Author Topic: HexEdit plugin  (Read 33360 times)

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
HexEdit plugin
« on: July 11, 2008, 12:14:16 am »
Looks like number of plugins is increasing :)

Here's my proposal: HexEditor.

I really missed that feature in C::B and hope that other will find it usefull :)

It's also good excercise to write such code (I've already found some bugs in wx and/or wxSmith while writing this plugin). It's not yet perfect so do not expect some superb features - only simple edition for now but some features have already been put onto my task list.

Regards
   BYO



[attachment deleted by admin]
« Last Edit: July 14, 2008, 10:13:51 pm by byo »

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5177
Re: HexEdit plugin
« Reply #1 on: July 11, 2008, 12:41:39 pm »
Thanks.

Some feedback :

* ctrl-z (undo) does not work
* selecting (ctrl or mouse) does not work
* tab heading shows different as regular files
   Example : I open a regular cpp file --> tab header says : src\MyFile.cpp, but hexeditor just says : Myfile.cpp
* when I have a file open in the internal editor and the hexeditor : changes are not communicated (not while editing, but also not after saving the changes) [change in hexeditor save --> other tab has no clue of change, you first need to remove focus from CB], the other way : change in internal editor, even having CB loose focus will not trigger the hexeditor to reload.

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: HexEdit plugin
« Reply #2 on: July 11, 2008, 08:34:51 pm »
* ctrl-z (undo) does not work

Currently no undo yet :)

Quote
* selecting (ctrl or mouse) does not work
* tab heading shows different as regular files
   Example : I open a regular cpp file --> tab header says : src\MyFile.cpp, but hexeditor just says : Myfile.cpp

Should be easy :)

Quote
* when I have a file open in the internal editor and the hexeditor : changes are not communicated (not while editing, but also not after saving the changes) [change in hexeditor save --> other tab has no clue of change, you first need to remove focus from CB], the other way : change in internal editor, even having CB loose focus will not trigger the hexeditor to reload.

Opening hexeditor should be either forbidden when the file is opened in other editor or it should ask for closing first. I thought about some synchronization but it's rather hard task, especially when dealing with different encodings.

BTW. I forgot to mention that this editor is available in project manager - just right click on ther file and select "Open With" from the popup menu.

Regards
   BYO

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: HexEdit plugin
« Reply #3 on: July 11, 2008, 10:57:54 pm »
Uploaded version 0.2 :)

Features added:
* Mouse selection support
* Preview of value under cursor (byte, word, dword, float, double, long double)
* Use settings of base editor to produce tab title (don't know how to update after config changes yet)
* Prevent from opening hex editor when file is already open in any other editor

Regards
  BYO

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: HexEdit plugin
« Reply #4 on: July 13, 2008, 04:30:34 pm »
Uploaded version 0.2 :)
Not sure if this was intended, but navigating using the cursor keys seems now to be broken to me.

Other than that: GREAT work again, byo...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: HexEdit plugin
« Reply #5 on: July 14, 2008, 10:18:34 pm »
Updated version 0.3: Undo / Redo support, probably fixes issues with keyboard navigation (at least works perfectly on linux ;) ).

Warning: Do not open resources in this project using wxSmith compiled from sources before rev 5121, otherwise HexEdit won't get all keyboard events (caused by some bug in either wxWidgets or wxSmith - I did't figure out yet which one ;))

Regards
   BYO

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: HexEdit plugin
« Reply #6 on: July 15, 2008, 04:46:20 pm »
Updated version 0.3: Undo / Redo support, probably fixes issues with keyboard navigation (at least works perfectly on linux ;) ).
Nope, not fixed yet. But it's a funny behaviour:

- you click on a number -> it gets selected.
- you move the cursor downwards - the selection remains
- you continue moving the cursor downwards and suddenly the panel scrolls, but the selection remains.

So it seems the cursor movement does indeed "something" but not visible to the user as the selection only changes when clicking with the mouse.

Very confusing... :-(
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline mariocup

  • Developer
  • Lives here!
  • *****
  • Posts: 587
Re: HexEdit plugin
« Reply #7 on: July 17, 2008, 04:41:31 pm »
Hi Byo,

I am using your Hex-Editor and it is almost perfect. What and my colleagues are missing is a insert and delete modus in the hex editor. It would be great to have this feature too, but perhaps it is already on your todo list :D

Bye,

Mario

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: HexEdit plugin
« Reply #8 on: July 17, 2008, 11:22:09 pm »
Hi Byo,

I am using your Hex-Editor and it is almost perfect. What and my colleagues are missing is a insert and delete modus in the hex editor. It would be great to have this feature too, but perhaps it is already on your todo list :D

Bye,

Mario

In fact the code is almost ready now - only need to bind proper keys in editor and test the code (especially undo/redo features) :)

BYO

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: HexEdit plugin
« Reply #9 on: July 17, 2008, 11:27:17 pm »
In fact the code is almost ready now
*sniff* What about the "wrong highlighting  when navigating with cursor keys" bug? :cry:
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: HexEdit plugin
« Reply #10 on: July 18, 2008, 12:30:32 am »
In fact the code is almost ready now
*sniff* What about the "wrong highlighting  when navigating with cursor keys" bug? :cry:

That's also fixed (I hope so), working on Linux and WinXP, currently I'm preparing to add sources to repository and it's not easy task (huh, those autotools...).

The quick fix for the 0.3 version is to replace the line 88 in HexEditPanel.cpp:
Code: [Select]
m_DrawArea = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE, _T("ID_PANEL1"));
with this one:

Code: [Select]
    m_DrawArea = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS|wxFULL_REPAINT_ON_RESIZE, _T("ID_PANEL1"));
Regards
   BYO

Offline krgh

  • Single posting newcomer
  • *
  • Posts: 7
Re: HexEdit plugin
« Reply #11 on: July 18, 2008, 06:39:29 am »
Hi BYO,

Just a small request. Can you provide a prebuilt  hex-editor plugin along with the source. i do not have compiler to compile the source.

TIA

Regards
Gururaja

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5177
Re: HexEdit plugin
« Reply #12 on: July 18, 2008, 07:20:10 am »
Quote
That's also fixed (I hope so), working on Linux and WinXP, currently I'm preparing to add sources to repository and it's not easy task (huh, those autotools...).

Tell me about it, well if you need help, I know my way around in that swamp ;-)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: HexEdit plugin
« Reply #13 on: July 18, 2008, 09:22:25 am »
That's also fixed (I hope so), working on Linux and WinXP, currently I'm preparing to add sources to repository and it's not easy task (huh, those autotools...).
Oh, that's nice and working. Thanks! :-)

BTW: If you want to, please use the project file I have attached for the commit (to contrib plugins). This would ensure a consistent style.

[attachment deleted by admin]
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: HexEdit plugin
« Reply #14 on: July 18, 2008, 08:07:51 pm »
BTW: If you want to, please use the project file I have attached for the commit (to contrib plugins). This would ensure a consistent style.

Yup, I'll use it :)

Tell me about it, well if you need help, I know my way around in that swamp ;-)

I hope that I found the way through :) But I need someone to test if the changes were correct. Right now I've committed the changes (rev 5137) and it looks like it compiles fine (but I didn't test it from fresh checked-out copy)

Regards
   BYO