Browse Source

* GDBWindow redesigned :
normal editor apart from
that any kbEnter will send the line (for begin to cursor)
to GDB command !
GDBWindow opened in Debugger Menu
still buggy :
-echo should not be present if at end of text
-GDBWindow becomes First after each step (I don't know why !)

pierre 26 years ago
parent
commit
b4eaffdca4
7 changed files with 159 additions and 36 deletions
  1. 15 1
      ide/text/fpconst.pas
  2. 40 15
      ide/text/fpdebug.pas
  3. 13 3
      ide/text/fphelp.pas
  4. 16 3
      ide/text/fpide.pas
  5. 18 1
      ide/text/fpmrun.inc
  6. 44 10
      ide/text/fpviews.pas
  7. 13 3
      ide/text/weditor.pas

+ 15 - 1
ide/text/fpconst.pas

@@ -77,6 +77,7 @@ const
      cmStepOver          = 227;
      cmResetDebugger     = 228;
      cmContToCursor      = 229;
+     cmOpenGDBWindow     = 230;
      
      cmNotImplemented    = 1000;
      cmNewFromTemplate   = 1001;
@@ -200,6 +201,7 @@ const
      hcParameters        = hcShift+cmParameters;
      hcResetDebugger     = hcShift+cmResetDebugger;
      hcContToCursor      = hcShift+cmContToCursor;
+     hcOpenGDBWindow     = hcShift+cmOpenGDBWindow;
      hcCompile           = hcShift+cmCompile;
      hcMake              = hcShift+cmMake;
      hcBuild             = hcShift+cmBuild;
@@ -251,6 +253,8 @@ const
      CBrowserTab =
         #6#12;
 
+     CGDBInputLine     = #9#9#10#11#12;
+     
      CIDEAppColor = CAppColor +
          { CIDEHelpDialog }
 {128-143}#$70#$7F#$7A#$13#$13#$70#$70#$7F#$7E#$20#$2B#$2F#$78#$2E#$70#$30 + { 1-16}
@@ -269,7 +273,17 @@ implementation
 END.
 {
   $Log$
-  Revision 1.9  1999-02-08 17:40:00  pierre
+  Revision 1.10  1999-02-11 19:07:19  pierre
+    * GDBWindow redesigned :
+      normal editor apart from
+      that any kbEnter will send the line (for begin to cursor)
+      to GDB command !
+      GDBWindow opened in Debugger Menu
+       still buggy :
+       -echo should not be present if at end of text
+       -GDBWindow becomes First after each step (I don't know why !)
+
+  Revision 1.9  1999/02/08 17:40:00  pierre
    + cmContToCursor added
 
   Revision 1.8  1999/02/04 12:23:43  pierre

+ 40 - 15
ide/text/fpdebug.pas

@@ -98,6 +98,8 @@ var
   
 procedure InitDebugger;
 procedure DoneDebugger;
+procedure InitGDBWindow;
+procedure DoneGDBWindow;
 procedure InitBreakpoints;
 procedure DoneBreakpoints;
 
@@ -197,6 +199,7 @@ begin
       If StrLen(GetError)>0 then
         GDBWindow^.WriteErrorText(GetError);
       GDBWindow^.WriteOutputText(GetOutput);
+      GDBWindow^.Editor^.TextEnd;
     end;
 end;
 
@@ -243,7 +246,8 @@ begin
           W^.Editor^.SetCurPtr(0,Line);
           W^.Editor^.TrackCursor(true);
           W^.Editor^.SetHighlightRow(Line);
-          W^.Select;
+          if Not assigned(GDBWindow) or not GDBWindow^.Focus then
+            W^.Select;
           InvalidSourceLine:=false;
         end
       else
@@ -256,7 +260,8 @@ begin
         begin
           W^.Editor^.SetHighlightRow(Line);
           W^.Editor^.TrackCursor(true);
-          W^.Select;
+          if Not assigned(GDBWindow) or not GDBWindow^.Focus then
+            W^.Select;
           LastSource:=W;
           InvalidSourceLine:=false;
         end
@@ -277,7 +282,8 @@ begin
               W:=TryToOpenFile(nil,fn,0,Line);
               W^.Editor^.SetHighlightRow(Line);
               W^.Editor^.TrackCursor(true);
-              W^.Select;
+              if Not assigned(GDBWindow) or not GDBWindow^.Focus then
+                W^.Select;
               LastSource:=W;
               InvalidSourceLine:=false;
            end;
@@ -289,7 +295,8 @@ begin
     begin
       PB:=BreakpointCollection^.GetGDB(stop_breakpoint_number);
       { For watch we should get old and new value !! }
-      If PB^.typ<>bt_file_line then
+      if (Not assigned(GDBWindow) or not GDBWindow^.Focus) and
+         (PB^.typ<>bt_file_line) then
         begin
            Command('p '+GetStr(PB^.Name));
            S:=StrPas(GetOutput);
@@ -595,10 +602,6 @@ end;
 ****************************************************************************}
 
 procedure InitDebugger;
-
-var
-  R : TRect;
-
 begin
   Assign(gdb_file,'gdb$$$.out');
   Rewrite(gdb_file);
@@ -617,12 +620,7 @@ begin
    dispose(Debugger,Done);
   new(Debugger,Init(ExeFile));
 {$ifdef GDBWINDOW}
-  if GDBWindow=nil then
-    begin
-      DeskTop^.GetExtent(R);
-      new(GDBWindow,init(R));
-      DeskTop^.Insert(GDBWindow);
-    end;
+  InitGDBWindow;
 {$endif def GDBWINDOW}
 end;
 
@@ -635,6 +633,23 @@ begin
   If Use_gdb_file then
     Close(GDB_file);
   Use_gdb_file:=false;
+  {DoneGDBWindow;}
+end;
+
+procedure InitGDBWindow;
+var
+  R : TRect;
+begin
+  if GDBWindow=nil then
+    begin
+      DeskTop^.GetExtent(R);
+      new(GDBWindow,init(R));
+      DeskTop^.Insert(GDBWindow);
+    end;
+end;
+
+procedure DoneGDBWindow;
+begin
   if assigned(GDBWindow) then
     begin
       DeskTop^.Delete(GDBWindow);
@@ -657,7 +672,17 @@ end.
 
 {
   $Log$
-  Revision 1.11  1999-02-11 13:10:03  pierre
+  Revision 1.12  1999-02-11 19:07:20  pierre
+    * GDBWindow redesigned :
+      normal editor apart from
+      that any kbEnter will send the line (for begin to cursor)
+      to GDB command !
+      GDBWindow opened in Debugger Menu
+       still buggy :
+       -echo should not be present if at end of text
+       -GDBWindow becomes First after each step (I don't know why !)
+
+  Revision 1.11  1999/02/11 13:10:03  pierre
    + GDBWindow only with -dGDBWindow for now : still buggy !!
 
   Revision 1.10  1999/02/10 09:55:07  pierre

+ 13 - 3
ide/text/fphelp.pas

@@ -141,9 +141,9 @@ begin
     hcClearPrimary  : S:='Clear the file previously set to Primary';
     hcInformation   : S:='Show compiler messages and program information';
 
-    hcDebugMenu     : S:='';
+    hcDebugMenu     : S:='Debug Program';
     hcToggleBreakpoint : S:='Toggles Breakpoint';
-
+    hcOpenGDBWindow : S:='Open direct window to GDB';
     hcToolsMenu     : S:='User installed tools';
     hcCalculator    : S:='Show calculator';
     hcGrep          : S:='Run grep';
@@ -356,7 +356,17 @@ end;
 END.
 {
   $Log$
-  Revision 1.7  1999-02-08 17:40:01  pierre
+  Revision 1.8  1999-02-11 19:07:21  pierre
+    * GDBWindow redesigned :
+      normal editor apart from
+      that any kbEnter will send the line (for begin to cursor)
+      to GDB command !
+      GDBWindow opened in Debugger Menu
+       still buggy :
+       -echo should not be present if at end of text
+       -GDBWindow becomes First after each step (I don't know why !)
+
+  Revision 1.7  1999/02/08 17:40:01  pierre
    + cmContToCursor added
 
   Revision 1.6  1999/02/08 10:37:43  peter

+ 16 - 3
ide/text/fpide.pas

@@ -57,6 +57,7 @@ type
       procedure ClearPrimary;
       procedure DoUserScreenWindow;
       procedure DoUserScreen;
+      procedure DoOpenGDBWindow;
       procedure DoToggleBreak;
       procedure Information;
       procedure Calculator;
@@ -206,7 +207,8 @@ begin
       NewItem('~O~utput','', kbNoKey, cmUserScreenWindow, hcUserScreenWindow,
       NewItem('~U~ser screen','Alt+F5', kbAltF5, cmUserScreen, hcUserScreen,
       NewItem('~B~reakpoint','Ctrl+F8', kbCtrlF8, cmToggleBreakpoint, hcToggleBreakpoint,
-      nil)))),
+      NewItem('~G~DB window','', kbNoKey, cmOpenGDBWindow, hcOpenGDBWindow,
+      nil))))),
     NewSubMenu('~T~ools', hcToolsMenu, NewMenu(
       NewItem('~M~essages', '', kbNoKey, cmToolsMessages, hcToolsMessages,
       NewLine(
@@ -353,7 +355,8 @@ begin
              cmInformation   : Information;
            { -- Debug menu -- }
              cmUserScreen    : DoUserScreen;
-             cmToggleBreakpoint   : DoToggleBreak;
+        cmToggleBreakpoint   : DoToggleBreak;
+             cmOpenGDBWindow : DoOpenGDBWindow;
            { -- Options menu -- }
              cmSwitchesMode  : SetSwitchesMode;
              cmCompiler      : DoCompilerSwitch;
@@ -654,7 +657,17 @@ end;
 END.
 {
   $Log$
-  Revision 1.13  1999-02-10 09:54:11  pierre
+  Revision 1.14  1999-02-11 19:07:22  pierre
+    * GDBWindow redesigned :
+      normal editor apart from
+      that any kbEnter will send the line (for begin to cursor)
+      to GDB command !
+      GDBWindow opened in Debugger Menu
+       still buggy :
+       -echo should not be present if at end of text
+       -GDBWindow becomes First after each step (I don't know why !)
+
+  Revision 1.13  1999/02/10 09:54:11  pierre
     * cmSourceWindowClosing resets Debugger LastSource field to avoid problems
 
   Revision 1.12  1999/02/08 17:43:44  pierre

+ 18 - 1
ide/text/fpmrun.inc

@@ -149,6 +149,13 @@ begin
     end;
 end;
 
+procedure TIDEApp.DoOpenGDBWindow;
+begin
+  InitGDBWindow;
+  If assigned(GDBWindow) then
+    GDBWindow^.MakeFirst;
+end;
+
 procedure TIDEApp.DoToggleBreak;
 var
   W : PSourceWindow;
@@ -175,7 +182,17 @@ end;
 
 {
   $Log$
-  Revision 1.11  1999-02-10 09:51:59  pierre
+  Revision 1.12  1999-02-11 19:07:24  pierre
+    * GDBWindow redesigned :
+      normal editor apart from
+      that any kbEnter will send the line (for begin to cursor)
+      to GDB command !
+      GDBWindow opened in Debugger Menu
+       still buggy :
+       -echo should not be present if at end of text
+       -GDBWindow becomes First after each step (I don't know why !)
+
+  Revision 1.11  1999/02/10 09:51:59  pierre
    small cleanup
 
   Revision 1.10  1999/02/08 17:43:45  pierre

+ 44 - 10
ide/text/fpviews.pas

@@ -85,12 +85,18 @@ type
     PGDBInputLine = ^TGDBInputLine;
     TGDBInputLine = object(TInputLine)
       procedure HandleEvent(var Event: TEvent); virtual;
+      function GetPalette : PPalette;virtual;
       end;
-
+      
+    PGDBSourceEditor = ^TGDBSourceEditor;
+    TGDBSourceEditor = object(TSourceEditor)
+      function InsertLine : Sw_integer;virtual;
+      end;
+      
     PGDBWindow = ^TGDBWindow;
     TGDBWindow = object(TFPWindow)
-      Editor    : PSourceEditor;
-      Input     : PGDBInputLine;
+      Editor    : PGDBSourceEditor;
+      {Input     : PGDBInputLine;}
       constructor Init(var Bounds: TRect);
       procedure   WriteText(Buf : pchar);
       procedure   WriteString(Const S : string);
@@ -941,8 +947,6 @@ begin
       (Event.KeyCode=kbEnter) then
      begin
         S:=Data^;
-        if assigned(GDBWindow) and (S<>'') then
-          GDBWindow^.Editor^.AddLine(S);
         if assigned(Debugger) and (S<>'') then
           Debugger^.Command(S);
         S:='';
@@ -952,12 +956,31 @@ begin
      TInputLine.HandleEvent(Event);
 end;
 
+function TGDBInputLine.GetPalette: PPalette;
+const
+  P: String[Length(CGDBInputLine)] = CGDBInputLine;
+begin
+  GetPalette := PPalette(@P);
+end;
+
+function TGDBSourceEditor.InsertLine: Sw_integer;
+Var
+  S : string;
+  
+begin
+  if IsReadOnly then begin InsertLine:=-1; Exit; end;
+  if CurPos.Y<GetLineCount then S:=GetLineText(CurPos.Y) else S:='';
+  s:=Copy(S,1,CurPos.X);
+  if assigned(Debugger) and (S<>'') then
+    Debugger^.Command(S);
+  InsertLine:=inherited InsertLine;
+end;
       
 constructor TGDBWindow.Init(var Bounds: TRect);
 var HSB,VSB: PScrollBar;
     R: TRect;
 begin
-  inherited Init(Bounds,'GDB',SearchFreeWindowNo);
+  inherited Init(Bounds,'GDB window',SearchFreeWindowNo);
   Options:=Options or ofTileAble;
   GetExtent(R); R.A.Y:=R.B.Y-1; R.Grow(-1,0); R.A.X:=14;
   New(HSB, Init(R)); HSB^.GrowMode:=gfGrowLoY+gfGrowHiX+gfGrowHiY; Insert(HSB);
@@ -965,7 +988,7 @@ begin
   New(VSB, Init(R)); VSB^.GrowMode:=gfGrowLoX+gfGrowHiX+gfGrowHiY; Insert(VSB);
   GetExtent(R); R.A.X:=3; R.B.X:=14; R.A.Y:=R.B.Y-1;
   GetExtent(R); R.Grow(-1,-1);
-  Dec(R.B.Y);
+  {Dec(R.B.Y);}
   New(Editor, Init(R, HSB, VSB, nil, GDBOutputFile));
   Editor^.GrowMode:=gfGrowHiX+gfGrowHiY;
   if ExistsFile(GDBOutputFile) then
@@ -977,11 +1000,12 @@ begin
   { Empty files are buggy !! }
     Editor^.AddLine('');
   Insert(Editor);
-  GetExtent(R); R.Grow(-1,-1);
+  {GetExtent(R); R.Grow(-1,-1);
   R.A.Y:=R.B.Y-1;
   New(Input, Init(R, 255));
   Input^.GrowMode:=gfGrowHiX;
-  Insert(Input);
+  
+  Insert(Input);              }
 end;
 
 destructor TGDBWindow.Done;
@@ -3224,7 +3248,17 @@ end;
 END.
 {
   $Log$
-  Revision 1.11  1999-02-11 13:08:39  pierre
+  Revision 1.12  1999-02-11 19:07:25  pierre
+    * GDBWindow redesigned :
+      normal editor apart from
+      that any kbEnter will send the line (for begin to cursor)
+      to GDB command !
+      GDBWindow opened in Debugger Menu
+       still buggy :
+       -echo should not be present if at end of text
+       -GDBWindow becomes First after each step (I don't know why !)
+
+  Revision 1.11  1999/02/11 13:08:39  pierre
    + TGDBWindow : direct gdb input/output
 
   Revision 1.10  1999/02/10 09:42:52  pierre

+ 13 - 3
ide/text/weditor.pas

@@ -1380,8 +1380,8 @@ begin
      if (PointOfs(SelStart)<=PointOfs(PX)) and (PointOfs(PX)<PointOfs(SelEnd)) then
         begin Color:=SelectColor; FreeFormat[X]:=false; end;
       end;
-      if FreeFormat[X] then
-    if X<=length(Format) then
+    if FreeFormat[X] then
+     if X<=length(Format) then
        Color:=ColorTab[ord(Format[X])] else Color:=ColorTab[coTextColor];
 
     if ( ((Flags and efHighlightRow)   <>0) and
@@ -3306,7 +3306,17 @@ end;
 END.
 {
   $Log$
-  Revision 1.15  1999-02-09 09:29:59  pierre
+  Revision 1.16  1999-02-11 19:07:26  pierre
+    * GDBWindow redesigned :
+      normal editor apart from
+      that any kbEnter will send the line (for begin to cursor)
+      to GDB command !
+      GDBWindow opened in Debugger Menu
+       still buggy :
+       -echo should not be present if at end of text
+       -GDBWindow becomes First after each step (I don't know why !)
+
+  Revision 1.15  1999/02/09 09:29:59  pierre
    * avoid invisible characters in CombineColors
 
   Revision 1.14  1999/02/05 13:51:45  peter