ide/Project Settings/Workspace: (#815) Fixed env vars partially entered going away...
authorJerome St-Louis <jerome@ecere.com>
Tue, 20 May 2014 20:56:47 +0000 (16:56 -0400)
committerJerome St-Louis <jerome@ecere.com>
Tue, 20 May 2014 20:56:47 +0000 (16:56 -0400)
- The reload is only needed on creation of the Project Settings dialog, as it is always constructed
  right before showing the dialog. The env. vars with only name or value entered will not be saved
  however after closing the dialog. The only question that remains is whether we would like to allow
  defining a variable to an empty value or not, so as to clear existing values in the environment.

ide/src/dialogs/WorkspaceSettings.ec

index 17f23fc..a13c796 100644 (file)
@@ -2,6 +2,9 @@ import "Project"
 
 class WorkspaceTab : Tab
 {
+   bool firstCreation;
+   firstCreation = true;
+
    background = formColor;
    text = $"Workspace";
 
@@ -53,26 +56,30 @@ class WorkspaceTab : Tab
 
    bool OnCreate()
    {
-      // This is required to be here because the label is labeling its parent, which otherwise has issues
-      labelSourceDirs.labeledWindow = sourceDirs;
-
-      if(ide.projectView)
+      if(firstCreation)
       {
-         Array<String> strings { };
-         char path[MAX_LOCATION];
-         String debugDir = ide.workspace.debugDir;
-         for(dir : ide.workspace.sourceDirs)
-            strings.Add(dir);
-         sourceDirs.strings = strings;
+         // This is required to be here because the label is labeling its parent, which otherwise has issues
+         labelSourceDirs.labeledWindow = sourceDirs;
 
-         strcpy(path, ide.workspace.projectDir);
-         if(debugDir)
-            PathCat(path, debugDir);
-         debugDirectory.path = path;
-         commandLineArgs.contents = ide.workspace.commandLineArgs;
-         environmentVars.namedStrings = ide.workspace.environmentVars;
+         if(ide.projectView)
+         {
+            Array<String> strings { };
+            char path[MAX_LOCATION];
+            String debugDir = ide.workspace.debugDir;
+            for(dir : ide.workspace.sourceDirs)
+               strings.Add(dir);
+            sourceDirs.strings = strings;
+
+            strcpy(path, ide.workspace.projectDir);
+            if(debugDir)
+               PathCat(path, debugDir);
+            debugDirectory.path = path;
+            commandLineArgs.contents = ide.workspace.commandLineArgs;
+            environmentVars.namedStrings = ide.workspace.environmentVars;
 
-         delete strings;
+            delete strings;
+         }
+         firstCreation = false;
       }
       return true;
    }