Changeset 65 for trunk/IDE/UCore.pas


Ignore:
Timestamp:
Jul 18, 2012, 10:57:48 PM (12 years ago)
Author:
chronos
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/IDE/UCore.pas

    r59 r65  
    77uses
    88  Classes, SysUtils, FileUtil, ULastOpenedList, UProject, UApplicationInfo,
    9   UCompiler, Registry, URegistry, UDebugLog, UCoolTranslator, UTarget;
     9  UCompiler, UGeneralRegistry, UDebugLog, UCoolTranslator, UTarget;
    1010
    1111type
     
    1515    SourceFiles: TSourceFileManager;
    1616    TargetFiles: TSourceFileManager;
    17     procedure LoadFromRegistry(Root: HKEY; Key: string);
    18     procedure SaveToRegistry(Root: HKEY; Key: string);
     17    procedure LoadFromRegistry(Root: Integer; Key: string);
     18    procedure SaveToRegistry(Root: Integer; Key: string);
    1919    constructor Create; override;
    2020    destructor Destroy; override;
     
    4646    procedure ProjectNew;
    4747    procedure CompilerDebugLog(Text: string);
    48     procedure LoadFromRegistry(Root: HKEY; Key: string);
    49     procedure SaveToRegistry(Root: HKEY; Key: string);
     48    procedure LoadFromRegistry(Root: Integer; Key: string);
     49    procedure SaveToRegistry(Root: Integer; Key: string);
    5050  end;
    5151
     
    136136end;
    137137
    138 procedure TCore.LoadFromRegistry(Root: HKEY; Key: string);
    139 begin
    140   with TRegistryEx.Create do
    141     try
    142       RootKey := Root;
    143       OpenKey(Key, True);
    144       ReopenLastOpenedFile := ReadBoolWithDefault('ReopenLastOpenedFile', True);
    145       Compiler.Target := Compiler.Targets.SearchBySysName(ReadStringWithDefault('TargetName', ''));
    146       LogParsing := ReadBoolWithDefault('LogParsing', False);
     138procedure TCore.LoadFromRegistry(Root: Integer; Key: string);
     139begin
     140  with TGeneralRegistry.Create(nil) do
     141    try
     142      CurrentRoot := Root;
     143      OpenKey(Key, True);
     144      if ValueExists('ReopenLastOpenedFile') then
     145        ReopenLastOpenedFile := ReadBool('ReopenLastOpenedFile')
     146        else ReopenLastOpenedFile := True;
     147      if ValueExists('TargetName') then
     148        Compiler.Target := Compiler.Targets.SearchBySysName(ReadString('TargetName'))
     149        else Compiler.Target := nil;
     150      if ValueExists('LogParsing') then
     151        LogParsing := ReadBool('LogParsing')
     152        else LogParsing := False;
    147153      if ValueExists('LanguageCode') then
    148         CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(ReadStringWithDefault('LanguageCode', ''))
     154        CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(ReadString('LanguageCode'))
    149155        else CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode('');
    150156    finally
     
    156162end;
    157163
    158 procedure TCore.SaveToRegistry(Root: HKEY; Key: string);
    159 begin
    160   with TRegistryEx.Create do
    161     try
    162       RootKey := Root;
     164procedure TCore.SaveToRegistry(Root: Integer; Key: string);
     165begin
     166  with TGeneralRegistry.Create(nil) do
     167    try
     168      CurrentRoot := Root;
    163169      OpenKey(Key, True);
    164170      WriteBool('ReopenLastOpenedFile', ReopenLastOpenedFile);
    165171      if Assigned(Compiler.Target) then
    166172        WriteString('TargetName', Compiler.Target.SysName)
    167         else DeleteValue('TargetName');
     173        else WriteString('TargetName', '');
    168174      WriteBool('LogParsing', LogParsing);
    169175      if Assigned(CoolTranslator1.Language) and (CoolTranslator1.Language.Code <> '') then
    170176        WriteString('LanguageCode', CoolTranslator1.Language.Code)
    171         else DeleteValue('LanguageCode');
     177        else WriteString('LanguageCode', '');
    172178    finally
    173179      Free;
     
    180186{ TCustomCompiler }
    181187
    182 procedure TCustomCompiler.LoadFromRegistry(Root: HKEY; Key: string);
     188procedure TCustomCompiler.LoadFromRegistry(Root: Integer; Key: string);
    183189var
    184190  I: Integer;
    185191begin
    186   with TRegistryEx.Create do
    187     try
    188       RootKey := Root;
     192  with TGeneralRegistry.Create(nil) do
     193    try
     194      CurrentRoot := Root;
    189195      for I := 0 to Targets.Count - 1 do
    190196      with TTarget(Targets[I]) do begin
    191197        OpenKey(Key + '\Targets\' + Name, True);
    192198        if ValueExists('CompilerPath') then
    193           Producer.CompilerPath := ReadStringWithDefault('CompilerPath', Producer.CompilerPath);
     199          Producer.CompilerPath := ReadString('CompilerPath');
    194200      end;
     201      OpenKey(Key, True);
    195202      if ValueExists('SelectedTarget') then
    196       Target := Targets.SearchBySysName(ReadString('SelectedTarget'))
     203        Target := Targets.SearchBySysName(ReadString('SelectedTarget'))
    197204        else Target := nil;
    198205    finally
     
    201208end;
    202209
    203 procedure TCustomCompiler.SaveToRegistry(Root: HKEY; Key: string);
     210procedure TCustomCompiler.SaveToRegistry(Root: Integer; Key: string);
    204211var
    205212  I: Integer;
    206213begin
    207   with TRegistryEx.Create do
    208     try
    209       RootKey := Root;
     214  with TGeneralRegistry.Create(nil) do
     215    try
     216      CurrentRoot := Root;
    210217      for I := 0 to Targets.Count - 1 do
    211218      with TTarget(Targets[I]) do begin
     
    213220        if Assigned(Producer) then begin
    214221          if Producer.CompilerPath <> '' then WriteString('CompilerPath', Producer.CompilerPath)
    215             else DeleteValue('CompilerPath');
     222            else WriteString('CompilerPath', '');
    216223        end;
    217224      end;
     225      OpenKey(Key, True);
    218226      if Assigned(Target) then WriteString('SelectedTarget', Target.SysName)
    219         else DeleteValue('SelectedTarget');
     227        else WriteString('SelectedTarget', '');
    220228    finally
    221229      Free;
Note: See TracChangeset for help on using the changeset viewer.