瀏覽代碼

* Adjusting the selection when the editor didn't contain any line.
* Reserved word recognition redesigned, but this didn't affect the overall
syntax highlight speed remarkably (at least not on my Amd-K6/350).
The syntax scanner loop is a bit slow but the main problem is the
recognition of special symbols. Switching off symbol processing boosts
the performance up to ca. 200%...
* The editor didn't allow copying (for ex to clipboard) of a single character
* 'File|Save as' caused permanently run-time error 3. Not any more now...
* Compiler Messages window (actually the whole desktop) did not act on any
keypress when compilation failed and thus the window remained visible
+ Message windows are now closed upon pressing Esc
+ At 'Run' the IDE checks whether any sources are modified, and recompiles
only when neccessary
+ BlockRead and BlockWrite (Ctrl+K+R/W) implemented in TCodeEditor
+ LineSelect (Ctrl+K+L) implemented
* The IDE had problems closing help windows before saving the desktop

peter 26 年之前
父節點
當前提交
629a079611

+ 121 - 16
ide/text/fpcompil.pas

@@ -80,6 +80,7 @@ const
     CompilerStatusDialog  : PCompilerStatusDialog = nil;
 
 procedure DoCompile(Mode: TCompileMode);
+function  NeedRecompile: boolean;
 
 procedure RegisterFPCompile;
 
@@ -92,7 +93,7 @@ uses
 {$endif}
   Dos,Video,
   App,Commands,
-  CompHook, systems,
+  CompHook, systems, browcol,
   WUtils,WEditor,
 {$ifdef redircompiler}
   FPRedir,
@@ -210,6 +211,8 @@ begin
   GetExtent(R);
   R.Grow(-1,-1);
   New(MsgLB, Init(R, HSB, VSB));
+
+  MsgLB^.GrowMode:=gfGrowHiX+gfGrowHiY;
   Insert(MsgLB);
   CompilerMessageWindow:=@self;
 end;
@@ -475,6 +478,28 @@ begin
   GetExePath:=CompleteDir(FExpand(Path));
 end;
 
+function GetMainFile: string;
+var FileName: string;
+    P : PSourceWindow;
+begin
+  P:=Message(Desktop,evBroadcast,cmSearchWindow,nil);
+  if (PrimaryFileMain='') and (P=nil) then
+    FileName:='' { nothing to compile }
+  else
+    begin
+      if PrimaryFileMain<>'' then
+        FileName:=PrimaryFileMain
+      else
+        begin
+          if P^.Editor^.Modified and (not P^.Editor^.Save) then
+            FileName:='*' { file not saved }
+          else
+            FileName:=P^.Editor^.FileName;
+        end;
+    end;
+  FileName:=FixFileName(FExpand(FileName));
+  GetMainFile:=FileName;
+end;
 
 procedure DoCompile(Mode: TCompileMode);
 
@@ -486,7 +511,6 @@ procedure DoCompile(Mode: TCompileMode);
   end;
 
 var
-  P : PSourceWindow;
   FileName: string;
   E : TEvent;
 const
@@ -494,27 +518,23 @@ const
 
 begin
 { Get FileName }
-  P:=Message(Desktop,evBroadcast,cmSearchWindow,nil);
-  if (PrimaryFileMain='') and (P=nil) then
+  FileName:=GetMainFile;
+  if FileName='' then
     begin
       ErrorBox('Oooops, nothing to compile.',nil);
       Exit;
-    end;
-  if PrimaryFileMain<>'' then
-    FileName:=PrimaryFileMain
-  else
+    end else
+  if FileName='*' then
     begin
-      if P^.Editor^.Modified and (not P^.Editor^.Save) then
-       begin
-         ErrorBox('Can''t compile unsaved file.',nil);
-         Exit;
-       end;
-      FileName:=P^.Editor^.FileName;
+      ErrorBox('Can''t compile unsaved file.',nil);
+      Exit;
     end;
+  PrevMainFile:=MainFile;
+  MainFile:=FileName;
   WriteSwitches(SwitchesPath);
   { leaving open browsers leads to crashes !! (PM) }
   CloseAllBrowsers;
-  MainFile:=FixFileName(FExpand(FileName));
+{  MainFile:=FixFileName(FExpand(FileName));}
   If GetEXEPath<>'' then
     EXEFile:=FixFileName(GetEXEPath+NameOf(MainFile)+ExeExt)
   else
@@ -599,6 +619,73 @@ begin
   releasetempheap;
   unsplit_heap;
 {$endif TEMPHEAP}
+  if Assigned(CompilerMessageWindow) then
+    with CompilerMessageWindow^ do
+    if GetState(sfVisible) then
+      begin
+        SetState(sfSelected,false);
+        SetState(sfSelected,true);
+      end;
+  { ^^^ we need this trick to reactivate the desktop }
+  EditorModified:=false;
+end;
+
+function GetFileTime(const FileName: string): longint;
+var T: longint;
+    f: file;
+    FM: integer;
+begin
+  if FileName='' then
+    T:=-1
+  else
+    begin
+      FM:=FileMode; FileMode:=0;
+      EatIO; DosError:=0;
+      Assign(f,FileName);
+      {$I-}
+      Reset(f);
+      GetFTime(f,T);
+      Close(f);
+      {$I+}
+      if (EatIO<>0) or (DosError<>0) then T:=-1;
+      FileMode:=FM;
+    end;
+  GetFileTime:=T;
+end;
+
+function NeedRecompile: boolean;
+var Need: boolean;
+    I: sw_integer;
+    SF: PSourceFile;
+    SourceTime,PPUTime,ObjTime: longint;
+begin
+  if Assigned(SourceFiles)=false then
+     Need:={(EditorModified=true)}true
+  else
+    begin
+      Need:=(PrevMainFile<>GetMainFile) and (PrevMainFile<>'');
+      if Need=false then
+        for I:=0 to SourceFiles^.Count-1 do
+          begin
+            SF:=SourceFiles^.At(I);
+            SourceTime:=GetFileTime(SF^.GetSourceFileName);
+            PPUTime:=GetFileTime(SF^.GetPPUFileName);
+            ObjTime:=GetFileTime(SF^.GetObjFileName);
+{            writeln('S: ',SF^.GetSourceFileName,' - ',SourceTime);
+            writeln('P: ',SF^.GetPPUFileName,' - ',PPUTime);
+            writeln('O: ',SF^.GetObjFileName,' - ',ObjTime);
+            writeln('------');}
+            if (SourceTime<>-1) then
+              if (SourceTime>PPUTime) or (SourceTime>ObjTime) then
+                begin
+                  Need:=true;
+                  Break;
+                end;
+          end;
+{      writeln('Need?', Need); system.readln;}
+    end;
+
+  NeedRecompile:=Need;
 end;
 
 procedure RegisterFPCompile;
@@ -613,7 +700,25 @@ end;
 end.
 {
   $Log$
-  Revision 1.33  1999-08-03 20:22:26  peter
+  Revision 1.34  1999-08-16 18:25:13  peter
+    * Adjusting the selection when the editor didn't contain any line.
+    * Reserved word recognition redesigned, but this didn't affect the overall
+      syntax highlight speed remarkably (at least not on my Amd-K6/350).
+      The syntax scanner loop is a bit slow but the main problem is the
+      recognition of special symbols. Switching off symbol processing boosts
+      the performance up to ca. 200%...
+    * The editor didn't allow copying (for ex to clipboard) of a single character
+    * 'File|Save as' caused permanently run-time error 3. Not any more now...
+    * Compiler Messages window (actually the whole desktop) did not act on any
+      keypress when compilation failed and thus the window remained visible
+    + Message windows are now closed upon pressing Esc
+    + At 'Run' the IDE checks whether any sources are modified, and recompiles
+      only when neccessary
+    + BlockRead and BlockWrite (Ctrl+K+R/W) implemented in TCodeEditor
+    + LineSelect (Ctrl+K+L) implemented
+    * The IDE had problems closing help windows before saving the desktop
+
+  Revision 1.33  1999/08/03 20:22:26  peter
     + TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
     + Desktop saving should work now
        - History saved

+ 21 - 1
ide/text/fpconst.pas

@@ -26,6 +26,8 @@ const
      MaxRecentFileCount   = 5;
      MaxToolCount         = 16;
 
+     ReservedWordMaxLen   = 16;
+
      CompilerStatusUpdateDelay = 0.8; { in secs }
 
      ININame              = 'fp.ini';
@@ -341,7 +343,25 @@ implementation
 END.
 {
   $Log$
-  Revision 1.23  1999-08-03 20:22:27  peter
+  Revision 1.24  1999-08-16 18:25:14  peter
+    * Adjusting the selection when the editor didn't contain any line.
+    * Reserved word recognition redesigned, but this didn't affect the overall
+      syntax highlight speed remarkably (at least not on my Amd-K6/350).
+      The syntax scanner loop is a bit slow but the main problem is the
+      recognition of special symbols. Switching off symbol processing boosts
+      the performance up to ca. 200%...
+    * The editor didn't allow copying (for ex to clipboard) of a single character
+    * 'File|Save as' caused permanently run-time error 3. Not any more now...
+    * Compiler Messages window (actually the whole desktop) did not act on any
+      keypress when compilation failed and thus the window remained visible
+    + Message windows are now closed upon pressing Esc
+    + At 'Run' the IDE checks whether any sources are modified, and recompiles
+      only when neccessary
+    + BlockRead and BlockWrite (Ctrl+K+R/W) implemented in TCodeEditor
+    + LineSelect (Ctrl+K+L) implemented
+    * The IDE had problems closing help windows before saving the desktop
+
+  Revision 1.23  1999/08/03 20:22:27  peter
     + TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
     + Desktop saving should work now
        - History saved

+ 19 - 3
ide/text/fpdebug.pas

@@ -1825,8 +1825,6 @@ end;
 function TWatchItemDialog.Execute: Word;
 var R: word;
     S1,S2: string;
-    err: word;
-    L: longint;
 begin
   S1:=GetStr(Watch^.expr);
   NameIL^.SetData(S1);
@@ -1952,7 +1950,25 @@ end.
 
 {
   $Log$
-  Revision 1.24  1999-08-03 20:22:28  peter
+  Revision 1.25  1999-08-16 18:25:15  peter
+    * Adjusting the selection when the editor didn't contain any line.
+    * Reserved word recognition redesigned, but this didn't affect the overall
+      syntax highlight speed remarkably (at least not on my Amd-K6/350).
+      The syntax scanner loop is a bit slow but the main problem is the
+      recognition of special symbols. Switching off symbol processing boosts
+      the performance up to ca. 200%...
+    * The editor didn't allow copying (for ex to clipboard) of a single character
+    * 'File|Save as' caused permanently run-time error 3. Not any more now...
+    * Compiler Messages window (actually the whole desktop) did not act on any
+      keypress when compilation failed and thus the window remained visible
+    + Message windows are now closed upon pressing Esc
+    + At 'Run' the IDE checks whether any sources are modified, and recompiles
+      only when neccessary
+    + BlockRead and BlockWrite (Ctrl+K+R/W) implemented in TCodeEditor
+    + LineSelect (Ctrl+K+L) implemented
+    * The IDE had problems closing help windows before saving the desktop
+
+  Revision 1.24  1999/08/03 20:22:28  peter
     + TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
     + Desktop saving should work now
        - History saved

+ 21 - 3
ide/text/fpdesk.pas

@@ -18,8 +18,8 @@ unit FPDesk;
 interface
 
 const
-     DesktopVersion     = $0001; { <- if you change any Load&Store methods,
-                                      then you should change also this }
+     DesktopVersion     = $0002; { <- if you change any Load&Store methods,
+                                      then you should also change this }
 
      ResDesktopFlags    = 'FLAGS';
      ResHistory         = 'HISTORY';
@@ -300,7 +300,25 @@ end;
 END.
 {
   $Log$
-  Revision 1.7  1999-08-03 20:22:30  peter
+  Revision 1.8  1999-08-16 18:25:16  peter
+    * Adjusting the selection when the editor didn't contain any line.
+    * Reserved word recognition redesigned, but this didn't affect the overall
+      syntax highlight speed remarkably (at least not on my Amd-K6/350).
+      The syntax scanner loop is a bit slow but the main problem is the
+      recognition of special symbols. Switching off symbol processing boosts
+      the performance up to ca. 200%...
+    * The editor didn't allow copying (for ex to clipboard) of a single character
+    * 'File|Save as' caused permanently run-time error 3. Not any more now...
+    * Compiler Messages window (actually the whole desktop) did not act on any
+      keypress when compilation failed and thus the window remained visible
+    + Message windows are now closed upon pressing Esc
+    + At 'Run' the IDE checks whether any sources are modified, and recompiles
+      only when neccessary
+    + BlockRead and BlockWrite (Ctrl+K+R/W) implemented in TCodeEditor
+    + LineSelect (Ctrl+K+L) implemented
+    * The IDE had problems closing help windows before saving the desktop
+
+  Revision 1.7  1999/08/03 20:22:30  peter
     + TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
     + Desktop saving should work now
        - History saved

+ 24 - 2
ide/text/fphelp.pas

@@ -389,7 +389,11 @@ procedure CloseHelpWindows;
 procedure CloseIfHelpWindow(P: PView); {$ifndef FPC}far;{$endif}
 begin
   if P^.HelpCtx=hcHelpWindow then
-    Message(P,evCommand,cmClose,nil);
+    begin
+      Message(P,evCommand,cmClose,nil);
+      Dispose(P, Done); { help windows are only hidden on close so we've
+                          to destroy them manually }
+    end;
 end;
 begin
   Desktop^.ForEach(@CloseIfHelpWindow);
@@ -399,7 +403,25 @@ end;
 END.
 {
   $Log$
-  Revision 1.20  1999-08-03 20:22:31  peter
+  Revision 1.21  1999-08-16 18:25:17  peter
+    * Adjusting the selection when the editor didn't contain any line.
+    * Reserved word recognition redesigned, but this didn't affect the overall
+      syntax highlight speed remarkably (at least not on my Amd-K6/350).
+      The syntax scanner loop is a bit slow but the main problem is the
+      recognition of special symbols. Switching off symbol processing boosts
+      the performance up to ca. 200%...
+    * The editor didn't allow copying (for ex to clipboard) of a single character
+    * 'File|Save as' caused permanently run-time error 3. Not any more now...
+    * Compiler Messages window (actually the whole desktop) did not act on any
+      keypress when compilation failed and thus the window remained visible
+    + Message windows are now closed upon pressing Esc
+    + At 'Run' the IDE checks whether any sources are modified, and recompiles
+      only when neccessary
+    + BlockRead and BlockWrite (Ctrl+K+R/W) implemented in TCodeEditor
+    + LineSelect (Ctrl+K+L) implemented
+    * The IDE had problems closing help windows before saving the desktop
+
+  Revision 1.20  1999/08/03 20:22:31  peter
     + TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
     + Desktop saving should work now
        - History saved

+ 21 - 2
ide/text/fpide.pas

@@ -364,8 +364,9 @@ begin
       NewStatusKey('~'+EnterSign+'~ Goto source', kbEnter, cmMsgGotoSource,
       NewStatusKey('~Space~ Track source', kbNoKey, cmMsgTrackSource,
       NewStatusKey('~Alt+F10~ Local menu', kbAltF10, cmLocalMenu,
+      NewStatusKey('', kbEsc, cmClose,
       StdStatusKeys(
-      nil))))),
+      nil)))))),
     NewStatusDef(hcCalcWindow, hcCalcWindow,
       NewStatusKey('~F1~ Help', kbF1, cmHelp,
       NewStatusKey('~Esc~ Close', kbEsc, cmClose,
@@ -814,7 +815,25 @@ end;
 END.
 {
   $Log$
-  Revision 1.34  1999-08-03 20:22:32  peter
+  Revision 1.35  1999-08-16 18:25:19  peter
+    * Adjusting the selection when the editor didn't contain any line.
+    * Reserved word recognition redesigned, but this didn't affect the overall
+      syntax highlight speed remarkably (at least not on my Amd-K6/350).
+      The syntax scanner loop is a bit slow but the main problem is the
+      recognition of special symbols. Switching off symbol processing boosts
+      the performance up to ca. 200%...
+    * The editor didn't allow copying (for ex to clipboard) of a single character
+    * 'File|Save as' caused permanently run-time error 3. Not any more now...
+    * Compiler Messages window (actually the whole desktop) did not act on any
+      keypress when compilation failed and thus the window remained visible
+    + Message windows are now closed upon pressing Esc
+    + At 'Run' the IDE checks whether any sources are modified, and recompiles
+      only when neccessary
+    + BlockRead and BlockWrite (Ctrl+K+R/W) implemented in TCodeEditor
+    + LineSelect (Ctrl+K+L) implemented
+    * The IDE had problems closing help windows before saving the desktop
+
+  Revision 1.34  1999/08/03 20:22:32  peter
     + TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
     + Desktop saving should work now
        - History saved

+ 20 - 2
ide/text/fpmfile.inc

@@ -62,7 +62,7 @@ begin
     if TE<>nil then
     begin
       StartTemplate(LB^.Focused,TE^.Editor);
-      TE^.Editor^.Modified:=false; { if nothing changes, we don't need to save it }
+      TE^.Editor^.SetModified(false); { if nothing changes, we don't need to save it }
       TE^.Hide; { we need this trick to get the editor updated }
       TE^.Show;
     end;
@@ -179,7 +179,25 @@ end;
 
 {
   $Log$
-  Revision 1.12  1999-08-03 20:22:34  peter
+  Revision 1.13  1999-08-16 18:25:20  peter
+    * Adjusting the selection when the editor didn't contain any line.
+    * Reserved word recognition redesigned, but this didn't affect the overall
+      syntax highlight speed remarkably (at least not on my Amd-K6/350).
+      The syntax scanner loop is a bit slow but the main problem is the
+      recognition of special symbols. Switching off symbol processing boosts
+      the performance up to ca. 200%...
+    * The editor didn't allow copying (for ex to clipboard) of a single character
+    * 'File|Save as' caused permanently run-time error 3. Not any more now...
+    * Compiler Messages window (actually the whole desktop) did not act on any
+      keypress when compilation failed and thus the window remained visible
+    + Message windows are now closed upon pressing Esc
+    + At 'Run' the IDE checks whether any sources are modified, and recompiles
+      only when neccessary
+    + BlockRead and BlockWrite (Ctrl+K+R/W) implemented in TCodeEditor
+    + LineSelect (Ctrl+K+L) implemented
+    * The IDE had problems closing help windows before saving the desktop
+
+  Revision 1.12  1999/08/03 20:22:34  peter
     + TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
     + Desktop saving should work now
        - History saved

+ 31 - 5
ide/text/fpmopts.inc

@@ -694,12 +694,20 @@ var D: PCenterDialog;
     ExtIL,TabExtIL: PInputLine;
     TabSize: Integer;
     EFlags: Longint;
+    Title: string;
 begin
-  if Editor=nil
-     then begin TabSize:=DefaultTabSize; EFlags:=DefaultCodeEditorFlags; end
-     else begin TabSize:=Editor^.TabSize; EFlags:=Editor^.Flags; end;
+  if Editor=nil then
+    begin
+      TabSize:=DefaultTabSize; EFlags:=DefaultCodeEditorFlags;
+      Title:='Default Editor Options';
+    end
+  else
+    begin
+      TabSize:=Editor^.TabSize; EFlags:=Editor^.Flags;
+      Title:='Editor Options';
+    end;
   R.Assign(0,0,56,18);
-  New(D, Init(R, 'Editor Options'));
+  New(D, Init(R, Title));
   with D^ do
   begin
     GetExtent(R); R.Grow(-2,-2); R.B.Y:=R.A.Y+7;
@@ -1065,7 +1073,25 @@ end;
 
 {
   $Log$
-  Revision 1.24  1999-03-23 16:16:40  peter
+  Revision 1.25  1999-08-16 18:25:21  peter
+    * Adjusting the selection when the editor didn't contain any line.
+    * Reserved word recognition redesigned, but this didn't affect the overall
+      syntax highlight speed remarkably (at least not on my Amd-K6/350).
+      The syntax scanner loop is a bit slow but the main problem is the
+      recognition of special symbols. Switching off symbol processing boosts
+      the performance up to ca. 200%...
+    * The editor didn't allow copying (for ex to clipboard) of a single character
+    * 'File|Save as' caused permanently run-time error 3. Not any more now...
+    * Compiler Messages window (actually the whole desktop) did not act on any
+      keypress when compilation failed and thus the window remained visible
+    + Message windows are now closed upon pressing Esc
+    + At 'Run' the IDE checks whether any sources are modified, and recompiles
+      only when neccessary
+    + BlockRead and BlockWrite (Ctrl+K+R/W) implemented in TCodeEditor
+    + LineSelect (Ctrl+K+L) implemented
+    * The IDE had problems closing help windows before saving the desktop
+
+  Revision 1.24  1999/03/23 16:16:40  peter
     * linux fixes
 
   Revision 1.23  1999/03/23 15:11:33  peter

+ 20 - 2
ide/text/fpmrun.inc

@@ -100,7 +100,7 @@ end;
 
 procedure TIDEApp.DoRun;
 begin
-  if (not ExistsFile(ExeFile)) or (CompilationPhase<>cpDone) then
+  if (not ExistsFile(ExeFile)) or (CompilationPhase<>cpDone) or NeedRecompile then
    DoCompile(cRun);
   if CompilationPhase<>cpDone then
      Exit;
@@ -238,7 +238,25 @@ end;
 
 {
   $Log$
-  Revision 1.17  1999-07-28 23:11:20  peter
+  Revision 1.18  1999-08-16 18:25:23  peter
+    * Adjusting the selection when the editor didn't contain any line.
+    * Reserved word recognition redesigned, but this didn't affect the overall
+      syntax highlight speed remarkably (at least not on my Amd-K6/350).
+      The syntax scanner loop is a bit slow but the main problem is the
+      recognition of special symbols. Switching off symbol processing boosts
+      the performance up to ca. 200%...
+    * The editor didn't allow copying (for ex to clipboard) of a single character
+    * 'File|Save as' caused permanently run-time error 3. Not any more now...
+    * Compiler Messages window (actually the whole desktop) did not act on any
+      keypress when compilation failed and thus the window remained visible
+    + Message windows are now closed upon pressing Esc
+    + At 'Run' the IDE checks whether any sources are modified, and recompiles
+      only when neccessary
+    + BlockRead and BlockWrite (Ctrl+K+R/W) implemented in TCodeEditor
+    + LineSelect (Ctrl+K+L) implemented
+    * The IDE had problems closing help windows before saving the desktop
+
+  Revision 1.17  1999/07/28 23:11:20  peter
     * fixes from gabor
 
   Revision 1.16  1999/07/12 13:14:19  pierre

+ 20 - 2
ide/text/fpusrscr.pas

@@ -458,14 +458,32 @@ begin
   if UserScreen<>nil then
    begin
      UserScreen^.SwitchTo;
-     Dispose(UserScreen, Done);
+     Dispose(UserScreen, Done); UserScreen:=nil;
    end;
 end;
 
 end.
 {
   $Log$
-  Revision 1.4  1999-06-28 19:32:25  peter
+  Revision 1.5  1999-08-16 18:25:24  peter
+    * Adjusting the selection when the editor didn't contain any line.
+    * Reserved word recognition redesigned, but this didn't affect the overall
+      syntax highlight speed remarkably (at least not on my Amd-K6/350).
+      The syntax scanner loop is a bit slow but the main problem is the
+      recognition of special symbols. Switching off symbol processing boosts
+      the performance up to ca. 200%...
+    * The editor didn't allow copying (for ex to clipboard) of a single character
+    * 'File|Save as' caused permanently run-time error 3. Not any more now...
+    * Compiler Messages window (actually the whole desktop) did not act on any
+      keypress when compilation failed and thus the window remained visible
+    + Message windows are now closed upon pressing Esc
+    + At 'Run' the IDE checks whether any sources are modified, and recompiles
+      only when neccessary
+    + BlockRead and BlockWrite (Ctrl+K+R/W) implemented in TCodeEditor
+    + LineSelect (Ctrl+K+L) implemented
+    * The IDE had problems closing help windows before saving the desktop
+
+  Revision 1.4  1999/06/28 19:32:25  peter
     * fixes from gabor
 
   Revision 1.3  1999/02/02 16:41:42  peter

+ 21 - 1
ide/text/fpvars.pas

@@ -45,6 +45,7 @@ const ClipboardWindow  : PClipboardWindow = nil;
       IsEXECompiled    : boolean = false;
       LinkAfter        : boolean = true;
       MainFile         : string{$ifdef GABOR}[80]{$endif} = '';
+      PrevMainFile     : string{$ifdef GABOR}[80]{$endif} = '';
       EXEFile          : string{$ifdef GABOR}[80]{$endif} = '';
       CompilationPhase : TCompPhase = cpNothing;
       ProgramInfoWindow: PProgramInfoWindow = nil;
@@ -69,6 +70,7 @@ const ClipboardWindow  : PClipboardWindow = nil;
       DesktopLocation  : byte    = dlConfigFileDir;
       AutoSaveOptions  : longint = asEnvironment+asDesktop;
       MiscOptions      : longint = moChangeDirOnOpen+moCloseOnGotoSource;
+      EditorModified   : boolean = false;
 
       ActionCommands   : array[acFirstAction..acLastAction] of word =
         (cmHelpTopicSearch,cmGotoCursor,cmToggleBreakpoint,
@@ -83,7 +85,25 @@ implementation
 END.
 {
   $Log$
-  Revision 1.21  1999-08-03 20:22:38  peter
+  Revision 1.22  1999-08-16 18:25:25  peter
+    * Adjusting the selection when the editor didn't contain any line.
+    * Reserved word recognition redesigned, but this didn't affect the overall
+      syntax highlight speed remarkably (at least not on my Amd-K6/350).
+      The syntax scanner loop is a bit slow but the main problem is the
+      recognition of special symbols. Switching off symbol processing boosts
+      the performance up to ca. 200%...
+    * The editor didn't allow copying (for ex to clipboard) of a single character
+    * 'File|Save as' caused permanently run-time error 3. Not any more now...
+    * Compiler Messages window (actually the whole desktop) did not act on any
+      keypress when compilation failed and thus the window remained visible
+    + Message windows are now closed upon pressing Esc
+    + At 'Run' the IDE checks whether any sources are modified, and recompiles
+      only when neccessary
+    + BlockRead and BlockWrite (Ctrl+K+R/W) implemented in TCodeEditor
+    + LineSelect (Ctrl+K+L) implemented
+    * The IDE had problems closing help windows before saving the desktop
+
+  Revision 1.21  1999/08/03 20:22:38  peter
     + TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
     + Desktop saving should work now
        - History saved

+ 45 - 17
ide/text/fpviews.pas

@@ -111,6 +111,7 @@ type
       function    GetLocalMenu: PMenu; virtual;
       function    GetCommandTarget: PView; virtual;
       function    CreateLocalMenuView(var Bounds: TRect; M: PMenu): PMenuPopup; virtual;
+      procedure   ModifiedChanged; virtual;
     end;
 
     PSourceWindow = ^TSourceWindow;
@@ -415,7 +416,8 @@ const
 
 const
   NoNameCount    : integer = 0;
-  ReservedWords  : PUnsortedStringCollection = nil;
+var
+  ReservedWords  : array[1..ReservedWordMaxLen] of PStringCollection;
 
 {****************************************************************************
                                 TStoreCollection
@@ -600,38 +602,39 @@ begin
 end;
 
 procedure InitReservedWords;
-var S,WordS: string;
+var WordS: string;
     Idx,I: integer;
 begin
-  New(ReservedWords, Init(50,10));
+  for I:=Low(ReservedWords) to High(ReservedWords) do
+    New(ReservedWords[I], Init(50,10));
   for I:=1 to GetReservedWordCount do
     begin
       WordS:=GetReservedWord(I-1); Idx:=length(WordS);
-      while ReservedWords^.Count<Idx do
-        ReservedWords^.Insert(NewStr(#0));
-      S:=ReservedWords^.At(Idx-1)^;
-      ReservedWords^.AtFree(Idx-1);
-      ReservedWords^.AtInsert(Idx-1,NewStr(S+WordS+#0));
+      ReservedWords[Idx]^.Insert(NewStr(WordS));
     end;
 end;
 
 procedure DoneReservedWords;
+var I: integer;
 begin
-  if assigned(ReservedWords) then
-    dispose(ReservedWords,done);
+  for I:=Low(ReservedWords) to High(ReservedWords) do
+    if assigned(ReservedWords[I]) then
+      begin
+        dispose(ReservedWords[I],done);
+        ReservedWords[I]:=nil;
+      end;
 end;
 
 function IsFPReservedWord(S: string): boolean;
 var _Is: boolean;
-    Idx: integer;
-    P: PString;
+    Idx,Item: sw_integer;
 begin
   Idx:=length(S); _Is:=false;
-  if (Idx>0) and (ReservedWords<>nil) and (ReservedWords^.Count>=Idx) then
+  if (Low(ReservedWords)<=Idx) and (Idx<=High(ReservedWords)) and
+     (ReservedWords[Idx]<>nil) and (ReservedWords[Idx]^.Count<>0) then
     begin
       S:=UpcaseStr(S);
-      P:=ReservedWords^.At(Idx-1);
-      _Is:=Pos(#0+S+#0,P^)>0;
+      _Is:=ReservedWords[Idx]^.Search(@S,Item);
     end;
   IsFPReservedWord:=_Is;
 end;
@@ -741,6 +744,13 @@ begin
 end;
 {$endif EDITORS}
 
+procedure TSourceEditor.ModifiedChanged;
+begin
+  inherited ModifiedChanged;
+  if (@Self<>Clipboard) and Modified then
+    EditorModified:=true;
+end;
+
 function TSourceEditor.GetLocalMenu: PMenu;
 var M: PMenu;
 begin
@@ -1304,7 +1314,7 @@ end;
 constructor TMessageListBox.Init(var Bounds: TRect; AHScrollBar, AVScrollBar: PScrollBar);
 begin
   inherited Init(Bounds,1,AHScrollBar, AVScrollBar);
-  GrowMode:=gfGrowLoX+gfGrowHiX+gfGrowHiY;
+  GrowMode:=gfGrowHiX+gfGrowHiY;
   New(ModuleNames, Init(50,100));
   NoSelection:=true;
 end;
@@ -2700,7 +2710,25 @@ end;
 END.
 {
   $Log$
-  Revision 1.36  1999-08-03 20:22:39  peter
+  Revision 1.37  1999-08-16 18:25:26  peter
+    * Adjusting the selection when the editor didn't contain any line.
+    * Reserved word recognition redesigned, but this didn't affect the overall
+      syntax highlight speed remarkably (at least not on my Amd-K6/350).
+      The syntax scanner loop is a bit slow but the main problem is the
+      recognition of special symbols. Switching off symbol processing boosts
+      the performance up to ca. 200%...
+    * The editor didn't allow copying (for ex to clipboard) of a single character
+    * 'File|Save as' caused permanently run-time error 3. Not any more now...
+    * Compiler Messages window (actually the whole desktop) did not act on any
+      keypress when compilation failed and thus the window remained visible
+    + Message windows are now closed upon pressing Esc
+    + At 'Run' the IDE checks whether any sources are modified, and recompiles
+      only when neccessary
+    + BlockRead and BlockWrite (Ctrl+K+R/W) implemented in TCodeEditor
+    + LineSelect (Ctrl+K+L) implemented
+    * The IDE had problems closing help windows before saving the desktop
+
+  Revision 1.36  1999/08/03 20:22:39  peter
     + TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
     + Desktop saving should work now
        - History saved

+ 214 - 59
ide/text/weditor.pas

@@ -74,6 +74,8 @@ const
       edTooManyLines  = 11;
       edGotoLine      = 12;
       edReplaceFile   = 13;
+      edWriteBlock    = 14;
+      edReadBlock     = 15;
 
       ffmOptions      = $0007; ffsOptions     = 0;
       ffmDirection    = $0008; ffsDirection   = 3;
@@ -215,8 +217,10 @@ type
       procedure   LimitsChanged; virtual;
       procedure   SelectionChanged; virtual;
       procedure   HighlightChanged; virtual;
+      procedure   ModifiedChanged; virtual;
       procedure   Update; virtual;
       procedure   ScrollTo(X, Y: sw_Integer);
+      procedure   SetModified(AModified: boolean); virtual;
       procedure   SetInsertMode(InsertMode: boolean); virtual;
       procedure   SetCurPtr(X,Y: sw_integer); virtual;
       procedure   SetSelection(A, B: TPoint); virtual;
@@ -231,6 +235,7 @@ type
       procedure   Store(var S: TStream);
       function    LoadFromStream(Stream: PStream): boolean; virtual;
       function    SaveToStream(Stream: PStream): boolean; virtual;
+      function    SaveAreaToStream(Stream: PStream; StartP,EndP: TPoint): boolean;
       destructor  Done; virtual;
     public
       { Text & info storage abstraction }
@@ -1867,8 +1872,7 @@ begin
   SetCurPtr(CurPos.X+Shift,CurPos.Y);
   UpdateAttrs(CurPos.Y,attrAll);
   DrawLines(CurPos.Y);
-  Modified:=true;
-  UpdateIndicator;
+  SetModified(true);
 end;
 
 procedure TCodeEditor.CharLeft;
@@ -2149,7 +2153,7 @@ begin
     SetCurPtr(Ind,CurPos.Y+1);
   end;
   DrawLines(CurPos.Y);
-  Modified:=true; UpdateIndicator;
+  SetModified(true);
 end;
 
 procedure TCodeEditor.BreakLine;
@@ -2204,8 +2208,7 @@ begin
   UpdateAttrs(CurPos.Y,attrAll);
   AdjustSelection(CurPos.X-SCP.X,CurPos.Y-SCP.Y);
   DrawLines(CurPos.Y);
-  Modified:=true;
-  UpdateIndicator;
+  SetModified(true);
 end;
 
 procedure TCodeEditor.DelChar;
@@ -2234,8 +2237,7 @@ begin
   UpdateAttrs(CurPos.Y,attrAll);
   AdjustSelection(SDX,SDY);
   DrawLines(CurPos.Y);
-  Modified:=true;
-  UpdateIndicator;
+  SetModified(true);
 end;
 
 procedure TCodeEditor.DelWord;
@@ -2244,8 +2246,7 @@ begin
 
   NotImplemented; Exit;
 
-  Modified:=true;
-  UpdateIndicator;
+  SetModified(true);
 end;
 
 procedure TCodeEditor.DelStart;
@@ -2254,8 +2255,7 @@ begin
 
   NotImplemented; Exit;
 
-  Modified:=true;
-  UpdateIndicator;
+  SetModified(true);
 end;
 
 procedure TCodeEditor.DelEnd;
@@ -2269,8 +2269,7 @@ begin
     SetCurPtr(CurPos.X,CurPos.Y);
     UpdateAttrs(CurPos.Y,attrAll);
     DrawLines(CurPos.Y);
-    Modified:=true;
-    UpdateIndicator;
+    SetModified(true);
   end;
 end;
 
@@ -2285,8 +2284,7 @@ begin
     SetCurPtr(0,CurPos.Y);
     UpdateAttrs(Max(0,CurPos.Y-1),attrAll);
     DrawLines(CurPos.Y);
-    Modified:=true;
-    UpdateIndicator;
+    SetModified(true);
   end;
 end;
 
@@ -2352,8 +2350,8 @@ var LineDelta, LineCount, CurLine: Sw_integer;
     StartX,EndX,LastX: Sw_integer;
     S: string;
 begin
-  if IsReadOnly then Exit;
-  if (SelStart.X=SelEnd.X) and (SelStart.Y=SelEnd.Y) then Exit;
+  if IsReadOnly or (ValidBlock=false) then Exit;
+
   Lock;
   LineCount:=(SelEnd.Y-SelStart.Y)+1;
   LineDelta:=0; LastX:=CurPos.X;
@@ -2389,8 +2387,7 @@ begin
   SetCurPtr(LastX,CurLine-1);
   UpdateAttrs(CurPos.Y,attrAll);
   DrawLines(CurPos.Y);
-  Modified:=true;
-  UpdateIndicator;
+  SetModified(true);
   UnLock;
 end;
 
@@ -2404,10 +2401,8 @@ procedure TCodeEditor.CopyBlock;
 var Temp: PCodeEditor;
     R: TRect;
 begin
-  if IsReadOnly then Exit;
-  if (SelStart.X=SelEnd.X) and (SelStart.Y=SelEnd.Y) then
-    Exit;
-  { There must be no exit inside a lock .. UnLock block !! }
+  if IsReadOnly or (ValidBlock=false) then Exit;
+
   Lock;
   GetExtent(R);
   New(Temp, Init(R, nil, nil, nil,0));
@@ -2457,8 +2452,7 @@ begin
   SetCurPtr(CurPos.X,CurPos.Y);
   UpdateAttrsRange(SelStart.Y,SelEnd.Y,attrAll);
   DrawLines(CurPos.Y);
-  Modified:=true;
-  UpdateIndicator;
+  SetModified(true);
   UnLock;
 end;
 
@@ -2483,8 +2477,7 @@ begin
   SetCurPtr(CurPos.X,CurPos.Y);
   UpdateAttrsRange(SelStart.Y,SelEnd.Y,attrAll);
   DrawLines(CurPos.Y);
-  Modified:=true;
-  UpdateIndicator;
+  SetModified(true);
   UnLock;
 end;
 
@@ -2494,20 +2487,69 @@ begin
 end;
 
 procedure TCodeEditor.SelectLine;
+var A,B: TPoint;
 begin
-  NotImplemented; Exit;
+  if CurPos.Y<GetLineCount then
+    begin
+      A.Y:=CurPos.Y; A.X:=0;
+      B.Y:=CurPos.Y+1; B.X:=0;
+      SetSelection(A,B);
+    end;
 end;
 
 procedure TCodeEditor.WriteBlock;
+var FileName: string;
+    S: PBufStream;
 begin
-  NotImplemented; Exit;
+  if ValidBlock=false then Exit;
+
+  FileName:='';
+  if EditorDialog(edWriteBlock, @FileName) <> cmCancel then
+  begin
+    FileName := FExpand(FileName);
+
+    New(S, Init(FileName, stCreate, 4096));
+    if (S=nil) or (S^.Status<>stOK) then
+      EditorDialog(edCreateError,@FileName)
+    else
+      if SaveAreaToStream(S,SelStart,SelEnd)=false then
+        EditorDialog(edWriteError,@FileName);
+    if Assigned(S) then Dispose(S, Done);
+  end;
 end;
 
 procedure TCodeEditor.ReadBlock;
+var FileName: string;
+    S: PBufStream;
+    E: PCodeEditor;
+    R: TRect;
 begin
-  NotImplemented; Exit;
+  FileName:='';
+  if EditorDialog(edReadBlock, @FileName) <> cmCancel then
+  begin
+    FileName := FExpand(FileName);
+
+    New(S, Init(FileName, stOpenRead, 4096));
+    if (S=nil) or (S^.Status<>stOK) then
+      EditorDialog(edReadError,@FileName)
+    else
+      begin
+        R.Assign(0,0,0,0);
+        New(E, Init(R,nil,nil,nil,0));
+        if E^.LoadFromStream(S)=false then
+          EditorDialog(edReadError,@FileName)
+        else
+          begin
+            E^.SelectAll(true);
+            Self.InsertFrom(E);
+          end;
+        Dispose(E, Done);
+      end;
+    if Assigned(S) then Dispose(S, Done);
+  end;
 end;
 
+
 procedure TCodeEditor.PrintBlock;
 begin
   NotImplemented; Exit;
@@ -2564,8 +2606,7 @@ begin
   UpdateAttrs(CurPos.Y,attrAll);
   AdjustSelection(CurPos.X-SP.X,CurPos.Y-SP.Y);
   DrawLines(CurPos.Y);
-  Modified:=true;
-  UpdateIndicator;
+  SetModified(true);
   UnLock;
 end;
 
@@ -2589,8 +2630,7 @@ begin
     begin
       if not IsClipBoard then
        DelSelect;
-      Modified:=true;
-      UpdateIndicator;
+      SetModified(true);
     end;
   UnLock;
   DontConsiderShiftState:=false;
@@ -2604,8 +2644,7 @@ begin
   if Clipboard<>nil then
    begin
      InsertFrom(Clipboard);
-     Modified:=true;
-     UpdateIndicator;
+     SetModified(true);
    end;
   UnLock;
   DontConsiderShiftState:=false;
@@ -2914,6 +2953,15 @@ begin
   DrawCursor;
 end;
 
+procedure TCodeEditor.SetModified(AModified: boolean);
+begin
+  if AModified<>Modified then
+  begin
+    Modified:=AModified;
+    ModifiedChanged;
+  end;
+end;
+
 { there is a problem with ShiftDel here
   because GetShitState tells to extend the
   selection which gives wrong results (PM) }
@@ -2951,7 +2999,11 @@ begin
     CheckSels;
     if Extended=false then
      if PointOfs(OldPos)=PointOfs(SelEnd) then
-   begin SetSelection(SelStart,CurPos); Extended:=true; end;
+       begin
+         if ValidBlock=false then
+           SetSelection(CurPos,CurPos);
+         SetSelection(SelStart,CurPos); Extended:=true;
+       end;
     CheckSels;
     if (Extended=false) then
        if PointOfs(OldPos)<=PointOfs(CurPos)
@@ -2976,6 +3028,8 @@ begin
     SetHighlightRow(-1);
   if ((CurPos.X<>OldPos.X) or (CurPos.Y<>OldPos.Y)) then
     AddAction(eaMoveCursor,OldPos,CurPos,'');
+  if ((CurPos.X<>OldPos.X) or (CurPos.Y<>OldPos.Y)) then
+     UpdateIndicator;
   UnLock;
 end;
 
@@ -3353,7 +3407,7 @@ begin
       else
         LineEndX:=255;
 
-      if LineEndX<=LineStartX then
+      if LineEndX<LineStartX then
         S:=''
       else
         S:=RExpand(copy(Editor^.GetLineText(Editor^.SelStart.Y+LineDelta),LineStartX+1,LineEndX-LineStartX+1),
@@ -3381,6 +3435,7 @@ begin
     if OK=false then EditorDialog(edTooManyLines,nil);
     SetCurPtr(CurPos.X,CurPos.Y);
     UpdateAttrs(StartPos.Y,attrAll);
+    SetModified(true);
     LimitsChanged;
     SetSelection(CurPos,SEnd);
     if IsClipboard then
@@ -3416,9 +3471,16 @@ begin
 end;
 
 procedure TCodeEditor.SetSelection(A, B: TPoint);
+var WV: boolean;
+    OS,OE: TPoint;
 begin
+  WV:=ValidBlock;
+  OS:=SelStart; OE:=SelEnd;
   SelStart:=A; SelEnd:=B;
-  SelectionChanged;
+  if (WV=false) and (ValidBlock=false) then { do nothing } else
+    if (OS.X<>SelStart.X) or (OS.Y<>SelStart.Y) or
+       (OE.X<>SelEnd.X) or (OE.Y<>SelEnd.Y) then
+     SelectionChanged;
 end;
 
 procedure TCodeEditor.SetHighlight(A, B: TPoint);
@@ -3439,7 +3501,12 @@ begin
   if (Enable=false) or (GetLineCount=0) then
      begin A:=CurPos; B:=CurPos end
   else
-     begin A.X:=0; A.Y:=0; B.Y:=GetLineCount-1; B.X:=length(GetLineText(B.Y)); end;
+     begin
+       A.X:=0; A.Y:=0;
+{       B.Y:=GetLineCount-1;
+       B.X:=length(GetLineText(B.Y));}
+       B.Y:=GetLineCount; B.X:=0;
+     end;
   SetSelection(A,B);
   DrawView;
 end;
@@ -3447,11 +3514,17 @@ end;
 procedure TCodeEditor.SelectionChanged;
 var Enable,CanPaste: boolean;
 begin
-  if SelEnd.Y>GetLineCount-1 then
+  if GetLineCount=0 then
     begin
-      SelEnd.Y:=GetLineCount-1;
-      SelEnd.X:=length(GetDisplayText(SelEnd.Y));
-    end;
+      SelStart.X:=0; SelStart.Y:=0; SelEnd:=SelStart;
+    end
+  else
+    if SelEnd.Y>GetLineCount-1 then
+     if (SelEnd.Y<>GetLineCount) or (SelEnd.X<>0) then
+      begin
+        SelEnd.Y:=GetLineCount-1;
+        SelEnd.X:=length(GetDisplayText(SelEnd.Y));
+      end;
 
   Enable:=((SelStart.X<>SelEnd.X) or (SelStart.Y<>SelEnd.Y)) and (Clipboard<>nil);
   SetCmdState(ToClipCmds,Enable and (Clipboard<>@Self));
@@ -3460,6 +3533,7 @@ begin
        (Clipboard^.SelStart.Y<>Clipboard^.SelEnd.Y));
   SetCmdState(FromClipCmds,CanPaste  and (Clipboard<>@Self));
   Message(Application,evBroadcast,cmCommandSetChanged,nil);
+  DrawView;
 end;
 
 procedure TCodeEditor.HighlightChanged;
@@ -3467,6 +3541,11 @@ begin
   DrawView;
 end;
 
+procedure TCodeEditor.ModifiedChanged;
+begin
+  UpdateIndicator;
+end;
+
 procedure TCodeEditor.SetState(AState: Word; Enable: Boolean);
 begin
   inherited SetState(AState,Enable);
@@ -3551,7 +3630,6 @@ end;
 function TCodeEditor.LoadFromStream(Stream: PStream): boolean;
 var S: string;
     OK: boolean;
-    Line: Sw_integer;
 begin
   DeleteAllLines;
   OK:=(Stream^.Status=stOK);
@@ -3572,18 +3650,47 @@ begin
 end;
 
 function TCodeEditor.SaveToStream(Stream: PStream): boolean;
+var A,B: TPoint;
+begin
+  A.Y:=0; A.X:=0;
+  B.Y:=GetLineCount-1;
+  if GetLineCount>0 then
+    B.X:=length(GetDisplayText(B.Y))
+  else
+    B.X:=0;
+  SaveToStream:=SaveAreaToStream(Stream,A,B);
+end;
+
+function TCodeEditor.SaveAreaToStream(Stream: PStream; StartP,EndP: TPoint): boolean;
 var S: string;
     OK: boolean;
     Line: Sw_integer;
     P: PLine;
     EOL: string[2];
 begin
+  if EndP.X=0 then
+    begin
+      if EndP.Y>0 then
+        begin
+          Dec(EndP.Y);
+          EndP.X:=length(GetDisplayText(EndP.Y));
+        end
+      else
+        EndP.X:=0;
+    end
+  else
+    Dec(EndP.X);
   {$ifdef Linux}EOL:=#10;{$else}EOL:=#13#10;{$endif}
-  OK:=(Stream^.Status=stOK); Line:=0;
-  while OK and (Line<GetLineCount) do
+  OK:=(Stream^.Status=stOK); Line:=StartP.Y;
+  while OK and (Line<=EndP.Y) and (Line<GetLineCount) do
   begin
     P:=Lines^.At(Line);
-    if P^.Text=nil then S:='' else S:=P^.Text^;
+    if P^.Text=nil then S:='' else
+      begin
+        S:=P^.Text^;
+        if Line=EndP.Y then S:=copy(S,1,EndP.Y+1);
+        if Line=StartP.Y then S:=copy(S,StartP.Y+1,255);
+      end;
     if (Flags and efUseTabCharacters)<>0 then
       S:=CompressUsingTabs(S,TabSize);
     Stream^.Write(S[1],length(S));
@@ -3591,7 +3698,7 @@ begin
     Inc(Line);
     OK:=OK and (Stream^.Status=stOK);
   end;
-  SaveToStream:=OK;
+  SaveAreaToStream:=OK;
 end;
 
 destructor TCodeEditor.Done;
@@ -3689,7 +3796,7 @@ begin
   OK:=Assigned(S);
   if OK then OK:=SaveToStream(S);
   if Assigned(S) then Dispose(S, Done);
-  if OK then begin Modified:=false; UpdateIndicator; end;
+  if OK then SetModified(false);
   SaveFile:=OK;
 end;
 
@@ -3796,9 +3903,9 @@ begin
   SetSelection(SSP,SEP);
   SetCurPtr(CP.X,CP.Y);
   ScrollTo(DP.X,DP.Y);
-  Modified:=false;
+  SetModified(false);
 
-  LimitsChanged; UpdateIndicator;
+  LimitsChanged;
 end;
 
 procedure TFileEditor.Store(var S: TStream);
@@ -3980,6 +4087,8 @@ var
   Name: string;
   DriveNumber : byte;
   StoreDir,StoreDir2 : DirStr;
+  Title,DefExt: string;
+  AskOW: boolean;
 begin
   case Dialog of
     edOutOfMemory:
@@ -4000,7 +4109,7 @@ begin
     edSaveUntitled:
       StdEditorDialog := MessageBox('Save untitled file?',
    nil, mfInsertInApp+ mfInformation + mfYesNoCancel);
-    edSaveAs:
+    edSaveAs,edWriteBlock,edReadBlock:
       begin
         Name:=PString(Info)^;
         GetDir(0,StoreDir);
@@ -4015,10 +4124,35 @@ begin
             GetDir(DriveNumber,StoreDir2);
             ChDir(Copy(FileDir,1,2));
           end;
-        ChDir(FileDir);
-        Re:=Application^.ExecuteDialog(New(PFileDialog, Init('*'+DefaultSaveExt,
-          'Save file as', '~N~ame', fdOkButton, 101)), @Name);
-        if (Re<>cmCancel) and (Name<>PString(Info)^) then
+        if FileDir<>'' then
+          ChDir(FileDir);
+        case Dialog of
+          edSaveAs     :
+            begin
+              Title:='Save File As';
+              DefExt:='*'+DefaultSaveExt;
+            end;
+          edWriteBlock :
+            begin
+              Title:='Write Block to File';
+              DefExt:='';
+            end;
+          edReadBlock  :
+            begin
+              Title:='Read Block from File';
+              DefExt:='';
+            end;
+        else begin Title:='???'; DefExt:=''; end;
+        end;
+        Re:=Application^.ExecuteDialog(New(PFileDialog, Init(DefExt,
+          Title, '~N~ame', fdOkButton, 101)), @Name);
+        case Dialog of
+          edSaveAs     : AskOW:=(Name<>PString(Info)^);
+          edWriteBlock : AskOW:=true;
+          edReadBlock  : AskOW:=false;
+        else AskOW:=true;
+        end;
+        if (Re<>cmCancel) and AskOW then
           begin
             FileDir:=DirOf(FExpand(Name));
             if ExistsFile(Name) then
@@ -4027,9 +4161,12 @@ begin
           end;
         if DriveNumber<>0 then
           ChDir(StoreDir2);
+{$ifdef TP}
         if (Length(StoreDir)>1) and (StoreDir[2]=':') then
           ChDir(Copy(StoreDir,1,2));
-        ChDir(StoreDir);
+{$endif}
+        if StoreDir<>'' then
+          ChDir(StoreDir);
 
         if Re<>cmCancel then
           PString(Info)^:=Name;
@@ -4088,7 +4225,25 @@ end;
 END.
 {
   $Log$
-  Revision 1.40  1999-08-03 20:22:42  peter
+  Revision 1.41  1999-08-16 18:25:28  peter
+    * Adjusting the selection when the editor didn't contain any line.
+    * Reserved word recognition redesigned, but this didn't affect the overall
+      syntax highlight speed remarkably (at least not on my Amd-K6/350).
+      The syntax scanner loop is a bit slow but the main problem is the
+      recognition of special symbols. Switching off symbol processing boosts
+      the performance up to ca. 200%...
+    * The editor didn't allow copying (for ex to clipboard) of a single character
+    * 'File|Save as' caused permanently run-time error 3. Not any more now...
+    * Compiler Messages window (actually the whole desktop) did not act on any
+      keypress when compilation failed and thus the window remained visible
+    + Message windows are now closed upon pressing Esc
+    + At 'Run' the IDE checks whether any sources are modified, and recompiles
+      only when neccessary
+    + BlockRead and BlockWrite (Ctrl+K+R/W) implemented in TCodeEditor
+    + LineSelect (Ctrl+K+L) implemented
+    * The IDE had problems closing help windows before saving the desktop
+
+  Revision 1.40  1999/08/03 20:22:42  peter
     + TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
     + Desktop saving should work now
        - History saved

+ 24 - 1
ide/text/whelp.pas

@@ -265,6 +265,11 @@ Function GetDosTicks:longint; { returns ticks at 18.2 Hz, just like DOS }
     GetDosTicks:=MemL[$40:$6c];
   end;
 {$endif go32v2}
+{$ifdef TP}
+  begin
+    GetDosTicks:=MemL[$40:$6c];
+  end;
+{$endif go32v2}
 
 procedure DisposeRecord(var R: TRecord);
 begin
@@ -949,7 +954,25 @@ end;
 END.
 {
   $Log$
-  Revision 1.14  1999-07-18 16:26:42  florian
+  Revision 1.15  1999-08-16 18:25:29  peter
+    * Adjusting the selection when the editor didn't contain any line.
+    * Reserved word recognition redesigned, but this didn't affect the overall
+      syntax highlight speed remarkably (at least not on my Amd-K6/350).
+      The syntax scanner loop is a bit slow but the main problem is the
+      recognition of special symbols. Switching off symbol processing boosts
+      the performance up to ca. 200%...
+    * The editor didn't allow copying (for ex to clipboard) of a single character
+    * 'File|Save as' caused permanently run-time error 3. Not any more now...
+    * Compiler Messages window (actually the whole desktop) did not act on any
+      keypress when compilation failed and thus the window remained visible
+    + Message windows are now closed upon pressing Esc
+    + At 'Run' the IDE checks whether any sources are modified, and recompiles
+      only when neccessary
+    + BlockRead and BlockWrite (Ctrl+K+R/W) implemented in TCodeEditor
+    + LineSelect (Ctrl+K+L) implemented
+    * The IDE had problems closing help windows before saving the desktop
+
+  Revision 1.14  1999/07/18 16:26:42  florian
     * IDE compiles with for Win32 and basic things are working
 
   Revision 1.13  1999/04/13 10:47:51  daniel

+ 21 - 3
ide/text/whlpview.pas

@@ -125,7 +125,7 @@ type
         procedure   ChangeBounds(var Bounds: TRect); virtual;
         procedure   Draw; virtual;
         procedure   HandleEvent(var Event: TEvent); virtual;
-        procedure   SetCurPtr(X,Y: integer); virtual;
+        procedure   SetCurPtr(X,Y: sw_integer); virtual;
         function    GetLineCount: sw_integer; virtual;
         function    GetLineText(Line: sw_integer): string; virtual;
         function    GetLinkCount: integer; virtual;
@@ -578,7 +578,7 @@ begin
   LinkContainsPoint:=OK;
 end;
 
-procedure THelpViewer.SetCurPtr(X,Y: integer);
+procedure THelpViewer.SetCurPtr(X,Y: sw_integer);
 var OldCurLink,I: integer;
     OldPos,P: TPoint;
     R: TRect;
@@ -1138,7 +1138,25 @@ end;
 END.
 {
   $Log$
-  Revision 1.9  1999-06-28 19:32:35  peter
+  Revision 1.10  1999-08-16 18:25:31  peter
+    * Adjusting the selection when the editor didn't contain any line.
+    * Reserved word recognition redesigned, but this didn't affect the overall
+      syntax highlight speed remarkably (at least not on my Amd-K6/350).
+      The syntax scanner loop is a bit slow but the main problem is the
+      recognition of special symbols. Switching off symbol processing boosts
+      the performance up to ca. 200%...
+    * The editor didn't allow copying (for ex to clipboard) of a single character
+    * 'File|Save as' caused permanently run-time error 3. Not any more now...
+    * Compiler Messages window (actually the whole desktop) did not act on any
+      keypress when compilation failed and thus the window remained visible
+    + Message windows are now closed upon pressing Esc
+    + At 'Run' the IDE checks whether any sources are modified, and recompiles
+      only when neccessary
+    + BlockRead and BlockWrite (Ctrl+K+R/W) implemented in TCodeEditor
+    + LineSelect (Ctrl+K+L) implemented
+    * The IDE had problems closing help windows before saving the desktop
+
+  Revision 1.9  1999/06/28 19:32:35  peter
     * fixes from gabor
 
   Revision 1.8  1999/04/07 21:56:02  peter

+ 2 - 3
ide/text/whtmlhlp.pas

@@ -110,14 +110,13 @@ function FormatPath(Path: string): string;
 var P: sw_integer;
     SC: char;
 begin
-  if DirSep='/' then
+  if ord(DirSep)=ord('/') then
     SC:='\'
   else
     SC:='/';
 
   repeat
     P:=Pos(SC,Path);
-    if Path[P]<>SC then P:=0;
     if P>0 then Path[P]:=DirSep;
   until P=0;
   FormatPath:=Path;
@@ -605,7 +604,7 @@ begin
     begin
       if T^.HelpCtx=0 then Name:=FileName else
         begin
-          Link:=TopicLinks^.At(T^.HelpCtx-1)^;
+          Link:=TopicLinks^.At((T^.HelpCtx and $ffff)-1)^;
           Link:=FormatPath(Link);
           P:=Pos('#',Link); if P>0 then Delete(Link,P,255);
 {          if CurFileName='' then Name:=Link else