Browse Source

* MyApp renamed IDEApp
* TDebugController.ResetDebuggerRows added to
get resetting of debugger rows

pierre 26 years ago
parent
commit
42641bdcec
5 changed files with 148 additions and 104 deletions
  1. 13 8
      ide/text/fp.pas
  2. 8 3
      ide/text/fpcatch.pas
  3. 36 24
      ide/text/fpdebug.pas
  4. 21 10
      ide/text/fpide.pas
  5. 70 59
      ide/text/fpviews.pas

+ 13 - 8
ide/text/fp.pas

@@ -157,31 +157,31 @@ BEGIN
   InitTemplates;
 
   ReadSwitches(SwitchesPath);
-  MyApp.Init;
+  IDEApp.Init;
   { load all options after init because of open files }
   ReadINIFile;
   InitDesktopFile;
   LoadDesktop;
 
   { Update IDE }
-  MyApp.Update;
-  MyApp.UpdateTarget;
+  IDEApp.Update;
+  IDEApp.UpdateTarget;
 
   ProcessParams(false);
 
   repeat
-    MyApp.Run;
+    IDEApp.Run;
     if (AutoSaveOptions and asEditorFiles)=0 then
       CanExit:=true
     else
-      CanExit:=MyApp.SaveAll;
+      CanExit:=IDEApp.SaveAll;
   until CanExit;
 
-  MyApp.AutoSave;
+  IDEApp.AutoSave;
 
   DoneDesktopFile;
 
-  MyApp.Done;
+  IDEApp.Done;
   WriteSwitches(SwitchesPath);
 
   DoneTemplates;
@@ -202,7 +202,12 @@ BEGIN
 END.
 {
   $Log$
-  Revision 1.33  1999-12-20 09:36:49  pierre
+  Revision 1.34  1999-12-20 14:23:16  pierre
+    * MyApp renamed IDEApp
+    * TDebugController.ResetDebuggerRows added to
+      get resetting of debugger rows
+
+  Revision 1.33  1999/12/20 09:36:49  pierre
    * get the mouse visible on win32 fp
 
   Revision 1.32  1999/12/10 13:02:05  pierre

+ 8 - 3
ide/text/fpcatch.pas

@@ -50,7 +50,7 @@ var CanQuit: boolean;
 begin
   case Sig of
    SIGSEGV : begin
-               if Assigned(Application) then MyApp.Done;
+               if Assigned(Application) then IDEApp.Done;
                Writeln('Internal Error caught');
                Halt;
              end;
@@ -61,7 +61,7 @@ begin
                  CanQuit:=true;
                if CanQuit then
                 begin
-                  if Assigned(Application) then MyApp.Done;
+                  if Assigned(Application) then IDEApp.Done;
                   Halt;
                 end;
              end;
@@ -87,7 +87,12 @@ end.
 
 {
   $Log$
-  Revision 1.2  1999-04-07 21:55:42  peter
+  Revision 1.3  1999-12-20 14:23:16  pierre
+    * MyApp renamed IDEApp
+    * TDebugController.ResetDebuggerRows added to
+      get resetting of debugger rows
+
+  Revision 1.2  1999/04/07 21:55:42  peter
     + object support for browser
     * html help fixes
     * more desktop saving things

+ 36 - 24
ide/text/fpdebug.pas

@@ -45,6 +45,7 @@ type
     procedure DoDebuggerScreen;virtual;
     procedure DoUserScreen;virtual;
     procedure Reset;virtual;
+    procedure ResetDebuggerRows;
     procedure Run;virtual;
     procedure Continue;virtual;
     procedure UntilReturn;virtual;
@@ -442,7 +443,7 @@ begin
   UserScreen;
   inherited Run;
   DebuggerScreen;
-  MyApp.SetCmdState([cmResetDebugger,cmUntilReturn],true);
+  IDEApp.SetCmdState([cmResetDebugger,cmUntilReturn],true);
   If assigned(StackWindow) then
     StackWindow^.Update;
 end;
@@ -500,30 +501,30 @@ function  TDebugController.AllowQuit : boolean;
 begin
   if ConfirmBox('Really quit editor ?',nil,true)=cmOK then
     begin
-      Message(@MyApp,evCommand,cmQuit,nil);
+      Message(@IDEApp,evCommand,cmQuit,nil);
     end
   else
     AllowQuit:=false;
 end;
 
-procedure TDebugController.Reset;
-var
-  W : PSourceWindow;
-  procedure ResetDebugerRow(P: PView); {$ifndef FPC}far;{$endif}
+procedure TDebugController.ResetDebuggerRows;
+  procedure ResetDebuggerRow(P: PView); {$ifndef FPC}far;{$endif}
   begin
     if assigned(P) and
        (TypeOf(P^)=TypeOf(TSourceWindow)) then
-      Message(P,evCommand,cmResetDebuggerRow,nil);
+       PSourceWindow(P)^.Editor^.SetDebuggerRow(-1);
   end;
 
+begin
+  Desktop^.ForEach(@ResetDebuggerRow);
+end;
+
+procedure TDebugController.Reset;
 begin
   inherited Reset;
   NoSwitch:=false;
-  MyApp.SetCmdState([cmResetDebugger,cmUntilReturn],false);
-  W:=PSourceWindow(LastSource);
-  if assigned(W) then
-     W^.Editor^.SetDebuggerRow(-1);
-  Desktop^.ForEach(@ResetDebugerRow);
+  IDEApp.SetCmdState([cmResetDebugger,cmUntilReturn],false);
+  ResetDebuggerRows;
 end;
 
 procedure TDebugController.AnnotateError;
@@ -591,7 +592,7 @@ begin
       else
        begin
          Desktop^.UnLock;
-         Found:=MyApp.OpenSearch(fn);
+         Found:=IDEApp.OpenSearch(fn);
          Desktop^.Lock;
          if not Found then
            begin
@@ -654,10 +655,8 @@ procedure TDebugController.DoEndSession(code:longint);
 var P :Array[1..2] of longint;
     W : PSourceWindow;
 begin
-   MyApp.SetCmdState([cmResetDebugger],false);
-   W:=PSourceWindow(LastSource);
-   if assigned(W) then
-     W^.Editor^.SetDebuggerRow(-1);
+   IDEApp.SetCmdState([cmResetDebugger],false);
+   ResetDebuggerRows;
    LastExitCode:=Code;
    If HiddenStepsCount=0 then
      InformationBox(#3'Program exited with '#13#3'exitcode = %d',@code)
@@ -677,7 +676,7 @@ begin
   if NoSwitch then
     PopStatus
   else
-    MyApp.ShowIDEScreen;
+    IDEApp.ShowIDEScreen;
 end;
 
 
@@ -686,7 +685,7 @@ begin
   if NoSwitch then
     PushStatus('Executable running in another window..')
   else
-    MyApp.ShowUserScreen;
+    IDEApp.ShowUserScreen;
 end;
 
 {****************************************************************************
@@ -824,7 +823,8 @@ begin
           GDBIndex:=Debugger^.last_breakpoint_number;
           GDBState:=bs_enabled;
           Debugger^.Command('cond '+IntToStr(GDBIndex)+' '+GetStr(Conditions));
-          Debugger^.Command('ignore '+IntToStr(GDBIndex)+' '+IntToStr(IgnoreCount));
+          If IgnoreCount>0 then
+            Debugger^.Command('ignore '+IntToStr(GDBIndex)+' '+IntToStr(IgnoreCount));
           If Assigned(Commands) then
             begin
               {Commands are not handled yet }
@@ -835,7 +835,7 @@ begin
         begin
           GDBIndex:=0;
           ErrorBox(#3'Could not set Breakpoint'#13+
-            #3+BreakpointTypeStr[typ]+' '+Name^,nil);
+            #3+BreakpointTypeStr[typ]+' '+GetStr(Name),nil);
           state:=bs_disabled;
         end;
     end
@@ -947,7 +947,7 @@ function TBreakpointCollection.GetType(typ : BreakpointType;Const s : String) :
 
   function IsThis(P : PBreakpoint) : boolean;{$ifndef FPC}far;{$endif}
   begin
-    IsThis:=(P^.typ=typ) and (P^.Name^=S);
+    IsThis:=(P^.typ=typ) and (GetStr(P^.Name)=S);
   end;
 
 begin
@@ -2168,6 +2168,8 @@ end;
   procedure TFramesListBox.Update;
 
     var i : longint;
+        W : PSourceWindow;
+
     begin
       { call backtrace command }
       If not assigned(Debugger) then
@@ -2180,12 +2182,17 @@ end;
       Debugger^.Command('backtrace');
       { generate list }
       { all is in tframeentry }
-      for i:=0 to Debugger^.frame_count-1 do
+      for i:=Debugger^.frame_count-1 downto 0 do
         begin
           with Debugger^.frames[i]^ do
             begin
               AddItem(new(PMessageItem,init(0,GetPChar(function_name)+GetPChar(args),
                 AddModuleName(GetPChar(file_name)),line_number,1)));
+              W:=SearchOnDesktop(GetPChar(file_name),false);
+              If assigned(W) then
+                begin
+                  W^.editor^.SetDebuggerRow(line_number);
+                end;
             end;
         end;
       if List^.Count > 0 then
@@ -2401,7 +2408,12 @@ end.
 
 {
   $Log$
-  Revision 1.35  1999-11-24 14:03:16  pierre
+  Revision 1.36  1999-12-20 14:23:16  pierre
+    * MyApp renamed IDEApp
+    * TDebugController.ResetDebuggerRows added to
+      get resetting of debugger rows
+
+  Revision 1.35  1999/11/24 14:03:16  pierre
    + Executing... in status line if in another window
 
   Revision 1.34  1999/11/10 17:19:58  pierre

+ 21 - 10
ide/text/fpide.pas

@@ -45,9 +45,9 @@ type
       function    GetPalette: PPalette; virtual;
       procedure   DosShell; virtual;
       destructor  Done; virtual;
-    public
-      procedure ShowUserScreen;
-      procedure ShowIDEScreen;
+      procedure   ShowUserScreen;
+      procedure   ShowIDEScreen;
+      function    IsClosing : boolean;
     private
       procedure NewEditor;
       procedure NewFromTemplate;
@@ -113,14 +113,13 @@ type
       procedure HelpFiles;
       procedure About;
     private
+      SaveCancelled: boolean;
+      InsideDone : boolean;
+      LastEvent: longint;
       function  DoExecute(ProgramPath, Params, InFile, OutFile: string; ExecType: TExecType): boolean;
-    private
       procedure AddRecentFile(AFileName: string; CurX, CurY: integer);
       function  SearchRecentFile(AFileName: string): integer;
       procedure RemoveRecentFile(Index: integer);
-    private
-      SaveCancelled: boolean;
-      LastEvent: longint;
       procedure CurDirChanged;
       procedure UpdatePrimaryFile;
       procedure UpdateINIFile;
@@ -130,7 +129,7 @@ type
 
 
 var
-  MyApp: TIDEApp;
+  IDEApp: TIDEApp;
 
 implementation
 
@@ -174,6 +173,7 @@ begin
 {$endif TP}
   {$endif}
   inherited Init;
+  InsideDone:=false;
   MenuBar^.GetBounds(R); R.A.X:=R.B.X-8;
   New(ClockView, Init(R));
   Application^.Insert(ClockView);
@@ -613,7 +613,7 @@ begin
         ErrorBox('Error saving configuration.',nil);
     end;
   if (AutoSaveOptions and asEditorFiles)=0 then
-      SOK:=MyApp.SaveAll;
+      SOK:=SaveAll;
   if (AutoSaveOptions and asDesktop)<>0 then
     begin
       { destory all help & browser windows - we don't want to store them }
@@ -845,8 +845,14 @@ begin
   GetPalette:=@P;
 end;
 
+function TIDEApp.IsClosing: Boolean;
+begin
+  IsClosing:=InsideDone;
+end;
+
 destructor TIDEApp.Done;
 begin
+  InsideDone:=true;
   inherited Done;
   RemoveBrowsersCollection;
   DoneHelpSystem;
@@ -855,7 +861,12 @@ end;
 END.
 {
   $Log$
-  Revision 1.46  1999-12-17 15:07:01  florian
+  Revision 1.47  1999-12-20 14:23:17  pierre
+    * MyApp renamed IDEApp
+    * TDebugController.ResetDebuggerRows added to
+      get resetting of debugger rows
+
+  Revision 1.46  1999/12/17 15:07:01  florian
     + TIDEApp.Idle does always call GiveUpTimeSlice
 
   Revision 1.45  1999/12/10 13:02:05  pierre

+ 70 - 59
ide/text/fpviews.pas

@@ -343,6 +343,7 @@ procedure TranslateMouseClick(View: PView; var Event: TEvent);
 
 function GetNextEditorBounds(var Bounds: TRect): boolean;
 function OpenEditorWindow(Bounds: PRect; FileName: string; CurX,CurY: sw_integer): PSourceWindow;
+function SearchOnDesktop(FileName : string;tryexts:boolean) : PSourceWindow;
 function TryToOpenFile(Bounds: PRect; FileName: string; CurX,CurY: sw_integer;tryexts:boolean): PSourceWindow;
 
 function StartEditor(Editor: PCodeEditor; FileName: string): boolean;
@@ -386,7 +387,7 @@ uses
 {$endif NODEBUG}
   {$ifdef VESA}Vesa,{$endif}
   FPSwitch,FPSymbol,FPDebug,FPVars,FPUtils,FPCompile,FPHelp,
-  FPTools;
+  FPTools,FPIde;
 
 const
   RSourceEditor: TStreamRec = (
@@ -1216,9 +1217,13 @@ end;
 
 destructor TSourceWindow.Done;
 begin
-  Message(Application,evBroadcast,cmSourceWndClosing,@Self);
+  PushStatus('Closing '+GetStr(Title));
+  if not IDEApp.IsClosing then
+    Message(Application,evBroadcast,cmSourceWndClosing,@Self);
   inherited Done;
-  Message(Application,evBroadcast,cmUpdate,@Self);
+  if not IDEApp.IsClosing then
+    Message(Application,evBroadcast,cmUpdate,@Self);
+  PopStatus;
 end;
 
 function TGDBSourceEditor.Valid(Command: Word): Boolean;
@@ -2404,6 +2409,60 @@ begin
   OpenEditorWindow:=W;
 end;
 
+function SearchOnDesktop(FileName : string;tryexts:boolean) : PSourceWindow;
+var
+    V: PView;
+    W: PWindow;
+    I: integer;
+    D,DS : DirStr;
+    N,NS : NameStr;
+    E,ES : ExtStr;
+    Found : boolean;
+    SName : string;
+
+function IsSearchedFile(W : PSourceWindow) : boolean;
+  var Found: boolean;
+  begin
+    Found:=false;
+    if (W<>nil) and (W^.HelpCtx=hcSourceWindow) then
+      begin
+        if (D='') then
+          SName:=NameAndExtOf(PSourceWindow(W)^.Editor^.FileName)
+        else
+          SName:=PSourceWindow(W)^.Editor^.FileName;
+        FSplit(SName,DS,NS,ES);
+        SName:=UpcaseStr(NS+ES);
+
+        if (E<>'') or (not tryexts) then
+          begin
+            if D<>'' then
+              Found:=UpCaseStr(DS)+SName=UpcaseStr(D+N+E)
+            else
+              Found:=SName=UpcaseStr(N+E);
+          end
+        else
+          begin
+            Found:=SName=UpcaseStr(N+'.pp');
+            if Found=false then
+              Found:=SName=UpcaseStr(N+'.pas');
+          end;
+      end;
+    IsSearchedFile:=found;
+  end;
+function IsSearchedSource(P: PView) : boolean; {$ifndef FPC}far;{$endif}
+begin
+  if assigned(P) and
+     (TypeOf(P^)=TypeOf(TSourceWindow)) then
+       IsSearchedSource:=IsSearchedFile(PSourceWindow(P))
+     else
+       IsSearchedSource:=false;
+end;
+
+begin
+  FSplit(FileName,D,N,E);
+  SearchOnDesktop:=PSourceWindow(Desktop^.FirstThat(@IsSearchedSource));
+end;
+
 function TryToOpenFile(Bounds: PRect; FileName: string; CurX,CurY: sw_integer;tryexts:boolean): PSourceWindow;
 var D : DirStr;
     N : NameStr;
@@ -2457,64 +2516,10 @@ var D : DirStr;
     TryToOpen:=W;
   end;
 
-  function SearchOnDesktop: PSourceWindow;
-  var
-      V: PView;
-      W: PWindow;
-      I: integer;
-      DS : DirStr;
-      NS : NameStr;
-      ES : ExtStr;
-      Found : boolean;
-      SName : string;
-
-  function IsSearchedFile(W : PSourceWindow) : boolean;
-    var Found: boolean;
-    begin
-      Found:=false;
-      if (W<>nil) and (W^.HelpCtx=hcSourceWindow) then
-        begin
-          if (D='') then
-            SName:=NameAndExtOf(PSourceWindow(W)^.Editor^.FileName)
-          else
-            SName:=PSourceWindow(W)^.Editor^.FileName;
-          FSplit(SName,DS,NS,ES);
-          SName:=UpcaseStr(NS+ES);
-
-          if (E<>'') or (not tryexts) then
-            begin
-              if D<>'' then
-                Found:=UpCaseStr(DS)+SName=UpcaseStr(D+N+E)
-              else
-                Found:=SName=UpcaseStr(N+E);
-            end
-          else
-            begin
-              Found:=SName=UpcaseStr(N+'.pp');
-              if Found=false then
-                Found:=SName=UpcaseStr(N+'.pas');
-            end;
-        end;
-      IsSearchedFile:=found;
-    end;
-  function IsSearchedSource(P: PView) : boolean; {$ifndef FPC}far;{$endif}
-  begin
-    if assigned(P) and
-       (TypeOf(P^)=TypeOf(TSourceWindow)) then
-         IsSearchedSource:=IsSearchedFile(PSourceWindow(P))
-       else
-         IsSearchedSource:=false;
-  end;
-
-  begin
-    SearchOnDesktop:=PSourceWindow(Desktop^.FirstThat(@IsSearchedSource));
-  end;
-
 var
   W : PSourceWindow;
 begin
-  FSplit(FileName,D,N,E);
-  W:=SearchOnDesktop;
+  W:=SearchOnDesktop(FileName,tryexts);
   if W<>nil then
     begin
       NewEditorOpened:=false;
@@ -2524,6 +2529,7 @@ begin
     end
   else
     begin
+      FSplit(FileName,D,N,E);
       DrStr:=GetSourceDirectories;
       While pos(';',DrStr)>0 do
         Begin
@@ -2863,7 +2869,12 @@ end;
 END.
 {
   $Log$
-  Revision 1.50  1999-12-16 16:55:52  pierre
+  Revision 1.51  1999-12-20 14:23:17  pierre
+    * MyApp renamed IDEApp
+    * TDebugController.ResetDebuggerRows added to
+      get resetting of debugger rows
+
+  Revision 1.50  1999/12/16 16:55:52  pierre
    * fix of web bug 756
 
   Revision 1.49  1999/11/25 00:25:43  pierre