News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

event in codeblocks being sent on a "undo" or "redo" command

Started by frithjofh, May 26, 2010, 11:51:25 PM

Previous topic - Next topic

frithjofh

Hi everybody,

is there an event in c::b which is emitted when the user calls the "undo" or "redo" functionality either by tool button or menu? I looked around in the forum and in the source code of c::b and didn't find anything ( which doesn't mean that there may be none  :) ). Such an event would come in handy for instance for a plugin to notice that there was a change in the active editor and adapt accordingly.

Regards

frithjofh
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100

ollydbg

I think the cbEVT_EDITOR_UPDATE_UI event is the right event you want.
see the posts around Re: A feature request about CC and BrowseTracker
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

frithjofh

HI, and thank you for the answer.

Isn't the cbEVT_EDITOR_UPDATE fired everytime any change happens in the editor, even if somebody adds a whitespace? If some body writes a word, it gets fired for every char written, right? Doesn't that mean really a lot of traffic if I use it in a plugin? I mean additional traffic to the c::b app if the plugin does some calculating, checking or parsing of the editors contents on every cbEVT_EDITOR_UPDATE. Scares me a bit ...

But I'll give it a try  :D and see what happens. If this is the way to do it ...

Regards

frithjofh
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100

ollydbg

QuoteIsn't the cbEVT_EDITOR_UPDATE fired everytime any change happens in the editor, even if somebody adds a whitespace?

I think it is. But you can check the scintilla document(this message is send from the scintilla control, cb just do a wrapper) for more information. Currently, this event is used to record the "edit position" in the browser tracker plugin. :D
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Jenna

wxScintilla sends the wxEVT_SCI_MODIFIED.
This event should be send with notification-type wxSCI_PERFORMED_UNDO or wxSCI_PERFORMED_REDO if an undo or redo is done.

See wxScintilla.h for the notification-types and cbEditor::OnEditorModified(wxScintillaEvent& event) for an example how to filter the notification-type.

frithjofh

Thank you very much for these hints. I remember looking over these files but I guess I got lost in code ... :?

By the way: that new release of c::b, does it already have some schedule for shipping?

regards

frithjofh
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100