Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

Execute plugin after saving C:B workspace?

(1/2) > >>

I have lots of Code::Blocks workspaces and I am considering exporting information found in them into "another format" (it doesn't matter what that is at this point).

I could write a completely separate tool to read C::B workspace and project files, but maybe a better idea is to write some form of C::B plugin that would always execute when a workspace is saved. I have been trying to read up on plugins from the Wiki, and there is useful information there, but it isn't clear to me how to make the plugin do its thing after saving a workspace. Is there some list of C::B events that a plugin can react to to achieve that?

For the sake of simplicity, let's assume there is no need for a plugin GUI. All that is needed is access to the workspace & project information + some event to trigger execution after saving the workspace.

Any suggestions?

Miguel Gimenez:
You can use the rndgen plugin as starting point, changing cbEVT_EDITOR_BEFORE_SAVE to cbEVT_WORKSPACE_CLOSING_BEGIN (or similar, see sdk_events.h)

Thank you, that was indeed a useful reply. I can see it is one of the contrib plugins.

Through your reply I also discovered

I will see what this means. I guess you need to use the same wxWidgets  in plugins that was used for building C::B, and that will be ok for me on Linux, as I build C::B from source there. Under Windows probably not, as I use exclusively Nightly Builds of C::B there, and wxWidgets compiled with MSVC. So most likely such a plugin would be Linux only.

In any case, I might give it a try. Thanks!

Miguel Gimenez:
The list of events in the wiki is incomplete (cbEVT_PROJECT_FILE_RENAMED is missing), but currently it can't be edited.

I have played around a bit with this under Kubuntu 20.04, and the plugin events seem to work quite nicely. I found that cbEVT_COMPILER_FINISHED is another good candidate. Thanks for the help.

If I can get the plugin to do something useful I will put it on github and mention it here.


[0] Message Index

[#] Next page

Go to full version