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

View File

@ -64,6 +64,7 @@ type
destructor Destroy; override; destructor Destroy; override;
procedure MakeIDEWindowDockSite(AForm: TCustomForm); override; procedure MakeIDEWindowDockSite(AForm: TCustomForm); override;
procedure MakeIDEWindowDockable(AControl: TWinControl); override; procedure MakeIDEWindowDockable(AControl: TWinControl); override;
function AddableInWindowMenu(AForm: TCustomForm): boolean; override;
function GetDefaultLayoutFilename: string; function GetDefaultLayoutFilename: string;
procedure LoadDefaultLayout; procedure LoadDefaultLayout;
procedure LoadUserLayout; procedure LoadUserLayout;
@ -175,6 +176,14 @@ begin
DockMaster.MakeDockable(AControl,false); DockMaster.MakeDockable(AControl,false);
end; 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; function TIDEAnchorDockMaster.GetDefaultLayoutFilename: string;
begin begin
Result:=AppendPathDelim(LazarusIDE.GetPrimaryConfigPath)+DefaultConfigFileName; Result:=AppendPathDelim(LazarusIDE.GetPrimaryConfigPath)+DefaultConfigFileName;

View File

@ -61,7 +61,7 @@ uses
CodeToolManager, CodeCache, AVL_Tree, SynEditKeyCmds, CodeToolManager, CodeCache, AVL_Tree, SynEditKeyCmds,
// IDEIntf // IDEIntf
LazConf, LazarusIDEStrConsts, SrcEditorIntf, LazIDEIntf, MenuIntf, LazConf, LazarusIDEStrConsts, SrcEditorIntf, LazIDEIntf, MenuIntf,
IDECommands, IDEMsgIntf, IDECommands, IDEMsgIntf, IDEWindowIntf,
// IDE // IDE
ProjectDefs, Project, PublishModule, BuildLazDialog, Compiler, ProjectDefs, Project, PublishModule, BuildLazDialog, Compiler,
ComponentReg, OutputFilter, ComponentReg, OutputFilter,
@ -209,8 +209,7 @@ begin
while (i>=0) do begin while (i>=0) do begin
if Screen.CustomForms[i].Caption=(Sender as TIDEMenuCommand).Caption then if Screen.CustomForms[i].Caption=(Sender as TIDEMenuCommand).Caption then
begin begin
Screen.CustomForms[i].Show; IDEWindowCreators.ShowForm(Screen.CustomForms[i],true);
Screen.CustomForms[i].BringToFront;
break; break;
end; end;
dec(i); dec(i);
@ -1048,10 +1047,17 @@ begin
// add special IDE windows // add special IDE windows
for i:=0 to Screen.FormCount-1 do begin for i:=0 to Screen.FormCount-1 do begin
AForm:=Screen.Forms[i]; AForm:=Screen.Forms[i];
if (AForm.Parent=nil) and (AForm<>MainIDEBar) and (AForm<>SplashForm) //debugln(['TMainIDEBase.UpdateWindowMenu ',DbgSName(AForm),' Vis=',AForm.IsVisible,' Des=',DbgSName(AForm.Designer)]);
and (AForm.Designer=nil) and (AForm.Visible) if (not AForm.IsVisible) or (AForm=MainIDEBar) or (AForm=SplashForm)
and (WindowsList.IndexOf(AForm)<0) then or (AForm.Designer<>nil) or (WindowsList.IndexOf(AForm)>=0) then
WindowsList.Add(AForm); 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; end;
// add designer forms and datamodule forms // add designer forms and datamodule forms
for i:=0 to Screen.FormCount-1 do begin 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 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 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 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 procedure CloseAll; virtual; // close all forms, called after IDE has saved all and shuts down
end; end;
@ -1479,6 +1480,11 @@ end;
{ TIDEDockMaster } { TIDEDockMaster }
function TIDEDockMaster.AddableInWindowMenu(AForm: TCustomForm): boolean;
begin
Result:=true;
end;
procedure TIDEDockMaster.CloseAll; procedure TIDEDockMaster.CloseAll;
begin begin
CloseAllForms; CloseAllForms;