mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-21 09:59:32 +02:00
anchordocking: started default layouts
git-svn-id: trunk@26117 -
This commit is contained in:
parent
9570fff742
commit
853aeb948f
@ -1701,24 +1701,33 @@ end;
|
||||
|
||||
procedure TAnchorDockMaster.CloseAll;
|
||||
var
|
||||
AForm: TCustomForm;
|
||||
i: Integer;
|
||||
AForm: TCustomForm;
|
||||
AControl: TWinControl;
|
||||
begin
|
||||
// first hide all to reduce flicker
|
||||
// hide all forms
|
||||
i:=Screen.CustomFormCount-1;
|
||||
while i>=0 do begin
|
||||
AForm:=GetParentForm(Screen.CustomForms[i]);
|
||||
if AForm<>nil then
|
||||
AForm.Hide;
|
||||
i:=Min(i,Screen.CustomFormCount);
|
||||
AForm.Hide;
|
||||
i:=Min(i,Screen.CustomFormCount)-1;
|
||||
end;
|
||||
// then close all, but the MainForm
|
||||
|
||||
// close all forms except the MainForm
|
||||
i:=Screen.CustomFormCount-1;
|
||||
while i>=0 do begin
|
||||
AForm:=Screen.CustomForms[i];
|
||||
if AForm<>Application.MainForm then
|
||||
if (AForm<>Application.MainForm) and not AForm.IsParentOf(Application.MainForm)
|
||||
then begin
|
||||
AControl:=AForm;
|
||||
while (AControl.Parent<>nil)
|
||||
and (AControl.Parent<>Application.MainForm) do begin
|
||||
AControl:=AControl.Parent;
|
||||
if AControl is TCustomForm then AForm:=TCustomForm(AControl);
|
||||
end;
|
||||
AForm.Close;
|
||||
i:=Min(i,Screen.CustomFormCount);
|
||||
end;
|
||||
i:=Min(i,Screen.CustomFormCount)-1;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -183,6 +183,20 @@ type
|
||||
function NewNode(aParent: TAnchorDockLayoutTreeNode): TAnchorDockLayoutTreeNode;
|
||||
end;
|
||||
|
||||
{ TAnchorDockDefaultLayout }
|
||||
|
||||
TAnchorDockDefaultLayout = class
|
||||
private
|
||||
FControlNames: TStrings;
|
||||
FLayout: TAnchorDockLayoutTree;
|
||||
procedure SetControlNames(const AValue: TStrings);
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
property ControlNames: TStrings read FControlNames write SetControlNames;
|
||||
property Layout: TAnchorDockLayoutTree read FLayout;
|
||||
end;
|
||||
|
||||
{ TADNameToControl }
|
||||
|
||||
TADNameToControl = class
|
||||
@ -1691,5 +1705,26 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TAnchorDockDefaultLayout }
|
||||
|
||||
procedure TAnchorDockDefaultLayout.SetControlNames(const AValue: TStrings);
|
||||
begin
|
||||
if FControlNames=AValue then exit;
|
||||
FControlNames.Assign(AValue);
|
||||
end;
|
||||
|
||||
constructor TAnchorDockDefaultLayout.Create;
|
||||
begin
|
||||
FControlNames:=TStringList.Create;
|
||||
FLayout:=TAnchorDockLayoutTree.Create;
|
||||
end;
|
||||
|
||||
destructor TAnchorDockDefaultLayout.Destroy;
|
||||
begin
|
||||
FreeAndNil(FLayout);
|
||||
FreeAndNil(FControlNames);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -193,8 +193,7 @@ begin
|
||||
debugln(['TIDEAnchorDockMaster.ShowForm ',DbgSName(AForm),' BringToFront=',BringToFront]);
|
||||
try
|
||||
AForm.DisableAlign;
|
||||
if (AForm.HostDockSite<>nil) or (AForm is TAnchorDockHostSite) then
|
||||
begin
|
||||
if DockMaster.IsSite(AForm) then begin
|
||||
// already docked
|
||||
end else begin
|
||||
// this form was not yet docked
|
||||
@ -234,7 +233,7 @@ begin
|
||||
end;
|
||||
|
||||
finally
|
||||
if AForm=Application.MainForm then
|
||||
if DockMaster.IsCustomSite(AForm) then
|
||||
AForm.Show
|
||||
else
|
||||
DockMaster.MakeDockable(AForm,true,false);
|
||||
|
Loading…
Reference in New Issue
Block a user