Explorar o código

* 'Use tab characters' now works correctly
+ Syntax highlight now acts on File|Save As...
+ Added a new class to syntax highlight: 'hex numbers'.
* There was something very wrong with the palette managment. Now fixed.
+ Added output directory (-FE<xxx>) support to 'Directories' dialog...
* Fixed some possible bugs in Running/Compiling, and the compilation/run
process revised

peter %!s(int64=26) %!d(string=hai) anos
pai
achega
bcecca182a

+ 11 - 1
ide/fake/compiler.pas

@@ -18,12 +18,22 @@ begin
   status.maxerrorcount:=50;
   status.maxerrorcount:=50;
   do_comment(V_Error,'Fake Compiler');
   do_comment(V_Error,'Fake Compiler');
   do_comment(V_Error,'Cmd = "'+cmd+'"');
   do_comment(V_Error,'Cmd = "'+cmd+'"');
+  Compile:=0;
 end;
 end;
 
 
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.2  1998-12-28 15:44:59  peter
+  Revision 1.3  1999-01-04 11:49:39  peter
+   * 'Use tab characters' now works correctly
+   + Syntax highlight now acts on File|Save As...
+   + Added a new class to syntax highlight: 'hex numbers'.
+   * There was something very wrong with the palette managment. Now fixed.
+   + Added output directory (-FE<xxx>) support to 'Directories' dialog...
+   * Fixed some possible bugs in Running/Compiling, and the compilation/run
+     process revised
+
+  Revision 1.2  1998/12/28 15:44:59  peter
     * use V_Error
     * use V_Error
     * set status.verbosity
     * set status.verbosity
 
 

+ 7 - 13
ide/text/TODO

@@ -1,16 +1,10 @@
---- To do ---
-
-* Most editor-actions are not aware if current selection, eg.
-  a line insertion does not shift the start and/or the end of the selection.
-* Implement Help|Files...
-* Implement missing option dialogs in Options menu, and
-* store settings & options
-* User screen
 
 
 --- Ideas ---
 --- Ideas ---
 
 
-* Integrated source beautifier (fully configurable)
-* Add some other classes to syntax highlight
-  (eg. highlight standard Pascal types, etc.)
- 
- 
+ * Integrated source beautifier (fully configurable)
+ * Add some other classes to syntax highlight
+   (eg. highlight standard Pascal types, etc.)
+ * ASCII-table for inserting chars not accessible thru keyboard
+ * Binary->source (const table/array) converter
+
+

+ 17 - 3
ide/text/fp.pas

@@ -84,8 +84,14 @@ type
       procedure UpdateRecentFileList;
       procedure UpdateRecentFileList;
     end;
     end;
 
 
+function IDEUseSyntaxHighlight(Editor: PFileEditor): boolean; {$ifndef FPC}far;{$endif}
+begin
+  IDEUseSyntaxHighlight:=MatchesFileList(NameAndExtOf(Editor^.FileName),HighlightExts);
+end;
+
 constructor TIDEApp.Init;
 constructor TIDEApp.Init;
 begin
 begin
+  {$ifndef EDITORS}UseSyntaxHighlight:=IDEUseSyntaxHighlight;{$endif}
   inherited Init;
   inherited Init;
   New(ClipboardWindow, Init);
   New(ClipboardWindow, Init);
   Desktop^.Insert(ClipboardWindow);
   Desktop^.Insert(ClipboardWindow);
@@ -368,6 +374,7 @@ begin
   if PrimaryFile<>'' then
   if PrimaryFile<>'' then
      SetCmdState(CompileCmds,true);
      SetCmdState(CompileCmds,true);
   UpdateMenu(MenuBar^.Menu);
   UpdateMenu(MenuBar^.Menu);
+  Message(ProgramInfoWindow,evBroadcast,cmUpdate,nil);
 end;
 end;
 
 
 procedure TIDEApp.UpdateINIFile;
 procedure TIDEApp.UpdateINIFile;
@@ -486,8 +493,9 @@ begin
 end;
 end;
 
 
 function TIDEApp.GetPalette: PPalette;
 function TIDEApp.GetPalette: PPalette;
-const P: string[length(CIDEAppColor)] = CIDEAppColor;
+var P: string;
 begin
 begin
+  P:=AppPalette;
   GetPalette:=@P;
   GetPalette:=@P;
 end;
 end;
 
 
@@ -570,8 +578,14 @@ BEGIN
 END.
 END.
 {
 {
   $Log$
   $Log$
-  Revision 1.3  1998-12-30 13:38:38  peter
-    * patches from Gabor
+  Revision 1.4  1999-01-04 11:49:41  peter
+   * 'Use tab characters' now works correctly
+   + Syntax highlight now acts on File|Save As...
+   + Added a new class to syntax highlight: 'hex numbers'.
+   * There was something very wrong with the palette managment. Now fixed.
+   + Added output directory (-FE<xxx>) support to 'Directories' dialog...
+   * Fixed some possible bugs in Running/Compiling, and the compilation/run
+     process revised
 
 
   Revision 1.2  1998/12/28 15:47:40  peter
   Revision 1.2  1998/12/28 15:47:40  peter
     + Added user screen support, display & window
     + Added user screen support, display & window

+ 32 - 6
ide/text/fpcompil.pas

@@ -37,7 +37,7 @@ procedure DoCompile(Mode: TCompileMode);
 implementation
 implementation
 
 
 uses
 uses
-  Video,CRt,
+  Dos,Video,
   Objects,Drivers,Views,App,
   Objects,Drivers,Views,App,
   CompHook,
   CompHook,
   FPConst,FPVars,FPUtils,FPIntf,FPSwitches;
   FPConst,FPVars,FPUtils,FPIntf,FPSwitches;
@@ -88,7 +88,7 @@ begin
       end;
       end;
   end;
   end;
   ST^.SetText(
   ST^.SetText(
-    'Main file: '+MainFile+#13+
+    'Main file: '+SmartPath(MainFile)+#13+
     StatusS+#13#13+
     StatusS+#13#13+
     'Target: '+LExpand(KillTilde(TargetSwitches^.ItemName(TargetSwitches^.GetCurrSel)),12)+'    '+
     'Target: '+LExpand(KillTilde(TargetSwitches^.ItemName(TargetSwitches^.GetCurrSel)),12)+'    '+
     'Line number: '+IntToStrL(Status.CurrentLine,7)+#13+
     'Line number: '+IntToStrL(Status.CurrentLine,7)+#13+
@@ -126,6 +126,20 @@ begin
    end;
    end;
 end;
 end;
 
 
+function GetExePath: string;
+var Path: string;
+    I: integer;
+begin
+  Path:='.\';
+  if DirectorySwitches<>nil then
+    with DirectorySwitches^ do
+    for I:=0 to ItemCount-1 do
+      begin
+        if Pos('EXE',KillTilde(ItemName(I)))>0 then
+          begin Path:=GetStringItem(I); Break; end;
+      end;
+  GetExePath:=CompleteDir(FExpand(Path));
+end;
 
 
 {****************************************************************************
 {****************************************************************************
                                  DoCompile
                                  DoCompile
@@ -164,7 +178,8 @@ begin
        end;
        end;
       FileName:=P^.Editor^.FileName;
       FileName:=P^.Editor^.FileName;
     end;
     end;
-  MainFile:=SmartPath(FileName);
+  MainFile:=FExpand(FileName);
+  EXEFile:=GetEXEPath+NameAndExtOf(MainFile);
 { Reset }
 { Reset }
   CtrlBreakHit:=false;
   CtrlBreakHit:=false;
 { Show Program Info }
 { Show Program Info }
@@ -186,10 +201,12 @@ begin
 
 
   Compile(FileName);
   Compile(FileName);
 
 
-  CompilationPhase:=cpDone;
+  if status.errorCount=0
+     then CompilationPhase:=cpDone
+     else CompilationPhase:=cpFailed;
   SD^.Update;
   SD^.Update;
 
 
-  if ((status.errorcount=0) or (ShowStatusOnError)) and (Mode<>cRun) then
+  if ((CompilationPhase in[cpDone,cpFailed]) or (ShowStatusOnError)) and (Mode<>cRun) then
    repeat
    repeat
      SD^.GetEvent(E);
      SD^.GetEvent(E);
      if IsExitEvent(E)=false then
      if IsExitEvent(E)=false then
@@ -207,7 +224,16 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.2  1998-12-28 15:47:42  peter
+  Revision 1.3  1999-01-04 11:49:42  peter
+   * 'Use tab characters' now works correctly
+   + Syntax highlight now acts on File|Save As...
+   + Added a new class to syntax highlight: 'hex numbers'.
+   * There was something very wrong with the palette managment. Now fixed.
+   + Added output directory (-FE<xxx>) support to 'Directories' dialog...
+   * Fixed some possible bugs in Running/Compiling, and the compilation/run
+     process revised
+
+  Revision 1.2  1998/12/28 15:47:42  peter
     + Added user screen support, display & window
     + Added user screen support, display & window
     + Implemented Editor,Mouse Options dialog
     + Implemented Editor,Mouse Options dialog
     + Added location of .INI and .CFG file
     + Added location of .INI and .CFG file

+ 10 - 3
ide/text/fpconst.pas

@@ -126,6 +126,7 @@ const
      hcHelpWindow        = 8001;
      hcHelpWindow        = 8001;
      hcClipboardWindow   = 8002;
      hcClipboardWindow   = 8002;
      hcCalcWindow        = 8003;
      hcCalcWindow        = 8003;
+     hcInfoWindow        = 8004;
 
 
      hcShift             = 10000;
      hcShift             = 10000;
 
 
@@ -237,15 +238,21 @@ const
          { CSourceWindow }
          { CSourceWindow }
 {167-182}#$17#$1F#$1A#$31#$31#$1E#$71#$1F#$00#$00#$00#$00#$00#$00#$00#$00 + { 1-16}
 {167-182}#$17#$1F#$1A#$31#$31#$1E#$71#$1F#$00#$00#$00#$00#$00#$00#$00#$00 + { 1-16}
 {183-198}#$00#$00#$00#$00#$00#$00#$00#$00#$00#$00#$00#$00#$00#$00#$00#$00 + {17-32}
 {183-198}#$00#$00#$00#$00#$00#$00#$00#$00#$00#$00#$00#$00#$00#$00#$00#$00 + {17-32}
-{199-214}#$1E#$1F#$17#$1F#$1E#$1B#$13#$1A#$1E#$71#$3F#$1F#$1C#$00#$00#$4E ; {33-48}
+{199-214}#$1E#$1F#$17#$1F#$1E#$1B#$13#$1A#$1E#$71#$3F#$1F#$1C#$13#$00#$4E ; {33-48}
 
 
 implementation
 implementation
 
 
 END.
 END.
 {
 {
   $Log$
   $Log$
-  Revision 1.3  1998-12-30 13:38:39  peter
-    * patches from Gabor
+  Revision 1.4  1999-01-04 11:49:43  peter
+   * 'Use tab characters' now works correctly
+   + Syntax highlight now acts on File|Save As...
+   + Added a new class to syntax highlight: 'hex numbers'.
+   * There was something very wrong with the palette managment. Now fixed.
+   + Added output directory (-FE<xxx>) support to 'Directories' dialog...
+   * Fixed some possible bugs in Running/Compiling, and the compilation/run
+     process revised
 
 
   Revision 1.2  1998/12/28 15:47:43  peter
   Revision 1.2  1998/12/28 15:47:43  peter
     + Added user screen support, display & window
     + Added user screen support, display & window

+ 14 - 2
ide/text/fphelp.pas

@@ -83,6 +83,8 @@ begin
     hcSourceWindow  : S:='';
     hcSourceWindow  : S:='';
     hcHelpWindow    : S:='';
     hcHelpWindow    : S:='';
     hcCalcWindow    : S:='';
     hcCalcWindow    : S:='';
+    hcInfoWindow    : S:='';
+    hcClipboardWindow:S:='';
 
 
     hcSystemMenu    : S:='System menu';
     hcSystemMenu    : S:='System menu';
     hcUpdate        : S:='Refresh and redraw display';
     hcUpdate        : S:='Refresh and redraw display';
@@ -151,7 +153,7 @@ begin
     hcEditor        : S:='Specify default editor settings';
     hcEditor        : S:='Specify default editor settings';
     hcMouse         : S:='Specify mouse settings';
     hcMouse         : S:='Specify mouse settings';
     hcStartup       : S:='Permanently change default startup options';
     hcStartup       : S:='Permanently change default startup options';
-    hcColors        : S:='Costumize IDE colors for windows, menus, editors, etc.';
+    hcColors        : S:='Customize IDE colors for windows, menus, editors, etc.';
     hcOpenINI       : S:='Load a previously saved options file';
     hcOpenINI       : S:='Load a previously saved options file';
     hcSaveINI       : S:='Save all the changes made in the options menu';
     hcSaveINI       : S:='Save all the changes made in the options menu';
     hcSaveAsINI     : S:='Save all the changes made under a different name';
     hcSaveAsINI     : S:='Save all the changes made under a different name';
@@ -166,6 +168,7 @@ begin
     hcPrev          : S:='Make the previous window active';
     hcPrev          : S:='Make the previous window active';
     hcClose         : S:='Close the active window';
     hcClose         : S:='Close the active window';
     hcWindowList    : S:='Show a list of all open windows';
     hcWindowList    : S:='Show a list of all open windows';
+    hcUserScreenWindow:S:='Show contents of user screen in a window';
 
 
     hcHelpMenu      : S:='Get online help';
     hcHelpMenu      : S:='Get online help';
     hcHelpContents  : S:='Show table of contents for Online Help';
     hcHelpContents  : S:='Show table of contents for Online Help';
@@ -314,7 +317,16 @@ end;
 END.
 END.
 {
 {
   $Log$
   $Log$
-  Revision 1.2  1998-12-28 15:47:44  peter
+  Revision 1.3  1999-01-04 11:49:44  peter
+   * 'Use tab characters' now works correctly
+   + Syntax highlight now acts on File|Save As...
+   + Added a new class to syntax highlight: 'hex numbers'.
+   * There was something very wrong with the palette managment. Now fixed.
+   + Added output directory (-FE<xxx>) support to 'Directories' dialog...
+   * Fixed some possible bugs in Running/Compiling, and the compilation/run
+     process revised
+
+  Revision 1.2  1998/12/28 15:47:44  peter
     + Added user screen support, display & window
     + Added user screen support, display & window
     + Implemented Editor,Mouse Options dialog
     + Implemented Editor,Mouse Options dialog
     + Added location of .INI and .CFG file
     + Added location of .INI and .CFG file

+ 16 - 10
ide/text/fpini.pas

@@ -48,6 +48,7 @@ const
   secEditor          = 'Editor';
   secEditor          = 'Editor';
   secHighlight       = 'Highlight';
   secHighlight       = 'Highlight';
   secMouse           = 'Mouse';
   secMouse           = 'Mouse';
+  secSearch          = 'Search';
 
 
   { INI file tags }
   { INI file tags }
   ieRecentFile       = 'RecentFile';
   ieRecentFile       = 'RecentFile';
@@ -62,13 +63,14 @@ const
   ieReverseButtons   = 'ReverseButtons';
   ieReverseButtons   = 'ReverseButtons';
   ieAltClickAction   = 'AltClickAction';
   ieAltClickAction   = 'AltClickAction';
   ieCtrlClickAction  = 'CtrlClickAction';
   ieCtrlClickAction  = 'CtrlClickAction';
+  ieFindFlags        = 'FindFlags';
 
 
 procedure InitINIFile;
 procedure InitINIFile;
-var S: string;
+var S: string;
 begin
 begin
-  S:=LocateFile(ININame);
-  if S<>'' then
-    INIPath:=S;
+  S:=LocateFile(ININame);
+  if S<>'' then
+    INIPath:=S;
   INIPath:=FExpand(INIPath);
   INIPath:=FExpand(INIPath);
 end;
 end;
 
 
@@ -198,11 +200,12 @@ begin
   INIFile^.SetIntEntry(secEditor,ieDefaultTabSize,DefaultTabSize);
   INIFile^.SetIntEntry(secEditor,ieDefaultTabSize,DefaultTabSize);
   INIFile^.SetIntEntry(secEditor,ieDefaultEditorFlags,DefaultCodeEditorFlags);
   INIFile^.SetIntEntry(secEditor,ieDefaultEditorFlags,DefaultCodeEditorFlags);
 {$endif}
 {$endif}
-  INIFile^.SetEntry(secHighlight,ieHighlightExts,HighlightExts);
+  INIFile^.SetEntry(secHighlight,ieHighlightExts,'"'+HighlightExts+'"');
   INIFile^.SetIntEntry(secMouse,ieDoubleClickDelay,DoubleDelay);
   INIFile^.SetIntEntry(secMouse,ieDoubleClickDelay,DoubleDelay);
   INIFile^.SetIntEntry(secMouse,ieReverseButtons,byte(MouseReverse));
   INIFile^.SetIntEntry(secMouse,ieReverseButtons,byte(MouseReverse));
   INIFile^.SetIntEntry(secMouse,ieAltClickAction,AltMouseAction);
   INIFile^.SetIntEntry(secMouse,ieAltClickAction,AltMouseAction);
   INIFile^.SetIntEntry(secMouse,ieCtrlClickAction,CtrlMouseAction);
   INIFile^.SetIntEntry(secMouse,ieCtrlClickAction,CtrlMouseAction);
+  INIFile^.SetIntEntry(secSearch,ieFindFlags,FindFlags);
   if AppPalette<>CIDEAppColor then
   if AppPalette<>CIDEAppColor then
   begin
   begin
     { this has a bug. if a different palette has been read on startup, and
     { this has a bug. if a different palette has been read on startup, and
@@ -224,11 +227,14 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.3  1998-12-30 13:38:40  peter
-    * patches from Gabor
-
-  Revision 1.2  1998/12/30 10:25:01  peter
-    * fixed readinifile
+  Revision 1.4  1999-01-04 11:49:45  peter
+   * 'Use tab characters' now works correctly
+   + Syntax highlight now acts on File|Save As...
+   + Added a new class to syntax highlight: 'hex numbers'.
+   * There was something very wrong with the palette managment. Now fixed.
+   + Added output directory (-FE<xxx>) support to 'Directories' dialog...
+   * Fixed some possible bugs in Running/Compiling, and the compilation/run
+     process revised
 
 
   Revision 1.1  1998/12/28 15:47:45  peter
   Revision 1.1  1998/12/28 15:47:45  peter
     + Added user screen support, display & window
     + Added user screen support, display & window

+ 10 - 14
ide/text/fpmfile.inc

@@ -18,7 +18,6 @@ function TIDEApp.OpenEditorWindow(FileName: string; CurX,CurY: integer): PSource
 var P: PView;
 var P: PView;
     R: TRect;
     R: TRect;
     W: PSourceWindow;
     W: PSourceWindow;
-    B,SH: boolean;
 begin
 begin
   P:=Message(Desktop,evBroadcast,cmSearchWindow,nil);
   P:=Message(Desktop,evBroadcast,cmSearchWindow,nil);
   if P=nil then Desktop^.GetExtent(R) else
   if P=nil then Desktop^.GetExtent(R) else
@@ -37,18 +36,6 @@ begin
          TrackCursor(true);
          TrackCursor(true);
        end;
        end;
     W^.HelpCtx:=hcSourceWindow;
     W^.HelpCtx:=hcSourceWindow;
-    SH:=MatchesFileList(NameAndExtOf(FileName),HighlightExts);
-    with W^.Editor^ do
-     begin
-       b:=(Flags and efSyntaxHighlight)<>0;
-       if SH<>B then
-        begin
-          if SH then
-           SetFlags(Flags or efSyntaxHighlight)
-          else
-           SetFlags(Flags and not efSyntaxHighlight);
-        end;
-     end;
     Desktop^.Insert(W);
     Desktop^.Insert(W);
     Message(Application,evBroadcast,cmUpdate,nil);
     Message(Application,evBroadcast,cmUpdate,nil);
   end;
   end;
@@ -163,7 +150,16 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.2  1998-12-28 15:47:47  peter
+  Revision 1.3  1999-01-04 11:49:46  peter
+   * 'Use tab characters' now works correctly
+   + Syntax highlight now acts on File|Save As...
+   + Added a new class to syntax highlight: 'hex numbers'.
+   * There was something very wrong with the palette managment. Now fixed.
+   + Added output directory (-FE<xxx>) support to 'Directories' dialog...
+   * Fixed some possible bugs in Running/Compiling, and the compilation/run
+     process revised
+
+  Revision 1.2  1998/12/28 15:47:47  peter
     + Added user screen support, display & window
     + Added user screen support, display & window
     + Implemented Editor,Mouse Options dialog
     + Implemented Editor,Mouse Options dialog
     + Added location of .INI and .CFG file
     + Added location of .INI and .CFG file

+ 15 - 8
ide/text/fpmopts.inc

@@ -375,7 +375,8 @@ var R,R2: TRect;
 const
 const
   LW = 25;
   LW = 25;
 begin
 begin
-  R.Assign(0,0,64,10);
+  Count:=DirectorySwitches^.ItemCount;
+  R.Assign(0,0,64,2+Count*2);
   New(D, Init(R, 'Directories'));
   New(D, Init(R, 'Directories'));
   with D^ do
   with D^ do
   begin
   begin
@@ -383,7 +384,6 @@ begin
     R.Grow(-2,-2);
     R.Grow(-2,-2);
     Dec(R.B.X);
     Dec(R.B.X);
     R.B.Y:=R.A.Y+1;
     R.B.Y:=R.A.Y+1;
-    Count:=DirectorySwitches^.ItemCount;
     for i:=Count-1 downto 0 do
     for i:=Count-1 downto 0 do
      begin
      begin
        R2.Copy(R);
        R2.Copy(R);
@@ -398,7 +398,7 @@ begin
      end;
      end;
   end;
   end;
   InsertButtons(D);
   InsertButtons(D);
-  IL[0]^.Select;
+  IL[Count-1]^.Select;
   if Desktop^.ExecView(D)=cmOK then
   if Desktop^.ExecView(D)=cmOK then
    begin
    begin
      for i:=Count-1 downto 0 do
      for i:=Count-1 downto 0 do
@@ -554,7 +554,7 @@ end;
 procedure TIDEApp.Colors;
 procedure TIDEApp.Colors;
 var D: PColorDialog;
 var D: PColorDialog;
 begin
 begin
-  New(D, Init(GetPalette^,
+  New(D, Init(AppPalette,
     ColorGroup('Desktop', DesktopColorItems(nil),
     ColorGroup('Desktop', DesktopColorItems(nil),
     ColorGroup('Dialogs', DialogColorItems(dpGrayDialog,nil),
     ColorGroup('Dialogs', DialogColorItems(dpGrayDialog,nil),
     ColorGroup('Editor',
     ColorGroup('Editor',
@@ -588,12 +588,13 @@ begin
       ColorItem('Identifiers'     , 203,
       ColorItem('Identifiers'     , 203,
       ColorItem('Strings'         , 204,
       ColorItem('Strings'         , 204,
       ColorItem('Numbers'         , 205,
       ColorItem('Numbers'         , 205,
+      ColorItem('Hex numbers'     , 212,
       ColorItem('Assembler'       , 206,
       ColorItem('Assembler'       , 206,
       ColorItem('Symbols'         , 207,
       ColorItem('Symbols'         , 207,
       ColorItem('Directives'      , 211,
       ColorItem('Directives'      , 211,
-      nil))))))))),
+      nil)))))))))),
     nil))))))));
     nil))))))));
-  if ExecuteDialog(D, GetPalette)=cmOK then
+  if ExecuteDialog(D, @AppPalette)=cmOK then
     begin
     begin
       DoneMemory;
       DoneMemory;
       Message(Application,evBroadcast,cmUpdate,nil);
       Message(Application,evBroadcast,cmUpdate,nil);
@@ -651,8 +652,14 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.3  1998-12-30 13:38:41  peter
-    * patches from Gabor
+  Revision 1.4  1999-01-04 11:49:47  peter
+   * 'Use tab characters' now works correctly
+   + Syntax highlight now acts on File|Save As...
+   + Added a new class to syntax highlight: 'hex numbers'.
+   * There was something very wrong with the palette managment. Now fixed.
+   + Added output directory (-FE<xxx>) support to 'Directories' dialog...
+   * Fixed some possible bugs in Running/Compiling, and the compilation/run
+     process revised
 
 
   Revision 1.2  1998/12/28 15:47:49  peter
   Revision 1.2  1998/12/28 15:47:49  peter
     + Added user screen support, display & window
     + Added user screen support, display & window

+ 25 - 8
ide/text/fpmrun.inc

@@ -15,17 +15,22 @@
  **********************************************************************}
  **********************************************************************}
 
 
 procedure TIDEApp.DoRun;
 procedure TIDEApp.DoRun;
-var
-  ExeFile : string;
 begin
 begin
-  if (MainFile='') or (CompilationPhase<>cpDone) then
+  if (not ExistsFile(ExeFile)) or (CompilationPhase<>cpDone) then
    DoCompile(cRun);
    DoCompile(cRun);
-  if (MainFile='') or (CompilationPhase<>cpDone) then
+  if CompilationPhase<>cpDone then
+     Exit;
+  if (EXEFile='') then
    begin
    begin
      ErrorBox('Oooops, nothing to run.',nil);
      ErrorBox('Oooops, nothing to run.',nil);
      Exit;
      Exit;
    end;
    end;
-  ExeFile:=MakeExeName(MainFile);
+  if not ExistsFile(ExeFile) then
+    begin
+      MsgParms[1].Ptr:=@EXEFile;
+      ErrorBox('Invalid filename %s',@MsgParms);
+      Exit;
+    end;
 
 
   if UserScreen=nil then
   if UserScreen=nil then
    begin
    begin
@@ -35,11 +40,14 @@ begin
   DoneMouse;
   DoneMouse;
   DoneVideo;
   DoneVideo;
 
 
-  UserScreen^.SwitchTo;
+  if Assigned(UserScreen) then
+    UserScreen^.SwitchTo;
 
 
   Exec(ExeFile,GetRunParameters);
   Exec(ExeFile,GetRunParameters);
+  LastExitCode:=DosExitCode;
 
 
-  UserScreen^.SwitchBack;
+  if Assigned(UserScreen) then
+    UserScreen^.SwitchBack;
 
 
   InitVideo;
   InitVideo;
   InitMouse;
   InitMouse;
@@ -75,7 +83,16 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.1  1998-12-28 15:47:50  peter
+  Revision 1.2  1999-01-04 11:49:48  peter
+   * 'Use tab characters' now works correctly
+   + Syntax highlight now acts on File|Save As...
+   + Added a new class to syntax highlight: 'hex numbers'.
+   * There was something very wrong with the palette managment. Now fixed.
+   + Added output directory (-FE<xxx>) support to 'Directories' dialog...
+   * Fixed some possible bugs in Running/Compiling, and the compilation/run
+     process revised
+
+  Revision 1.1  1998/12/28 15:47:50  peter
     + Added user screen support, display & window
     + Added user screen support, display & window
     + Implemented Editor,Mouse Options dialog
     + Implemented Editor,Mouse Options dialog
     + Added location of .INI and .CFG file
     + Added location of .INI and .CFG file

+ 11 - 1
ide/text/fpmwnd.inc

@@ -56,6 +56,7 @@ begin
   P:=List^.At(Item);
   P:=List^.At(Item);
   case P^.HelpCtx of
   case P^.HelpCtx of
     hcSourceWindow : S:=PSourceWindow(P)^.GetTitle(MaxLen);
     hcSourceWindow : S:=PSourceWindow(P)^.GetTitle(MaxLen);
+    hcInfoWindow   : S:=PProgramInfoWindow(P)^.GetTitle(MaxLen);
     hcHelpWindow   : S:=PHelpWindow(P)^.GetTitle(MaxLen);
     hcHelpWindow   : S:=PHelpWindow(P)^.GetTitle(MaxLen);
     hcCalcWindow   : S:=PCalculator(P)^.GetTitle(MaxLen);
     hcCalcWindow   : S:=PCalculator(P)^.GetTitle(MaxLen);
   else S:='???? - '+PWindow(P)^.GetTitle(MaxLen);
   else S:='???? - '+PWindow(P)^.GetTitle(MaxLen);
@@ -161,7 +162,16 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.3  1998-12-28 15:47:50  peter
+  Revision 1.4  1999-01-04 11:49:49  peter
+   * 'Use tab characters' now works correctly
+   + Syntax highlight now acts on File|Save As...
+   + Added a new class to syntax highlight: 'hex numbers'.
+   * There was something very wrong with the palette managment. Now fixed.
+   + Added output directory (-FE<xxx>) support to 'Directories' dialog...
+   * Fixed some possible bugs in Running/Compiling, and the compilation/run
+     process revised
+
+  Revision 1.3  1998/12/28 15:47:50  peter
     + Added user screen support, display & window
     + Added user screen support, display & window
     + Implemented Editor,Mouse Options dialog
     + Implemented Editor,Mouse Options dialog
     + Added location of .INI and .CFG file
     + Added location of .INI and .CFG file

+ 11 - 1
ide/text/fpswitch.pas

@@ -691,6 +691,7 @@ begin
      AddStringItem('~I~nclude directories','i',true);
      AddStringItem('~I~nclude directories','i',true);
      AddStringItem('~L~ibrary directories','l',true);
      AddStringItem('~L~ibrary directories','l',true);
      AddStringItem('~O~bject directories','o',true);
      AddStringItem('~O~bject directories','o',true);
+     AddStringItem('~E~XE & PPU directories','E',true);
    end;
    end;
   SwitchesPath:=LocateFile(SwitchesName);
   SwitchesPath:=LocateFile(SwitchesName);
   if SwitchesPath='' then
   if SwitchesPath='' then
@@ -717,7 +718,16 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.1  1998-12-28 15:47:52  peter
+  Revision 1.2  1999-01-04 11:49:50  peter
+   * 'Use tab characters' now works correctly
+   + Syntax highlight now acts on File|Save As...
+   + Added a new class to syntax highlight: 'hex numbers'.
+   * There was something very wrong with the palette managment. Now fixed.
+   + Added output directory (-FE<xxx>) support to 'Directories' dialog...
+   * Fixed some possible bugs in Running/Compiling, and the compilation/run
+     process revised
+
+  Revision 1.1  1998/12/28 15:47:52  peter
     + Added user screen support, display & window
     + Added user screen support, display & window
     + Implemented Editor,Mouse Options dialog
     + Implemented Editor,Mouse Options dialog
     + Added location of .INI and .CFG file
     + Added location of .INI and .CFG file

+ 16 - 9
ide/text/fpusrscr.pas

@@ -118,11 +118,13 @@ uses
 
 
 function TScreen.GetWidth: integer;
 function TScreen.GetWidth: integer;
 begin
 begin
+  Getwidth:=0;
   Abstract;
   Abstract;
 end;
 end;
 
 
 function TScreen.GetHeight: integer;
 function TScreen.GetHeight: integer;
 begin
 begin
+  Getheight:=0;
   Abstract;
   Abstract;
 end;
 end;
 
 
@@ -208,10 +210,8 @@ end;
 
 
 
 
 procedure TDOSScreen.Capture;
 procedure TDOSScreen.Capture;
-var X,Y: integer;
-    W: word;
-    r: registers;
-    VSeg,SOfs: word;
+var
+  VSeg,SOfs: word;
 begin
 begin
   GetVideoMode(VideoInfo);
   GetVideoMode(VideoInfo);
   GetBuffer(VideoInfo.ScreenSize);
   GetBuffer(VideoInfo.ScreenSize);
@@ -229,10 +229,8 @@ end;
 
 
 
 
 procedure TDOSScreen.SwitchTo;
 procedure TDOSScreen.SwitchTo;
-var X,Y: integer;
-    W: word;
-    r: registers;
-    VSeg,SOfs: word;
+var
+  VSeg,SOfs: word;
 begin
 begin
   GetVideoMode(TM);
   GetVideoMode(TM);
   SetVideoMode(VideoInfo);
   SetVideoMode(VideoInfo);
@@ -461,7 +459,16 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.1  1998-12-28 15:47:53  peter
+  Revision 1.2  1999-01-04 11:49:51  peter
+   * 'Use tab characters' now works correctly
+   + Syntax highlight now acts on File|Save As...
+   + Added a new class to syntax highlight: 'hex numbers'.
+   * There was something very wrong with the palette managment. Now fixed.
+   + Added output directory (-FE<xxx>) support to 'Directories' dialog...
+   * Fixed some possible bugs in Running/Compiling, and the compilation/run
+     process revised
+
+  Revision 1.1  1998/12/28 15:47:53  peter
     + Added user screen support, display & window
     + Added user screen support, display & window
     + Implemented Editor,Mouse Options dialog
     + Implemented Editor,Mouse Options dialog
     + Added location of .INI and .CFG file
     + Added location of .INI and .CFG file

+ 13 - 5
ide/text/fpvars.pas

@@ -26,7 +26,7 @@ type
       LastPos   : TPoint;
       LastPos   : TPoint;
     end;
     end;
 
 
-    TCompPhase = (cpCompiling,cpLinking,cpDone);
+    TCompPhase = (cpNothing,cpCompiling,cpLinking,cpFailed,cpDone);
 
 
 const ClipboardWindow  : PClipboardWindow = nil;
 const ClipboardWindow  : PClipboardWindow = nil;
       CalcWindow       : PCalculator = nil;
       CalcWindow       : PCalculator = nil;
@@ -35,7 +35,8 @@ const ClipboardWindow  : PClipboardWindow = nil;
       PrimaryFile      : string = '';
       PrimaryFile      : string = '';
       IsEXECompiled    : boolean = false;
       IsEXECompiled    : boolean = false;
       MainFile         : string = '';
       MainFile         : string = '';
-      CompilationPhase : TCompPhase = cpDone;
+      EXEFile          : string = '';
+      CompilationPhase : TCompPhase = cpNothing;
       ProgramInfoWindow: PProgramInfoWindow = nil;
       ProgramInfoWindow: PProgramInfoWindow = nil;
       UserScreenWindow : PScreenWindow = nil;
       UserScreenWindow : PScreenWindow = nil;
       HelpFiles        : FPViews.PUnsortedStringCollection = nil;
       HelpFiles        : FPViews.PUnsortedStringCollection = nil;
@@ -46,12 +47,13 @@ const ClipboardWindow  : PClipboardWindow = nil;
       CtrlMouseAction  : integer = acTopicSearch;
       CtrlMouseAction  : integer = acTopicSearch;
       AltMouseAction   : integer = acBrowseSymbol;
       AltMouseAction   : integer = acBrowseSymbol;
       StartupOptions   : longint = 0;
       StartupOptions   : longint = 0;
+      LastExitCode     : integer = 0;
 
 
       ActionCommands   : array[acFirstAction..acLastAction] of word =
       ActionCommands   : array[acFirstAction..acLastAction] of word =
         (cmHelpTopicSearch,cmGotoCursor,cmToggleBreakpoint,
         (cmHelpTopicSearch,cmGotoCursor,cmToggleBreakpoint,
          cmEvaluate,cmAddWatch,cmBrowseAtCursor);
          cmEvaluate,cmAddWatch,cmBrowseAtCursor);
 
 
-      AppPalette       : string = CAppColor;
+      AppPalette       : string = CIDEAppColor;
 
 
 var   RecentFiles      : array[1..MaxRecentFileCount] of TRecentFileEntry;
 var   RecentFiles      : array[1..MaxRecentFileCount] of TRecentFileEntry;
 
 
@@ -60,8 +62,14 @@ implementation
 END.
 END.
 {
 {
   $Log$
   $Log$
-  Revision 1.2  1998-12-30 13:38:42  peter
-    * patches from Gabor
+  Revision 1.3  1999-01-04 11:49:52  peter
+   * 'Use tab characters' now works correctly
+   + Syntax highlight now acts on File|Save As...
+   + Added a new class to syntax highlight: 'hex numbers'.
+   * There was something very wrong with the palette managment. Now fixed.
+   + Added output directory (-FE<xxx>) support to 'Directories' dialog...
+   * Fixed some possible bugs in Running/Compiling, and the compilation/run
+     process revised
 
 
   Revision 1.1  1998/12/28 15:47:54  peter
   Revision 1.1  1998/12/28 15:47:54  peter
     + Added user screen support, display & window
     + Added user screen support, display & window

+ 63 - 6
ide/text/fpviews.pas

@@ -200,12 +200,15 @@ type
 
 
     PProgramInfoWindow = ^TProgramInfoWindow;
     PProgramInfoWindow = ^TProgramInfoWindow;
     TProgramInfoWindow = object(TDlgWindow)
     TProgramInfoWindow = object(TDlgWindow)
-      InfoST: PStaticText;
+      InfoST: PColorStaticText;
       LogLB : PMessageListBox;
       LogLB : PMessageListBox;
       constructor Init;
       constructor Init;
       procedure   AddMessage(AClass: longint; Msg, Module: string; Line: longint);
       procedure   AddMessage(AClass: longint; Msg, Module: string; Line: longint);
       procedure   SizeLimits(var Min, Max: TPoint); virtual;
       procedure   SizeLimits(var Min, Max: TPoint); virtual;
       procedure   Close; virtual;
       procedure   Close; virtual;
+      procedure   HandleEvent(var Event: TEvent); virtual;
+      procedure   Update; virtual;
+      destructor  Done; virtual;
     end;
     end;
 
 
     PTabItem = ^TTabItem;
     PTabItem = ^TTabItem;
@@ -305,6 +308,12 @@ const
 
 
       OpenFileName   : string = '';
       OpenFileName   : string = '';
 
 
+var  MsgParms : array[1..10] of
+         record
+           case byte of
+             0 : (Ptr : pointer);
+             1 : (Long: longint);
+         end;
 
 
 implementation
 implementation
 
 
@@ -1665,7 +1674,7 @@ end;
 
 
 function ConfirmBox(S: string; Params: pointer; CanCancel: boolean): word;
 function ConfirmBox(S: string; Params: pointer; CanCancel: boolean): word;
 begin
 begin
-  MessageBox(S,Params,mfConfirmation+mfInsertInApp+mfYesButton+mfNoButton+integer(CanCancel)*mfCancelButton);
+  ConfirmBox:=MessageBox(S,Params,mfConfirmation+mfInsertInApp+mfYesButton+mfNoButton+integer(CanCancel)*mfCancelButton);
 end;
 end;
 
 
 function IsSeparator(P: PMenuItem): boolean;
 function IsSeparator(P: PMenuItem): boolean;
@@ -1888,7 +1897,7 @@ begin
   I:=1;
   I:=1;
   for Y:=0 to Size.Y-1 do
   for Y:=0 to Size.Y-1 do
   begin
   begin
-    MoveChar(B, ' ', C, Size.X);
+    MoveChar(B, ' ', Lo(C), Size.X);
     CurS:='';
     CurS:='';
     if S<>'' then
     if S<>'' then
     begin
     begin
@@ -1951,6 +1960,7 @@ end;
 
 
 function TLocalMenuListBox.GetLocalMenu: PMenu;
 function TLocalMenuListBox.GetLocalMenu: PMenu;
 begin
 begin
+  GetLocalMenu:=nil;
   Abstract;
   Abstract;
 end;
 end;
 
 
@@ -2081,7 +2091,6 @@ begin
 end;
 end;
 
 
 procedure TMessageListBox.GotoSource;
 procedure TMessageListBox.GotoSource;
-var P: PMessageItem;
 begin
 begin
 {  if TryToOpenSource(}
 {  if TryToOpenSource(}
 end;
 end;
@@ -2222,10 +2231,19 @@ constructor TProgramInfoWindow.Init;
 var R,R2: TRect;
 var R,R2: TRect;
     HSB,VSB: PScrollBar;
     HSB,VSB: PScrollBar;
     ST: PStaticText;
     ST: PStaticText;
+    C: word;
+const White = 15;
 begin
 begin
   Desktop^.GetExtent(R); R.A.Y:=R.B.Y-13;
   Desktop^.GetExtent(R); R.A.Y:=R.B.Y-13;
   inherited Init(R, 'Program Information', wnNoNumber);
   inherited Init(R, 'Program Information', wnNoNumber);
 
 
+  HelpCtx:=hcInfoWindow;
+
+  GetExtent(R); R.Grow(-1,-1); R.B.Y:=R.A.Y+4;
+  C:=((Desktop^.GetColor(32+6) and $f0) or White)*256+Desktop^.GetColor(32+6);
+  New(InfoST, Init(R,'', C)); InfoST^.GrowMode:=gfGrowHiX;
+  InfoST^.DontWrap:=true;
+  Insert(InfoST);
   GetExtent(R); R.Grow(-1,-1); Inc(R.A.Y,4); R.B.Y:=R.A.Y+1;
   GetExtent(R); R.Grow(-1,-1); Inc(R.A.Y,4); R.B.Y:=R.A.Y+1;
   New(ST, Init(R, CharStr('Ä', MaxViewWidth))); ST^.GrowMode:=gfGrowHiX; Insert(ST);
   New(ST, Init(R, CharStr('Ä', MaxViewWidth))); ST^.GrowMode:=gfGrowHiX; Insert(ST);
   GetExtent(R); R.Grow(-1,-1); Inc(R.A.Y,5);
   GetExtent(R); R.Grow(-1,-1); Inc(R.A.Y,5);
@@ -2237,6 +2255,7 @@ begin
   LogLB^.GrowMode:=gfGrowHiX+gfGrowHiY;
   LogLB^.GrowMode:=gfGrowHiX+gfGrowHiY;
   LogLB^.Transparent:=true;
   LogLB^.Transparent:=true;
   Insert(LogLB);
   Insert(LogLB);
+  Update;
 end;
 end;
 
 
 procedure TProgramInfoWindow.AddMessage(AClass: longint; Msg, Module: string; Line: longint);
 procedure TProgramInfoWindow.AddMessage(AClass: longint; Msg, Module: string; Line: longint);
@@ -2248,7 +2267,7 @@ end;
 procedure TProgramInfoWindow.SizeLimits(var Min, Max: TPoint);
 procedure TProgramInfoWindow.SizeLimits(var Min, Max: TPoint);
 begin
 begin
   inherited SizeLimits(Min,Max);
   inherited SizeLimits(Min,Max);
-  Min.Y:=9;
+  Min.X:=30; Min.Y:=9;
 end;
 end;
 
 
 procedure TProgramInfoWindow.Close;
 procedure TProgramInfoWindow.Close;
@@ -2256,6 +2275,35 @@ begin
   Hide;
   Hide;
 end;
 end;
 
 
+procedure TProgramInfoWindow.HandleEvent(var Event: TEvent);
+begin
+  case Event.What of
+    evBroadcast :
+      case Event.Command of
+        cmUpdate :
+          Update;
+      end;
+  end;
+  inherited HandleEvent(Event);
+end;
+
+procedure TProgramInfoWindow.Update;
+begin
+  InfoST^.SetText(
+    #13+
+    '   Current module : '+MainFile+#13+
+    '   Last exit code : '+IntToStr(LastExitCode)+#13+
+    ' Available memory : '+IntToStrL(MemAvail div 1024,5)+'K'+#13+
+    ''
+  );
+end;
+
+destructor TProgramInfoWindow.Done;
+begin
+  inherited Done;
+  ProgramInfoWindow:=nil;
+end;
+
 function TAdvancedStatusLine.GetStatusText: string;
 function TAdvancedStatusLine.GetStatusText: string;
 var S: string;
 var S: string;
 begin
 begin
@@ -2763,7 +2811,16 @@ end;
 END.
 END.
 {
 {
   $Log$
   $Log$
-  Revision 1.2  1998-12-28 15:47:54  peter
+  Revision 1.3  1999-01-04 11:49:53  peter
+   * 'Use tab characters' now works correctly
+   + Syntax highlight now acts on File|Save As...
+   + Added a new class to syntax highlight: 'hex numbers'.
+   * There was something very wrong with the palette managment. Now fixed.
+   + Added output directory (-FE<xxx>) support to 'Directories' dialog...
+   * Fixed some possible bugs in Running/Compiling, and the compilation/run
+     process revised
+
+  Revision 1.2  1998/12/28 15:47:54  peter
     + Added user screen support, display & window
     + Added user screen support, display & window
     + Implemented Editor,Mouse Options dialog
     + Implemented Editor,Mouse Options dialog
     + Added location of .INI and .CFG file
     + Added location of .INI and .CFG file

+ 4 - 0
ide/text/test.pas

@@ -1,7 +1,11 @@
 program TestProgram;
 program TestProgram;
 
 
+const A =  1234;
+      B =  $1234;
+
 var Hello : word;
 var Hello : word;
 
 
 BEGIN
 BEGIN
   writeln('Hello world!');
   writeln('Hello world!');
+  Halt;
 END.
 END.

+ 130 - 36
ide/text/weditor.pas

@@ -26,6 +26,8 @@ uses
   Objects,Drivers,Views,Commands;
   Objects,Drivers,Views,Commands;
 
 
 const
 const
+      cmFileNameChanged      = 51234;
+
       MaxLineLength = 255;
       MaxLineLength = 255;
       MaxLineCount  = 16380;
       MaxLineCount  = 16380;
 
 
@@ -60,6 +62,7 @@ const
       edReplacePrompt = 10;
       edReplacePrompt = 10;
       edTooManyLines  = 11;
       edTooManyLines  = 11;
       edGotoLine      = 12;
       edGotoLine      = 12;
+      edReplaceFile   = 13;
 
 
       ffmOptions         = $0007; ffsOptions     = 0;
       ffmOptions         = $0007; ffsOptions     = 0;
       ffmDirection       = $0008; ffsDirection   = 3;
       ffmDirection       = $0008; ffsDirection   = 3;
@@ -92,9 +95,10 @@ const
       coAssemblerColor    = 7;
       coAssemblerColor    = 7;
       coSymbolColor       = 8;
       coSymbolColor       = 8;
       coDirectiveColor    = 9;
       coDirectiveColor    = 9;
+      coHexNumberColor    = 10;
 
 
       coFirstColor        = 0;
       coFirstColor        = 0;
-      coLastColor         = coDirectiveColor;
+      coLastColor         = coHexNumberColor;
 
 
       CIndicator          = #2#3#1;
       CIndicator          = #2#3#1;
       CEditor             = #33#34#35#36#37#38#39#40#41#42#43#44#45#46#47#48;
       CEditor             = #33#34#35#36#37#38#39#40#41#42#43#44#45#46#47#48;
@@ -246,11 +250,14 @@ type
       function    LoadFile: boolean; virtual;
       function    LoadFile: boolean; virtual;
       function    SaveFile: boolean; virtual;
       function    SaveFile: boolean; virtual;
       function    Valid(Command: Word): Boolean; virtual;
       function    Valid(Command: Word): Boolean; virtual;
+      procedure   HandleEvent(var Event: TEvent); virtual;
       function    ShouldSave: boolean; virtual;
       function    ShouldSave: boolean; virtual;
     end;
     end;
 
 
     TCodeEditorDialog = function(Dialog: Integer; Info: Pointer): Word;
     TCodeEditorDialog = function(Dialog: Integer; Info: Pointer): Word;
 
 
+function DefUseSyntaxHighlight(Editor: PFileEditor): boolean;
+
 const
 const
      DefaultCodeEditorFlags : longint =
      DefaultCodeEditorFlags : longint =
       efBackupFiles+efInsertMode+efAutoIndent+efPersistentBlocks+
       efBackupFiles+efInsertMode+efAutoIndent+efPersistentBlocks+
@@ -273,6 +280,8 @@ const
      AlphaChars         : set of char = ['A'..'Z','a'..'z','_'];
      AlphaChars         : set of char = ['A'..'Z','a'..'z','_'];
      NumberChars        : set of char = ['0'..'9'];
      NumberChars        : set of char = ['0'..'9'];
 
 
+     UseSyntaxHighlight : function(Editor: PFileEditor): boolean = DefUseSyntaxHighlight;
+
 implementation
 implementation
 
 
 uses Dos,MsgBox,Dialogs,App,StdDlg,HistList,Validate;
 uses Dos,MsgBox,Dialogs,App,StdDlg,HistList,Validate;
@@ -304,14 +313,14 @@ const
      kbShift = kbLeftShift+kbRightShift;
      kbShift = kbLeftShift+kbRightShift;
 
 
 const
 const
-  FirstKeyCount = 36;
+  FirstKeyCount = 37;
   FirstKeys: array[0..FirstKeyCount * 2] of Word = (FirstKeyCount,
   FirstKeys: array[0..FirstKeyCount * 2] of Word = (FirstKeyCount,
     Ord(^A), cmWordLeft, Ord(^C), cmPageDown,
     Ord(^A), cmWordLeft, Ord(^C), cmPageDown,
     Ord(^D), cmCharRight, Ord(^E), cmLineUp,
     Ord(^D), cmCharRight, Ord(^E), cmLineUp,
     Ord(^F), cmWordRight, Ord(^G), cmDelChar,
     Ord(^F), cmWordRight, Ord(^G), cmDelChar,
-    Ord(^H), cmBackSpace, Ord(^K), $FF02,
-    Ord(^L), cmSearchAgain, Ord(^M), cmNewLine,
-    Ord(^Q), $FF01,
+    Ord(^H), cmBackSpace, Ord(^J), cmJumpLine,
+    Ord(^K), $FF02, Ord(^L), cmSearchAgain,
+    Ord(^M), cmNewLine, Ord(^Q), $FF01,
     Ord(^R), cmPageUp, Ord(^S), cmCharLeft,
     Ord(^R), cmPageUp, Ord(^S), cmCharLeft,
     Ord(^T), cmDelWord, Ord(^U), cmUndo,
     Ord(^T), cmDelWord, Ord(^U), cmUndo,
     Ord(^V), cmInsMode, Ord(^X), cmLineDown,
     Ord(^V), cmInsMode, Ord(^X), cmLineDown,
@@ -379,6 +388,23 @@ begin
   EatIO:=IOResult;
   EatIO:=IOResult;
 end;
 end;
 
 
+function ExistsFile(FileName: string): boolean;
+var f: file;
+    Exists: boolean;
+begin
+  if FileName='' then Exists:=false else
+ begin
+  {$I-}
+  Assign(f,FileName);
+  Reset(f,1);
+  Exists:=EatIO=0;
+  Close(f);
+  EatIO;
+  {$I+}
+ end;
+  ExistsFile:=Exists;
+end;
+
 function Max(A,B: longint): longint;
 function Max(A,B: longint): longint;
 begin
 begin
   if A>B then Max:=A else Max:=B;
   if A>B then Max:=A else Max:=B;
@@ -443,6 +469,32 @@ begin
   PointOfs:=longint(P.Y)*MaxLineLength+P.X;
   PointOfs:=longint(P.Y)*MaxLineLength+P.X;
 end;
 end;
 
 
+function ExtractTabs(S: string; TabSize: byte): string;
+var TabS: string;
+    P: byte;
+begin
+  TabS:=CharStr(' ',TabSize);
+  repeat
+    P:=Pos(TAB,S);
+    if P>0 then
+      S:=copy(S,1,P-1)+TabS+copy(S,P+1,255);
+  until P=0;
+  ExtractTabs:=S;
+end;
+
+function CompressUsingTabs(S: string; TabSize: byte): string;
+var TabS: string;
+    P: byte;
+begin
+  TabS:=CharStr(' ',TabSize);
+  repeat
+    P:=Pos(TabS,S);
+    if P>0 then
+      S:=copy(S,1,P-1)+TAB+copy(S,P+TabSize,255);
+  until P=0;
+  CompressUsingTabs:=S;
+end;
+
 {$ifdef ASMSCAN}
 {$ifdef ASMSCAN}
 
 
 function Scan_F(var Block; Size: Word; Str: String): Word; near; assembler;
 function Scan_F(var Block; Size: Word; Str: String): Word; near; assembler;
@@ -1199,6 +1251,7 @@ begin
   ColorTab[coAssemblerColor]:=GetColor(8);
   ColorTab[coAssemblerColor]:=GetColor(8);
   ColorTab[coSymbolColor]:=GetColor(9);
   ColorTab[coSymbolColor]:=GetColor(9);
   ColorTab[coDirectiveColor]:=GetColor(13);
   ColorTab[coDirectiveColor]:=GetColor(13);
+  ColorTab[coHexNumberColor]:=GetColor(14);
   SelectColor:=GetColor(10);
   SelectColor:=GetColor(10);
   HighlightColColor:=GetColor(11); HighlightRowColor:=GetColor(12);
   HighlightColColor:=GetColor(11); HighlightRowColor:=GetColor(12);
   ErrorMessageColor:=GetColor(16);
   ErrorMessageColor:=GetColor(16);
@@ -1309,8 +1362,6 @@ end;
 
 
 procedure TCodeEditor.SetLineText(I: integer; S: string);
 procedure TCodeEditor.SetLineText(I: integer; S: string);
 var L: PLine;
 var L: PLine;
-    TabS: string;
-    P: byte;
     AddCount: word;
     AddCount: word;
 begin
 begin
   AddCount:=0;
   AddCount:=0;
@@ -1320,14 +1371,7 @@ begin
   L:=Lines^.At(I);
   L:=Lines^.At(I);
   if L^.Text<>nil then DisposeStr(L^.Text);
   if L^.Text<>nil then DisposeStr(L^.Text);
   if ((Flags and efUseTabCharacters)<>0) and (TabSize>0) then
   if ((Flags and efUseTabCharacters)<>0) and (TabSize>0) then
-  begin
-    TabS:=CharStr(' ',TabSize);
-    repeat
-      P:=Pos(TabS,S);
-      if P>0 then
-         S:=copy(S,1,P-1)+TAB+copy(S,P+TabSize,255);
-    until P=0;
-  end;
+    S:=CompressUsingTabs(S,TabSize);
   L^.Text:=NewStr(S);
   L^.Text:=NewStr(S);
 end;
 end;
 
 
@@ -1945,9 +1989,6 @@ var S: string;
   function ContainsText(const SubS:string;var S: string; Start: Sw_word): Sw_integer;
   function ContainsText(const SubS:string;var S: string; Start: Sw_word): Sw_integer;
   var
   var
     P: Sw_Integer;
     P: Sw_Integer;
-{$ifndef ASMSCAN}
-    Hs : string;
-{$endif}
   begin
   begin
     if Start<=0 then
     if Start<=0 then
      P:=0
      P:=0
@@ -2020,8 +2061,7 @@ begin
 
 
   X:=X+DX;
   X:=X+DX;
   CanExit:=false;
   CanExit:=false;
-  if DoReplace and (Confirm=false) and (Owner<>nil) then
-    Owner^.Lock;
+  if DoReplace and (Confirm=false) and (Owner<>nil) then Owner^.Lock;
   if InArea(X,Y) then
   if InArea(X,Y) then
   repeat
   repeat
     S:=GetLineText(Y);
     S:=GetLineText(Y);
@@ -2230,11 +2270,14 @@ begin
   if InAsm then C:=coAssemblerColor else
   if InAsm then C:=coAssemblerColor else
   case SClass of
   case SClass of
     ccWhiteSpace : C:=coWhiteSpaceColor;
     ccWhiteSpace : C:=coWhiteSpaceColor;
-    ccNumber     : C:=coNumberColor;
+    ccNumber     : if copy(WordS,1,1)='$' then
+                     C:=coHexNumberColor
+                   else
+                     C:=coNumberColor;
     ccSymbol     : C:=coSymbolColor;
     ccSymbol     : C:=coSymbolColor;
     ccAlpha      :
     ccAlpha      :
       begin
       begin
-        WordS:=copy(LineText,StartX,EndX-StartX+1);
+{        WordS:=copy(LineText,StartX,EndX-StartX+1);}
         if IsReservedWord(WordS) then C:=coReservedWordColor
         if IsReservedWord(WordS) then C:=coReservedWordColor
                                  else C:=coIdentifierColor;
                                  else C:=coIdentifierColor;
       end;
       end;
@@ -2368,6 +2411,7 @@ var I: integer;
 begin
 begin
   for I:=1 to length(S) do
   for I:=1 to length(S) do
     AddChar(S[I]);
     AddChar(S[I]);
+  InsertText:=true;
 end;
 end;
 
 
 function TCodeEditor.InsertFrom(Editor: PCodeEditor): Boolean;
 function TCodeEditor.InsertFrom(Editor: PCodeEditor): Boolean;
@@ -2471,6 +2515,13 @@ begin
   DrawView;
   DrawView;
 end;
 end;
 
 
+procedure TCodeEditor.SetState(AState: Word; Enable: Boolean);
+begin
+  inherited SetState(AState,Enable);
+  if (AState and (sfActive+sfSelected+sfFocused))<>0 then
+     SelectionChanged;
+end;
+
 function TCodeEditor.GetPalette: PPalette;
 function TCodeEditor.GetPalette: PPalette;
 const P: string[length(CEditor)] = CEditor;
 const P: string[length(CEditor)] = CEditor;
 begin
 begin
@@ -2489,6 +2540,7 @@ begin
   inherited Init(Bounds,AHScrollBAr,AVScrollBAr,AIndicator,0);
   inherited Init(Bounds,AHScrollBAr,AVScrollBAr,AIndicator,0);
   FileName:=AFileName;
   FileName:=AFileName;
   UpdateIndicator;
   UpdateIndicator;
+  Message(@Self,evBroadcast,cmFileNameChanged,@Self);
 end;
 end;
 
 
 function TFileEditor.LoadFile: boolean;
 function TFileEditor.LoadFile: boolean;
@@ -2535,7 +2587,7 @@ begin
   begin
   begin
     readln(f,S);
     readln(f,S);
     OK:=OK and (IOResult=0);
     OK:=OK and (IOResult=0);
-    if OK then Lines^.Insert(NewLine(S));
+    if OK then Lines^.Insert(NewLine(ExtractTabs(S,TabSize)));
   end;
   end;
   FileMode:=FM;
   FileMode:=FM;
   Close(F);
   Close(F);
@@ -2576,7 +2628,7 @@ begin
   begin
   begin
     P:=Lines^.At(Line);
     P:=Lines^.At(Line);
     if P^.Text=nil then S:='' else S:=P^.Text^;
     if P^.Text=nil then S:='' else S:=P^.Text^;
-    writeln(f,S);
+    writeln(f,CompressUsingTabs(S,TabSize));
     Inc(Line);
     Inc(Line);
     OK:=OK and (IOResult=0);
     OK:=OK and (IOResult=0);
   end;
   end;
@@ -2604,17 +2656,33 @@ begin
   if EditorDialog(edSaveAs, @FileName) <> cmCancel then
   if EditorDialog(edSaveAs, @FileName) <> cmCancel then
   begin
   begin
     FileName := FExpand(FileName);
     FileName := FExpand(FileName);
-    Message(Owner, evBroadcast, cmUpdateTitle, nil);
+    Message(Owner, evBroadcast, cmUpdateTitle, @Self);
     SaveAs := SaveFile;
     SaveAs := SaveFile;
     if IsClipboard then FileName := '';
     if IsClipboard then FileName := '';
+    Message(Application,evBroadcast,cmFileNameChanged,@Self);
   end;
   end;
 end;
 end;
 
 
-procedure TCodeEditor.SetState(AState: Word; Enable: Boolean);
+procedure TFileEditor.HandleEvent(var Event: TEvent);
+var SH,B: boolean;
 begin
 begin
-  inherited SetState(AState,Enable);
-  if (AState and (sfActive+sfSelected+sfFocused))<>0 then
-     SelectionChanged;
+  case Event.What of
+    evBroadcast :
+      case Event.Command of
+        cmFileNameChanged :
+          if (Event.InfoPtr=nil) or (Event.InfoPtr=@Self) then
+          begin
+            B:=(Flags and efSyntaxHighlight)<>0;
+            SH:=UseSyntaxHighlight(@Self);
+            if SH<>B then
+              if SH then
+                SetFlags(Flags or efSyntaxHighlight)
+              else
+                SetFlags(Flags and not efSyntaxHighlight);
+          end;
+      end;
+  end;
+  inherited HandleEvent(Event);
 end;
 end;
 
 
 function TFileEditor.Valid(Command: Word): Boolean;
 function TFileEditor.Valid(Command: Word): Boolean;
@@ -2808,6 +2876,8 @@ function StdEditorDialog(Dialog: Integer; Info: Pointer): Word;
 var
 var
   R: TRect;
   R: TRect;
   T: TPoint;
   T: TPoint;
+  Re: word;
+  Name: string;
 begin
 begin
   case Dialog of
   case Dialog of
     edOutOfMemory:
     edOutOfMemory:
@@ -2823,15 +2893,24 @@ begin
       StdEditorDialog := MessageBox('Error creating file %s.',
       StdEditorDialog := MessageBox('Error creating file %s.',
         @Info, mfInsertInApp+ mfError + mfOkButton);
         @Info, mfInsertInApp+ mfError + mfOkButton);
     edSaveModify:
     edSaveModify:
-      StdEditorDialog := MessageBox(#3'%s'#13#13#3'has been modified. Save?',
+      StdEditorDialog := MessageBox('%s has been modified. Save?',
         @Info, mfInsertInApp+ mfInformation + mfYesNoCancel);
         @Info, mfInsertInApp+ mfInformation + mfYesNoCancel);
     edSaveUntitled:
     edSaveUntitled:
-      StdEditorDialog := MessageBox(#3'Save untitled file?',
+      StdEditorDialog := MessageBox('Save untitled file?',
         nil, mfInsertInApp+ mfInformation + mfYesNoCancel);
         nil, mfInsertInApp+ mfInformation + mfYesNoCancel);
     edSaveAs:
     edSaveAs:
-      StdEditorDialog :=
-        Application^.ExecuteDialog(New(PFileDialog, Init('*.*',
-        'Save file as', '~N~ame', fdOkButton, 101)), Info);
+      begin
+        Name:=PString(Info)^;
+        Re:=Application^.ExecuteDialog(New(PFileDialog, Init('*.*',
+        'Save file as', '~N~ame', fdOkButton, 101)), @Name);
+        if (Re<>cmCancel) and (Name<>PString(Info)^) then
+          if ExistsFile(Name) then
+            if EditorDialog(edReplaceFile,@Name)<>cmYes then
+              Re:=cmCancel;
+        if Re<>cmCancel then
+          PString(Info)^:=Name;
+        StdEditorDialog := Re;
+      end;
     edGotoLine:
     edGotoLine:
       StdEditorDialog :=
       StdEditorDialog :=
         Application^.ExecuteDialog(CreateGotoLineDialog(Info), Info);
         Application^.ExecuteDialog(CreateGotoLineDialog(Info), Info);
@@ -2856,14 +2935,29 @@ begin
         StdEditorDialog := MessageBoxRect(R, 'Replace this occurence?',
         StdEditorDialog := MessageBoxRect(R, 'Replace this occurence?',
           nil, mfInsertInApp+ mfYesNoCancel + mfInformation);
           nil, mfInsertInApp+ mfYesNoCancel + mfInformation);
       end;
       end;
+    edReplaceFile :
+      StdEditorDialog :=
+        MessageBox('File %s already exists. Overwrite?',@Info,mfInsertInApp+mfConfirmation+
+          mfYesButton+mfNoButton);
   end;
   end;
 end;
 end;
 
 
+function DefUseSyntaxHighlight(Editor: PFileEditor): boolean;
+begin
+  DefUseSyntaxHighlight:=(Editor^.Flags and efSyntaxHighlight)<>0;
+end;
+
 END.
 END.
 {
 {
   $Log$
   $Log$
-  Revision 1.3  1998-12-30 10:16:20  peter
-    * forward search for FPC
+  Revision 1.4  1999-01-04 11:49:55  peter
+   * 'Use tab characters' now works correctly
+   + Syntax highlight now acts on File|Save As...
+   + Added a new class to syntax highlight: 'hex numbers'.
+   * There was something very wrong with the palette managment. Now fixed.
+   + Added output directory (-FE<xxx>) support to 'Directories' dialog...
+   * Fixed some possible bugs in Running/Compiling, and the compilation/run
+     process revised
 
 
   Revision 1.2  1998/12/28 15:47:55  peter
   Revision 1.2  1998/12/28 15:47:55  peter
     + Added user screen support, display & window
     + Added user screen support, display & window