anchordocking: started save/load settings

git-svn-id: trunk@26348 -
This commit is contained in:
mattias 2010-06-30 13:23:19 +00:00
parent 73c490be56
commit fa65c21adb
2 changed files with 47 additions and 0 deletions

View File

@ -485,6 +485,8 @@ type
property RestoreLayouts: TAnchorDockRestoreLayouts read FRestoreLayouts;
property Restoring: boolean read FRestoring write SetRestoring;
property IdleConnected: Boolean read FIdleConnected write SetIdleConnected;
procedure LoadSettingsFromConfig(Config: TConfigStorage);
procedure SaveSettingsToConfig(Config: TConfigStorage);
// manual docking
procedure ManualFloat(AControl: TControl);
@ -2196,6 +2198,48 @@ begin
Result:=true;
end;
procedure TAnchorDockMaster.LoadSettingsFromConfig(Config: TConfigStorage);
begin
Config.AppendBasePath('Settings/');
DragTreshold:=Config.GetValue('DragThreshold',4);
DockOutsideMargin:=Config.GetValue('DockOutsideMargin',10);
DockParentMargin:=Config.GetValue('DockOutsideMargin',10);
PageAreaInPercent:=Config.GetValue('DockOutsideMargin',40);
HeaderAlignTop:=Config.GetValue('DockOutsideMargin',80);
HeaderAlignLeft:=Config.GetValue('DockOutsideMargin',120);
SplitterWidth:=Config.GetValue('DockOutsideMargin',4);
ScaleOnResize:=Config.GetValue('DockOutsideMargin',true);
ShowHeaderCaption:=Config.GetValue('DockOutsideMargin',true);
HideHeaderCaptionFloatingControl:=Config.GetValue('DockOutsideMargin',true);
AllowDragging:=Config.GetValue('DockOutsideMargin',true);
HeaderButtonSize:=Config.GetValue('DockOutsideMargin',10);
//property HeaderHint: string read FHeaderHint write FHeaderHint;
Config.UndoAppendBasePath;
end;
procedure TAnchorDockMaster.SaveSettingsToConfig(Config: TConfigStorage);
begin
Config.AppendBasePath('Settings/');
Config.SetDeleteValue('DragThreshold',DragTreshold,4);
Config.SetDeleteValue('DockOutsideMargin',DockOutsideMargin,10);
Config.SetDeleteValue('DockParentMargin',DockParentMargin,10);
Config.SetDeleteValue('PageAreaInPercent',PageAreaInPercent,40);
Config.SetDeleteValue('HeaderAlignTop',HeaderAlignTop,80);
Config.SetDeleteValue('HeaderAlignLeft',HeaderAlignLeft,120);
Config.SetDeleteValue('SplitterWidth',SplitterWidth,4);
Config.SetDeleteValue('ScaleOnResize',ScaleOnResize,true);
Config.SetDeleteValue('ShowHeaderCaption',ShowHeaderCaption,true);
Config.SetDeleteValue('HideHeaderCaptionFloatingControl',HideHeaderCaptionFloatingControl,true);
Config.SetDeleteValue('AllowDragging',AllowDragging,true);
Config.SetDeleteValue('HeaderButtonSize',HeaderButtonSize,10);
//property HeaderHint: string read FHeaderHint write FHeaderHint;
Config.UndoAppendBasePath;
end;
procedure TAnchorDockMaster.ManualFloat(AControl: TControl);
var
Site: TAnchorDockHostSite;

View File

@ -274,6 +274,7 @@ begin
if not DockMaster.ConfigIsEmpty(Config) then begin
// loading last layout
debugln(['TIDEAnchorDockMaster.LoadUserLayout restoring ...']);
DockMaster.LoadSettingsFromConfig(Config);
DockMaster.LoadLayoutFromConfig(Config,true);
UserLayoutLoaded:=true;
end else begin
@ -299,6 +300,7 @@ begin
debugln(['TIDEAnchorDockMaster.SaveDefaultLayout ',Filename]);
Config:=GetIDEConfigStorage(Filename,false);
try
DockMaster.SaveSettingsToConfig(Config);
DockMaster.SaveLayoutToConfig(Config);
finally
Config.Free;
@ -582,6 +584,7 @@ begin
if not (AOptions is SupportedOptionsClass) then exit;
IDEAnchorDockMaster.Enabled:=EnableCheckBox.Checked;
OptionsFrame.SaveToMaster;
end;
class function TAnchorDockIDEFrame.