mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 07:19:16 +02:00
IDE: Retain anchored desktop configuration while AnchorDocking is not installed. Patch by joecare99.
git-svn-id: trunk@55410 -
This commit is contained in:
parent
a2fecca799
commit
d5a8e6f3f1
@ -42,7 +42,9 @@ uses
|
|||||||
Laz2_XMLCfg, LazUTF8, SourceChanger, CodeCompletionTool,
|
Laz2_XMLCfg, LazUTF8, SourceChanger, CodeCompletionTool,
|
||||||
// IDEIntf
|
// IDEIntf
|
||||||
ProjectIntf, ObjectInspector, IDEWindowIntf, IDEOptionsIntf,
|
ProjectIntf, ObjectInspector, IDEWindowIntf, IDEOptionsIntf,
|
||||||
ComponentReg, IDEExternToolIntf, MacroDefIntf, DbgIntfDebuggerBase,
|
ComponentReg, IDEExternToolIntf, MacroDefIntf,
|
||||||
|
// DebuggerIntf
|
||||||
|
DbgIntfDebuggerBase,
|
||||||
// IDE
|
// IDE
|
||||||
IDEProcs, DialogProcs, LazarusIDEStrConsts, IDETranslations, LazConf,
|
IDEProcs, DialogProcs, LazarusIDEStrConsts, IDETranslations, LazConf,
|
||||||
IDEOptionDefs, TransferMacros, ModeMatrixOpts, Debugger,
|
IDEOptionDefs, TransferMacros, ModeMatrixOpts, Debugger,
|
||||||
@ -384,7 +386,7 @@ type
|
|||||||
public
|
public
|
||||||
constructor Create(aEnvOpts: TEnvironmentOptions);
|
constructor Create(aEnvOpts: TEnvironmentOptions);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure AddFromCfg(Path: String);
|
function AddFromCfg(Path: String):boolean;
|
||||||
function IndexOf(aName: string): integer;
|
function IndexOf(aName: string): integer;
|
||||||
function Find(aName: string): TDesktopOpt;
|
function Find(aName: string): TDesktopOpt;
|
||||||
property Items[Index: Integer]: TDesktopOpt read GetItem; default;
|
property Items[Index: Integer]: TDesktopOpt read GetItem; default;
|
||||||
@ -560,6 +562,8 @@ type
|
|||||||
|
|
||||||
// Desktop
|
// Desktop
|
||||||
FDesktops: TDesktopOptList;
|
FDesktops: TDesktopOptList;
|
||||||
|
FDesktopsIdx: Array of integer;
|
||||||
|
FAllDesktopsCount:integer;
|
||||||
FDesktop: TDesktopOpt;
|
FDesktop: TDesktopOpt;
|
||||||
FLastDesktopBeforeDebug: TDesktopOpt;
|
FLastDesktopBeforeDebug: TDesktopOpt;
|
||||||
FActiveDesktopName: string;
|
FActiveDesktopName: string;
|
||||||
@ -1051,21 +1055,23 @@ begin
|
|||||||
FConfigStore := aConfigStore;
|
FConfigStore := aConfigStore;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDesktopOptList.AddFromCfg(Path: String);
|
function TDesktopOptList.AddFromCfg(Path: String): boolean;
|
||||||
var
|
var
|
||||||
dsk: TDesktopOpt;
|
dsk: TDesktopOpt;
|
||||||
dskName, dskDockMaster: String;
|
dskName, dskDockMaster: String;
|
||||||
begin
|
begin
|
||||||
|
Result := False;
|
||||||
dskName := FXMLCfg.GetValue(Path+'Name', 'default');
|
dskName := FXMLCfg.GetValue(Path+'Name', 'default');
|
||||||
dskDockMaster := FXMLCfg.GetValue(Path+'DockMaster', '');
|
dskDockMaster := FXMLCfg.GetValue(Path+'DockMaster', '');
|
||||||
|
|
||||||
if not EnvironmentOptions.DesktopCanBeLoaded(dskDockMaster) or (IndexOf(dskName) >= 0) then
|
if not TEnvironmentOptions.DesktopCanBeLoaded(dskDockMaster) or (IndexOf(dskName) >= 0) then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
dsk := TDesktopOpt.Create(dskName, dskDockMaster<>'');
|
dsk := TDesktopOpt.Create(dskName, dskDockMaster<>'');
|
||||||
dsk.SetConfig(FXMLCfg, FConfigStore);
|
dsk.SetConfig(FXMLCfg, FConfigStore);
|
||||||
dsk.Load(Path);
|
dsk.Load(Path);
|
||||||
Add(dsk);
|
Add(dsk);
|
||||||
|
Result := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TDesktopOptList.IndexOf(aName: string): integer;
|
function TDesktopOptList.IndexOf(aName: string): integer;
|
||||||
@ -1473,6 +1479,8 @@ begin
|
|||||||
|
|
||||||
// Desktop collection
|
// Desktop collection
|
||||||
FDesktops := TDesktopOptList.Create(Self);
|
FDesktops := TDesktopOptList.Create(Self);
|
||||||
|
SetLength(FDesktopsIdx,0);
|
||||||
|
FAllDesktopsCount:=0;
|
||||||
// FDesktop points to the IDE properties
|
// FDesktop points to the IDE properties
|
||||||
FDesktop := TDesktopOpt.Create('');
|
FDesktop := TDesktopOpt.Create('');
|
||||||
FAutoSaveActiveDesktop := True;
|
FAutoSaveActiveDesktop := True;
|
||||||
@ -1483,6 +1491,7 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
FreeAndNil(FDesktops);
|
FreeAndNil(FDesktops);
|
||||||
|
SetLength(FDesktopsIdx,0);
|
||||||
FreeAndNil(FDesktop);
|
FreeAndNil(FDesktop);
|
||||||
FreeAndNil(FLastDesktopBeforeDebug);
|
FreeAndNil(FLastDesktopBeforeDebug);
|
||||||
FreeAndNil(FBuildMatrixOptions);
|
FreeAndNil(FBuildMatrixOptions);
|
||||||
@ -1963,9 +1972,12 @@ begin
|
|||||||
CurPath := 'Desktops/';
|
CurPath := 'Desktops/';
|
||||||
FDebugDesktopName := FXMLCfg.GetValue(CurPath+'DebugDesktop', '');
|
FDebugDesktopName := FXMLCfg.GetValue(CurPath+'DebugDesktop', '');
|
||||||
FActiveDesktopName := FXMLCfg.GetValue(CurPath+'ActiveDesktop', '');
|
FActiveDesktopName := FXMLCfg.GetValue(CurPath+'ActiveDesktop', '');
|
||||||
j := FXMLCfg.GetValue(CurPath+'Count', 1);
|
FAllDesktopsCount := FXMLCfg.GetValue(CurPath+'Count', 1);
|
||||||
for i := 1 to j do
|
SetLength(FDesktopsIdx,FAllDesktopsCount+1);
|
||||||
FDesktops.AddFromCfg(CurPath+'Desktop'+IntToStr(i)+'/');
|
for i := 1 to FAllDesktopsCount do
|
||||||
|
if FDesktops.AddFromCfg(CurPath+'Desktop'+IntToStr(i)+'/') then
|
||||||
|
FDesktopsIdx[FDesktops.Count-1]:=i;
|
||||||
|
SetLength(FDesktopsIdx,FDesktops.Count);
|
||||||
end;
|
end;
|
||||||
if FFileVersion<=109 then begin
|
if FFileVersion<=109 then begin
|
||||||
FXMLCfg.DeletePath('Desktop');
|
FXMLCfg.DeletePath('Desktop');
|
||||||
@ -2001,7 +2013,7 @@ var
|
|||||||
begin
|
begin
|
||||||
// files
|
// files
|
||||||
CurLazDir:=ChompPathDelim(LazarusDirectory);
|
CurLazDir:=ChompPathDelim(LazarusDirectory);
|
||||||
if not GlobalMacroList.StrHasMacros(CurLazDir) then begin
|
if not TTransferMacroList.StrHasMacros(CurLazDir) then begin
|
||||||
BaseDir:=ExtractFilePath(ChompPathDelim(GetPrimaryConfigPath));
|
BaseDir:=ExtractFilePath(ChompPathDelim(GetPrimaryConfigPath));
|
||||||
if (CompareFilenames(BaseDir,CurLazDir)=0)
|
if (CompareFilenames(BaseDir,CurLazDir)=0)
|
||||||
or FileIsInPath(CurLazDir,BaseDir) then begin
|
or FileIsInPath(CurLazDir,BaseDir) then begin
|
||||||
@ -2293,16 +2305,24 @@ begin
|
|||||||
xActiveDesktopName := FActiveDesktopName;
|
xActiveDesktopName := FActiveDesktopName;
|
||||||
|
|
||||||
// The user can define many desktops. They are saved under path Desktops/.
|
// The user can define many desktops. They are saved under path Desktops/.
|
||||||
FXMLCfg.DeletePath('Desktops/');
|
|
||||||
CurPath:='Desktops/';
|
CurPath:='Desktops/';
|
||||||
FXMLCfg.SetDeleteValue(CurPath+'Count', FDesktops.Count, 0);
|
FXMLCfg.SetDeleteValue(CurPath+'Count', FDesktops.Count + FAllDesktopsCount -length(FDesktopsIdx) , 0);
|
||||||
FXMLCfg.SetDeleteValue(CurPath+'DebugDesktop', FDebugDesktopName, '');
|
FXMLCfg.SetDeleteValue(CurPath+'DebugDesktop', FDebugDesktopName, '');
|
||||||
FXMLCfg.SetDeleteValue(CurPath+'ActiveDesktop', xActiveDesktopName, '');
|
FXMLCfg.SetDeleteValue(CurPath+'ActiveDesktop', xActiveDesktopName, '');
|
||||||
for i := 0 to FDesktops.Count-1 do
|
for i := 0 to FDesktops.Count-1 do
|
||||||
begin
|
if i <= high(FDesktopsIdx) then
|
||||||
FDesktops[i].SetConfig(FXMLCfg, FConfigStore);
|
begin
|
||||||
FDesktops[i].Save(CurPath+'Desktop'+IntToStr(i+1)+'/');
|
FXMLCfg.DeletePath(CurPath+'Desktop'+IntToStr(FDesktopsIdx[i])+'/');
|
||||||
end;
|
FDesktops[i].SetConfig(FXMLCfg, FConfigStore);
|
||||||
|
FDesktops[i].Save(CurPath+'Desktop'+IntToStr(FDesktopsIdx[i])+'/');
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
FDesktops[i].SetConfig(FXMLCfg, FConfigStore);
|
||||||
|
FDesktops[i].Save(CurPath+'Desktop'+IntToStr(i+ FAllDesktopsCount -length(FDesktopsIdx)+1)+'/');
|
||||||
|
end;
|
||||||
|
for i := FDesktops.Count to high(FDesktopsIdx) do
|
||||||
|
FXMLCfg.DeletePath(CurPath+'Desktop'+IntToStr(FDesktopsIdx[i])+'/');
|
||||||
|
|
||||||
FXMLCfg.Flush;
|
FXMLCfg.Flush;
|
||||||
FileUpdated;
|
FileUpdated;
|
||||||
@ -2343,8 +2363,7 @@ begin
|
|||||||
RemoveFromRecentList(AFilename,FRecentOpenFiles,rltFile);
|
RemoveFromRecentList(AFilename,FRecentOpenFiles,rltFile);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TEnvironmentOptions.RemoveFromRecentPackageFiles(
|
procedure TEnvironmentOptions.RemoveFromRecentPackageFiles(const AFilename: string);
|
||||||
const AFilename: string);
|
|
||||||
begin
|
begin
|
||||||
RemoveFromRecentList(AFilename,FRecentPackageFiles,rltFile);
|
RemoveFromRecentList(AFilename,FRecentPackageFiles,rltFile);
|
||||||
end;
|
end;
|
||||||
@ -2664,6 +2683,9 @@ begin
|
|||||||
ObjectInspectorOptions.ConfigStore:=FConfigStore;
|
ObjectInspectorOptions.ConfigStore:=FConfigStore;
|
||||||
FDbgConfigStore:=TXMLOptionsStorage.Create(FXMLCfg, 'EnvironmentOptions/Debugger/');
|
FDbgConfigStore:=TXMLOptionsStorage.Create(FXMLCfg, 'EnvironmentOptions/Debugger/');
|
||||||
FDebuggerConfig.ConfigStore := FDbgConfigStore;
|
FDebuggerConfig.ConfigStore := FDbgConfigStore;
|
||||||
|
// Reset Values to Trigger a new List.
|
||||||
|
SetLength(FDesktopsIdx,0);
|
||||||
|
FAllDesktopsCount:=0;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user