AnchorDocking: Save PageIndex. Issue #34727

git-svn-id: trunk@59867 -
This commit is contained in:
michl 2018-12-19 21:07:54 +00:00
parent 8e2489be65
commit 9f7c9ac748
2 changed files with 25 additions and 3 deletions

View File

@ -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

View File

@ -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);