Browse Source

* fixed far problem is fpdebug
* tile/cascading with message window
* grep fixes

peter 26 years ago
parent
commit
2f31c21e63
3 changed files with 133 additions and 26 deletions
  1. 12 6
      ide/text/fpdebug.pas
  2. 20 4
      ide/text/fpide.pas
  3. 101 16
      ide/text/fpmtools.inc

+ 12 - 6
ide/text/fpdebug.pas

@@ -532,7 +532,7 @@ end;
 
 function  TBreakpointCollection.GetGDB(index : longint) : PBreakpoint;
 
-  function IsNum(P : PBreakpoint) : boolean;
+  function IsNum(P : PBreakpoint) : boolean;{$ifndef FPC}far;{$endif}
   begin
     IsNum:=P^.GDBIndex=index;
   end;
@@ -546,7 +546,7 @@ end;
 
 procedure TBreakpointCollection.ShowBreakpoints(W : PSourceWindow);
 
-  procedure SetInSource(P : PBreakpoint);
+  procedure SetInSource(P : PBreakpoint);{$ifndef FPC}far;{$endif}
   begin
     If assigned(P^.FileName) and (P^.FileName^=W^.Editor^.FileName) then
       W^.Editor^.SetLineBreakState(P^.Line,P^.state=bs_enabled);
@@ -558,7 +558,7 @@ end;
 
 function TBreakpointCollection.GetType(typ : BreakpointType;Const s : String) : PBreakpoint;
 
-  function IsThis(P : PBreakpoint) : boolean;
+  function IsThis(P : PBreakpoint) : boolean;{$ifndef FPC}far;{$endif}
   begin
     IsThis:=(P^.typ=typ) and (P^.Name^=S);
   end;
@@ -571,7 +571,7 @@ function TBreakpointCollection.ToggleFileLine(Const FileName: String;LineNr : Lo
 
 var PB : PBreakpoint;
 
-  function IsThere(P : PBreakpoint) : boolean;
+  function IsThere(P : PBreakpoint) : boolean;{$ifndef FPC}far;{$endif}
   begin
     IsThere:=(P^.typ=bt_file_line) and (P^.FileName^=FileName) and (P^.Line=LineNr);
   end;
@@ -678,11 +678,17 @@ end.
 
 {
   $Log$
-  Revision 1.16  1999-03-01 15:41:52  peter
+  Revision 1.17  1999-03-02 13:48:28  peter
+    * fixed far problem is fpdebug
+    * tile/cascading with message window
+    * grep fixes
+
+  Revision 1.16  1999/03/01 15:41:52  peter
     + Added dummy entries for functions not yet implemented
     * MenuBar didn't update itself automatically on command-set changes
     * Fixed Debugging/Profiling options dialog
-    * TCodeEditor converts spaces to tabs at save only if efUseTabChars is
 set
+    * TCodeEditor converts spaces to tabs at save only if efUseTabChars is
+ set
     * efBackSpaceUnindents works correctly
     + 'Messages' window implemented
     + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros

+ 20 - 4
ide/text/fpide.pas

@@ -17,7 +17,7 @@ unit fpide;
 interface
 
 uses
-  Drivers,Views,App,Gadgets,MsgBox,
+  Objects,Drivers,Views,App,Gadgets,MsgBox,
   {$ifdef EDITORS}Editors,{$else}WEditor,{$endif}
   Comphook,
   FPViews,FPSymbol;
@@ -33,6 +33,7 @@ type
       function    OpenSearch(FileName: string) : boolean;
       procedure   Idle; virtual;
       procedure   HandleEvent(var Event: TEvent); virtual;
+      procedure   GetTileRect(var R: TRect); virtual;
       function    GetPalette: PPalette; virtual;
       procedure   DosShell; virtual;
       destructor  Done; virtual;
@@ -121,7 +122,7 @@ uses
   linux,
 {$endif}
   Video,Mouse,Keyboard,
-  Dos,Objects,Memory,Menus,Dialogs,StdDlg,ColorSel,Commands,HelpCtx,
+  Dos,Memory,Menus,Dialogs,StdDlg,ColorSel,Commands,HelpCtx,
   AsciiTab,
   Systems,BrowCol,
   WUtils,WHelp,WHlpView,WINI,WViews,
@@ -458,6 +459,15 @@ begin
 end;
 
 
+procedure TIDEApp.GetTileRect(var R: TRect);
+begin
+  Desktop^.GetExtent(R);
+{ Leave the messages window in the bottom }
+  if assigned(MessagesWindow) then
+   R.B.Y:=MessagesWindow^.Origin.Y;
+end;
+
+
 {****************************************************************************
                                  Switch Screens
 ****************************************************************************}
@@ -706,11 +716,17 @@ end;
 END.
 {
   $Log$
-  Revision 1.20  1999-03-01 15:41:54  peter
+  Revision 1.21  1999-03-02 13:48:29  peter
+    * fixed far problem is fpdebug
+    * tile/cascading with message window
+    * grep fixes
+
+  Revision 1.20  1999/03/01 15:41:54  peter
     + Added dummy entries for functions not yet implemented
     * MenuBar didn't update itself automatically on command-set changes
     * Fixed Debugging/Profiling options dialog
-    * TCodeEditor converts spaces to tabs at save only if efUseTabChars is
 set
+    * TCodeEditor converts spaces to tabs at save only if efUseTabChars is
+ set
     * efBackSpaceUnindents works correctly
     + 'Messages' window implemented
     + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros

+ 101 - 16
ide/text/fpmtools.inc

@@ -14,13 +14,23 @@
 
  **********************************************************************}
 
+procedure TIDEApp.Messages;
+begin
+  if MessagesWindow=nil then
+    Desktop^.Insert(New(PMessagesWindow, Init))
+  else
+    MessagesWindow^.Focus;
+end;
+
 procedure TIDEApp.DoAsciiTable;
-var
-  P: PAsciiChart;
 begin
-  P := New(PAsciiChart, Init);
-  P^.HelpCtx := hcAsciiTable;
-  InsertWindow(P);
+  if ASCIIChart=nil then
+    begin
+      New(ASCIIChart, Init);
+      Desktop^.Insert(ASCIIChart);
+    end
+  else
+    ASCIIChart^.Focus;
 end;
 
 
@@ -35,23 +45,88 @@ end;
 
 procedure TIDEApp.ExecuteTool(Idx: integer);
 var Title,ProgramPath,Params: string;
-    W: word;
+    W: PSourceWindow;
+    Wo: word;
     Err: integer;
+    CaptureFile: string;
+    ExecMode: TExecType;
 begin
   if (Idx<1) or (Idx>GetToolCount) then Exit;
-  GetToolParams(Idx-1,Title,ProgramPath,Params,W);
+  GetToolParams(Idx-1,Title,ProgramPath,Params,Wo);
   Err:=ParseToolParams(Params,false);
   if Err=-1 then Exit;
   if Err<>0 then
     begin ErrorBox(^C'Error parsing tool params.',nil); Exit; end;
-  DoExecute(ProgramPath,Params,false);
+  if CaptureToolTo<>capNone then
+    begin
+      CaptureFile:=ToolCaptureName;
+      ExecMode:=exNoSwap;
+    end
+  else
+    begin
+      CaptureFile:='';
+      ExecMode:=exNormal;
+    end;
+
+  EraseFile(CaptureFile);
+  EraseFile(FilterCaptureName);
+
+  if CaptureToolTo=capMessageWindow then
+    AddToolCommand(ProgramPath+' '+Params);
+
+  if CaptureToolTo<>capNone then
+    ShowMessage('Executing tool '+KillTilde(Title)+'...');
+
+  DoExecute(ProgramPath,Params,'',CaptureFile,ExecMode);
+
+  if CaptureToolTo<>capNone then
+    HideMessage;
+
+  if (DosError=0) and (DosExitCode=0) then
+    begin
+      if CaptureToolTo=capEditWindow then
+        begin
+          W:=OpenEditorWindow(nil,'',0,0);
+          if W<>nil then
+            if StartEditor(W^.Editor,CaptureFile)=false then
+              ErrorBox('Error reading output.',nil);
+        end
+      else
+      if ToolFilter<>'' then
+        begin
+          ShowMessage('Executing filter for '+KillTilde(Title)+'...');
+          DoExecute(ToolFilter,'',CaptureFile,FilterCaptureName,exNoSwap);
+          HideMessage;
+          if (DosError=0) and (DosExitCode=0) then
+            begin
+              if ExistsFile(FilterCaptureName)=false then
+                ErrorBox('Can''t find filtered output.',nil)
+              else
+                if ProcessMessageFile(FilterCaptureName)=false then
+                  ErrorBox('Error processing filtered output.',nil);
+            end
+          else
+            if (DosError<>0) then
+              ErrorBox('Error executing filter '+KillTilde(GetToolName(Idx-1)),nil) else
+            if DosExitCode<>0 then
+              ErrorBox('Filter execution successful. Exit code '+IntToStr(DosExitCode),nil);
+          UpdateToolMessages;
+          if DosError=0 then
+            Messages;
+        end;
+    end else
   if (DosError<>0) then
     ErrorBox('Error executing tool '+KillTilde(GetToolName(Idx-1)),nil) else
   if DosExitCode<>0 then
-    ErrorBox('Execution successful. Exit code '+IntToStr(DosExitCode),nil);
+    ErrorBox('Tool execution successful. Exit code '+IntToStr(DosExitCode),nil);
+{$ifndef DEBUG}
+  EraseFile(CaptureFile);
+  EraseFile(FilterCaptureName);
+{$endif}
 end;
 
-procedure TIDEApp.Grep;
+
+procedure TIDEApp.DoGrep;
 Const
   GrepOutName = 'grep$$.out';
   GrepErrName = 'grep$$.err';
@@ -63,11 +138,13 @@ var
   s : string;
   p,lineNb : longint;
   error : word;
+  showmsg : boolean;
   searchword,
   GrepExe,GrepArgs,Line,ModuleName : String;
   GrepOut : text;
   Params : Array[0..4] of longint;
 begin
+  showmsg:=false;
 { Find grep.exe }
   GrepExe:=GrepExeName;
   If not LocateExeFile(GrepExe) then
@@ -122,7 +199,7 @@ begin
          GrepArgs:=IL2^.Data^;
          ReplaceStr(GrepArgs,'$TEXT',SearchWord);
          { Linux ? }
-         if not ExecuteRedir(GrepExe,GrepArgs,GrepOutName,GrepErrName) then
+         if not ExecuteRedir(GrepExe,GrepArgs,'',GrepOutName,GrepErrName) then
            Begin
               { 2 as exit code just means that
                 some file vwere not found ! }
@@ -134,6 +211,7 @@ begin
                 end;
            End;
          {$I-}
+         showmsg:=true;
          Assign(GrepOut,GrepOutName);
          Reset(GrepOut);
          While not eof(GrepOut) do
@@ -147,11 +225,8 @@ begin
                  p:=pos(':',Line);
                  val(copy(Line,1,p-1),lineNb,error);
                  if error=0 then
-                   ProgramInfoWindow^.AddMessage(V_Normal,Copy(Line,p+1,255),
-                     ModuleName,LineNb,1);
+                   AddToolMessage(ModuleName,Copy(Line,p+1,255),LineNb,1);
                end;
-             ProgramInfoWindow^.Show;
-             ProgramInfoWindow^.MakeFirst;
            end;
          Close(GrepOut);
          Erase(GrepOut);
@@ -163,10 +238,20 @@ begin
        end;
     end;
   Dispose(PGrepDialog, Done);
+  UpdateToolMessages;
+  if showmsg then
+    Messages;
 end;
+
+
 {
   $Log$
-  Revision 1.10  1999-02-22 12:46:57  peter
+  Revision 1.11  1999-03-02 13:48:30  peter
+    * fixed far problem is fpdebug
+    * tile/cascading with message window
+    * grep fixes
+
+  Revision 1.10  1999/02/22 12:46:57  peter
     * small fixes for linux and grep
 
   Revision 1.9  1999/02/22 11:29:37  pierre