IDE: Improved Search Results dialog behavior:

1. Always bring Search Results to front on Ctrl-Alt-F (or if called via menu).
     2. Bring Search Results to front if Search Progress dialog was active (had focus).
     3. Do not bring Search Results to front if Search Progress dialog was not active.

git-svn-id: trunk@39520 -
This commit is contained in:
maxim 2012-12-12 19:51:53 +00:00
parent 48fa6760da
commit fce81aa63d
4 changed files with 41 additions and 22 deletions

View File

@ -969,7 +969,7 @@ type
// search results
function DoJumpToSearchResult(FocusEditor: boolean): boolean;
procedure DoShowSearchResultsView(Show: boolean); override;
procedure DoShowSearchResultsView(Show: boolean; BringToFront: boolean = False); override;
// form editor and designer
procedure DoBringToFrontFormOrUnit;
@ -3960,7 +3960,8 @@ end;
procedure TMainIDE.mnuViewSearchResultsClick(Sender: TObject);
Begin
DoShowSearchResultsView(true);
// show and bring to front
DoShowSearchResultsView(true, true);
End;
procedure TMainIDE.mnuNewProjectClicked(Sender: TObject);
@ -9143,7 +9144,7 @@ begin
SourceEditorManager.ShowActiveWindowOnTop(False);
end;
procedure TMainIDE.DoShowSearchResultsView(Show: boolean);
procedure TMainIDE.DoShowSearchResultsView(Show: boolean; BringToFront: boolean = False);
begin
if SearchresultsView=Nil then begin
SearchresultsView:=TSearchResultsView.Create(OwningComponent);
@ -9152,7 +9153,8 @@ begin
if Show then begin
IDEWindowCreators.ShowForm(SearchresultsView,Show);
// the sourcenotebook is more interesting than the search results
SourceEditorManager.ShowActiveWindowOnTop(False);
if BringToFront = false then
SourceEditorManager.ShowActiveWindowOnTop(False);
end;
end;

View File

@ -7,8 +7,10 @@ object SearchProgressForm: TSearchProgressForm
ClientHeight = 167
ClientWidth = 700
Constraints.MinWidth = 700
OnClose = FormClose
OnCreate = SearchFormCREATE
OnDestroy = SearchFormDESTROY
OnShow = FormShow
Position = poScreenCenter
LCLVersion = '1.1'
Visible = True
@ -29,7 +31,7 @@ object SearchProgressForm: TSearchProgressForm
AnchorSideTop.Side = asrCenter
Left = 121
Height = 1
Top = 98
Top = 88
Width = 1
ParentColor = False
ShowAccelChar = False
@ -38,9 +40,9 @@ object SearchProgressForm: TSearchProgressForm
AnchorSideTop.Control = SearchingLabel
AnchorSideTop.Side = asrBottom
Left = 16
Height = 17
Top = 90
Width = 54
Height = 13
Top = 82
Width = 40
BorderSpacing.Top = 18
Caption = 'Matches'
ParentColor = False
@ -50,7 +52,7 @@ object SearchProgressForm: TSearchProgressForm
AnchorSideTop.Side = asrCenter
Left = 121
Height = 1
Top = 63
Top = 57
Width = 1
ParentColor = False
ShowAccelChar = False
@ -59,9 +61,9 @@ object SearchProgressForm: TSearchProgressForm
AnchorSideTop.Control = SearchTextLabel
AnchorSideTop.Side = asrBottom
Left = 16
Height = 17
Top = 55
Width = 68
Height = 13
Top = 51
Width = 51
BorderSpacing.Top = 18
Caption = 'Searching:'
ParentColor = False
@ -69,9 +71,9 @@ object SearchProgressForm: TSearchProgressForm
object SearchTextLabel: TLabel
AnchorSideTop.Control = Panel2
Left = 16
Height = 17
Height = 13
Top = 20
Width = 78
Width = 62
BorderSpacing.Top = 18
Caption = 'Search Text:'
ParentColor = False
@ -81,7 +83,7 @@ object SearchProgressForm: TSearchProgressForm
AnchorSideTop.Side = asrCenter
Left = 121
Height = 1
Top = 28
Top = 26
Width = 1
ParentColor = False
ShowAccelChar = False
@ -93,10 +95,10 @@ object SearchProgressForm: TSearchProgressForm
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Panel2
AnchorSideBottom.Side = asrBottom
Left = 306
Height = 31
Top = 128
Width = 89
Left = 312
Height = 26
Top = 133
Width = 77
Anchors = [akLeft, akBottom]
AutoSize = True
BorderSpacing.Top = 12

View File

@ -54,6 +54,8 @@ type
lblProgress: TLABEL;
lblSearchText: TLABEL;
Panel2: TPANEL;
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormShow(Sender: TObject);
procedure OnAddMatch(const Filename: string; const StartPos, EndPos: TPoint;
const Lines: string);
procedure SearchFormCREATE(Sender: TObject);
@ -81,6 +83,7 @@ type
fSearchProject: boolean;
fAborting: boolean;
fLastUpdateProgress: DWORD;
fWasActive: boolean;
procedure DoFindInFiles(ADirectory: string);
procedure DoFindInSearchList;
procedure SetResultsList(const AValue: TStrings);
@ -639,6 +642,7 @@ begin
fSearchProject:= false;
fSearchOpen:= false;
fSearchFiles:= false;
fWasActive:= false;
end;
procedure TSearchProgressForm.OnAddMatch(const Filename: string; const StartPos,
@ -661,6 +665,17 @@ begin
UpdateMatches;
end;
procedure TSearchProgressForm.FormClose(Sender: TObject; var CloseAction:
TCloseAction);
begin
fWasActive:= Active;
end;
procedure TSearchProgressForm.FormShow(Sender: TObject);
begin
fWasActive:= true;
end;
procedure TSearchProgressForm.SearchFormDESTROY(Sender: TObject);
begin
FreeAndNil(fProgress);
@ -926,8 +941,8 @@ begin
finally
ListPage.Caption:= Format('%s (%d)',[ListPage.Caption,Cnt]);
SearchResultsView.EndUpdate(ListPage.PageIndex);
// bring to front
IDEWindowCreators.ShowForm(SearchResultsView,true);
// show, but bring to front only if Search Progress dialog was active
LazarusIDE.DoShowSearchResultsView(True, fWasActive);
end;
end;

View File

@ -299,7 +299,7 @@ type
procedure AbortBuild; virtual; abstract;
// search results
procedure DoShowSearchResultsView(Show: boolean); virtual; abstract;
procedure DoShowSearchResultsView(Show: boolean; BringToFront: boolean = False); virtual; abstract;
// designer
function GetDesignerForProjectEditor(AEditor: TSourceEditorInterface;