Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development
Execute plugin after saving C:B workspace?
cacb:
I have managed to get my plugin to work, more or less (a number of rough edges still). It runs just after build (cbEVT_COMPILER_FINISHED) which is nice in many ways. But I can now see that I have hard coded a couple of things that should be user configurable, so I have a couple of questions:
As I understand it, the "settings" for a plugin is accessed in C::B via Tools -> Plugins if the plugin has created a dialog for it in its GetConfigurationPanel() overload. Is that correct?
If I have such a dialog with settings that should persist also after closing and restarting Code::Blocks, where would I store those values? In a normal application I would perhaps use wxConfig for that, but how does this work for a Code::Blocks plugin? Is maybe the correct way to use Manager::Get()->GetConfigManager("MyPluginName") and obtain a ConfigManager* where I simply use standard primitives like Read/Write in much the same way as for wxConfig?
Miguel Gimenez:
You can use the tidycmt plugin as reference, it uses these two methods to show/save settings:
--- Code: ---cbConfigurationPanel* TidyCmt::GetConfigurationPanel(wxWindow* parent)
void TidyCmt::ConfigurePlugin(const TidyCmtConfig& tcc)
--- End code ---
and a custom panel derived from cbConfigurationPanel (TidyCmtSettingsWrapper).
cacb:
Thank you, that is useful. However, on Windows I have tidycmt enabled but I can't find where its show/save settings is displayed in the C::B gui. It does not show in the Plugins menu and I can't find it anywhere else either (settings). To be usable as a reference I need to see it working.
What I hope to do is
1. Make my plugin be listed in the Plugins Menu and when I select it, a settings dialog show up (similar to Symbols Table Plugin maybe).
2. Make it add a menu entry in the File menu (e.g. File -> Export ) where it would perform the same operation without requiring a Compilation
So far I have figured out that only plugins of type "ptTool" show up in the Plugins menu, but I can't make it a cbToolPlugin because I think that hides things I need to do for # 2 (I could be wrong). I tried to make my plugin return type "pTool" and that made it show up in the Plugins Menu, but it crashed when I clicked it since it doesn't return a dialog at present.
Would implementing ConfigurePlugin using a wrapper like TidyCmt::GetConfigurationPanel solve that? I can't figure this bit out since I never saw the tidycmt gui, and I think I need a dialog, not a panel.
EDIT: I finally found that the tidycmt panel GUI is very well hidden in Project -> Properties as "EditorConfig options" tab far to the right. So now I know where it is. But this is not the kind of feature I want to duplicate. I think I want the same as a cbToolPlugin but where the BuildMenu function is not hidden as it is in cbToolPlugin
Miguel Gimenez:
I see it under Settings -> Editor -> tidycmt. The panel you supply will be shown inside the Settings window.
Navigation
[0] Message Index
[*] Previous page
Go to full version