From: <eb...@us...> - 2009-03-24 20:09:22
|
Revision: 450 http://gexperts.svn.sourceforge.net/gexperts/?rev=450&view=rev Author: eberry Date: 2009-03-24 20:09:07 +0000 (Tue, 24 Mar 2009) Log Message: ----------- Allow grep search within previously matched result files (John Hansen, Erik) Modified Paths: -------------- trunk/Documentation/Readme.txt trunk/Source/Grep/GX_GrepBackend.pas trunk/Source/Grep/GX_GrepResults.pas trunk/Source/Grep/GX_GrepSearch.dfm trunk/Source/Grep/GX_GrepSearch.pas Modified: trunk/Documentation/Readme.txt =================================================================== --- trunk/Documentation/Readme.txt 2009-03-23 09:38:38 UTC (rev 449) +++ trunk/Documentation/Readme.txt 2009-03-24 20:09:07 UTC (rev 450) @@ -1,4 +1,4 @@ -GExperts 1.33 +GExperts 1.33 Beta 3 Open Source Programming Tools for Delphi and C++Builder Source code, the FAQ, and the latest news are available at: @@ -106,21 +106,24 @@ etc. should support UNICODE files just fine. Also included are some shutdown optimizations, removal of all known memory leaks, and other minor tweaks. All GExperts forms use the OS default font face/size. You can also override - the UI font in the General tab of the settings. + the UI font in the General tab of the settings. - Grep Search: There is a new regular expression engine that supports a large subset of the Perl regular expression syntax. Grep can now search and replace files in ANSI, UTF-8, and UTF-16 formats in Delphi 2009. The stay on top feature was removed when running inside the IDE, since it could hide modal - dialogs. + dialogs. Allow searching within previously matched files (John Hansen). - Hide/Show Non-Visual Components: This new tool allows temporarily hiding non-visual components on a form, so you can visualize the form as it will appear at runtime. - Editor Experts: The main menu contains a submenu item for each editor expert now in Delphi 8 or later. - Favorite Files: Supports preview of jpg, png, and gif files if the VCL - supports it in your IDE version. + supports it in your IDE version, supports select all for files and move + up/down for folders. - Code Proofreader: Should be slightly more accurate with fewer false positive corrections made to your code. +- To Do List: Display the category and owner for to do items, indicate items + marked DONE, support more priorities (Pestasoft, Erik). VERSION 1.32 (September 11, 2007) Modified: trunk/Source/Grep/GX_GrepBackend.pas =================================================================== --- trunk/Source/Grep/GX_GrepBackend.pas 2009-03-23 09:38:38 UTC (rev 449) +++ trunk/Source/Grep/GX_GrepBackend.pas 2009-03-24 20:09:07 UTC (rev 450) @@ -10,7 +10,7 @@ GX_GrepRegExSearch, GX_GenericUtils; type - TGrepAction = (gaProjGrep, gaCurrentOnlyGrep, gaOpenFilesGrep, gaDirGrep, gaProjGroupGrep); + TGrepAction = (gaProjGrep, gaCurrentOnlyGrep, gaOpenFilesGrep, gaDirGrep, gaProjGroupGrep, gaResults); // Saved grep settings (used for refresh) TGrepSettings = record @@ -116,6 +116,7 @@ FFileResult: TFileResult; FSearcher: TSearcher; FSearchRoot: string; + FFilesInResults: TStrings; procedure FoundIt(LineNo, StartCol, EndCol: Integer; const Line: TGXUnicodeString); procedure StartFileSearch(const FileName: string); procedure ExecuteSearchOnFile(const FileName: string; FromProject: Boolean = False); @@ -131,8 +132,9 @@ procedure GrepProject(Project: IOTAProject); procedure GrepDirectory(Dir, Mask: string); procedure GrepDirectories(const Dir, Mask: string); + procedure GrepResults; public - constructor Create(const Settings: TGrepSettings; StorageTarget: TStrings); + constructor Create(const Settings: TGrepSettings; StorageTarget, FilesInResults: TStrings); procedure Execute; property OnSearchFile: TOnSearchFile read FOnSearchFile write FOnSearchFile; property FileSearchCount: Integer read FFileSearchCount; @@ -264,12 +266,14 @@ end; end; -constructor TGrepSearchRunner.Create(const Settings: TGrepSettings; StorageTarget: TStrings); +constructor TGrepSearchRunner.Create(const Settings: TGrepSettings; StorageTarget, FilesInResults: TStrings); begin inherited Create; Assert(Assigned(StorageTarget)); + Assert(Assigned(FilesInResults)); FStorageTarget := StorageTarget; + FFilesInResults := FilesInResults; FGrepSettings := Settings; end; @@ -423,6 +427,20 @@ end; end; +procedure TGrepSearchRunner.GrepResults; +var + i: Integer; +begin + for i := 0 to FFilesInResults.Count - 1 do + begin + if GxOtaFileOrModuleExists(FFilesInResults[i]) then + begin + {$IFOPT D+} SendDebug('ResultsGrep on ' + FFilesInResults[i]); {$ENDIF} + ExecuteSearchOnFile(FFilesInResults[i]); + end; + end; +end; + procedure TGrepSearchRunner.Execute; begin FFileSearchCount := 0; @@ -464,6 +482,8 @@ else GrepDirectories(FGrepSettings.Directories, AnsiUpperCase(FGrepSettings.Mask)); end; + gaResults: + GrepResults; end; // end case finally FreeAndNil(FDupeFileList); Modified: trunk/Source/Grep/GX_GrepResults.pas =================================================================== --- trunk/Source/Grep/GX_GrepResults.pas 2009-03-23 09:38:38 UTC (rev 449) +++ trunk/Source/Grep/GX_GrepResults.pas 2009-03-24 20:09:07 UTC (rev 450) @@ -229,6 +229,8 @@ FilesHit: Cardinal; Cursor: IInterface; MatchString: string; + ResultFiles: TStringList; + i: Integer; begin if FSearchInProgress then raise Exception.Create(SGrepActive); @@ -239,25 +241,34 @@ reContext.Clear; - SetStatusString(''); - SetMatchString(''); - ClearResultsListbox; - BringToFront; - IdeDockManager.ShowForm(Self); - EnsureFormVisible(Self); + ResultFiles := TStringList.Create; + try + ContractList; + for i := 0 to lbResults.Items.Count - 1 do + ResultFiles.Add(lbResults.Items[i]); + SetStatusString(''); + SetMatchString(''); + ClearResultsListbox; + BringToFront; + IdeDockManager.ShowForm(Self); + EnsureFormVisible(Self); - TimeStart := Now; - Cursor := TempHourGlassCursor; - FSearcher := TGrepSearchRunner.Create(FGrepSettings, lbResults.Items); - try - FSearcher.OnSearchFile := StartFileSearch; - FSearchInProgress := True; - FSearcher.Execute; - FilesSearched := FSearcher.FileSearchCount; - MatchesFound := FSearcher.MatchCount; + TimeStart := Now; + Cursor := TempHourGlassCursor; + + FSearcher := TGrepSearchRunner.Create(FGrepSettings, lbResults.Items, ResultFiles); + try + FSearcher.OnSearchFile := StartFileSearch; + FSearchInProgress := True; + FSearcher.Execute; + FilesSearched := FSearcher.FileSearchCount; + MatchesFound := FSearcher.MatchCount; + finally + FreeAndNil(FSearcher); + FSearchInProgress := False; + end; finally - FreeAndNil(FSearcher); - FSearchInProgress := False; + FreeAndNil(ResultFiles); end; FilesHit := lbResults.Items.Count; Modified: trunk/Source/Grep/GX_GrepSearch.dfm =================================================================== --- trunk/Source/Grep/GX_GrepSearch.dfm 2009-03-23 09:38:38 UTC (rev 449) +++ trunk/Source/Grep/GX_GrepSearch.dfm 2009-03-24 20:09:07 UTC (rev 450) @@ -3,7 +3,7 @@ Top = 209 BorderStyle = bsDialog Caption = 'Grep Search' - ClientHeight = 305 + ClientHeight = 336 ClientWidth = 486 Color = clBtnFace Font.Charset = ANSI_CHARSET @@ -17,7 +17,7 @@ Scaled = False DesignSize = ( 486 - 305) + 336) PixelsPerInch = 96 TextHeight = 14 object lblFind: TLabel @@ -43,21 +43,21 @@ Left = 8 Top = 40 Width = 227 - Height = 121 + Height = 145 Caption = 'Options' TabOrder = 1 object cbCaseSensitive: TCheckBox Left = 10 - Top = 16 - Width = 165 + Top = 19 + Width = 200 Height = 17 Caption = '&Case sensitive' TabOrder = 0 end object cbNoComments: TCheckBox Left = 10 - Top = 98 - Width = 165 + Top = 101 + Width = 200 Height = 17 Caption = '&Ignore comments' TabOrder = 4 @@ -65,24 +65,24 @@ end object cbForms: TCheckBox Left = 10 - Top = 57 - Width = 165 + Top = 60 + Width = 200 Height = 17 Caption = 'Search for&m files' TabOrder = 2 end object cbWholeWord: TCheckBox Left = 10 - Top = 36 - Width = 165 + Top = 39 + Width = 200 Height = 17 Caption = '&Whole word' TabOrder = 1 end object cbRegEx: TCheckBox Left = 10 - Top = 77 - Width = 165 + Top = 80 + Width = 200 Height = 17 Caption = 'Regular e&xpression' TabOrder = 3 @@ -92,14 +92,14 @@ Left = 252 Top = 40 Width = 227 - Height = 121 + Height = 145 Anchors = [akLeft, akTop, akRight] Caption = 'Where' TabOrder = 2 object rbAllProjFiles: TRadioButton Left = 10 - Top = 57 - Width = 177 + Top = 58 + Width = 200 Height = 17 Caption = 'All files in &project' Checked = True @@ -109,8 +109,8 @@ end object rbOpenFiles: TRadioButton Left = 10 - Top = 77 - Width = 177 + Top = 78 + Width = 200 Height = 17 Caption = '&Open project files' TabOrder = 3 @@ -119,34 +119,43 @@ object rbDirectories: TRadioButton Left = 10 Top = 98 - Width = 177 + Width = 200 Height = 17 - Caption = 'Search in &directories' + Caption = '&Directories' TabOrder = 4 OnClick = rbDirectoriesClick end object rbCurrentOnly: TRadioButton Left = 10 - Top = 16 - Width = 177 + Top = 18 + Width = 200 Height = 17 - Caption = 'Current &file only' + Caption = 'Current &file' TabOrder = 0 OnClick = rbDirectoriesClick end object rbAllProjGroupFiles: TRadioButton Left = 10 - Top = 36 - Width = 177 + Top = 38 + Width = 200 Height = 17 Caption = 'All files in project &group' TabOrder = 1 OnClick = rbDirectoriesClick end + object rbResults: TRadioButton + Left = 10 + Top = 119 + Width = 200 + Height = 17 + Caption = 'Previous search &result files' + TabOrder = 5 + OnClick = rbDirectoriesClick + end end object gbxDirectories: TGroupBox Left = 8 - Top = 168 + Top = 192 Width = 471 Height = 99 Anchors = [akLeft, akTop, akRight] @@ -220,7 +229,7 @@ end object btnOK: TButton Left = 244 - Top = 273 + Top = 304 Width = 75 Height = 25 Anchors = [akRight, akBottom] @@ -231,7 +240,7 @@ end object btnCancel: TButton Left = 324 - Top = 273 + Top = 304 Width = 75 Height = 25 Anchors = [akRight, akBottom] @@ -242,7 +251,7 @@ end object btnHelp: TButton Left = 404 - Top = 273 + Top = 304 Width = 75 Height = 25 Anchors = [akRight, akBottom] Modified: trunk/Source/Grep/GX_GrepSearch.pas =================================================================== --- trunk/Source/Grep/GX_GrepSearch.pas 2009-03-23 09:38:38 UTC (rev 449) +++ trunk/Source/Grep/GX_GrepSearch.pas 2009-03-24 20:09:07 UTC (rev 450) @@ -34,6 +34,7 @@ btnBrowse: TButton; lblDirectory: TLabel; rbAllProjGroupFiles: TRadioButton; + rbResults: TRadioButton; procedure btnBrowseClick(Sender: TObject); procedure rbDirectoriesClick(Sender: TObject); procedure btnHelpClick(Sender: TObject); @@ -259,7 +260,9 @@ else if rbDirectories.Checked then FGrepExpert.GrepSearch := 3 else if rbAllProjGroupFiles.Checked then - FGrepExpert.GrepSearch := 4; + FGrepExpert.GrepSearch := 4 + else if rbResults.Checked then + FGrepExpert.GrepSearch := 5; end; procedure TfmGrepSearch.LoadFormSettings; @@ -308,6 +311,7 @@ cbText.Items.Assign(FGrepExpert.SearchList); cbDirectory.Items.Assign(FGrepExpert.DirList); cbMasks.Items.Assign(FGrepExpert.MaskList); + rbResults.Enabled := fmGrepResults.lbResults.Count > 0; cbCaseSensitive.Checked := FGrepExpert.GrepCaseSensitive; //cbNoComments.Checked := not FGrepExpert.GrepIncludeComments; @@ -321,6 +325,12 @@ 2: rbOpenFiles.Checked := True; 3: rbDirectories.Checked := True; 4: rbAllProjGroupFiles.Checked := True; + 5: begin + if rbResults.Enabled then + rbResults.Checked := True + else + rbAllProjFiles.Checked := True; + end; else rbAllProjFiles.Checked := True; end; @@ -387,6 +397,8 @@ Value.GrepAction := gaOpenFilesGrep else if rbAllProjGroupFiles.Checked then Value.GrepAction := gaProjGroupGrep + else if rbResults.Checked then + Value.GrepAction := gaResults else begin Value.GrepAction := gaDirGrep; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |