mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-06 06:57:54 +02:00
LCL: Anchordocking: New button to minimize a site. Issue #34347. Patch by Andrey Zubarev
git-svn-id: trunk@59681 -
This commit is contained in:
parent
0dd0d21622
commit
b7377b00f9
File diff suppressed because it is too large
Load Diff
@ -1,25 +1,28 @@
|
||||
object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
|
||||
Left = 0
|
||||
Height = 482
|
||||
Height = 567
|
||||
Top = 0
|
||||
Width = 416
|
||||
ClientHeight = 482
|
||||
ClientWidth = 416
|
||||
Width = 490
|
||||
ClientHeight = 567
|
||||
ClientWidth = 490
|
||||
DesignTimePPI = 113
|
||||
OnClick = FrameClick
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
DesignLeft = 513
|
||||
DesignTop = 189
|
||||
object DragThresholdLabel: TLabel
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = Owner
|
||||
Left = 10
|
||||
Height = 13
|
||||
Top = 10
|
||||
Width = 111
|
||||
BorderSpacing.Left = 10
|
||||
BorderSpacing.Top = 10
|
||||
Left = 12
|
||||
Height = 19
|
||||
Top = 12
|
||||
Width = 122
|
||||
BorderSpacing.Left = 12
|
||||
BorderSpacing.Top = 12
|
||||
Caption = 'DragThresholdLabel'
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object DragThresholdTrackBar: TTrackBar
|
||||
AnchorSideLeft.Control = DragThresholdLabel
|
||||
@ -27,15 +30,16 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 10
|
||||
Height = 46
|
||||
Top = 23
|
||||
Width = 396
|
||||
Left = 12
|
||||
Height = 54
|
||||
Top = 31
|
||||
Width = 466
|
||||
Max = 20
|
||||
OnChange = DragThresholdTrackBarChange
|
||||
Position = 0
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Right = 10
|
||||
BorderSpacing.Right = 12
|
||||
ParentFont = False
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 1
|
||||
@ -46,12 +50,13 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
|
||||
AnchorSideTop.Control = DragThresholdLabel
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = Owner
|
||||
Left = 127
|
||||
Height = 23
|
||||
Top = 5
|
||||
Width = 50
|
||||
BorderSpacing.Left = 6
|
||||
Left = 141
|
||||
Height = 27
|
||||
Top = 8
|
||||
Width = 59
|
||||
BorderSpacing.Left = 7
|
||||
MaxValue = 20
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
Visible = False
|
||||
end
|
||||
@ -59,13 +64,14 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
|
||||
AnchorSideLeft.Control = DragThresholdLabel
|
||||
AnchorSideTop.Control = DragThresholdTrackBar
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 10
|
||||
Height = 13
|
||||
Top = 79
|
||||
Width = 103
|
||||
BorderSpacing.Top = 10
|
||||
Left = 12
|
||||
Height = 19
|
||||
Top = 97
|
||||
Width = 112
|
||||
BorderSpacing.Top = 12
|
||||
Caption = 'SplitterWidthLabel'
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object SplitterWidthTrackBar: TTrackBar
|
||||
AnchorSideLeft.Control = DragThresholdTrackBar
|
||||
@ -73,14 +79,15 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = DragThresholdTrackBar
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 10
|
||||
Height = 46
|
||||
Top = 92
|
||||
Width = 396
|
||||
Left = 12
|
||||
Height = 54
|
||||
Top = 116
|
||||
Width = 466
|
||||
Min = 1
|
||||
OnChange = SplitterWidthTrackBarChange
|
||||
Position = 1
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
ParentFont = False
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 3
|
||||
@ -89,12 +96,13 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
|
||||
AnchorSideLeft.Control = DragThresholdLabel
|
||||
AnchorSideTop.Control = SplitterWidthTrackBar
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 10
|
||||
Height = 24
|
||||
Top = 142
|
||||
Width = 160
|
||||
BorderSpacing.Top = 4
|
||||
Left = 12
|
||||
Height = 23
|
||||
Top = 175
|
||||
Width = 169
|
||||
BorderSpacing.Top = 5
|
||||
Caption = 'ScaleOnResizeCheckBox'
|
||||
ParentFont = False
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 4
|
||||
@ -103,12 +111,13 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
|
||||
AnchorSideLeft.Control = ScaleOnResizeCheckBox
|
||||
AnchorSideTop.Control = ScaleOnResizeCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 10
|
||||
Height = 24
|
||||
Top = 166
|
||||
Width = 149
|
||||
Left = 12
|
||||
Height = 23
|
||||
Top = 198
|
||||
Width = 160
|
||||
Caption = 'ShowHeaderCheckBox'
|
||||
OnChange = ShowHeaderCheckBoxChange
|
||||
ParentFont = False
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 5
|
||||
@ -117,12 +126,13 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
|
||||
AnchorSideLeft.Control = ScaleOnResizeCheckBox
|
||||
AnchorSideTop.Control = ShowHeaderCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 25
|
||||
Height = 24
|
||||
Top = 190
|
||||
Width = 191
|
||||
BorderSpacing.Left = 15
|
||||
Left = 30
|
||||
Height = 23
|
||||
Top = 221
|
||||
Width = 208
|
||||
BorderSpacing.Left = 18
|
||||
Caption = 'ShowHeaderCaptionCheckBox'
|
||||
ParentFont = False
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 6
|
||||
@ -131,11 +141,12 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
|
||||
AnchorSideLeft.Control = ShowHeaderCaptionCheckBox
|
||||
AnchorSideTop.Control = ShowHeaderCaptionCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 25
|
||||
Height = 24
|
||||
Top = 214
|
||||
Width = 249
|
||||
Left = 30
|
||||
Height = 23
|
||||
Top = 244
|
||||
Width = 272
|
||||
Caption = 'HideHeaderCaptionForFloatingCheckBox'
|
||||
ParentFont = False
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 7
|
||||
@ -147,15 +158,16 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 122
|
||||
Left = 136
|
||||
Height = 27
|
||||
Top = 286
|
||||
Width = 284
|
||||
Top = 313
|
||||
Width = 342
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Right = 10
|
||||
ItemHeight = 0
|
||||
BorderSpacing.Left = 7
|
||||
BorderSpacing.Right = 12
|
||||
ItemHeight = 19
|
||||
OnDrawItem = HeaderStyleComboBoxDrawItem
|
||||
ParentFont = False
|
||||
Style = csDropDownList
|
||||
TabOrder = 10
|
||||
end
|
||||
@ -163,23 +175,25 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
|
||||
AnchorSideLeft.Control = ShowHeaderCheckBox
|
||||
AnchorSideTop.Control = HeaderStyleComboBox
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 20
|
||||
Height = 13
|
||||
Top = 293
|
||||
Width = 96
|
||||
BorderSpacing.Left = 10
|
||||
Left = 24
|
||||
Height = 19
|
||||
Top = 317
|
||||
Width = 105
|
||||
BorderSpacing.Left = 12
|
||||
Caption = 'HeaderStyleLabel'
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object FlattenHeadersCheckBox: TCheckBox
|
||||
AnchorSideLeft.Control = HideHeaderCaptionForFloatingCheckBox
|
||||
AnchorSideTop.Control = HideHeaderCaptionForFloatingCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 25
|
||||
Height = 24
|
||||
Top = 238
|
||||
Width = 164
|
||||
Left = 30
|
||||
Height = 23
|
||||
Top = 267
|
||||
Width = 175
|
||||
Caption = 'FlattenHeadersCheckBox'
|
||||
ParentFont = False
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 8
|
||||
@ -188,11 +202,12 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
|
||||
AnchorSideLeft.Control = FlattenHeadersCheckBox
|
||||
AnchorSideTop.Control = FlattenHeadersCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 25
|
||||
Height = 24
|
||||
Top = 262
|
||||
Width = 154
|
||||
Left = 30
|
||||
Height = 23
|
||||
Top = 290
|
||||
Width = 164
|
||||
Caption = 'FilledHeadersCheckBox'
|
||||
ParentFont = False
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 9
|
||||
@ -201,11 +216,12 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
|
||||
AnchorSideLeft.Control = FilledHeadersCheckBox
|
||||
AnchorSideTop.Control = HeaderStyleComboBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 25
|
||||
Height = 24
|
||||
Top = 313
|
||||
Width = 175
|
||||
Left = 30
|
||||
Height = 23
|
||||
Top = 340
|
||||
Width = 189
|
||||
Caption = 'HighlightFocusedCheckBox'
|
||||
ParentFont = False
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 11
|
||||
@ -215,28 +231,30 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = SplitterWidthLabel
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 119
|
||||
Height = 23
|
||||
Top = 74
|
||||
Width = 50
|
||||
BorderSpacing.Left = 6
|
||||
Left = 131
|
||||
Height = 27
|
||||
Top = 93
|
||||
Width = 59
|
||||
BorderSpacing.Left = 7
|
||||
MaxValue = 10
|
||||
MinValue = 1
|
||||
ParentFont = False
|
||||
TabOrder = 2
|
||||
Value = 1
|
||||
Visible = False
|
||||
end
|
||||
object HeaderAlignTopLabel: TLabel
|
||||
AnchorSideLeft.Control = DragThresholdLabel
|
||||
AnchorSideTop.Control = HighlightFocusedCheckBox
|
||||
AnchorSideTop.Control = DockSitesCanBeMinimized
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 10
|
||||
Height = 13
|
||||
Top = 347
|
||||
Width = 117
|
||||
BorderSpacing.Top = 10
|
||||
Left = 12
|
||||
Height = 19
|
||||
Top = 398
|
||||
Width = 130
|
||||
BorderSpacing.Top = 12
|
||||
Caption = 'HeaderAlignTopLabel'
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object HeaderAlignTopTrackBar: TTrackBar
|
||||
AnchorSideLeft.Control = Owner
|
||||
@ -244,17 +262,18 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = DragThresholdTrackBar
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 10
|
||||
Height = 47
|
||||
Top = 360
|
||||
Width = 396
|
||||
Left = 12
|
||||
Height = 55
|
||||
Top = 417
|
||||
Width = 466
|
||||
Frequency = 10
|
||||
Max = 150
|
||||
OnChange = HeaderAlignTopTrackBarChange
|
||||
PageSize = 10
|
||||
Position = 0
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 10
|
||||
BorderSpacing.Left = 12
|
||||
ParentFont = False
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 13
|
||||
@ -264,12 +283,13 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = HeaderAlignTopLabel
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 133
|
||||
Height = 23
|
||||
Top = 342
|
||||
Width = 50
|
||||
BorderSpacing.Left = 6
|
||||
Left = 149
|
||||
Height = 27
|
||||
Top = 394
|
||||
Width = 59
|
||||
BorderSpacing.Left = 7
|
||||
MaxValue = 150
|
||||
ParentFont = False
|
||||
TabOrder = 12
|
||||
Visible = False
|
||||
end
|
||||
@ -277,13 +297,14 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
|
||||
AnchorSideLeft.Control = DragThresholdLabel
|
||||
AnchorSideTop.Control = HeaderAlignTopTrackBar
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 10
|
||||
Height = 13
|
||||
Top = 417
|
||||
Width = 120
|
||||
BorderSpacing.Top = 10
|
||||
Left = 12
|
||||
Height = 19
|
||||
Top = 484
|
||||
Width = 130
|
||||
BorderSpacing.Top = 12
|
||||
Caption = 'HeaderAlignLeftLabel'
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object HeaderAlignLeftTrackBar: TTrackBar
|
||||
AnchorSideLeft.Control = Owner
|
||||
@ -291,17 +312,18 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = DragThresholdTrackBar
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 10
|
||||
Height = 47
|
||||
Top = 430
|
||||
Width = 396
|
||||
Left = 12
|
||||
Height = 55
|
||||
Top = 503
|
||||
Width = 466
|
||||
Frequency = 10
|
||||
Max = 200
|
||||
OnChange = HeaderAlignLeftTrackBarChange
|
||||
PageSize = 10
|
||||
Position = 0
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 10
|
||||
BorderSpacing.Left = 12
|
||||
ParentFont = False
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 15
|
||||
@ -311,13 +333,28 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = HeaderAlignLeftLabel
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 136
|
||||
Height = 23
|
||||
Top = 412
|
||||
Width = 50
|
||||
BorderSpacing.Left = 6
|
||||
Left = 149
|
||||
Height = 27
|
||||
Top = 480
|
||||
Width = 59
|
||||
BorderSpacing.Left = 7
|
||||
MaxValue = 200
|
||||
ParentFont = False
|
||||
TabOrder = 14
|
||||
Visible = False
|
||||
end
|
||||
object DockSitesCanBeMinimized: TCheckBox
|
||||
AnchorSideLeft.Control = FilledHeadersCheckBox
|
||||
AnchorSideTop.Control = HighlightFocusedCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 30
|
||||
Height = 23
|
||||
Top = 363
|
||||
Width = 185
|
||||
Caption = 'DockSitesCanBeMinimized'
|
||||
ParentFont = False
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 16
|
||||
end
|
||||
end
|
||||
|
@ -37,6 +37,7 @@ type
|
||||
HeaderStyleLabel: TLabel;
|
||||
HideHeaderCaptionForFloatingCheckBox: TCheckBox;
|
||||
HighlightFocusedCheckBox: TCheckBox;
|
||||
DockSitesCanBeMinimized: TCheckBox;
|
||||
ScaleOnResizeCheckBox: TCheckBox;
|
||||
ShowHeaderCaptionCheckBox: TCheckBox;
|
||||
ShowHeaderCheckBox: TCheckBox;
|
||||
@ -202,7 +203,7 @@ begin
|
||||
|
||||
HeaderAlignTopSpinEdit.Visible:=true;
|
||||
HeaderAlignTopTrackBar.Visible:=false;
|
||||
HeaderAlignTopSpinEdit.AnchorToNeighbour(akTop,6,HighlightFocusedCheckBox);
|
||||
HeaderAlignTopSpinEdit.AnchorToNeighbour(akTop,6,DockSitesCanBeMinimized);
|
||||
HeaderAlignTopLabel.AnchorVerticalCenterTo(HeaderAlignTopSpinEdit);
|
||||
UpdateHeaderAlignTopLabel;
|
||||
|
||||
@ -299,6 +300,7 @@ begin
|
||||
HeaderStyleLabel.Enabled:=HasHeaders;
|
||||
HeaderStyleComboBox.Enabled:=HasHeaders;
|
||||
HighlightFocusedCheckBox.Enabled:=HasHeaders;
|
||||
DockSitesCanBeMinimized.Enabled:=HasHeaders;
|
||||
end;
|
||||
|
||||
constructor TAnchorDockOptionsFrame.Create(TheOwner: TComponent);
|
||||
@ -356,6 +358,7 @@ begin
|
||||
TheSettings.HeaderFilled:=FilledHeadersCheckBox.Checked;
|
||||
TheSettings.HeaderStyle:=TADHeaderStyle(HeaderStyleComboBox.ItemIndex);
|
||||
TheSettings.HeaderHighlightFocused:=HighlightFocusedCheckBox.Checked;
|
||||
TheSettings.DockSitesCanBeMinimized:=DockSitesCanBeMinimized.Checked;
|
||||
end;
|
||||
|
||||
procedure TAnchorDockOptionsFrame.LoadFromSettings(
|
||||
@ -429,6 +432,10 @@ begin
|
||||
HighlightFocusedCheckBox.Checked:=TheSettings.HeaderHighlightFocused;
|
||||
HighlightFocusedCheckBox.Caption:=adrsHighlightFocused;
|
||||
HighlightFocusedCheckBox.Hint:=adrsHighlightFocusedHint;
|
||||
|
||||
DockSitesCanBeMinimized.Checked:=TheSettings.DockSitesCanBeMinimized;
|
||||
DockSitesCanBeMinimized.Caption:=adrsDockSitesCanBeMinimized;
|
||||
DockSitesCanBeMinimized.Hint:=adrsDockSitesCanBeMinimizedHint;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -55,7 +55,7 @@ begin
|
||||
begin
|
||||
|
||||
LayoutNode.NodeType:=adltnControl;
|
||||
LayoutNode.Assign(Self);
|
||||
LayoutNode.Assign(Self,false,false);
|
||||
LayoutNode.Name:={OneControl.}Name;
|
||||
|
||||
TAnchorDockHostSite(OneControl).SaveLayout(LayoutTree,LayoutNode);
|
||||
|
@ -64,6 +64,7 @@ type
|
||||
FTabPosition: TTabPosition;
|
||||
FWindowState: TWindowState;
|
||||
FControlLocation: TADLControlLocation;
|
||||
FMinimized: Boolean;
|
||||
function GetAnchors(Site: TAnchorKind): string;
|
||||
function GetBottom: integer;
|
||||
function GetHeight: integer;
|
||||
@ -90,13 +91,14 @@ type
|
||||
procedure SetTop(const AValue: integer);
|
||||
procedure SetWidth(const AValue: integer);
|
||||
procedure SetWindowState(const AValue: TWindowState);
|
||||
procedure SetMinimized(const AValue: boolean);
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure Clear;
|
||||
function IsEqual(Node: TAnchorDockLayoutTreeNode): boolean;
|
||||
procedure Assign(Node: TAnchorDockLayoutTreeNode); overload;
|
||||
procedure Assign(AControl: TControl; OverrideBoundsRect: Boolean=false); overload;
|
||||
procedure Assign(AControl: TControl; OverrideBoundsRect, AMinimized: boolean); overload;
|
||||
procedure LoadFromConfig(Config: TConfigStorage); overload;
|
||||
procedure LoadFromConfig(Path: string; Config: TRttiXMLConfig); overload;
|
||||
procedure SaveToConfig(Config: TConfigStorage); overload;
|
||||
@ -106,7 +108,7 @@ type
|
||||
procedure CheckConsistency; virtual;
|
||||
|
||||
// simplifying
|
||||
procedure Simplify(ExistingNames: TStrings);
|
||||
procedure Simplify(ExistingNames: TStrings; ParentMinimized: boolean);
|
||||
procedure DeleteNode(ChildNode: TAnchorDockLayoutTreeNode);
|
||||
function FindNodeBoundSplitter(ChildNode: TAnchorDockLayoutTreeNode;
|
||||
Side: TAnchorKind): TAnchorDockLayoutTreeNode;
|
||||
@ -135,6 +137,7 @@ type
|
||||
property Monitor: integer read FMonitor write SetMonitor;
|
||||
property HeaderPosition: TADLHeaderPosition read FHeaderPosition write SetHeaderPosition;
|
||||
property TabPosition: TTabPosition read FTabPosition write SetTabPosition;
|
||||
property Minimized: Boolean read FMinimized write SetMinimized;
|
||||
function Count: integer;
|
||||
function IsSplitter: boolean;
|
||||
function IsRootWindow: boolean;
|
||||
@ -988,6 +991,13 @@ begin
|
||||
IncreaseChangeStamp;
|
||||
end;
|
||||
|
||||
procedure TAnchorDockLayoutTreeNode.SetMinimized(const AValue: boolean);
|
||||
begin
|
||||
if FMinimized=AValue then exit;
|
||||
FMinimized:=AValue;
|
||||
IncreaseChangeStamp;
|
||||
end;
|
||||
|
||||
procedure TAnchorDockLayoutTreeNode.SetTop(const AValue: integer);
|
||||
begin
|
||||
if Top=AValue then exit;
|
||||
@ -1084,6 +1094,7 @@ begin
|
||||
BoundSplitterPos:=Node.BoundSplitterPos;
|
||||
WorkAreaRect:=Node.WorkAreaRect;
|
||||
Monitor:=Node.Monitor;
|
||||
Minimized:=Node.Minimized;
|
||||
for a:=low(TAnchorKind) to high(TAnchorKind) do
|
||||
Anchors[a]:=Node.Anchors[a];
|
||||
while Count>Node.Count do Nodes[Count-1].Free;
|
||||
@ -1098,9 +1109,10 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TAnchorDockLayoutTreeNode.Assign(AControl: TControl; OverrideBoundsRect: Boolean=false);
|
||||
procedure TAnchorDockLayoutTreeNode.Assign(AControl: TControl; OverrideBoundsRect, AMinimized: boolean);
|
||||
var
|
||||
AnchorControl: TControl;
|
||||
ParentForm: TCustomForm;
|
||||
a: TAnchorKind;
|
||||
begin
|
||||
Name:=AControl.Name;
|
||||
@ -1109,12 +1121,18 @@ begin
|
||||
else
|
||||
BoundsRect:=AControl.BoundsRect;
|
||||
Align:=AControl.Align;
|
||||
Minimized:=AMinimized;
|
||||
if (AControl.Parent=nil) and (AControl is TCustomForm) then begin
|
||||
WindowState:=TCustomForm(AControl).WindowState;
|
||||
Monitor:=TCustomForm(AControl).Monitor.MonitorNum;
|
||||
WorkAreaRect:=TCustomForm(AControl).Monitor.WorkareaRect;
|
||||
end else
|
||||
WindowState:=GetParentForm(AControl).WindowState;
|
||||
end else begin
|
||||
ParentForm:=GetParentForm(AControl);
|
||||
if Assigned(ParentForm) then
|
||||
WindowState:=ParentForm.WindowState
|
||||
else
|
||||
WindowState:=wsNormal;
|
||||
end;
|
||||
if AControl is TCustomTabControl then
|
||||
TabPosition:=TCustomTabControl(AControl).TabPosition
|
||||
else
|
||||
@ -1137,6 +1155,7 @@ begin
|
||||
Clear;
|
||||
Name:=Config.GetValue('Name','');
|
||||
NodeType:=NameToADLTreeNodeType(Config.GetValue('Type',ADLTreeNodeTypeNames[adltnNone]));
|
||||
Minimized:=Config.GetValue('Minimized',false);
|
||||
Left:=Config.GetValue('Bounds/Left',0);
|
||||
Top:=Config.GetValue('Bounds/Top',0);
|
||||
Width:=Config.GetValue('Bounds/Width',0);
|
||||
@ -1171,6 +1190,7 @@ begin
|
||||
Clear;
|
||||
Name:=Config.GetValue(Path+'Name','');
|
||||
NodeType:=NameToADLTreeNodeType(Config.GetValue(Path+'Type',ADLTreeNodeTypeNames[adltnNone]));
|
||||
Minimized:=Config.GetValue(Path+'Minimized',false);
|
||||
Left:=Config.GetValue(Path+'Bounds/Left',0);
|
||||
Top:=Config.GetValue(Path+'Bounds/Top',0);
|
||||
Width:=Config.GetValue(Path+'Bounds/Width',0);
|
||||
@ -1219,6 +1239,7 @@ begin
|
||||
ADLHeaderPositionNames[adlhpAuto]);
|
||||
Config.SetDeleteValue('Header/TabPosition',ADLTabPostionNames[TabPosition],
|
||||
ADLTabPostionNames[tpTop]);
|
||||
Config.SetDeleteValue('Minimized',Minimized,False);
|
||||
Config.SetDeleteValue('Monitor',Monitor,0);
|
||||
Config.SetDeleteValue('ChildCount',Count,0);
|
||||
for i:=1 to Count do begin
|
||||
@ -1252,6 +1273,7 @@ begin
|
||||
ADLHeaderPositionNames[adlhpAuto]);
|
||||
Config.SetDeleteValue(Path+'Header/TabPosition',ADLTabPostionNames[TabPosition],
|
||||
ADLTabPostionNames[tpTop]);
|
||||
Config.SetDeleteValue(Path+'Minimized',Minimized,False);
|
||||
Config.SetDeleteValue(Path+'Monitor',Monitor,0);
|
||||
Config.SetDeleteValue(Path+'ChildCount',Count,0);
|
||||
for i:=1 to Count do
|
||||
@ -1397,7 +1419,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TAnchorDockLayoutTreeNode.Simplify(ExistingNames: TStrings);
|
||||
procedure TAnchorDockLayoutTreeNode.Simplify(ExistingNames: TStrings; ParentMinimized: boolean);
|
||||
{ Simplification rules:
|
||||
1. Control nodes without existing name are deleted.
|
||||
2. Empty layouts and pages are deleted
|
||||
@ -1406,16 +1428,18 @@ procedure TAnchorDockLayoutTreeNode.Simplify(ExistingNames: TStrings);
|
||||
var
|
||||
i: Integer;
|
||||
ChildNode: TAnchorDockLayoutTreeNode;
|
||||
NodeMinimized: Boolean;
|
||||
begin
|
||||
// simplify children
|
||||
i:=Count-1;
|
||||
while i>=0 do begin
|
||||
ChildNode:=Nodes[i];
|
||||
ChildNode.Simplify(ExistingNames);
|
||||
NodeMinimized:=ParentMinimized or ChildNode.Minimized;
|
||||
ChildNode.Simplify(ExistingNames,NodeMinimized);
|
||||
|
||||
if (ChildNode.NodeType=adltnControl) then begin
|
||||
// leaf node => check if there is a control
|
||||
if (ChildNode.Name='') or (ExistingNames.IndexOf(ChildNode.Name)<0) then
|
||||
if (ChildNode.Name='') or ((ExistingNames.IndexOf(ChildNode.Name)<0) and (not NodeMinimized)) then
|
||||
DeleteNode(ChildNode);
|
||||
end else if ChildNode.IsSplitter then begin
|
||||
// splitter
|
||||
@ -1424,7 +1448,7 @@ begin
|
||||
ChildNode[0].Free;
|
||||
end else if ChildNode.NodeType=adltnCustomSite then begin
|
||||
// custom dock site
|
||||
end else if ChildNode.Count=0 then begin
|
||||
end else if (ChildNode.Count=0) and (not NodeMinimized) then begin
|
||||
// inner node without child => delete
|
||||
DeleteNode(ChildNode);
|
||||
end else if (ChildNode.Count=1)
|
||||
|
@ -8,6 +8,7 @@ interface
|
||||
|
||||
resourcestring
|
||||
adrsClose = 'Close';
|
||||
adrsMinimize = 'Minimize';
|
||||
adrsQuit = 'Quit %s';
|
||||
adrsTabPosition = 'Tab position';
|
||||
adrsMovePageRight = 'Move page right';
|
||||
@ -82,6 +83,8 @@ resourcestring
|
||||
adrsFilledHeadersHint = 'Fill headers of docked controls';
|
||||
adrsHighlightFocused = 'Highlight focused';
|
||||
adrsHighlightFocusedHint = 'Highlight header of focused docked control';
|
||||
adrsDockSitesCanBeMinimized = 'Dock sites can be minimized';
|
||||
adrsDockSitesCanBeMinimizedHint = 'Dock sites can be minimized';
|
||||
|
||||
implementation
|
||||
|
||||
|
@ -272,7 +272,7 @@ begin
|
||||
// custom dock site
|
||||
LayoutNode:=FTree.NewNode(FTree.Root);
|
||||
LayoutNode.NodeType:=adltnCustomSite;
|
||||
LayoutNode.Assign(AForm);
|
||||
LayoutNode.Assign(AForm,false,false);
|
||||
// can have one normal dock site
|
||||
Site:=TAnchorDockManager(AForm.DockManager).GetChildSite;
|
||||
if Site<>nil then begin
|
||||
@ -287,7 +287,7 @@ begin
|
||||
raise EAnchorDockLayoutError.Create('invalid root control for save: '+DbgSName(AControl));
|
||||
end;
|
||||
// remove invisible controls
|
||||
FTree.Root.Simplify(VisibleControls);
|
||||
FTree.Root.Simplify(VisibleControls,false);
|
||||
finally
|
||||
VisibleControls.Free;
|
||||
SavedSites.Free;
|
||||
|
Loading…
Reference in New Issue
Block a user