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