I need this event for a plugin.
I define the event in "src/include/sdk_events.h" and "src/sdk/sdk_events.cpp"
1) I fire it in the ProjectManager::CloseWorkspace() method. ( see code below ) - Is that correct ?
2) Are you ok for a patch ?
bool ProjectManager::CloseWorkspace()
{
bool result = false;
m_IsClosingWorkspace = true;
if (m_pWorkspace)
{
if (!m_ui->QueryCloseWorkspace())
{
m_IsClosingWorkspace = false;
return false;
}
// ----------------------------------------------------------------->>
// Fire-up cbEVT_WORKSPACE_CLOSE_BEGIN event
CodeBlocksEvent event(cbEVT_WORKSPACE_CLOSE_BEGIN);
Manager::Get()->GetPluginManager()->NotifyPlugins(event);
// -----------------------------------------------------------------<<
// m_ui->QueryCloseWorkspace asked for saving workspace AND projects, no need to do again
if (!CloseAllProjects(true))
{
m_IsClosingWorkspace = false;
return false;
}
delete m_pWorkspace;
m_pWorkspace = nullptr;
m_ui->CloseWorkspace();
result = true;
}
else
result = CloseAllProjects(false);
m_IsClosingWorkspace = false;
WorkspaceChanged();
return result;
}
Here is the patch for svn10499 :
Files modified : sdk_events.h - sdk_events.cpp - projectmanager.cpp
cd svn10499/trunk
patch -R -p2 < svn10499.cbEVT_WORKSPACE_CLOSE.patch
( Hey, the new forum server rocks ! )
OK, I'll push it some time next week.
p.s. Don't use -R when generating patches.
You did replace some "_CLOSE_" words in my patch by "_CLOSING_" ones, but in sdk_events.h :
extern EVTIMPORT const wxEventType cbEVT_WORKSPACE_CLOSING_BEGIN;
#define EVT_WORKSPACE_CLOSING_BEGIN(fn) DECLARE_EVENT_TABLE_ENTRY( cbEVT_WORKSPACE_CLOSE_BEGIN, -1, -1, (wxObjectEventFunction)(wxEventFunction)(CodeBlocksEventFunction)&fn, (wxObject *) NULL ),
extern EVTIMPORT const wxEventType cbEVT_WORKSPACE_CLOSING_COMPLETE;
#define EVT_WORKSPACE_CLOSING_COMPLETE(fn) DECLARE_EVENT_TABLE_ENTRY( cbEVT_WORKSPACE_CLOSE_COMPLETE, -1, -1, (wxObjectEventFunction)(wxEventFunction)(CodeBlocksEventFunction)&fn, (wxObject *) NULL ),
you forgot "_CLOSE_" words in the DECLARE_EVENT_TABLE_ENTRY(...), so these macros wont be usable.