ide: Fixed various global settings issues
authorJerome St-Louis <jerome@ecere.com>
Mon, 1 Aug 2016 19:06:20 +0000 (15:06 -0400)
committerJerome St-Louis <jerome@ecere.com>
Mon, 1 Aug 2016 22:08:33 +0000 (18:08 -0400)
- Destructor and properties in IDEConfigHolder
- Fixed confusion between configs/recent files&projects inside ideSettings (for loading legacy only) vs. actual values in ideConfig
- Added file monitors on recent files & projects
- Fixed CompilerConfig comparison to include type, target platform and number of parallel build jobs
- Savings settings after adding recent files/projects
- Fixed including newly added compiler configs into write list
- Fixed importing issues

epj2make/epj2make.ec
ide/src/IDESettings.ec
ide/src/designer/CodeEditor.ec
ide/src/dialogs/NewProjectDialog.ec
ide/src/ide.ec
ide/src/project/Project.ec
ide/src/project/ProjectView.ec
ide/src/project/Workspace.ec

index be0caf7..53792c1 100644 (file)
@@ -270,7 +270,7 @@ class epj2makeApp : GuiApplication
       // TODO: Command line option to choose between the two
       // or a command line option to not use global settings
       //defaultCompiler = MakeDefaultCompiler();
-                  defaultCompiler = ideSettings.GetCompilerConfig(compiler);
+                  defaultCompiler = ideConfig.compilers.GetCompilerConfig(compiler);
       // possible TODO: use the workspace to select the active compiler
       // TODO: option to specify compiler name when using global settings
                }
index e3e518b..b83f2a5 100644 (file)
@@ -260,6 +260,29 @@ class IDEConfigHolder
    RecentFiles recentFiles { };
    RecentWorkspaces recentWorkspaces { };
 
+   property CompilerConfigs compilers
+   {
+      set { compilers.Free(); delete compilers; compilers = value; }
+      get { return compilers; }
+   }
+   property RecentFiles recentFiles
+   {
+      set { recentFiles.Free(); delete recentFiles; recentFiles = value; }
+      get { return recentFiles; }
+   }
+   property RecentWorkspaces recentProjects
+   {
+      set { recentWorkspaces.Free(); delete recentWorkspaces; recentWorkspaces = value; }
+      get { return recentWorkspaces; }
+   }
+
+   ~IDEConfigHolder()
+   {
+      compilers.Free();
+      recentFiles.Free();
+      recentWorkspaces.Free();
+   }
+
    void forcePathSeparatorStyle(bool unixStyle)
    {
       char from, to;
@@ -297,6 +320,50 @@ class IDESettingsContainer : GlobalSettings
 
    char moduleLocation[MAX_LOCATION];
 
+   FileMonitor recentFilesMonitor
+   {
+      this, fileChange = { modified = true };
+
+      bool OnFileNotify(FileChange action, const char * param)
+      {
+         File f;
+         recentFilesMonitor.StopMonitoring();
+         f = FileOpen(recentFilesMonitor.fileName, read);
+         if(f)
+         {
+            int c;
+            bool locked;
+            for(c = 0; c < 10 && !(locked = f.Lock(shared, 0, 0, false)); c++) ecere::sys::Sleep(0.01);
+            RecentFiles::read();
+            f.Unlock(0,0,true);
+            delete f;
+         }
+         return true;
+      }
+   };
+
+   FileMonitor recentProjectsMonitor
+   {
+      this, fileChange = { modified = true };
+
+      bool OnFileNotify(FileChange action, const char * param)
+      {
+         File f;
+         recentProjectsMonitor.StopMonitoring();
+         f = FileOpen(recentProjectsMonitor.fileName, read);
+         if(f)
+         {
+            int c;
+            bool locked;
+            for(c = 0; c < 10 && !(locked = f.Lock(shared, 0, 0, false)); c++) ecere::sys::Sleep(0.01);
+            RecentWorkspaces::read();
+            f.Unlock(0,0,true);
+            delete f;
+         }
+         return true;
+      }
+   };
+
 private:
    bool oldConfig;
    FileSize settingsFileSize;
@@ -438,52 +505,31 @@ private:
          }
       }
 
-      if(oldConfig)
-      {
-         if(data.compilerConfigs && data.compilerConfigs.count)
-         {
-            for(c : data.compilerConfigs)
-               ideConfig.compilers.Add(c);
-            data.compilerConfigs.RemoveAll();
-         }
-         if(data.recentFiles && data.recentFiles.count)
-         {
-            for(s : data.recentFiles)
-               ideConfig.recentFiles.Add(s);
-            data.recentFiles.RemoveAll();
-         }
-         if(data.recentProjects && data.recentProjects.count)
-         {
-            for(s : data.recentProjects)
-               ideConfig.recentWorkspaces.Add(s);
-            data.recentProjects.RemoveAll();
-         }
-         ideConfig.forcePathSeparatorStyle(true);
-      }
-
       CloseAndMonitor();
       FileGetSize(settingsFilePath, &settingsFileSize);
-      if(oldConfig)
-         CompilerConfigs::fix();
       if(portable && moduleLocation[0] && FileExists(moduleLocation).isDirectory)
          data.ManagePortablePaths(moduleLocation, true);
       data.ForcePathSeparatorStyle(true);
 
-#if !defined(ECERE_DOCUMENTOR) && !defined(ECERE_EPJ2MAKE)
-      globalSettingsDialog.ideSettings = data;
+      // Import from previous ecereIDE settings
       if(oldConfig)
       {
-         ide.updateRecentMenus();
-         ide.UpdateCompilerConfigs(true);
-      }
-#endif
+         data.compilerConfigs.ensureDefaults();
+         data.compilerConfigs.write(null);
+         data.compilerConfigs.Free();
+
+         data.recentFiles.write();
+         data.recentFiles.Free();
+
+         data.recentProjects.write();
+         data.recentProjects.Free();
 
-      if(oldConfig)
-      {
-         useNewConfigurationFiles = true;
          Save();
-         CompilerConfigs::write(null);
       }
+
+#if !defined(ECERE_DOCUMENTOR) && !defined(ECERE_EPJ2MAKE)
+      globalSettingsDialog.ideSettings = data;
+#endif
       return result;
    }
 
@@ -525,10 +571,7 @@ static Map<String, String> getCompilerConfigFilePathsByName(const char * path)
          char * path = CopyString(fl.path);
          MakeSlashPath(path);
          GetLastDirectory(path, name);
-         {
-            char * s = strstr(name, ".");
-            if(s) *s = 0;
-         }
+         StripExtension(name);
          map[name] = path;
       }
    }
@@ -547,10 +590,7 @@ static Map<String, CompilerConfig> getCompilerConfigsByName(const char * path)
          char * path = CopyString(fl.path);
          MakeSlashPath(path);
          GetLastDirectory(path, name);
-         {
-            char * s = strstr(name, ".");
-            if(s) *s = 0;
-         }
+         StripExtension(name);
          {
             CompilerConfig ccfg = CompilerConfig::read(path);
             if(ccfg)
@@ -577,7 +617,7 @@ static void getConfigFilePath(char * path, Class _class, char * dir, const char
       if(configName)
       {
          PathCatSlash(path, configName);
-         ChangeExtension(path, "econ", path);
+         strcat(path, ".econ");
       }
    }
    else if(_class == class(RecentFilesData))
@@ -813,25 +853,6 @@ private:
    RecentFiles recentFiles { };
    RecentWorkspaces recentProjects { };
 
-   CompilerConfig GetCompilerConfig(const String compilerName)
-   {
-      const char * name = compilerName && compilerName[0] ? compilerName : defaultCompilerName;
-      CompilerConfig compilerConfig = null;
-      for(compiler : compilerConfigs)
-      {
-         if(!strcmp(compiler.name, name))
-         {
-            compilerConfig = compiler;
-            break;
-         }
-      }
-      if(!compilerConfig && compilerConfigs.count)
-         compilerConfig = compilerConfigs.firstIterator.data;
-      if(compilerConfig)
-         incref compilerConfig;
-      return compilerConfig;
-   }
-
    ~IDESettings()
    {
       compilerConfigs.Free();
@@ -1010,24 +1031,24 @@ class RecentFiles : RecentPaths
       readConfigFile(path, _class, &d);
       if(d && d.recentFiles && d.recentFiles.count)
       {
-         IDESettings s = (IDESettings)settingsContainer.data;
-         s.property::recentFiles = d.recentFiles;
+         ideConfig.recentFiles = d.recentFiles;
          d.recentFiles = null;
 #if !defined(ECERE_DOCUMENTOR) && !defined(ECERE_EPJ2MAKE)
          ide.updateRecentFilesMenu();
 #endif
       }
       delete d;
+      settingsContainer.recentFilesMonitor.fileName = path;
+      settingsContainer.recentFilesMonitor.StartMonitoring();
    }
 
-   void ::write()
+   void write()
    {
       char path[MAX_LOCATION];
-      IDESettings s = (IDESettings)settingsContainer.data;
       RecentFilesData d { };
       Class _class = class(RecentFilesData);
       getConfigFilePath(path, _class, null, null);
-      d.recentFiles = s.recentFiles;
+      d.recentFiles = this;
       writeConfigFile(path, _class, d);
       d.recentFiles = null;
       delete d;
@@ -1050,24 +1071,24 @@ class RecentWorkspaces : RecentPaths
       readConfigFile(path, _class, &d);
       if(d && d.recentWorkspaces && d.recentWorkspaces.count)
       {
-         IDESettings s = (IDESettings)settingsContainer.data;
-         s.property::recentProjects = d.recentWorkspaces;
+         ideConfig.recentProjects = d.recentWorkspaces;
          d.recentWorkspaces = null;
 #if !defined(ECERE_DOCUMENTOR) && !defined(ECERE_EPJ2MAKE)
          ide.updateRecentProjectsMenu();
 #endif
       }
+      settingsContainer.recentProjectsMonitor.fileName = path;
+      settingsContainer.recentProjectsMonitor.StartMonitoring();
       delete d;
    }
 
-   void ::write()
+   void write()
    {
       char path[MAX_LOCATION];
-      IDESettings s = (IDESettings)settingsContainer.data;
       RecentWorkspacesData d { };
       Class _class = class(RecentWorkspacesData);
       getConfigFilePath(path, _class, null, null);
-      d.recentWorkspaces = s.recentProjects;
+      d.recentWorkspaces = this;
       writeConfigFile(path, _class, d);
       d.recentWorkspaces = null;
       delete d;
@@ -1094,10 +1115,10 @@ class RecentPaths : Array<String>
       return Array::Add((T)filePath);
    }
 
-   IteratorPointer addRecent(T value)
+   IteratorPointer addRecent(const String value)
    {
       int c;
-      char * filePath = (char *)value;
+      char * filePath = CopyString((char *)value);
       IteratorPointer ip;
       ChangeCh(filePath, '\\', '/');
       for(c = 0; c < count; c++)
@@ -1575,7 +1596,13 @@ private:
    int OnCompare(CompilerConfig b)
    {
       int result;
-      if(!(result = name.OnCompare(b.name)) &&
+      if(
+         !(result = type.OnCompare(b.type)) &&
+         !(result = targetPlatform.OnCompare(b.targetPlatform)) &&
+         !(result = numJobs.OnCompare(b.numJobs)));
+
+      if(!result &&
+         !(result = name.OnCompare(b.name)) &&
          !(result = ecpCommand.OnCompare(b.ecpCommand)) &&
          !(result = eccCommand.OnCompare(b.eccCommand)) &&
          !(result = ecsCommand.OnCompare(b.ecsCommand)) &&
@@ -1591,8 +1618,7 @@ private:
          !(result = executableLauncher.OnCompare(b.executableLauncher)) &&
          !(result = distccHosts.OnCompare(b.distccHosts)) &&
          !(result = gnuToolchainPrefix.OnCompare(b.gnuToolchainPrefix)) &&
-         !(result = sysroot.OnCompare(b.sysroot)))
-         ;
+         !(result = sysroot.OnCompare(b.sysroot)));
 
       if(!result &&
          !(result = includeDirs.OnCompare(b.includeDirs)) &&
@@ -1604,9 +1630,7 @@ private:
          !(result = cxxFlags.OnCompare(b.cxxFlags)) &&
          !(result = eCcompilerFlags.OnCompare(b.eCcompilerFlags)) &&
          !(result = compilerFlags.OnCompare(b.compilerFlags)) &&
-         !(result = linkerFlags.OnCompare(b.linkerFlags)))
-         ;
-
+         !(result = linkerFlags.OnCompare(b.linkerFlags)));
       return result;
    }
 
@@ -1684,52 +1708,70 @@ public:
 
 class CompilerConfigs : List<CompilerConfig>
 {
-   void ::fix()
+   CompilerConfig GetCompilerConfig(const String compilerName)
+   {
+      const char * name = compilerName && compilerName[0] ? compilerName : defaultCompilerName;
+      CompilerConfig compilerConfig = null;
+      for(compiler : this)
+      {
+         if(!strcmp(compiler.name, name))
+         {
+            compilerConfig = compiler;
+            break;
+         }
+      }
+      if(!compilerConfig && count)
+         compilerConfig = this[0];
+      if(compilerConfig)
+      {
+         incref compilerConfig;
+         if(compilerConfig._refCount == 1)
+            incref compilerConfig;
+      }
+      return compilerConfig;
+   }
+
+   void ensureDefaults()
    {
-      IDESettings s = (IDESettings)settingsContainer.data;
       // Ensure we have a default compiler
-      CompilerConfig defaultCompiler = null;
-      defaultCompiler = s.GetCompilerConfig(defaultCompilerName);
+      CompilerConfig defaultCompiler = GetCompilerConfig(defaultCompilerName);
       if(!defaultCompiler)
       {
          defaultCompiler = MakeDefaultCompiler(defaultCompilerName, true);
-         s.compilerConfigs.Insert(null, defaultCompiler);
+         Insert(null, defaultCompiler);
          defaultCompiler = null;
       }
       delete defaultCompiler;
 
-      if(s.compilerConfigs)
+      for(ccfg : this)
       {
-         for(ccfg : s.compilerConfigs)
-         {
-            if(!ccfg.ecpCommand || !ccfg.ecpCommand[0])
-               ccfg.ecpCommand = ecpDefaultCommand;
-            if(!ccfg.eccCommand || !ccfg.eccCommand[0])
-               ccfg.eccCommand = eccDefaultCommand;
-            if(!ccfg.ecsCommand || !ccfg.ecsCommand[0])
-               ccfg.ecsCommand = ecsDefaultCommand;
-            if(!ccfg.earCommand || !ccfg.earCommand[0])
-               ccfg.earCommand = earDefaultCommand;
-            if(!ccfg.cppCommand || !ccfg.cppCommand[0])
-               ccfg.cppCommand = cppDefaultCommand;
-            if(!ccfg.ccCommand || !ccfg.ccCommand[0])
-               ccfg.ccCommand = ccDefaultCommand;
-            if(!ccfg.cxxCommand || !ccfg.cxxCommand[0])
-               ccfg.cxxCommand = cxxDefaultCommand;
-            /*if(!ccfg.ldCommand || !ccfg.ldCommand[0])
-               ccfg.ldCommand = ldDefaultCommand;*/
-            if(!ccfg.arCommand || !ccfg.arCommand[0])
-               ccfg.arCommand = arDefaultCommand;
-            if(!ccfg.objectFileExt || !ccfg.objectFileExt[0])
-               ccfg.objectFileExt = objectDefaultFileExt;
-            /*if(!ccfg.staticLibFileExt || !ccfg.staticLibFileExt[0])
-               ccfg.staticLibFileExt = staticLibDefaultFileExt;*/
-            /*if(!ccfg.sharedLibFileExt || !ccfg.sharedLibFileExt[0])
-               ccfg.sharedLibFileExt = sharedLibDefaultFileExt;*/
-            /*if(!ccfg.executableFileExt || !ccfg.executableFileExt[0])
-               ccfg.executableFileExt = outputDefaultFileExt;*/
-            if(!ccfg._refCount) incref ccfg;
-         }
+         if(!ccfg.ecpCommand || !ccfg.ecpCommand[0])
+            ccfg.ecpCommand = ecpDefaultCommand;
+         if(!ccfg.eccCommand || !ccfg.eccCommand[0])
+            ccfg.eccCommand = eccDefaultCommand;
+         if(!ccfg.ecsCommand || !ccfg.ecsCommand[0])
+            ccfg.ecsCommand = ecsDefaultCommand;
+         if(!ccfg.earCommand || !ccfg.earCommand[0])
+            ccfg.earCommand = earDefaultCommand;
+         if(!ccfg.cppCommand || !ccfg.cppCommand[0])
+            ccfg.cppCommand = cppDefaultCommand;
+         if(!ccfg.ccCommand || !ccfg.ccCommand[0])
+            ccfg.ccCommand = ccDefaultCommand;
+         if(!ccfg.cxxCommand || !ccfg.cxxCommand[0])
+            ccfg.cxxCommand = cxxDefaultCommand;
+         /*if(!ccfg.ldCommand || !ccfg.ldCommand[0])
+            ccfg.ldCommand = ldDefaultCommand;*/
+         if(!ccfg.arCommand || !ccfg.arCommand[0])
+            ccfg.arCommand = arDefaultCommand;
+         if(!ccfg.objectFileExt || !ccfg.objectFileExt[0])
+            ccfg.objectFileExt = objectDefaultFileExt;
+         /*if(!ccfg.staticLibFileExt || !ccfg.staticLibFileExt[0])
+            ccfg.staticLibFileExt = staticLibDefaultFileExt;*/
+         /*if(!ccfg.sharedLibFileExt || !ccfg.sharedLibFileExt[0])
+            ccfg.sharedLibFileExt = sharedLibDefaultFileExt;*/
+         /*if(!ccfg.executableFileExt || !ccfg.executableFileExt[0])
+            ccfg.executableFileExt = outputDefaultFileExt;*/
+         if(!ccfg._refCount) incref ccfg;
       }
    }
 
@@ -1738,20 +1780,21 @@ class CompilerConfigs : List<CompilerConfig>
       AVLTree<String> list { };
       for(ccfg : this)
       {
-         for(occfg : oldConfigs)
+         bool found = false;
+         for(occfg : oldConfigs; !strcmp(ccfg.name, occfg.name))
          {
-            if(!strcmp(ccfg.name, occfg.name))
-            {
-               if(ccfg.OnCompare(occfg))
-                  list.Add(CopyString(ccfg.name));
-               break;
-            }
+            found = true;
+            if(ccfg.OnCompare(occfg))
+               list.Add(CopyString(ccfg.name));
+            break;
          }
+         if(!found)
+            list.Add(CopyString(ccfg.name));
       }
       return list;
    }
 
-   void ::read()
+   void read()
    {
       if(settingsContainer.settingsFilePath)
       {
@@ -1761,33 +1804,32 @@ class CompilerConfigs : List<CompilerConfig>
          getConfigFilePath(path, _class, dir, null);
          if(dir[0])
          {
-            CompilerConfigs ccfgs { };
             AVLTree<const String> addedConfigs { };
-            IDESettings s = (IDESettings)settingsContainer.data;
             Map<String, CompilerConfig> compilerConfigsByName = getCompilerConfigsByName(dir);
             MapIterator<const String, CompilerConfig> it { map = compilerConfigsByName };
             if(it.Index("Default", false))
             {
                CompilerConfig ccfg = it.data;
-               ccfgs.Add(ccfg.Copy());
+               Add(ccfg.Copy());
                addedConfigs.Add(ccfg.name);
             }
             for(ccfg : compilerConfigsByName)
             {
                if(!addedConfigs.Find(ccfg.name))
                {
-                  ccfgs.Add(ccfg.Copy());
+                  Add(ccfg.Copy());
                   addedConfigs.Add(ccfg.name);
                }
             }
-            for(ccfg : s.compilerConfigs)
+            /*
+            for(ccfg : this)
             {
                if(!addedConfigs.Find(ccfg.name))
-                  ccfgs.Add(ccfg.Copy());
+                  Add(ccfg.Copy());
             }
+            */
             delete addedConfigs;
-            s.property::compilerConfigs = ccfgs;
-            fix();
+            ensureDefaults();
             compilerConfigsByName.Free();
             delete compilerConfigsByName;
 #if !defined(ECERE_DOCUMENTOR) && !defined(ECERE_EPJ2MAKE)
@@ -1797,17 +1839,16 @@ class CompilerConfigs : List<CompilerConfig>
       }
    }
 
-   void ::write(AVLTree<String> cfgsToWrite)
+   void write(AVLTree<String> cfgsToWrite)
    {
       char dir[MAX_LOCATION];
       char path[MAX_LOCATION];
       Map<String, String> paths;
-      IDESettings s = (IDESettings)settingsContainer.data;
       getConfigFilePath(path, class(CompilerConfig), dir, null);
       paths = getCompilerConfigFilePathsByName(dir);
       {
          MapIterator<String, String> it { map = paths };
-         for(c : s.compilerConfigs)
+         for(c : this)
          {
             CompilerConfig ccfg = c;
             if(!cfgsToWrite || cfgsToWrite.Find(ccfg.name))
index a24e939..9edd7ac 100644 (file)
@@ -2050,7 +2050,7 @@ class CodeEditor : Window
          int line = editBox.lineNumber + 1;
          if(projectView)
          {
-            CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
+            CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler);
             ProjectConfig config = projectView.project.config;
             int bitDepth = ide.workspace.bitDepth;
             bool useValgrind = ide.workspace.useValgrind;
@@ -2853,7 +2853,7 @@ class CodeEditor : Window
 
       if(ide.workspace)
       {
-         CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
+         CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler);
          SetTargetBits(ide.workspace.bitDepth ? ide.workspace.bitDepth : GetHostBits());
          delete compiler;
       }
@@ -2906,7 +2906,7 @@ class CodeEditor : Window
       // TODO: Get symbolsDir from project settings instead...
       if(ide.projectView)
       {
-         CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
+         CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler);
          ProjectConfig config = project.config;
          int bitDepth = ide.workspace.bitDepth;
          DirExpression objDir = project.GetObjDir(compiler, config, bitDepth);
index 0918314..16eb033 100644 (file)
@@ -211,7 +211,7 @@ class NewProjectDialog : Window
 
       if(prj && projectWindow)
       {
-         CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
+         CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler);
          ProjectConfig config = prj.config;
          projectWindow.ShowOutputBuildLog(true);
          projectWindow.DisplayCompiler(compiler, false);
@@ -560,7 +560,7 @@ class QuickProjectDialog : Window
 
          if(project && projectWindow)
          {
-            CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
+            CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler);
             ProjectConfig config = project.config;
             projectWindow.ShowOutputBuildLog(true);
             projectWindow.DisplayCompiler(compiler, false);
index 5be6554..1481d88 100644 (file)
@@ -306,7 +306,7 @@ class IDEToolbar : ToolBar
          if(ide.workspace && ide.projectView && row && strcmp(row.string, ide.workspace.activeCompiler))
          {
             bool silent = ide.projectView.buildInProgress == none ? false : true;
-            CompilerConfig compiler = ideSettings.GetCompilerConfig(row.string);
+            CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(row.string);
             ide.workspace.activeCompiler = row.string;
             ide.projectView.ShowOutputBuildLog(!silent);
             if(!silent)
@@ -328,7 +328,7 @@ class IDEToolbar : ToolBar
          if(ide.workspace && ide.projectView && row)
          {
             bool silent = ide.projectView.buildInProgress == none ? false : true;
-            CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
+            CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler);
             ide.workspace.bitDepth = (int)row.tag;
             ide.projectView.ShowOutputBuildLog(!silent);
             if(!silent)
@@ -441,7 +441,7 @@ class IDEWorkSpace : Window
 
       void OnGotoError(const char * line, bool noParsing)
       {
-         CompilerConfig compiler = ide.workspace ? ideSettings.GetCompilerConfig(ide.workspace.activeCompiler) : null;
+         CompilerConfig compiler = ide.workspace ? ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler) : null;
          const char * objectFileExt = compiler ? compiler.objectFileExt : objectDefaultFileExt;
          ide.GoToError(line, noParsing, objectFileExt);
          delete compiler;
@@ -449,7 +449,7 @@ class IDEWorkSpace : Window
 
       void OnCodeLocationParseAndGoTo(const char * line)
       {
-         CompilerConfig compiler = ide.workspace ? ideSettings.GetCompilerConfig(ide.workspace.activeCompiler) : null;
+         CompilerConfig compiler = ide.workspace ? ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler) : null;
          const char * objectFileExt = compiler ? compiler.objectFileExt : objectDefaultFileExt;
          ide.CodeLocationParseAndGoTo(line, ide.findInFilesDialog.findProject, ide.findInFilesDialog.findDir, objectFileExt);
          delete compiler;
@@ -824,7 +824,7 @@ class IDEWorkSpace : Window
                      newProjectDialog.CreateNewProject();
                      if(projectView)
                      {
-                        ideConfig.recentWorkspaces.addRecent(CopyString(projectView.fileName));
+                        ideConfig.recentWorkspaces.addRecent(projectView.fileName);
                         ide.updateRecentProjectsMenu();
                      }
                   }
@@ -1824,7 +1824,7 @@ class IDEWorkSpace : Window
 
    void DocumentSaved(Window document, const char * fileName)
    {
-      ideConfig.recentFiles.addRecent(CopyString(fileName));
+      ideConfig.recentFiles.addRecent(fileName);
       ide.updateRecentFilesMenu();
       ide.AdjustFileMenus();
    }
@@ -1862,7 +1862,7 @@ class IDEWorkSpace : Window
    {
       if(workspace)
       {
-         CompilerConfig compiler = ideSettings.GetCompilerConfig(workspace.activeCompiler);
+         CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(workspace.activeCompiler);
          for(prj : workspace.projects)
             projectView.ProjectUpdateMakefileForAllConfigs(prj);
          delete compiler;
@@ -1875,7 +1875,7 @@ class IDEWorkSpace : Window
       if(workspace)
       {
          bool silent = mute || (ide.projectView.buildInProgress == none ? false : true);
-         CompilerConfig compiler = ideSettings.GetCompilerConfig(workspace.activeCompiler);
+         CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(workspace.activeCompiler);
          if(!silent)
          {
             projectView.ShowOutputBuildLog(true);
@@ -2332,7 +2332,7 @@ class IDEWorkSpace : Window
 
                         ide.projectView.ShowOutputBuildLog(true);
                         {
-                           CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
+                           CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler);
                            ide.projectView.DisplayCompiler(compiler, false);
                            delete compiler;
                         }
@@ -2435,7 +2435,7 @@ class IDEWorkSpace : Window
                   if(prj)
                   {
                      const char * activeConfigName = null;
-                     CompilerConfig compiler = ideSettings.GetCompilerConfig(workspace.activeCompiler);
+                     CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(workspace.activeCompiler);
                      prj.StartMonitoring();
                      workspace.AddProject(prj, null);
                      if(toolBar.activeConfig.currentRow && toolBar.activeConfig.currentRow != toolBar.activeConfig.firstRow &&
@@ -2569,12 +2569,23 @@ class IDEWorkSpace : Window
             document.state = maximized;
 
          if(isProject)
-            ideConfig.recentWorkspaces.addRecent(CopyString(document.fileName));
-         else if(!workspace)
-            ideConfig.recentFiles.addRecent(CopyString(document.fileName));
-         ide.AdjustFileMenus();
+         {
+            ideConfig.recentWorkspaces.addRecent(document.fileName);
+            ide.updateRecentProjectsMenu();
+            settingsContainer.Save();
+         }
+         else if(workspace)
+         {
+            workspace.recentFiles.addRecent(document.fileName);
+            workspace.Save();
+         }
+         else
+         {
+            ideConfig.recentFiles.addRecent(document.fileName);
+            settingsContainer.Save();
+         }
          ide.updateRecentFilesMenu();
-
+         ide.AdjustFileMenus();
          return document;
       }
       else
@@ -3168,7 +3179,7 @@ class IDEWorkSpace : Window
                   newProjectDialog.Modal();
                   if(projectView)
                   {
-                     ideConfig.recentWorkspaces.addRecent(CopyString(projectView.fileName));
+                     ideConfig.recentWorkspaces.addRecent(projectView.fileName);
                      ide.updateRecentMenus();
                   }
                   delete newProjectDialog;
index c1bf7e2..c223749 100644 (file)
@@ -663,7 +663,7 @@ CompilerConfig GetCompilerConfig()
 #if !defined(ECERE_DOCUMENTOR) && !defined(ECERE_EPJ2MAKE)
    CompilerConfig compiler = null;
    if(ide && ide.workspace)
-      compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
+      compiler = ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler);
    return compiler;
 #else
    incref defaultCompiler;
@@ -926,7 +926,7 @@ private:
 
                if(projectView)
                {
-                  CompilerConfig compiler = ideSettings.GetCompilerConfig(projectView.workspace.activeCompiler);
+                  CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(projectView.workspace.activeCompiler);
                   projectView.AddNode(topNode, null);
                   topNode.row.Move(prev);
 
index 6abf32e..c66acd3 100644 (file)
@@ -929,7 +929,7 @@ class ProjectView : Window
       if(buildInProgress == none)
       {
          Project prj = project;
-         CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
+         CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler);
          int bitDepth = ide.workspace.bitDepth;
          ProjectConfig config;
          if(selection || !ide.activeClient)
@@ -959,7 +959,7 @@ class ProjectView : Window
    bool ProjectInstall(MenuItem selection, Modifiers mods)
    {
       Project prj = project;
-      CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
+      CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler);
       int bitDepth = ide.workspace.bitDepth;
       BuildOutputMode mode = selection ? (BuildOutputMode)selection.id : normal;
       ProjectConfig config;
@@ -993,7 +993,7 @@ class ProjectView : Window
    bool ProjectLink(MenuItem selection, Modifiers mods)
    {
       Project prj = project;
-      CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
+      CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler);
       int bitDepth = ide.workspace.bitDepth;
       BuildOutputMode mode = selection ? (BuildOutputMode)selection.id : normal;
       ProjectConfig config;
@@ -1027,7 +1027,7 @@ class ProjectView : Window
 
    bool ProjectRebuild(MenuItem selection, Modifiers mods)
    {
-      CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
+      CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler);
       int bitDepth = ide.workspace.bitDepth;
       Project prj = project;
       BuildOutputMode mode = selection ? (BuildOutputMode)selection.id : normal;
@@ -1088,7 +1088,7 @@ class ProjectView : Window
    {
       Project prj = project;
       Array<Project> projects { };
-      CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
+      CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler);
       int bitDepth = ide.workspace.bitDepth;
       if(selection)
       {
@@ -1148,7 +1148,7 @@ class ProjectView : Window
    bool ProjectRegenerate(MenuItem selection, Modifiers mods)
    {
       Project prj = project;
-      CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
+      CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler);
       ShowOutputBuildLog(true);
       if(selection || !ide.activeClient)
       {
@@ -1198,7 +1198,7 @@ class ProjectView : Window
 
       if(result)
       {
-         CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
+         CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler);
          int bitDepth = ide.workspace.bitDepth;
          result = false;
          if(ProjectPrepareForToolchain(project, normal, true, true, compiler, config))
@@ -1248,7 +1248,7 @@ class ProjectView : Window
 
       if(result)
       {
-         CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
+         CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler);
          int bitDepth = ide.workspace.bitDepth;
          result = false;
          if(ProjectPrepareForToolchain(project, normal, true, true, compiler, config))
@@ -1374,7 +1374,7 @@ class ProjectView : Window
 
    bool ProjectUpdateMakefileForAllConfigs(Project project)
    {
-      CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
+      CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler);
 
       // This call really does not belong here:
       ide.UpdateToolBarActiveConfigs(false);
@@ -1609,7 +1609,7 @@ class ProjectView : Window
 
    bool Run(MenuItem selection, Modifiers mods)
    {
-      CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
+      CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler);
       ProjectConfig config = project.config;
       int bitDepth = ide.workspace.bitDepth;
       bool shellOpen = compiler.hasDocumentOutput;
@@ -1632,7 +1632,7 @@ class ProjectView : Window
    bool DebugStart()
    {
       bool result = false;
-      CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
+      CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler);
       ProjectConfig config = project.config;
       int bitDepth = ide.workspace.bitDepth;
       bool useValgrind = ide.workspace.useValgrind;
@@ -1841,7 +1841,7 @@ class ProjectView : Window
                      {
                         char name[MAX_FILENAME];
                         Project project = node.project;
-                        CompilerConfig compiler = ideSettings.GetCompilerConfig(project.lastBuildCompilerName);
+                        CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(project.lastBuildCompilerName);
                         if(compiler)
                         {
                            int bitDepth = ide.workspace.bitDepth;
@@ -2054,7 +2054,7 @@ class ProjectView : Window
 
    bool DebugRestart()
    {
-      CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
+      CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler);
       ProjectConfig config = project.config;
       int bitDepth = ide.workspace.bitDepth;
       bool useValgrind = ide.workspace.useValgrind;
@@ -2093,7 +2093,7 @@ class ProjectView : Window
 
    bool DebugStepInto()
    {
-      CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
+      CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler);
       ProjectConfig config = project.config;
       int bitDepth = ide.workspace.bitDepth;
       bool useValgrind = ide.workspace.useValgrind;
@@ -2106,7 +2106,7 @@ class ProjectView : Window
 
    bool DebugStepOver(bool skip)
    {
-      CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
+      CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler);
       ProjectConfig config = project.config;
       int bitDepth = ide.workspace.bitDepth;
       bool useValgrind = ide.workspace.useValgrind;
@@ -2120,7 +2120,7 @@ class ProjectView : Window
 
    bool DebugStepUntil(bool skip)
    {
-      CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
+      CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(ide.workspace.activeCompiler);
       ProjectConfig config = project.config;
       int bitDepth = ide.workspace.bitDepth;
       bool useValgrind = ide.workspace.useValgrind;
index ed4a261..ba6c2b8 100644 (file)
@@ -518,7 +518,7 @@ public:
                      {
                         const char * cfgName = prj.config ? prj.config.name : "";
                         char name[MAX_FILENAME];
-                        CompilerConfig compiler = ideSettings.GetCompilerConfig(prj.lastBuildCompilerName);
+                        CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(prj.lastBuildCompilerName);
                         DirExpression objDir = prj.GetObjDir(compiler, prj.config, bitDepth);
                         strcpy(fullPath, prj.topNode.path);
                         PathCatSlash(fullPath, objDir.dir);
@@ -1098,7 +1098,7 @@ Workspace LoadWorkspace(const char * filePath, const char * fromProjectFile)
                   char path[MAX_LOCATION];
                   strcpy(path, workspace.workspaceDir);
                   PathCatSlash(path, workspace.openedFiles[c].path);
-                  workspace.recentFiles.addRecent(CopyString(path));
+                  workspace.recentFiles.addRecent(path);
                }
             }
          }
@@ -1466,7 +1466,7 @@ Workspace LoadLegacyWorkspace(const char * filePath, Array<String> openedFilesNo
                      TrimLSpaces(equal, equal);
                      if(!strcmpi(buffer, "Active Compiler"))
                      {
-                        CompilerConfig compiler = ideSettings.GetCompilerConfig(equal);
+                        CompilerConfig compiler = ideConfig.compilers.GetCompilerConfig(equal);
                         if(!compiler)
                            workspace.activeCompiler = defaultCompilerName;
                         else