Changeset 65 for trunk/IDE/UCore.pas
- Timestamp:
- Jul 18, 2012, 10:57:48 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IDE/UCore.pas
r59 r65 7 7 uses 8 8 Classes, SysUtils, FileUtil, ULastOpenedList, UProject, UApplicationInfo, 9 UCompiler, Registry, URegistry, UDebugLog, UCoolTranslator, UTarget;9 UCompiler, UGeneralRegistry, UDebugLog, UCoolTranslator, UTarget; 10 10 11 11 type … … 15 15 SourceFiles: TSourceFileManager; 16 16 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); 19 19 constructor Create; override; 20 20 destructor Destroy; override; … … 46 46 procedure ProjectNew; 47 47 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); 50 50 end; 51 51 … … 136 136 end; 137 137 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); 138 procedure TCore.LoadFromRegistry(Root: Integer; Key: string); 139 begin 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; 147 153 if ValueExists('LanguageCode') then 148 CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(ReadString WithDefault('LanguageCode', ''))154 CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(ReadString('LanguageCode')) 149 155 else CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(''); 150 156 finally … … 156 162 end; 157 163 158 procedure TCore.SaveToRegistry(Root: HKEY; Key: string);159 begin 160 with T RegistryEx.Createdo161 try 162 RootKey:= Root;164 procedure TCore.SaveToRegistry(Root: Integer; Key: string); 165 begin 166 with TGeneralRegistry.Create(nil) do 167 try 168 CurrentRoot := Root; 163 169 OpenKey(Key, True); 164 170 WriteBool('ReopenLastOpenedFile', ReopenLastOpenedFile); 165 171 if Assigned(Compiler.Target) then 166 172 WriteString('TargetName', Compiler.Target.SysName) 167 else DeleteValue('TargetName');173 else WriteString('TargetName', ''); 168 174 WriteBool('LogParsing', LogParsing); 169 175 if Assigned(CoolTranslator1.Language) and (CoolTranslator1.Language.Code <> '') then 170 176 WriteString('LanguageCode', CoolTranslator1.Language.Code) 171 else DeleteValue('LanguageCode');177 else WriteString('LanguageCode', ''); 172 178 finally 173 179 Free; … … 180 186 { TCustomCompiler } 181 187 182 procedure TCustomCompiler.LoadFromRegistry(Root: HKEY; Key: string);188 procedure TCustomCompiler.LoadFromRegistry(Root: Integer; Key: string); 183 189 var 184 190 I: Integer; 185 191 begin 186 with T RegistryEx.Createdo187 try 188 RootKey:= Root;192 with TGeneralRegistry.Create(nil) do 193 try 194 CurrentRoot := Root; 189 195 for I := 0 to Targets.Count - 1 do 190 196 with TTarget(Targets[I]) do begin 191 197 OpenKey(Key + '\Targets\' + Name, True); 192 198 if ValueExists('CompilerPath') then 193 Producer.CompilerPath := ReadString WithDefault('CompilerPath', Producer.CompilerPath);199 Producer.CompilerPath := ReadString('CompilerPath'); 194 200 end; 201 OpenKey(Key, True); 195 202 if ValueExists('SelectedTarget') then 196 Target := Targets.SearchBySysName(ReadString('SelectedTarget'))203 Target := Targets.SearchBySysName(ReadString('SelectedTarget')) 197 204 else Target := nil; 198 205 finally … … 201 208 end; 202 209 203 procedure TCustomCompiler.SaveToRegistry(Root: HKEY; Key: string);210 procedure TCustomCompiler.SaveToRegistry(Root: Integer; Key: string); 204 211 var 205 212 I: Integer; 206 213 begin 207 with T RegistryEx.Createdo208 try 209 RootKey:= Root;214 with TGeneralRegistry.Create(nil) do 215 try 216 CurrentRoot := Root; 210 217 for I := 0 to Targets.Count - 1 do 211 218 with TTarget(Targets[I]) do begin … … 213 220 if Assigned(Producer) then begin 214 221 if Producer.CompilerPath <> '' then WriteString('CompilerPath', Producer.CompilerPath) 215 else DeleteValue('CompilerPath');222 else WriteString('CompilerPath', ''); 216 223 end; 217 224 end; 225 OpenKey(Key, True); 218 226 if Assigned(Target) then WriteString('SelectedTarget', Target.SysName) 219 else DeleteValue('SelectedTarget');227 else WriteString('SelectedTarget', ''); 220 228 finally 221 229 Free;
Note:
See TracChangeset
for help on using the changeset viewer.