Browse Source

Autosave before Run with Breakpoints in Debuger

Margers 10 months ago
parent
commit
dde4d515bf
2 changed files with 20 additions and 11 deletions
  1. 2 1
      packages/ide/fpide.pas
  2. 18 10
      packages/ide/fpmrun.inc

+ 2 - 1
packages/ide/fpide.pas

@@ -101,6 +101,7 @@ type
       procedure DoShowRegisters;
       procedure DoShowRegisters;
       procedure DoShowFPU;
       procedure DoShowFPU;
       procedure DoShowVector;
       procedure DoShowVector;
+      function  CheckModifiedEditor:boolean;
       function  AskRecompileIfModified:boolean;
       function  AskRecompileIfModified:boolean;
       procedure Messages;
       procedure Messages;
       procedure Calculator;
       procedure Calculator;
@@ -1088,7 +1089,7 @@ begin
       StdStatusKeys(
       StdStatusKeys(
       NewStatusKey('~Cursor~ Move', kbNoKey, 65535,
       NewStatusKey('~Cursor~ Move', kbNoKey, 65535,
       NewStatusKey('~Shift+Cursor~ Size', kbNoKey, 65535,
       NewStatusKey('~Shift+Cursor~ Size', kbNoKey, 65535,
-      NewStatusKey('~'#17'~ Done', kbNoKey, 65535, {#17 = left arrow}
+      NewStatusKey('~'#17#$C4#$D9'~ Done', kbNoKey, 65535, {#17 = left arrow}
       NewStatusKey('~Esc~ Cancel', kbNoKey, 65535,
       NewStatusKey('~Esc~ Cancel', kbNoKey, 65535,
       nil)))))),
       nil)))))),
     NewStatusDef(hcStackWindow, hcStackWindow,
     NewStatusDef(hcStackWindow, hcStackWindow,

+ 18 - 10
packages/ide/fpmrun.inc

@@ -15,16 +15,12 @@
 
 
 {$define MODIFIEDINDEBUG}
 {$define MODIFIEDINDEBUG}
 
 
-function TIDEApp.AskRecompileIfModified:boolean;
+function TIDEApp.CheckModifiedEditor:boolean;
 var
 var
   PW,PPW : PSourceWindow;
   PW,PPW : PSourceWindow;
-  Checkmodifiededitor : boolean;
+  Checkmodified : boolean;
 begin
 begin
-  AskRecompileIfModified:=false;
-{$ifdef MODIFIEDINDEBUG}
-  if not AskRecompileIfModifiedFlag then
-   exit;
-  Checkmodifiededitor:=false;
+  Checkmodified:=false;
   PW:=FirstEditorWindow;
   PW:=FirstEditorWindow;
   PPW:=PW;
   PPW:=PW;
   while assigned(PW) do
   while assigned(PW) do
@@ -34,7 +30,7 @@ begin
         if pw^.editor^.getmodified then
         if pw^.editor^.getmodified then
          if pw^.editor^.core^.getmodifytime > LastCompileTime then
          if pw^.editor^.core^.getmodifytime > LastCompileTime then
            begin
            begin
-             Checkmodifiededitor:=true;
+             Checkmodified:=true;
              break;
              break;
            end;
            end;
       end;
       end;
@@ -44,7 +40,16 @@ begin
      If PW=PPW then
      If PW=PPW then
       break;
       break;
    end;
    end;
-  if Checkmodifiededitor then
+  CheckModifiedEditor:=Checkmodified;
+end;
+
+function TIDEApp.AskRecompileIfModified:boolean;
+begin
+  AskRecompileIfModified:=false;
+{$ifdef MODIFIEDINDEBUG}
+  if not AskRecompileIfModifiedFlag then
+    exit;
+  if CheckModifiedEditor then
    begin
    begin
      if (MessageBox(#3+'You''ve edited a file, recompile the project?',nil,mfinformation+mfyesbutton+mfnobutton)=cmYes) then
      if (MessageBox(#3+'You''ve edited a file, recompile the project?',nil,mfinformation+mfyesbutton+mfnobutton)=cmYes) then
       begin
       begin
@@ -187,7 +192,7 @@ begin
 {$endif}
 {$endif}
     begin
     begin
       if (not ExistsFile(ExeFile)) or (CompilationPhase<>cpDone) or
       if (not ExistsFile(ExeFile)) or (CompilationPhase<>cpDone) or
-         NeedRecompile(cRun,false) then
+         NeedRecompile(cRun,false) or CheckModifiedEditor then
         begin
         begin
           DoCompile(cRun);
           DoCompile(cRun);
           if CompilationPhase<>cpDone then
           if CompilationPhase<>cpDone then
@@ -235,6 +240,9 @@ begin
               else
               else
                 Debugger^.Run;
                 Debugger^.Run;
               RunDirect:=false;
               RunDirect:=false;
+              {we are about to run debuger, AutoSave first}
+              SaveCancelled:=false;
+              AutoSave; {ignore result, ignore if canceled}
             end;
             end;
         end;
         end;
 {$endif ndef NODEBUG}
 {$endif ndef NODEBUG}