Browse Source

+ 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
* efBackSpaceUnindents works correctly
+ 'Messages' window implemented
+ Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
+ Added TP message-filter support (for ex. you can call GREP thru
GREP2MSG and view the result in the messages window - just like in TP)
* A 'var' was missing from the param-list of THelpFacility.TopicSearch,
so topic search didn't work...
* In FPHELP.PAS there were still context-variables defined as word instead
of THelpCtx
* StdStatusKeys() was missing from the statusdef for help windows
+ Topic-title for index-table can be specified when adding a HTML-files

peter 26 years ago
parent
commit
6483f16209

+ 21 - 4
ide/text/Makefile

@@ -23,7 +23,7 @@ NEEDUNITDIR=../../api ../../fv
 # ../../fv/base ../../fv/app ../../fv/dialogs
 
 # when making a full version include the compiler
-ifdef FULL
+ifeq ($(FULL),1)
 override NEEDUNITDIR+=../../compiler
 override NEEDOPT+=-dBrowserCol -dGDB -Sg
 else
@@ -35,9 +35,9 @@ ifndef GDBINT
 GDBINT=gdbint
 endif
 
-ifdef GDB
+ifeq ($(GDB),1)
 override NEEDUNITDIR+=../../$(GDBINT)
-NEEDLIBDIR+=../../$(GDBINT)/libgdb /pp/dj/lib
+NEEDLIBDIR+=../../$(GDBINT)/libgdb
 NEEDOBJDIR+=../../$(GDBINT)/libgdb
 else
 override NEEDUNITDIR+=../fake/gdb
@@ -102,7 +102,24 @@ clean_compiler:
 
 #
 # $Log$
-# Revision 1.10  1999-02-22 02:15:12  peter
+# Revision 1.11  1999-03-01 15:41:47  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
+#   * efBackSpaceUnindents works correctly
+#   + 'Messages' window implemented
+#   + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
+#   + Added TP message-filter support (for ex. you can call GREP thru
+#     GREP2MSG and view the result in the messages window - just like in TP)
+#   * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
+#     so topic search didn't work...
+#   * In FPHELP.PAS there were still context-variables defined as word instead
+#     of THelpCtx
+#   * StdStatusKeys() was missing from the statusdef for help windows
+#   + Topic-title for index-table can be specified when adding a HTML-files
+#
+# Revision 1.10  1999/02/22 02:15:12  peter
 #   + default extension for save in the editor
 #   + Separate Text to Find for the grep dialog
 #   * fixed redir crash with tp7

+ 24 - 3
ide/text/fp.pas

@@ -22,7 +22,11 @@ uses
   Dos,
   BrowCol,
   FPIni,FPViews,FPConst,FPVars,FPUtils,FPIde,FPHelp,FPSwitch,FPUsrScr,
-  FPTools,FPDebug,FPTemplt,FPCatch;
+  FPTools,FPDebug,FPTemplt,FPCatch,FPRedir
+{$ifdef TEMPHEAP}
+  ,dpmiexcp
+{$endif TEMPHEAP}
+  ;
 
 
 procedure ProcessParams(BeforeINI: boolean);
@@ -64,7 +68,6 @@ begin
   end;
 end;
 
-
 BEGIN
   {$ifdef DEV}HeapLimit:=4096;{$endif}
   writeln('þ Free Pascal IDE  Version '+VersionStr);
@@ -72,6 +75,7 @@ BEGIN
 
   ProcessParams(true);
 
+  InitRedir;
   InitBreakpoints;
   InitReservedWords;
   InitHelpFiles;
@@ -107,7 +111,24 @@ BEGIN
 END.
 {
   $Log$
-  Revision 1.12  1999-02-20 15:18:25  peter
+  Revision 1.13  1999-03-01 15:41:48  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
+    * efBackSpaceUnindents works correctly
+    + 'Messages' window implemented
+    + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
+    + Added TP message-filter support (for ex. you can call GREP thru
+      GREP2MSG and view the result in the messages window - just like in TP)
+    * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
+      so topic search didn't work...
+    * In FPHELP.PAS there were still context-variables defined as word instead
+      of THelpCtx
+    * StdStatusKeys() was missing from the statusdef for help windows
+    + Topic-title for index-table can be specified when adding a HTML-files
+
+  Revision 1.12  1999/02/20 15:18:25  peter
     + ctrl-c capture with confirm dialog
     + ascii table in the tools menu
     + heapviewer

+ 18 - 7
ide/text/fpcalc.pas

@@ -19,6 +19,7 @@ interface
 
 uses
   Drivers,Objects,Commands,Views,Dialogs,App,
+  WViews,
   FPViews;
 
 const
@@ -93,7 +94,7 @@ const
 procedure TCalcButton.HandleEvent(var Event: TEvent);
 var
   Call : boolean;
-  i : longint;
+  i : Sw_Word;
 begin
   Call:=true;
   case Event.What of
@@ -423,12 +424,22 @@ end;
 end.
 {
   $Log$
-  Revision 1.2  1999-02-20 15:18:27  peter
-    + ctrl-c capture with confirm dialog
-    + ascii table in the tools menu
-    + heapviewer
-    * empty file fixed
-    * fixed callback routines in fpdebug to have far for tp7
+  Revision 1.3  1999-03-01 15:41:49  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
+    * efBackSpaceUnindents works correctly
+    + 'Messages' window implemented
+    + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
+    + Added TP message-filter support (for ex. you can call GREP thru
+      GREP2MSG and view the result in the messages window - just like in TP)
+    * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
+      so topic search didn't work...
+    * In FPHELP.PAS there were still context-variables defined as word instead
+      of THelpCtx
+    * StdStatusKeys() was missing from the statusdef for help windows
+    + Topic-title for index-table can be specified when adding a HTML-files
 
   Revision 1.1  1998/12/22 14:27:54  peter
     * moved

+ 29 - 8
ide/text/fpcompil.pas

@@ -17,7 +17,8 @@ unit FPCompile;
 
 interface
 
-uses FPViews;
+uses WViews,
+     FPViews;
 
 type
     TCompileMode = (cBuild,cMake,cCompile,cRun);
@@ -140,8 +141,9 @@ begin
      ProgramInfoWindow^.AddMessage(Level,S,status.currentsourcepath+status.currentsource,
        status.currentline,status.currentcolumn);
      if SD<>nil then
-     SD^.MsgLB^.AddItem(New(PCompilerMessage, Init(Level, S, SmartPath(status.currentmodule),
-       status.currentline,status.currentcolumn)));
+     SD^.MsgLB^.AddItem(
+       New(PMessageItem, Init(Level, S, SD^.MsgLB^.AddModuleName(SmartPath(status.currentmodule)),
+         status.currentline,status.currentcolumn)));
    end;
 {$ifdef TEMPHEAP}
   switch_to_temp_heap;
@@ -229,8 +231,8 @@ begin
   { this avoids all flickers
     and allows to get assembler and linker messages
     but also forbids to use GDB inside !! }
-  ChangeRedir('fp$$$.out',false);
-  ChangeErrorRedir('fp$$$.err',false);
+  ChangeRedirOut('fp$$$.out',false);
+  ChangeRedirError('fp$$$.err',false);
 {$endif ndef debug}
 {$ifdef TEMPHEAP}
   split_heap;
@@ -240,8 +242,10 @@ begin
 {$ifdef TEMPHEAP}
   switch_to_base_heap;
 {$endif TEMPHEAP}
-  RestoreRedir;
-  RestoreErrorRedir;
+{$ifdef go32v2}
+  RestoreRedirOut;
+  RestoreRedirError;
+{$endif def go32v2}
 
   if status.errorCount=0
      then CompilationPhase:=cpDone
@@ -272,7 +276,24 @@ end;
 end.
 {
   $Log$
-  Revision 1.14  1999-02-22 12:46:56  peter
+  Revision 1.15  1999-03-01 15:41:50  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
+    * efBackSpaceUnindents works correctly
+    + 'Messages' window implemented
+    + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
+    + Added TP message-filter support (for ex. you can call GREP thru
+      GREP2MSG and view the result in the messages window - just like in TP)
+    * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
+      so topic search didn't work...
+    * In FPHELP.PAS there were still context-variables defined as word instead
+      of THelpCtx
+    * StdStatusKeys() was missing from the statusdef for help windows
+    + Topic-title for index-table can be specified when adding a HTML-files
+
+  Revision 1.14  1999/02/22 12:46:56  peter
     * small fixes for linux and grep
 
   Revision 1.13  1999/02/22 11:51:33  peter

+ 38 - 8
ide/text/fpconst.pas

@@ -17,7 +17,8 @@ unit FPConst;
 
 interface
 
-uses Views,App,Commands;
+uses Views,App,Commands,
+     WViews;
 
 const
      VersionStr           = '0.9';
@@ -28,6 +29,13 @@ const
      ININame              = 'fp.ini';
      SwitchesName         = 'fp.cfg';
 
+     ToolCaptureName      = '$$TOOL$$.OUT';
+     FilterCaptureName    = '$FILTER$.OUT';
+
+     HelpFileExts         = '*.tph;*.htm*';
+
+     EnterSign            = #17#196#217;
+
      { Strings/Messages }
      strLoadingHelp       = 'Loading help files...';
      strBuildingHelpIndex = 'Building Help Index...';
@@ -78,18 +86,19 @@ const
      cmResetDebugger     = 228;
      cmContToCursor      = 229;
      cmOpenGDBWindow     = 230;
+     cmToolsMsgNext      = 231;
+     cmToolsMsgPrev      = 232;
+     cmGrep              = 233;
 
      cmNotImplemented    = 1000;
      cmNewFromTemplate   = 1001;
 
      cmSearchWindow      = 1500;
-     cmUpdate            = 1600;
      cmSourceWndClosing  = 1601;
-     cmLocalMenu         = 1602;
      cmCalculatorPaste   = 1603;
      cmMsgClear          = 1604;
      cmUpdateTools       = 1605;
-     cmGrep              = 1606;
+{     cmGrep              = 160?;}
 
      cmAddItem           = 1620;
      cmEditItem          = 1621;
@@ -99,7 +108,7 @@ const
      cmUserScreenWindow  = 1651;
      cmEvaluate          = 1652;
      cmCalculator        = 1653;
-     cmAsciiTable        = 1654;
+     cmASCIITable        = 1654;
 
      cmToolsMessages     = 1700;
      cmToolsBase         = 1800;
@@ -144,6 +153,7 @@ const
      hcCalcWindow        = 8003;
      hcInfoWindow        = 8004;
      hcBrowserWindow     = 8005;
+     hcMessagesWindow    = 8006;
 
      hcShift             = 10000;
 
@@ -179,9 +189,9 @@ const
      hcSaveAsINI         = hcShift+cmSaveAsINI;
      hcCalculator        = hcShift+cmCalculator;
      hcAsciiTable        = hcShift+cmAsciiTable;
-     hcGrep              = hcShift+cmGrep;
-     hcBrowser           = hcShift+cmBrowser;
+{     hcGrep              = hcShift+cmGrep;}
      hcSwitchesMode      = hcShift+cmSwitchesMode;
+     hcBrowser           = hcShift+cmBrowser;
      hcAbout             = hcShift+cmAbout;
 
      hcSystemMenu        = 9000;
@@ -210,6 +220,8 @@ const
      hcResetDebugger     = hcShift+cmResetDebugger;
      hcContToCursor      = hcShift+cmContToCursor;
      hcOpenGDBWindow     = hcShift+cmOpenGDBWindow;
+     hcToolsMsgNext      = hcShift+cmToolsMsgNext;
+     hcToolsMsgPrev      = hcShift+cmToolsMsgPrev;
      hcCompile           = hcShift+cmCompile;
      hcMake              = hcShift+cmMake;
      hcBuild             = hcShift+cmBuild;
@@ -233,6 +245,7 @@ const
      hcToggleBreakpoint  = hcShift+cmToggleBreakpoint;
      hcEvaluate          = hcShift+cmEvaluate;
      hcAddWatch          = hcShift+cmAddWatch;
+     hcGrep              = hcShift+cmGrep;
 
      hcOpenAtCursor      = hcShift+cmOpenAtCursor;
      hcBrowseAtCursor    = hcShift+cmBrowseAtCursor;
@@ -281,7 +294,24 @@ implementation
 END.
 {
   $Log$
-  Revision 1.12  1999-02-22 11:51:34  peter
+  Revision 1.13  1999-03-01 15:41:51  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
+    * efBackSpaceUnindents works correctly
+    + 'Messages' window implemented
+    + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
+    + Added TP message-filter support (for ex. you can call GREP thru
+      GREP2MSG and view the result in the messages window - just like in TP)
+    * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
+      so topic search didn't work...
+    * In FPHELP.PAS there were still context-variables defined as word instead
+      of THelpCtx
+    * StdStatusKeys() was missing from the statusdef for help windows
+    + Topic-title for index-table can be specified when adding a HTML-files
+
+  Revision 1.12  1999/02/22 11:51:34  peter
     * browser updates from gabor
 
   Revision 1.11  1999/02/20 15:18:28  peter

+ 29 - 13
ide/text/fpdebug.pas

@@ -17,8 +17,10 @@ unit FPDebug;
 interface
 
 uses
-  Views,FPViews,
-  Objects,GDBCon,GDBInt;
+  Objects,Views,
+  GDBCon,GDBInt,
+  WViews,
+  FPViews;
 
 type
   PDebugController=^TDebugController;
@@ -93,7 +95,7 @@ const
        = ( 'enabled','disabled','invalid' );
 
 var
-  Debugger : PDebugController;
+  Debugger             : PDebugController;
   BreakpointCollection : PBreakpointCollection;
 
 procedure InitDebugger;
@@ -128,8 +130,7 @@ begin
 end;
 
 procedure TDebugController.InsertBreakpoints;
-
-  procedure DoInsert(PB : PBreakpoint);{$ifndef FPC}far;{$endif}
+  procedure DoInsert(PB : PBreakpoint);
   begin
     PB^.Insert;
   end;
@@ -140,18 +141,16 @@ end;
 
 
 procedure TDebugController.RemoveBreakpoints;
-
-  procedure DoDelete(PB : PBreakpoint);{$ifndef FPC}far;{$endif}
+  procedure DoDelete(PB : PBreakpoint);
     begin
       PB^.Remove;
     end;
-
 begin
    BreakpointCollection^.ForEach(@DoDelete);
 end;
 
 procedure TDebugController.ResetBreakpointsValues;
-  procedure DoResetVal(PB : PBreakpoint);{$ifndef FPC}far;{$endif}
+  procedure DoResetVal(PB : PBreakpoint);
     begin
       PB^.ResetValues;
     end;
@@ -547,7 +546,7 @@ end;
 
 procedure TBreakpointCollection.ShowBreakpoints(W : PSourceWindow);
 
-  procedure SetInSource(P : PBreakpoint);{$ifndef FPC}far;{$endif}
+  procedure SetInSource(P : PBreakpoint);
   begin
     If assigned(P^.FileName) and (P^.FileName^=W^.Editor^.FileName) then
       W^.Editor^.SetLineBreakState(P^.Line,P^.state=bs_enabled);
@@ -559,7 +558,7 @@ end;
 
 function TBreakpointCollection.GetType(typ : BreakpointType;Const s : String) : PBreakpoint;
 
-  function IsThis(P : PBreakpoint) : boolean;{$ifndef FPC}far;{$endif}
+  function IsThis(P : PBreakpoint) : boolean;
   begin
     IsThis:=(P^.typ=typ) and (P^.Name^=S);
   end;
@@ -572,7 +571,7 @@ function TBreakpointCollection.ToggleFileLine(Const FileName: String;LineNr : Lo
 
 var PB : PBreakpoint;
 
-  function IsThere(P : PBreakpoint) : boolean;{$ifndef FPC}far;{$endif}
+  function IsThere(P : PBreakpoint) : boolean;
   begin
     IsThere:=(P^.typ=bt_file_line) and (P^.FileName^=FileName) and (P^.Line=LineNr);
   end;
@@ -679,7 +678,24 @@ end.
 
 {
   $Log$
-  Revision 1.15  1999-02-20 15:18:29  peter
+  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
+    * efBackSpaceUnindents works correctly
+    + 'Messages' window implemented
+    + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
+    + Added TP message-filter support (for ex. you can call GREP thru
+      GREP2MSG and view the result in the messages window - just like in TP)
+    * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
+      so topic search didn't work...
+    * In FPHELP.PAS there were still context-variables defined as word instead
+      of THelpCtx
+    * StdStatusKeys() was missing from the statusdef for help windows
+    + Topic-title for index-table can be specified when adding a HTML-files
+
+  Revision 1.15  1999/02/20 15:18:29  peter
     + ctrl-c capture with confirm dialog
     + ascii table in the tools menu
     + heapviewer

+ 56 - 33
ide/text/fphelp.pas

@@ -18,13 +18,14 @@ unit FPHelp;
 interface
 
 uses
-  Drivers,HelpCtx,WHlpView,WHTML,
+  Drivers,HelpCtx,
+  WHelp,WHlpView,WHTML,
 {$ifdef EDITORS}
   Editors,
 {$else}
   WEditor,
 {$endif}
-  FPViews;
+  WViews,FPViews;
 
 type
     PIDEStatusLine = ^TIDEStatusLine;
@@ -33,8 +34,8 @@ type
       procedure HandleEvent(var Event: TEvent); virtual;
     end;
 
-procedure Help(FileID, Context: word; Modal: boolean);
-procedure HelpIndex(const Keyword: string);
+procedure Help(FileID, Context: THelpCtx; Modal: boolean);
+procedure HelpIndex(Keyword: string);
 procedure HelpTopicSearch(Editor: PEditor);
 procedure HelpTopic(const S: string);
 
@@ -44,23 +45,23 @@ procedure DoneHelpSystem;
 procedure InitHelpFiles;
 procedure DoneHelpFiles;
 
-procedure PushStatus(const S: string);
-procedure SetStatus(const S: string);
+procedure PushStatus(S: string);
+procedure SetStatus(S: string);
 procedure ClearStatus;
 procedure PopStatus;
 
 const
-      HelpWindow     : PIDEHelpWindow = nil;
+      HelpWindow     : PFPHelpWindow = nil;
       HelpInited     : boolean = false;
 
 implementation
 
 uses Objects,Views,App,MsgBox,
-     WHelp,WHTMLHlp,
+     WHTMLHlp,
      FPConst,FPVars,FPUtils;
 
 const
-    MaxStatusLevel = 10;
+    MaxStatusLevel = 5;
 
 var StatusStack : array[0..MaxStatusLevel] of string[MaxViewWidth];
 
@@ -89,6 +90,8 @@ begin
     hcCalcWindow    : S:='';
     hcInfoWindow    : S:='';
     hcClipboardWindow:S:='';
+    hcBrowserWindow : S:='';
+    hcMessagesWindow: S:='';
 
     hcSystemMenu    : S:='System menu';
     hcUpdate        : S:='Refresh and redraw display';
@@ -146,8 +149,9 @@ begin
     hcOpenGDBWindow : S:='Open direct window to GDB';
     hcToolsMenu     : S:='User installed tools';
     hcCalculator    : S:='Show calculator';
-    hcGrep          : S:='Run grep';
+{    hcGrep          : S:='Run grep';}
 
+    hcToolsMessages : S:='Open the message window';
     hcToolsBase..
     hcToolsBase+MaxToolCount
                     : S:='User installed tool';
@@ -216,18 +220,22 @@ procedure InitHelpSystem;
     {$IFDEF DEBUG}SetStatus(strLoadingHelp);{$ENDIF}
   end;
 
-var
-  I: Sw_integer;
-  S: string;
+var I,P: sw_integer;
+    S: string;
+    TopicTitle: string;
 begin
   New(HelpFacility, Init);
   PushStatus(strLoadingHelp);
 {  AddHTMLFile('User''s guide','C:\FP\USER\USER.HTM');}
   for I:=0 to HelpFiles^.Count-1 do
     begin
-      S:=HelpFiles^.At(I)^;
-      if (copy(UpcaseStr(ExtOf(S)),1,4)='.HTM') then
-        AddHTMLFile(S,S)
+      S:=HelpFiles^.At(I)^; TopicTitle:='';
+      P:=Pos('|',S);
+      if P>0 then
+        begin TopicTitle:=copy(S,P+1,255); S:=copy(S,1,P-1); end;
+      if TopicTitle='' then TopicTitle:=S;
+      if copy(UpcaseStr(ExtOf(S)),1,4)='.HTM' then { this recognizes both .htm and .html }
+          AddHTMLFile(TopicTitle,S)
       else
         AddOAFile(S);
     end;
@@ -244,10 +252,10 @@ end;
 procedure DoneHelpSystem;
 begin
   if assigned(HelpFacility) then
-   begin
-     Dispose(HelpFacility, Done);
-     HelpFacility:=nil;
-   end;
+    begin
+      Dispose(HelpFacility, Done);
+      HelpFacility:=nil;
+    end;
   HelpInited:=false;
 end;
 
@@ -258,18 +266,16 @@ begin
   if HelpWindow=nil then
   begin
      Desktop^.GetExtent(R); R.Grow(-15,-3); Dec(R.A.Y);
-     New(HelpWindow, Init(R, 'Help', 0, 0, wnNoNumber));
+     New(HelpWindow, Init(R, 'Help', 0, 0, SearchFreeWindowNo));
      if HelpWindow<>nil then
      begin
-       HelpWindow^.HelpCtx:=hcHelpWindow;
-       HelpWindow^.HideOnClose:=true;
        HelpWindow^.Hide;
        Desktop^.Insert(HelpWindow);
      end;
   end;
 end;
 
-procedure Help(FileID, Context: word; Modal: boolean);
+procedure Help(FileID, Context: THelpCtx; Modal: boolean);
 begin
   if Modal then
      begin MessageBox('Sorry, modal help not yet implemented.',nil,mfInformation+mfInsertInApp+mfOKButton); Exit; end;
@@ -292,21 +298,21 @@ begin
 end;
 
 procedure HelpTopic(const S: string);
-var
-  FileID, Ctx: word;
-  Found: boolean;
+var FileID: word;
+    Ctx   : THelpCtx;
+var Found: boolean;
 begin
   CheckHelpSystem;
   PushStatus(strLocatingTopic);
   Found:=HelpFacility^.TopicSearch(S,FileID,Ctx);
   PopStatus;
   if Found then
-    Help(FileID,Ctx,false)
+     Help(FileID,Ctx,false)
   else
-    HelpIndex(S);
+     HelpIndex(S);
 end;
 
-procedure HelpIndex(const Keyword: string);
+procedure HelpIndex(Keyword: string);
 begin
   HelpCreateWindow;
   with HelpWindow^ do
@@ -322,7 +328,7 @@ begin
   Message(Application,evCommand,cmUpdate,nil);
 end;
 
-procedure PushStatus(const S: string);
+procedure PushStatus(S: string);
 begin
   if StatusLine=nil then
     Exit;
@@ -345,7 +351,7 @@ begin
     SetStatus(StatusStack[MaxStatusLevel]);
 end;
 
-procedure SetStatus(const S: string);
+procedure SetStatus(S: string);
 begin
   if StatusLine=nil then
     Exit;
@@ -371,7 +377,24 @@ end;
 END.
 {
   $Log$
-  Revision 1.10  1999-02-22 11:51:35  peter
+  Revision 1.11  1999-03-01 15:41:53  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
+    * efBackSpaceUnindents works correctly
+    + 'Messages' window implemented
+    + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
+    + Added TP message-filter support (for ex. you can call GREP thru
+      GREP2MSG and view the result in the messages window - just like in TP)
+    * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
+      so topic search didn't work...
+    * In FPHELP.PAS there were still context-variables defined as word instead
+      of THelpCtx
+    * StdStatusKeys() was missing from the statusdef for help windows
+    + Topic-title for index-table can be specified when adding a HTML-files
+
+  Revision 1.10  1999/02/22 11:51:35  peter
     * browser updates from gabor
 
   Revision 1.9  1999/02/19 18:43:45  peter

+ 75 - 38
ide/text/fpide.pas

@@ -17,20 +17,21 @@ unit fpide;
 interface
 
 uses
-  Drivers,Views,App,Gadgets,
+  Drivers,Views,App,Gadgets,MsgBox,
   {$ifdef EDITORS}Editors,{$else}WEditor,{$endif}
   Comphook,
   FPViews,FPSymbol;
 
 type
+    TExecType = (exNormal,exNoSwap,exDosShell);
+
     TIDEApp = object(TApplication)
-      Heap : PHeapView;
       constructor Init;
-      procedure   Idle;virtual;
       procedure   InitMenuBar; virtual;
       procedure   InitStatusLine; virtual;
       procedure   Open(FileName: string);
       function    OpenSearch(FileName: string) : boolean;
+      procedure   Idle; virtual;
       procedure   HandleEvent(var Event: TEvent); virtual;
       function    GetPalette: PPalette; virtual;
       procedure   DosShell; virtual;
@@ -39,12 +40,14 @@ type
       procedure ShowUserScreen;
       procedure ShowIDEScreen;
     private
+      Heap: PFPHeapView;
       procedure NewEditor;
       procedure NewFromTemplate;
       procedure OpenRecentFile(RecentIndex: integer);
       procedure SaveAll;
       procedure ChangeDir;
       procedure ShowClipboard;
+      procedure FindProcedure;
       procedure Objects;
       procedure Modules;
       procedure Globals;
@@ -62,8 +65,9 @@ type
       procedure DoOpenGDBWindow;
       procedure DoToggleBreak;
       procedure Information;
-      procedure DoAsciiTable;
+      procedure Messages;
       procedure Calculator;
+      procedure DoAsciiTable;
       procedure ExecuteTool(Idx: integer);
       procedure SetSwitchesMode;
       procedure DoCompilerSwitch;
@@ -72,10 +76,12 @@ type
       procedure DoDebuggerSwitch;
       procedure Directories;
       procedure Tools;
-      procedure Grep;
+      procedure DoGrep;
+      procedure Preferences;
       procedure EditorOptions(Editor: PEditor);
       procedure BrowserOptions(Browser: PBrowserWindow);
       procedure Mouse;
+      procedure StartUp;
       procedure Colors;
       procedure OpenINI;
       procedure SaveINI;
@@ -90,7 +96,7 @@ type
       procedure HelpFiles;
       procedure About;
     private
-      procedure DoExecute(ProgramPath, Params: string; IsDOSShell: boolean);
+      procedure DoExecute(ProgramPath, Params, InFile, OutFile: string; ExecType: TExecType);
     private
       procedure AddRecentFile(AFileName: string; CurX, CurY: integer);
       function  SearchRecentFile(AFileName: string): integer;
@@ -117,8 +123,8 @@ uses
   Video,Mouse,Keyboard,
   Dos,Objects,Memory,Menus,Dialogs,StdDlg,ColorSel,Commands,HelpCtx,
   AsciiTab,
-  Systems,BrowCol,Version,
-  WHelp,WHlpView,WINI,
+  Systems,BrowCol,
+  WUtils,WHelp,WHlpView,WINI,WViews,
   FPConst,FPVars,FPUtils,FPSwitch,FPIni,FPIntf,FPCompile,FPHelp,
   FPTemplt,FPCalc,FPUsrScr,FPTools,FPDebug,FPRedir;
 
@@ -134,8 +140,7 @@ begin
 end;
 
 constructor TIDEApp.Init;
-var
-  R : TRect;
+var R: TRect;
 begin
   {$ifndef EDITORS}
   UseSyntaxHighlight:=IDEUseSyntaxHighlight;
@@ -151,20 +156,12 @@ begin
   Desktop^.Insert(ProgramInfoWindow);
   Message(@Self,evBroadcast,cmUpdate,nil);
   CurDirChanged;
-{ heap viewer }
-  GetExtent(R);
-  Dec(R.B.X);
-  R.A.X := R.B.X - 9; R.A.Y := R.B.Y - 1;
-  Heap := New(PHeapView, InitKb(R));
+  { heap viewer }
+  GetExtent(R); Dec(R.B.X); R.A.X:=R.B.X-9; R.A.Y:=R.B.Y-1;
+  New(Heap, InitKb(R));
   Insert(Heap);
 end;
 
-procedure TIDEApp.Idle;
-begin
-  inherited Idle;
-  Heap^.Update;
-end;
-
 procedure TIDEApp.InitMenuBar;
 var R: TRect;
 begin
@@ -232,11 +229,13 @@ begin
       nil))))),
     NewSubMenu('~T~ools', hcToolsMenu, NewMenu(
       NewItem('~M~essages', '', kbNoKey, cmToolsMessages, hcToolsMessages,
+      NewItem('Goto ~n~ext','Alt+F8', kbAltF8, cmToolsMsgNext, hcToolsMsgNext,
+      NewItem('Goto ~p~revious','Alt+F7', kbAltF7, cmToolsMsgPrev, hcToolsMsgPrev,
       NewLine(
       NewItem('~G~rep', 'Shift+F2', kbShiftF2, cmGrep, hcGrep,
       NewItem('~C~alculator', '', kbNoKey, cmCalculator, hcCalculator,
       NewItem('Ascii ~t~able', '', kbNoKey, cmAsciiTable, hcAsciiTable,
-      nil)))))),
+      nil)))))))),
     NewSubMenu('~O~ptions', hcOptionsMenu, NewMenu(
       NewItem('Mode~.~..','', kbNoKey, cmSwitchesMode, hcSwitchesMode,
       NewItem('~C~ompiler...','', kbNoKey, cmCompiler, hcCompiler,
@@ -304,7 +303,8 @@ begin
       NewStatusKey('~Alt+F1~ Previous topic', kbAltF1, cmHelpPrevTopic,
       NewStatusKey('~Shift+F1~ Help index', kbShiftF1, cmHelpIndex,
       NewStatusKey('~Esc~ Close help', kbEsc, cmClose,
-      nil)))),
+      StdStatusKeys(
+      nil))))),
     NewStatusDef(hcSourceWindow, hcSourceWindow,
       NewStatusKey('~F1~ Help', kbF1, cmHelp,
       NewStatusKey('~F2~ Save', kbF2, cmSave,
@@ -314,6 +314,13 @@ begin
       NewStatusKey('~Alt+F10~ Local menu', kbAltF10, cmLocalMenu,
       StdStatusKeys(
       nil))))))),
+    NewStatusDef(hcMessagesWindow, hcMessagesWindow,
+      NewStatusKey('~F1~ Help', kbF1, cmHelp,
+      NewStatusKey('~'+EnterSign+'~ Goto source', kbEnter, cmMsgGotoSource,
+      NewStatusKey('~Space~ Track source', kbNoKey, cmMsgTrackSource,
+      NewStatusKey('~Alt+F10~ Local menu', kbAltF10, cmLocalMenu,
+      StdStatusKeys(
+      nil))))),
     NewStatusDef(hcCalcWindow, hcCalcWindow,
       NewStatusKey('~F1~ Help', kbF1, cmHelp,
       NewStatusKey('~Esc~ Close', kbEsc, cmClose,
@@ -328,7 +335,13 @@ begin
       NewStatusKey('~Alt+F10~ Local menu', kbAltF10, cmLocalMenu,
       StdStatusKeys(
       nil)))))),
-    nil)))))));
+    nil))))))));
+end;
+
+procedure TIDEApp.Idle;
+begin
+  inherited Idle;
+  Message(Application,evIdle,0,nil);
 end;
 
 procedure TIDEApp.HandleEvent(var Event: TEvent);
@@ -358,6 +371,7 @@ begin
            { -- Edit menu -- }
              cmShowClipboard : ShowClipboard;
            { -- Search menu -- }
+             cmFindProcedure : FindProcedure;
              cmObjects       : Objects;
              cmModules       : Modules;
              cmGlobals       : Globals;
@@ -388,19 +402,22 @@ begin
              cmDebugger      : DoDebuggerSwitch;
              cmDirectories   : Directories;
              cmTools         : Tools;
+             cmPreferences   : Preferences;
              cmEditor        : EditorOptions(nil);
              cmEditorOptions : EditorOptions(Event.InfoPtr);
              cmBrowser       : BrowserOptions(nil);
              cmBrowserOptions : BrowserOptions(Event.InfoPtr);
              cmMouse         : Mouse;
+             cmStartup       : StartUp;
              cmColors        : Colors;
              cmOpenINI       : OpenINI;
              cmSaveINI       : SaveINI;
              cmSaveAsINI     : SaveAsINI;
            { -- Tools menu -- }
-             cmAsciiTable    : DoAsciiTable;
+             cmToolsMessages : Messages;
              cmCalculator    : Calculator;
-             cmGrep          : Grep;
+             cmAsciiTable    : DoAsciiTable;
+             cmGrep          : DoGrep;
              cmToolsBase+1..
              cmToolsBase+MaxToolCount
                              : ExecuteTool(Event.Command-cmToolsBase);
@@ -475,7 +492,7 @@ begin
 end;
 
 
-procedure TIDEApp.DoExecute(ProgramPath, Params: string; IsDosShell: boolean);
+procedure TIDEApp.DoExecute(ProgramPath, Params, InFile,OutFile: string; ExecType: TExecType);
 begin
   if UserScreen=nil then
    begin
@@ -483,20 +500,23 @@ begin
      Exit;
    end;
 
-  ShowUserScreen;
+  if ExecType<>exNoSwap then
+    ShowUserScreen;
 
-  if IsDOSShell then
+  if ExecType=exDosShell then
     WriteShellMsg;
 
-  SwapVectors;
 {$ifdef linux}
   Shell(ProgramPath+' '+Params);
 {$else}
-  Dos.Exec(GetEnv('COMSPEC'),'/C '+ProgramPath+' '+Params);
+  if (InFile='') and (OutFile='') then
+    Dos.Exec(GetEnv('COMSPEC'),'/C '+ProgramPath+' '+Params)
+  else
+    ExecuteRedir(GetEnv('COMSPEC'),'/C '+ProgramPath+' '+Params,InFile,OutFile,'stderr');
 {$endif}
-  SwapVectors;
 
-  ShowIDEScreen;
+  if ExecType<>exNoSwap then
+    ShowIDEScreen;
 end;
 
 
@@ -506,11 +526,11 @@ begin
   SetCmdState([cmCloseAll,cmTile,cmCascade,cmWindowList],IsThereAnyWindow);
   SetCmdState([cmFindProcedure,cmObjects,cmModules,cmGlobals{,cmInformation}],IsSymbolInfoAvailable);
   SetCmdState([cmResetDebugger],assigned(debugger) and debugger^.debugger_started);
+  SetCmdState([cmToolsMsgNext,cmToolsMsgPrev],MessagesWindow<>nil);
+  UpdateTools;
+  UpdateRecentFileList;
   UpdatePrimaryFile;
   UpdateINIFile;
-  Message(MenuBar,evBroadcast,cmUpdate,nil);
-  UpdateRecentFileList;
-  UpdateTools;
   Message(Application,evBroadcast,cmCommandSetChanged,nil);
 end;
 
@@ -616,7 +636,7 @@ end;
 
 procedure TIDEApp.DosShell;
 begin
-  DoExecute(GetEnv('COMSPEC'), '', true);
+  DoExecute(GetEnv('COMSPEC'), '', '', '', exDosShell);
 end;
 
 {$I FPMFILE.INC}
@@ -686,7 +706,24 @@ end;
 END.
 {
   $Log$
-  Revision 1.19  1999-02-22 11:51:36  peter
+  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
+    * efBackSpaceUnindents works correctly
+    + 'Messages' window implemented
+    + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
+    + Added TP message-filter support (for ex. you can call GREP thru
+      GREP2MSG and view the result in the messages window - just like in TP)
+    * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
+      so topic search didn't work...
+    * In FPHELP.PAS there were still context-variables defined as word instead
+      of THelpCtx
+    * StdStatusKeys() was missing from the statusdef for help windows
+    + Topic-title for index-table can be specified when adding a HTML-files
+
+  Revision 1.19  1999/02/22 11:51:36  peter
     * browser updates from gabor
 
   Revision 1.18  1999/02/22 02:15:13  peter

+ 52 - 31
ide/text/fpini.pas

@@ -208,14 +208,15 @@ var INIFile: PINIFile;
     S,PS,S1,S2,S3: string;
     I,P: integer;
     BreakPointCount:longint;
+    OK: boolean;
     ts : TSwitchMode;
     W: word;
 begin
-  ReadINIFile:=false;
-  if not ExistsFile(INIPath) then
-   exit;
+  OK:=ExistsFile(INIPath);
+  if OK then
+ begin
   New(INIFile, Init(INIPath));
-{ Files }
+  { Files }
   OpenExts:=INIFile^.GetEntry(secFiles,ieOpenExts,OpenExts);
   RecentFileCount:=High(RecentFiles);
   for I:=Low(RecentFiles) to High(RecentFiles) do
@@ -232,15 +233,17 @@ begin
         LastPos.Y:=Max(0,StrToInt(copy(S,1,P-1))); Delete(S,1,P);
       end;
     end;
-{ Run }
+  { Run }
   SetRunParameters(INIFile^.GetEntry(secRun,ieRunParameters,GetRunParameters));
-{ Compile }
   PrimaryFile:=INIFile^.GetEntry(secCompile,iePrimaryFile,PrimaryFile);
+  { Compile }
   S:=INIFile^.GetEntry(secCompile,ieCompileMode,'');
   for ts:=low(TSwitchMode) to high(TSwitchMode) do
-   if SwitchesModeStr[ts]=S then
-     SwitchesMode:=ts;
-{ Help }
+    begin
+      if SwitchesModeStr[ts]=S then
+        SwitchesMode:=ts;
+    end;
+  { Help }
   S:=INIFile^.GetEntry(secHelp,ieHelpFiles,'');
   repeat
     P:=Pos(';',S); if P=0 then P:=length(S)+1;
@@ -248,29 +251,29 @@ begin
     if PS<>'' then HelpFiles^.Insert(NewStr(PS));
     Delete(S,1,P);
   until S='';
-{ Editor }
+  { Editor }
 {$ifndef EDITORS}
   DefaultTabSize:=INIFile^.GetIntEntry(secEditor,ieDefaultTabSize,DefaultTabSize);
   DefaultCodeEditorFlags:=INIFile^.GetIntEntry(secEditor,ieDefaultEditorFlags,DefaultCodeEditorFlags);
   DefaultSaveExt:=INIFile^.GetEntry(secEditor,ieDefaultSaveExt,DefaultSaveExt);
 {$endif}
-{ Highlight }
+  { Highlight }
   HighlightExts:=INIFile^.GetEntry(secHighlight,ieHighlightExts,HighlightExts);
   TabsPattern:=INIFile^.GetEntry(secHighlight,ieTabsPattern,TabsPattern);
-{ SourcePath }
+  { SourcePath }
   SourceDirs:=INIFile^.GetEntry(secSourcePath,ieSourceList,SourceDirs);
-{ Mouse }
+  { Mouse }
   DoubleDelay:=INIFile^.GetIntEntry(secMouse,ieDoubleClickDelay,DoubleDelay);
   MouseReverse:=boolean(INIFile^.GetIntEntry(secMouse,ieReverseButtons,byte(MouseReverse)));
   AltMouseAction:=INIFile^.GetIntEntry(secMouse,ieAltClickAction,AltMouseAction);
   CtrlMouseAction:=INIFile^.GetIntEntry(secMouse,ieCtrlClickAction,CtrlMouseAction);
-{ Search }
+  { Search }
   FindFlags:=INIFile^.GetIntEntry(secSearch,ieFindFlags,FindFlags);
-{ Breakpoints }
+  { Breakpoints }
   BreakpointCount:=INIFile^.GetIntEntry(secBreakpoint,ieBreakpointCount,0);
   for i:=1 to BreakpointCount do
     ReadOneBreakPointEntry(i-1,INIFile);
-{ Tools }
+  { Tools }
   for I:=1 to MaxToolCount do
     begin
       S:=IntToStr(I);
@@ -281,7 +284,7 @@ begin
       W:=Max(0,Min(65535,INIFile^.GetIntEntry(secTools,ieToolHotKey+S,0)));
       AddTool(S1,S2,S3,W);
     end;
-{ Colors }
+  { Colors }
   S:=AppPalette;
   PS:=StrToPalette(INIFile^.GetEntry(secColors,iePalette+'_1_40',PaletteToStr(copy(S,1,40))));
   PS:=PS+StrToPalette(INIFile^.GetEntry(secColors,iePalette+'_41_80',PaletteToStr(copy(S,41,40))));
@@ -291,7 +294,8 @@ begin
   PS:=PS+StrToPalette(INIFile^.GetEntry(secColors,iePalette+'_201_240',PaletteToStr(copy(S,201,40))));
   AppPalette:=PS;
   Dispose(INIFile, Done);
-  ReadINIFile:=true;
+ end;
+  ReadINIFile:=OK;
 end;
 
 function WriteINIFile: boolean;
@@ -309,7 +313,7 @@ begin
 end;
 begin
   New(INIFile, Init(INIPath));
-{ Files }
+  { Files }
   INIFile^.SetEntry(secFiles,ieOpenExts,'"'+OpenExts+'"');
   for I:=1 to High(RecentFiles) do
     begin
@@ -319,39 +323,39 @@ begin
          S:='';
       INIFile^.SetEntry(secFiles,ieRecentFile+IntToStr(I),S);
     end;
-{ Run }
+  { Run }
   INIFile^.SetEntry(secRun,ieRunParameters,GetRunParameters);
-{ Compile }
+  { Compile }
   INIFile^.SetEntry(secCompile,iePrimaryFile,PrimaryFile);
   INIFile^.SetEntry(secCompile,ieCompileMode,SwitchesModeStr[SwitchesMode]);
-{ Help }
+  { Help }
   S:='';
   HelpFiles^.ForEach(@ConcatName);
   INIFile^.SetEntry(secHelp,ieHelpFiles,'"'+S+'"');
-{ Editor }
+  { Editor }
 {$ifndef EDITORS}
   INIFile^.SetIntEntry(secEditor,ieDefaultTabSize,DefaultTabSize);
   INIFile^.SetIntEntry(secEditor,ieDefaultEditorFlags,DefaultCodeEditorFlags);
   INIFile^.SetEntry(secEditor,ieDefaultSaveExt,DefaultSaveExt);
 {$endif}
-{ Highlight }
+  { Highlight }
   INIFile^.SetEntry(secHighlight,ieHighlightExts,'"'+HighlightExts+'"');
   INIFile^.SetEntry(secHighlight,ieTabsPattern,'"'+TabsPattern+'"');
-{ SourcePath }
+  { SourcePath }
   INIFile^.SetEntry(secSourcePath,ieSourceList,'"'+SourceDirs+'"');
-{ Mouse }
+  { Mouse }
   INIFile^.SetIntEntry(secMouse,ieDoubleClickDelay,DoubleDelay);
   INIFile^.SetIntEntry(secMouse,ieReverseButtons,byte(MouseReverse));
   INIFile^.SetIntEntry(secMouse,ieAltClickAction,AltMouseAction);
   INIFile^.SetIntEntry(secMouse,ieCtrlClickAction,CtrlMouseAction);
-{ Search }
+  { Search }
   INIFile^.SetIntEntry(secSearch,ieFindFlags,FindFlags);
-{ Breakpoints }
+  { Breakpoints }
   BreakPointCount:=BreakpointCollection^.Count;
   INIFile^.SetIntEntry(secBreakpoint,ieBreakpointCount,BreakpointCount);
   for i:=1 to BreakpointCount do
     WriteOneBreakPointEntry(I-1,INIFile);
-{ Tools }
+  { Tools }
   INIFile^.DeleteSection(secTools);
   for I:=1 to GetToolCount do
     begin
@@ -365,7 +369,7 @@ begin
       INIFile^.SetEntry(secTools,ieToolParams+S,S3);
       INIFile^.SetIntEntry(secTools,ieToolHotKey+S,W);
     end;
-{ Colors }
+  { Colors }
   if AppPalette<>CIDEAppColor then
   begin
     { this has a bug. if a different palette has been read on startup, and
@@ -387,7 +391,24 @@ end;
 end.
 {
   $Log$
-  Revision 1.13  1999-02-22 02:15:14  peter
+  Revision 1.14  1999-03-01 15:41:55  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
+    * efBackSpaceUnindents works correctly
+    + 'Messages' window implemented
+    + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
+    + Added TP message-filter support (for ex. you can call GREP thru
+      GREP2MSG and view the result in the messages window - just like in TP)
+    * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
+      so topic search didn't work...
+    * In FPHELP.PAS there were still context-variables defined as word instead
+      of THelpCtx
+    * StdStatusKeys() was missing from the statusdef for help windows
+    + Topic-title for index-table can be specified when adding a HTML-files
+
+  Revision 1.13  1999/02/22 02:15:14  peter
     + default extension for save in the editor
     + Separate Text to Find for the grep dialog
     * fixed redir crash with tp7

+ 48 - 44
ide/text/fpmhelp.inc

@@ -42,16 +42,31 @@ begin
 end;
 
 type
+    PHelpFileListBox = ^THelpFileListBox;
+    THelpFileListBox = object(TListBox)
+      function GetText(Item: Integer; MaxLen: Integer): String; virtual;
+    end;
+
     PHelpFilesDialog = ^THelpFilesDialog;
     THelpFilesDialog = object(TCenterDialog)
       constructor Init;
       procedure   HandleEvent(var Event: TEvent); virtual;
       destructor  Done; virtual;
     private
-      LB: PListBox;
+      LB: PHelpFileListBox;
       C : PUnsortedStringCollection;
     end;
 
+function THelpFileListBox.GetText(Item: Integer; MaxLen: Integer): String;
+var S: string;
+    P: integer;
+begin
+  S:=inherited GetText(Item,MaxLen);
+  P:=Pos('|',S);
+  if P>0 then S:=copy(S,P+1,255)+' - '+copy(S,1,P-1);
+  GetText:=copy(S,1,MaxLen);
+end;
+
 constructor THelpFilesDialog.Init;
 var R,R2: TRect;
     SB: PScrollBar;
@@ -93,6 +108,8 @@ procedure THelpFilesDialog.HandleEvent(var Event: TEvent);
 var I: integer;
     D: PFileDialog;
     FileName: string;
+    Re: word;
+    S: string;
 begin
   case Event.What of
     evKeyDown :
@@ -112,10 +129,18 @@ begin
       case Event.Command of
         cmAddItem :
           begin
-            New(D, Init('*.tph','Install a help file','*.tph',fdOpenButton,0));
-            if Desktop^.ExecView(D)<>cmCancel then
+            S:='';
+            New(D, Init(HelpFileExts,'Install a help file','~H~elp file name',fdOpenButton,0));
+            Re:=Desktop^.ExecView(D);
+            if Re<>cmCancel then
             begin
               D^.GetFileName(FileName);
+              if UpcaseStr(copy(ExtOf(FileName),1,4))='.HTM' then
+                Re:=InputBox('Topic title','Title',S,40);
+            end;
+            if Re<>cmCancel then
+            begin
+              if S<>'' then FileName:=FileName+'|'+S;
               LB^.List^.Insert(NewStr(FileName));
               LB^.SetRange(LB^.List^.Count);
               ReDraw;
@@ -153,57 +178,36 @@ begin
   if Desktop^.ExecView(New(PHelpFilesDialog, Init))=cmOK then
   begin
     DoneHelpSystem;
+    Message(Application,evBroadcast,cmHelpFilesChanged,nil);
     InitHelpSystem;
   end;
 end;
 
 procedure TIDEApp.About;
-var R,R2: TRect;
-    D: PCenterDialog;
-    OSStr: string;
 begin
-  OSStr:='';
-{$ifdef go32v2}
-  OSStr:='Dos';
-{$endif}
-{$ifdef tp}
-  OSStr:='Dos';
-{$endif}
-{$ifdef linux}
-  OSStr:='Linux';
-{$endif}
-{$ifdef win32}
-  OSStr:='Win32';
-{$endif}
-{$ifdef os2}
-  OSStr:='OS/2';
-{$endif}
-  R.Assign(0,0,46,12);
-  New(D, Init(R, 'About'));
-  with D^ do
-  begin
-    GetExtent(R); R.Grow(-3,-2);
-    R2.Copy(R); R2.B.Y:=R2.A.Y+1;
-    Insert(New(PStaticText, Init(R2, ^C'FreePascal IDE for '+OSStr+' Version '+VersionStr)));
-    R2.Move(0,1);
-    Insert(New(PStaticText, Init(R2, ^C'(Compiler Version '+Version_String+')')));
-    R2.Move(0,2);
-    Insert(New(PStaticText, Init(R2, ^C'Copyright (C) 1998-99 by')));
-    R2.Move(0,2);
-    Insert(New(PStaticText, Init(R2, ^C'B‚rczi G bor')));
-    R2.Move(0,1);
-    Insert(New(PStaticText, Init(R2, ^C'and')));
-    R2.Move(0,1);
-    Insert(New(PStaticText, Init(R2, ^C'Peter Vreman')));
-  end;
-  InsertOK(D);
-  Desktop^.ExecView(D);
-  Dispose(D, Done);
+  ExecuteDialog(New(PFPAboutDialog, Init), nil);
 end;
 
 {
   $Log$
-  Revision 1.5  1999-02-22 02:15:16  peter
+  Revision 1.6  1999-03-01 15:41:56  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
+    * efBackSpaceUnindents works correctly
+    + 'Messages' window implemented
+    + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
+    + Added TP message-filter support (for ex. you can call GREP thru
+      GREP2MSG and view the result in the messages window - just like in TP)
+    * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
+      so topic search didn't work...
+    * In FPHELP.PAS there were still context-variables defined as word instead
+      of THelpCtx
+    * StdStatusKeys() was missing from the statusdef for help windows
+    + Topic-title for index-table can be specified when adding a HTML-files
+
+  Revision 1.5  1999/02/22 02:15:16  peter
     + default extension for save in the editor
     + Separate Text to Find for the grep dialog
     * fixed redir crash with tp7

+ 32 - 6
ide/text/fpmopts.inc

@@ -353,7 +353,7 @@ var R,R2: TRect;
     Items: PSItem;
 begin
   R.Assign(0,0,60,2+DebugInfoSwitches^.ItemCount+2
-      +ProfileInfoSwitches^.ItemCount+4);
+      +ProfileInfoSwitches^.ItemCount+2+2+1);
   New(D, Init(R, 'Debugging/Profiling'));
   with D^ do
   begin
@@ -378,12 +378,11 @@ begin
     If L = 1 then L:=3;
     CB^.SetData(L);
     Insert(CB);
-    R2.Copy(R); Inc(R2.A.Y,6); R2.B.Y:=R2.A.Y+1;
+    R2.Move(0,-1); R2.B.Y:=R2.A.Y+1;
     Insert(New(PLabel, Init(R2, 'Profiling Switches', CB)));
 
     {custom }
-    R2.A.Y:=R2.B.Y+2;
-    R2.B.Y:=R2.A.Y+1;
+    Inc(R2.A.Y,1+DebugInfoSwitches^.ItemCount+2); R2.B.Y:=R2.A.Y+1;
     New(IL2, Init(R2, 255));
     IL2^.Data^:=CustomArg[SwitchesMode];
     Insert(IL2);
@@ -454,6 +453,11 @@ begin
   ExecuteDialog(New(PToolsDialog, Init),nil);
 end;
 
+procedure TIDEApp.Preferences;
+begin
+  NotImplemented;
+end;
+
 procedure TIDEApp.EditorOptions(Editor: PEditor);
 var D: PCenterDialog;
     R,R2,R3: TRect;
@@ -480,7 +484,7 @@ begin
       NewSItem('~B~ackspace unindents',
       NewSItem('~P~ersistent blocks',
       NewSItem('~S~yntax highlight',
-      NewSItem('~B~lock insert cursor',
+      NewSItem('B~l~ock insert cursor',
       NewSItem('~V~ertical blocks',
       NewSItem('Highlight ~c~olumn',
       NewSItem('Highlight ~r~ow',
@@ -611,6 +615,11 @@ begin
   Dispose(D, Done);
 end;
 
+procedure TIDEApp.Startup;
+begin
+  NotImplemented;
+end;
+
 procedure TIDEApp.Mouse;
 var R,R2: TRect;
     D: PCenterDialog;
@@ -796,7 +805,24 @@ end;
 
 {
   $Log$
-  Revision 1.17  1999-02-22 11:51:37  peter
+  Revision 1.18  1999-03-01 15:41:57  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
+    * efBackSpaceUnindents works correctly
+    + 'Messages' window implemented
+    + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
+    + Added TP message-filter support (for ex. you can call GREP thru
+      GREP2MSG and view the result in the messages window - just like in TP)
+    * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
+      so topic search didn't work...
+    * In FPHELP.PAS there were still context-variables defined as word instead
+      of THelpCtx
+    * StdStatusKeys() was missing from the statusdef for help windows
+    + Topic-title for index-table can be specified when adding a HTML-files
+
+  Revision 1.17  1999/02/22 11:51:37  peter
     * browser updates from gabor
 
   Revision 1.16  1999/02/18 13:44:32  peter

+ 19 - 2
ide/text/fpmrun.inc

@@ -83,7 +83,7 @@ begin
 
   if not assigned(Debugger) then
     begin
-      DoExecute(ExeFile,GetRunParameters,false);
+      DoExecute(ExeFile,GetRunParameters,'','',exNormal);
       LastExitCode:=DosExitCode;
     end
   else
@@ -182,7 +182,24 @@ end;
 
 {
   $Log$
-  Revision 1.13  1999-02-18 13:44:33  peter
+  Revision 1.14  1999-03-01 15:41:58  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
+    * efBackSpaceUnindents works correctly
+    + 'Messages' window implemented
+    + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
+    + Added TP message-filter support (for ex. you can call GREP thru
+      GREP2MSG and view the result in the messages window - just like in TP)
+    * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
+      so topic search didn't work...
+    * In FPHELP.PAS there were still context-variables defined as word instead
+      of THelpCtx
+    * StdStatusKeys() was missing from the statusdef for help windows
+    + Topic-title for index-table can be specified when adding a HTML-files
+
+  Revision 1.13  1999/02/18 13:44:33  peter
     * search fixed
     + backward search
     * help fixes

+ 25 - 2
ide/text/fpmsrch.inc

@@ -14,8 +14,14 @@
 
  **********************************************************************}
 
+procedure TIDEApp.FindProcedure;
+begin
+  NotImplemented;
+end;
+
 procedure TIDEApp.Objects;
 begin
+  NotImplemented;
 end;
 
 procedure TIDEApp.Globals;
@@ -23,7 +29,7 @@ var R: TRect;
     S: PSortedSymbolCollection;
     Overflow: boolean;
     Level : longint;
-    
+
   procedure InsertInS(P: PSymbol); {$ifndef FPC}far;{$endif}
 
     procedure InsertItemsInS(P: PSymbolCollection);
@@ -76,7 +82,24 @@ end;
 
 {
   $Log$
-  Revision 1.4  1999-02-10 09:51:03  pierre
+  Revision 1.5  1999-03-01 15:41:59  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
+    * efBackSpaceUnindents works correctly
+    + 'Messages' window implemented
+    + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
+    + Added TP message-filter support (for ex. you can call GREP thru
+      GREP2MSG and view the result in the messages window - just like in TP)
+    * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
+      so topic search didn't work...
+    * In FPHELP.PAS there were still context-variables defined as word instead
+      of THelpCtx
+    * StdStatusKeys() was missing from the statusdef for help windows
+    + Topic-title for index-table can be specified when adding a HTML-files
+
+  Revision 1.4  1999/02/10 09:51:03  pierre
    * Adapted to TBrowserWindow changes
 
   Revision 1.3  1999/02/04 13:32:08  pierre

+ 19 - 1
ide/text/fpmwnd.inc

@@ -60,6 +60,7 @@ begin
     hcHelpWindow   : S:=PHelpWindow(P)^.GetTitle(MaxLen);
     hcCalcWindow   : S:=PCalculator(P)^.GetTitle(MaxLen);
     hcBrowserWindow: S:=PBrowserWindow(P)^.GetTitle(MaxLen);
+    hcMessagesWindow:S:=PMessagesWindow(P)^.GetTitle(MaxLen);
   else S:='???? - '+PWindow(P)^.GetTitle(MaxLen);
   end;
   GetText:=copy(S,1,MaxLen);
@@ -152,7 +153,24 @@ end;
 
 {
   $Log$
-  Revision 1.6  1999-01-21 11:54:22  peter
+  Revision 1.7  1999-03-01 15:42:00  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
+    * efBackSpaceUnindents works correctly
+    + 'Messages' window implemented
+    + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
+    + Added TP message-filter support (for ex. you can call GREP thru
+      GREP2MSG and view the result in the messages window - just like in TP)
+    * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
+      so topic search didn't work...
+    * In FPHELP.PAS there were still context-variables defined as word instead
+      of THelpCtx
+    * StdStatusKeys() was missing from the statusdef for help windows
+    + Topic-title for index-table can be specified when adding a HTML-files
+
+  Revision 1.6  1999/01/21 11:54:22  peter
     + tools menu
     + speedsearch in symbolbrowser
     * working run command

+ 146 - 78
ide/text/fpredir.pas

@@ -38,20 +38,22 @@ Interface
 {$UnDef MsDos}
 {$endif FPC}
 
-
 Var
-  IOStatus      : Integer;
-  RedirError    : Integer;
-  ExecuteResult : Word;
+  IOStatus                   : Integer;
+  RedirErrorOut,RedirErrorIn,
+  RedirErrorError            : Integer;
+  ExecuteResult              : Word;
 
 {------------------------------------------------------------------------------}
-function ExecuteRedir (Const ProgName, ComLine, RedirStdOut, RedirStdErr : String) : boolean;
-
-function ChangeRedir(Const Redir : String; AppendToFile : Boolean) : Boolean;
-procedure RestoreRedir;
+procedure InitRedir;
+function ExecuteRedir (Const ProgName, ComLine, RedirStdIn, RedirStdOut, RedirStdErr : String) : boolean;
 
-function ChangeErrorRedir(Const Redir : String; AppendToFile : Boolean) : Boolean;
-procedure RestoreErrorRedir;
+function  ChangeRedirOut(Const Redir : String; AppendToFile : Boolean) : Boolean;
+procedure RestoreRedirOut;
+function  ChangeRedirIn(Const Redir : String) : Boolean;
+procedure RestoreRedirIn;
+function  ChangeRedirError(Const Redir : String; AppendToFile : Boolean) : Boolean;
+procedure RestoreRedirError;
 
 
 Implementation
@@ -60,11 +62,9 @@ Uses
 {$ifdef go32v2}
   go32,
 {$endif go32v2}
-{$ifdef linux}
-  linux,
-{$endif linux}
   dos;
 
+
 {*****************************************************************************
                                      Dos
 *****************************************************************************}
@@ -90,18 +90,19 @@ Type
   PWord = ^Word;
 
 Var
-  PrefSeg      : Word;
   MinBlockSize : Word;
   MyBlockSize  : Word;
   Handles      : PHandles;
-  OldHandle,OldErrorHandle    : Byte;
+  PrefSeg      : Word;
+  OldHandleOut,OldHandleIn,OldHandleError    : Byte;
 {$endif TP}
 
-Var
-  F,FE              : File;
-  RedirChanged      : Boolean;
-  RedirErrorChanged : Boolean;
-  TempH, TempErrorH : longint;
+var
+  FIN,FOUT,FERR     : File;
+  RedirChangedOut,
+  RedirChangedIn    : Boolean;
+  RedirChangedError : Boolean;
+  TempHOut, TempHIn,TempHError : longint;
 
 { For linux the following functions exist
 Function  Dup(oldfile:longint;var newfile:longint):Boolean;
@@ -155,60 +156,84 @@ end;
 
 {............................................................................}
 
-function ChangeRedir(Const Redir : String; AppendToFile : Boolean) : Boolean;
+function ChangeRedirOut(Const Redir : String; AppendToFile : Boolean) : Boolean;
+  var temp : byte;
   begin
-    ChangeRedir:=False;
+    ChangeRedirOut:=False;
     If Redir = '' then Exit;
-    Assign (F, Redir);
+    Assign (FOUT, Redir);
     If AppendToFile and FileExist(Redir) then
       Begin
-      Reset(F,1);
-      Seek(F,FileSize(F));
-      End else Rewrite (F);
+      Reset(FOUT,1);
+      Seek(FOUT,FileSize(FOUT));
+      End else Rewrite (FOUT);
 
-    RedirError:=IOResult;
-    IOStatus:=RedirError;
+    RedirErrorOut:=IOResult;
+    IOStatus:=RedirErrorOut;
     If IOStatus <> 0 then Exit;
 {$ifndef FPC}
     Handles:=Ptr (prefseg, PWord (Ptr (prefseg, $34))^);
-    OldHandle:=Handles^[1];
-    Handles^[1]:=Handles^[FileRec (F).Handle];
-    ChangeRedir:=True;
+    OldHandleOut:=Handles^[StdOutputHandle];
+    Handles^[StdOutputHandle]:=Handles^[FileRec (FOUT).Handle];
+    ChangeRedirOut:=True;
 {$else}
-    if dup(StdOutputHandle,TempH) and
-       dup2(FileRec(F).Handle,StdOutputHandle) then
-      ChangeRedir:=True;
+    if dup(StdOutputHandle,TempHOut) and
+       dup2(FileRec(FOUT).Handle,StdOutputHandle) then
+      ChangeRedirOut:=True;
 {$endif def FPC}
-     RedirChanged:=True;
+     RedirChangedOut:=True;
   end;
 
-function ChangeErrorRedir(Const Redir : String; AppendToFile : Boolean) : Boolean;
+function ChangeRedirIn(Const Redir : String) : Boolean;
+  var temp : byte;
   begin
-    ChangeErrorRedir:=False;
+    ChangeRedirIn:=False;
     If Redir = '' then Exit;
-    Assign (FE, Redir);
+    Assign (FIN, Redir);
+    Reset(FIN,1);
+
+    RedirErrorIn:=IOResult;
+    IOStatus:=RedirErrorIn;
+    If IOStatus <> 0 then Exit;
+{$ifndef FPC}
+    Handles:=Ptr (prefseg, PWord (Ptr (prefseg, $34))^);
+    OldHandleIn:=Handles^[StdInputHandle];
+    Handles^[StdInputHandle]:=Handles^[FileRec (FIN).Handle];
+    ChangeRedirIn:=True;
+{$else}
+    if dup(StdInputHandle,TempHIn) and
+       dup2(FileRec(FIN).Handle,StdInputHandle) then
+      ChangeRedirIn:=True;
+{$endif def FPC}
+     RedirChangedIn:=True;
+  end;
+
+function ChangeRedirError(Const Redir : String; AppendToFile : Boolean) : Boolean;
+  var temp : byte;
+  begin
+    ChangeRedirError:=False;
+    If Redir = '' then Exit;
+    Assign (FERR, Redir);
     If AppendToFile and FileExist(Redir) then
       Begin
-      Reset(FE,1);
-      Seek(FE,FileSize(FE));
-      End
-    else
-      Rewrite (FE);
+      Reset(FERR,1);
+      Seek(FERR,FileSize(FERR));
+      End else Rewrite (FERR);
 
-    RedirError:=IOResult;
-    IOStatus:=RedirError;
+    RedirErrorError:=IOResult;
+    IOStatus:=RedirErrorError;
     If IOStatus <> 0 then Exit;
 {$ifndef FPC}
     Handles:=Ptr (prefseg, PWord (Ptr (prefseg, $34))^);
-    OldErrorHandle:=Handles^[2];
-    Handles^[2]:=Handles^[FileRec (FE).Handle];
-    ChangeErrorRedir:=True;
+    OldHandleError:=Handles^[StdErrorHandle];
+    Handles^[StdErrorHandle]:=Handles^[FileRec (FERR).Handle];
+    ChangeRedirError:=True;
 {$else}
-    if dup(StdErrorHandle,TempErrorH) and
-       dup2(FileRec(FE).Handle,StdErrorHandle) then
-      ChangeErrorRedir:=True;
+    if dup(StdErrorHandle,TempHError) and
+       dup2(FileRec(FERR).Handle,StdErrorHandle) then
+      ChangeRedirError:=True;
 {$endif}
-    RedirErrorChanged:=True;
+     RedirChangedError:=True;
   end;
 
 
@@ -246,34 +271,50 @@ end;
 {$EndIf MsDos}
 
 
-  procedure RestoreRedir;
+  procedure RestoreRedirOut;
+
+  begin
+    If not RedirChangedOut then Exit;
+{$ifndef FPC}
+    Handles^[StdOutputHandle]:=OldHandleOut;
+    OldHandleOut:=StdOutputHandle;
+{$else}
+    dup2(TempHOut,StdOutputHandle);
+{$endif}
+    Close (FOUT);
+    RedirChangedOut:=false;
+  end;
+
+  {............................................................................}
+
+  procedure RestoreRedirIn;
 
   begin
-    If not RedirChanged then Exit;
+    If not RedirChangedIn then Exit;
 {$ifndef FPC}
-    Handles^[1]:=OldHandle;
-    OldHandle:=StdOutputHandle;
+    Handles^[StdInputHandle]:=OldHandleIn;
+    OldHandleIn:=StdInputHandle;
 {$else}
-    dup2(TempH,StdOutputHandle);
+    dup2(TempHIn,StdInputHandle);
 {$endif}
-    Close (F);
-    RedirChanged:=false;
+    Close (FIn);
+    RedirChangedIn:=false;
   end;
 
   {............................................................................}
 
-  procedure RestoreErrorRedir;
+  procedure RestoreRedirError;
 
   begin
-    If not RedirErrorChanged then Exit;
+    If not RedirChangedError then Exit;
 {$ifndef FPC}
-    Handles^[2]:=OldErrorHandle;
-    OldErrorHandle:=StdErrorHandle;
+    Handles^[StdErrorHandle]:=OldHandleError;
+    OldHandleError:=StdErrorHandle;
 {$else}
-    dup2(TempErrorH,StdErrorHandle);
+    dup2(TempHError,StdErrorHandle);
 {$endif}
-    Close (FE);
-    RedirErrorChanged:=false;
+    Close (FERR);
+    RedirChangedError:=false;
   end;
 
 {............................................................................}
@@ -282,7 +323,7 @@ end;
 
   Begin
 {$IfDef MsDos}
-    SmallHeap;
+  SmallHeap;
 {$EndIf MsDos}
     SwapVectors;
     { Must use shell() for linux for the wildcard expansion (PFV) }
@@ -295,36 +336,46 @@ end;
     ExecuteResult:=DosExitCode;
     SwapVectors;
 {$IfDef MsDos}
-    Fullheap;
+  Fullheap;
 {$EndIf MsDos}
   End;
 
 {............................................................................}
 
-function ExecuteRedir (Const ProgName, ComLine, RedirStdOut, RedirStdErr : String) : boolean;
+function ExecuteRedir (Const ProgName, ComLine, RedirStdIn, RedirStdOut, RedirStdErr : String) : boolean;
 Begin
-  RedirError:=0;
+  RedirErrorOut:=0; RedirErrorIn:=0; RedirErrorError:=0;
   ExecuteResult:=0;
   IOStatus:=0;
+  if RedirStdIn<>'' then
+    ChangeRedirIn(RedirStdIn);
   if RedirStdOut<>'' then
-    ChangeRedir(RedirStdOut,false);
+    ChangeRedirOut(RedirStdOut,false);
   if RedirStdErr<>'stderr' then
-    RedirErrorChanged:=ChangeErrorRedir(RedirStdErr,false);
+    ChangeRedirError(RedirStdErr,false);
   DosExecute(ProgName,ComLine);
-  RestoreRedir;
-  RestoreErrorRedir;
-  ExecuteRedir:=(IOStatus=0) and (RedirError=0) and (ExecuteResult=0);
+  RestoreRedirOut;
+  RestoreRedirIn;
+  RestoreRedirError;
+  ExecuteRedir:=(IOStatus=0) and (RedirErrorOut=0) and
+                (RedirErrorIn=0) and (RedirErrorError=0) and
+                (ExecuteResult=0);
 End;
 
 
-{$else not  implemented}
+procedure InitRedir;
+begin
+{$ifndef FPC}
+  PrefSeg:=PrefixSeg;
+{$endif FPC}
+end;
 
+{$else not  implemented}
 
 {*****************************************************************************
                                  Linux
 *****************************************************************************}
 
-
 function ExecuteRedir (Const ProgName, ComLine, RedirStdOut, RedirStdErr : String) : boolean;
 begin
   ExecuteRedir:=false;
@@ -362,7 +413,24 @@ end;
 End.
 {
   $Log$
-  Revision 1.10  1999-02-22 12:46:58  peter
+  Revision 1.11  1999-03-01 15:42:01  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
+    * efBackSpaceUnindents works correctly
+    + 'Messages' window implemented
+    + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
+    + Added TP message-filter support (for ex. you can call GREP thru
+      GREP2MSG and view the result in the messages window - just like in TP)
+    * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
+      so topic search didn't work...
+    * In FPHELP.PAS there were still context-variables defined as word instead
+      of THelpCtx
+    * StdStatusKeys() was missing from the statusdef for help windows
+    + Topic-title for index-table can be specified when adding a HTML-files
+
+  Revision 1.10  1999/02/22 12:46:58  peter
     * small fixes for linux and grep
 
   Revision 1.9  1999/02/22 11:12:33  pierre

+ 20 - 3
ide/text/fpsymbol.pas

@@ -117,8 +117,8 @@ procedure OpenOneSymbolBrowser(Name : String);
 implementation
 
 uses Commands,App,
-     WEditor,FPDebug,
-     FPConst,FPUtils,FPVars;
+     WEditor,WViews,
+     FPConst,FPUtils,FPVars,FPDebug;
 
 function NewBrowserTabItem(ASign: char; ALink: PView; ANext: PBrowserTabItem): PBrowserTabItem;
 var P: PBrowserTabItem;
@@ -911,7 +911,24 @@ end;
 END.
 {
   $Log$
-  Revision 1.11  1999-02-22 11:51:38  peter
+  Revision 1.12  1999-03-01 15:42:02  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
+    * efBackSpaceUnindents works correctly
+    + 'Messages' window implemented
+    + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
+    + Added TP message-filter support (for ex. you can call GREP thru
+      GREP2MSG and view the result in the messages window - just like in TP)
+    * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
+      so topic search didn't work...
+    * In FPHELP.PAS there were still context-variables defined as word instead
+      of THelpCtx
+    * StdStatusKeys() was missing from the statusdef for help windows
+    + Topic-title for index-table can be specified when adding a HTML-files
+
+  Revision 1.11  1999/02/22 11:51:38  peter
     * browser updates from gabor
 
   Revision 1.9  1999/02/18 13:44:34  peter

+ 19 - 15
ide/text/fptemplt.pas

@@ -113,22 +113,9 @@ function StartTemplate(Index: integer; Editor: PSourceEditor): boolean;
 var
     T: PTemplate;
     OK: boolean;
-    E: PFileEditor;
-    R: TRect;
 begin
   T:=Templates^.At(Index);
-  R.Assign(0,0,0,0);
-  New(E, Init(R,nil,nil,nil,T^.Path^));
-  OK:=E<>nil;
-  if OK then OK:=E^.LoadFile;
-  if OK then
-    begin
-      E^.SelectAll(true);
-      Editor^.InsertFrom(E);
-      Editor^.SetCurPtr(0,0);
-      Editor^.SelectAll(false);
-      Dispose(E, Done);
-    end;
+  OK:=StartEditor(Editor,T^.Path^);
   StartTemplate:=OK;
 end;
 
@@ -177,7 +164,24 @@ end;
 END.
 {
   $Log$
-  Revision 1.5  1999-02-18 13:44:35  peter
+  Revision 1.6  1999-03-01 15:42:03  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
+    * efBackSpaceUnindents works correctly
+    + 'Messages' window implemented
+    + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
+    + Added TP message-filter support (for ex. you can call GREP thru
+      GREP2MSG and view the result in the messages window - just like in TP)
+    * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
+      so topic search didn't work...
+    * In FPHELP.PAS there were still context-variables defined as word instead
+      of THelpCtx
+    * StdStatusKeys() was missing from the statusdef for help windows
+    + Topic-title for index-table can be specified when adding a HTML-files
+
+  Revision 1.5  1999/02/18 13:44:35  peter
     * search fixed
     + backward search
     * help fixes

+ 383 - 45
ide/text/fptools.pas

@@ -17,10 +17,17 @@ unit FPTools;
 
 interface
 
-uses Objects,Drivers,Dialogs,Validate,
+uses Objects,Drivers,Views,Dialogs,Validate,
+     BrowCol,
+     WViews,
      FPViews;
 
+const
+      MsgFilterSign = 'BI#PIP#OK'#0;
+
 type
+    TCaptureTarget = (capNone,capMessageWindow,capEditWindow);
+
     PTool = ^TTool;
     TTool = object(TObject)
       constructor Init(const ATitle, AProgramPath, ACommandLine: string; AHotKey: word);
@@ -42,7 +49,7 @@ type
 
     PToolListBox = ^TToolListBox;
     TToolListBox = object(TAdvancedListBox)
-      function GetText(Item,MaxLen: sw_integer): String; virtual;
+      function GetText(Item,MaxLen: Sw_Integer): String; virtual;
     end;
 
     PToolParamValidator = ^TToolParamValidator;
@@ -77,22 +84,62 @@ type
       procedure Delete;
     end;
 
+    PToolMessage = ^TToolMessage;
+    TToolMessage = object(TMessageItem)
+      constructor Init(AModule: PString; ALine: string; ARow, ACol: sw_integer);
+      function    GetText(MaxLen: Sw_integer): string; virtual;
+    end;
+
+    PToolMessageListBox = ^TToolMessageListBox;
+    TToolMessageListBox = object(TMessageListBox)
+      procedure  NewList(AList: PCollection); virtual;
+      procedure  Clear; virtual;
+      procedure  Update; virtual;
+      function   GetPalette: PPalette; virtual;
+      destructor Done; virtual;
+    end;
+
+    PMessagesWindow = ^TMessagesWindow;
+    TMessagesWindow = object(TFPWindow)
+      constructor Init;
+      procedure   Update; virtual;
+      procedure   HandleEvent(var Event: TEvent); virtual;
+      function    GetPalette: PPalette; virtual;
+      destructor  Done; virtual;
+    private
+      MsgLB : PToolMessageListBox;
+    end;
+
 procedure InitTools;
-function  GetToolCount: Sw_integer;
-function  GetToolName(Idx: Sw_integer): string;
-function  AddTool(Title, ProgramPath, Params: string; HotKey: word): Sw_integer;
-procedure GetToolParams(Idx: Sw_integer; var Title, ProgramPath, Params: string; var HotKey: word);
-procedure SetToolParams(Idx: Sw_integer; Title, ProgramPath, Params: string; HotKey: word);
+function  GetToolCount: sw_integer;
+function  GetToolName(Idx: sw_integer): string;
+function  AddTool(Title, ProgramPath, Params: string; HotKey: word): sw_integer;
+procedure GetToolParams(Idx: sw_integer; var Title, ProgramPath, Params: string; var HotKey: word);
+procedure SetToolParams(Idx: sw_integer; Title, ProgramPath, Params: string; HotKey: word);
 procedure DoneTools;
 
 function GetHotKeyName(Key: word): string;
 
-function ParseToolParams(var Params: string; CheckOnly: boolean): Sw_integer;
+function ParseToolParams(var Params: string; CheckOnly: boolean): integer;
+
+function  ProcessMessageFile(const MsgFileName: string): boolean;
+procedure AddToolCommand(Command: string);
+procedure AddToolMessage(ModuleName, Text: string; Row, Col: longint);
+procedure ClearToolMessages;
+procedure UpdateToolMessages;
+
+const
+     ToolFilter     : string           = '';
+     CaptureToolTo  : TCaptureTarget   = capNone;
+     ToolMessages   : PCollection      = nil;
+     ToolModuleNames: PStoreCollection = nil;
+     MessagesWindow : PMessagesWindow  = nil;
+     LastToolMessageFocused : PToolMessage = nil;
 
 implementation
 
 uses Dos,
-     Commands,Views,App,MsgBox,
+     Commands,App,MsgBox,
      FPConst,FPVars,FPUtils;
 
 type
@@ -104,8 +151,7 @@ type
 const
      HotKeys : array[0..8] of THotKeyDef =
       ( (Name : '~U~nassigned' ; KeyCode : kbNoKey   ),
-{ Used for Grep, so it can't be assigned for user tools
-        (Name : 'Shift+F~2~'   ; KeyCode : kbShiftF2 ), }
+{        (Name : 'Shift+F~2~'   ; KeyCode : kbShiftF2 ), }
         (Name : 'Shift+F~3~'   ; KeyCode : kbShiftF3 ),
         (Name : 'Shift+F~4~'   ; KeyCode : kbShiftF4 ),
         (Name : 'Shift+F~5~'   ; KeyCode : kbShiftF5 ),
@@ -115,20 +161,20 @@ const
         (Name : 'Shift+F~9~'   ; KeyCode : kbShiftF9 ),
         (Name : 'Shift+F~1~0'  ; KeyCode : kbShiftF10));
 
-     Tools : PToolCollection = nil;
+     Tools     : PToolCollection = nil;
 
-function GetHotKeyCount: Sw_integer;
+function GetHotKeyCount: integer;
 begin
   GetHotKeyCount:=ord(High(HotKeys))-ord(Low(HotKeys))+1;
 end;
 
-function GetHotKeyNameByIdx(Idx: Sw_integer): string;
+function GetHotKeyNameByIdx(Idx: integer): string;
 begin
   GetHotKeyNameByIdx:=HotKeys[Idx].Name;
 end;
 
-function HotKeyToIdx(Key: word): Sw_integer;
-var Count,I: Sw_integer;
+function HotKeyToIdx(Key: word): integer;
+var Count,I: integer;
     Found: boolean;
 begin
   Count:=GetHotKeyCount; Found:=false;
@@ -143,8 +189,8 @@ begin
   HotKeyToIdx:=I;
 end;
 
-function IdxToHotKey(Idx: Sw_integer): word;
-var Count: Sw_integer;
+function IdxToHotKey(Idx: integer): word;
+var Count: integer;
     Key: word;
 begin
   Count:=GetHotKeyCount;
@@ -156,7 +202,7 @@ begin
 end;
 
 function GetHotKeyName(Key: word): string;
-var Idx: Sw_integer;
+var Idx: integer;
     S: string;
 begin
   Idx:=HotKeyToIdx(Key);
@@ -222,15 +268,15 @@ begin
   New(Tools, Init(10,20));
 end;
 
-function  GetToolCount: Sw_integer;
-var Count: Sw_integer;
+function  GetToolCount: sw_integer;
+var Count: integer;
 begin
   if Tools=nil then Count:=0 else
     Count:=Tools^.Count;
   GetToolCount:=Count;
 end;
 
-function GetToolName(Idx: Sw_integer): string;
+function GetToolName(Idx: sw_integer): string;
 var S1,S2: string;
     W: word;
 begin
@@ -238,7 +284,7 @@ begin
   GetToolName:=KillTilde(S1);
 end;
 
-function AddTool(Title, ProgramPath, Params: string; HotKey: word): Sw_integer;
+function AddTool(Title, ProgramPath, Params: string; HotKey: word): sw_integer;
 var P: PTool;
 begin
   if Tools=nil then InitTools;
@@ -247,14 +293,14 @@ begin
   AddTool:=Tools^.IndexOf(P);
 end;
 
-procedure GetToolParams(Idx: Sw_integer; var Title, ProgramPath, Params: string; var HotKey: word);
+procedure GetToolParams(Idx: sw_integer; var Title, ProgramPath, Params: string; var HotKey: word);
 var P: PTool;
 begin
   P:=Tools^.At(Idx);
   P^.GetParams(Title,ProgramPath,Params,HotKey);
 end;
 
-procedure SetToolParams(Idx: Sw_integer; Title, ProgramPath, Params: string; HotKey: word);
+procedure SetToolParams(Idx: sw_integer; Title, ProgramPath, Params: string; HotKey: word);
 var P: PTool;
 begin
   P:=Tools^.At(Idx);
@@ -283,7 +329,7 @@ end;
 constructor TToolItemDialog.Init(ATool: PTool);
 var R,R2,R3: TRect;
     Items: PSItem;
-    I,KeyCount: Sw_integer;
+    I,KeyCount: sw_integer;
 begin
   KeyCount:=GetHotKeyCount;
 
@@ -473,12 +519,39 @@ begin
   ReDraw;
 end;
 
+procedure ReplaceStr(var S: string; const What,NewS: string);
+var I : integer;
+begin
+  repeat
+    I:=Pos(What,S);
+    if I>0 then
+    begin
+      Delete(S,I,length(What));
+      Insert(NewS,S,I);
+    end;
+  until I=0;
+end;
 
-function ParseToolParams(var Params: string; CheckOnly: boolean): Sw_integer;
+procedure ReplaceStrI(var S: string; What: string; const NewS: string);
+var I : integer;
+    UpcaseS: string;
+begin
+  UpcaseS:=UpcaseStr(S); What:=UpcaseStr(What);
+  repeat
+    I:=Pos(What,UpcaseS);
+    if I>0 then
+    begin
+      Delete(S,I,length(What));
+      Insert(NewS,S,I);
+    end;
+  until I=0;
+end;
+
+function ParseToolParams(var Params: string; CheckOnly: boolean): integer;
 var Err: integer;
     W: PSourceWindow;
-procedure ParseParams(Pass: integer);
-var I: Sw_integer;
+procedure ParseParams(Pass: sw_integer);
+var I: sw_integer;
 function IsAlpha(Ch: char): boolean;
 begin
   IsAlpha:=(Upcase(Ch) in['A'..'Z','_','$']);
@@ -512,7 +585,7 @@ begin
 end;
 var C,PrevC: char;
     WordS: string;
-    LastWordStart: Sw_integer;
+    LastWordStart: sw_integer;
     L: longint;
     S: string;
     D: DirStr; N: NameStr; E: ExtStr;
@@ -532,6 +605,31 @@ begin
       begin
         WordS:=UpcaseStr(Trim(WordS));
         if WordS<>'' then
+        if (WordS='$CAP') then
+          begin
+            if (Pass=0) then
+              if (Params[I]=' ') and (I<=255) then Params[I]:='_';
+          end else
+        if (WordS='$CAP_MSG') then
+          begin
+            if (Pass=2) then
+              if Consume('(')=false then Err:=I else
+              if ReadTill(S,')')=false then Err:=I else
+              begin
+                Consume(')');
+                I:=I+ReplacePart(LastWordStart,I-1,'');
+                ToolFilter:=S;
+                CaptureToolTo:=capMessageWindow;
+              end;
+          end else
+        if (WordS='$CAP_EDIT') then
+          begin
+            if (Pass=2) then
+              begin
+                I:=I+ReplacePart(LastWordStart,I-1,'');
+                CaptureToolTo:=capEditWindow;
+              end;
+          end else
         if (WordS='$COL') then
           begin
             if (Pass=1) then
@@ -633,24 +731,47 @@ begin
               I:=I+ReplacePart(LastWordStart,I-1,'');
             end;
           end else
+        if (WordS='$DRIVE') then
+          begin
+            if (Pass=2) then
+              if Consume('(')=false then Err:=I else
+              if ReadTill(S,')')=false then Err:=I else
+              begin
+                Consume(')');
+                FSplit(S,D,N,E);
+                L:=Pos(':',D); if L=0 then L:=-1;
+                D:=copy(D,1,L+1);
+                I:=I+ReplacePart(LastWordStart,I-1,D);
+              end;
+          end else
         if (WordS='$PROMPT') then
           begin
             if (Pass=3) then
-              begin
-                I:=I+ReplacePart(LastWordStart,I-1,'');
-                if CheckOnly=false then
+              if Params[I]='(' then
+                begin
+                  if Consume('(')=false then Err:=I else
+                  if ReadTill(S,')')=false then Err:=I else
                   begin
-                    S:=copy(Params,I+1,255);
-                    if InputBox('Program Arguments', '~E~nter program argument',
-                      S,255-I+1)=cmOK then
-                      begin
-                        ReplacePart(LastWordStart,255,S);
-                        I:=255;
-                      end
-                    else
-                      Err:=-1;
+                    Consume(')');
+
                   end;
-              end;
+                end
+              else { just prompt for parms }
+                begin
+                  I:=I+ReplacePart(LastWordStart,I-1,'');
+                  if CheckOnly=false then
+                    begin
+                      S:=copy(Params,I+1,255);
+                      if InputBox('Program Arguments', '~E~nter program argument',
+                        S,255-I+1)=cmOK then
+                        begin
+                          ReplacePart(LastWordStart,255,S);
+                          I:=255;
+                        end
+                      else
+                        Err:=-1;
+                    end;
+                end;
           end else
         if (WordS='$SAVE') then
           begin
@@ -691,8 +812,10 @@ begin
     Inc(I);
   end;
 end;
-var Pass: Sw_integer;
+var Pass: sw_integer;
 begin
+  CaptureToolTo:=capNone;
+  ToolFilter:='';
   W:=FirstEditorWindow;
   Err:=0;
   for Pass:=0 to 3 do
@@ -703,10 +826,225 @@ begin
   ParseToolParams:=Err;
 end;
 
+function ProcessMessageFile(const MsgFileName: string): boolean;
+var OK,Done: boolean;
+    S: PBufStream;
+    C: char;
+    Sign: array[1..10] of char;
+    InFileName,InReference: boolean;
+    AddChar: boolean;
+    FileName,Line: string;
+    Row,Col: longint;
+procedure AddLine;
+begin
+  Row:=ord(Line[1])+ord(Line[2]) shl 8;
+  Col:=ord(Line[3])+ord(Line[4]) shl 8;
+  AddToolMessage(FileName,copy(Line,5,255),Row,Col);
+end;
+begin
+  New(S, Init(MsgFileName, stOpenRead, 4096));
+  OK:=(S<>nil) and (S^.Status=stOK);
+  if OK then S^.Read(Sign,SizeOf(Sign));
+  OK:=OK and (Sign=MsgFilterSign);
+  Done:=false; InFileName:=false; InReference:=false;
+  while OK and (Done=false) do
+    begin
+      S^.Read(C,SizeOf(C));
+      OK:=(S^.Status=stOK);
+      AddChar:=false;
+      if OK then
+      case C of
+        #0   : if InFileName then
+                 begin InFileName:=false end else
+               if InReference then
+                 begin
+                   if (length(Line)>4) then
+                     begin
+                       AddLine;
+                       InReference:=false;
+                     end
+                   else
+                     AddChar:=true;
+                 end else
+               begin InFileName:=true; FileName:=''; end;
+        #1   : if InReference then AddChar:=true else
+                 begin InReference:=true; Line:=''; end;
+        #127 : if InReference then AddChar:=true else
+                 Done:=true;
+      else AddChar:=true;
+      end;
+      if AddChar then
+        if InFileName then
+          FileName:=FileName+C else
+        if InReference then
+          Line:=Line+C;
+    end;
+  if S<>nil then Dispose(S, Done);
+  ProcessMessageFile:=OK;
+end;
+
+constructor TToolMessage.Init(AModule: PString; ALine: string; ARow, ACol: sw_integer);
+begin
+  inherited Init(0,ALine,AModule,ARow,ACol);
+end;
+
+function TToolMessage.GetText(MaxLen: Sw_integer): string;
+var S: string;
+begin
+  if Module=nil then
+    S:=GetStr(Text)
+  else
+    S:=NameAndExtOf(GetModuleName)+
+       '('+IntToStr(Row)+'): '+GetStr(Text);
+  GetText:=copy(S,1,MaxLen);
+end;
+
+procedure AddToolCommand(Command: string);
+begin
+  AddToolMessage('',Command,0,0);
+  LastToolMessageFocused:=ToolMessages^.At(ToolMessages^.Count-1);
+end;
+
+procedure AddToolMessage(ModuleName, Text: string; Row, Col: longint);
+var MN: PString;
+begin
+  if ToolMessages=nil then
+    New(ToolMessages, Init(500,1000));
+  if ToolModuleNames=nil then
+    New(ToolModuleNames, Init(50,100));
+  MN:=ToolModuleNames^.Add(ModuleName);
+  ToolMessages^.Insert(New(PToolMessage, Init(MN,Text,Row,Col)));
+end;
+
+procedure ClearToolMessages;
+begin
+  if ToolMessages<>nil then Dispose(ToolMessages,Done); ToolMessages:=nil;
+  if ToolModuleNames<>nil then Dispose(ToolModuleNames, Done); ToolModuleNames:=nil;
+  LastToolMessageFocused:=nil;
+end;
+
+procedure UpdateToolMessages;
+begin
+  if Assigned(MessagesWindow) then
+    MessagesWindow^.Update;
+end;
+
+procedure TToolMessageListBox.Update;
+var P: PMessageItem;
+    Idx: integer;
+begin
+  P:=LastToolMessageFocused;
+  NewList(ToolMessages);
+  if (Range>0) and (P<>nil) then
+    begin
+      Idx:=List^.IndexOf(P);
+      if Idx>=0 then
+        begin
+          FocusItem(Idx);
+          DrawView;
+        end;
+    end;
+  DrawView;
+end;
+
+procedure TToolMessageListBox.NewList(AList: PCollection);
+begin
+  if (List=ToolMessages) or (ToolMessages=nil) then
+    begin List:=nil; SetRange(0); end;
+  inherited NewList(AList);
+end;
+
+procedure TToolMessageListBox.Clear;
+begin
+  ClearToolMessages;
+  Update;
+end;
+
+function TToolMessageListBox.GetPalette: PPalette;
+const
+  P: string[length(CBrowserListBox)] = CBrowserListBox;
+begin
+  GetPalette:=@P;
+end;
+
+destructor TToolMessageListBox.Done;
+begin
+  HScrollBar:=nil; VScrollBar:=nil;
+  if List=ToolMessages then begin List:=nil; SetRange(0); end;
+  inherited Done;
+end;
+
+constructor TMessagesWindow.Init;
+var R: TRect;
+    HSB,VSB: PScrollBar;
+begin
+  Desktop^.GetExtent(R); R.A.Y:=R.B.Y-7;
+  inherited Init(R,'Messages',SearchFreeWindowNo);
+  HelpCtx:=hcMessagesWindow;
+
+  HSB:=StandardScrollBar(sbHorizontal+sbHandleKeyboard); Insert(HSB);
+  VSB:=StandardScrollBar(sbVertical+sbHandleKeyboard); Insert(VSB);
+
+  GetExtent(R); R.Grow(-1,-1);
+  New(MsgLB, Init(R, HSB, VSB));
+  Insert(MsgLB);
+
+  Update;
+
+  MessagesWindow:=@Self;
+end;
+
+procedure TMessagesWindow.Update;
+begin
+  MsgLB^.Update;
+end;
+
+procedure TMessagesWindow.HandleEvent(var Event: TEvent);
+begin
+  case Event.What of
+    evBroadcast :
+      case Event.Command of
+        cmListFocusChanged :
+          if Event.InfoPtr=MsgLB then
+            LastToolMessageFocused:=MsgLB^.List^.At(MsgLB^.Focused);
+      end;
+  end;
+  inherited HandleEvent(Event);
+end;
+
+function TMessagesWindow.GetPalette: PPalette;
+const S: string[length(CBrowserWindow)] = CBrowserWindow;
+begin
+  GetPalette:=@S;
+end;
+
+destructor TMessagesWindow.Done;
+begin
+  MessagesWindow:=nil;
+  inherited Done;
+end;
+
 END.
 {
   $Log$
-  Revision 1.3  1999-02-22 02:15:19  peter
+  Revision 1.4  1999-03-01 15:42:04  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
+    * efBackSpaceUnindents works correctly
+    + 'Messages' window implemented
+    + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
+    + Added TP message-filter support (for ex. you can call GREP thru
+      GREP2MSG and view the result in the messages window - just like in TP)
+    * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
+      so topic search didn't work...
+    * In FPHELP.PAS there were still context-variables defined as word instead
+      of THelpCtx
+    * StdStatusKeys() was missing from the statusdef for help windows
+    + Topic-title for index-table can be specified when adding a HTML-files
+
+  Revision 1.3  1999/02/22 02:15:19  peter
     + default extension for save in the editor
     + Separate Text to Find for the grep dialog
     * fixed redir crash with tp7

+ 75 - 64
ide/text/fputils.pas

@@ -49,12 +49,12 @@ function MakeExeName(const fn:string):string;
 function LExpand(S: string; MinLen: byte): string;
 function RExpand(S: string; MinLen: byte): string;
 function FitStr(const S: string; Len: byte): string;
-function LTrim(const S: string): string;
-function RTrim(const S: string): string;
-function Trim(const S: string): string;
+function LTrim(S: string): string;
+function RTrim(S: string): string;
+function Trim(S: string): string;
 function KillTilde(S: string): string;
-function UpcaseStr(const S: string): string;
-function LowerCaseStr(const S: string): string;
+function UpcaseStr(S: string): string;
+function LowerCaseStr(S: string): string;
 function Max(A,B: longint): longint;
 function Min(A,B: longint): longint;
 function DirOf(const S: string): string;
@@ -65,7 +65,7 @@ function StrToExtended(S: string): Extended;
 function Power(const A,B: double): double;
 function GetCurDir: string;
 function MatchesMask(What, Mask: string): boolean;
-function MatchesMaskList(const What:string;MaskList: string): boolean;
+function MatchesMaskList(What, MaskList: string): boolean;
 function MatchesFileList(What, FileList: string): boolean;
 function EatIO: integer;
 function ExistsFile(const FileName: string): boolean;
@@ -73,7 +73,8 @@ function CompleteDir(const Path: string): string;
 function LocateFile(FileList: string): string;
 function LocatePasFile(const FileName:string):string;
 function LocateExeFile(var FileName:string): boolean;
-function GetStr(P: PString): string;
+function EraseFile(FileName: string): boolean;
+function GetStr(const P: PString): string;
 procedure ReplaceStr(var S: string; const What,NewS: string);
 procedure ReplaceStrI(var S: string; What: string; const NewS: string);
 
@@ -225,28 +226,20 @@ begin
   KillTilde:=S;
 end;
 
-function UpcaseStr(const S: string): string;
-var
-  i  : Sw_word;
+function UpcaseStr(S: string): string;
+var I: Longint;
 begin
-  for i:=1 to length(s) do
-   if s[i] in ['a'..'z'] then
-    UpcaseStr[i]:=char(byte(s[i])-32)
-   else
-    UpcaseStr[i]:=s[i];
-  UpcaseStr[0]:=s[0];
+  for I:=1 to length(S) do
+      S[I]:=Upcase(S[I]);
+  UpcaseStr:=S;
 end;
 
-function LowercaseStr(const S: string): string;
-var
-  i  : Sw_word;
+function LowerCaseStr(S: string): string;
+var I: byte;
 begin
-  for i:=1 to length(s) do
-   if s[i] in ['A'..'Z'] then
-    LowercaseStr[i]:=char(byte(s[i])+32)
-   else
-    LowercaseStr[i]:=s[i];
-  LowercaseStr[0]:=s[0];
+  for I:=1 to length(S) do
+    if S[I] in ['A'..'Z'] then S[I]:=chr(ord(S[I])+32);
+  LowerCaseStr:=S;
 end;
 
 function Max(A,B: longint): longint;
@@ -314,7 +307,6 @@ begin
   GetCurDir:=S;
 end;
 
-
 function IntToHex(L: longint): string;
 const HexNums : string[16] = '0123456789ABCDEF';
 var S: string;
@@ -337,7 +329,6 @@ begin
   IntToHex:=S;
 end;
 
-
 function HexToInt(S: string): longint;
 var L,I: longint;
     C: char;
@@ -356,7 +347,6 @@ begin
   HexToInt:=L;
 end;
 
-
 function IntToHexL(L: longint; MinLen: byte): string;
 var S: string;
 begin
@@ -365,33 +355,23 @@ begin
   IntToHexL:=S;
 end;
 
-function LTrim(const S: string): string;
-var
-  i : Sw_integer;
+function LTrim(S: string): string;
 begin
-  i:=1;
-  while (i<length(S)) and (S[i]=' ') do
-   inc(i);
-  LTrim:=Copy(S,i,255);
+  while copy(S,1,1)=' ' do Delete(S,1,1);
+  LTrim:=S;
 end;
 
-
-Function RTrim(const S:string):string;
-var
-  i : Sw_integer;
+function RTrim(S: string): string;
 begin
-  i:=length(S);
-  while (i>0) and (S[i]=' ') do
-   dec(i);
-  RTrim:=Copy(S,1,i);
+  while copy(S,length(S),1)=' ' do Delete(S,length(S),1);
+  RTrim:=S;
 end;
 
-function Trim(const S: string): string;
+function Trim(S: string): string;
 begin
   Trim:=RTrim(LTrim(S));
 end;
 
-
 function MatchesMask(What, Mask: string): boolean;
 var P: integer;
     Match: boolean;
@@ -411,7 +391,7 @@ begin
   MatchesMask:=Match;
 end;
 
-function MatchesMaskList(const What:string;MaskList: string): boolean;
+function MatchesMaskList(What, MaskList: string): boolean;
 var P: integer;
     Match: boolean;
 begin
@@ -538,26 +518,41 @@ begin
     end;
 
   S:=GetEnv('PATH');
-  repeat
-    i:=0;
-    While (i<=Length(S)) and not (S[i] in ListSep) do
-     Inc(i);
-    Dir:=CompleteDir(Copy(S,1,i-1));
-    Delete(S,1,i);
-    if ExistsFile(Dir+FileName) then
-     Begin
-       FileName:=Dir+FileName;
-       LocateExeFile:=true;
-       Exit;
-     End;
-  until s='';
-end;
-
-function GetStr(P: PString): string;
+  While Length(S)>0 do
+    begin
+      i:=1;
+      While (i<=Length(S)) and not (S[i] in ListSep) do
+        Inc(i);
+      Dir:=CompleteDir(Copy(S,1,i-1));
+      if i<Length(S) then
+        Delete(S,1,i)
+      else
+        S:='';
+      if ExistsFile(Dir+FileName) then
+        Begin
+           FileName:=Dir+FileName;
+           LocateExeFile:=true;
+           Exit;
+        End;
+   end;
+end;
+
+function GetStr(const P: PString): string;
 begin
   if P=nil then GetStr:='' else GetStr:=P^;
 end;
 
+function EraseFile(FileName: string): boolean;
+var f: file;
+begin
+  if FileName='' then Exit;
+  {$I-}
+  Assign(f,FileName);
+  Erase(f);
+  {$I+}
+  EraseFile:=(EatIO=0);
+end;
+
 procedure ReplaceStr(var S: string; const What,NewS: string);
 var I : Sw_integer;
 begin
@@ -587,11 +582,27 @@ begin
 end;
 
 
-
 END.
 {
   $Log$
-  Revision 1.8  1999-02-22 02:15:20  peter
+  Revision 1.9  1999-03-01 15:42:06  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
+    * efBackSpaceUnindents works correctly
+    + 'Messages' window implemented
+    + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
+    + Added TP message-filter support (for ex. you can call GREP thru
+      GREP2MSG and view the result in the messages window - just like in TP)
+    * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
+      so topic search didn't work...
+    * In FPHELP.PAS there were still context-variables defined as word instead
+      of THelpCtx
+    * StdStatusKeys() was missing from the statusdef for help windows
+    + Topic-title for index-table can be specified when adding a HTML-files
+
+  Revision 1.8  1999/02/22 02:15:20  peter
     + default extension for save in the editor
     + Separate Text to Find for the grep dialog
     * fixed redir crash with tp7

+ 21 - 2
ide/text/fpvars.pas

@@ -18,6 +18,7 @@ unit FPVars;
 interface
 
 uses Objects,Views,App,
+     WUtils,
      FPConst,FPUtils,FPViews,FPCalc;
 
 type
@@ -44,7 +45,7 @@ const ClipboardWindow  : PClipboardWindow = nil;
       ProgramInfoWindow: PProgramInfoWindow = nil;
       GDBWindow        : PGDBWindow = nil;
       UserScreenWindow : PScreenWindow = nil;
-      HelpFiles        : FPViews.PUnsortedStringCollection = nil;
+      HelpFiles        : WUtils.PUnsortedStringCollection = nil;
       ShowStatusOnError: boolean = true;
       StartupDir       : string = '.'+DirSep;
       INIPath          : string = ININame;
@@ -53,6 +54,7 @@ const ClipboardWindow  : PClipboardWindow = nil;
       AltMouseAction   : integer = acBrowseSymbol;
       StartupOptions   : longint = 0;
       LastExitCode     : integer = 0;
+      ASCIIChart       : PFPASCIIChart = nil;
 
       ActionCommands   : array[acFirstAction..acLastAction] of word =
         (cmHelpTopicSearch,cmGotoCursor,cmToggleBreakpoint,
@@ -67,7 +69,24 @@ implementation
 END.
 {
   $Log$
-  Revision 1.9  1999-02-19 18:43:48  peter
+  Revision 1.10  1999-03-01 15:42:07  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
+    * efBackSpaceUnindents works correctly
+    + 'Messages' window implemented
+    + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
+    + Added TP message-filter support (for ex. you can call GREP thru
+      GREP2MSG and view the result in the messages window - just like in TP)
+    * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
+      so topic search didn't work...
+    * In FPHELP.PAS there were still context-variables defined as word instead
+      of THelpCtx
+    * StdStatusKeys() was missing from the statusdef for help windows
+    + Topic-title for index-table can be specified when adding a HTML-files
+
+  Revision 1.9  1999/02/19 18:43:48  peter
     + open dialog supports mask list
 
   Revision 1.8  1999/02/11 13:10:04  pierre

File diff suppressed because it is too large
+ 280 - 1401
ide/text/fpviews.pas


+ 3 - 2
ide/text/test.pas

@@ -1,9 +1,10 @@
-program TestProgram;
+program                TestProgram;
 
 uses Test2;
 
 const A =  1234;
       B =  $1234;
+      C =  #1#2#3#4;
       ConstBool1 = true;
       ConstBool2 = boolean(5);
       ConstChar = 'A';
@@ -23,7 +24,7 @@ type
       end;
 
       TObj2 = object(TObj)
-        procedure   Proc; virtual;
+        procedure Proc; virtual;
       end;
 
       TClass = class

File diff suppressed because it is too large
+ 420 - 272
ide/text/weditor.pas


+ 106 - 156
ide/text/whelp.pas

@@ -74,7 +74,7 @@ type
       THLPFileHeader = packed record
         Options         : word;
         MainIndexScreen : word;
-        Maxscreensize   : word;
+        MaxScreenSize   : word;
         Height          : byte;
         Width           : byte;
         LeftMargin      : byte;
@@ -130,29 +130,24 @@ type
       TKeywordDescriptors = array[0..10900] of TKeywordDescriptor;
 
       PTopic = ^TTopic;
-      TTopic = packed record
+      TTopic = object
         HelpCtx       : THelpCtx;
         FileOfs       : longint;
         TextSize      : word;
         Text          : PByteArray;
         LinkCount     : word;
-        LinkSize      : word;
         Links         : PKeywordDescriptors;
         LastAccess    : longint;
         FileID        : word;
         Param         : PString;
-      end;
-
-      PUnsortedStringCollection = ^TUnsortedStringCollection;
-      TUnsortedStringCollection = object(TCollection)
-        function   At(Index: Sw_Integer): PString;
-        procedure FreeItem(Item: Pointer); virtual;
+        function LinkSize: word;
       end;
 
       PTopicCollection = ^TTopicCollection;
-      TTopicCollection = object(TCollection)
-        function   At(Index: Sw_Integer): PTopic;
+      TTopicCollection = object(TSortedCollection)
+        function   At(Index: sw_Integer): PTopic;
         procedure  FreeItem(Item: Pointer); virtual;
+        function   Compare(Key1, Key2: Pointer): Sw_Integer; virtual;
         function   SearchTopic(AHelpCtx: THelpCtx): PTopic;
       end;
 
@@ -189,7 +184,7 @@ type
       public
         function    LoadIndex: boolean; virtual;
         function    ReadTopic(T: PTopic): boolean; virtual;
-      private
+      public { protected }
         F: PBufStream;
         TopicsRead     : boolean;
         IndexTableRead : boolean;
@@ -210,12 +205,12 @@ type
       PHelpFacility = ^THelpFacility;
       THelpFacility = object(TObject)
         HelpFiles: PHelpFileCollection;
-        IndexTabSize: Sw_integer;
+        IndexTabSize: sw_integer;
         constructor Init;
         function    AddOAHelpFile(FileName: string): boolean;
         function    AddHTMLHelpFile(FileName, TOCEntry: string): boolean;
         function    LoadTopic(SourceFileID: word; Context: THelpCtx): PTopic; virtual;
-        function    TopicSearch(Keyword: string; var FileID: word; Context: THelpCtx): boolean; virtual;
+        function    TopicSearch(Keyword: string; var FileID: word; var Context: THelpCtx): boolean; virtual;
         function    BuildIndexTopic: PTopic; virtual;
         destructor  Done; virtual;
       private
@@ -226,8 +221,8 @@ type
         function  AddFile(H: PHelpFile): boolean;
       end;
 
-const TopicCacheSize    : Sw_integer = 10;
-      HelpStreamBufSize : Sw_integer = 4096;
+const TopicCacheSize    : sw_integer = 10;
+      HelpStreamBufSize : sw_integer = 4096;
       HelpFacility      : PHelpFacility = nil;
       MaxHelpTopicSize  : word = 65520;
 
@@ -241,36 +236,9 @@ implementation
 
 uses
   Dos,
-  WHTMLHlp,
+  WUtils,WHTMLHlp,
   Drivers;
 
-type
-     PByteArray = ^TByteArray;
-     TByteArray = array[0..65520] of byte;
-
-function CharStr(C: char; Count: byte): string;
-var S: string;
-begin
-  S[0]:=chr(Count);
-  FillChar(S[1],Count,C);
-  CharStr:=S;
-end;
-
-function RExpand(S: string; MinLen: byte): string;
-begin
-  if length(S)<MinLen then
-     S:=S+CharStr(' ',MinLen-length(S));
-  RExpand:=S;
-end;
-
-function UpcaseStr(S: string): string;
-var I: Sw_integer;
-begin
-  for I:=1 to length(S) do
-      S[I]:=Upcase(S[I]);
-  UpcaseStr:=S;
-end;
-
 procedure DisposeRecord(var R: TRecord);
 begin
   with R do
@@ -318,11 +286,8 @@ end;
 function NewIndexEntry(Tag: string; FileID: word; HelpCtx: THelpCtx): PIndexEntry;
 var P: PIndexEntry;
 begin
-  New(P);
-  FillChar(P^,SizeOf(P^), 0);
-  P^.Tag:=NewStr(Tag);
-  P^.FileID:=FileID;
-  P^.HelpCtx:=HelpCtx;
+  New(P); FillChar(P^,SizeOf(P^), 0);
+  P^.Tag:=NewStr(Tag); P^.FileID:=FileID; P^.HelpCtx:=HelpCtx;
   NewIndexEntry:=P;
 end;
 
@@ -335,17 +300,12 @@ begin
   end;
 end;
 
-function TUnsortedStringCollection.At(Index: Sw_Integer): PString;
+function TTopic.LinkSize: word;
 begin
-  At:=inherited At(Index);
-end;
-
-procedure TUnsortedStringCollection.FreeItem(Item: Pointer);
-begin
-  if Item<>nil then DisposeStr(Item);
+  LinkSize:=LinkCount*SizeOf(Links^[0]);
 end;
 
-function TTopicCollection.At(Index: Sw_Integer): PTopic;
+function TTopicCollection.At(Index: sw_Integer): PTopic;
 begin
   At:=inherited At(Index);
 end;
@@ -355,11 +315,28 @@ begin
   if Item<>nil then DisposeTopic(Item);
 end;
 
+function TTopicCollection.Compare(Key1, Key2: Pointer): Sw_Integer;
+var K1: PTopic absolute Key1;
+    K2: PTopic absolute Key2;
+    R: Sw_integer;
+begin
+  if K1^.HelpCtx<K2^.HelpCtx then R:=-1 else
+  if K1^.HelpCtx>K2^.HelpCtx then R:= 1 else
+  R:=0;
+  Compare:=R;
+end;
+
 function TTopicCollection.SearchTopic(AHelpCtx: THelpCtx): PTopic;
-function Match(P: PTopic): boolean;{$ifndef FPC}far;{$endif}
-begin Match:=(P^.HelpCtx=AHelpCtx); end;
+var T: TTopic;
+    P: PTopic;
+    Index: sw_integer;
 begin
-  SearchTopic:=FirstThat(@Match);
+  T.HelpCtx:=AHelpCtx;
+  if Search(@T,Index) then
+    P:=At(Index)
+  else
+    P:=nil;
+  SearchTopic:=P;
 end;
 
 function TIndexEntryCollection.At(Index: Sw_Integer): PIndexEntry;
@@ -412,7 +389,6 @@ end;
 function THelpFile.LoadIndex: boolean;
 begin
   Abstract;
-  LoadIndex:=false;
 end;
 
 function THelpFile.SearchTopic(HelpCtx: THelpCtx): PTopic;
@@ -425,11 +401,10 @@ end;
 function THelpFile.ReadTopic(T: PTopic): boolean;
 begin
   Abstract;
-  ReadTopic:=false;
 end;
 
 procedure THelpFile.MaintainTopicCache;
-var Count: Sw_integer;
+var Count: sw_integer;
     MinP: PTopic;
     MinLRU: longint;
 procedure CountThem(P: PTopic); {$ifndef FPC}far;{$endif}
@@ -445,7 +420,7 @@ begin
     if P<>nil then
     begin
       FreeMem(P^.Text,P^.TextSize); P^.TextSize:=0; P^.Text:=nil;
-      FreeMem(P^.Links,P^.LinkSize); P^.LinkSize:=0; P^.LinkCount:=0; P^.Links:=nil;
+      FreeMem(P^.Links,P^.LinkSize); P^.LinkCount:=0; P^.Links:=nil;
     end;
   end;
 end;
@@ -466,14 +441,7 @@ begin
   New(F, Init(AFileName, stOpenRead, HelpStreamBufSize));
   OK:=F<>nil;
   if OK then OK:=(F^.Status=stOK);
-  if OK then
-    begin
-{$ifdef FPC}
-      F^.TPCompatible:=true;
-{$endif}
-      FS:=F^.GetSize;
-      OK:=ReadHeader;
-    end;
+  if OK then begin FS:=F^.GetSize; OK:=ReadHeader; end;
   while OK do
   begin
     L:=F^.GetPos;
@@ -570,10 +538,8 @@ begin
   for I:=0 to IndexCount-1 do
   begin
     LenCode:=PByteArray(@Entries)^[CurPtr];
-    AddLen:=LenCode and $1f;
-    CopyCnt:=LenCode shr 5;
-    S[0]:=chr(AddLen);
-    Move(PByteArray(@Entries)^[CurPtr+1],S[1],AddLen);
+    AddLen:=LenCode and $1f; CopyCnt:=LenCode shr 5;
+    S[0]:=chr(AddLen); Move(PByteArray(@Entries)^[CurPtr+1],S[1],AddLen);
     LastTag:=copy(LastTag,1,CopyCnt)+S;
     Move(PByteArray(@Entries)^[CurPtr+1+AddLen],HelpCtx,2);
     IndexEntries^.Insert(NewIndexEntry(LastTag,ID,HelpCtx));
@@ -654,7 +620,7 @@ begin
   case N of
     $00       : C:=#0;
     $01..$0D  : C:=chr(Compression.CharTable[N]);
-    ncRawChar : C:=chr(GetNextNibble+GetNextNibble shl 4);
+    ncRawChar : C:=chr(GetNextNibble*16+GetNextNibble);
     ncRepChar : begin
                   Cnt:=2+GetNextNibble;
                   C:=GetNextChar{$ifdef FPC}(){$endif};
@@ -715,8 +681,7 @@ begin
       with THLPKeywordRecord(KeyWR.Data^) do
       begin
         T^.LinkCount:=KeywordCount;
-        W:=T^.LinkCount*SizeOf(T^.Links^[0]);
-        T^.LinkSize:=W; GetMem(T^.Links,T^.LinkSize);
+        GetMem(T^.Links,T^.LinkSize);
         if KeywordCount>0 then
         for I:=0 to KeywordCount-1 do
         begin
@@ -803,7 +768,7 @@ begin
   LoadTopic:=P;
 end;
 
-function THelpFacility.TopicSearch(Keyword: string; var FileID: word; Context: THelpCtx): boolean;
+function THelpFacility.TopicSearch(Keyword: string; var FileID: word; var Context: THelpCtx): boolean;
 function ScanHelpFile(H: PHelpFile): boolean; {$ifndef FPC}far;{$endif}
 function Search(P: PIndexEntry): boolean; {$ifndef FPC}far;{$endif}
 begin
@@ -821,72 +786,50 @@ begin
   TopicSearch:=HelpFiles^.FirstThat(@ScanHelpFile)<>nil;
 end;
 
-
 function THelpFacility.BuildIndexTopic: PTopic;
-var
-  T        : PTopic;
-  Keywords : PIndexEntryCollection;
-  Lines    : PUnsortedStringCollection;
-
-  procedure InsertKeywordsOfFile(H: PHelpFile); {$ifndef FPC}far;{$endif}
-
-    function InsertKeywords(P: PIndexEntry): boolean; {$ifndef FPC}far;{$endif}
-    begin
-      Keywords^.Insert(P);
-      InsertKeywords:=Keywords^.Count>=MaxCollectionSize;
-    end;
-
-  begin
-    H^.LoadIndex;
-    if Keywords^.Count<MaxCollectionSize then
-      H^.IndexEntries^.FirstThat(@InsertKeywords);
-  end;
-
-  procedure AddLine(S: string);
-  begin
-    if S='' then S:=' ';
-    Lines^.Insert(NewStr(S));
-  end;
-
+var T: PTopic;
+    Keywords: PIndexEntryCollection;
+    Lines: PUnsortedStringCollection;
+procedure InsertKeywordsOfFile(H: PHelpFile); {$ifndef FPC}far;{$endif}
+function InsertKeywords(P: PIndexEntry): boolean; {$ifndef FPC}far;{$endif}
+begin
+  Keywords^.Insert(P);
+  InsertKeywords:=Keywords^.Count>=MaxCollectionSize;
+end;
+begin
+  H^.LoadIndex;
+  if Keywords^.Count<MaxCollectionSize then
+  H^.IndexEntries^.FirstThat(@InsertKeywords);
+end;
+procedure AddLine(S: string);
+begin
+  if S='' then S:=' ';
+  Lines^.Insert(NewStr(S));
+end;
 procedure RenderTopic;
-var
-  Size,CurPtr,I: word;
-  S: string;
-
-  function CountSize(P: PString): boolean; {$ifndef FPC}far;{$endif}
-  begin
-    Inc(Size, length(P^)+1);
-    CountSize:=Size>65200;
-  end;
-
+var Size,CurPtr,I: word;
+    S: string;
+function CountSize(P: PString): boolean; {$ifndef FPC}far;{$endif} begin Inc(Size, length(P^)+1); CountSize:=Size>65200; end;
 begin
-  Size:=0;
-  Lines^.FirstThat(@CountSize);
-  T^.TextSize:=Size;
-  GetMem(T^.Text,T^.TextSize);
+  Size:=0; Lines^.FirstThat(@CountSize);
+  T^.TextSize:=Size; GetMem(T^.Text,T^.TextSize);
   CurPtr:=0;
   for I:=0 to Lines^.Count-1 do
   begin
     S:=Lines^.At(I)^;
-    Size:=length(S)+1;
-    S[Size]:=hscLineBreak;
+    Size:=length(S)+1; S[Size]:=hscLineBreak;
     Move(S[1],PByteArray(T^.Text)^[CurPtr],Size);
     Inc(CurPtr,Size);
-    if CurPtr>=T^.TextSize then
-     Break;
+    if CurPtr>=T^.TextSize then Break;
   end;
 end;
-
 var Line: string;
 procedure FlushLine;
 begin
   if Line<>'' then AddLine(Line); Line:='';
 end;
-
-var
-  KWCount,NLFlag: Sw_integer;
-  LastFirstChar: char;
-
+var KWCount,NLFlag: sw_integer;
+    LastFirstChar: char;
 procedure NewSection(FirstChar: char);
 begin
   if FirstChar<=#64 then FirstChar:=#32;
@@ -897,7 +840,6 @@ begin
   LastFirstChar:=FirstChar;
   NLFlag:=0;
 end;
-
 procedure AddKeyword(KWS: string);
 begin
   Inc(KWCount); if KWCount=1 then NLFlag:=0;
@@ -912,10 +854,8 @@ begin
           end;
   Inc(NLFlag);
 end;
-
-var
-  KW : PIndexEntry;
-  I  : Sw_integer;
+var KW: PIndexEntry;
+    I: sw_integer;
 begin
   New(Keywords, Init(5000,1000));
   HelpFiles^.ForEach(@InsertKeywordsOfFile);
@@ -925,32 +865,28 @@ begin
     begin
       AddLine('');
       AddLine(' No help files installed.')
-    end
-  else
+    end else
+  begin
+    AddLine(' Help index');
+    KWCount:=0; Line:='';
+    T^.LinkCount:=Keywords^.Count;
+    GetMem(T^.Links,T^.LinkSize);
+
+    for I:=0 to Keywords^.Count-1 do
     begin
-      AddLine(' Help index');
-      KWCount:=0; Line:='';
-      T^.LinkCount:=Keywords^.Count;
-      T^.LinkSize:=T^.LinkCount*SizeOf(T^.Links^[0]);
-      GetMem(T^.Links,T^.LinkSize);
-      for I:=0 to Keywords^.Count-1 do
-       begin
-         KW:=Keywords^.At(I);
-         AddKeyword(KW^.Tag^);
-         T^.Links^[I].Context:=KW^.HelpCtx;
-         T^.Links^[I].FileID:=KW^.FileID;
-       end;
-      FlushLine;
-      AddLine('');
+      KW:=Keywords^.At(I);
+      AddKeyword(KW^.Tag^);
+      T^.Links^[I].Context:=KW^.HelpCtx; T^.Links^[I].FileID:=KW^.FileID;
     end;
+    FlushLine;
+    AddLine('');
+  end;
   RenderTopic;
   Dispose(Lines, Done);
-  Keywords^.DeleteAll;
-  Dispose(Keywords, Done);
+  Keywords^.DeleteAll; Dispose(Keywords, Done);
   BuildIndexTopic:=T;
 end;
 
-
 function THelpFacility.SearchFile(ID: byte): PHelpFile;
 function Match(P: PHelpFile): boolean; {$ifndef FPC}far;{$endif}
 begin
@@ -977,8 +913,22 @@ end;
 END.
 {
   $Log$
-  Revision 1.7  1999-02-22 15:04:31  peter
-    * helpfiles fixed
+  Revision 1.8  1999-03-01 15:42:11  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
+    * efBackSpaceUnindents works correctly
+    + 'Messages' window implemented
+    + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
+    + Added TP message-filter support (for ex. you can call GREP thru
+      GREP2MSG and view the result in the messages window - just like in TP)
+    * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
+      so topic search didn't work...
+    * In FPHELP.PAS there were still context-variables defined as word instead
+      of THelpCtx
+    * StdStatusKeys() was missing from the statusdef for help windows
+    + Topic-title for index-table can be specified when adding a HTML-files
 
   Revision 1.6  1999/02/20 15:18:35  peter
     + ctrl-c capture with confirm dialog

+ 56 - 30
ide/text/whlpview.pas

@@ -24,7 +24,7 @@ uses
 {$else}
   WEditor,
 {$endif}
-  WHelp;
+  WUtils,WHelp;
 
 {$IFNDEF EDITORS}
 type
@@ -38,6 +38,8 @@ const
      CHelpViewer         = #33#34#35#36;
      CHelpFrame          = #37#37#38#38#39;
 
+     cmHelpFilesChanged  = 57340;
+
 type
       PHelpLink = ^THelpLink;
       THelpLink = record
@@ -166,10 +168,13 @@ type
 
       PHelpWindow = ^THelpWindow;
       THelpWindow = object(TWindow)
+        HSB,VSB : PScrollBar;
         HelpView: PHelpViewer;
         HideOnClose: boolean;
         constructor Init(var Bounds: TRect; ATitle: TTitleStr; ASourceFileID: word; AContext: THelpCtx; ANumber: Integer);
         procedure   InitFrame; virtual;
+        procedure   InitScrollBars; virtual;
+        procedure   InitHelpView; virtual;
         procedure   ShowIndex; virtual;
         procedure   ShowTopic(SourceFileID: word; Context: THelpCtx); virtual;
         procedure   HandleEvent(var Event: TEvent); virtual;
@@ -184,28 +189,6 @@ uses
 
 const CommentColor = Blue;
 
-function Min(A,B: longint): longint; begin if A<B then Min:=A else Min:=B; end;
-function Max(A,B: longint): longint; begin if A>B then Max:=A else Max:=B; end;
-function CharStr(C: char; Count: byte): string;
-var S: string;
-begin S[0]:=chr(Count); if Count>0 then FillChar(S[1],Count,C); CharStr:=S; end;
-
-function Trim(S: string): string;
-const TrimChars : set of char = [#0,#9,' ',#255];
-begin
-  while (length(S)>0) and (S[1] in TrimChars) do Delete(S,1,1);
-  while (length(S)>0) and (S[length(S)] in TrimChars) do Delete(S,length(S),1);
-  Trim:=S;
-end;
-
-function UpcaseStr(S: string): string;
-var I: integer;
-begin
-  for I:=1 to length(S) do
-      S[I]:=Upcase(S[I]);
-  UpcaseStr:=S;
-end;
-
 function NewLink(FileID: longint; Topic: THelpCtx; StartP, EndP: TPoint): PHelpLink;
 var P: PHelpLink;
 begin
@@ -905,6 +888,16 @@ begin
         if CurLink<>-1 then
            SelectLink(CurLink);
       end;
+    evBroadcast :
+      case Event.Command of
+        cmHelpFilesChanged :
+          begin
+            if HelpTopic=IndexHelpTopic then HelpTopic:=nil;
+            IndexTopic:=nil;
+            if IndexHelpTopic<>nil then Dispose(IndexHelpTopic, Done);
+            IndexHelpTopic:=nil;
+          end;
+      end;
     evCommand :
       begin
         DontClear:=false;
@@ -1057,19 +1050,35 @@ end;
 
 constructor THelpWindow.Init(var Bounds: TRect; ATitle: TTitleStr; ASourceFileID: word; AContext: THelpCtx; ANumber: Integer);
 var R: TRect;
-    VSB,HSB: PScrollBar;
 begin
   inherited Init(Bounds, ATitle, ANumber);
+  InitScrollBars;
+  if Assigned(HSB) then Insert(HSB);
+  if Assigned(VSB) then Insert(VSB);
+  InitHelpView;
+  if Assigned(HelpView) then
+  begin
+    if (ASourceFileID<>0) or (AContext<>0) then
+       ShowTopic(ASourceFileID, AContext);
+    Insert(HelpView);
+  end;
+end;
+
+procedure THelpWindow.InitScrollBars;
+var R: TRect;
+begin
   GetExtent(R); R.Grow(0,-1); R.A.X:=R.B.X-1;
-  New(VSB, Init(R)); VSB^.GrowMode:=gfGrowLoX+gfGrowHiX+gfGrowHiY; Insert(VSB);
+  New(VSB, Init(R)); VSB^.GrowMode:=gfGrowLoX+gfGrowHiX+gfGrowHiY;
   GetExtent(R); R.Grow(-1,0); R.A.Y:=R.B.Y-1;
-  New(HSB, Init(R)); HSB^.GrowMode:=gfGrowLoY+gfGrowHiX+gfGrowHiY; Insert(HSB);
+  New(HSB, Init(R)); HSB^.GrowMode:=gfGrowLoY+gfGrowHiX+gfGrowHiY;
+end;
+
+procedure THelpWindow.InitHelpView;
+var R: TRect;
+begin
   GetExtent(R); R.Grow(-1,-1);
   New(HelpView, Init(R, HSB, VSB));
   HelpView^.GrowMode:=gfGrowHiX+gfGrowHiY;
-  if (ASourceFileID<>0) or (AContext<>0) then
-     ShowTopic(ASourceFileID, AContext);
-  Insert(HelpView);
 end;
 
 procedure THelpWindow.InitFrame;
@@ -1116,7 +1125,24 @@ end;
 END.
 {
   $Log$
-  Revision 1.5  1999-02-18 13:44:38  peter
+  Revision 1.6  1999-03-01 15:42:13  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
+    * efBackSpaceUnindents works correctly
+    + 'Messages' window implemented
+    + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
+    + Added TP message-filter support (for ex. you can call GREP thru
+      GREP2MSG and view the result in the messages window - just like in TP)
+    * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
+      so topic search didn't work...
+    * In FPHELP.PAS there were still context-variables defined as word instead
+      of THelpCtx
+    * StdStatusKeys() was missing from the statusdef for help windows
+    + Topic-title for index-table can be specified when adding a HTML-files
+
+  Revision 1.5  1999/02/18 13:44:38  peter
     * search fixed
     + backward search
     * help fixes

+ 5 - 10
ide/text/whtmlhlp.pas

@@ -15,7 +15,7 @@ type
     TTopicLinkCollection = object(TStringCollection)
       procedure Insert(Item: Pointer); virtual;
       function  At(Index: sw_Integer): PString;
-      function  AddItem(const Item: string): Sw_integer;
+      function  AddItem(Item: string): integer;
     end;
 
     TParagraphAlign = (paLeft,paCenter,paRight);
@@ -178,7 +178,7 @@ begin
   At:=inherited At(Index);
 end;
 
-function TTopicLinkCollection.AddItem(const Item: string): Sw_integer;
+function TTopicLinkCollection.AddItem(Item: string): integer;
 var Idx: sw_integer;
 begin
   if Item='' then Idx:=-1 else
@@ -491,10 +491,9 @@ begin
           if (Topic^.Links<>nil) and (Topic^.LinkSize>0) then
             begin
               FreeMem(Topic^.Links,Topic^.LinkSize);
-              Topic^.Links:=nil; Topic^.LinkSize:=0; Topic^.LinkCount:=0;
+              Topic^.Links:=nil; Topic^.LinkCount:=0;
             end;
           Topic^.LinkCount:=TopicLinks^.Count;
-          Topic^.LinkSize:=SizeOf(Topic^.Links^[0])*Topic^.LinkCount;
           GetMem(Topic^.Links,Topic^.LinkSize);
           for I:=0 to Topic^.LinkCount-1 do
             begin
@@ -563,18 +562,14 @@ var OK: boolean;
     HTMLFile: PDOSTextFile;
     Name: string;
     Link: string;
-    FileNo,LinkNo : word;
     P: sw_integer;
 begin
   OK:=T<>nil;
   if OK then
     begin
-      if (T^.HelpCtx=0) then
-        Name:=FileName
-      else
+      if T^.HelpCtx=0 then Name:=FileName else
         begin
-          DecodeHTMLCtx(T^.HelpCtx-1,FileNo,LinkNo);
-          Link:=TopicLinks^.At(LinkNo)^;
+          Link:=TopicLinks^.At(T^.HelpCtx-1)^;
           Link:=FormatPath(Link);
           P:=Pos('#',Link); if P>0 then Delete(Link,P,255);
 {          if CurFileName='' then Name:=Link else

+ 21 - 68
ide/text/wini.pas

@@ -79,73 +79,9 @@ const MainSectionName : string[40] = 'MainSection';
 
 implementation
 
-{$ifdef FPC}uses callspec;{$endif}
-
-const LastStrToIntResult : integer = 0;
-
-function IntToStr(L: longint): string;
-var S: string;
-begin
-  Str(L,S);
-  IntToStr:=S;
-end;
-
-function StrToInt(const S: string): longint;
-var L: longint;
-    C: integer;
-begin
-  Val(S,L,C); if C<>0 then L:=-1;
-  LastStrToIntResult:=C;
-  StrToInt:=L;
-end;
-
-function UpcaseStr(const S: string): string;
-var
-  i  : Sw_word;
-begin
-  for i:=1 to length(s) do
-   if s[i] in ['a'..'z'] then
-    UpcaseStr[i]:=char(byte(s[i])-32)
-   else
-    UpcaseStr[i]:=s[i];
-  UpcaseStr[0]:=s[0];
-end;
-
-function LTrim(const S: string): string;
-var
-  i : Sw_integer;
-begin
-  i:=1;
-  while (i<length(S)) and (S[i]=' ') do
-   inc(i);
-  LTrim:=Copy(S,i,255);
-end;
-
-Function RTrim(const S:string):string;
-var
-  i : Sw_integer;
-begin
-  i:=length(S);
-  while (i>0) and (S[i]=' ') do
-   dec(i);
-  RTrim:=Copy(S,1,i);
-end;
-
-function Trim(const S: string): string;
-begin
-  Trim:=RTrim(LTrim(S));
-end;
-
-function GetStr(P: PString): string;
-begin
-  if P=nil then GetStr:='' else GetStr:=P^;
-end;
-
-function EatIO: integer;
-begin
-  EatIO:=IOResult;
-end;
-
+uses WUtils
+{$ifdef FPC},callspec{$endif}
+     ;
 
 constructor TINIEntry.Init(const ALine: string);
 begin
@@ -520,7 +456,24 @@ end;
 END.
 {
   $Log$
-  Revision 1.5  1999-02-22 02:15:26  peter
+  Revision 1.6  1999-03-01 15:42:15  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
+    * efBackSpaceUnindents works correctly
+    + 'Messages' window implemented
+    + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros
+    + Added TP message-filter support (for ex. you can call GREP thru
+      GREP2MSG and view the result in the messages window - just like in TP)
+    * A 'var' was missing from the param-list of THelpFacility.TopicSearch,
+      so topic search didn't work...
+    * In FPHELP.PAS there were still context-variables defined as word instead
+      of THelpCtx
+    * StdStatusKeys() was missing from the statusdef for help windows
+    + Topic-title for index-table can be specified when adding a HTML-files
+
+  Revision 1.5  1999/02/22 02:15:26  peter
     + default extension for save in the editor
     + Separate Text to Find for the grep dialog
     * fixed redir crash with tp7

Some files were not shown because too many files changed in this diff