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

Workspace loading and Active Project

(1/5) > >>

daniloz:
Hi All,

I'm working in a plugin and I'd like to know, when the user loads a workspace with several projects, after all projects are loaded, which is the active project.

Any ideas? I haven't found any event defined for that...

MortenMacFly:

--- Quote from: daniloz on October 27, 2011, 02:57:09 pm ---Any ideas? I haven't found any event defined for that...

--- End quote ---
A loading complete event does not exist.

However, you can use the project activated event.

If you really need an event for the case "workspace completely loaded", provide a patch accordingly. It should be really simple to implement. Create an event in sdk_events{.cpp/.h} and instrument the method "ProjectManager::LoadWorkspace" accordingly.

Jenna:
There is an event:
cbEVT_PROJECT_ACTIVATE
The event provides the active project as pointer:


--- Code: ---void MyPlugin::OnProjectActivated(CodeBlocksEvent& event)
{
    // project will be apointer to the active project
    cbProject* project = event.GetProject();
    // first check if project is not NULL
    if (project)
    {
        // do something meaningful here
    }
    event.Skip();
}

--- End code ---

Jenna:

--- Quote from: MortenMacFly on October 27, 2011, 04:15:01 pm ---
--- Quote from: daniloz on October 27, 2011, 02:57:09 pm ---Any ideas? I haven't found any event defined for that...

--- End quote ---
A loading complete event does not exist.

However, you can use the project activated event.

If you really need an event for the case "workspace completely loaded", provide a patch accordingly. It should be really simple to implement. Create an event in sdk_events{.cpp/.h} and instrument the method "ProjectManager::LoadWorkspace" accordingly.

--- End quote ---
If I see it right, cbEVT_WORKSPACE_CHANGED is send from EndLoadingWorkspace().

daniloz:

--- Quote from: jens on October 27, 2011, 04:19:38 pm ---There is an event:
cbEVT_PROJECT_ACTIVATE
The event provides the active project as pointer:

--- End quote ---

Hi jens,

I am aware of it and I'm using it for the case when the use changes the project. And I was also assuming that this event got triggered after a workspace loading, but it's not, actually.

Is this a feature or a bug?

Navigation

[0] Message Index

[#] Next page

Go to full version