Pecan, you could also use EVT_WORKSPACE_CHANGED, I put it there *EXACTLY* for that reason. When the new project has finished opening, the EVT_WORKSPACE_CHANGED is triggered. Perhaps you could use it in combination with EVT_PROJECT_OPEN..
Sorry, that won't work. Here's why:
The sequence of events when loading a project:
Loading a project
10:34:55: [1419125ms] EVT_EDITOR_DEACTIVATED [050C8B18][]
10:34:55: [1419125ms] EVT_EDITOR_ACTIVATED [050C8B18][]
10:34:55: [1419172ms] EVT_EDITOR_OPEN [050C8B18][EventsDisplay.cpp]
10:34:55: [1419187ms] EVT_EDITOR_DEACTIVATED [028EDA58][]
10:34:55: [1419187ms] EVT_EDITOR_ACTIVATED [028EDA58][]
10:34:55: [1419219ms] EVT_EDITOR_OPEN [028EDA58][EventsDisplay.h]
10:34:55: [1419234ms] EVT_EDITOR_DEACTIVATED [050C8B18][EventsDisplay.cpp]
10:34:55: [1419234ms] EVT_EDITOR_ACTIVATED [050C8B18][EventsDisplay.cpp]
10:34:55: [1419234ms] EVT_EDITOR_ACTIVATED [050C8B18][EventsDisplay.cpp]
10:34:55: [1419266ms] EVT_PROJECT_ACTIVATE[]
10:34:55: [1419266ms] EVT_PROJECT_OPEN
10:34:55: [1419266ms] EVT_EDITOR_DEACTIVATED [050C8B18][EventsDisplay.cpp]
10:34:55: [1419266ms] EVT_EDITOR_ACTIVATED [050C8B18][EventsDisplay.cpp]
10:34:55: [1419281ms] EVT_WORKSPACE_CHANGED[]
10:34:55: [1419281ms] EVT_WORKSPACE_CHANGED[]
Now closing the project
10:35:10: [1433953ms] EVT_PROJECT_CLOSE[]
10:35:10: [1433953ms] EVT_EDITOR_DEACTIVATED [05095BA8][]
10:35:10: [1433953ms] EVT_EDITOR_ACTIVATED [05095BA8][]
10:35:10: [1434062ms] EVT_EDITOR_CLOSE [050C8B18][unavailable]
10:35:10: [1434078ms] EVT_EDITOR_DEACTIVATED [05095BA8][Start here]
10:35:10: [1434094ms] EVT_EDITOR_ACTIVATED [05095BA8][Start here]
10:35:10: [1434094ms] EVT_EDITOR_CLOSE [028EDA58][unavailable]
10:35:10: [1434109ms] EVT_EDITOR_DEACTIVATED [05095BA8][Start here]
10:35:10: [1434109ms] EVT_EDITOR_ACTIVATED [05095BA8][Start here]
10:35:10: [1434125ms] EVT_WORKSPACE_CHANGED[]
10:35:10: [1434125ms] EVT_WORKSPACE_CHANGED[]
If you used EVT_WORKSPACE_CHANGED, you'd miss every open/activate on every editor.
If you wanted to wait until a project opened, you again would miss every editor.
The whole sequence is backwards. OR... I'm misunderstanding the purpose of the events.
http://www.savefile.com/files/848388
(http://www.savefile.com/files/848112)
Above is a url containing cbEventsDisplay.zip with source and .cbplugin for MSW .
Use Plugins/Manage Plugsin/Install new/ to install and remove it.
It'll open up a log in the upper left and log the events as they occur.
Well, I'm suggesting a workaround. Try adding a queue to your plugin.
Like
OnEditorActivate(...)
{
if(ProjectManager::IsBusy())
m_filequeue.insert(theeditor);
else
do_stuff_on_editor(theeditor);
}
OnEditorDeActivate(...)
{
if(ProjectManager::IsBusy())
m_filequeue.erase(theeditor);
else
undo_stuff_on_editor(theeditor);
}
OnWorkspaceChanged...
{
Do_stuff_on_filequeue();
filequeue.clear();
}
Since I don't really know what you're doing, I can't suggest a specific method, but what I do goes around those lines.
But yes, I agree that in this case, the PROJECT_OPEN should be triggered before.
The problem is WHAT WE WANT the events for.
Should we have a PROJECT_BEGIN_OPENING and PROJECT_FINISHED_OPENING events?
In any case, PROJECT_OPEN should go immediately *BEFORE* PROJECT_ACTIVATE. And PROJECT_CLOSE should go immediately *AFTER* PROJECT_DEACTIVATE for the events to have some coherence.
The real question is, if by doing this, we break existing functionality on the plugins.