You've already forked lazarus-ccr
type_lib_edtr : Persistent options across sessions.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4193 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -6,15 +6,19 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LResources, Forms, Controls, Dialogs, IniFiles,
|
||||
pascal_parser_intf;
|
||||
{$IFDEF WST_IDE}LazConfigStorage, BaseIDEIntf, LCLProc,{$ENDIF WST_IDE}
|
||||
pascal_parser_intf, wst_consts;
|
||||
|
||||
const
|
||||
SECTION_OPTIONS = 'Options';
|
||||
CASE_SENSITIVE = 'CaseSensitive';
|
||||
STRING_MAPPING = 'StringMapping';
|
||||
STRING_MAPPING = 'StringMapping';
|
||||
{$IFNDEF WST_IDE}
|
||||
sLAST_PATH = 'LastPath';
|
||||
{$ENDIF WST_IDE}
|
||||
{$IFDEF WST_IDE}
|
||||
sCONFIG_FILE_NAME = 'wstsettings.xml';
|
||||
{$ENDIF WST_IDE}
|
||||
|
||||
type
|
||||
|
||||
@ -26,6 +30,10 @@ type
|
||||
{$IFNDEF WST_IDE}
|
||||
FOptions : TMemIniFile;
|
||||
function GetOtions: TCustomIniFile;
|
||||
{$ENDIF WST_IDE}
|
||||
{$IFDEF WST_IDE}
|
||||
procedure SaveOptionsToIDEStore();
|
||||
procedure LoadOptionsFromIDEStore();
|
||||
{$ENDIF WST_IDE}
|
||||
private
|
||||
FXsdStringMaping : TXSDStringMaping;
|
||||
@ -59,6 +67,50 @@ begin
|
||||
end;
|
||||
{$ENDIF WST_IDE}
|
||||
|
||||
{$IFDEF WST_IDE}
|
||||
procedure TDM.SaveOptionsToIDEStore();
|
||||
var
|
||||
store : TConfigStorage;
|
||||
begin
|
||||
try
|
||||
store := GetIDEConfigStorage(sCONFIG_FILE_NAME,True);
|
||||
try
|
||||
store.SetDeleteValue('Options/Version',WST_VERSION_INTEGER,0);
|
||||
store.SetDeleteValue('Options/'+CASE_SENSITIVE,Self.CaseSensitive,CASE_SENSITIVE_DEFAULT);
|
||||
store.SetDeleteValue('Options/'+STRING_MAPPING,Ord(Self.XsdStringMaping),Ord(xsmUnicodeString));
|
||||
finally
|
||||
store.Free();
|
||||
end;
|
||||
except
|
||||
on e : Exception do begin
|
||||
DebugLn([Format('Saving %s failed: ',[sCONFIG_FILE_NAME]),e.Message]);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDM.LoadOptionsFromIDEStore();
|
||||
var
|
||||
store : TConfigStorage;
|
||||
i : Integer;
|
||||
begin
|
||||
try
|
||||
store := GetIDEConfigStorage(sCONFIG_FILE_NAME,True);
|
||||
try
|
||||
Self.CaseSensitive := store.GetValue('Options/'+CASE_SENSITIVE,Self.CaseSensitive);
|
||||
i := store.GetValue('Options/'+STRING_MAPPING,Ord(Self.XsdStringMaping));
|
||||
if (i >= Ord(Low(TXSDStringMaping))) and (i <= Ord(High(TXSDStringMaping))) then
|
||||
Self.XsdStringMaping := TXSDStringMaping(i);
|
||||
finally
|
||||
store.Free();
|
||||
end;
|
||||
except
|
||||
on e : Exception do begin
|
||||
DebugLn([Format('Loading %s failed: ',[sCONFIG_FILE_NAME]),e.Message]);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
{$ENDIF WST_IDE}
|
||||
|
||||
procedure TDM.LoadOptions(AStore: TCustomIniFile);
|
||||
var
|
||||
i : Integer;
|
||||
@ -84,10 +136,16 @@ begin
|
||||
FOptions := TMemIniFile.Create(ChangeFileExt(GetAppConfigFile(False),'.ini'));
|
||||
LoadOptions(FOptions);
|
||||
{$ENDIF WST_IDE}
|
||||
{$IFDEF WST_IDE}
|
||||
LoadOptionsFromIDEStore();
|
||||
{$ENDIF WST_IDE}
|
||||
end;
|
||||
|
||||
destructor TDM.Destroy();
|
||||
begin
|
||||
{$IFDEF WST_IDE}
|
||||
SaveOptionsToIDEStore();
|
||||
{$ENDIF WST_IDE}
|
||||
{$IFNDEF WST_IDE}
|
||||
if ( FOptions <> nil ) then begin
|
||||
SaveOptions(FOptions);
|
||||
|
@ -19,6 +19,7 @@ interface
|
||||
const
|
||||
WST_BLOCK_TYPE = LongInt(56789);
|
||||
sWST_SIGNATURE = 'WST_METADATA_0.6';
|
||||
WST_VERSION_INTEGER = LongInt(10000*0 + 100*6);
|
||||
|
||||
resourcestring
|
||||
SERR_BaseTypeNotSpecfifiedForSimpleType = 'Base type is not specified for the simple type, parsing : "%s".';
|
||||
|
Reference in New Issue
Block a user