mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 13:39:11 +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;
|
procedure TAnchorDockMaster.CloseAll;
|
||||||
var
|
var
|
||||||
AForm: TCustomForm;
|
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
AForm: TCustomForm;
|
||||||
|
AControl: TWinControl;
|
||||||
begin
|
begin
|
||||||
// first hide all to reduce flicker
|
// hide all forms
|
||||||
i:=Screen.CustomFormCount-1;
|
i:=Screen.CustomFormCount-1;
|
||||||
while i>=0 do begin
|
while i>=0 do begin
|
||||||
AForm:=GetParentForm(Screen.CustomForms[i]);
|
AForm:=GetParentForm(Screen.CustomForms[i]);
|
||||||
if AForm<>nil then
|
|
||||||
AForm.Hide;
|
AForm.Hide;
|
||||||
i:=Min(i,Screen.CustomFormCount);
|
i:=Min(i,Screen.CustomFormCount)-1;
|
||||||
end;
|
end;
|
||||||
// then close all, but the MainForm
|
|
||||||
|
// close all forms except the MainForm
|
||||||
i:=Screen.CustomFormCount-1;
|
i:=Screen.CustomFormCount-1;
|
||||||
while i>=0 do begin
|
while i>=0 do begin
|
||||||
AForm:=Screen.CustomForms[i];
|
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;
|
AForm.Close;
|
||||||
i:=Min(i,Screen.CustomFormCount);
|
end;
|
||||||
|
i:=Min(i,Screen.CustomFormCount)-1;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -183,6 +183,20 @@ type
|
|||||||
function NewNode(aParent: TAnchorDockLayoutTreeNode): TAnchorDockLayoutTreeNode;
|
function NewNode(aParent: TAnchorDockLayoutTreeNode): TAnchorDockLayoutTreeNode;
|
||||||
end;
|
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 }
|
||||||
|
|
||||||
TADNameToControl = class
|
TADNameToControl = class
|
||||||
@ -1691,5 +1705,26 @@ begin
|
|||||||
end;
|
end;
|
||||||
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.
|
end.
|
||||||
|
|
||||||
|
@ -193,8 +193,7 @@ begin
|
|||||||
debugln(['TIDEAnchorDockMaster.ShowForm ',DbgSName(AForm),' BringToFront=',BringToFront]);
|
debugln(['TIDEAnchorDockMaster.ShowForm ',DbgSName(AForm),' BringToFront=',BringToFront]);
|
||||||
try
|
try
|
||||||
AForm.DisableAlign;
|
AForm.DisableAlign;
|
||||||
if (AForm.HostDockSite<>nil) or (AForm is TAnchorDockHostSite) then
|
if DockMaster.IsSite(AForm) then begin
|
||||||
begin
|
|
||||||
// already docked
|
// already docked
|
||||||
end else begin
|
end else begin
|
||||||
// this form was not yet docked
|
// this form was not yet docked
|
||||||
@ -234,7 +233,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
finally
|
finally
|
||||||
if AForm=Application.MainForm then
|
if DockMaster.IsCustomSite(AForm) then
|
||||||
AForm.Show
|
AForm.Show
|
||||||
else
|
else
|
||||||
DockMaster.MakeDockable(AForm,true,false);
|
DockMaster.MakeDockable(AForm,true,false);
|
||||||
|
Loading…
Reference in New Issue
Block a user