Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: byo on July 11, 2008, 12:14:16 am

Title: HexEdit plugin
Post by: byo 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]
Title: Re: HexEdit plugin
Post by: killerbot 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.
Title: Re: HexEdit plugin
Post by: byo 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
Title: Re: HexEdit plugin
Post by: byo 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
Title: Re: HexEdit plugin
Post by: MortenMacFly 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...
Title: Re: HexEdit plugin
Post by: byo 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
Title: Re: HexEdit plugin
Post by: MortenMacFly 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... :-(
Title: Re: HexEdit plugin
Post by: mariocup 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
Title: Re: HexEdit plugin
Post by: byo 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
Title: Re: HexEdit plugin
Post by: MortenMacFly 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:
Title: Re: HexEdit plugin
Post by: byo 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
m_DrawArea = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE, _T("ID_PANEL1"));

with this one:

Code
    m_DrawArea = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS|wxFULL_REPAINT_ON_RESIZE, _T("ID_PANEL1"));

Regards
   BYO
Title: Re: HexEdit plugin
Post by: krgh 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
Title: Re: HexEdit plugin
Post by: killerbot 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 ;-)
Title: Re: HexEdit plugin
Post by: MortenMacFly 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]
Title: Re: HexEdit plugin
Post by: byo 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
Title: Re: HexEdit plugin
Post by: killerbot on July 18, 2008, 08:16:36 pm
checking this right now.

By the way, I think all things related to a plug-in should be in the same case.

So some things are not 100% correct I think  :

manifest.xml --> HexEditor
PluginRegistrant<HexEditor> reg( _T("HexEditor") );

BUT :
libhexeditor
hexeditor.zip


EDIT : the suggestion is to "CamelCase'
Title: Re: HexEdit plugin
Post by: killerbot on July 18, 2008, 08:24:55 pm
little update rev 5138
Title: Re: HexEdit plugin
Post by: killerbot on July 18, 2008, 08:42:42 pm
A little bit of feedback :

1) creating a selection doesn't seem to work (keyboard or mouse)
2) could you make the value preview checked by default, it's so interesting, but it is not retained after you close the file. My *personal* feeling is that people will turn on more often then actually turn it off
Title: Re: HexEdit plugin
Post by: byo on July 18, 2008, 09:02:21 pm
Thanks killerbot :)

manifest.xml --> HexEditor
PluginRegistrant<HexEditor> reg( _T("HexEditor") );

BUT :
libhexeditor
hexeditor.zip

Hmm, right, I'll try to fix that today. The only problem is that if someone has already compiled HexEditor adn did make install and will do the same after updating, he will have two instances of hexeditor plugin. So I'll better do this quick...

BYO
Title: Re: HexEdit plugin
Post by: killerbot on July 18, 2008, 09:11:20 pm
Quote
The only problem is that if someone has already compiled HexEditor adn did make install
  yep ;-)
Title: Re: HexEdit plugin
Post by: byo on July 18, 2008, 11:11:44 pm
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

I tried to build precompiled version but I couldn't make it working with 8.02 version (probably different wx version, sdk should be rather compatible), maybe some nightly build will be out soon.

Regards
   BYO
Title: Re: HexEdit plugin
Post by: killerbot on July 18, 2008, 11:16:21 pm
Quote
I tried to build precompiled version but I couldn't make it working with 8.02 version (probably different wx version, sdk should be rather compatible), maybe some nightly build will be out soon.
normally tomorrow :-)
Title: Re: HexEdit plugin
Post by: MortenMacFly on July 18, 2008, 11:19:40 pm
normally tomorrow :-)
OT: Which reminds me: Should we rename this to "weekly" / "monthly" builds? I'd prefer the first... What's the current idea/state of nightlies anyways?!
Title: Re: HexEdit plugin
Post by: killerbot on July 18, 2008, 11:24:53 pm
normally every night providing there are new '+' or '*' commits. But I have to admit, I have been a little bit lazy the last couple of weeks, and we have had several periods without commits. But from tomorrow on should be back at full force.
Title: Re: HexEdit plugin
Post by: killerbot on July 19, 2008, 10:56:22 am
Quote
   HexEdit:
* Made the "Value Preview" option enabled by default
* Some small project adjustments
* Removed some warnings

The value preview checked by default doesn't seem to work for me.
Title: Re: HexEdit plugin
Post by: byo on July 19, 2008, 12:11:37 pm
The value preview checked by default doesn't seem to work for me.

Auch, I was working on my local project (not the one added into repository), just give me few minutes :)

BYO
Title: Re: HexEdit plugin
Post by: killerbot on July 19, 2008, 12:32:35 pm
The value preview checked by default doesn't seem to work for me.

Auch, I was working on my local project (not the one added into repository), just give me few minutes :)

BYO
confirmed :-)
Title: Re: HexEdit plugin
Post by: ironhead on July 20, 2008, 01:12:17 pm
Hexedit causes a crash in svn 5144 when using the cursor keys (left, down, right, up).  Using the mouse to place the cursor works fine.

I'm running XP Pro and I've compiled C::B using MinGW.
Title: Re: HexEdit plugin
Post by: Max on July 23, 2008, 08:30:52 pm
Hexedit causes a crash in svn 5144 when using the cursor keys (left, down, right, up).  Using the mouse to place the cursor works fine.

I'm running XP Pro and I've compiled C::B using MinGW.

Confirmed. I'm observing this bug too. Windows XN SP3 CB 5153.

max
Title: Re: HexEdit plugin
Post by: byo on July 23, 2008, 10:15:20 pm
Hexedit causes a crash in svn 5144 when using the cursor keys (left, down, right, up).  Using the mouse to place the cursor works fine.

I'm running XP Pro and I've compiled C::B using MinGW.

Thanks for reporting, I'm investigating it right now :)

Regards
   BYO
Title: Re: HexEdit plugin
Post by: ironhead on July 24, 2008, 02:12:46 pm
Thanks for reporting, I'm investigating it right now :)

I updated my local repository to svn 5160 and everything is working fine once again, thanx! :)
Title: Re: HexEdit plugin
Post by: dmoore on July 29, 2008, 10:31:38 pm
nice work, byo!

mario wanted to be able to open files in the hex editor from the file browser window in my ShellExtensions plugin, so I provide this small patch. Unfortunately, I have to clutter your plugin class with some methods and a wxString member to hold the name of the file that the user has clicked in the browser.

[attachment deleted by admin]
Title: Re: HexEdit plugin
Post by: mariocup on July 30, 2008, 08:25:57 am
Hi dmoore,

cool :D I will try it as soon as possible.

Bye,

Mario
Title: Re: HexEdit plugin
Post by: byo on July 30, 2008, 03:03:48 pm
nice work, byo!

mario wanted to be able to open files in the hex editor from the file browser window in my ShellExtensions plugin, so I provide this small patch. Unfortunately, I have to clutter your plugin class with some methods and a wxString member to hold the name of the file that the user has clicked in the browser.

Thanks for the patch. I'll apply it in next few days (I have some work in progress code now so it must be finished first).

Regards
   BYO
Title: Re: HexEdit plugin
Post by: mariocup on October 07, 2008, 01:10:26 pm
Hi Byo,

I am just playing around with the HexEditor. I was thinking about if the File-> Open with HexEditor could be removed and integrated in the following manner:

- The File->Open Menu will open the browse dialogue
- Optional: There could be a file mask for HexFiles which the user selects
- Since CB then would pop-up (What to do dialogue) the user should be able to select:
...
Open with CB editor
Open with HexEditor (new entry)

optional: If possible then the file extension handler would register the extension with the HexEditor and opening these files will result in a Hex-view.

I personally would prefer to have a context menu like Swap HexEditor/Editor to access the HexEditor.

Bye,

Mario
Title: Re: HexEdit plugin
Post by: byo on October 07, 2008, 07:31:22 pm
- Optional: There could be a file mask for HexFiles which the user selects

We would have to change this in the core code since sdk doesn't allow adding custom extensions (good candidate for feature request ? ;) )

Quote
- Since CB then would pop-up (What to do dialogue) the user should be able to select:
...
Open with CB editor
Open with HexEditor (new entry)

That would confuse usual users which doesn't need the hex editor at all.

Quote
optional: If possible then the file extension handler would register the extension with the HexEditor and opening these files will result in a Hex-view.

This could be done, but I wanted HexEditor to open all types of files (including those that are opened in standard editor like .cpp or anything else).

Anyway, which extensions did you want to be opened by hexeditor by default ?

Quote
I personally would prefer to have a context menu like Swap HexEditor/Editor to access the HexEditor.

Do you mean like switching between header and source file ?


Regards
   BYO
Title: Re: HexEdit plugin
Post by: mariocup on October 07, 2008, 08:30:07 pm
Quote
This could be done, but I wanted HexEditor to open all types of files (including those that are opened in standard editor like .cpp or anything else).

Anyway, which extensions did you want to be opened by hexeditor by default ?

Perhaps *.bin; *.hex; *.elf; *.exe; ???

Quote
Do you mean like switching between header and source file ?

Exactly.

Sometimes it is useful to have a fixed number of columns in the hex-editor to see e.g. a multiple of 16-Byte in a row. Is this feature already available in the HexEditor?

Bye,

Mario
Title: Re: HexEdit plugin
Post by: webbesen on October 30, 2008, 11:27:08 pm
I really like the Hexeditor. Nice work.
However as Mario already suggested it would be great to be able to specify how many bits/bytes to show in a row.
Title: Re: HexEdit plugin
Post by: danselmi on October 31, 2008, 11:48:40 am
Hi

Isn't it is possible to extend CB that it opens *.bin, *.elf ... within the hex editor if the hex
editor implements the mime plugin interface (deriving from cbMimePlugin) and say it can open .bin .elf..
and create a lexer configuration like this?
Code
<?xml version="1.0"?>
<!DOCTYPE CodeBlocks_lexer_properties>
<CodeBlocks_lexer_properties>
<Lexer name="HexEditor binary"
index="20"
filemasks="*.bin,*.elf,*.exe">
</Lexer>
</CodeBlocks_lexer_properties>

So CB shows the entry in the file open dialog.

regards danselmi
Title: Re: HexEdit plugin
Post by: byo on November 03, 2008, 11:38:10 pm
I really like the Hexeditor. Nice work.
However as Mario already suggested it would be great to be able to specify how many bits/bytes to show in a row.

Already working on that, but it turned out not to be so easy task (I don't want to make some ugly workarounds ;) ). Just don't have much free time now :(

Isn't it is possible to extend CB that it opens *.bin, *.elf ... within the hex editor if the hex
editor implements the mime plugin interface (deriving from cbMimePlugin) and say it can open .bin .elf..

Making C::B automatically open those exstensions you request is easy task. The problem is that even if you register mime plugin, registered extensions won't show up in the file open dialog - you'll have to select "Show all file types" or something like this.

Regards
   BYO
Title: Re: HexEdit plugin
Post by: danselmi on November 04, 2008, 10:54:22 am
The (misused?) lexer configuration file will make the file open dialog
show an entry for this filetypes (I have tested it).
And the registered mime plugin will open the file.

regards danselmi
Title: Re: HexEdit plugin
Post by: MortenMacFly on November 04, 2008, 01:11:18 pm
The problem is that even if you register mime plugin, registered extensions won't show up in the file open dialog - you'll have to select "Show all file types" or something like this.
Nice catch! So we should change the core to do so. Anyways - the file extension handling is ugly in general and could need some overhaul / refactoring.
Title: Re: HexEdit plugin
Post by: ouch on January 21, 2009, 12:04:20 am
any chance on having the search menu working on a hex editor opened file?

At least just the "find" one anyway...

also something that searches for hex strings as well as text would rock too. :)

good job, doesn't quite replace HxD as is though. ;)
Title: Re: HexEdit plugin
Post by: byo on January 21, 2009, 11:13:58 pm
Yeah, the plugin has some issues :/ Unfortunately I don't have enough time to work on it right now (for next few weeks I suppose). So please be patient :) Maybe anybody wants to help ?

BYO
Title: Re: HexEdit plugin
Post by: byo on February 14, 2009, 12:03:35 pm
Hi. Those who observe HexEdit in svn log may notice that I've reached the 0.5 version. This version include:


The version 0.5 also means that I've reached the end of my roadmap for this plugin. This means that from now on in probably next few months I'll only fix bugs, maybe add some small features in meantime. I need to focus on other tasks right now :) If anybody has some feature request, please send an PM to me.

Also keep in mind that the 0.5 version is not bug-free. I did my best to create product with good quality and especially tested the code that may damage some data. But no guarantees are given.

Regards
   BYO
Title: Re: HexEdit plugin
Post by: mariocup on February 14, 2009, 01:53:40 pm
Hi byo,

if it is OK for you, I would like to start the documentation of the HexEditor plugin to complete the existing documentation for Code::Blocks plugins. Perhaps there are some "hidden" features of your plugin that should be mentioned in the documentation: So please give me some hints for that kind of features.

Title: Re: HexEdit plugin
Post by: byo on February 16, 2009, 09:20:48 pm
if it is OK for you, I would like to start the documentation of the HexEditor plugin to complete the existing documentation for Code::Blocks plugins. Perhaps there are some "hidden" features of your plugin that should be mentioned in the documentation: So please give me some hints for that kind of features.

Sure, just give me some time and I'll prepare full features list :)

BYO
Title: Re: HexEdit plugin
Post by: baska on August 19, 2009, 01:55:47 pm
Hi,

I am new here. Where can I download this plugin?
Title: Re: HexEdit plugin
Post by: Jenna on August 19, 2009, 02:05:29 pm
Hi,

I am new here. Where can I download this plugin?

No need to download it, because it's part of the contrib-plugins.
Title: Re: HexEdit plugin
Post by: baska on October 15, 2009, 10:56:01 am
Hi,

I downloaded Code::Blocks 8.02 (new release) in binary form for Windows and installed with option "Full (all plugins)".
But there are no HexEditor plugin installed.

Could anybody send me HexEditor plugin in binary for Windows, which I can install/copy to Code::Blocks.

Thanks in advance.
Title: Re: HexEdit plugin
Post by: killerbot on October 15, 2009, 11:41:13 am
download a recent nightly build :-)