Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: frithjofh on May 26, 2010, 11:51:25 pm

Title: event in codeblocks being sent on a "undo" or "redo" command
Post by: frithjofh on May 26, 2010, 11:51:25 pm
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
Title: Re: event in codeblocks being sent on a "undo" or "redo" command
Post by: ollydbg on May 27, 2010, 01:33:31 am
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 (http://forums.codeblocks.org/index.php/topic,10919.msg75225.html#msg75225)
Title: Re: event in codeblocks being sent on a "undo" or "redo" command
Post by: frithjofh on May 27, 2010, 10:09:06 am
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
Title: Re: event in codeblocks being sent on a "undo" or "redo" command
Post by: ollydbg on May 27, 2010, 10:14:16 am
Quote
Isn'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
Title: Re: event in codeblocks being sent on a "undo" or "redo" command
Post by: Jenna on May 27, 2010, 12:19:35 pm
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.
Title: Re: event in codeblocks being sent on a "undo" or "redo" command
Post by: frithjofh on May 27, 2010, 12:37:51 pm
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