IDE: ask dockmaster what to show in window menu

git-svn-id: trunk@26209 -
This commit is contained in:
mattias 2010-06-20 14:50:50 +00:00
parent e9b21036b9
commit 559c4d9746
3 changed files with 28 additions and 7 deletions
examples/anchordocking/design
ide
ideintf

View File

@ -64,6 +64,7 @@ type
destructor Destroy; override;
procedure MakeIDEWindowDockSite(AForm: TCustomForm); override;
procedure MakeIDEWindowDockable(AControl: TWinControl); override;
function AddableInWindowMenu(AForm: TCustomForm): boolean; override;
function GetDefaultLayoutFilename: string;
procedure LoadDefaultLayout;
procedure LoadUserLayout;
@ -175,6 +176,14 @@ begin
DockMaster.MakeDockable(AControl,false);
end;
function TIDEAnchorDockMaster.AddableInWindowMenu(AForm: TCustomForm): boolean;
begin
Result:=false;
if AForm is TAnchorDockHostSite then exit;
if (DockMaster.FindControl(AForm.Name)=nil) and (AForm.Parent<>nil) then exit;
Result:=true;
end;
function TIDEAnchorDockMaster.GetDefaultLayoutFilename: string;
begin
Result:=AppendPathDelim(LazarusIDE.GetPrimaryConfigPath)+DefaultConfigFileName;

View File

@ -61,7 +61,7 @@ uses
CodeToolManager, CodeCache, AVL_Tree, SynEditKeyCmds,
// IDEIntf
LazConf, LazarusIDEStrConsts, SrcEditorIntf, LazIDEIntf, MenuIntf,
IDECommands, IDEMsgIntf,
IDECommands, IDEMsgIntf, IDEWindowIntf,
// IDE
ProjectDefs, Project, PublishModule, BuildLazDialog, Compiler,
ComponentReg, OutputFilter,
@ -209,8 +209,7 @@ begin
while (i>=0) do begin
if Screen.CustomForms[i].Caption=(Sender as TIDEMenuCommand).Caption then
begin
Screen.CustomForms[i].Show;
Screen.CustomForms[i].BringToFront;
IDEWindowCreators.ShowForm(Screen.CustomForms[i],true);
break;
end;
dec(i);
@ -1048,10 +1047,17 @@ begin
// add special IDE windows
for i:=0 to Screen.FormCount-1 do begin
AForm:=Screen.Forms[i];
if (AForm.Parent=nil) and (AForm<>MainIDEBar) and (AForm<>SplashForm)
and (AForm.Designer=nil) and (AForm.Visible)
and (WindowsList.IndexOf(AForm)<0) then
WindowsList.Add(AForm);
//debugln(['TMainIDEBase.UpdateWindowMenu ',DbgSName(AForm),' Vis=',AForm.IsVisible,' Des=',DbgSName(AForm.Designer)]);
if (not AForm.IsVisible) or (AForm=MainIDEBar) or (AForm=SplashForm)
or (AForm.Designer<>nil) or (WindowsList.IndexOf(AForm)>=0) then
continue;
if IDEDockMaster<>nil then
begin
if not IDEDockMaster.AddableInWindowMenu(AForm) then continue;
end else begin
if AForm.Parent<>nil then continue;
end;
WindowsList.Add(AForm);
end;
// add designer forms and datamodule forms
for i:=0 to Screen.FormCount-1 do begin

View File

@ -343,6 +343,7 @@ type
procedure MakeIDEWindowDockable(AControl: TWinControl); virtual; abstract; // make AControl dockable, it can be docked and other dockable windows can be docked to it, this does not make it visible
procedure MakeIDEWindowDockSite(AForm: TCustomForm); virtual; abstract; // make AForm a dock site, AForm can not be docked, its Parent must be kept nil, this does not make it visible
procedure ShowForm(AForm: TCustomForm; BringToFront: boolean); virtual; abstract; // make a form visible, set BringToFront=true if form should be shown on active screen and on front of other windows, normally this focus the form
function AddableInWindowMenu(AForm: TCustomForm): boolean; virtual;
procedure CloseAll; virtual; // close all forms, called after IDE has saved all and shuts down
end;
@ -1479,6 +1480,11 @@ end;
{ TIDEDockMaster }
function TIDEDockMaster.AddableInWindowMenu(AForm: TCustomForm): boolean;
begin
Result:=true;
end;
procedure TIDEDockMaster.CloseAll;
begin
CloseAllForms;