Patch #910 2006-03-09 02:18

sethjackson

Bug #6725
Download
910-Bug_6725.patch (7.1 KB)
Category
Plugin::Bugfix
Status
Accepted
Close date
2006-03-13 09:45
Assigned to
 
Index: src/plugins/compilergcc/compilergcc.cpp
===================================================================
--- src/plugins/compilergcc/compilergcc.cpp    (revision 2178)
+++ src/plugins/compilergcc/compilergcc.cpp    (working copy)
@@ -138,32 +138,33 @@
     EVT_IDLE(                                        CompilerGCC::OnIdle)
     EVT_TIMER(idTimerPollCompiler,                  CompilerGCC::OnTimer)
 
-    EVT_MENU(idMenuRun,                             CompilerGCC::OnRun)
-    EVT_MENU(idMenuCompileAndRun,                   CompilerGCC::OnCompileAndRun)
-    EVT_MENU(idMenuCompile,                         CompilerGCC::OnCompile)
-    EVT_MENU(idMenuCompileFromProjectManager,       CompilerGCC::OnCompile)
-    EVT_MENU(idMenuCompileTargetFromProjectManager, CompilerGCC::OnCompile)
-    EVT_MENU(idMenuCompileFile,                     CompilerGCC::OnCompileFile)
-    EVT_MENU(idMenuCompileFileFromProjectManager,   CompilerGCC::OnCompileFile)
-    EVT_MENU(idMenuRebuild,                         CompilerGCC::OnRebuild)
-    EVT_MENU(idMenuRebuildFromProjectManager,       CompilerGCC::OnRebuild)
-    EVT_MENU(idMenuRebuildTargetFromProjectManager, CompilerGCC::OnRebuild)
-    EVT_MENU(idMenuCompileAll,                      CompilerGCC::OnCompileAll)
-    EVT_MENU(idMenuRebuildAll,                      CompilerGCC::OnRebuildAll)
-    EVT_MENU(idMenuProjectCompilerOptions,            CompilerGCC::OnProjectCompilerOptions)
-    EVT_MENU(idMenuTargetCompilerOptions,            CompilerGCC::OnTargetCompilerOptions)
-    EVT_MENU(idMenuClean,                           CompilerGCC::OnClean)
-    EVT_MENU(idMenuCleanAll,                        CompilerGCC::OnCleanAll)
-    EVT_MENU(idMenuCleanFromProjectManager,         CompilerGCC::OnClean)
-    EVT_MENU(idMenuCleanTargetFromProjectManager,   CompilerGCC::OnClean)
-    EVT_MENU(idMenuKillProcess,                     CompilerGCC::OnKillProcess)
-    EVT_MENU(idMenuSelectTargetAll,                    CompilerGCC::OnSelectTarget)
-    EVT_MENU(idMenuNextError,                        CompilerGCC::OnNextError)
-    EVT_MENU(idMenuPreviousError,                    CompilerGCC::OnPreviousError)
-    EVT_MENU(idMenuClearErrors,                        CompilerGCC::OnClearErrors)
-    EVT_MENU(idMenuExportMakefile,                  CompilerGCC::OnExportMakefile)
-    EVT_MENU(idMenuSettings,                        CompilerGCC::OnConfig)
 
+    EVT_MENU(idMenuRun,                             CompilerGCC::Dispatcher)
+    EVT_MENU(idMenuCompileAndRun,                   CompilerGCC::Dispatcher)
+    EVT_MENU(idMenuCompile,                         CompilerGCC::Dispatcher)
+    EVT_MENU(idMenuCompileFromProjectManager,       CompilerGCC::Dispatcher)
+    EVT_MENU(idMenuCompileTargetFromProjectManager, CompilerGCC::Dispatcher)
+    EVT_MENU(idMenuCompileFile,                     CompilerGCC::Dispatcher)
+    EVT_MENU(idMenuCompileFileFromProjectManager,   CompilerGCC::Dispatcher)
+    EVT_MENU(idMenuRebuild,                         CompilerGCC::Dispatcher)
+    EVT_MENU(idMenuRebuildFromProjectManager,       CompilerGCC::Dispatcher)
+    EVT_MENU(idMenuRebuildTargetFromProjectManager, CompilerGCC::Dispatcher)
+    EVT_MENU(idMenuCompileAll,                      CompilerGCC::Dispatcher)
+    EVT_MENU(idMenuRebuildAll,                      CompilerGCC::Dispatcher)
+    EVT_MENU(idMenuProjectCompilerOptions,          CompilerGCC::Dispatcher)
+    EVT_MENU(idMenuTargetCompilerOptions,           CompilerGCC::Dispatcher)
+    EVT_MENU(idMenuClean,                           CompilerGCC::Dispatcher)
+    EVT_MENU(idMenuCleanAll,                        CompilerGCC::Dispatcher)
+    EVT_MENU(idMenuCleanFromProjectManager,         CompilerGCC::Dispatcher)
+    EVT_MENU(idMenuCleanTargetFromProjectManager,   CompilerGCC::Dispatcher)
+    EVT_MENU(idMenuKillProcess,                     CompilerGCC::Dispatcher)
+    EVT_MENU(idMenuSelectTargetAll,                 CompilerGCC::Dispatcher)
+    EVT_MENU(idMenuNextError,                       CompilerGCC::Dispatcher)
+    EVT_MENU(idMenuPreviousError,                   CompilerGCC::Dispatcher)
+    EVT_MENU(idMenuClearErrors,                     CompilerGCC::Dispatcher)
+    EVT_MENU(idMenuExportMakefile,                  CompilerGCC::Dispatcher)
+    EVT_MENU(idMenuSettings,                        CompilerGCC::Dispatcher)
+
     EVT_COMBOBOX(idToolTarget,                        CompilerGCC::OnSelectTarget)
 
     EVT_PROJECT_ACTIVATE(CompilerGCC::OnProjectActivated)
@@ -261,6 +262,97 @@
     CompilerFactory::UnregisterCompilers();
 }
 
+void CompilerGCC::Dispatcher(wxCommandEvent& event)
+{
+    // Memorize the currently focused window
+
+    wxWindow* focused = wxWindow::FindFocus();
+
+    int eventId = event.GetId();
+
+    Manager::Get()->GetMessageManager()->Log(wxT("Dispatcher"));
+
+    if (eventId == idMenuRun)
+        OnRun(event);
+
+    if (eventId == idMenuCompileAndRun)
+        OnCompileAndRun(event);
+
+    if (eventId == idM
download for full patch...
sethjackson 2006-03-09 02:40

One thing I failed to mention.... With this patch the editor always gets focus after compilation. This may or may not be acceptable. Ex: user has Management pane in focus. The build a project through the keybd shortcut. The avtive editor (if there is one) will get focus. This may not be desired. To remedy the above situation you could probably make a new variable bool m_hadFocus or something. Check for editor focus before compilation. Eg m_hadFocus = ed->HasCapture(). Then change my code to if(ed && m_hadFocus).

pecan 2006-03-13 00:20

Seth, you have a personal message (PM)

concerning this patch.

sethjackson 2006-03-13 01:45

Ok here is a new patch. Kudos to Pecan for it (he coded it). :D

I had to merge by hand. I hope I didn't mess it up.....

mandrav 2006-03-13 09:45

Thank you both :)

Oh, and Seth, creating the patch file by hand doesn't work ;)