mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 01:28:19 +02:00
added to IDEIntf: GetIDEConfigStorage for custom config files
git-svn-id: trunk@7202 -
This commit is contained in:
parent
716352928c
commit
73ca58ffc8
@ -33,8 +33,9 @@ unit IDEOptionDefs;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Laz_XMLCfg, LCLProc,
|
||||
Forms, Controls, StdCtrls, Buttons, ConfigStorage, LazarusIDEStrConsts;
|
||||
Classes, SysUtils, Laz_XMLCfg, LCLProc, FileUtil,
|
||||
Forms, Controls, StdCtrls, Buttons, ConfigStorage,
|
||||
LazConf, LazarusIDEStrConsts;
|
||||
|
||||
type
|
||||
{ TXMLOptionsStorage }
|
||||
@ -63,6 +64,7 @@ type
|
||||
property XMLConfig: TXMLConfig read FXMLConfig;
|
||||
property FreeXMLConfig: boolean read FFreeXMLConfig write FFreeXMLConfig;
|
||||
procedure WriteToDisk; override;
|
||||
function GetFilename: string; override;
|
||||
end;
|
||||
|
||||
|
||||
@ -376,6 +378,8 @@ function NonModalIDEFormIDToEnum(const FormID: string): TNonModalIDEWindow;
|
||||
var
|
||||
IDEDialogLayoutList: TIDEDialogLayoutList;
|
||||
|
||||
function GetLazIDEConfigStorage(const Filename: string; LoadFromDisk: Boolean
|
||||
): TConfigStorage;
|
||||
|
||||
implementation
|
||||
|
||||
@ -459,6 +463,20 @@ begin
|
||||
Result:=nmiwNone;
|
||||
end;
|
||||
|
||||
function GetLazIDEConfigStorage(const Filename: string; LoadFromDisk: Boolean
|
||||
): TConfigStorage;
|
||||
var
|
||||
ConfigFilename: String;
|
||||
begin
|
||||
if LoadFromDisk then begin
|
||||
// copy template config file to users config directory
|
||||
CopySecondaryConfigFile(Filename);
|
||||
end;
|
||||
// create storage
|
||||
ConfigFilename:=AppendPathDelim(GetPrimaryConfigPath)+Filename;
|
||||
Result:=TXMLOptionsStorage.Create(ConfigFilename,LoadFromDisk);
|
||||
end;
|
||||
|
||||
{ TIDEWindowLayout }
|
||||
|
||||
constructor TIDEWindowLayout.Create;
|
||||
@ -1364,9 +1382,15 @@ begin
|
||||
FXMLConfig.Flush;
|
||||
end;
|
||||
|
||||
function TXMLOptionsStorage.GetFilename: string;
|
||||
begin
|
||||
Result:=FXMLConfig.Filename;
|
||||
end;
|
||||
|
||||
initialization
|
||||
IDEDialogLayoutList:=nil;
|
||||
DefaultConfigClass:=TXMLOptionsStorage;
|
||||
GetIDEConfigStorage:=@GetLazIDEConfigStorage;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -62,12 +62,18 @@ type
|
||||
procedure AppendBasePath(const Path: string);
|
||||
procedure UndoAppendBasePath;
|
||||
procedure WriteToDisk; virtual; abstract;
|
||||
function GetFilename: string; virtual; abstract;
|
||||
end;
|
||||
|
||||
TConfigStorageClass = class of TConfigStorage;
|
||||
|
||||
TGetIDEConfigStorage = function(const Filename: string; LoadFromDisk: Boolean
|
||||
): TConfigStorage;
|
||||
|
||||
var
|
||||
DefaultConfigClass: TConfigStorageClass;
|
||||
DefaultConfigClass: TConfigStorageClass; // will be set by the IDE
|
||||
GetIDEConfigStorage: TGetIDEConfigStorage; // will be set by the IDE
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user