Procházet zdrojové kódy

Merged revisions 8761,8766-8769,8772,8776,8794,8797-8798,8807,8821-8822,8831,8848-8849,8851,8854-8855,8857-8858 via svnmerge from
http://svn.freepascal.org/svn/fpc/trunk

........
r8761 | florian | 2007-10-10 21:38:38 +0200 (Mi, 10 Okt 2007) | 2 lines

* don't mark a file modified in case of an empty paste, resolves #6320
........
r8772 | florian | 2007-10-12 18:22:27 +0200 (Fr, 12 Okt 2007) | 2 lines

* enabled Shift-F11 and Shift-F2 for tools
........
r8776 | florian | 2007-10-13 15:21:33 +0200 (Sa, 13 Okt 2007) | 2 lines

* display compilation time, resolves #9926
........
r8794 | florian | 2007-10-14 15:34:50 +0200 (So, 14 Okt 2007) | 2 lines

* fixed two backward searching issues: #7112 and #9663
........
r8798 | florian | 2007-10-14 18:22:39 +0200 (So, 14 Okt 2007) | 2 lines

* use always insert mode when replacing text, resolves #9476
........
r8807 | florian | 2007-10-14 21:26:34 +0200 (So, 14 Okt 2007) | 2 lines

+ show path in IDE breakpoint list, resolves #9873
........
r8821 | florian | 2007-10-15 23:00:41 +0200 (Mo, 15 Okt 2007) | 4 lines

o resolve #7277:
* fixed tab order on options/dirs./misc.
* tfpmemo sends esc now properly
........
r8854 | florian | 2007-10-19 23:39:16 +0200 (Fr, 19 Okt 2007) | 2 lines

* because EXEFile was changed into an ansistring, @EXEFile was wrong, fixed, resolves #9057
........
r8855 | florian | 2007-10-19 23:54:51 +0200 (Fr, 19 Okt 2007) | 2 lines

* write location of configuration files
........
r8857 | florian | 2007-10-20 00:34:31 +0200 (Sa, 20 Okt 2007) | 2 lines

* check if breakpoint name is assigned when displaying breakpoints in the disassembly window, resolves #9257
........
r8858 | florian | 2007-10-20 00:36:33 +0200 (Sa, 20 Okt 2007) | 2 lines

* small 64 bit compatibility fixes
........

git-svn-id: branches/fixes_2_2@8879 -

florian před 18 roky
rodič
revize
bce3212e63
8 změnil soubory, kde provedl 243 přidání a 169 odebrání
  1. 3 1
      ide/fp.pas
  2. 31 18
      ide/fpcompil.pas
  3. 17 8
      ide/fpdebug.pas
  4. 15 1
      ide/fpmopts.inc
  5. 7 3
      ide/fpmrun.inc
  6. 4 2
      ide/fptools.pas
  7. 6 2
      ide/fpviews.pas
  8. 160 134
      ide/weditor.pas

+ 3 - 1
ide/fp.pas

@@ -368,6 +368,8 @@ BEGIN
   StreamError:=@MyStreamError;
 
   ShowReadme:=ShowReadme or (LocateFile(INIFileName)='');
+  if LocateFile(INIFileName)<>'' then
+    writeln(bullet+' Using configuration files from: ',DirOf(LocateFile(INIFileName)));
 
 {$ifdef VESA}
   InitVESAScreenModes;
@@ -458,7 +460,7 @@ BEGIN
             if (application<>nil) and (ideapp.displaymode=dmIDE) then
               begin
                 P.l1:=SeenExitCode;
-                ErrS:=hexstr(longint(SeenErrorAddr),8);
+                ErrS:=hexstr(PtrUInt(SeenErrorAddr),sizeof(PtrUInt)*2);
                 P.s:=@ErrS;
                 if OKCancelBox(error_programexitedwitherror,@P)=cmCancel then
                   UserWantsToGoOn:=true;

+ 31 - 18
ide/fpcompil.pas

@@ -84,9 +84,11 @@ type
     TCompilerStatusDialog = object(TCenterDialog)
       ST    : PAdvancedStaticText;
       KeyST : PColorStaticText;
+      starttime : real;
       constructor Init;
       destructor Done;virtual;
       procedure   Update;
+      procedure SetStartTime(r : real);
     end;
 
     TFPInputFile = class(tinputfile)
@@ -551,12 +553,30 @@ end;
                           CompilerStatusDialog
 ****************************************************************************}
 
+function getrealtime : real;
+var
+{$IFDEF USE_SYSUTILS}
+  h,m,s,s1000 : word;
+{$ELSE USE_SYSUTILS}
+  h,m,s,s100 : word;
+{$ENDIF USE_SYSUTILS}
+begin
+{$IFDEF USE_SYSUTILS}
+  DecodeTime(Time,h,m,s,s1000);
+  getrealtime:=h*3600.0+m*60.0+s+s1000/1000.0;
+{$ELSE USE_SYSUTILS}
+  gettime(h,m,s,s100);
+  getrealtime:=h*3600.0+m*60.0+s+s100/100.0;
+{$ENDIF USE_SYSUTILS}
+end;
+
 constructor TCompilerStatusDialog.Init;
 var R: TRect;
 begin
   R.Assign(0,0,56,11);
   ClearFormatParams; AddFormatParamStr(KillTilde(SwitchesModeName[SwitchesMode]));
   inherited Init(R, FormatStrF(dialog_compilingwithmode, FormatParams));
+  starttime:=getrealtime;
   GetExtent(R); R.B.Y:=11;
   R.Grow(-3,-2);
   New(ST, Init(R, ''));
@@ -576,10 +596,16 @@ begin
   Inherited Done;
 end;
 
+procedure TCompilerStatusDialog.SetStartTime(r : real);
+  begin
+    starttime:=r;
+  end;
+
 procedure TCompilerStatusDialog.Update;
 var
   StatusS,KeyS: string;
   hstatus : TFPCHeapStatus;
+  r : real;
 const
   MaxFileNameSize = 46;
 begin
@@ -642,6 +668,9 @@ begin
   AddFormatParamInt(hstatus.CurrHeapUsed div 1024);
   AddFormatParamInt(hstatus.CurrHeapSize div 1024);
   AddFormatParamInt(Status.ErrorCount);
+  r:=getrealtime;
+  AddFormatParamInt(trunc(r-starttime));
+  AddFormatParamInt(trunc(frac(r-starttime)*10));
   ST^.SetText(
    FormatStrF(
     'Main file: %s'#13+
@@ -649,7 +678,7 @@ begin
     'Target: %s'#13+
     'Line number: %6d     '+'Total lines:      %6d'+#13+
     'Used memory: %6dK    '+'Allocated memory: %6dK'#13+
-    'Total errors: %5d',
+    'Total errors:%6d     '+'Compile time: %8d.%1ds',
    FormatParams)
   );
   KeyST^.SetText(^C+KeyS);
@@ -660,23 +689,6 @@ end;
                                Compiler Hooks
 ****************************************************************************}
 
-function getrealtime : real;
-var
-{$IFDEF USE_SYSUTILS}
-  h,m,s,s1000 : word;
-{$ELSE USE_SYSUTILS}
-  h,m,s,s100 : word;
-{$ENDIF USE_SYSUTILS}
-begin
-{$IFDEF USE_SYSUTILS}
-  DecodeTime(Time,h,m,s,s1000);
-  getrealtime:=h*3600.0+m*60.0+s+s1000/1000.0;
-{$ELSE USE_SYSUTILS}
-  gettime(h,m,s,s100);
-  getrealtime:=h*3600.0+m*60.0+s+s100/100.0;
-{$ENDIF USE_SYSUTILS}
-end;
-
 const
   lasttime  : real = 0;
 
@@ -911,6 +923,7 @@ begin
   if not assigned(CompilingHiddenFile) then
     begin
       New(CompilerStatusDialog, Init);
+      CompilerStatusDialog^.SetStartTime(getrealtime);
       CompilerStatusDialog^.SetState(sfModal,true);
       { disable window closing }
       CompilerStatusDialog^.Flags:=CompilerStatusDialog^.Flags and not wfclose;

+ 17 - 8
ide/fpdebug.pas

@@ -476,7 +476,7 @@ const
 
       { Breakpoints window }
       dialog_breakpointlist = 'Breakpoint list';
-      label_breakpointpropheader = ' Type      | State   | Position          | Ignore | Conditions ';
+      label_breakpointpropheader = ' Type      | State   | Position          | Path                        | Ignore | Conditions ';
 
       dialog_modifynewbreakpoint = 'Modify/New Breakpoint';
       label_breakpoint_name = '~N~ame';
@@ -1818,9 +1818,12 @@ procedure TBreakpointCollection.ShowBreakpoints(W : PFPWindow);
           end
         else
           begin
-            Val('$'+P^.Name^,HAddr,code);
-            If (P^.typ=bt_address) and (PDL^.Address=HAddr) then
-              PDisassemblyWindow(W)^.Editor^.SetLineFlagState(i,lfBreakpoint,P^.state=bs_enabled);
+            if assigned(P^.Name) then
+              begin
+                Val('$'+P^.Name^,HAddr,code);
+                If (P^.typ=bt_address) and (PDL^.Address=HAddr) then
+                  PDisassemblyWindow(W)^.Editor^.SetLineFlagState(i,lfBreakpoint,P^.state=bs_enabled);
+              end;
           end;
       end;
   end;
@@ -1978,15 +1981,21 @@ begin
        S:=S+' ';
      S:=S+'|';
      if (typ=bt_file_line) then
-       S:=S+NameAndExtOf(GetStr(FileName))+':'+IntToStr(Line)
-         else
+       begin
+         S:=S+NameAndExtOf(GetStr(FileName))+':'+IntToStr(Line);
+         While Length(S)<40 do
+           S:=S+' ';
+         S:=S+'|';
+         S:=S+copy(DirOf(GetStr(FileName)),1,min(length(DirOf(GetStr(FileName))),29));
+       end
+     else
        S:=S+GetStr(name);
-     While Length(S)<40 do
+     While Length(S)<70 do
        S:=S+' ';
      S:=S+'|';
      if IgnoreCount>0 then
        S:=S+IntToStr(IgnoreCount);
-     While Length(S)<49 do
+     While Length(S)<79 do
        S:=S+' ';
      S:=S+'|';
      if assigned(Conditions) then

+ 15 - 1
ide/fpmopts.inc

@@ -698,7 +698,8 @@ var tab:Ptab;
     IL:array[0..11] of PEditorInputLine;
     misc_items:PTabItem;
     misc_tabfocus:Pview;
-
+    newmisc_items,
+    temp : PTabItem;
 const LW=25;
 
 begin
@@ -777,6 +778,19 @@ begin
         end;
     end;
 
+  { revert items for correct tab order }
+  newmisc_items:=nil;
+  while assigned(misc_items) do
+    begin
+      { get element }
+      temp:=misc_items;
+      misc_items:=temp^.next;
+      { put element }
+      temp^.next:=newmisc_items;
+      newmisc_items:=temp;
+    end;
+  misc_items:=newmisc_items;
+
   {Create some tabs in the window.}
   tabR.assign(1,1,d^.size.x-2,d^.size.y-1);
   new(tab,init(tabR,

+ 7 - 3
ide/fpmrun.inc

@@ -180,6 +180,7 @@ procedure TIDEApp.DoRun;
 var
   RunDirect : boolean;
   oldcurrdir : string;
+  s : shortstring;
 begin
 {$ifndef NODEBUG}
   if not assigned(Debugger) or not Debugger^.HasExe or not Debugger^.IsRunning then
@@ -207,9 +208,10 @@ begin
          ErrorBox(msg_nothingtorun,nil);
          Exit;
        end;
+      s:=EXEFile;
       if not ExistsFile(ExeFile) then
         begin
-          MsgParms[1].Ptr:=@EXEFile;
+          MsgParms[1].Ptr:=@s;
           ErrorBox(msg_invalidfilename,@MsgParms);
           Exit;
         end;
@@ -256,15 +258,17 @@ begin
       { In case we have something that the compiler touched }
       AskToReloadAllModifiedFiles;
       LastExitCode:=ExecuteResult;
+
+      s:=EXEFile;
       If IOStatus<>0 then
         begin
-          MsgParms[1].Ptr:=@EXEFile;
+          MsgParms[1].Ptr:=@s;
           MsgParms[2].long:=IOStatus;
           InformationBox(msg_programnotrundoserroris,@MsgParms);
         end
       else If LastExitCode<>0 then
         begin
-          MsgParms[1].Ptr:=@EXEFile;
+          MsgParms[1].Ptr:=@s;
           MsgParms[2].long:=LastExitCode;
           InformationBox(msg_programfileexitedwithexitcode,@MsgParms);
         end;

+ 4 - 2
ide/fptools.pas

@@ -213,7 +213,7 @@ type
     end;
 
 const
-     HotKeys : array[0..9] of THotKeyDef =
+     HotKeys : array[0..11] of THotKeyDef =
       ( (Name : '~U~nassigned' ; KeyCode : kbNoKey   ),
         (Name : 'Shift+F~2~'   ; KeyCode : kbShiftF2 ),
         (Name : 'Shift+F~3~'   ; KeyCode : kbShiftF3 ),
@@ -223,7 +223,9 @@ const
         (Name : 'Shift+F~7~'   ; KeyCode : kbShiftF7 ),
         (Name : 'Shift+F~8~'   ; KeyCode : kbShiftF8 ),
         (Name : 'Shift+F~9~'   ; KeyCode : kbShiftF9 ),
-        (Name : 'Shift+F~1~0'  ; KeyCode : kbShiftF10));
+        (Name : 'Shift+F1~0~'  ; KeyCode : kbShiftF10),
+        (Name : 'Shift+F1~1~'  ; KeyCode : kbShiftF11),
+        (Name : 'Shift+~F~12'  ; KeyCode : kbShiftF12));
 
      Tools     : PToolCollection = nil;
      AbortTool : boolean         = false;

+ 6 - 2
ide/fpviews.pas

@@ -2676,7 +2676,7 @@ var
   LI : PEditorLineInfo;
 begin
    if AAddress<>0 then
-     inherited AddLine('$'+hexstr(AAddress,8)+S)
+     inherited AddLine('$'+hexstr(AAddress,sizeof(PtrUInt)*2)+S)
    else
      inherited AddLine(S);
    PL:=DisasLines^.At(DisasLines^.count-1);
@@ -4500,7 +4500,11 @@ begin
         DontClear:=false;
         case Event.KeyCode of
           kbEsc:
-            Message(Owner,evCommand,cmCancel,nil);
+            begin
+              Event.What:=evCommand;
+              Event.Command:=cmCancel;
+              PutEvent(Event);
+            end;
         else DontClear:=true;
         end;
         if not DontClear then ClearEvent(Event);

+ 160 - 134
ide/weditor.pas

@@ -5902,7 +5902,6 @@ begin
      InsertFrom(Clipboard);
      if ShowInfo then
        PopInfo;
-     SetModified(true);
    end;
   CloseGroupedAction(eaPaste);
   UnLock;
@@ -6052,6 +6051,7 @@ var S: string;
     Re: word;
     IFindStr : string;
     BT : BTable;
+    Overwriting : boolean;
 
   function ContainsText(const SubS:string;var S: string; Start: Sw_integer): Sw_integer;
   var
@@ -6150,8 +6150,16 @@ begin
      AreaEnd:=SelEnd;
    end;
 
-  X:=CurPos.X-DX;
-  Y:=CurPos.Y;;
+  { set a y value being inside the areal }
+  Y:=Min(CurPos.Y,Count-1);
+
+  if sForward then
+    X:=CurPos.X-1
+  else
+    { if you change this, pleas check that repeated backward searching for single chars still works
+      and that data is still found if searching starts outside the current line }
+    X:=Min(CurPos.X,length(GetDisplayText(Y)));
+
   if SearchRunCount=1 then
     if (FindFlags and ffmOrigin)=ffEntireScope then
       if SForward then
@@ -6186,147 +6194,165 @@ begin
   if not DoReplace or (not Confirm and (Owner<>nil)) then
     Owner^.Lock;
   if InArea(X,Y) then
-  repeat
-    CurDY:=DY;
-    S:=GetDisplayText(Y);
+    repeat
+      CurDY:=DY;
+      S:=GetDisplayText(Y);
+      if X>length(S)-1 then
+        X:=length(S)-1;
 {$ifdef TEST_REGEXP}
-    if UseRegExp then
-       begin
-         getmem(findstrpchar,length(Copy(S,X+1,high(S)))+1);
-         strpcopy(findstrpchar,Copy(S,X+1,high(S)));
-         { If start of line is required do check other positions PM }
-         if (FindStr[1]='^') and (X<>0) then
-           Found:=false
-         else
-           Found:=RegExprPos(RegExpEngine,findstrpchar,regexpindex,regexplen);
-         strdispose(findstrpchar);
-         P:=regexpindex+X+1;
-       end
-    else
+      if UseRegExp then
+         begin
+           getmem(findstrpchar,length(Copy(S,X+1,high(S)))+1);
+           strpcopy(findstrpchar,Copy(S,X+1,high(S)));
+           { If start of line is required do check other positions PM }
+           if (FindStr[1]='^') and (X<>0) then
+             Found:=false
+           else
+             Found:=RegExprPos(RegExpEngine,findstrpchar,regexpindex,regexplen);
+           strdispose(findstrpchar);
+           P:=regexpindex+X+1;
+         end
+      else
 {$endif TEST_REGEXP}
-      begin
-        P:=ContainsText(FindStr,S,X+1);
-        Found:=P<>0;
-      end;
-    if Found then
-      begin
-        A.X:=P-1;
-        A.Y:=Y;
-        B.Y:=Y;
+        begin
+          P:=ContainsText(FindStr,S,X+1);
+          Found:=P<>0;
+        end;
+      if Found then
+        begin
+          A.X:=P-1;
+          A.Y:=Y;
+          B.Y:=Y;
 {$ifdef TEST_REGEXP}
-        if UseRegExp then
-          B.X:=A.X+regexplen
-        else
+          if UseRegExp then
+            B.X:=A.X+regexplen
+          else
 {$endif TEST_REGEXP}
-          B.X:=A.X+length(FindStr);
-      end;
-    Found:=Found and InArea(A.X,A.Y);
+            B.X:=A.X+length(FindStr);
+        end;
+      Found:=Found and InArea(A.X,A.Y);
 
-    if Found and ((FindFlags and ffWholeWordsOnly)<>0) then
-     begin
-       LeftOK:=(A.X<=0) or (not( (S[A.X] in AlphaChars) or (S[A.X] in NumberChars) ));
-       RightOK:=(B.X>=length(S)) or (not( (S[B.X+1] in AlphaChars) or (S[B.X+1] in NumberChars) ));
-       Found:=LeftOK and RightOK;
-       if not Found then
-         begin
-           CurDY:=0;
-           X:=B.X+1;
-         end;
-     end;
+      if Found and ((FindFlags and ffWholeWordsOnly)<>0) then
+       begin
+         LeftOK:=(A.X<=0) or (not( (S[A.X] in AlphaChars+NumberChars) ));
+         RightOK:=(B.X>=length(S)) or (not( (S[B.X+1] in AlphaChars+NumberChars) ));
+         Found:=LeftOK and RightOK;
+         if not Found then
+           begin
+             CurDY:=0;
+             If SForward then
+               begin
+                 X:=B.X+1;
+                 if X>length(S) then
+                   CurDY:=DY;
+               end
+             else
+               begin
+                 X:=A.X-1;
+                 if X<0 then
+                   CurDY:=DY;
+               end;
+           end;
+       end;
 
-    if Found then
-      begin
-        Inc(FoundCount);
-        Lock;
-        if SForward then
-         SetCurPtr(B.X,B.Y)
-        else
-         SetCurPtr(A.X,A.Y);
-        TrackCursor(do_centre);
-        SetHighlight(A,B);
-        UnLock;
-        CurDY:=0;
-        if not DoReplace then
-          begin
-            CanExit:=true;
-            If SForward then
-              begin
-                X:=B.X;
-                Y:=B.Y;
-              end
-            else
-              begin
-                X:=A.X;
-                Y:=A.Y;
-              end;
-          end
-        else
-          begin
-            if not confirm then
-              CanReplace:=true
-            else
-              begin
-                Re:=EditorDialog(edReplacePrompt,@CurPos);
-                case Re of
-                  cmYes :
-                    CanReplace:=true;
-                  cmNo :
-                    CanReplace:=false;
-                  else {cmCancel}
-                    begin
+      if Found then
+        begin
+          Inc(FoundCount);
+          Lock;
+          if SForward then
+           SetCurPtr(B.X,B.Y)
+          else
+           SetCurPtr(A.X,A.Y);
+          TrackCursor(do_centre);
+          SetHighlight(A,B);
+          UnLock;
+          CurDY:=0;
+          if not DoReplace then
+            begin
+              CanExit:=true;
+              If SForward then
+                begin
+                  X:=B.X;
+                  Y:=B.Y;
+                end
+              else
+                begin
+                  X:=A.X;
+                  Y:=A.Y;
+                end;
+            end
+          else
+            begin
+              if not confirm then
+                CanReplace:=true
+              else
+                begin
+                  Re:=EditorDialog(edReplacePrompt,@CurPos);
+                  case Re of
+                    cmYes :
+                      CanReplace:=true;
+                    cmNo :
                       CanReplace:=false;
-                      CanExit:=true;
+                    else {cmCancel}
+                      begin
+                        CanReplace:=false;
+                        CanExit:=true;
+                      end;
+                  end;
+                end;
+              if CanReplace then
+                begin
+                  Lock;
+                  { don't use SetInsertMode here because it changes the cursor shape }
+                  overwriting:=(GetFlags and efInsertMode)=0;
+                  SetFlags(GetFlags or efInsertMode);
+                  SetSelection(A,B);
+                  DelSelect;
+                  InsertText(ReplaceStr);
+                  if SForward then
+                    begin
+                      X:=CurPos.X;
+                      Y:=CurPos.Y;
+                    end
+                  else
+                    begin
+                      X:=A.X;
+                      Y:=A.Y;
+                    end;
+                  if overwriting then
+                    SetFlags(GetFlags and (not efInsertMode));
+                  UnLock;
+                end
+              else
+                begin
+                  If SForward then
+                    begin
+                      X:=B.X;
+                      Y:=B.Y;
+                    end
+                  else
+                    begin
+                      X:=A.X;
+                      Y:=A.Y;
                     end;
                 end;
-              end;
-            if CanReplace then
-              begin
-                Lock;
-                SetSelection(A,B);
-                DelSelect;
-                InsertText(ReplaceStr);
-                if SForward then
-                  begin
-                    X:=CurPos.X;
-                    Y:=CurPos.Y;
-                  end
-                else
-                  begin
-                    X:=A.X;
-                    Y:=A.Y;
-                  end;
-                UnLock;
-              end
-            else
-              begin
-                If SForward then
-                  begin
-                    X:=B.X;
-                    Y:=B.Y;
-                  end
-                else
-                  begin
-                    X:=A.X;
-                    Y:=A.Y;
-                  end;
-              end;
-            if (DoReplaceAll=false) then
-              CanExit:=true;
-          end;
-      end;
+              if (DoReplaceAll=false) then
+                CanExit:=true;
+            end;
+        end;
 
-    if (CanExit=false) and (CurDY<>0) then
-      begin
-        inc(Y,CurDY);
-        if SForward then
-          X:=0
-        else
-          X:=254;
-        CanExit:=(Y>=Count) or (Y<0);
-      end;
-    if not CanExit then
-      CanExit:=not InArea(X,Y);
-  until CanExit;
+      if (CanExit=false) and (CurDY<>0) then
+        begin
+          inc(Y,CurDY);
+          if SForward then
+            X:=0
+          else
+            X:=254;
+          CanExit:=((Y>=Count) and sForward) or (Y<0);
+        end;
+      if not CanExit then
+        CanExit:=(not InArea(X,Y)) and sForward;
+    until CanExit;
   if (FoundCount=0) or (DoReplace) then
     SetHighlight(CurPos,CurPos);
   if (DoReplace=false) or ((Confirm=false) and (Owner<>nil)) then