ide: fix -debug-start command line switch.
authorRejean Loyer <redj@ecere.com>
Mon, 15 Sep 2014 06:23:07 +0000 (02:23 -0400)
committerRejean Loyer <redj@ecere.com>
Mon, 16 Mar 2015 05:31:37 +0000 (01:31 -0400)
ide/src/ide.ec
ide/src/project/Workspace.ec

index 044bab6..e1200b8 100755 (executable)
@@ -1638,6 +1638,7 @@ class IDEWorkSpace : Window
    };
 
    bool noParsing;
+   bool debugStart;
 
 #ifdef GDB_DEBUG_GUI
    GDBDialog gdbDialog
@@ -3111,7 +3112,6 @@ class IDEWorkSpace : Window
    {
       int c;
       bool passThrough = false;
-      bool debugStart = false;
       bool debugWorkDir = false;
       char * passDebugWorkDir = null;
       bool openAsText = false;
@@ -3141,7 +3141,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], "-@"))
@@ -3159,7 +3159,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)
@@ -3212,8 +3212,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 6f126a0..8e3d56e 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;
       }
    };