Patch #3099 2010-12-11 16:13

martind

cbEVT_PROJECT_NEW message
Download
3099-cbEVT_PROJECT.patch (2.4 KB)
Category
Application::FeatureAdd
Status
Accepted
Close date
2011-02-03 20:14
Assigned to
mortenmacfly
Index: src/sdk/sdk_events.cpp
===================================================================
--- src/sdk/sdk_events.cpp    (revision 6892)
+++ src/sdk/sdk_events.cpp    (working copy)
@@ -87,6 +87,7 @@
 const wxEventType cbEVT_EDITOR_BREAKPOINT_DELETE = wxNewEventType();
 const wxEventType cbEVT_EDITOR_UPDATE_UI = wxNewEventType();
 // project events
+const wxEventType cbEVT_PROJECT_NEW = wxNewEventType();
 const wxEventType cbEVT_PROJECT_CLOSE = wxNewEventType();
 const wxEventType cbEVT_PROJECT_OPEN = wxNewEventType();
 const wxEventType cbEVT_PROJECT_SAVE = wxNewEventType();
Index: src/include/sdk_events.h
===================================================================
--- src/include/sdk_events.h    (revision 6892)
+++ src/include/sdk_events.h    (working copy)
@@ -249,6 +249,8 @@
 #define EVT_EDITOR_UPDATE_UI(fn) DECLARE_EVENT_TABLE_ENTRY( cbEVT_EDITOR_UPDATE_UI, -1, -1, (wxObjectEventFunction)(wxEventFunction)(CodeBlocksEventFunction)&fn, (wxObject *) NULL ),
 
 // project events
+extern EVTIMPORT const wxEventType cbEVT_PROJECT_NEW;
+#define EVT_PROJECT_NEW(fn) DECLARE_EVENT_TABLE_ENTRY( cbEVT_PROJECT_NEW, -1, -1, (wxObjectEventFunction)(wxEventFunction)(CodeBlocksEventFunction)&fn, (wxObject *) NULL ),
 extern EVTIMPORT const wxEventType cbEVT_PROJECT_CLOSE;
 #define EVT_PROJECT_CLOSE(fn) DECLARE_EVENT_TABLE_ENTRY( cbEVT_PROJECT_CLOSE, -1, -1, (wxObjectEventFunction)(wxEventFunction)(CodeBlocksEventFunction)&fn, (wxObject *) NULL ),
 extern EVTIMPORT const wxEventType cbEVT_PROJECT_OPEN;
Index: src/src/main.cpp
===================================================================
--- src/src/main.cpp    (revision 6892)
+++ src/src/main.cpp    (working copy)
@@ -2412,6 +2412,10 @@
         if (!prj && filename.IsEmpty())
             return;
 
+        // Send the new project event
+        CodeBlocksEvent evtNew(cbEVT_PROJECT_NEW, 0, prj);
+        Manager::Get()->GetPluginManager()->NotifyPlugins(evtNew);
+
         if (prj)
         {
             prj->Save();
@@ -2427,8 +2431,8 @@
         }
         if (prj && tot == totProject) // Created project should be parsed
         {
-            CodeBlocksEvent evt(cbEVT_PROJECT_OPEN, 0, prj);
-            Manager::Get()->GetPluginManager()->NotifyPlugins(evt);
+            CodeBlocksEvent evtOpen(cbEVT_PROJECT_OPEN, 0, prj);
+            Manager::Get()->GetPluginManager()->NotifyPlugins(evtOpen);
         }
         return;
     }
mortenmacfly 2010-12-18 13:10

What does this patch do? A description is needed!

martind 2010-12-20 08:46

Hi Morten,

This patch sends cbEVT_PROJECT_NEW message when a project is created. Before the cbEVT_PROJECT_OPEN is sent.

I am developing a microcontroller based plugin, but need to know when a project is created so certain compiler options can be automatically set.

Thanks,

Martin.