ide; added active configuration and active compiler drop boxes to ide toolbar. remove...
authorRejean Loyer <rejean.loyer@gmail.com>
Thu, 22 Nov 2012 16:27:18 +0000 (11:27 -0500)
committerRejean Loyer <rejean.loyer@gmail.com>
Fri, 23 Nov 2012 04:56:27 +0000 (23:56 -0500)
ide/Makefile
ide/ide.epj
ide/src/ProjectSettings.ec
ide/src/dialogs/FindInFilesDialog.ec
ide/src/ide.ec
ide/src/project/Project.ec
ide/src/project/ProjectView.ec

index 7607c80..442e280 100755 (executable)
@@ -48,13 +48,11 @@ _ECSOURCES = \
        ../extras/gui/layout.ec \
        ../extras/gui/controls/StringsBox.ec \
        ../extras/types/DynamicString.ec \
-       src/dialogs/ActiveCompilerDialog.ec \
        src/dialogs/CompilersDetectionDialog.ec \
        src/dialogs/FindInFilesDialog.ec \
        src/dialogs/GlobalSettingsDialog.ec \
        src/dialogs/NewProjectDialog.ec \
        src/dialogs/NodeProperties.ec \
-       src/dialogs/ProjectActiveConfig.ec \
        src/dialogs/WorkspaceSettings.ec \
        src/dialogs/ProjectTabSettings.ec \
        src/project/Project.ec \
@@ -287,9 +285,6 @@ $(OBJ)StringsBox.sym: ../extras/gui/controls/StringsBox.ec
 $(OBJ)DynamicString.sym: ../extras/types/DynamicString.ec
        $(ECP) $(CFLAGS) $(CECFLAGS) $(ECFLAGS) $(PRJ_CFLAGS) -c ../extras/types/DynamicString.ec -o $(OBJ)DynamicString.sym
 
-$(OBJ)ActiveCompilerDialog.sym: src/dialogs/ActiveCompilerDialog.ec
-       $(ECP) $(CFLAGS) $(CECFLAGS) $(ECFLAGS) $(PRJ_CFLAGS) -c src/dialogs/ActiveCompilerDialog.ec -o $(OBJ)ActiveCompilerDialog.sym
-
 $(OBJ)CompilersDetectionDialog.sym: src/dialogs/CompilersDetectionDialog.ec
        $(ECP) $(CFLAGS) $(CECFLAGS) $(ECFLAGS) $(PRJ_CFLAGS) -c src/dialogs/CompilersDetectionDialog.ec -o $(OBJ)CompilersDetectionDialog.sym
 
@@ -305,9 +300,6 @@ $(OBJ)NewProjectDialog.sym: src/dialogs/NewProjectDialog.ec
 $(OBJ)NodeProperties.sym: src/dialogs/NodeProperties.ec
        $(ECP) $(CFLAGS) $(CECFLAGS) $(ECFLAGS) $(PRJ_CFLAGS) -c src/dialogs/NodeProperties.ec -o $(OBJ)NodeProperties.sym
 
-$(OBJ)ProjectActiveConfig.sym: src/dialogs/ProjectActiveConfig.ec
-       $(ECP) $(CFLAGS) $(CECFLAGS) $(ECFLAGS) $(PRJ_CFLAGS) -c src/dialogs/ProjectActiveConfig.ec -o $(OBJ)ProjectActiveConfig.sym
-
 $(OBJ)WorkspaceSettings.sym: src/dialogs/WorkspaceSettings.ec
        $(ECP) $(CFLAGS) $(CECFLAGS) $(ECFLAGS) $(PRJ_CFLAGS) -c src/dialogs/WorkspaceSettings.ec -o $(OBJ)WorkspaceSettings.sym
 
@@ -428,9 +420,6 @@ $(OBJ)StringsBox.c: ../extras/gui/controls/StringsBox.ec $(OBJ)StringsBox.sym |
 $(OBJ)DynamicString.c: ../extras/types/DynamicString.ec $(OBJ)DynamicString.sym | $(SYMBOLS)
        $(ECC) $(CFLAGS) $(CECFLAGS) $(ECFLAGS) $(PRJ_CFLAGS) $(FVISIBILITY) -c ../extras/types/DynamicString.ec -o $(OBJ)DynamicString.c -symbols $(OBJ)
 
-$(OBJ)ActiveCompilerDialog.c: src/dialogs/ActiveCompilerDialog.ec $(OBJ)ActiveCompilerDialog.sym | $(SYMBOLS)
-       $(ECC) $(CFLAGS) $(CECFLAGS) $(ECFLAGS) $(PRJ_CFLAGS) $(FVISIBILITY) -c src/dialogs/ActiveCompilerDialog.ec -o $(OBJ)ActiveCompilerDialog.c -symbols $(OBJ)
-
 $(OBJ)CompilersDetectionDialog.c: src/dialogs/CompilersDetectionDialog.ec $(OBJ)CompilersDetectionDialog.sym | $(SYMBOLS)
        $(ECC) $(CFLAGS) $(CECFLAGS) $(ECFLAGS) $(PRJ_CFLAGS) $(FVISIBILITY) -c src/dialogs/CompilersDetectionDialog.ec -o $(OBJ)CompilersDetectionDialog.c -symbols $(OBJ)
 
@@ -446,9 +435,6 @@ $(OBJ)NewProjectDialog.c: src/dialogs/NewProjectDialog.ec $(OBJ)NewProjectDialog
 $(OBJ)NodeProperties.c: src/dialogs/NodeProperties.ec $(OBJ)NodeProperties.sym | $(SYMBOLS)
        $(ECC) $(CFLAGS) $(CECFLAGS) $(ECFLAGS) $(PRJ_CFLAGS) $(FVISIBILITY) -c src/dialogs/NodeProperties.ec -o $(OBJ)NodeProperties.c -symbols $(OBJ)
 
-$(OBJ)ProjectActiveConfig.c: src/dialogs/ProjectActiveConfig.ec $(OBJ)ProjectActiveConfig.sym | $(SYMBOLS)
-       $(ECC) $(CFLAGS) $(CECFLAGS) $(ECFLAGS) $(PRJ_CFLAGS) $(FVISIBILITY) -c src/dialogs/ProjectActiveConfig.ec -o $(OBJ)ProjectActiveConfig.c -symbols $(OBJ)
-
 $(OBJ)WorkspaceSettings.c: src/dialogs/WorkspaceSettings.ec $(OBJ)WorkspaceSettings.sym | $(SYMBOLS)
        $(ECC) $(CFLAGS) $(CECFLAGS) $(ECFLAGS) $(PRJ_CFLAGS) $(FVISIBILITY) -c src/dialogs/WorkspaceSettings.ec -o $(OBJ)WorkspaceSettings.c -symbols $(OBJ)
 
@@ -569,9 +555,6 @@ $(OBJ)StringsBox.o: $(OBJ)StringsBox.c
 $(OBJ)DynamicString.o: $(OBJ)DynamicString.c
        $(CC) $(CFLAGS) $(PRJ_CFLAGS) $(FVISIBILITY) -c $(OBJ)DynamicString.c -o $(OBJ)DynamicString.o
 
-$(OBJ)ActiveCompilerDialog.o: $(OBJ)ActiveCompilerDialog.c
-       $(CC) $(CFLAGS) $(PRJ_CFLAGS) $(FVISIBILITY) -c $(OBJ)ActiveCompilerDialog.c -o $(OBJ)ActiveCompilerDialog.o
-
 $(OBJ)CompilersDetectionDialog.o: $(OBJ)CompilersDetectionDialog.c
        $(CC) $(CFLAGS) $(PRJ_CFLAGS) $(FVISIBILITY) -c $(OBJ)CompilersDetectionDialog.c -o $(OBJ)CompilersDetectionDialog.o
 
@@ -587,9 +570,6 @@ $(OBJ)NewProjectDialog.o: $(OBJ)NewProjectDialog.c
 $(OBJ)NodeProperties.o: $(OBJ)NodeProperties.c
        $(CC) $(CFLAGS) $(PRJ_CFLAGS) $(FVISIBILITY) -c $(OBJ)NodeProperties.c -o $(OBJ)NodeProperties.o
 
-$(OBJ)ProjectActiveConfig.o: $(OBJ)ProjectActiveConfig.c
-       $(CC) $(CFLAGS) $(PRJ_CFLAGS) $(FVISIBILITY) -c $(OBJ)ProjectActiveConfig.c -o $(OBJ)ProjectActiveConfig.o
-
 $(OBJ)WorkspaceSettings.o: $(OBJ)WorkspaceSettings.c
        $(CC) $(CFLAGS) $(PRJ_CFLAGS) $(FVISIBILITY) -c $(OBJ)WorkspaceSettings.c -o $(OBJ)WorkspaceSettings.o
 
index 4278bea..73a3908 100755 (executable)
             {
                "Folder" : "dialogs",
                "Files" : [
-                  "ActiveCompilerDialog.ec",
                   "CompilersDetectionDialog.ec",
                   "FindInFilesDialog.ec",
                   "GlobalSettingsDialog.ec",
                   "NewProjectDialog.ec",
                   "NodeProperties.ec",
-                  "ProjectActiveConfig.ec",
                   "WorkspaceSettings.ec",
                   "ProjectTabSettings.ec"
                ]
index 232d220..d62095e 100755 (executable)
@@ -219,6 +219,7 @@ class ProjectSettings : Window
             project.topNode.modified = true;
             project.MarkChanges(buildTab.backupNode);
             ide.projectView.modifiedDocument = true;
+            ide.UpdateToolBarActiveConfigs(false);
             ide.projectView.Update(null);
          }
          if(prjTabControl.curTab == workspaceTab && workspaceTab.modifiedDocument)
@@ -1821,6 +1822,7 @@ class BuildTab : Tab
             project.MarkChanges(backupNode);
             project.topNode.modified = true;
             ide.projectView.modifiedDocument = true;
+            ide.UpdateToolBarActiveConfigs(false);
             ide.projectView.Update(null);
          }
          modifiedDocument = false;
index 7fecff9..1c95975 100644 (file)
@@ -183,6 +183,7 @@ private:
    String lastSelectionProject;
    String lastSelectionProjectNode;
    bool replaceMode;
+   SelectorButton starDir;
 
    FindInFilesDialog()
    {
index 5aac4c0..fecdc5d 100644 (file)
@@ -9,14 +9,12 @@ public import "ec"
 import "GlobalSettingsDialog"
 import "NewProjectDialog"
 import "FindInFilesDialog"
-import "ActiveCompilerDialog"
 
 #ifdef GDB_DEBUG_GUI
 import "GDBDialog"
 #endif
 
 import "Project"
-import "ProjectActiveConfig"
 import "ProjectConfig"
 import "ProjectNode"
 import "NodeProperties"
@@ -270,6 +268,60 @@ class IDEToolbar : ToolBar
    ToolButton buttonDebugStepOut { this, toolTip = $"Step Out", menuItemPtr = IDEItem(debugStepOutItem), disabled = true; };
    // Shift+F10
    ToolButton buttonDebugSkipStepOver { this, toolTip = $"Step Over Skipping Breakpoints", menuItemPtr = IDEItem(debugSkipStepOverItem), disabled = true; };
+
+   ToolSeparator separator5 { this };
+
+   Window spacer5 { this, size = { 4 } };
+
+   DropBox activeConfig
+   {
+      this, toolTip = $"Active Configuration(s)", size = { 160 };
+      bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
+      {
+         if(row)
+         {
+            for(prj : ide.workspace.projects)
+            {
+               for(cfg : prj.configurations)
+               {
+                  if(cfg.name && !strcmp(cfg.name, row.string))
+                  {
+                     prj.config = cfg;
+                     break;
+                  }
+               }
+            }
+            ide.UpdateToolBarActiveConfigs(true);
+            ide.projectView.Update(null);
+         }
+         return true;
+      }
+   };
+
+   Window spacer6 { this, size = { 4 } };
+
+   DropBox activeCompiler
+   {
+      this, toolTip = $"Active Compiler", size = { 160 };
+      bool NotifySelect(DropBox dropBox, DataRow row, Modifiers mods)
+      {
+         if(row && strcmp(row.string, ide.workspace.compiler))
+         {
+            CompilerConfig compiler = ideSettings.GetCompilerConfig(row.string);
+            ide.workspace.compiler = row.string;
+            ide.projectView.ShowOutputBuildLog(true);
+            ide.projectView.DisplayCompiler(compiler, false);
+            for(prj : ide.workspace.projects)
+               ide.projectView.ProjectPrepareCompiler(prj, compiler);
+            delete compiler;
+            ide.workspace.Save();
+         }
+         return true;
+      }
+   };
+
+   Window spacer7 { this, size = { 4 } };
+
 }
 
 class IDEMainFrame : Window
@@ -874,24 +926,6 @@ class IDEWorkSpace : Window
          }
       }
       MenuDivider { projectMenu };
-      MenuItem activeCompilerItem
-      {
-         projectMenu, $"Active Compiler...", g, /*altF5, */disabled = true;
-         bool NotifySelect(MenuItem selection, Modifiers mods)
-         {
-            projectView.MenuCompiler(null, mods);
-            return true;
-         }
-      }
-      MenuItem projectActiveConfigItem
-      {
-         projectMenu, $"Active Configuration...", g, altF5, disabled = true;
-         bool NotifySelect(MenuItem selection, Modifiers mods)
-         {
-            projectView.MenuConfig(projectView.active ? selection : null, mods);
-            return true;
-         }
-      }
       MenuItem projectSettingsItem
       {
          projectMenu, $"Settings...", s, altF7, disabled = true;
@@ -1572,6 +1606,7 @@ class IDEWorkSpace : Window
 
    void UpdateCompilerConfigs()
    {
+      UpdateToolBarActiveCompilers();
       if(workspace)
       {
          CompilerConfig compiler = ideSettings.GetCompilerConfig(workspace.compiler);
@@ -1583,6 +1618,96 @@ class IDEWorkSpace : Window
       }
    }
 
+   void UpdateToolBarActiveCompilers()
+   {
+      toolBar.activeCompiler.Clear();
+      for(compiler : ideSettings.compilerConfigs)
+      {
+         DataRow row = toolBar.activeCompiler.AddString(compiler.name);
+         if(workspace && workspace.compiler && !strcmp(compiler.name, workspace.compiler))
+            toolBar.activeCompiler.currentRow = row;
+      }
+      if(!toolBar.activeCompiler.currentRow)
+         toolBar.activeCompiler.currentRow = toolBar.activeCompiler.firstRow;
+      toolBar.activeCompiler.disabled = workspace == null;
+   }
+
+   void UpdateToolBarActiveConfigs(bool selectionOnly)
+   {
+      bool commonSelected = false;
+      DataRow row = toolBar.activeConfig.currentRow;
+      if(selectionOnly)
+         row = toolBar.activeConfig.FindRow(1);
+      else
+      {
+         toolBar.activeConfig.Clear();
+         row = toolBar.activeConfig.AddString("(Mixed)");
+         row.tag = 1;
+      }
+      if(workspace)
+      {
+         char * configName = null;
+         if(!selectionOnly)
+         {
+            Map<String, int> configs { }; // TOIMP: just need sort but using map until containers have sort
+            for(prj : workspace.projects)
+            {
+               for(cfg : prj.configurations)
+               {
+                  if(cfg.name)
+                     configs[cfg.name] = 1;
+               }
+            }
+            for(name : configs)
+            {
+               toolBar.activeConfig.AddString(&name);
+            }
+            delete configs;
+         }
+         if(projectView && projectView.project)
+         {
+            for(prj : workspace.projects)
+            {
+               if(prj.config && prj.config.name)
+               {
+                  configName = prj.config.name;
+                  break;
+               }
+            }
+            if(configName)
+            {
+               commonSelected = true;
+               for(prj : workspace.projects)
+               {
+                  if(prj.config && (!prj.config.name || strcmp(prj.config.name, configName)))
+                  {
+                     commonSelected = false;
+                     break;
+                  }
+               }
+            }
+         }
+         if(commonSelected)
+         {
+            commonSelected = false;
+            for(row = toolBar.activeConfig.firstRow; row; row = row.next)
+            {
+               if(!strcmp(row.string, configName))
+               {
+                  toolBar.activeConfig.currentRow = row;
+                  commonSelected = true;
+                  break;
+               }
+            }
+         }
+      }
+      if(!selectionOnly)
+         toolBar.activeConfig.Sort(null, 0);
+      if(!commonSelected)
+         toolBar.activeConfig.currentRow = row;
+      toolBar.activeConfig.disabled = workspace == null;
+   }
+
    void AdjustMenus()
    {
       bool unavailable = !project;
@@ -1590,8 +1715,6 @@ class IDEWorkSpace : Window
       projectAddItem.disabled             = unavailable;
       toolBar.buttonAddProject.disabled   = unavailable;
 
-      activeCompilerItem.disabled         = unavailable;
-      projectActiveConfigItem.disabled    = unavailable;
       projectSettingsItem.disabled        = unavailable;
 
       projectBrowseFolderItem.disabled    = unavailable;
@@ -2579,6 +2702,9 @@ class IDEWorkSpace : Window
       delete passArgs;
       if(debugStart)
          ;//MenuDebugStart(debugStartResumeItem, 0); // <-- how TODO this without getting into the app.Wait lock
+
+      UpdateToolBarActiveConfigs(false);
+      UpdateToolBarActiveCompilers();
       return true;
    }
 
index 8ec3d3e..06d015c 100755 (executable)
@@ -1312,6 +1312,7 @@ private:
          }
 
          property::config = cfg.data;
+         ide.UpdateToolBarActiveConfigs(true);
          ide.workspace.modified = true;
          ide.projectView.Update(null);
       }
index 0f8eb50..3318c9e 100644 (file)
@@ -238,7 +238,6 @@ class ProjectView : Window
                      MenuItem { popupContent, $"Remove project from workspace", r, NotifySelect = ProjectRemove }.disabled = buildMenuUnavailable;
                      MenuDivider { popupContent };
                   }
-                  MenuItem { popupContent, $"Active Configuration...", s, Key { f5, alt = true } , NotifySelect = MenuConfig };
                   MenuItem { popupContent, $"Settings...", s, Key { f7, alt = true } , NotifySelect = MenuSettings };
                   MenuDivider { popupContent };
                   MenuItem { popupContent, $"Browse Folder", w, NotifySelect = MenuBrowseFolder };
@@ -1197,6 +1196,7 @@ class ProjectView : Window
    {
       CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
 
+      ide.UpdateToolBarActiveConfigs(false);
       for(config : project.configurations)
          ProjectPrepareMakefile(project, forceExists, compiler, config);
 
@@ -1205,36 +1205,6 @@ class ProjectView : Window
       return true;
    }
 
-   bool MenuConfig(MenuItem selection, Modifiers mods)
-   {
-      if(ProjectActiveConfig { master = parent, project = project }.Modal() == ok)
-         ide.AdjustMenus();
-      return true;
-   }
-
-   bool MenuCompiler(MenuItem selection, Modifiers mods)
-   {
-      ActiveCompilerDialog compilerDialog
-      {
-         master = parent;
-         ideSettings = ideSettings, workspaceActiveCompiler = ide.workspace.compiler;
-      };
-      incref compilerDialog;
-      if(compilerDialog.Modal() == ok && strcmp(compilerDialog.workspaceActiveCompiler, ide.workspace.compiler))
-      {
-         CompilerConfig compiler = ideSettings.GetCompilerConfig(compilerDialog.workspaceActiveCompiler);
-         ide.workspace.compiler = compilerDialog.workspaceActiveCompiler;
-         ide.projectView.ShowOutputBuildLog(true);
-         ide.projectView.DisplayCompiler(compiler, false);
-
-         for(prj : ide.workspace.projects)
-            ide.projectView.ProjectPrepareCompiler(prj, compiler);
-         delete compiler;
-      }
-      delete compilerDialog;
-      return true;
-   }
-
    bool MenuSettings(MenuItem selection, Modifiers mods)
    {
       ProjectNode node = GetSelectedNode(true);