* Let spotter window be managed by IDE (bug #34353)

git-svn-id: trunk@59180 -
This commit is contained in:
michael 2018-09-29 08:39:09 +00:00
parent 2a10162c7b
commit f79380078f
3 changed files with 33 additions and 24 deletions

View File

@ -18,19 +18,19 @@ object SpotterForm: TSpotterForm
LCLVersion = '2.1.0.0'
Visible = True
object LBMatches: TListBox
Left = 3
Height = 196
Top = 33
Width = 491
Left = 6
Height = 187
Top = 39
Width = 485
Align = alClient
BorderSpacing.Around = 3
BorderSpacing.Around = 6
ClickOnSelChange = False
ItemHeight = 0
OnClick = LBMatchesClick
OnDrawItem = LBMatchesDrawItem
OnKeyUp = LBMatchesKeyUp
ParentShowHint = False
ScrollWidth = 489
ScrollWidth = 483
ShowHint = True
Style = lbOwnerDrawFixed
TabOrder = 0
@ -38,12 +38,12 @@ object SpotterForm: TSpotterForm
TopIndex = -1
end
object ESearch: TEditButton
Left = 3
Left = 6
Height = 27
Top = 3
Width = 491
Top = 6
Width = 485
Align = alTop
BorderSpacing.Around = 3
BorderSpacing.Around = 6
ButtonWidth = 23
Flat = True
Glyph.Data = {

View File

@ -137,10 +137,11 @@ Procedure ShowSpotterForm;
Procedure ApplySpotterOptions;
Procedure SaveSpotterOptions;
procedure LoadSpotterOptions;
procedure CreateSpotterWindow(Sender: TObject; aFormName: string; var AForm: TCustomForm; DoDisableAutoSizing: boolean);
implementation
Uses PackageIntf, BaseIDEIntf, LazConfigStorage, StrUtils, LCLIntf, LCLProc, srceditorintf;
Uses PackageIntf, BaseIDEIntf, LazConfigStorage, StrUtils, LCLIntf, LCLProc, IDEWindowIntf, srceditorintf;
{$R *.lfm}
@ -218,16 +219,29 @@ begin
end;
end;
Procedure ShowSpotterForm;
Procedure MaybeCreateSpotterForm;
begin
if SpotterForm=Nil then
begin
SpotterForm:=TSpotterForm.Create(Application);
ApplySpotterOptions;
end;
SpotterForm.Show;
end;
Procedure ShowSpotterForm;
begin
MaybeCreateSpotterForm;
IDEWindowCreators.ShowForm(SpotterForm,True,vmAlwaysMoveToVisible);
end;
procedure CreateSpotterWindow(Sender: TObject; aFormName: string;
var AForm: TCustomForm; DoDisableAutoSizing: boolean);
begin
MaybeCreateSpotterForm;
aForm:=SpotterForm;
end;
{ TOpenFileItem }
@ -428,19 +442,12 @@ begin
RemoveHandlerAddToRecentPackageFiles(@ProjectOpened);
end;
FreeAndNil(FSearchItems);
SpotterForm:=Nil;
end;
procedure TSpotterForm.FormShow(Sender: TObject);
Var
MF : TForm;
begin
MF:=LazarusIDE.GetMainBar;
if MF=nil then MF:=Application.MainForm;
if Assigned(MF) then
begin
Top:=MF.ClientOrigin.y+32; // Note: docked or not docked
Left:=MF.ClientOrigin.x+(MF.Width-Width) div 2;
end;
ESearch.Clear;
LBMatches.Clear;
RefreshCaption(-1);

View File

@ -41,7 +41,7 @@ Procedure Register;
implementation
uses IDESpotterOptions,forms, graphics,lcltype,idecommands,toolbarintf,menuintf, frmspotter;
uses IDESpotterOptions,forms, graphics,lcltype,idecommands,toolbarintf, idewindowintf, menuintf, frmspotter;
Procedure IdeMenuClicked(Sender : TObject);
@ -49,6 +49,7 @@ begin
ShowSpotterForm;
end;
Procedure Register;
Const
@ -80,6 +81,7 @@ begin
IDESpotteroptionsFrameID)^.Index;
RegisterIDEMenuCommand(itmViewIDEInternalsWindows, 'Spotter', 'Spotter', nil,
@IDEMenuClicked,IDECommand);
IDEWindowCreators.Add('IDESpotter',@CreateSpotterWindow,nil,'40%','10%','+500','+240');
end;
Initialization