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

a Qt plugin : QtPregenForCB => AddOnForQt

<< < (5/15) > >>

oBFusCATed:

--- Quote from: LETARTARE on February 15, 2015, 09:04:54 am ---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())
        return;

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

// 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"));
}
else
if (prefile) {
// popup menu on a file
m_IdfBuild  = menu->FindItem(_("Build file"));
m_IdfClean  = menu->FindItem(_("Clean file"));
}
      }
}
--- End code ---

--- End quote ---
What  a really clever hack. I'm stunned!



--- Quote from: LETARTARE on February 15, 2015, 09:04:54 am ---
--- 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 ?

--- End quote ---
1. Create new event or even two events. One for starting and one for finishing.
2. Make an enum with all the possible types of actions you're interested in
3. Inspect the switch in CompilerGCC::BuildStateManagement and in every interesting case statement fire the appropriate event.
4. Test if all this is reliable... And doesn't slow the build process.
5. Probably it will be good if these events can be used to cancel the build process.

oBFusCATed:

--- Quote from: LETARTARE on February 15, 2015, 09:04:54 am ---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'.

--- End quote ---
I don't think there is a way.
Loggers have no name or id, so you cannot query them to obtain the index.
Only the one that has created them knows their index and can use them.

LETARTARE:
@oBFusCATed

--- Quote ---What  a really clever hack. I'm stunned!
--- End quote ---
Sir, is it a mockery or not ?

oBFusCATed:
Hm. I don't think it is a mockery. I'm just amazed what you've done to solve your problem.  8)

p.s. Keep in mind that English is not my native language, so I may use the inappropriate words at times.

LETARTARE:
Hello,
I would rather. I also use 'Google Translation' and that's why I asked for you. It's over.


--- Quote ---3. Inspect the switch in CompilerGCC::BuildStateManagement and in every interesting case statement fire the appropriate event.
--- End quote ---
I do not know what to do ?
Regards

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version