Browse Source

+ automatic .pas/.pp adding by opening of file
* better debuggerscreen changes

peter 26 years ago
parent
commit
72a631eff3
7 changed files with 160 additions and 81 deletions
  1. 9 7
      ide/text/fpdebug.pas
  2. 44 20
      ide/text/fpide.pas
  3. 10 11
      ide/text/fpmdebug.inc
  4. 15 10
      ide/text/fpmfile.inc
  5. 11 2
      ide/text/fpusrscr.pas
  6. 70 30
      ide/text/fputils.pas
  7. 1 1
      ide/text/maketp.bat

+ 9 - 7
ide/text/fpdebug.pas

@@ -45,7 +45,7 @@ uses
   Dos,Mouse,Video,
   App,
   FPViews,FPVars,FPUtils,FPIntf,
-  FPCompile,FPUsrScr;
+  FPCompile,FPIDe;
 
 
 {****************************************************************************
@@ -79,22 +79,20 @@ begin
    begin
      W^.Editor^.SetHighlightRow(Line);
      W^.Select;
-   end;  
+   end;
   Desktop^.UnLock;
 end;
 
 
 procedure TDebugController.DoDebuggerScreen;
 begin
-  if assigned(FPUsrScr.UserScreen) then
-    FPUsrScr.UserScreen^.SwitchBack;
+  MyApp.ShowIDEScreen;
 end;
 
 
 procedure TDebugController.DoUserScreen;
 begin
-  if assigned(FPUsrScr.UserScreen) then
-    FPUsrScr.UserScreen^.SwitchTo;
+  MyApp.ShowUserScreen;
 end;
 
 
@@ -131,7 +129,11 @@ end.
 
 {
   $Log$
-  Revision 1.2  1999-01-22 18:14:09  pierre
+  Revision 1.3  1999-02-02 16:41:38  peter
+    + automatic .pas/.pp adding by opening of file
+    * better debuggerscreen changes
+
+  Revision 1.2  1999/01/22 18:14:09  pierre
    * adaptd to changes in gdbint and gdbcon for  to /
 
   Revision 1.1  1999/01/22 10:24:03  peter

+ 44 - 20
ide/text/fpide.pas

@@ -31,6 +31,9 @@ type
       function    GetPalette: PPalette; virtual;
       procedure   DosShell; virtual;
       destructor  Done; virtual;
+    public
+      procedure ShowUserScreen;
+      procedure ShowIDEScreen;
     private
       procedure NewEditor;
       procedure NewFromTemplate;
@@ -48,8 +51,8 @@ type
       procedure Target;
       procedure PrimaryFile_;
       procedure ClearPrimary;
-      procedure ShowScreenWindow;
-      procedure ShowUserScreen;
+      procedure DoUserScreenWindow;
+      procedure DoUserScreen;
       procedure Information;
       procedure Calculator;
       procedure ExecuteTool(Idx: integer);
@@ -326,7 +329,7 @@ begin
              cmClearPrimary  : ClearPrimary;
              cmInformation   : Information;
            { -- Debug menu -- }
-             cmUserScreen    : ShowUserScreen;
+             cmUserScreen    : DoUserScreen;
            { -- Options menu -- }
              cmSwitchesMode  : SetSwitchesMode;
              cmCompiler      : DoCompilerSwitch;
@@ -350,7 +353,7 @@ begin
            { -- Window menu -- }
              cmCloseAll      : CloseAll;
              cmWindowList    : WindowList;
-             cmUserScreenWindow: ShowScreenWindow;
+             cmUserScreenWindow: DoUserScreenWindow;
            { -- Help menu -- }
              cmHelpContents  : HelpContents;
              cmHelpIndex     : HelpHelpIndex;
@@ -378,31 +381,26 @@ begin
   inherited HandleEvent(Event);
 end;
 
-procedure TIDEApp.DoExecute(ProgramPath, Params: string; IsDosShell: boolean);
-begin
-  if UserScreen=nil then
-   begin
-     ErrorBox('Sorry, user screen not available.',nil);
-     Exit;
-   end;
 
+{****************************************************************************
+                                 Switch Screens
+****************************************************************************}
+
+procedure TIDEApp.ShowUserScreen;
+begin
   DoneSysError;
   DoneEvents;
   DoneMouse;
-  { Not found ?? (PM)
-   DoneScreen;       }
+  DoneScreen; { this is available in FV app.pas (PFV) }
   DoneDosMem;
 
   if Assigned(UserScreen) then
     UserScreen^.SwitchTo;
+end;
 
-  if IsDOSShell then
-    WriteShellMsg;
-
-  SwapVectors;
-  Exec(GetEnv('COMSPEC'),'/C '+ProgramPath+' '+Params);
-  SwapVectors;
 
+procedure TIDEApp.ShowIDEScreen;
+begin
   if Assigned(UserScreen) then
     UserScreen^.SwitchBack;
 
@@ -417,6 +415,28 @@ begin
   UpdateScreen(true);
 end;
 
+
+procedure TIDEApp.DoExecute(ProgramPath, Params: string; IsDosShell: boolean);
+begin
+  if UserScreen=nil then
+   begin
+     ErrorBox('Sorry, user screen not available.',nil);
+     Exit;
+   end;
+
+  ShowUserScreen;
+
+  if IsDOSShell then
+    WriteShellMsg;
+
+  SwapVectors;
+  Exec(GetEnv('COMSPEC'),'/C '+ProgramPath+' '+Params);
+  SwapVectors;
+
+  ShowIDEScreen;
+end;
+
+
 procedure TIDEApp.Update;
 begin
   SetCmdState([cmSaveAll],IsThereAnyEditor);
@@ -603,7 +623,11 @@ end;
 END.
 {
   $Log$
-  Revision 1.5  1999-01-22 18:13:22  pierre
+  Revision 1.6  1999-02-02 16:41:39  peter
+    + automatic .pas/.pp adding by opening of file
+    * better debuggerscreen changes
+
+  Revision 1.5  1999/01/22 18:13:22  pierre
    * DoneScreen Removed I did not find any such proc ??
 
   Revision 1.4  1999/01/22 10:24:03  peter

+ 10 - 11
ide/text/fpmdebug.inc

@@ -14,7 +14,7 @@
 
  **********************************************************************}
 
-procedure TIDEApp.ShowScreenWindow;
+procedure TIDEApp.DoUserScreenWindow;
 begin
   if UserScreenWindow=nil then
     begin
@@ -24,31 +24,30 @@ begin
   UserScreenWindow^.MakeFirst;
 end;
 
-procedure TIDEApp.ShowUserScreen;
+procedure TIDEApp.DoUserScreen;
 begin
   if UserScreen=nil then
    begin
      ErrorBox('Sorry, user screen not available.',nil);
      Exit;
    end;
-  DoneMouse;
-  DoneVideo;
 
-  UserScreen^.SwitchTo;
+  ShowUserScreen;
+
   Keyboard.GetKeyEvent;
   while (Keyboard.PollKeyEvent<>0) do
    Keyboard.GetKeyEvent;
-  UserScreen^.SwitchBack;
 
-  InitVideo;
-  InitMouse;
-  ReDraw;
-  UpdateScreen(true);
+  ShowIDEScreen;
 end;
 
 {
   $Log$
-  Revision 1.2  1999-01-21 11:54:16  peter
+  Revision 1.3  1999-02-02 16:41:40  peter
+    + automatic .pas/.pp adding by opening of file
+    * better debuggerscreen changes
+
+  Revision 1.2  1999/01/21 11:54:16  peter
     + tools menu
     + speedsearch in symbolbrowser
     * working run command

+ 15 - 10
ide/text/fpmfile.inc

@@ -77,19 +77,20 @@ procedure TIDEApp.Open(FileName: string);
 var D: PFileDialog;
     OpenIt: boolean;
 begin
-  New(D, Init('*.pas','Open a file','*.pas',fdOpenButton,0));
   OpenIt:=FileName<>'';
   if not OpenIt then
-  begin
+   begin
+     New(D, Init('*.pas','Open a file','*.pas',fdOpenButton,0));
      OpenIt:=Desktop^.ExecView(D)<>cmCancel;
-     if OpenIt then D^.GetFileName(FileName);
-  end;
+     if OpenIt then
+       D^.GetFileName(FileName);
+     Dispose(D, Done);
+   end;
   if OpenIt then
-  begin
-    FileName := FExpand(FileName);
-    OpenEditorWindow(nil,FileName,0,0);
-  end;
-  Dispose(D, Done);
+   begin
+     FileName:=FExpand(LocatePasFile(FileName));
+     OpenEditorWindow(nil,FileName,0,0);
+   end;
 end;
 
 
@@ -120,7 +121,11 @@ end;
 
 {
   $Log$
-  Revision 1.5  1999-01-21 11:54:17  peter
+  Revision 1.6  1999-02-02 16:41:41  peter
+    + automatic .pas/.pp adding by opening of file
+    * better debuggerscreen changes
+
+  Revision 1.5  1999/01/21 11:54:17  peter
     + tools menu
     + speedsearch in symbolbrowser
     * working run command

+ 11 - 2
ide/text/fpusrscr.pas

@@ -339,7 +339,12 @@ var r: registers;
 {$I realintr.inc}
 {$endif}
 begin
-  r.ah:=$00; r.al:=MI.Mode; intr($10,r);
+  r.ah:=$0f;
+  intr($10,r);
+  if r.al<>MI.Mode then
+   begin
+     r.ah:=$00; r.al:=MI.Mode; intr($10,r);
+   end;
   r.ah:=$05; r.al:=MI.Page; intr($10,r);
   r.ah:=$02; r.bh:=MI.Page; r.dl:=MI.CurPos.X; r.dh:=MI.CurPos.Y; intr($10,r);
   r.ah:=$01; r.ch:=MI.CurShapeT; r.cl:=MI.CurShapeB; intr($10,r);
@@ -459,7 +464,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.2  1999-01-04 11:49:51  peter
+  Revision 1.3  1999-02-02 16:41:42  peter
+    + automatic .pas/.pp adding by opening of file
+    * better debuggerscreen changes
+
+  Revision 1.2  1999/01/04 11:49:51  peter
    * 'Use tab characters' now works correctly
    + Syntax highlight now acts on File|Save As...
    + Added a new class to syntax highlight: 'hex numbers'.

+ 70 - 30
ide/text/fputils.pas

@@ -23,9 +23,13 @@ const
 {$ifdef linux}
   dirsep = '/';
   exeext = '';
+  pasext = '.pas';
+  ppext  = '.pp';
 {$else}
   dirsep = '\';
   exeext = '.exe';
+  pasext = '.pas';
+  ppext  = '.pp';
 {$endif}
 
 function IntToStr(L: longint): string;
@@ -42,7 +46,7 @@ function FixFileName(const s:string):string;
 function MakeExeName(const fn:string):string;
 function LExpand(S: string; MinLen: byte): string;
 function RExpand(S: string; MinLen: byte): string;
-function FitStr(S: string; Len: byte): string;
+function FitStr(const S: string; Len: byte): string;
 function LTrim(S: string): string;
 function RTrim(S: string): string;
 function Trim(S: string): string;
@@ -51,9 +55,10 @@ function UpcaseStr(S: string): string;
 function LowerCaseStr(S: string): string;
 function Max(A,B: longint): longint;
 function Min(A,B: longint): longint;
-function DirOf(S: string): string;
-function NameOf(S: string): string;
-function NameAndExtOf(S: string): string;
+function DirOf(const S: string): string;
+function ExtOf(const S: string): string;
+function NameOf(const S: string): string;
+function NameAndExtOf(const S: string): string;
 function StrToExtended(S: string): Extended;
 function Power(const A,B: double): double;
 function GetCurDir: string;
@@ -61,9 +66,10 @@ function MatchesMask(What, Mask: string): boolean;
 function MatchesMaskList(What, MaskList: string): boolean;
 function MatchesFileList(What, FileList: string): boolean;
 function EatIO: integer;
-function ExistsFile(FileName: string): boolean;
-function CompleteDir(Path: string): string;
+function ExistsFile(const FileName: string): boolean;
+function CompleteDir(const Path: string): string;
 function LocateFile(FileList: string): string;
+function LocatePasFile(const FileName:string):string;
 function GetStr(P: PString): string;
 
 const LastStrToIntResult : integer = 0;
@@ -197,24 +203,25 @@ begin
 end;
 
 
-function FitStr(S: string; Len: byte): string;
+function FitStr(const S: string; Len: byte): string;
 begin
   FitStr:=RExpand(copy(S,1,Len),Len);
 end;
 
 
 function KillTilde(S: string): string;
-var P: byte;
+var P: longint;
 begin
   repeat
     P:=Pos('~',S);
-    if P>0 then Delete(S,P,1);
+    if P>0 then
+      Delete(S,P,1);
   until P=0;
   KillTilde:=S;
 end;
 
 function UpcaseStr(S: string): string;
-var I: integer;
+var I: Longint;
 begin
   for I:=1 to length(S) do
       S[I]:=Upcase(S[I]);
@@ -239,22 +246,33 @@ begin
   if A<B then Min:=A else Min:=B;
 end;
 
-function DirOf(S: string): string;
+function DirOf(const S: string): string;
 var D: DirStr; E: ExtStr; N: NameStr;
 begin
   FSplit(S,D,N,E);
-  if copy(D,1,length(D))<>DirSep then D:=D+DirSep;
-  DirOf:=D;
+  if (D<>'') and (D[Length(D)]<>DirSep) then
+   DirOf:=D+DirSep
+  else
+   DirOf:=D;
 end;
 
-function NameOf(S: string): string;
+
+function ExtOf(const S: string): string;
+var D: DirStr; E: ExtStr; N: NameStr;
+begin
+  FSplit(S,D,N,E);
+  ExtOf:=E;
+end;
+
+
+function NameOf(const S: string): string;
 var D: DirStr; E: ExtStr; N: NameStr;
 begin
   FSplit(S,D,N,E);
   NameOf:=N;
 end;
 
-function NameAndExtOf(S: string): string;
+function NameAndExtOf(const S: string): string;
 var D: DirStr; E: ExtStr; N: NameStr;
 begin
   FSplit(S,D,N,E);
@@ -408,24 +426,20 @@ begin
   EatIO:=IOResult;
 end;
 
-function ExistsFile(FileName: string): boolean;
-var f: file;
-    Exists: boolean;
+function ExistsFile(const FileName: string): boolean;
+var
+  Dir : SearchRec;
 begin
-  {$I-}
-  Assign(f,FileName);
-  Reset(f,1);
-  Exists:=EatIO=0;
-  Close(f);
-  EatIO;
-  {$I+}
-  ExistsFile:=Exists;
+  FindFirst(FileName,Archive+ReadOnly,Dir);
+  ExistsFile:=(DosError=0);
 end;
 
-function CompleteDir(Path: string): string;
+function CompleteDir(const Path: string): string;
 begin
-  if copy(Path,length(Path),1)<>DirSep then Path:=Path+DirSep;
-  CompleteDir:=Path;
+  if (Path<>'') and (Path[Length(Path)]<>DirSep) then
+   CompleteDir:=Path+DirSep
+  else
+   CompleteDir:=Path;
 end;
 
 function LocateFile(FileList: string): string;
@@ -459,6 +473,28 @@ begin
   LocateFile:=FilePath;
 end;
 
+function LocatePasFile(const FileName:string):string;
+var
+  s : string;
+begin
+  LocatePasFile:=FileName;
+  if ExistsFile(FileName) or (ExtOf(FileName)<>'') then
+   exit;
+  S:=FileName+PPExt;
+  if ExistsFile(S) then
+   begin
+     LocatePasFile:=S;
+     exit;
+   end;
+  S:=FileName+PasExt;
+  if ExistsFile(S) then
+   begin
+     LocatePasFile:=S;
+     exit;
+   end;
+end;
+
+
 function GetStr(P: PString): string;
 begin
   if P=nil then GetStr:='' else GetStr:=P^;
@@ -469,7 +505,11 @@ end;
 END.
 {
   $Log$
-  Revision 1.4  1999-01-21 11:54:25  peter
+  Revision 1.5  1999-02-02 16:41:43  peter
+    + automatic .pas/.pp adding by opening of file
+    * better debuggerscreen changes
+
+  Revision 1.4  1999/01/21 11:54:25  peter
     + tools menu
     + speedsearch in symbolbrowser
     * working run command

+ 1 - 1
ide/text/maketp.bat

@@ -1,2 +1,2 @@
 @echo off
-bpc fp -dTP -U..\fake
+bpc fp -dTP -U..\fake\gdb -U..\fake\compiler