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

a Qt plugin : QtPregenForCB => AddOnForQt

<< < (4/15) > >>

Sorry, have no time to do it...


--- Quote from: oBFusCATed on February 13, 2015, 09:40:22 am ---Sorry, have no time to do it...

--- End quote ---
So you had no time but I had. Indeed, it works. I think you are wrong on that topic. And reverting a commit without proof that is does NOT work is not nice you know...  :(

I've not reverted it because it doesn't work, but because it is bad design (this is a personal opinion/vision).
I would have reverted it even if I've tried it and it has worked.
Obviously we need to implement this feature as a new event that is fired at the correct time and it doesn't depend on a state variable.

p.s. Can you reason about why it works? How on earth the plugin matches correctly the id of the context menu items, when it has never requested them?

Thank you for taking the time to test this plugin.
Is it possible to use the 'Build log' to display messages generated by the pre-generate ?
This would be more consistent than display them in 'Code::Blocks log'.


--- Quote ---when it has never requested them
--- End quote ---
See 2-

1- It retrieves the ids menus created by the plugin 'CompilerGcc' by :

--- Code: ---void QtPregen::BuildMenu(wxMenuBar* menuBar)
if (!IsAttached())

int pos = menuBar->FindMenu(_("Build"));
if (pos !=-1) {
wxMenu * builder = menuBar->GetMenu(pos);
m_IdBuild = builder->FindItem(_("Build"));
m_IdCompile = builder->FindItem(_("Compile current file"));
m_IdRun = builder->FindItem(_("Run"));
m_IdBuildRun = builder->FindItem(_("Build and run"));
m_IdRebuild = builder->FindItem(_("Rebuild"));
m_IdClean = builder->FindItem(_("Clean"));
--- End code ---

2- It retrieves the ids context menus created by the plugin 'CompilerGcc' by :

--- Code: ---void QtPregen::BuildModuleMenu(const ModuleType type, wxMenu* menu, const FileTreeData* data)
if (!IsAttached())

// we 're only interested in m_project manager's menus
    if (!menu || type != mtProjectManager)

// right click on item menu ...else -> 0
    if (data) {
    FileTreeData::FileTreeDataKind typedata  = data->GetKind();
    // ... click project
bool preproject = typedata == FileTreeData::ftdkProject  ;
// ... click file
bool prefile = typedata == FileTreeData::ftdkFile ;

if (preproject)  {
// popup menu on a project
m_IdpClean  = menu->FindItem(_("Clean"));
m_IdpBuild  = menu->FindItem(_("Build"));
m_IdpRebuild  = menu->FindItem(_("Rebuild"));
if (prefile) {
// popup menu on a file
m_IdfBuild  = menu->FindItem(_("Build file"));
m_IdfClean  = menu->FindItem(_("Clean file"));
--- End code ---

3- Id are used to select the treatment  in :

--- Code: ---void QtPregen::OnPrebuild(CodeBlocksEvent& event)
      int eventId = event.GetId();

--- End code ---
Note that from one session to another, id's remain the same!
While compiling a new version of svn 'Code::Block'.

--- Quote ---Obviously we need to implement this feature as a new event that is fired at the correct time and it doesn't depend on a state variable.
--- End quote ---

Well, how so ?

- new 'QtPregenForCB-0.2.4'
- all private variables are prefixed with 'm_',
- improved user dialogs on error Qt utilities
Best regards


[0] Message Index

[#] Next page

[*] Previous page

Go to full version