From 9b6e7948a906cc317050c9bbd0947e15a1a53bd0 Mon Sep 17 00:00:00 2001 From: mattias Date: Tue, 22 Jun 2010 15:32:53 +0000 Subject: [PATCH] anchordocking: flag to Scale when restore layout git-svn-id: trunk@26255 - --- examples/anchordocking/anchordocking.pas | 14 ++++++++------ .../anchordocking/design/registeranchordocking.pas | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/examples/anchordocking/anchordocking.pas b/examples/anchordocking/anchordocking.pas index b79702a188..cb7f221296 100644 --- a/examples/anchordocking/anchordocking.pas +++ b/examples/anchordocking/anchordocking.pas @@ -406,7 +406,7 @@ type function CreateNeededControls(Tree: TAnchorDockLayoutTree; DisableAutoSizing: boolean; ControlNames: TStrings): boolean; procedure MapTreeToControls(Tree: TAnchorDockLayoutTree); - function RestoreLayout(Tree: TAnchorDockLayoutTree): boolean; + function RestoreLayout(Tree: TAnchorDockLayoutTree; Scale: boolean): boolean; procedure EnableAllAutoSizing; procedure ClearLayoutProperties(AControl: TControl); procedure PopupMenuPopup(Sender: TObject); @@ -467,7 +467,7 @@ type LayoutTree: TAnchorDockLayoutTree); function CreateRestoreLayout(AControl: TControl): TAnchorDockRestoreLayout; function ConfigIsEmpty(Config: TConfigStorage): boolean; - function LoadLayoutFromConfig(Config: TConfigStorage): boolean; + function LoadLayoutFromConfig(Config: TConfigStorage; Scale: Boolean): boolean; property RestoreLayouts: TAnchorDockRestoreLayouts read FRestoreLayouts; // manual docking @@ -1174,7 +1174,8 @@ begin MapSplitters(Tree.Root); end; -function TAnchorDockMaster.RestoreLayout(Tree: TAnchorDockLayoutTree): boolean; +function TAnchorDockMaster.RestoreLayout(Tree: TAnchorDockLayoutTree; + Scale: boolean): boolean; var ScreenWidth, ScreenHeight: integer; @@ -1251,7 +1252,7 @@ var NewBounds: TRect; begin Result:=nil; - if SrcRectValid(Node.ScreenRect) then + if Scale and SrcRectValid(Node.ScreenRect) then SrcRect:=Node.ScreenRect; //debugln(['Restore ',Node.Name,' ',dbgs(Node.NodeType),' Bounds=',dbgs(Node.BoundsRect),' Parent=',DbgSName(Parent),' ']); if Node.NodeType=adltnControl then begin @@ -2069,7 +2070,8 @@ begin Result:=Config.GetValue('MainConfig/Nodes/ChildCount',0)=0; end; -function TAnchorDockMaster.LoadLayoutFromConfig(Config: TConfigStorage): Boolean; +function TAnchorDockMaster.LoadLayoutFromConfig(Config: TConfigStorage; + Scale: Boolean): boolean; var Tree: TAnchorDockLayoutTree; ControlNames: TStringList; @@ -2109,7 +2111,7 @@ begin //fTreeNameToDocker.WriteDebugReport('TAnchorDockMaster.LoadLayoutFromConfig Map'); // create sites - RestoreLayout(Tree); + RestoreLayout(Tree,Scale); finally EndUpdate; end; diff --git a/examples/anchordocking/design/registeranchordocking.pas b/examples/anchordocking/design/registeranchordocking.pas index 4e5b00269d..9936e3994b 100644 --- a/examples/anchordocking/design/registeranchordocking.pas +++ b/examples/anchordocking/design/registeranchordocking.pas @@ -215,7 +215,7 @@ begin if not DockMaster.ConfigIsEmpty(Config) then begin // loading last layout debugln(['TIDEAnchorDockMaster.LoadUserLayout restoring ...']); - DockMaster.LoadLayoutFromConfig(Config); + DockMaster.LoadLayoutFromConfig(Config,true); UserLayoutLoaded:=true; end else begin LoadDefaultLayout; @@ -261,7 +261,7 @@ begin XMLConfig.Filename:=Filename; Config:=TXMLConfigStorage.Create(XMLConfig); try - DockMaster.LoadLayoutFromConfig(Config); + DockMaster.LoadLayoutFromConfig(Config,true); finally Config.Free; end;