Browse Source

* fixed couple of bugs

peter 26 years ago
parent
commit
c3351959a2
7 changed files with 119 additions and 17 deletions
  1. 6 3
      ide/text/fp.pas
  2. 15 1
      ide/text/fpcompil.pas
  3. 6 1
      ide/text/fpide.pas
  4. 7 3
      ide/text/fpmhelp.inc
  5. 12 1
      ide/text/fptools.pas
  6. 5 1
      ide/text/fpviews.pas
  7. 68 7
      ide/text/weditor.pas

+ 6 - 3
ide/text/fp.pas

@@ -30,9 +30,9 @@ uses
   FPIDE,FPCalc,FPCompile,
   FPIni,FPViews,FPConst,FPVars,FPUtils,FPHelp,FPSwitch,FPUsrScr,
   FPTools,{$ifndef NODEBUG}FPDebug,{$endif}FPTemplt,FPCatch,FPRedir,FPDesk
-{$ifdef TEMPHEAP}
+{$ifdef FPC}
   ,dpmiexcp
-{$endif TEMPHEAP}
+{$endif FPC}
   ;
 
 
@@ -191,7 +191,10 @@ BEGIN
 END.
 {
   $Log$
-  Revision 1.21  1999-04-07 21:55:40  peter
+  Revision 1.22  1999-05-22 13:44:28  peter
+    * fixed couple of bugs
+
+  Revision 1.21  1999/04/07 21:55:40  peter
     + object support for browser
     * html help fixes
     * more desktop saving things

+ 15 - 1
ide/text/fpcompil.pas

@@ -56,6 +56,7 @@ type
       function    GetPalette: PPalette; virtual;
       procedure   Close;virtual;
       destructor  Done; virtual;
+      procedure   SizeLimits(var Min, Max: TPoint); virtual;
       procedure   AddMessage(AClass: longint;const Msg, Module: string; Line, Column: longint);
       procedure   ClearMessages;
       constructor Load(var S: TStream);
@@ -196,8 +197,10 @@ begin
   HelpCtx:=hcMessagesWindow;
 
   HSB:=StandardScrollBar(sbHorizontal+sbHandleKeyboard);
+  HSB^.GrowMode:=gfGrowLoY+gfGrowHiX+gfGrowHiY;
   Insert(HSB);
   VSB:=StandardScrollBar(sbVertical+sbHandleKeyboard);
+  VSB^.GrowMode:=gfGrowLoX+gfGrowHiX+gfGrowHiY;
   Insert(VSB);
 
   GetExtent(R);
@@ -256,6 +259,14 @@ begin
 end;
 
 
+procedure TCompilerMessageWindow.SizeLimits(var Min, Max: TPoint);
+begin
+  inherited SizeLimits(Min,Max);
+  Min.X:=20;
+  Min.Y:=4;
+end;
+
+
 procedure TCompilerMessageWindow.Close;
 begin
   Hide;
@@ -553,7 +564,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.26  1999-05-02 14:29:35  peter
+  Revision 1.27  1999-05-22 13:44:29  peter
+    * fixed couple of bugs
+
+  Revision 1.26  1999/05/02 14:29:35  peter
     * fixed typo disableredir -> redirdisable
 
   Revision 1.25  1999/04/29 22:58:09  pierre

+ 6 - 1
ide/text/fpide.pas

@@ -456,6 +456,8 @@ begin
              SaveCancelled:=true;
            cmUpdateTools :
              UpdateTools;
+           cmCommandSetChanged :
+             UpdateMenu(MenuBar^.Menu);
            cmUpdate              :
              Update;
            cmSourceWndClosing :
@@ -738,7 +740,10 @@ end;
 END.
 {
   $Log$
-  Revision 1.26  1999-04-07 21:55:47  peter
+  Revision 1.27  1999-05-22 13:44:30  peter
+    * fixed couple of bugs
+
+  Revision 1.26  1999/04/07 21:55:47  peter
     + object support for browser
     * html help fixes
     * more desktop saving things

+ 7 - 3
ide/text/fpmhelp.inc

@@ -1,6 +1,6 @@
 {
     $Id$
-    This file is part of the Free Pascal Integrated Development Environment
+    This file is part of the ffff
     Copyright (c) 1998 by Berczi Gabor
 
     Help menu entries
@@ -190,11 +190,15 @@ end;
 
 {
   $Log$
-  Revision 1.6  1999-03-01 15:41:56  peter
+  Revision 1.7  1999-05-22 13:44:31  peter
+    * fixed couple of bugs
+
+  Revision 1.6  1999/03/01 15:41:56  peter
     + Added dummy entries for functions not yet implemented
     * MenuBar didn't update itself automatically on command-set changes
     * Fixed Debugging/Profiling options dialog
-    * TCodeEditor converts spaces to tabs at save only if efUseTabChars is
 set
+    * TCodeEditor converts spaces to tabs at save only if efUseTabChars is
+ set
     * efBackSpaceUnindents works correctly
     + 'Messages' window implemented
     + Added '$CAP MSG()' and '$CAP EDIT' to available tool-macros

+ 12 - 1
ide/text/fptools.pas

@@ -110,6 +110,7 @@ type
       constructor Load(var S: TStream);
       procedure   Store(var S: TStream);
       destructor  Done; virtual;
+      procedure   SizeLimits(var Min, Max: TPoint); virtual;
     private
       MsgLB : PToolMessageListBox;
     end;
@@ -1448,6 +1449,13 @@ begin
   inherited HandleEvent(Event);
 end;
 
+procedure TMessagesWindow.SizeLimits(var Min, Max: TPoint);
+begin
+  inherited SizeLimits(Min,Max);
+  Min.X:=20;
+  Min.Y:=4;
+end;
+
 function TMessagesWindow.GetPalette: PPalette;
 const S: string[length(CBrowserWindow)] = CBrowserWindow;
 begin
@@ -1486,7 +1494,10 @@ end;
 END.
 {
   $Log$
-  Revision 1.8  1999-04-07 21:55:54  peter
+  Revision 1.9  1999-05-22 13:44:32  peter
+    * fixed couple of bugs
+
+  Revision 1.8  1999/04/07 21:55:54  peter
     + object support for browser
     * html help fixes
     * more desktop saving things

+ 5 - 1
ide/text/fpviews.pas

@@ -1252,6 +1252,7 @@ end;
 constructor TMessageListBox.Init(var Bounds: TRect; AHScrollBar, AVScrollBar: PScrollBar);
 begin
   inherited Init(Bounds,1,AHScrollBar, AVScrollBar);
+  GrowMode:=gfGrowLoX+gfGrowHiX+gfGrowHiY;
   New(ModuleNames, Init(50,100));
   NoSelection:=true;
 end;
@@ -2606,7 +2607,10 @@ end;
 END.
 {
   $Log$
-  Revision 1.29  1999-04-15 08:58:08  peter
+  Revision 1.30  1999-05-22 13:44:33  peter
+    * fixed couple of bugs
+
+  Revision 1.29  1999/04/15 08:58:08  peter
     * syntax highlight fixes
     * browser updates
 

+ 68 - 7
ide/text/weditor.pas

@@ -282,6 +282,8 @@ type
       procedure HideSelect; virtual;
       procedure CopyBlock; virtual;
       procedure MoveBlock; virtual;
+      procedure IdentBlock; virtual;
+      procedure UnidentBlock; virtual;
       procedure AddChar(C: char); virtual;
       function  ClipCopy: Boolean; virtual;
       procedure ClipCut; virtual;
@@ -430,11 +432,12 @@ const
     Ord('H'), cmDelStart, Ord('R'), cmTextStart,
     Ord('S'), cmLineStart, Ord('Y'), cmDelEnd,
     Ord('G'), cmJumpLine, Ord('P'), cmReplace );
-  BlockKeyCount = 6;
+  BlockKeyCount = 8;
   BlockKeys: array[0..BlockKeyCount * 2] of Word = (BlockKeyCount,
     Ord('B'), cmStartSelect, Ord('C'), cmCopyBlock,
     Ord('H'), cmHideSelect, Ord('K'), cmEndSelect,
-    Ord('Y'), cmDelSelect, Ord('V'), cmMoveBlock);
+    Ord('Y'), cmDelSelect, Ord('V'), cmMoveBlock,
+    Ord('I'), cmIdentBlock, Ord('U'), cmUnidentBlock);
   KeyMap: array[0..2] of Pointer = (@FirstKeys, @QuickKeys, @BlockKeys);
 
 function ScanKeyMap(KeyMap: Pointer; KeyCode: Word): Word;
@@ -1194,6 +1197,8 @@ begin
           cmDelSelect   : DelSelect;
           cmCopyBlock   : CopyBlock;
           cmMoveBlock   : MoveBlock;
+          cmIdentBlock   : IdentBlock;
+          cmUnidentBlock : UnidentBlock;
         { ------ }
           cmFind        : Find;
           cmReplace     : Replace;
@@ -1890,8 +1895,8 @@ begin
     SetDisplayText(CurPos.Y,copy(S,1,CurPos.X-1+1));
     if PointOfs(SelStart)<>PointOfs(SelEnd) then { !!! check it - it's buggy !!! }
       begin SelEnd.Y:=CurPos.Y+1; SelEnd.X:=length(GetLineText(CurPos.Y+1))-SelBack; end;
-    UpdateAttrs(CurPos.Y,attrAll);
     SetCurPtr(Ind,CurPos.Y+1);
+    UpdateAttrs(CurPos.Y,attrAll);
   end else
   begin
     if CurPos.Y=GetLineCount-1 then
@@ -1972,6 +1977,7 @@ begin
      Delete(S,CurPos.X+1,1);
      SetLineText(CurPos.Y,S);
    end;
+  SetCurPtr(CurPos.X,CurPos.Y);
   UpdateAttrs(CurPos.Y,attrAll);
   DrawLines(CurPos.Y);
   Modified:=true;
@@ -2000,6 +2006,7 @@ begin
   if (S<>'') and (CurPos.X<>length(S)) then
   begin
     SetLineText(CurPos.Y,copy(S,1,CurPos.X));
+    SetCurPtr(CurPos.X,CurPos.Y);
     UpdateAttrs(CurPos.Y,attrAll);
     DrawLines(CurPos.Y);
     Modified:=true;
@@ -2105,8 +2112,8 @@ begin
        end;
     Inc(LineDelta);
   end;
-  SetCurPtr(LastX,CurLine-1);
   HideSelect;
+  SetCurPtr(LastX,CurLine-1);
   UpdateAttrs(CurPos.Y,attrAll);
   DrawLines(CurPos.Y);
   Modified:=true;
@@ -2148,6 +2155,52 @@ begin
   Dispose(Temp, Done);
 end;
 
+procedure TCodeEditor.IdentBlock;
+var
+  ey,i : Sw_integer;
+  S : String;
+begin
+  if IsReadOnly then Exit;
+  if (SelStart.X=SelEnd.X) and (SelStart.Y=SelEnd.Y) then Exit;
+  ey:=selend.y;
+  if selend.x=0 then
+   dec(ey);
+  for i:=selstart.y to ey do
+   begin
+     S:=GetLineText(i);
+     SetLineText(i,' '+S);
+   end;
+  SetCurPtr(CurPos.X,CurPos.Y);
+  UpdateAttrs(SelStart.Y,attrAll);
+  DrawLines(CurPos.Y);
+  Modified:=true;
+  UpdateIndicator;
+end;
+
+procedure TCodeEditor.UnidentBlock;
+var
+  ey,i : Sw_integer;
+  S : String;
+begin
+  if IsReadOnly then Exit;
+  if (SelStart.X=SelEnd.X) and (SelStart.Y=SelEnd.Y) then Exit;
+  ey:=selend.y;
+  if selend.x=0 then
+   dec(ey);
+  for i:=selstart.y to ey do
+   begin
+     S:=GetLineText(i);
+     if (length(s)>1) and (S[1]=' ') then
+      Delete(s,1,1);
+     SetLineText(i,S);
+   end;
+  SetCurPtr(CurPos.X,CurPos.Y);
+  UpdateAttrs(SelStart.Y,attrAll);
+  DrawLines(CurPos.Y);
+  Modified:=true;
+  UpdateIndicator;
+end;
+
 procedure TCodeEditor.AddChar(C: char);
 const OpenBrackets  : string[10] = '[({';
       CloseBrackets : string[10] = '])}';
@@ -2213,7 +2266,8 @@ begin
   if Clipboard<>nil then
      if Clipboard^.InsertFrom(@Self) then
      begin
-       DelSelect;
+       if not IsClipBoard then
+        DelSelect;
        Modified:=true;
        UpdateIndicator;
      end;
@@ -2931,11 +2985,15 @@ begin
       OK:=GetLineCount<MaxLineCount;
     end;
     if OK=false then EditorDialog(edTooManyLines,nil);
+    SetCurPtr(CurPos.X,CurPos.Y);
     UpdateAttrs(StartPos.Y,attrAll);
     LimitsChanged;
     SetSelection(CurPos,SEnd);
     if IsClipboard then
-       begin Inc(DestPos.X,length(S)); SetCurPtr(DestPos.X,DestPos.Y); end;
+     begin
+       Inc(DestPos.X,length(S));
+       SetCurPtr(DestPos.X,DestPos.Y);
+     end;
     DrawView;
   end;
   InsertFrom:=OK;
@@ -3513,7 +3571,10 @@ end;
 END.
 {
   $Log$
-  Revision 1.30  1999-04-15 08:58:10  peter
+  Revision 1.31  1999-05-22 13:44:35  peter
+    * fixed couple of bugs
+
+  Revision 1.30  1999/04/15 08:58:10  peter
     * syntax highlight fixes
     * browser updates