Sunday, October 11, 2009

Living during SVN downtime

We had a svn downtime at the weekend and I decided to work on something different. I was bored because I don't like to work on monodevelop without svn.
I've decided to do something useful and made a little hex editor user control using spare parts of the text editor control and it was very fun.

The control feels fast (at least compared to the other hex editors I tested). It could re-use red-black tree for data storage and almost all data structures used by the text editor.

Some of the code changed, for example it's no longer needed to have locations as line/columns.
Instead just the offset is used (btw. all calculations done by the hex editor are much simpler than in the text editor). It still needs some work, for example the undo/redo logic and cut&paste needs to be 'translated'. But this should be easy - I may do it during the next svn downtime :)

From the user point of view it feels like the monodevelop text editor. It re-uses some of the drawing code and event handler logic.
  • Styling (could share style files with the text editor)
  • "Margin" model
  • Caret blinking/drawing
  • Bookmarks
  • Mouse behavior (selection etc.)
  • It can do bookmarks, selection, zooming, group bytes, words, longs
After the 2.2 release I'll include a hex editor view in monodevelop. From time to time I need to view the hex code of files, then I can do this without leaving monodevelop.

I wonder if anybody dares to make a stand alone version of the monodevelop hex editor and text editor. Both controls can easily be re-used in a standalone application.