mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-02 11:10:12 +02:00
IDE: started using configstorage for package custom options
git-svn-id: trunk@24735 -
This commit is contained in:
parent
b7a54325ee
commit
f66c5b9bd3
@ -61,6 +61,7 @@ type
|
|||||||
constructor Create(TheXMLConfig: TXMLConfig);
|
constructor Create(TheXMLConfig: TXMLConfig);
|
||||||
constructor Create(TheXMLConfig: TXMLConfig; const StartPath: string);
|
constructor Create(TheXMLConfig: TXMLConfig; const StartPath: string);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
procedure Clear; override;
|
||||||
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;
|
||||||
@ -946,6 +947,11 @@ begin
|
|||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TXMLOptionsStorage.Clear;
|
||||||
|
begin
|
||||||
|
FXMLConfig.Clear;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TXMLOptionsStorage.WriteToDisk;
|
procedure TXMLOptionsStorage.WriteToDisk;
|
||||||
begin
|
begin
|
||||||
FXMLConfig.Flush;
|
FXMLConfig.Flush;
|
||||||
|
@ -23,7 +23,7 @@ unit PackageIntf;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Forms, NewItemIntf, AvgLvlTree;
|
Classes, SysUtils, Forms, LazConfigStorage, NewItemIntf, AvgLvlTree;
|
||||||
|
|
||||||
const
|
const
|
||||||
PkgDescGroupName = 'Package';
|
PkgDescGroupName = 'Package';
|
||||||
@ -91,7 +91,7 @@ type
|
|||||||
|
|
||||||
TIDEPackage = class(TLazPackageID)
|
TIDEPackage = class(TLazPackageID)
|
||||||
protected
|
protected
|
||||||
FCustomOptions: TStringToStringTree;
|
FCustomOptions: TConfigStorage;
|
||||||
FFilename: string;
|
FFilename: string;
|
||||||
function GetDirectoryExpanded: string; virtual; abstract;
|
function GetDirectoryExpanded: string; virtual; abstract;
|
||||||
function GetModified: boolean; virtual; abstract;
|
function GetModified: boolean; virtual; abstract;
|
||||||
@ -100,11 +100,14 @@ type
|
|||||||
public
|
public
|
||||||
function IsVirtual: boolean; virtual; abstract;
|
function IsVirtual: boolean; virtual; abstract;
|
||||||
function ReadOnly: boolean; virtual; abstract;
|
function ReadOnly: boolean; virtual; abstract;
|
||||||
|
constructor Create;
|
||||||
|
destructor Destroy; override;
|
||||||
|
procedure ClearCustomOptions;
|
||||||
public
|
public
|
||||||
property Filename: string read FFilename write SetFilename;//the .lpk filename
|
property Filename: string read FFilename write SetFilename;//the .lpk filename
|
||||||
property Modified: boolean read GetModified write SetModified;
|
property Modified: boolean read GetModified write SetModified;
|
||||||
property DirectoryExpanded: string read GetDirectoryExpanded;
|
property DirectoryExpanded: string read GetDirectoryExpanded;
|
||||||
property CustomOptions: TStringToStringTree read FCustomOptions;
|
property CustomOptions: TConfigStorage read FCustomOptions;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -544,6 +547,25 @@ begin
|
|||||||
Version.Assign(Source.Version);
|
Version.Assign(Source.Version);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TIDEPackage }
|
||||||
|
|
||||||
|
constructor TIDEPackage.Create;
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
FCustomOptions:=TConfigMemStorage.Create('',false);
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TIDEPackage.Destroy;
|
||||||
|
begin
|
||||||
|
FreeAndNil(FCustomOptions);
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TIDEPackage.ClearCustomOptions;
|
||||||
|
begin
|
||||||
|
TConfigMemStorage(FCustomOptions).Clear;
|
||||||
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
PackageEditingInterface:=nil;
|
PackageEditingInterface:=nil;
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ type
|
|||||||
public
|
public
|
||||||
constructor Create(const Filename: string; LoadFromDisk: Boolean); virtual;
|
constructor Create(const Filename: string; LoadFromDisk: Boolean); virtual;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
procedure Clear; virtual; abstract;
|
||||||
function GetValue(const APath, ADefault: String): String;
|
function GetValue(const APath, ADefault: String): String;
|
||||||
function GetValue(const APath: String; ADefault: Integer): Integer;
|
function GetValue(const APath: String; ADefault: Integer): Integer;
|
||||||
function GetValue(const APath: String; ADefault: Boolean): Boolean;
|
function GetValue(const APath: String; ADefault: Boolean): Boolean;
|
||||||
@ -121,6 +122,9 @@ type
|
|||||||
function GetFilename: string; override;
|
function GetFilename: string; override;
|
||||||
procedure WriteToDisk; override;
|
procedure WriteToDisk; override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
procedure Clear; override;
|
||||||
|
procedure SaveToConfig(Config: TConfigStorage; const APath: string);
|
||||||
|
procedure LoadFromToConfig(Config: TConfigStorage; const APath: string);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function CompareConfigMemStorageNames(p1, p2: PChar): integer;
|
function CompareConfigMemStorageNames(p1, p2: PChar): integer;
|
||||||
@ -538,6 +542,23 @@ begin
|
|||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TConfigMemStorage.Clear;
|
||||||
|
begin
|
||||||
|
FreeAndNil(Root);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TConfigMemStorage.SaveToConfig(Config: TConfigStorage;
|
||||||
|
const APath: string);
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TConfigMemStorage.LoadFromToConfig(Config: TConfigStorage;
|
||||||
|
const APath: string);
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
{ TConfigMemStorageNode }
|
{ TConfigMemStorageNode }
|
||||||
|
|
||||||
procedure TConfigMemStorageNode.ClearChilds;
|
procedure TConfigMemStorageNode.ClearChilds;
|
||||||
|
@ -46,7 +46,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, LCLProc, LResources, Graphics, Forms, FileUtil,
|
Classes, SysUtils, LCLProc, LResources, Graphics, Forms, FileUtil,
|
||||||
AvgLvlTree, AVL_Tree,
|
AvgLvlTree, AVL_Tree, LazConfigStorage,
|
||||||
DefineTemplates, CodeToolManager, Laz_XMLWrite, Laz_XMLCfg, CodeCache,
|
DefineTemplates, CodeToolManager, Laz_XMLWrite, Laz_XMLCfg, CodeCache,
|
||||||
PropEdits, LazIDEIntf, MacroIntf, PackageIntf,
|
PropEdits, LazIDEIntf, MacroIntf, PackageIntf,
|
||||||
EditDefineTree, CompilerOptions, CompOptsModes,
|
EditDefineTree, CompilerOptions, CompOptsModes,
|
||||||
@ -2324,7 +2324,6 @@ begin
|
|||||||
FDefineTemplates:=TLazPackageDefineTemplates.Create(Self);
|
FDefineTemplates:=TLazPackageDefineTemplates.Create(Self);
|
||||||
fPublishOptions:=TPublishPackageOptions.Create(Self);
|
fPublishOptions:=TPublishPackageOptions.Create(Self);
|
||||||
FProvides:=TStringList.Create;
|
FProvides:=TStringList.Create;
|
||||||
FCustomOptions:=TStringToStringTree.Create(false);
|
|
||||||
Clear;
|
Clear;
|
||||||
FUsageOptions.ParsedOpts.InvalidateParseOnChange:=true;
|
FUsageOptions.ParsedOpts.InvalidateParseOnChange:=true;
|
||||||
end;
|
end;
|
||||||
@ -2333,7 +2332,6 @@ destructor TLazPackage.Destroy;
|
|||||||
begin
|
begin
|
||||||
Include(FFlags,lpfDestroying);
|
Include(FFlags,lpfDestroying);
|
||||||
Clear;
|
Clear;
|
||||||
FreeAndNil(FCustomOptions);
|
|
||||||
FreeAndNil(fPublishOptions);
|
FreeAndNil(fPublishOptions);
|
||||||
FreeAndNil(FProvides);
|
FreeAndNil(FProvides);
|
||||||
FreeAndNil(FDefineTemplates);
|
FreeAndNil(FDefineTemplates);
|
||||||
@ -2375,28 +2373,31 @@ begin
|
|||||||
// break and free required dependencies
|
// break and free required dependencies
|
||||||
while FFirstRequiredDependency<>nil do
|
while FFirstRequiredDependency<>nil do
|
||||||
DeleteRequiredDependency(FFirstRequiredDependency);
|
DeleteRequiredDependency(FFirstRequiredDependency);
|
||||||
FAddToProjectUsesSection:=true;
|
if not (lpfDestroying in FFlags) then begin
|
||||||
FAuthor:='';
|
FAddToProjectUsesSection:=true;
|
||||||
FAutoInstall:=pitNope;
|
FAuthor:='';
|
||||||
|
FAutoInstall:=pitNope;
|
||||||
|
FComponents.Clear;
|
||||||
|
FCompilerOptions.Clear;
|
||||||
|
FDescription:='';
|
||||||
|
FDirectory:='';
|
||||||
|
FDirectoryExpandedChangeStamp:=InvalidParseStamp;
|
||||||
|
FHasDirectory:=false;
|
||||||
|
FHasStaticDirectory:=false;
|
||||||
|
FVersion.Clear;
|
||||||
|
FFilename:='';
|
||||||
|
FIconFile:='';
|
||||||
|
FInstalled:=pitNope;
|
||||||
|
FName:='';
|
||||||
|
FPackageType:=lptRunAndDesignTime;
|
||||||
|
FRegistered:=false;
|
||||||
|
ClearCustomOptions;
|
||||||
|
end;
|
||||||
for i:=FComponents.Count-1 downto 0 do Components[i].Free;
|
for i:=FComponents.Count-1 downto 0 do Components[i].Free;
|
||||||
FComponents.Clear;
|
|
||||||
FCompilerOptions.Clear;
|
|
||||||
FDescription:='';
|
|
||||||
FDirectory:='';
|
|
||||||
FDirectoryExpandedChangeStamp:=InvalidParseStamp;
|
|
||||||
FHasDirectory:=false;
|
|
||||||
FHasStaticDirectory:=false;
|
|
||||||
FVersion.Clear;
|
|
||||||
FFilename:='';
|
|
||||||
for i:=FRemovedFiles.Count-1 downto 0 do RemovedFiles[i].Free;
|
for i:=FRemovedFiles.Count-1 downto 0 do RemovedFiles[i].Free;
|
||||||
FRemovedFiles.Clear;
|
FRemovedFiles.Clear;
|
||||||
for i:=FFiles.Count-1 downto 0 do Files[i].Free;
|
for i:=FFiles.Count-1 downto 0 do Files[i].Free;
|
||||||
FFiles.Clear;
|
FFiles.Clear;
|
||||||
FIconFile:='';
|
|
||||||
FInstalled:=pitNope;
|
|
||||||
FName:='';
|
|
||||||
FPackageType:=lptRunAndDesignTime;
|
|
||||||
FRegistered:=false;
|
|
||||||
FUsageOptions.Clear;
|
FUsageOptions.Clear;
|
||||||
fPublishOptions.Clear;
|
fPublishOptions.Clear;
|
||||||
FProvides.Clear;
|
FProvides.Clear;
|
||||||
@ -2552,7 +2553,7 @@ begin
|
|||||||
fPublishOptions.LoadFromXMLConfig(XMLConfig,Path+'PublishOptions/',
|
fPublishOptions.LoadFromXMLConfig(XMLConfig,Path+'PublishOptions/',
|
||||||
PathDelimChanged);
|
PathDelimChanged);
|
||||||
LoadStringList(XMLConfig,FProvides,Path+'Provides/');
|
LoadStringList(XMLConfig,FProvides,Path+'Provides/');
|
||||||
LoadStringToStringTree(XMLConfig,FCustomOptions,Path+'CustomOptions');
|
//LoadStringToStringTree(XMLConfig,FCustomOptions,Path+'CustomOptions');
|
||||||
EndUpdate;
|
EndUpdate;
|
||||||
Modified:=false;
|
Modified:=false;
|
||||||
UnlockModified;
|
UnlockModified;
|
||||||
@ -2618,7 +2619,7 @@ begin
|
|||||||
FUsageOptions.SaveToXMLConfig(XMLConfig,Path+'UsageOptions/',UsePathDelim);
|
FUsageOptions.SaveToXMLConfig(XMLConfig,Path+'UsageOptions/',UsePathDelim);
|
||||||
fPublishOptions.SaveToXMLConfig(XMLConfig,Path+'PublishOptions/',UsePathDelim);
|
fPublishOptions.SaveToXMLConfig(XMLConfig,Path+'PublishOptions/',UsePathDelim);
|
||||||
SaveStringList(XMLConfig,FProvides,Path+'Provides/');
|
SaveStringList(XMLConfig,FProvides,Path+'Provides/');
|
||||||
SaveStringToStringTree(XMLConfig,FCustomOptions,Path+'CustomOptions');
|
//SaveStringToStringTree(XMLConfig,FCustomOptions,Path+'CustomOptions');
|
||||||
Modified:=false;
|
Modified:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user