ide: tweaked code related to managing (or not) debug session when compiling. fixed...
authorRejean Loyer <rejean.loyer@gmail.com>
Mon, 30 May 2011 00:03:54 +0000 (20:03 -0400)
committerRejean Loyer <rejean.loyer@gmail.com>
Mon, 30 May 2011 00:03:54 +0000 (20:03 -0400)
ide/src/debugger/Debugger.ec
ide/src/ide.ec
ide/src/project/Project.ec
ide/src/project/ProjectView.ec

index 8364573..977e759 100644 (file)
@@ -621,13 +621,8 @@ class Debugger
 
    // PUBLIC MEMBERS
 
-   property bool isActiveForCurrentConfig
-   {
-      get
-      {
-         return ide.project && ide.project.config == prjConfig && (state == running || state == stopped) ? true : false;
-      }
-   }
+   property bool isActive { get { return state == running || state == stopped; } }
+   property bool isPrepared  { get { return state == loaded || state == running || state == stopped; } }
 
    void Resume()
    {
index fd926d1..0c08878 100644 (file)
@@ -1545,7 +1545,7 @@ class IDE : Window
 
    bool DontTerminateDebugSession(char * title)
    {
-      if(debugger.isActiveForCurrentConfig)
+      if(debugger.isActive)
       {
          if(MessageBox { type = yesNo, master = ide, 
                            contents = "Do you want to terminate the debugging session in progress?", 
index cbe594d..63d87f2 100644 (file)
@@ -855,6 +855,26 @@ private:
    }
    //SetBool excludeFromBuild;
 
+   property bool configIsInActiveDebugSession
+   {
+      get
+      {
+#ifndef MAKEFILE_GENERATOR
+         return ide.project == this  && ide.debugger && ide.debugger.prjConfig == config && ide.debugger.isActive;
+#endif
+      }
+   }
+
+   property bool configIsInDebugSession
+   {
+      get
+      {
+#ifndef MAKEFILE_GENERATOR
+         return ide.project == this  && ide.debugger && ide.debugger.prjConfig == config && ide.debugger.isPrepared;
+#endif
+      }
+   }
+
    void SetPath(bool projectsDirs)
    {
 #ifndef MAKEFILE_GENERATOR
index 1735968..f87f5bb 100644 (file)
@@ -822,7 +822,7 @@ class ProjectView : Window
 
    ~ProjectView()
    {
-      ide.debugger.Stop();
+      DebugStop();
       ide.DestroyTemporaryProjectDir();
       if(project)
       {
@@ -982,7 +982,7 @@ class ProjectView : Window
          if(node)
             prj = node.project;
       }
-      if(prj != project || !ide.DontTerminateDebugSession("Project Build"))
+      if(/*prj != project || */!prj.configIsInDebugSession || !ide.DontTerminateDebugSession("Project Build"))
          BuildInterrim(prj, build, false);
       return true;
    }
@@ -1247,8 +1247,8 @@ class ProjectView : Window
       {
          DirExpression targetDir = prj.targetDir;
 
-         if(buildType != run && prj == project && ide.debugger.isActiveForCurrentConfig)
-            ide.debugger.Stop();
+         if(buildType != run/* && prj == project*/ && prj.configIsInDebugSession)
+            DebugStop();
          
          // TODO: Disabled until problems fixed... is it fixed?
          if(buildType == rebuild || (prj.config && prj.config.compilingModified))