From 9f7c9ac7486d3ff7ab5faf3c3432aa63212a6269 Mon Sep 17 00:00:00 2001 From: michl Date: Wed, 19 Dec 2018 21:07:54 +0000 Subject: [PATCH] AnchorDocking: Save PageIndex. Issue #34727 git-svn-id: trunk@59867 - --- components/anchordocking/anchordocking.pas | 2 ++ .../anchordocking/anchordockstorage.pas | 26 ++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/components/anchordocking/anchordocking.pas b/components/anchordocking/anchordocking.pas index 7c6fe3da62..7f177ea484 100644 --- a/components/anchordocking/anchordocking.pas +++ b/components/anchordocking/anchordocking.pas @@ -2379,6 +2379,7 @@ function TAnchorDockMaster.RestoreLayout(Tree: TAnchorDockLayoutTree; for Side:=Low(TAnchorKind) to high(TAnchorKind) do AControl.AnchorSide[Side].Control:=nil; end; + Site.Pages.PageIndex:=ANode.PageIndex; finally while Site.Pages.PageCount>j do Site.Pages.Page[Site.Pages.PageCount-1].Free; @@ -6005,6 +6006,7 @@ begin LayoutNode.Assign(Self,false,Minimized); LayoutNode.HeaderPosition:=Header.HeaderPosition; LayoutNode.TabPosition:=Pages.TabPosition; + LayoutNode.PageIndex:=Pages.PageIndex; end else LayoutNode.NodeType:=adltnNone; if BoundSplitter<>nil then begin diff --git a/components/anchordocking/anchordockstorage.pas b/components/anchordocking/anchordockstorage.pas index a5f549f8ab..8ec7e7b4ab 100644 --- a/components/anchordocking/anchordockstorage.pas +++ b/components/anchordocking/anchordockstorage.pas @@ -59,6 +59,7 @@ type FName: string; FNodes: TFPList; // list of TAnchorDockLayoutTreeNode FNodeType: TADLTreeNodeType; + FPageIndex: integer; FParent: TAnchorDockLayoutTreeNode; FWorkAreaRect: TRect; FTabPosition: TTabPosition; @@ -84,6 +85,7 @@ type procedure SetMonitor(const AValue: integer); procedure SetName(const AValue: string); procedure SetNodeType(const AValue: TADLTreeNodeType); + procedure SetPageIndex(AValue: integer); procedure SetParent(const AValue: TAnchorDockLayoutTreeNode); procedure SetRight(const AValue: integer); procedure SetWorkAreaRect(const AValue: TRect); @@ -137,6 +139,7 @@ type property Monitor: integer read FMonitor write SetMonitor; property HeaderPosition: TADLHeaderPosition read FHeaderPosition write SetHeaderPosition; property TabPosition: TTabPosition read FTabPosition write SetTabPosition; + property PageIndex: integer read FPageIndex write SetPageIndex; property Minimized: Boolean read FMinimized write SetMinimized; function Count: integer; function IsSplitter: boolean; @@ -956,6 +959,13 @@ begin IncreaseChangeStamp; end; +procedure TAnchorDockLayoutTreeNode.SetPageIndex(AValue: integer); +begin + if FPageIndex = AValue then Exit; + FPageIndex := AValue; + IncreaseChangeStamp; +end; + procedure TAnchorDockLayoutTreeNode.SetParent( const AValue: TAnchorDockLayoutTreeNode); begin @@ -1046,6 +1056,7 @@ begin Align:=alNone; HeaderPosition:=adlhpAuto; TabPosition:=tpTop; + PageIndex:=0; BoundSplitterPos:=0; WorkAreaRect:=Rect(0,0,0,0); for a:=low(TAnchorKind) to high(TAnchorKind) do @@ -1067,6 +1078,7 @@ begin or (WindowState<>Node.WindowState) or (HeaderPosition<>Node.HeaderPosition) or (TabPosition<>Node.TabPosition) + or (PageIndex<>Node.PageIndex) or (BoundSplitterPos<>Node.BoundSplitterPos) or (not CompareRect(@FWorkAreaRect,@Node.FWorkAreaRect)) then @@ -1091,6 +1103,7 @@ begin WindowState:=Node.WindowState; HeaderPosition:=Node.HeaderPosition; TabPosition:=Node.TabPosition; + PageIndex:=Node.PageIndex; BoundSplitterPos:=Node.BoundSplitterPos; WorkAreaRect:=Node.WorkAreaRect; Monitor:=Node.Monitor; @@ -1133,10 +1146,13 @@ begin else WindowState:=wsNormal; end; - if AControl is TCustomTabControl then - TabPosition:=TCustomTabControl(AControl).TabPosition - else + if AControl is TCustomTabControl then begin + TabPosition:=TCustomTabControl(AControl).TabPosition; + PageIndex:=TCustomTabControl(AControl).PageIndex; + end else begin TabPosition:=tpTop; + PageIndex:=0; + end; for a:=low(TAnchorKind) to high(TAnchorKind) do begin AnchorControl:=AControl.AnchorSide[a].Control; if (AnchorControl=nil) or (AnchorControl=AControl.Parent) then @@ -1170,6 +1186,7 @@ begin WindowState:=NameToADLWindowState(Config.GetValue('WindowState',ADLWindowStateNames[wsNormal])); HeaderPosition:=NameToADLHeaderPosition(Config.GetValue('Header/Position',ADLHeaderPositionNames[adlhpAuto])); TabPosition:=NameToADLTabPosition(Config.GetValue('Header/TabPosition',ADLTabPostionNames[tpTop])); + PageIndex:=Config.GetValue('Header/PageIndex',0); Monitor:=Config.GetValue('Monitor',0); NewCount:=Config.GetValue('ChildCount',0); for i:=1 to NewCount do begin @@ -1205,6 +1222,7 @@ begin WindowState:=NameToADLWindowState(Config.GetValue(Path+'WindowState',ADLWindowStateNames[wsNormal])); HeaderPosition:=NameToADLHeaderPosition(Config.GetValue(Path+'Header/Position',ADLHeaderPositionNames[adlhpAuto])); TabPosition:=NameToADLTabPosition(Config.GetValue(Path+'Header/TabPosition',ADLTabPostionNames[tpTop])); + PageIndex:=Config.GetValue(Path+'Header/PageIndex',0); Monitor:=Config.GetValue(Path+'Monitor',0); NewCount:=Config.GetValue(Path+'ChildCount',0); for i:=1 to NewCount do @@ -1239,6 +1257,7 @@ begin ADLHeaderPositionNames[adlhpAuto]); Config.SetDeleteValue('Header/TabPosition',ADLTabPostionNames[TabPosition], ADLTabPostionNames[tpTop]); + Config.SetDeleteValue('Header/PageIndex',PageIndex,0); Config.SetDeleteValue('Minimized',Minimized,False); Config.SetDeleteValue('Monitor',Monitor,0); Config.SetDeleteValue('ChildCount',Count,0); @@ -1273,6 +1292,7 @@ begin ADLHeaderPositionNames[adlhpAuto]); Config.SetDeleteValue(Path+'Header/TabPosition',ADLTabPostionNames[TabPosition], ADLTabPostionNames[tpTop]); + Config.SetDeleteValue(Path+'Header/PageIndex',PageIndex,0); Config.SetDeleteValue(Path+'Minimized',Minimized,False); Config.SetDeleteValue(Path+'Monitor',Monitor,0); Config.SetDeleteValue(Path+'ChildCount',Count,0);