IDE: Improve saving Anchordocking settings. Issue #28704, patch from Ondrej Pokorny.

git-svn-id: trunk@49895 -
This commit is contained in:
juha 2015-09-29 18:05:38 +00:00
parent 114e2e8efc
commit f049308eac
8 changed files with 188 additions and 132 deletions

View File

@ -105,7 +105,7 @@ uses
Math, Classes, SysUtils, types,
LCLType, LCLIntf, LCLProc,
Controls, Forms, ExtCtrls, ComCtrls, Graphics, Themes, Menus, Buttons,
LazConfigStorage, LazFileCache,
LazConfigStorage, Laz2_XMLCfg, LazFileCache,
AnchorDockStr, AnchorDockStorage;
type
@ -444,9 +444,12 @@ type
property HeaderFilled: boolean read FHeaderFilled write SetHeaderFilled;
procedure IncreaseChangeStamp; inline;
property ChangeStamp: integer read FChangeStamp;
procedure LoadFromConfig(Config: TConfigStorage);
procedure SaveToConfig(Config: TConfigStorage);
procedure LoadFromConfig(Config: TConfigStorage); overload;
procedure LoadFromConfig(Path: string; Config: TRttiXMLConfig); overload;
procedure SaveToConfig(Config: TConfigStorage); overload;
procedure SaveToConfig(Path: string; Config: TRttiXMLConfig); overload;
function IsEqual(Settings: TAnchorDockSettings): boolean; reintroduce;
procedure Assign(Source: TAnchorDockSettings);
end;
TAnchorDockMaster = class;
@ -1280,6 +1283,27 @@ begin
IncreaseChangeStamp;
end;
procedure TAnchorDockSettings.Assign(Source: TAnchorDockSettings);
begin
FAllowDragging := Source.FAllowDragging;
FChangeStamp := Source.FChangeStamp;
FDockOutsideMargin := Source.FDockOutsideMargin;
FDockParentMargin := Source.FDockParentMargin;
FDragTreshold := Source.FDragTreshold;
FHeaderAlignLeft := Source.FHeaderAlignLeft;
FHeaderAlignTop := Source.FHeaderAlignTop;
FHeaderHint := Source.FHeaderHint;
FHeaderStyle := Source.FHeaderStyle;
FHeaderFlatten := Source.FHeaderFlatten;
FHeaderFilled := Source.FHeaderFilled;
FHideHeaderCaptionFloatingControl := Source.FHideHeaderCaptionFloatingControl;
FPageAreaInPercent := Source.FPageAreaInPercent;
FScaleOnResize := Source.FScaleOnResize;
FShowHeader := Source.FShowHeader;
FShowHeaderCaption := Source.FShowHeaderCaption;
FSplitterWidth := Source.FSplitterWidth;
end;
procedure TAnchorDockSettings.IncreaseChangeStamp;
begin
LUIncreaseChangeStamp(fChangeStamp);
@ -1306,6 +1330,26 @@ begin
Config.UndoAppendBasePath;
end;
procedure TAnchorDockSettings.SaveToConfig(Path: string; Config: TRttiXMLConfig
);
begin
Config.SetDeleteValue(Path+'DragThreshold',DragTreshold,4);
Config.SetDeleteValue(Path+'DockOutsideMargin',DockOutsideMargin,10);
Config.SetDeleteValue(Path+'DockParentMargin',DockParentMargin,10);
Config.SetDeleteValue(Path+'PageAreaInPercent',PageAreaInPercent,40);
Config.SetDeleteValue(Path+'HeaderAlignTop',HeaderAlignTop,80);
Config.SetDeleteValue(Path+'HeaderAlignLeft',HeaderAlignLeft,120);
Config.SetDeleteValue(Path+'SplitterWidth',SplitterWidth,4);
Config.SetDeleteValue(Path+'ScaleOnResize',ScaleOnResize,true);
Config.SetDeleteValue(Path+'ShowHeader',ShowHeader,true);
Config.SetDeleteValue(Path+'ShowHeaderCaption',ShowHeaderCaption,true);
Config.SetDeleteValue(Path+'HideHeaderCaptionFloatingControl',HideHeaderCaptionFloatingControl,true);
Config.SetDeleteValue(Path+'AllowDragging',AllowDragging,true);
Config.SetDeleteValue(Path+'HeaderStyle',ADHeaderStyleNames[HeaderStyle],ADHeaderStyleNames[adhsDefault]);
Config.SetDeleteValue(Path+'HeaderFlatten',HeaderFlatten,true);
Config.SetDeleteValue(Path+'HeaderFilled',HeaderFilled,true);
end;
procedure TAnchorDockSettings.SaveToConfig(Config: TConfigStorage);
begin
Config.AppendBasePath('Settings/');
@ -1348,6 +1392,26 @@ begin
;
end;
procedure TAnchorDockSettings.LoadFromConfig(Path: string;
Config: TRttiXMLConfig);
begin
DragTreshold:=Config.GetValue(Path+'DragThreshold',4);
DockOutsideMargin:=Config.GetValue(Path+'DockOutsideMargin',10);
DockParentMargin:=Config.GetValue(Path+'DockParentMargin',10);
PageAreaInPercent:=Config.GetValue(Path+'PageAreaInPercent',40);
HeaderAlignTop:=Config.GetValue(Path+'HeaderAlignTop',80);
HeaderAlignLeft:=Config.GetValue(Path+'HeaderAlignLeft',120);
SplitterWidth:=Config.GetValue(Path+'SplitterWidth',4);
ScaleOnResize:=Config.GetValue(Path+'ScaleOnResize',true);
ShowHeader:=Config.GetValue(Path+'ShowHeader',true);
ShowHeaderCaption:=Config.GetValue(Path+'ShowHeaderCaption',true);
HideHeaderCaptionFloatingControl:=Config.GetValue(Path+'HideHeaderCaptionFloatingControl',true);
AllowDragging:=Config.GetValue(Path+'AllowDragging',true);
HeaderStyle:=StrToADHeaderStyle(Config.GetValue(Path+'HeaderStyle',ADHeaderStyleNames[adhsDefault]));
HeaderFlatten:=Config.GetValue(Path+'HeaderFlatten',true);
HeaderFilled:=Config.GetValue(Path+'HeaderFilled',true);
end;
{ TAnchorDockMaster }
function TAnchorDockMaster.GetControls(Index: integer): TControl;

View File

@ -8,9 +8,13 @@ uses
Classes, SysUtils,
LCLProc, Forms, Controls,
LazFileUtils, LazConfigStorage, Laz2_XMLCfg,
IDEOptionsIntf, MacroIntf, LazIDEIntf,
IDEOptionsIntf, MacroIntf, LazIDEIntf, BaseIDEIntf,
AnchorDocking, AnchorDockStorage;
const
AnchorDockingFileVersion = 1;
//1 added Settings node (FSettings: TAnchorDockSettings)
type
{ TAnchorDesktopOpt }
@ -19,7 +23,7 @@ type
private
FTree: TAnchorDockLayoutTree;
FRestoreLayouts: TAnchorDockRestoreLayouts;
FRestoreLayoutsCreated: Boolean;
FSettings: TAnchorDockSettings;
public
procedure LoadDefaultLayout;
procedure LoadLayoutFromConfig(Path: string; aXMLCfg: TRttiXMLConfig);
@ -28,13 +32,14 @@ type
procedure SaveMainLayoutToTree;
procedure SaveLayoutToConfig(Path: string; aXMLCfg: TRttiXMLConfig);
public
constructor Create(aUseIDELayouts: Boolean); override;
constructor Create; override;
destructor Destroy; override;
procedure Load(Path: String; aXMLCfg: TRttiXMLConfig); override;
procedure Save(Path: String; aXMLCfg: TRttiXMLConfig); override;
procedure Assign(Source: TAbstractDesktopDockingOpt); override;
procedure StoreWindowPositions; override;
procedure ImportSettingsFromIDE; override;
procedure ExportSettingsToIDE; override;
function RestoreDesktop: Boolean; override;
procedure Assign(Source: TAbstractDesktopDockingOpt); override;
end;
implementation
@ -50,29 +55,33 @@ begin
xSource := TAnchorDesktopOpt(Source);
FTree.Assign(xSource.FTree);
FRestoreLayouts.Assign(xSource.FRestoreLayouts);
FSettings.Assign(xSource.FSettings);
end;
end;
constructor TAnchorDesktopOpt.Create(aUseIDELayouts: Boolean);
constructor TAnchorDesktopOpt.Create;
begin
inherited Create(aUseIDELayouts);
inherited Create;
FTree := TAnchorDockLayoutTree.Create;
if aUseIDELayouts then
FRestoreLayouts := DockMaster.RestoreLayouts
else begin
FRestoreLayouts := TAnchorDockRestoreLayouts.Create;
FRestoreLayoutsCreated := True;
end;
FSettings := TAnchorDockSettings.Create;
FRestoreLayouts := TAnchorDockRestoreLayouts.Create;
end;
destructor TAnchorDesktopOpt.Destroy;
begin
FSettings.Free;
FTree.Free;
if FRestoreLayoutsCreated then
FRestoreLayouts.Free;
FRestoreLayouts.Free;
inherited Destroy;
end;
procedure TAnchorDesktopOpt.ExportSettingsToIDE;
begin
DockMaster.LoadSettings(FSettings);
DockMaster.RestoreLayouts.Assign(FRestoreLayouts);
end;
procedure TAnchorDesktopOpt.Load(Path: String; aXMLCfg: TRttiXMLConfig);
begin
//new version of old "TIDEAnchorDockMaster.LoadUserLayout"
@ -124,10 +133,44 @@ begin
end;
end;
procedure TAnchorDesktopOpt.LoadLayoutFromConfig(Path: string; aXMLCfg: TRttiXMLConfig);
procedure TAnchorDesktopOpt.ImportSettingsFromIDE;
begin
SaveMainLayoutToTree;
DockMaster.SaveSettings(FSettings);
FRestoreLayouts.Assign(DockMaster.RestoreLayouts);
end;
procedure TAnchorDesktopOpt.LoadLayoutFromConfig(Path: string;
aXMLCfg: TRttiXMLConfig);
procedure LoadAnchorDockOptions;
var
Config: TConfigStorage;
begin
try
Config:=GetIDEConfigStorage('anchordockoptions.xml',true);
try
FSettings.LoadFromConfig(Config);
finally
Config.Free;
end;
except
on E: Exception do begin
DebugLn(['TAnchorDesktopOpt.LoadLayoutFromConfig - LoadAnchorDockOptions failed: ',E.Message]);
end;
end;
end;
var
FileVersion: Integer;
begin
FileVersion:=aXMLCfg.GetValue(Path+'Version/Value',0);
FTree.LoadFromConfig(Path+'MainConfig/', aXMLCfg);
FRestoreLayouts.LoadFromConfig(Path+'Restores/', aXMLCfg);
if (FileVersion = 0) then//backwards compatibility - read anchordockoptions.xml
LoadAnchorDockOptions
else
FSettings.LoadFromConfig(Path+'Settings/', aXMLCfg);
end;
procedure TAnchorDesktopOpt.LoadLayoutFromFile(FileName: string);
@ -160,8 +203,10 @@ end;
procedure TAnchorDesktopOpt.SaveLayoutToConfig(Path: string; aXMLCfg: TRttiXMLConfig);
begin
aXMLCfg.SetValue(Path+'Version/Value',AnchorDockingFileVersion);
FTree.SaveToConfig(Path+'MainConfig/', aXMLCfg);
FRestoreLayouts.SaveToConfig(Path+'Restores/', aXMLCfg);
FSettings.SaveToConfig(Path+'Settings/', aXMLCfg);
WriteDebugLayout('TAnchorDesktopOpt.SaveLayoutToConfig ',FTree.Root);
end;
@ -220,11 +265,6 @@ begin
end;
end;
procedure TAnchorDesktopOpt.StoreWindowPositions;
begin
SaveMainLayoutToTree;
end;
function TAnchorDesktopOpt.RestoreDesktop: Boolean;
begin
Result := DockMaster.FullRestoreLayout(FTree,True);

View File

@ -46,9 +46,6 @@ uses
// AnchorDocking
AnchorDockStr, AnchorDocking, AnchorDesktopOptions, AnchorDockOptionsDlg;
const
DefaultConfigFileName = 'anchordockoptions.xml';
type
{ TIDEAnchorDockMaster }
@ -73,8 +70,6 @@ type
procedure IncreaseChangeStamp; inline;
property ChangeStamp: int64 read FChangeStamp;
property Modified: boolean read GetModified write SetModified;
procedure LoadSettings;
procedure SaveSettings;
function DockedDesktopOptClass: TAbstractDesktopDockingOptClass; override;
// layouts
property UserLayoutLoaded: boolean read FUserLayoutLoaded write SetUserLayoutLoaded;
@ -123,7 +118,6 @@ begin
// add options frame
AnchorDockOptionsID:=RegisterIDEOptionsEditor(GroupEnvironment,TAnchorDockIDEFrame,
AnchorDockOptionsID)^.Index;
IDEAnchorDockMaster.LoadSettings;
end;
{ TIDEAnchorDockMaster }
@ -392,43 +386,6 @@ begin
LUIncreaseChangeStamp64(FChangeStamp);
end;
procedure TIDEAnchorDockMaster.LoadSettings;
var
Config: TConfigStorage;
begin
try
Config:=GetIDEConfigStorage(DefaultConfigFileName,true);
try
DockMaster.LoadSettingsFromConfig(Config);
finally
Config.Free;
end;
except
on E: Exception do begin
DebugLn(['TIDEAnchorDockMaster.LoadSettings failed: ',E.Message]);
end;
end;
end;
procedure TIDEAnchorDockMaster.SaveSettings;
var
Config: TConfigStorage;
begin
try
Config:=GetIDEConfigStorage(DefaultConfigFileName,false);
try
DockMaster.SaveSettingsToConfig(Config);
Config.WriteToDisk;
finally
Config.Free;
end;
except
on E: Exception do begin
DebugLn(['TIDEAnchorDockMaster.SaveSettings failed: ',E.Message]);
end;
end;
end;
{ TAnchorDockIDEFrame }
constructor TAnchorDockIDEFrame.Create(TheOwner: TComponent);

View File

@ -63,12 +63,14 @@ type
TAbstractDesktopDockingOpt = class
public
constructor Create({%H-}aUseIDELayouts: Boolean); virtual;
constructor Create; virtual;
procedure StoreWindowPositions; virtual; abstract;
procedure Load(Path: String; aXMLCfg: TRttiXMLConfig); virtual; abstract;
procedure Save(Path: String; aXMLCfg: TRttiXMLConfig); virtual; abstract;
procedure Assign(Source: TAbstractDesktopDockingOpt); virtual; abstract;
procedure ImportSettingsFromIDE; virtual; abstract;
procedure ExportSettingsToIDE; virtual; abstract;
function RestoreDesktop: Boolean; virtual; abstract;
procedure Assign(Source: TAbstractDesktopDockingOpt); virtual; abstract;
end;
TAbstractDesktopDockingOptClass = class of TAbstractDesktopDockingOpt;
@ -422,7 +424,7 @@ end;
{ TAbstractDesktopDockingOpt }
constructor TAbstractDesktopDockingOpt.Create(aUseIDELayouts: Boolean);
constructor TAbstractDesktopDockingOpt.Create;
begin
inherited Create;
end;

View File

@ -145,13 +145,13 @@ begin
end;
debugln(['TDesktopForm.SaveBitBtnClick: Creating ', aDesktopName]);
dsk := TDesktopOpt.Create(aDesktopName, False);
dsk := TDesktopOpt.Create(aDesktopName);
if dskIndex < 0 then
Desktops.Add(dsk)
else
Desktops.Insert(dskIndex, dsk);
debugln(['TDesktopForm.SaveBitBtnClick: Assign from active desktop to ', aDesktopName]);
Desktop.StoreWindowPositions;
Desktop.ImportSettingsFromIDE;
dsk.Assign(Desktop);
ActiveDesktopName := aDesktopName;
Result := True;
@ -592,7 +592,7 @@ begin
if Assigned(xDsk) then //if desktop is to be rewritten, it has to be recreated
EnvironmentOptions.Desktops.Remove(xDsk);
xDsk := TDesktopOpt.Create(xDesktopName, False, xDesktopDockMaster<>'');
xDsk := TDesktopOpt.Create(xDesktopName, xDesktopDockMaster<>'');
EnvironmentOptions.Desktops.Add(xDsk);
if xDsk.Name = EnvironmentOptions.ActiveDesktopName then

View File

@ -275,7 +275,6 @@ type
FXMLCfg: TRttiXMLConfig;
FConfigStore: TXMLOptionsStorage;
// window layout
FUseIDELayouts: Boolean;
FIDEWindowCreatorsLayoutList: TSimpleWindowLayoutList;
FIDEDialogLayoutList: TIDEDialogLayoutList;
FSingleTaskBarButton: boolean;
@ -304,15 +303,17 @@ type
function GetCompatible: Boolean;
procedure InitLayoutList;
public
constructor Create(const aName: String; const aUseIDELayouts: Boolean);
constructor Create(const aName: String; const aUseIDELayouts, aIsDocked: Boolean);
constructor Create(const aName: String);
constructor Create(const aName: String; const aIsDocked: Boolean);
destructor Destroy; override;
procedure Assign(Source: TDesktopOpt; const AssignName: Boolean = False);
procedure StoreWindowPositions;
public
procedure SetConfig(aXMLCfg: TRttiXMLConfig; aConfigStore: TXMLOptionsStorage);
procedure Load(Path: String);
procedure Save(Path: String);
procedure ImportSettingsFromIDE;
procedure ExportSettingsToIDE;
procedure RestoreDesktop;
property Name: String read FName write FName;
property IDEWindowCreatorsLayoutList: TSimpleWindowLayoutList read FIDEWindowCreatorsLayoutList write FIDEWindowCreatorsLayoutList;
@ -599,7 +600,6 @@ type
procedure UseDesktop(ADesktop: TDesktopOpt);
procedure EnableDebugDesktop;
procedure DisableDebugDesktop;
procedure RestoreDesktop;
class function DesktopCanBeLoaded(const aDockMaster: string): Boolean;
// auto save
@ -964,7 +964,7 @@ begin
if not EnvironmentOptions.DesktopCanBeLoaded(dskDockMaster) or (IndexOf(dskName) >= 0) then
Exit;
dsk := TDesktopOpt.Create(dskName, False, dskDockMaster<>'');
dsk := TDesktopOpt.Create(dskName, dskDockMaster<>'');
dsk.SetConfig(FXMLCfg, FConfigStore);
dsk.Load(Path);
Add(dsk);
@ -996,12 +996,12 @@ end;
{ TDesktopOpt }
constructor TDesktopOpt.Create(const aName: String; const aUseIDELayouts: Boolean);
constructor TDesktopOpt.Create(const aName: String);
begin
Create(aName, aUseIDELayouts, Assigned(IDEDockMaster));
Create(aName, Assigned(IDEDockMaster));
end;
constructor TDesktopOpt.Create(const aName: String; const aUseIDELayouts, aIsDocked: Boolean);
constructor TDesktopOpt.Create(const aName: String; const aIsDocked: Boolean);
begin
if aIsDocked and not Assigned(IDEDockMaster) then
raise Exception.Create('Internal error: TEnvironmentOptions.CreateDesktop cannot create docked desktop in undocked environment.');
@ -1011,7 +1011,7 @@ begin
FName:=aName;
FIsDocked := aIsDocked;
if aIsDocked then
FDockedOpt := IDEDockMaster.DockedDesktopOptClass.Create(aUseIDELayouts);
FDockedOpt := IDEDockMaster.DockedDesktopOptClass.Create;
FSingleTaskBarButton:=false;
FHideIDEOnRun:=false;
FAutoAdjustIDEHeight:=true;
@ -1034,20 +1034,10 @@ begin
// Windows layout
InitLayoutList;
FUseIDELayouts := aUseIDELayouts;
if FUseIDELayouts then
begin
//default desktop - use IDE storage objects!
FIDEDialogLayoutList:=IDEWindowIntf.IDEDialogLayoutList;
FIDEWindowCreatorsLayoutList := IDEWindowIntf.IDEWindowCreators.SimpleLayoutStorage;
end else
begin
//saved desktops - use own layout storage objects
FIDEDialogLayoutList:=TIDEDialogLayoutList.Create;
FIDEWindowCreatorsLayoutList:=TSimpleWindowLayoutList.Create(False);
FIDEDialogLayoutList.Assign(IDEWindowIntf.IDEDialogLayoutList);
FIDEWindowCreatorsLayoutList.CopyItemsFrom(IDEWindowIntf.IDEWindowCreators.SimpleLayoutStorage);
end;
FIDEDialogLayoutList:=TIDEDialogLayoutList.Create;
FIDEWindowCreatorsLayoutList:=TSimpleWindowLayoutList.Create(False);
FIDEDialogLayoutList.Assign(IDEWindowIntf.IDEDialogLayoutList);
FIDEWindowCreatorsLayoutList.CopyItemsFrom(IDEWindowIntf.IDEWindowCreators.SimpleLayoutStorage);
end;
destructor TDesktopOpt.Destroy;
@ -1057,11 +1047,8 @@ begin
FreeAndNil(FIDECoolBarOptions);
FreeAndNil(FDockedOpt);
if not FUseIDELayouts then
begin
FreeAndNil(FIDEDialogLayoutList);
FreeAndNil(FIDEWindowCreatorsLayoutList);
end;
FreeAndNil(FIDEDialogLayoutList);
FreeAndNil(FIDEWindowCreatorsLayoutList);
inherited Destroy;
end;
@ -1139,6 +1126,23 @@ begin
FDockedOpt.Load(Path, FXMLCfg);
end;
procedure TDesktopOpt.RestoreDesktop;
begin
IDEWindowCreators.RestoreSimpleLayout;
if Assigned(FDockedOpt) then
FDockedOpt.RestoreDesktop;
end;
procedure TDesktopOpt.ImportSettingsFromIDE;
begin
IDEWindowIntf.IDEWindowCreators.SimpleLayoutStorage.StoreWindowPositions;
FIDEDialogLayoutList.Assign(IDEWindowIntf.IDEDialogLayoutList);
FIDEWindowCreatorsLayoutList.CopyItemsFrom(IDEWindowIntf.IDEWindowCreators.SimpleLayoutStorage);
if Assigned(FDockedOpt) then
FDockedOpt.ImportSettingsFromIDE;
end;
procedure TDesktopOpt.Save(Path: String);
begin
// windows
@ -1176,6 +1180,15 @@ begin
FDockedOpt.Save(Path, FXMLCfg);
end;
procedure TDesktopOpt.ExportSettingsToIDE;
begin
if Assigned(FDockedOpt) then
FDockedOpt.ExportSettingsToIDE;
IDEWindowIntf.IDEDialogLayoutList.Assign(FIDEDialogLayoutList);
IDEWindowIntf.IDEWindowCreators.SimpleLayoutStorage.CopyItemsFrom(FIDEWindowCreatorsLayoutList);
end;
procedure InitLayoutHelper(const FormID: string);
begin
with IDEWindowCreators.SimpleLayoutStorage do
@ -1189,14 +1202,6 @@ begin
FConfigStore := aConfigStore;
end;
procedure TDesktopOpt.StoreWindowPositions;
begin
FIDEWindowCreatorsLayoutList.StoreWindowPositions;
if Assigned(FDockedOpt) then
FDockedOpt.StoreWindowPositions;
end;
procedure TDesktopOpt.InitLayoutList;
var
l: TNonModalIDEWindow;
@ -1355,7 +1360,7 @@ begin
// Desktop collection
FDesktops := TDesktopOptList.Create(Self);
// FDesktop points to the IDE properties
FDesktop := TDesktopOpt.Create('', True);
FDesktop := TDesktopOpt.Create('');
FAutoSaveActiveDesktop := True;
end;
@ -1398,7 +1403,7 @@ begin
try
if AutoSaveActiveDesktop and Assigned(DebugDesktop) then
begin
Desktop.StoreWindowPositions;
Desktop.ImportSettingsFromIDE;
DebugDesktop.Assign(Desktop);
end;
@ -1430,7 +1435,7 @@ procedure TEnvironmentOptions.EnableDebugDesktop;
begin
if not Assigned(FLastDesktopBeforeDebug) and Assigned(DebugDesktop) then
begin
FLastDesktopBeforeDebug := TDesktopOpt.Create('', False);
FLastDesktopBeforeDebug := TDesktopOpt.Create('');
FLastDesktopBeforeDebug.Assign(Desktop);
FLastDesktopBeforeDebug.Name := ActiveDesktopName;
EnvironmentOptions.UseDesktop(DebugDesktop);
@ -1821,6 +1826,7 @@ begin
end;
Desktop.Assign(ActiveDesktop, False);
Desktop.ExportSettingsToIDE;
FileUpdated;
except
@ -2097,7 +2103,7 @@ begin
if AutoSaveActiveDesktop then
begin
//save active desktop
Desktop.StoreWindowPositions;
Desktop.ImportSettingsFromIDE;
ActiveDesktop.Assign(Desktop);
if Assigned(FLastDesktopBeforeDebug) then//are we in debug session?
@ -2162,13 +2168,6 @@ begin
RemoveFromRecentList(AFilename,FRecentProjectFiles,rltFile);
end;
procedure TEnvironmentOptions.RestoreDesktop;
begin
IDEWindowCreators.RestoreSimpleLayout;
if Assigned(Desktop.FDockedOpt) then
Desktop.FDockedOpt.RestoreDesktop;
end;
function TEnvironmentOptions.GetParsedTestBuildDirectory: string;
begin
Result:=GetParsedValue(eopTestBuildDirectory);
@ -2509,7 +2508,7 @@ begin
if Assigned(Result) then
FDesktops.Remove(Result);
Result := TDesktopOpt.Create(FActiveDesktopName, False);
Result := TDesktopOpt.Create(FActiveDesktopName);
FDesktops.Add(Result);
Result.Assign(Desktop);
end;
@ -2547,7 +2546,8 @@ begin
Desktop.Assign(ADesktop);
ActiveDesktopName := ADesktop.Name;
DoAfterWrite(False); //this is needed to get the EditorToolBar refreshed!!! - needed only here in UseDesktop()
RestoreDesktop;
Desktop.ExportSettingsToIDE;
Desktop.RestoreDesktop;
//set focus back to the previously focused control
if Screen.CustomFormIndex(xLastFocusForm) >= 0 then//check if form hasn't been destroyed

View File

@ -77,7 +77,6 @@ type
FLayout: TSimpleWindowLayout;
FDivider: TSimpleWindowLayoutDividerPos;
FShowSimpleLayout: boolean;
FLayoutChanged: boolean;
procedure EnableGeometryEdits(aEnable: Boolean);
function GetPlacementRadioButtons(APlacement: TIDEWindowPlacement): TRadioButton;
procedure SetLayout(const AValue: TSimpleWindowLayout);
@ -213,8 +212,6 @@ begin
lblWindowPosition.Parent:=nil;
WindowPositionsPanel.Parent:=nil;
end;
FLayoutChanged := False;
end;
procedure TWindowOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
@ -234,9 +231,6 @@ begin
AutoAdjustIDEHeightFullCompPal := AutoAdjustIDEHeightFullCompPalCheckBox.Checked;
IDEProjectDirectoryInIdeTitle:=ProjectDirInIdeTitleCheckBox.Checked;
end;
if FLayoutChanged then
EnvironmentOptions.RestoreDesktop;
end;
function TWindowOptionsFrame.GetPlacementRadioButtons(
@ -346,7 +340,6 @@ begin
end;
Layout.ApplyDivider(True);
end;
FLayoutChanged := True;
end;
procedure TWindowOptionsFrame.EnableGeometryEdits(aEnable: Boolean);

View File

@ -2351,7 +2351,7 @@ end;
procedure TMainIDE.RestoreIDEWindows;
begin
DoCallNotifyHandler(lihtIDERestoreWindows);
EnvironmentOptions.RestoreDesktop;
EnvironmentOptions.Desktop.RestoreDesktop;
end;
procedure TMainIDE.FreeIDEWindows;
@ -4411,7 +4411,7 @@ procedure TMainIDE.SaveDesktopSettings(TheEnvironmentOptions: TEnvironmentOption
// Called also before reading EnvironmentOptions
begin
DebugLn(['* TMainIDE.SaveDesktopSettings']);
EnvironmentOptions.Desktop.StoreWindowPositions;
EnvironmentOptions.Desktop.ImportSettingsFromIDE;
if ObjectInspector1<>nil then
TheEnvironmentOptions.ObjectInspectorOptions.Assign(ObjectInspector1);