Find in files: showing skipped results

git-svn-id: trunk@9693 -
This commit is contained in:
mattias 2006-07-29 14:09:04 +00:00
parent a582185670
commit 85de8ce1f8
13 changed files with 134 additions and 83 deletions

View File

@ -275,14 +275,14 @@ var
IsHexNumberChar IsHexNumberChar
: array[char] of boolean; : array[char] of boolean;
function Min(i1, i2: integer): integer; function Min(i1, i2: integer): integer; inline;
begin begin
if i1<i2 then Result:=i1 else Result:=i2; if i1<=i2 then Result:=i1 else Result:=i2;
end; end;
function Max(i1, i2: integer): integer; function Max(i1, i2: integer): integer; inline;
begin begin
if i1>i2 then Result:=i1 else Result:=i2; if i1>=i2 then Result:=i1 else Result:=i2;
end; end;
{ most simple code tools - just methods } { most simple code tools - just methods }
@ -1981,8 +1981,14 @@ var
begin begin
while StartPos<EndPos do begin while StartPos<EndPos do begin
case Src[StartPos] of case Src[StartPos] of
'{','/': '{':
ReadComment; ReadComment;
'/':
if (StartPos<SrcLen) and (Src[StartPos]='/') then
ReadComment
else
inc(StartPos);
'(': '(':
if (StartPos<SrcLen) and (Src[StartPos]='*') then if (StartPos<SrcLen) and (Src[StartPos]='*') then

View File

@ -138,6 +138,7 @@ type
property AutoResizeViewport; property AutoResizeViewport;
property BorderSpacing; property BorderSpacing;
property Enabled; property Enabled;
property OnChangeBounds;
property OnClick; property OnClick;
property OnConstrainedResize; property OnConstrainedResize;
property OnDblClick; property OnDblClick;

View File

@ -42,7 +42,8 @@ interface
uses uses
{$IFDEF SYN_LAZARUS} {$IFDEF SYN_LAZARUS}
Math, LCLProc, LCLIntf, LCLType, SynEditTextBuffer, Messages, LMessages, LCLProc, LCLIntf, LCLType, SynEditTextBuffer, Messages, LMessages,
SynEditMiscProcs,
{$ELSE} {$ELSE}
Windows, SynEditTypes, Messages, Windows, SynEditTypes, Messages,
{$ENDIF} {$ENDIF}

View File

@ -658,14 +658,6 @@ implementation
const MaxComboBoxCount: integer = 20; const MaxComboBoxCount: integer = 20;
function Max(i, j: integer): integer;
begin
if i<=j then
Result:=j
else
Result:=i;
end;
function DebuggerNameToType(const s: string): TDebuggerType; function DebuggerNameToType(const s: string): TDebuggerType;
begin begin
for Result:=Low(TDebuggerType) to High(TDebuggerType) do for Result:=Low(TDebuggerType) to High(TDebuggerType) do

View File

@ -25,7 +25,7 @@ interface
uses uses
Classes, SysUtils, LCLProc, LCLIntf, Controls, StdCtrls, Forms, Buttons, Classes, SysUtils, LCLProc, LCLIntf, Controls, StdCtrls, Forms, Buttons,
ExtCtrls, LResources, FileUtil, LazarusIDEStrConsts, Dialogs, SynEditTypes, ExtCtrls, LResources, FileUtil, LazarusIDEStrConsts, Dialogs, SynEditTypes,
InputHistory; IDEDialogs, InputHistory;
type type
{ TLazFindInFilesDialog } { TLazFindInFilesDialog }
@ -102,9 +102,11 @@ end;
procedure TLazFindInFilesDialog.DirectoryBrowseClick(Sender: TObject); procedure TLazFindInFilesDialog.DirectoryBrowseClick(Sender: TObject);
begin begin
InitIDEFileDialog(SelectDirectoryDialog);
SelectDirectoryDialog.InitialDir := GetCurrentDir; SelectDirectoryDialog.InitialDir := GetCurrentDir;
if SelectDirectoryDialog.Execute then if SelectDirectoryDialog.Execute then
DirectoryComboBox.Text := SelectDirectoryDialog.FileName; DirectoryComboBox.Text := SelectDirectoryDialog.FileName;
StoreIDEFileDialog(SelectDirectoryDialog);
end; end;
procedure TLazFindInFilesDialog.FormCreate(Sender: TObject); procedure TLazFindInFilesDialog.FormCreate(Sender: TObject);

View File

@ -440,8 +440,7 @@ begin
OriginalFile:=TSourceLog.Create(''); OriginalFile:=TSourceLog.Create('');
OriginalFile.LoadFromFile(TheFileName); OriginalFile.LoadFromFile(TheFileName);
end else begin end else begin
OriginalFile:=TSourceLog.Create(''); OriginalFile:=TSourceLog.Create(TheText);
OriginalFile.Source:=TheText;
end; end;
// convert case // convert case
@ -583,9 +582,8 @@ begin
TrimmedCurLine:=TrimLineAndMatch(Lines,TrimmedMatch); TrimmedCurLine:=TrimLineAndMatch(Lines,TrimmedMatch);
MatchLen:=EndPos.X-StartPos.X; MatchLen:=EndPos.X-StartPos.X;
if MatchLen<1 then MatchLen:=1; if MatchLen<1 then MatchLen:=1;
SearchResultsView.AddMatch(fResultsWindow, SearchResultsView.AddMatch(fResultsWindow,FileName,StartPos,
FileName,StartPos, TrimmedCurLine, TrimmedMatch, MatchLen);
TrimmedCurLine, TrimmedMatch, MatchLen);
UpdateMatches; UpdateMatches;
end; end;

View File

@ -1,2 +1,2 @@
// Created by Svn2RevisionInc // Created by Svn2RevisionInc
const RevisionStr = '9599'; const RevisionStr = '';

View File

@ -88,10 +88,12 @@ type
TLazSearchResultLB = Class(TCustomListBox) TLazSearchResultLB = Class(TCustomListBox)
private private
fSearchObject: TLazSearch; fSearchObject: TLazSearch;
FSkipped: integer;
fUpdateStrings: TStrings; fUpdateStrings: TStrings;
fUpdating: boolean; fUpdating: boolean;
fUpdateCount: integer; fUpdateCount: integer;
fShortenPathNeeded: boolean; fShortenPathNeeded: boolean;
procedure SetSkipped(const AValue: integer);
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -101,6 +103,7 @@ type
procedure ShortenPaths; procedure ShortenPaths;
property UpdateItems: TStrings read fUpdateStrings write fUpdateStrings; property UpdateItems: TStrings read fUpdateStrings write fUpdateStrings;
property UpdateState: boolean read fUpdating; property UpdateState: boolean read fUpdating;
property Skipped: integer read FSkipped write SetSkipped;
end; end;
@ -130,10 +133,10 @@ type
procedure ListBoxDoubleClicked(Sender: TObject); procedure ListBoxDoubleClicked(Sender: TObject);
procedure SetItems(Index: Integer; Value: TStrings); procedure SetItems(Index: Integer; Value: TStrings);
function GetItems(Index: integer): TStrings; function GetItems(Index: integer): TStrings;
fOnSelectionChanged: TNotifyEvent; fOnSelectionChanged: TNotifyEvent;
fListBoxFont: TFont; fListBoxFont: TFont;
fMouseOverIndex: integer; fMouseOverIndex: integer;
procedure SetMaxItems(const AValue: integer); procedure SetMaxItems(const AValue: integer);
public public
function AddSearch(const ResultsName: string; function AddSearch(const ResultsName: string;
const SearchText: string; const SearchText: string;
@ -240,9 +243,15 @@ begin
if Assigned(CurrentLB) then if Assigned(CurrentLB) then
begin begin
if CurrentLB.UpdateState then begin if CurrentLB.UpdateState then begin
if CurrentLB.UpdateItems.Count>=MaxItems then exit; if CurrentLB.UpdateItems.Count>=MaxItems then begin
CurrentLB.Skipped:=CurrentLB.Skipped+1;
exit;
end;
end else begin end else begin
if CurrentLB.Items.Count>=MaxItems then exit; if CurrentLB.Items.Count>=MaxItems then begin
CurrentLB.Skipped:=CurrentLB.Skipped+1;
exit;
end;
end; end;
SearchPos:= TLazSearchMatchPos.Create; SearchPos:= TLazSearchMatchPos.Create;
SearchPos.MatchStart:= MatchStart; SearchPos.MatchStart:= MatchStart;
@ -317,6 +326,7 @@ begin
CurrentLB.UpdateItems.Assign(Value) CurrentLB.UpdateItems.Assign(Value)
else else
CurrentLB.Items.Assign(Value); CurrentLB.Items.Assign(Value);
CurrentLB.Skipped:=0;
end;//if end;//if
end//if end//if
end;//SetItems end;//SetItems
@ -395,8 +405,10 @@ end;//PageExists
procedure TSearchResultsView.ListBoxKeyDown(Sender: TObject; var Key: Word; procedure TSearchResultsView.ListBoxKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState); Shift: TShiftState);
begin begin
if Key = 27 then if Key = VK_ESCAPE then begin
Key:=VK_UNKNOWN;
Close; Close;
end;
end; end;
{Add Result will create a tab in the Results view window with an new {Add Result will create a tab in the Results view window with an new
@ -419,7 +431,7 @@ begin
With ResultsNoteBook do With ResultsNoteBook do
begin begin
i:= GetPageIndex(ResultsName); i:= GetPageIndex(ResultsName);
if i > -1 then if i>=0 then
begin begin
NewListBox:= GetListBox(i); NewListBox:= GetListBox(i);
ResultsNoteBook.PageIndex:= i; ResultsNoteBook.PageIndex:= i;
@ -462,6 +474,7 @@ begin
SearchObj.SearchMask:= AMask; SearchObj.SearchMask:= AMask;
SearchObj.SearchOptions:= TheOptions; SearchObj.SearchOptions:= TheOptions;
end; end;
NewListBox.Skipped:=0;
Result:= ResultsNoteBook.PageIndex; Result:= ResultsNoteBook.PageIndex;
end;//if end;//if
end;//AddResult end;//AddResult
@ -677,6 +690,36 @@ begin
end;//if end;//if
end;//GetListBox end;//GetListBox
procedure TLazSearchResultLB.SetSkipped(const AValue: integer);
var
SrcList: TStrings;
s: String;
HasSkippedLine: Boolean;
SkippedLine: String;
begin
if FSkipped=AValue then exit;
FSkipped:=AValue;
s:='Found, but not listed here: ';
if fUpdating then
SrcList:=fUpdateStrings
else
SrcList:=Items;
if (SrcList.Count>0) and (copy(SrcList[SrcList.Count-1],1,length(s))=s) then
HasSkippedLine:=true
else
HasSkippedLine:=false;
SkippedLine:=s+IntToStr(FSkipped);
if FSkipped>0 then begin
if HasSkippedLine then begin
SrcList[SrcList.Count-1]:=SkippedLine;
end else begin
SrcList.add(SkippedLine);
end;
end else begin
if HasSkippedLine then
SrcList.Delete(SrcList.Count-1);
end;
end;
{****************************************************************************** {******************************************************************************
TLazSearchResultLB TLazSearchResultLB

View File

@ -20,7 +20,7 @@ unit newfield;
interface interface
uses uses
LCLIntf, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Classes, SysUtils, DBConst, LCLIntf, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls, Buttons, DB, LResources, ComponentEditors, ExtCtrls, StdCtrls, Buttons, DB, LResources, ComponentEditors,
PropEdits, TypInfo; PropEdits, TypInfo;
@ -86,14 +86,6 @@ var
implementation implementation
uses dbconst;
function min(i,j: integer): integer;
begin
Result := i;
if j<i then Result := j;
end;
procedure SplitFieldsList(FldList: string; AList: TStrings); procedure SplitFieldsList(FldList: string; AList: TStrings);
const const
SplitChars: Array[0..2] of Char = ('+',';',':'); SplitChars: Array[0..2] of Char = ('+',';',':');

View File

@ -25,7 +25,7 @@ unit extgraphics;
interface interface
uses Classes, LCLProc, Graphics, math, GraphMath; uses Classes, LCLProc, Graphics, Math, GraphMath;
type type
TShapeDirection = (atUp, atDown, atLeft, atRight); TShapeDirection = (atUp, atDown, atLeft, atRight);

View File

@ -49,9 +49,9 @@ unit Grids;
interface interface
uses uses
Types, Classes, SysUtils, LCLStrConsts, LCLProc, LCLType, LCLIntf, Controls, Types, Classes, SysUtils, Math, LCLStrConsts, LCLProc, LCLType, LCLIntf,
GraphType, Graphics, Forms, DynamicArray, LMessages, XMLCfg, StdCtrls, Controls, GraphType, Graphics, Forms, DynamicArray, LMessages, XMLCfg,
LResources, MaskEdit, Buttons, Clipbrd; StdCtrls, LResources, MaskEdit, Buttons, Clipbrd;
const const
//GRIDFILEVERSION = 1; // Original //GRIDFILEVERSION = 1; // Original
@ -1322,7 +1322,7 @@ type
end; end;
procedure DrawRubberRect(Canvas: TCanvas; aRect: TRect; Color: TColor); procedure DrawRubberRect(Canvas: TCanvas; aRect: TRect; Color: TColor);
procedure Register; procedure Register;
@ -1333,22 +1333,7 @@ function PointIgual(const P1,P2: TPoint): Boolean;
begin begin
result:=(P1.X=P2.X)and(P1.Y=P2.Y); result:=(P1.X=P2.X)and(P1.Y=P2.Y);
end; end;
{function RectIgual(const R1,R2: TRect): Boolean;
begin
Result:=CompareMem(@R1,@R2, SizeOf(R1));
end;}
function Min(const I,J: Integer): Integer;
begin
if I<J then Result:=I
else Result:=J;
end;
function Max(const I,J: Integer): Integer;
begin
if I>J then Result:=I
else Result:=J;
end;
function NormalizarRect(const R:TRect): TRect; function NormalizarRect(const R:TRect): TRect;
begin begin
Result.Left:=Min(R.Left, R.Right); Result.Left:=Min(R.Left, R.Right);

View File

@ -28,8 +28,8 @@
Frees the widgetinfo. Frees the widgetinfo.
} }
function CarbonPrivateHIView_Dispose(ANextHandler: EventHandlerCallRef; function CarbonPrivateHIView_Dispose(ANextHandler: EventHandlerCallRef;
AEvent: EventRef; AEvent: EventRef;
AInfo: PWidgetInfo): OSStatus; {$IFDEF darwin}mwpascal;{$ENDIF} AInfo: PWidgetInfo): OSStatus; {$IFDEF darwin}mwpascal;{$ENDIF}
var var
Msg: TLMessage; Msg: TLMessage;
PrivateClass: TCarbonPrivateHiViewClass; PrivateClass: TCarbonPrivateHiViewClass;
@ -46,8 +46,8 @@ begin
end; end;
function CarbonPrivateHIView_Hit(ANextHandler: EventHandlerCallRef; function CarbonPrivateHIView_Hit(ANextHandler: EventHandlerCallRef;
AEvent: EventRef; AEvent: EventRef;
AInfo: PWidgetInfo): OSStatus; {$IFDEF darwin}mwpascal;{$ENDIF} AInfo: PWidgetInfo): OSStatus; {$IFDEF darwin}mwpascal;{$ENDIF}
var var
Msg: TLMessage; Msg: TLMessage;
begin begin
@ -58,53 +58,56 @@ begin
end; end;
function CarbonPrivateHIView_MouseMove(ANextHandler: EventHandlerCallRef; function CarbonPrivateHIView_MouseMove(ANextHandler: EventHandlerCallRef;
AEvent: EventRef; AEvent: EventRef;
AInfo: PWidgetInfo): OSStatus; {$IFDEF darwin}mwpascal;{$ENDIF} AInfo: PWidgetInfo): OSStatus; {$IFDEF darwin}mwpascal;{$ENDIF}
begin begin
DebugLn('CarbonPrivateHIView_MouseMove'); DebugLn('CarbonPrivateHIView_MouseMove');
Result := CallNextEventHandler(ANextHandler, AEvent); Result := CallNextEventHandler(ANextHandler, AEvent);
end; end;
function CarbonPrivateHIView_Update(ANextHandler: EventHandlerCallRef;
AEvent: EventRef;
AInfo: PWidgetInfo): OSStatus; {$IFDEF darwin}mwpascal;{$ENDIF}
begin
debugln('CarbonPrivateHIView_Update ');
// first let carbon draw/update
Result := CallNextEventHandler(ANextHandler, AEvent);
end;
// ================================================================== // ==================================================================
// C L A S S // C L A S S
// ================================================================== // ==================================================================
{ TCarbonWSWinControlPrivate } { TCarbonWSWinControlPrivate }
(*
class procedure TCarbonPrivateHiView.InstallControlHandler(AInfo: PWidgetInfo; AClass: UInt32; AKind: UInt32; AHandler: Pointer; var AUPP: EventHandlerUPP);
var
eventSpec: EventTypeSpec;
begin
if AUPP = nil
then AUPP := NewEventHandlerUPP(EventHandlerProcPtr(AHandler));
eventSpec := MakeEventSpec(AClass, AKind);
InstallControlEventHandler(AInfo^.Widget, AUPP, 1, eventSpec, Pointer(AInfo), nil);
end;
*)
class procedure TCarbonPrivateHiView.RegisterEvents(AInfo: PWidgetInfo); class procedure TCarbonPrivateHiView.RegisterEvents(AInfo: PWidgetInfo);
var var
MouseSpec: array [0..6] of EventTypeSpec; MouseSpec: array [0..6] of EventTypeSpec;
TmpSpec: EventTypeSpec; TmpSpec: EventTypeSpec;
begin begin
// TODO, move both to the CarbonPrivateHIView handler
TmpSpec := MakeEventSpec(kEventClassControl, kEventControlDispose); TmpSpec := MakeEventSpec(kEventClassControl, kEventControlDispose);
InstallControlEventHandler(AInfo^.Widget, RegisterEventHandler(@CarbonPrivateHIView_Dispose), InstallControlEventHandler(AInfo^.Widget,
RegisterEventHandler(@CarbonPrivateHIView_Dispose),
1, @TmpSpec, Pointer(AInfo), nil); 1, @TmpSpec, Pointer(AInfo), nil);
TmpSpec := MakeEventSpec(kEventClassControl, kEventControlHit); TmpSpec := MakeEventSpec(kEventClassControl, kEventControlHit);
InstallControlEventHandler(AInfo^.Widget, RegisterEventHandler(@CarbonPrivateHIView_Hit), InstallControlEventHandler(AInfo^.Widget,
RegisterEventHandler(@CarbonPrivateHIView_Hit),
1, @TmpSpec, Pointer(AInfo), nil); 1, @TmpSpec, Pointer(AInfo), nil);
MouseSpec[0] := MakeEventSpec(kEventClassMouse, kEventMouseMoved); MouseSpec[0] := MakeEventSpec(kEventClassMouse, kEventMouseMoved);
MouseSpec[1] := MakeEventSpec(kEventClassMouse, kEventMouseDragged); MouseSpec[1] := MakeEventSpec(kEventClassMouse, kEventMouseDragged);
InstallControlEventHandler(AInfo^.Widget, RegisterEventHandler(@CarbonPrivateHIView_MouseMove), InstallControlEventHandler(AInfo^.Widget,
RegisterEventHandler(@CarbonPrivateHIView_MouseMove),
2, @MouseSpec[0], Pointer(AInfo), nil); 2, @MouseSpec[0], Pointer(AInfo), nil);
TmpSpec := MakeEventSpec(kEventClassControl, kEventControlDraw);
InstallControlEventHandler(AInfo^.Widget,
RegisterEventHandler(@CarbonPrivateHIView_Update),
1, @TmpSpec, Pointer(AInfo), nil);
// InstallControlHandler(AInfo, kEventClassControl, kEventControlDispose, RegisterEventHandler(@CarbonWSWinControl_Dispose)); // InstallControlHandler(AInfo, kEventClassControl, kEventControlDispose, RegisterEventHandler(@CarbonWSWinControl_Dispose));
// InstallControlHandler(AInfo, kEventClassControl, kEventControlHit, @CarbonWSWinControl_Hit, MCarbonWSWinControl_Hit_UPP); // InstallControlHandler(AInfo, kEventClassControl, kEventControlHit, @CarbonWSWinControl_Hit, MCarbonWSWinControl_Hit_UPP);
DebugLN(TWinControl(Ainfo^.LCLObject).Name,':', TWinControl(Ainfo^.LCLObject).ClassName ,' Events set') DebugLN(TWinControl(Ainfo^.LCLObject).Name,':', TWinControl(Ainfo^.LCLObject).ClassName ,' Events set')

View File

@ -102,6 +102,7 @@ var
Msg: TLMessage; Msg: TLMessage;
PrivateClass: TCarbonPrivateWindowClass; PrivateClass: TCarbonPrivateWindowClass;
begin begin
//debugln('CarbonPrivateWindow_Closed ',DbgSName(AInfo^.LCLObject));
Result := CallNextEventHandler(ANextHandler, AEvent); Result := CallNextEventHandler(ANextHandler, AEvent);
PrivateClass := TCarbonPrivateWindowClass(AInfo^.WSClass.WSPrivate); PrivateClass := TCarbonPrivateWindowClass(AInfo^.WSClass.WSPrivate);
@ -825,6 +826,22 @@ begin
end; end;
end; end;
function CarbonPrivateWindow_Update(ANextHandler: EventHandlerCallRef;
AEvent: EventRef;
AWindowInfo: PWidgetInfo): OSStatus; {$IFDEF darwin}mwpascal;{$ENDIF}
begin
debugln('CarbonPrivateWindow_Update ',DbgSName(AWindowInfo^.LCLObject));
Result := CallNextEventHandler(ANextHandler, AEvent);
end;
function CarbonPrivateWindow_DrawContent(ANextHandler: EventHandlerCallRef;
AEvent: EventRef;
AWindowInfo: PWidgetInfo): OSStatus; {$IFDEF darwin}mwpascal;{$ENDIF}
begin
debugln('CarbonPrivateWindow_DrawContent ',DbgSName(AWindowInfo^.LCLObject));
Result := CallNextEventHandler(ANextHandler, AEvent);
end;
// ================================================================== // ==================================================================
// C L A S S // C L A S S
// ================================================================== // ==================================================================
@ -876,6 +893,17 @@ begin
InstallWindowEventHandler(AInfo^.Widget, InstallWindowEventHandler(AInfo^.Widget,
RegisterEventHandler(@CarbonPrivateWindow_KeyboardProc), RegisterEventHandler(@CarbonPrivateWindow_KeyboardProc),
3, @KeySpecs[0], Pointer(AInfo), nil); 3, @KeySpecs[0], Pointer(AInfo), nil);
debugln('TCarbonPrivateWindow.RegisterEvents ',DbgSName(AInfo^.LCLObject));
TmpSpec := MakeEventSpec(kEventClassWindow, kEventWindowUpdate);
InstallWindowEventHandler(AInfo^.Widget,
RegisterEventHandler(@CarbonPrivateWindow_Update),
1, @TmpSpec, Pointer(AInfo), nil);
TmpSpec := MakeEventSpec(kEventClassWindow, kEventWindowDrawContent);
InstallWindowEventHandler(AInfo^.Widget,
RegisterEventHandler(@CarbonPrivateWindow_DrawContent),
1, @TmpSpec, Pointer(AInfo), nil);
end; end;
class procedure TCarbonPrivateWindow.UnregisterEvents; class procedure TCarbonPrivateWindow.UnregisterEvents;