ide: fix -debug-start command line switch.
authorRejean Loyer <redj@ecere.com>
Mon, 15 Sep 2014 06:23:07 +0000 (02:23 -0400)
committerJerome St-Louis <jerome@ecere.com>
Wed, 9 Dec 2015 23:11:35 +0000 (18:11 -0500)
ide/src/ide.ec
ide/src/project/Workspace.ec

index c9aa31d..274796a 100644 (file)
@@ -1634,6 +1634,7 @@ class IDEWorkSpace : Window
    };
 
    bool noParsing;
+   bool debugStart;
 
 #ifdef GDB_DEBUG_GUI
    GDBDialog gdbDialog
@@ -3106,7 +3107,6 @@ class IDEWorkSpace : Window
    {
       int c;
       bool passThrough = false;
-      bool debugStart = false;
       bool debugWorkDir = false;
       char * passDebugWorkDir = null;
       bool openAsText = false;
@@ -3136,7 +3136,7 @@ class IDEWorkSpace : Window
          else if(!strcmp(app.argv[c], "-no-parsing"))
             ide.noParsing = true;
          else if(!strcmp(app.argv[c], "-debug-start"))
-            debugStart = true;
+            ide.debugStart = true;
          else if(!strcmp(app.argv[c], "-debug-work-dir"))
             debugWorkDir = true;
          else if(!strcmp(app.argv[c], "-@"))
@@ -3154,7 +3154,7 @@ class IDEWorkSpace : Window
             GetExtension(app.argv[c], ext);
             isProject = !openAsText && !strcmpi(ext, "epj");
 
-            if(isProject && c > (debugStart ? 2 : 1)) continue;
+            if(isProject && c > 1 + (ide.debugStart ? 1 : 0)) continue;
 
             // Create directory for projects (only)
             if(((dirAttribs = FileExists(parentPath)) && dirAttribs.isDirectory) || isProject)
@@ -3207,8 +3207,6 @@ class IDEWorkSpace : Window
          workspace.debugDir = passDebugWorkDir;
          delete passDebugWorkDir;
       }
-      if(debugStart)
-         ;//MenuDebugStart(debugStartResumeItem, 0); // <-- how TODO this without getting into the app.Wait lock
 
       UpdateToolBarActiveConfigs(false);
       UpdateToolBarActiveCompilers();
index 41bf369..175a0aa 100644 (file)
@@ -134,11 +134,20 @@ public:
 
    Timer timer
    {
-      userData = this, delay = 2.5;
+      userData = this, delay = 1.0;
       bool DelayExpired()
       {
-         if(modified)
+         static bool skip = true;
+         if(skip)
+            skip = false;
+         else if(modified)
             Save();
+
+         if(ide.debugStart)
+         {
+            ide.MenuDebugStart(ide.debugStartResumeItem, 0);
+            ide.debugStart = false;
+         }
          return true;
       }
    };