mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 16:59:20 +02:00
IDE: make Search Result window use the previous position. Issue #21288
git-svn-id: trunk@36407 -
This commit is contained in:
parent
6c336b7fdd
commit
d76fd3fafb
@ -94,7 +94,7 @@ type
|
|||||||
const
|
const
|
||||||
// This is the list of IDE windows, that will not be automatically reopened
|
// This is the list of IDE windows, that will not be automatically reopened
|
||||||
// on startup. These windows are opened automatically when needed.
|
// on startup. These windows are opened automatically when needed.
|
||||||
NonModalIDEWindowManualOpen = [
|
{ NonModalIDEWindowManualOpen = [
|
||||||
nmiwNone,
|
nmiwNone,
|
||||||
nmiwMainIDEName,
|
nmiwMainIDEName,
|
||||||
nmiwSourceNoteBookName,
|
nmiwSourceNoteBookName,
|
||||||
@ -103,7 +103,7 @@ const
|
|||||||
nmiwSearchResultsViewName,
|
nmiwSearchResultsViewName,
|
||||||
nmiwAnchorEditor
|
nmiwAnchorEditor
|
||||||
];
|
];
|
||||||
|
}
|
||||||
// form names for non modal IDE windows:
|
// form names for non modal IDE windows:
|
||||||
NonModalIDEWindowNames: array[TNonModalIDEWindow] of string = (
|
NonModalIDEWindowNames: array[TNonModalIDEWindow] of string = (
|
||||||
'?',
|
'?',
|
||||||
|
22
ide/main.pp
22
ide/main.pp
@ -1088,7 +1088,7 @@ type
|
|||||||
|
|
||||||
// search results
|
// search results
|
||||||
function DoJumpToSearchResult(FocusEditor: boolean): boolean;
|
function DoJumpToSearchResult(FocusEditor: boolean): boolean;
|
||||||
procedure DoShowSearchResultsView(Show, BringToFront: boolean);
|
procedure DoShowSearchResultsView(Show: boolean); override;
|
||||||
|
|
||||||
// form editor and designer
|
// form editor and designer
|
||||||
procedure DoBringToFrontFormOrUnit;
|
procedure DoBringToFrontFormOrUnit;
|
||||||
@ -1548,6 +1548,7 @@ begin
|
|||||||
FreeAndNil(LazFindReplaceDialog);
|
FreeAndNil(LazFindReplaceDialog);
|
||||||
FreeAndNil(MessagesView);
|
FreeAndNil(MessagesView);
|
||||||
FreeThenNil(AnchorDesigner);
|
FreeThenNil(AnchorDesigner);
|
||||||
|
FreeThenNil(SearchResultsView);
|
||||||
FreeThenNil(ObjectInspector1);
|
FreeThenNil(ObjectInspector1);
|
||||||
FreeThenNil(SourceEditorManagerIntf);
|
FreeThenNil(SourceEditorManagerIntf);
|
||||||
|
|
||||||
@ -4084,7 +4085,7 @@ end;
|
|||||||
|
|
||||||
procedure TMainIDE.mnuViewSearchResultsClick(Sender: TObject);
|
procedure TMainIDE.mnuViewSearchResultsClick(Sender: TObject);
|
||||||
Begin
|
Begin
|
||||||
ShowSearchResultView(true);
|
DoShowSearchResultsView(true);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
procedure TMainIDE.mnuNewProjectClicked(Sender: TObject);
|
procedure TMainIDE.mnuNewProjectClicked(Sender: TObject);
|
||||||
@ -10212,7 +10213,7 @@ begin
|
|||||||
end
|
end
|
||||||
else if ItIs(NonModalIDEWindowNames[nmiwSearchResultsViewName]) then
|
else if ItIs(NonModalIDEWindowNames[nmiwSearchResultsViewName]) then
|
||||||
begin
|
begin
|
||||||
DoShowSearchResultsView(false,false);
|
DoShowSearchResultsView(false);
|
||||||
AForm:=SearchResultsView;
|
AForm:=SearchResultsView;
|
||||||
end
|
end
|
||||||
else if ItIs(NonModalIDEWindowNames[nmiwAnchorEditor]) then
|
else if ItIs(NonModalIDEWindowNames[nmiwAnchorEditor]) then
|
||||||
@ -14092,15 +14093,14 @@ begin
|
|||||||
SourceEditorManager.ShowActiveWindowOnTop(False);
|
SourceEditorManager.ShowActiveWindowOnTop(False);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.DoShowSearchResultsView(Show, BringToFront: boolean);
|
procedure TMainIDE.DoShowSearchResultsView(Show: boolean);
|
||||||
begin
|
begin
|
||||||
//set the event here for the selectionchanged event
|
if SearchresultsView=Nil then begin
|
||||||
if not assigned(SearchresultsView.OnSelectionChanged) then
|
SearchresultsView:=TSearchResultsView.Create(OwningComponent);
|
||||||
SearchresultsView.OnSelectionChanged := @SearchresultsViewSelectionChanged;
|
SearchresultsView.OnSelectionChanged := OnSearchResultsViewSelectionChanged;
|
||||||
|
end;
|
||||||
if Show and (not SearchResultsView.IsVisible) then
|
if Show then begin
|
||||||
begin
|
IDEWindowCreators.ShowForm(SearchresultsView,Show);
|
||||||
IDEWindowCreators.ShowForm(SearchResultsView,BringToFront);
|
|
||||||
// the sourcenotebook is more interesting than the search results
|
// the sourcenotebook is more interesting than the search results
|
||||||
SourceEditorManager.ShowActiveWindowOnTop(False);
|
SourceEditorManager.ShowActiveWindowOnTop(False);
|
||||||
end;
|
end;
|
||||||
|
@ -901,9 +901,9 @@ var
|
|||||||
Cnt: integer;
|
Cnt: integer;
|
||||||
begin
|
begin
|
||||||
Cnt:= 0;
|
Cnt:= 0;
|
||||||
ListPage:=SearchResultsView.AddSearch(SearchText, SearchText,
|
LazarusIDE.DoShowSearchResultsView(True);
|
||||||
ReplaceText,SearchDirectory,
|
ListPage:=SearchResultsView.AddSearch(SearchText,SearchText,
|
||||||
SearchMask, SearchOptions);
|
ReplaceText,SearchDirectory,SearchMask,SearchOptions);
|
||||||
try
|
try
|
||||||
(* BeginUpdate prevents ListPage from being closed,
|
(* BeginUpdate prevents ListPage from being closed,
|
||||||
other pages can still be closed or inserted, so PageIndex can change *)
|
other pages can still be closed or inserted, so PageIndex can change *)
|
||||||
|
@ -11,7 +11,7 @@ object SearchResultsView: TSearchResultsView
|
|||||||
OnClose = FormClose
|
OnClose = FormClose
|
||||||
OnCreate = Form1Create
|
OnCreate = Form1Create
|
||||||
OnKeyDown = FormKeyDown
|
OnKeyDown = FormKeyDown
|
||||||
Position = poScreenCenter
|
Position = poDefault
|
||||||
LCLVersion = '0.9.31'
|
LCLVersion = '0.9.31'
|
||||||
object ResultsNoteBook: TPageControl
|
object ResultsNoteBook: TPageControl
|
||||||
AnchorSideTop.Control = ToolBar
|
AnchorSideTop.Control = ToolBar
|
||||||
|
@ -37,10 +37,10 @@ unit SearchResultView;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, LCLProc, Forms, Controls, Graphics, Dialogs, ComCtrls,
|
Classes, SysUtils, LCLProc, Forms, Controls, Graphics, ComCtrls, LCLType, LCLIntf,
|
||||||
ExtCtrls, StdCtrls, Buttons, LCLType, LCLIntf, Menus, strutils, IDEWindowIntf,
|
Menus, strutils, IDEOptionDefs, LazarusIDEStrConsts, EnvironmentOpts, InputHistory,
|
||||||
IDEOptionDefs, LazarusIDEStrConsts, EnvironmentOpts, InputHistory, IDEProcs,
|
IDEProcs, Project, MainIntf, Clipbrd, ActnList, IDECommands, TreeFilterEdit;
|
||||||
Project, MainIntf, Clipbrd, ActnList, IDECommands, TreeFilterEdit;
|
|
||||||
|
|
||||||
type
|
type
|
||||||
{ TLazSearchMatchPos }
|
{ TLazSearchMatchPos }
|
||||||
@ -211,11 +211,8 @@ type
|
|||||||
property Items[Index: integer]: TStrings read GetItems write SetItems;
|
property Items[Index: integer]: TStrings read GetItems write SetItems;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function SearchResultsView: TSearchResultsView;
|
|
||||||
|
|
||||||
procedure ShowSearchResultView(BringToFront: boolean);
|
|
||||||
|
|
||||||
var
|
var
|
||||||
|
SearchResultsView: TSearchResultsView = nil;
|
||||||
OnSearchResultsViewSelectionChanged: TNotifyEvent = nil;
|
OnSearchResultsViewSelectionChanged: TNotifyEvent = nil;
|
||||||
OnSearchAgainClicked: TNotifyEvent = nil;
|
OnSearchAgainClicked: TNotifyEvent = nil;
|
||||||
|
|
||||||
@ -223,12 +220,8 @@ implementation
|
|||||||
|
|
||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
|
||||||
{ TSearchResultsView }
|
|
||||||
|
|
||||||
const
|
const
|
||||||
MaxTextLen = 80;
|
MaxTextLen = 80;
|
||||||
var
|
|
||||||
SearchResultsViewSingleton: TSearchResultsView = nil;
|
|
||||||
|
|
||||||
function CopySearchMatchPos(var Src, Dest: TLazSearchMatchPos): Boolean;
|
function CopySearchMatchPos(var Src, Dest: TLazSearchMatchPos): Boolean;
|
||||||
begin
|
begin
|
||||||
@ -260,29 +253,17 @@ begin
|
|||||||
sl.Free;
|
sl.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function SearchResultsView: TSearchResultsView;
|
{ TSearchResultsView }
|
||||||
begin
|
|
||||||
Result := SearchResultsViewSingleton;
|
|
||||||
if Result <> nil then exit;
|
|
||||||
Application.CreateForm(TSearchResultsView, SearchResultsViewSingleton);
|
|
||||||
SearchResultsViewSingleton.OnSelectionChanged := OnSearchResultsViewSelectionChanged;
|
|
||||||
Result := SearchResultsViewSingleton;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure ShowSearchResultView(BringToFront: boolean);
|
|
||||||
begin
|
|
||||||
IDEWindowCreators.ShowForm(SearchResultsView,BringToFront);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSearchResultsView.Form1Create(Sender: TObject);
|
procedure TSearchResultsView.Form1Create(Sender: TObject);
|
||||||
var
|
var
|
||||||
CloseCommand: TIDECommand;
|
CloseCommand: TIDECommand;
|
||||||
begin
|
begin
|
||||||
FMaxItems:=50000;
|
FMaxItems:=50000;
|
||||||
|
|
||||||
ResultsNoteBook.Options:= ResultsNoteBook.Options+[nboShowCloseButtons];
|
ResultsNoteBook.Options:= ResultsNoteBook.Options+[nboShowCloseButtons];
|
||||||
ResultsNoteBook.Update;
|
ResultsNoteBook.Update;
|
||||||
|
|
||||||
|
Name:=NonModalIDEWindowNames[nmiwSearchResultsViewName];
|
||||||
Caption:=lisMenuViewSearchResults;
|
Caption:=lisMenuViewSearchResults;
|
||||||
|
|
||||||
SearchAgainButton.Hint:=rsStartANewSearch;
|
SearchAgainButton.Hint:=rsStartANewSearch;
|
||||||
@ -297,8 +278,6 @@ begin
|
|||||||
actClosePage.SecondaryShortCuts.Append(ShortCutToText(
|
actClosePage.SecondaryShortCuts.Append(ShortCutToText(
|
||||||
ShortCut(CloseCommand.ShortcutB.Key1, CloseCommand.ShortcutB.Shift1)));
|
ShortCut(CloseCommand.ShortcutB.Key1, CloseCommand.ShortcutB.Shift1)));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Name := NonModalIDEWindowNames[nmiwSearchResultsViewName];
|
|
||||||
fOnSelectionChanged:= nil;
|
fOnSelectionChanged:= nil;
|
||||||
ShowHint:= True;
|
ShowHint:= True;
|
||||||
fMouseOverIndex:= -1;
|
fMouseOverIndex:= -1;
|
||||||
@ -308,10 +287,9 @@ begin
|
|||||||
mniCopyAll.Caption := lisCopyAllItemsToClipboard;
|
mniCopyAll.Caption := lisCopyAllItemsToClipboard;
|
||||||
mniExpandAll.Caption := lisExpandAll;
|
mniExpandAll.Caption := lisExpandAll;
|
||||||
mniCollapseAll.Caption := lisCollapseAll;
|
mniCollapseAll.Caption := lisCollapseAll;
|
||||||
end;//Create
|
end;
|
||||||
|
|
||||||
procedure TSearchResultsView.FormClose(Sender: TObject;
|
procedure TSearchResultsView.FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
||||||
var CloseAction: TCloseAction);
|
|
||||||
begin
|
begin
|
||||||
// Using a dock manager...
|
// Using a dock manager...
|
||||||
if Parent<>nil then
|
if Parent<>nil then
|
||||||
|
@ -288,6 +288,9 @@ type
|
|||||||
function DoCheckFilesOnDisk(Instantaneous: boolean = false): TModalResult; virtual; abstract;
|
function DoCheckFilesOnDisk(Instantaneous: boolean = false): TModalResult; virtual; abstract;
|
||||||
procedure AbortBuild; virtual; abstract;
|
procedure AbortBuild; virtual; abstract;
|
||||||
|
|
||||||
|
// search results
|
||||||
|
procedure DoShowSearchResultsView(Show: boolean); virtual; abstract;
|
||||||
|
|
||||||
// designer
|
// designer
|
||||||
function GetDesignerForProjectEditor(AEditor: TSourceEditorInterface;
|
function GetDesignerForProjectEditor(AEditor: TSourceEditorInterface;
|
||||||
LoadForm: boolean): TIDesigner; virtual; abstract;
|
LoadForm: boolean): TIDesigner; virtual; abstract;
|
||||||
|
Loading…
Reference in New Issue
Block a user