LCL: Anchordocking: New button to minimize a site. Issue #34347. Patch by Andrey Zubarev

git-svn-id: trunk@59681 -
This commit is contained in:
michl 2018-11-27 20:33:19 +00:00
parent 0dd0d21622
commit b7377b00f9
7 changed files with 1015 additions and 198 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +1,28 @@
object AnchorDockOptionsFrame: TAnchorDockOptionsFrame object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
Left = 0 Left = 0
Height = 482 Height = 567
Top = 0 Top = 0
Width = 416 Width = 490
ClientHeight = 482 ClientHeight = 567
ClientWidth = 416 ClientWidth = 490
DesignTimePPI = 113
OnClick = FrameClick OnClick = FrameClick
ParentFont = False
TabOrder = 0 TabOrder = 0
DesignLeft = 513 DesignLeft = 513
DesignTop = 189 DesignTop = 189
object DragThresholdLabel: TLabel object DragThresholdLabel: TLabel
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner AnchorSideTop.Control = Owner
Left = 10 Left = 12
Height = 13 Height = 19
Top = 10 Top = 12
Width = 111 Width = 122
BorderSpacing.Left = 10 BorderSpacing.Left = 12
BorderSpacing.Top = 10 BorderSpacing.Top = 12
Caption = 'DragThresholdLabel' Caption = 'DragThresholdLabel'
ParentColor = False ParentColor = False
ParentFont = False
end end
object DragThresholdTrackBar: TTrackBar object DragThresholdTrackBar: TTrackBar
AnchorSideLeft.Control = DragThresholdLabel AnchorSideLeft.Control = DragThresholdLabel
@ -27,15 +30,16 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 10 Left = 12
Height = 46 Height = 54
Top = 23 Top = 31
Width = 396 Width = 466
Max = 20 Max = 20
OnChange = DragThresholdTrackBarChange OnChange = DragThresholdTrackBarChange
Position = 0 Position = 0
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Right = 10 BorderSpacing.Right = 12
ParentFont = False
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 1 TabOrder = 1
@ -46,12 +50,13 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
AnchorSideTop.Control = DragThresholdLabel AnchorSideTop.Control = DragThresholdLabel
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = Owner AnchorSideRight.Control = Owner
Left = 127 Left = 141
Height = 23 Height = 27
Top = 5 Top = 8
Width = 50 Width = 59
BorderSpacing.Left = 6 BorderSpacing.Left = 7
MaxValue = 20 MaxValue = 20
ParentFont = False
TabOrder = 0 TabOrder = 0
Visible = False Visible = False
end end
@ -59,13 +64,14 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
AnchorSideLeft.Control = DragThresholdLabel AnchorSideLeft.Control = DragThresholdLabel
AnchorSideTop.Control = DragThresholdTrackBar AnchorSideTop.Control = DragThresholdTrackBar
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 10 Left = 12
Height = 13 Height = 19
Top = 79 Top = 97
Width = 103 Width = 112
BorderSpacing.Top = 10 BorderSpacing.Top = 12
Caption = 'SplitterWidthLabel' Caption = 'SplitterWidthLabel'
ParentColor = False ParentColor = False
ParentFont = False
end end
object SplitterWidthTrackBar: TTrackBar object SplitterWidthTrackBar: TTrackBar
AnchorSideLeft.Control = DragThresholdTrackBar AnchorSideLeft.Control = DragThresholdTrackBar
@ -73,14 +79,15 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = DragThresholdTrackBar AnchorSideRight.Control = DragThresholdTrackBar
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 10 Left = 12
Height = 46 Height = 54
Top = 92 Top = 116
Width = 396 Width = 466
Min = 1 Min = 1
OnChange = SplitterWidthTrackBarChange OnChange = SplitterWidthTrackBarChange
Position = 1 Position = 1
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
ParentFont = False
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 3 TabOrder = 3
@ -89,12 +96,13 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
AnchorSideLeft.Control = DragThresholdLabel AnchorSideLeft.Control = DragThresholdLabel
AnchorSideTop.Control = SplitterWidthTrackBar AnchorSideTop.Control = SplitterWidthTrackBar
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 10 Left = 12
Height = 24 Height = 23
Top = 142 Top = 175
Width = 160 Width = 169
BorderSpacing.Top = 4 BorderSpacing.Top = 5
Caption = 'ScaleOnResizeCheckBox' Caption = 'ScaleOnResizeCheckBox'
ParentFont = False
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 4 TabOrder = 4
@ -103,12 +111,13 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
AnchorSideLeft.Control = ScaleOnResizeCheckBox AnchorSideLeft.Control = ScaleOnResizeCheckBox
AnchorSideTop.Control = ScaleOnResizeCheckBox AnchorSideTop.Control = ScaleOnResizeCheckBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 10 Left = 12
Height = 24 Height = 23
Top = 166 Top = 198
Width = 149 Width = 160
Caption = 'ShowHeaderCheckBox' Caption = 'ShowHeaderCheckBox'
OnChange = ShowHeaderCheckBoxChange OnChange = ShowHeaderCheckBoxChange
ParentFont = False
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 5 TabOrder = 5
@ -117,12 +126,13 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
AnchorSideLeft.Control = ScaleOnResizeCheckBox AnchorSideLeft.Control = ScaleOnResizeCheckBox
AnchorSideTop.Control = ShowHeaderCheckBox AnchorSideTop.Control = ShowHeaderCheckBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 25 Left = 30
Height = 24 Height = 23
Top = 190 Top = 221
Width = 191 Width = 208
BorderSpacing.Left = 15 BorderSpacing.Left = 18
Caption = 'ShowHeaderCaptionCheckBox' Caption = 'ShowHeaderCaptionCheckBox'
ParentFont = False
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 6 TabOrder = 6
@ -131,11 +141,12 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
AnchorSideLeft.Control = ShowHeaderCaptionCheckBox AnchorSideLeft.Control = ShowHeaderCaptionCheckBox
AnchorSideTop.Control = ShowHeaderCaptionCheckBox AnchorSideTop.Control = ShowHeaderCaptionCheckBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 25 Left = 30
Height = 24 Height = 23
Top = 214 Top = 244
Width = 249 Width = 272
Caption = 'HideHeaderCaptionForFloatingCheckBox' Caption = 'HideHeaderCaptionForFloatingCheckBox'
ParentFont = False
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 7 TabOrder = 7
@ -147,15 +158,16 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 122 Left = 136
Height = 27 Height = 27
Top = 286 Top = 313
Width = 284 Width = 342
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6 BorderSpacing.Left = 7
BorderSpacing.Right = 10 BorderSpacing.Right = 12
ItemHeight = 0 ItemHeight = 19
OnDrawItem = HeaderStyleComboBoxDrawItem OnDrawItem = HeaderStyleComboBoxDrawItem
ParentFont = False
Style = csDropDownList Style = csDropDownList
TabOrder = 10 TabOrder = 10
end end
@ -163,23 +175,25 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
AnchorSideLeft.Control = ShowHeaderCheckBox AnchorSideLeft.Control = ShowHeaderCheckBox
AnchorSideTop.Control = HeaderStyleComboBox AnchorSideTop.Control = HeaderStyleComboBox
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 20 Left = 24
Height = 13 Height = 19
Top = 293 Top = 317
Width = 96 Width = 105
BorderSpacing.Left = 10 BorderSpacing.Left = 12
Caption = 'HeaderStyleLabel' Caption = 'HeaderStyleLabel'
ParentColor = False ParentColor = False
ParentFont = False
end end
object FlattenHeadersCheckBox: TCheckBox object FlattenHeadersCheckBox: TCheckBox
AnchorSideLeft.Control = HideHeaderCaptionForFloatingCheckBox AnchorSideLeft.Control = HideHeaderCaptionForFloatingCheckBox
AnchorSideTop.Control = HideHeaderCaptionForFloatingCheckBox AnchorSideTop.Control = HideHeaderCaptionForFloatingCheckBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 25 Left = 30
Height = 24 Height = 23
Top = 238 Top = 267
Width = 164 Width = 175
Caption = 'FlattenHeadersCheckBox' Caption = 'FlattenHeadersCheckBox'
ParentFont = False
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 8 TabOrder = 8
@ -188,11 +202,12 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
AnchorSideLeft.Control = FlattenHeadersCheckBox AnchorSideLeft.Control = FlattenHeadersCheckBox
AnchorSideTop.Control = FlattenHeadersCheckBox AnchorSideTop.Control = FlattenHeadersCheckBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 25 Left = 30
Height = 24 Height = 23
Top = 262 Top = 290
Width = 154 Width = 164
Caption = 'FilledHeadersCheckBox' Caption = 'FilledHeadersCheckBox'
ParentFont = False
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 9 TabOrder = 9
@ -201,11 +216,12 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
AnchorSideLeft.Control = FilledHeadersCheckBox AnchorSideLeft.Control = FilledHeadersCheckBox
AnchorSideTop.Control = HeaderStyleComboBox AnchorSideTop.Control = HeaderStyleComboBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 25 Left = 30
Height = 24 Height = 23
Top = 313 Top = 340
Width = 175 Width = 189
Caption = 'HighlightFocusedCheckBox' Caption = 'HighlightFocusedCheckBox'
ParentFont = False
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 11 TabOrder = 11
@ -215,28 +231,30 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = SplitterWidthLabel AnchorSideTop.Control = SplitterWidthLabel
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 119 Left = 131
Height = 23 Height = 27
Top = 74 Top = 93
Width = 50 Width = 59
BorderSpacing.Left = 6 BorderSpacing.Left = 7
MaxValue = 10 MaxValue = 10
MinValue = 1 MinValue = 1
ParentFont = False
TabOrder = 2 TabOrder = 2
Value = 1 Value = 1
Visible = False Visible = False
end end
object HeaderAlignTopLabel: TLabel object HeaderAlignTopLabel: TLabel
AnchorSideLeft.Control = DragThresholdLabel AnchorSideLeft.Control = DragThresholdLabel
AnchorSideTop.Control = HighlightFocusedCheckBox AnchorSideTop.Control = DockSitesCanBeMinimized
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 10 Left = 12
Height = 13 Height = 19
Top = 347 Top = 398
Width = 117 Width = 130
BorderSpacing.Top = 10 BorderSpacing.Top = 12
Caption = 'HeaderAlignTopLabel' Caption = 'HeaderAlignTopLabel'
ParentColor = False ParentColor = False
ParentFont = False
end end
object HeaderAlignTopTrackBar: TTrackBar object HeaderAlignTopTrackBar: TTrackBar
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
@ -244,17 +262,18 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = DragThresholdTrackBar AnchorSideRight.Control = DragThresholdTrackBar
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 10 Left = 12
Height = 47 Height = 55
Top = 360 Top = 417
Width = 396 Width = 466
Frequency = 10 Frequency = 10
Max = 150 Max = 150
OnChange = HeaderAlignTopTrackBarChange OnChange = HeaderAlignTopTrackBarChange
PageSize = 10 PageSize = 10
Position = 0 Position = 0
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 10 BorderSpacing.Left = 12
ParentFont = False
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 13 TabOrder = 13
@ -264,12 +283,13 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = HeaderAlignTopLabel AnchorSideTop.Control = HeaderAlignTopLabel
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 133 Left = 149
Height = 23 Height = 27
Top = 342 Top = 394
Width = 50 Width = 59
BorderSpacing.Left = 6 BorderSpacing.Left = 7
MaxValue = 150 MaxValue = 150
ParentFont = False
TabOrder = 12 TabOrder = 12
Visible = False Visible = False
end end
@ -277,13 +297,14 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
AnchorSideLeft.Control = DragThresholdLabel AnchorSideLeft.Control = DragThresholdLabel
AnchorSideTop.Control = HeaderAlignTopTrackBar AnchorSideTop.Control = HeaderAlignTopTrackBar
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 10 Left = 12
Height = 13 Height = 19
Top = 417 Top = 484
Width = 120 Width = 130
BorderSpacing.Top = 10 BorderSpacing.Top = 12
Caption = 'HeaderAlignLeftLabel' Caption = 'HeaderAlignLeftLabel'
ParentColor = False ParentColor = False
ParentFont = False
end end
object HeaderAlignLeftTrackBar: TTrackBar object HeaderAlignLeftTrackBar: TTrackBar
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
@ -291,17 +312,18 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = DragThresholdTrackBar AnchorSideRight.Control = DragThresholdTrackBar
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 10 Left = 12
Height = 47 Height = 55
Top = 430 Top = 503
Width = 396 Width = 466
Frequency = 10 Frequency = 10
Max = 200 Max = 200
OnChange = HeaderAlignLeftTrackBarChange OnChange = HeaderAlignLeftTrackBarChange
PageSize = 10 PageSize = 10
Position = 0 Position = 0
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 10 BorderSpacing.Left = 12
ParentFont = False
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 15 TabOrder = 15
@ -311,13 +333,28 @@ object AnchorDockOptionsFrame: TAnchorDockOptionsFrame
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = HeaderAlignLeftLabel AnchorSideTop.Control = HeaderAlignLeftLabel
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 136 Left = 149
Height = 23 Height = 27
Top = 412 Top = 480
Width = 50 Width = 59
BorderSpacing.Left = 6 BorderSpacing.Left = 7
MaxValue = 200 MaxValue = 200
ParentFont = False
TabOrder = 14 TabOrder = 14
Visible = False Visible = False
end 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 end

View File

@ -37,6 +37,7 @@ type
HeaderStyleLabel: TLabel; HeaderStyleLabel: TLabel;
HideHeaderCaptionForFloatingCheckBox: TCheckBox; HideHeaderCaptionForFloatingCheckBox: TCheckBox;
HighlightFocusedCheckBox: TCheckBox; HighlightFocusedCheckBox: TCheckBox;
DockSitesCanBeMinimized: TCheckBox;
ScaleOnResizeCheckBox: TCheckBox; ScaleOnResizeCheckBox: TCheckBox;
ShowHeaderCaptionCheckBox: TCheckBox; ShowHeaderCaptionCheckBox: TCheckBox;
ShowHeaderCheckBox: TCheckBox; ShowHeaderCheckBox: TCheckBox;
@ -202,7 +203,7 @@ begin
HeaderAlignTopSpinEdit.Visible:=true; HeaderAlignTopSpinEdit.Visible:=true;
HeaderAlignTopTrackBar.Visible:=false; HeaderAlignTopTrackBar.Visible:=false;
HeaderAlignTopSpinEdit.AnchorToNeighbour(akTop,6,HighlightFocusedCheckBox); HeaderAlignTopSpinEdit.AnchorToNeighbour(akTop,6,DockSitesCanBeMinimized);
HeaderAlignTopLabel.AnchorVerticalCenterTo(HeaderAlignTopSpinEdit); HeaderAlignTopLabel.AnchorVerticalCenterTo(HeaderAlignTopSpinEdit);
UpdateHeaderAlignTopLabel; UpdateHeaderAlignTopLabel;
@ -299,6 +300,7 @@ begin
HeaderStyleLabel.Enabled:=HasHeaders; HeaderStyleLabel.Enabled:=HasHeaders;
HeaderStyleComboBox.Enabled:=HasHeaders; HeaderStyleComboBox.Enabled:=HasHeaders;
HighlightFocusedCheckBox.Enabled:=HasHeaders; HighlightFocusedCheckBox.Enabled:=HasHeaders;
DockSitesCanBeMinimized.Enabled:=HasHeaders;
end; end;
constructor TAnchorDockOptionsFrame.Create(TheOwner: TComponent); constructor TAnchorDockOptionsFrame.Create(TheOwner: TComponent);
@ -356,6 +358,7 @@ begin
TheSettings.HeaderFilled:=FilledHeadersCheckBox.Checked; TheSettings.HeaderFilled:=FilledHeadersCheckBox.Checked;
TheSettings.HeaderStyle:=TADHeaderStyle(HeaderStyleComboBox.ItemIndex); TheSettings.HeaderStyle:=TADHeaderStyle(HeaderStyleComboBox.ItemIndex);
TheSettings.HeaderHighlightFocused:=HighlightFocusedCheckBox.Checked; TheSettings.HeaderHighlightFocused:=HighlightFocusedCheckBox.Checked;
TheSettings.DockSitesCanBeMinimized:=DockSitesCanBeMinimized.Checked;
end; end;
procedure TAnchorDockOptionsFrame.LoadFromSettings( procedure TAnchorDockOptionsFrame.LoadFromSettings(
@ -429,6 +432,10 @@ begin
HighlightFocusedCheckBox.Checked:=TheSettings.HeaderHighlightFocused; HighlightFocusedCheckBox.Checked:=TheSettings.HeaderHighlightFocused;
HighlightFocusedCheckBox.Caption:=adrsHighlightFocused; HighlightFocusedCheckBox.Caption:=adrsHighlightFocused;
HighlightFocusedCheckBox.Hint:=adrsHighlightFocusedHint; HighlightFocusedCheckBox.Hint:=adrsHighlightFocusedHint;
DockSitesCanBeMinimized.Checked:=TheSettings.DockSitesCanBeMinimized;
DockSitesCanBeMinimized.Caption:=adrsDockSitesCanBeMinimized;
DockSitesCanBeMinimized.Hint:=adrsDockSitesCanBeMinimizedHint;
end; end;
end. end.

View File

@ -55,7 +55,7 @@ begin
begin begin
LayoutNode.NodeType:=adltnControl; LayoutNode.NodeType:=adltnControl;
LayoutNode.Assign(Self); LayoutNode.Assign(Self,false,false);
LayoutNode.Name:={OneControl.}Name; LayoutNode.Name:={OneControl.}Name;
TAnchorDockHostSite(OneControl).SaveLayout(LayoutTree,LayoutNode); TAnchorDockHostSite(OneControl).SaveLayout(LayoutTree,LayoutNode);

View File

@ -64,6 +64,7 @@ type
FTabPosition: TTabPosition; FTabPosition: TTabPosition;
FWindowState: TWindowState; FWindowState: TWindowState;
FControlLocation: TADLControlLocation; FControlLocation: TADLControlLocation;
FMinimized: Boolean;
function GetAnchors(Site: TAnchorKind): string; function GetAnchors(Site: TAnchorKind): string;
function GetBottom: integer; function GetBottom: integer;
function GetHeight: integer; function GetHeight: integer;
@ -90,13 +91,14 @@ type
procedure SetTop(const AValue: integer); procedure SetTop(const AValue: integer);
procedure SetWidth(const AValue: integer); procedure SetWidth(const AValue: integer);
procedure SetWindowState(const AValue: TWindowState); procedure SetWindowState(const AValue: TWindowState);
procedure SetMinimized(const AValue: boolean);
public public
constructor Create; constructor Create;
destructor Destroy; override; destructor Destroy; override;
procedure Clear; procedure Clear;
function IsEqual(Node: TAnchorDockLayoutTreeNode): boolean; function IsEqual(Node: TAnchorDockLayoutTreeNode): boolean;
procedure Assign(Node: TAnchorDockLayoutTreeNode); overload; 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(Config: TConfigStorage); overload;
procedure LoadFromConfig(Path: string; Config: TRttiXMLConfig); overload; procedure LoadFromConfig(Path: string; Config: TRttiXMLConfig); overload;
procedure SaveToConfig(Config: TConfigStorage); overload; procedure SaveToConfig(Config: TConfigStorage); overload;
@ -106,7 +108,7 @@ type
procedure CheckConsistency; virtual; procedure CheckConsistency; virtual;
// simplifying // simplifying
procedure Simplify(ExistingNames: TStrings); procedure Simplify(ExistingNames: TStrings; ParentMinimized: boolean);
procedure DeleteNode(ChildNode: TAnchorDockLayoutTreeNode); procedure DeleteNode(ChildNode: TAnchorDockLayoutTreeNode);
function FindNodeBoundSplitter(ChildNode: TAnchorDockLayoutTreeNode; function FindNodeBoundSplitter(ChildNode: TAnchorDockLayoutTreeNode;
Side: TAnchorKind): TAnchorDockLayoutTreeNode; Side: TAnchorKind): TAnchorDockLayoutTreeNode;
@ -135,6 +137,7 @@ type
property Monitor: integer read FMonitor write SetMonitor; property Monitor: integer read FMonitor write SetMonitor;
property HeaderPosition: TADLHeaderPosition read FHeaderPosition write SetHeaderPosition; property HeaderPosition: TADLHeaderPosition read FHeaderPosition write SetHeaderPosition;
property TabPosition: TTabPosition read FTabPosition write SetTabPosition; property TabPosition: TTabPosition read FTabPosition write SetTabPosition;
property Minimized: Boolean read FMinimized write SetMinimized;
function Count: integer; function Count: integer;
function IsSplitter: boolean; function IsSplitter: boolean;
function IsRootWindow: boolean; function IsRootWindow: boolean;
@ -988,6 +991,13 @@ begin
IncreaseChangeStamp; IncreaseChangeStamp;
end; end;
procedure TAnchorDockLayoutTreeNode.SetMinimized(const AValue: boolean);
begin
if FMinimized=AValue then exit;
FMinimized:=AValue;
IncreaseChangeStamp;
end;
procedure TAnchorDockLayoutTreeNode.SetTop(const AValue: integer); procedure TAnchorDockLayoutTreeNode.SetTop(const AValue: integer);
begin begin
if Top=AValue then exit; if Top=AValue then exit;
@ -1084,6 +1094,7 @@ begin
BoundSplitterPos:=Node.BoundSplitterPos; BoundSplitterPos:=Node.BoundSplitterPos;
WorkAreaRect:=Node.WorkAreaRect; WorkAreaRect:=Node.WorkAreaRect;
Monitor:=Node.Monitor; Monitor:=Node.Monitor;
Minimized:=Node.Minimized;
for a:=low(TAnchorKind) to high(TAnchorKind) do for a:=low(TAnchorKind) to high(TAnchorKind) do
Anchors[a]:=Node.Anchors[a]; Anchors[a]:=Node.Anchors[a];
while Count>Node.Count do Nodes[Count-1].Free; while Count>Node.Count do Nodes[Count-1].Free;
@ -1098,9 +1109,10 @@ begin
end; end;
end; end;
procedure TAnchorDockLayoutTreeNode.Assign(AControl: TControl; OverrideBoundsRect: Boolean=false); procedure TAnchorDockLayoutTreeNode.Assign(AControl: TControl; OverrideBoundsRect, AMinimized: boolean);
var var
AnchorControl: TControl; AnchorControl: TControl;
ParentForm: TCustomForm;
a: TAnchorKind; a: TAnchorKind;
begin begin
Name:=AControl.Name; Name:=AControl.Name;
@ -1109,12 +1121,18 @@ begin
else else
BoundsRect:=AControl.BoundsRect; BoundsRect:=AControl.BoundsRect;
Align:=AControl.Align; Align:=AControl.Align;
Minimized:=AMinimized;
if (AControl.Parent=nil) and (AControl is TCustomForm) then begin if (AControl.Parent=nil) and (AControl is TCustomForm) then begin
WindowState:=TCustomForm(AControl).WindowState; WindowState:=TCustomForm(AControl).WindowState;
Monitor:=TCustomForm(AControl).Monitor.MonitorNum; Monitor:=TCustomForm(AControl).Monitor.MonitorNum;
WorkAreaRect:=TCustomForm(AControl).Monitor.WorkareaRect; WorkAreaRect:=TCustomForm(AControl).Monitor.WorkareaRect;
end else end else begin
WindowState:=GetParentForm(AControl).WindowState; ParentForm:=GetParentForm(AControl);
if Assigned(ParentForm) then
WindowState:=ParentForm.WindowState
else
WindowState:=wsNormal;
end;
if AControl is TCustomTabControl then if AControl is TCustomTabControl then
TabPosition:=TCustomTabControl(AControl).TabPosition TabPosition:=TCustomTabControl(AControl).TabPosition
else else
@ -1137,6 +1155,7 @@ begin
Clear; Clear;
Name:=Config.GetValue('Name',''); Name:=Config.GetValue('Name','');
NodeType:=NameToADLTreeNodeType(Config.GetValue('Type',ADLTreeNodeTypeNames[adltnNone])); NodeType:=NameToADLTreeNodeType(Config.GetValue('Type',ADLTreeNodeTypeNames[adltnNone]));
Minimized:=Config.GetValue('Minimized',false);
Left:=Config.GetValue('Bounds/Left',0); Left:=Config.GetValue('Bounds/Left',0);
Top:=Config.GetValue('Bounds/Top',0); Top:=Config.GetValue('Bounds/Top',0);
Width:=Config.GetValue('Bounds/Width',0); Width:=Config.GetValue('Bounds/Width',0);
@ -1171,6 +1190,7 @@ begin
Clear; Clear;
Name:=Config.GetValue(Path+'Name',''); Name:=Config.GetValue(Path+'Name','');
NodeType:=NameToADLTreeNodeType(Config.GetValue(Path+'Type',ADLTreeNodeTypeNames[adltnNone])); NodeType:=NameToADLTreeNodeType(Config.GetValue(Path+'Type',ADLTreeNodeTypeNames[adltnNone]));
Minimized:=Config.GetValue(Path+'Minimized',false);
Left:=Config.GetValue(Path+'Bounds/Left',0); Left:=Config.GetValue(Path+'Bounds/Left',0);
Top:=Config.GetValue(Path+'Bounds/Top',0); Top:=Config.GetValue(Path+'Bounds/Top',0);
Width:=Config.GetValue(Path+'Bounds/Width',0); Width:=Config.GetValue(Path+'Bounds/Width',0);
@ -1219,6 +1239,7 @@ begin
ADLHeaderPositionNames[adlhpAuto]); ADLHeaderPositionNames[adlhpAuto]);
Config.SetDeleteValue('Header/TabPosition',ADLTabPostionNames[TabPosition], Config.SetDeleteValue('Header/TabPosition',ADLTabPostionNames[TabPosition],
ADLTabPostionNames[tpTop]); ADLTabPostionNames[tpTop]);
Config.SetDeleteValue('Minimized',Minimized,False);
Config.SetDeleteValue('Monitor',Monitor,0); Config.SetDeleteValue('Monitor',Monitor,0);
Config.SetDeleteValue('ChildCount',Count,0); Config.SetDeleteValue('ChildCount',Count,0);
for i:=1 to Count do begin for i:=1 to Count do begin
@ -1252,6 +1273,7 @@ begin
ADLHeaderPositionNames[adlhpAuto]); ADLHeaderPositionNames[adlhpAuto]);
Config.SetDeleteValue(Path+'Header/TabPosition',ADLTabPostionNames[TabPosition], Config.SetDeleteValue(Path+'Header/TabPosition',ADLTabPostionNames[TabPosition],
ADLTabPostionNames[tpTop]); ADLTabPostionNames[tpTop]);
Config.SetDeleteValue(Path+'Minimized',Minimized,False);
Config.SetDeleteValue(Path+'Monitor',Monitor,0); Config.SetDeleteValue(Path+'Monitor',Monitor,0);
Config.SetDeleteValue(Path+'ChildCount',Count,0); Config.SetDeleteValue(Path+'ChildCount',Count,0);
for i:=1 to Count do for i:=1 to Count do
@ -1397,7 +1419,7 @@ begin
end; end;
end; end;
procedure TAnchorDockLayoutTreeNode.Simplify(ExistingNames: TStrings); procedure TAnchorDockLayoutTreeNode.Simplify(ExistingNames: TStrings; ParentMinimized: boolean);
{ Simplification rules: { Simplification rules:
1. Control nodes without existing name are deleted. 1. Control nodes without existing name are deleted.
2. Empty layouts and pages are deleted 2. Empty layouts and pages are deleted
@ -1406,16 +1428,18 @@ procedure TAnchorDockLayoutTreeNode.Simplify(ExistingNames: TStrings);
var var
i: Integer; i: Integer;
ChildNode: TAnchorDockLayoutTreeNode; ChildNode: TAnchorDockLayoutTreeNode;
NodeMinimized: Boolean;
begin begin
// simplify children // simplify children
i:=Count-1; i:=Count-1;
while i>=0 do begin while i>=0 do begin
ChildNode:=Nodes[i]; ChildNode:=Nodes[i];
ChildNode.Simplify(ExistingNames); NodeMinimized:=ParentMinimized or ChildNode.Minimized;
ChildNode.Simplify(ExistingNames,NodeMinimized);
if (ChildNode.NodeType=adltnControl) then begin if (ChildNode.NodeType=adltnControl) then begin
// leaf node => check if there is a control // 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); DeleteNode(ChildNode);
end else if ChildNode.IsSplitter then begin end else if ChildNode.IsSplitter then begin
// splitter // splitter
@ -1424,7 +1448,7 @@ begin
ChildNode[0].Free; ChildNode[0].Free;
end else if ChildNode.NodeType=adltnCustomSite then begin end else if ChildNode.NodeType=adltnCustomSite then begin
// custom dock site // 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 // inner node without child => delete
DeleteNode(ChildNode); DeleteNode(ChildNode);
end else if (ChildNode.Count=1) end else if (ChildNode.Count=1)

View File

@ -8,6 +8,7 @@ interface
resourcestring resourcestring
adrsClose = 'Close'; adrsClose = 'Close';
adrsMinimize = 'Minimize';
adrsQuit = 'Quit %s'; adrsQuit = 'Quit %s';
adrsTabPosition = 'Tab position'; adrsTabPosition = 'Tab position';
adrsMovePageRight = 'Move page right'; adrsMovePageRight = 'Move page right';
@ -82,6 +83,8 @@ resourcestring
adrsFilledHeadersHint = 'Fill headers of docked controls'; adrsFilledHeadersHint = 'Fill headers of docked controls';
adrsHighlightFocused = 'Highlight focused'; adrsHighlightFocused = 'Highlight focused';
adrsHighlightFocusedHint = 'Highlight header of focused docked control'; adrsHighlightFocusedHint = 'Highlight header of focused docked control';
adrsDockSitesCanBeMinimized = 'Dock sites can be minimized';
adrsDockSitesCanBeMinimizedHint = 'Dock sites can be minimized';
implementation implementation

View File

@ -272,7 +272,7 @@ begin
// custom dock site // custom dock site
LayoutNode:=FTree.NewNode(FTree.Root); LayoutNode:=FTree.NewNode(FTree.Root);
LayoutNode.NodeType:=adltnCustomSite; LayoutNode.NodeType:=adltnCustomSite;
LayoutNode.Assign(AForm); LayoutNode.Assign(AForm,false,false);
// can have one normal dock site // can have one normal dock site
Site:=TAnchorDockManager(AForm.DockManager).GetChildSite; Site:=TAnchorDockManager(AForm.DockManager).GetChildSite;
if Site<>nil then begin if Site<>nil then begin
@ -287,7 +287,7 @@ begin
raise EAnchorDockLayoutError.Create('invalid root control for save: '+DbgSName(AControl)); raise EAnchorDockLayoutError.Create('invalid root control for save: '+DbgSName(AControl));
end; end;
// remove invisible controls // remove invisible controls
FTree.Root.Simplify(VisibleControls); FTree.Root.Simplify(VisibleControls,false);
finally finally
VisibleControls.Free; VisibleControls.Free;
SavedSites.Free; SavedSites.Free;