mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-17 23:28:35 +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
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Laz_XMLCfg, LCLProc,
|
Classes, SysUtils, Laz_XMLCfg, LCLProc, FileUtil,
|
||||||
Forms, Controls, StdCtrls, Buttons, ConfigStorage, LazarusIDEStrConsts;
|
Forms, Controls, StdCtrls, Buttons, ConfigStorage,
|
||||||
|
LazConf, LazarusIDEStrConsts;
|
||||||
|
|
||||||
type
|
type
|
||||||
{ TXMLOptionsStorage }
|
{ TXMLOptionsStorage }
|
||||||
@ -63,6 +64,7 @@ type
|
|||||||
property XMLConfig: TXMLConfig read FXMLConfig;
|
property XMLConfig: TXMLConfig read FXMLConfig;
|
||||||
property FreeXMLConfig: boolean read FFreeXMLConfig write FFreeXMLConfig;
|
property FreeXMLConfig: boolean read FFreeXMLConfig write FFreeXMLConfig;
|
||||||
procedure WriteToDisk; override;
|
procedure WriteToDisk; override;
|
||||||
|
function GetFilename: string; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -376,6 +378,8 @@ function NonModalIDEFormIDToEnum(const FormID: string): TNonModalIDEWindow;
|
|||||||
var
|
var
|
||||||
IDEDialogLayoutList: TIDEDialogLayoutList;
|
IDEDialogLayoutList: TIDEDialogLayoutList;
|
||||||
|
|
||||||
|
function GetLazIDEConfigStorage(const Filename: string; LoadFromDisk: Boolean
|
||||||
|
): TConfigStorage;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -459,6 +463,20 @@ begin
|
|||||||
Result:=nmiwNone;
|
Result:=nmiwNone;
|
||||||
end;
|
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 }
|
{ TIDEWindowLayout }
|
||||||
|
|
||||||
constructor TIDEWindowLayout.Create;
|
constructor TIDEWindowLayout.Create;
|
||||||
@ -1364,9 +1382,15 @@ begin
|
|||||||
FXMLConfig.Flush;
|
FXMLConfig.Flush;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TXMLOptionsStorage.GetFilename: string;
|
||||||
|
begin
|
||||||
|
Result:=FXMLConfig.Filename;
|
||||||
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
IDEDialogLayoutList:=nil;
|
IDEDialogLayoutList:=nil;
|
||||||
DefaultConfigClass:=TXMLOptionsStorage;
|
DefaultConfigClass:=TXMLOptionsStorage;
|
||||||
|
GetIDEConfigStorage:=@GetLazIDEConfigStorage;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -62,12 +62,18 @@ type
|
|||||||
procedure AppendBasePath(const Path: string);
|
procedure AppendBasePath(const Path: string);
|
||||||
procedure UndoAppendBasePath;
|
procedure UndoAppendBasePath;
|
||||||
procedure WriteToDisk; virtual; abstract;
|
procedure WriteToDisk; virtual; abstract;
|
||||||
|
function GetFilename: string; virtual; abstract;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TConfigStorageClass = class of TConfigStorage;
|
TConfigStorageClass = class of TConfigStorage;
|
||||||
|
|
||||||
|
TGetIDEConfigStorage = function(const Filename: string; LoadFromDisk: Boolean
|
||||||
|
): TConfigStorage;
|
||||||
|
|
||||||
var
|
var
|
||||||
DefaultConfigClass: TConfigStorageClass;
|
DefaultConfigClass: TConfigStorageClass; // will be set by the IDE
|
||||||
|
GetIDEConfigStorage: TGetIDEConfigStorage; // will be set by the IDE
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user