mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 07:39:22 +02:00
Jedi code format: replace deprecated TRegIniFile by TIniFile.
This commit is contained in:
parent
86519acad0
commit
719f66bebf
@ -57,9 +57,6 @@ type
|
|||||||
type
|
type
|
||||||
TShowParseTreeOption = (eShowAlways, eShowOnError, eShowNever);
|
TShowParseTreeOption = (eShowAlways, eShowOnError, eShowNever);
|
||||||
|
|
||||||
const
|
|
||||||
REG_ROOT_KEY = '\Software\Jedi\JediCodeFormat';
|
|
||||||
|
|
||||||
const
|
const
|
||||||
SOURCE_FILE_FILTERS =
|
SOURCE_FILE_FILTERS =
|
||||||
'All source|*.pas; *.dpr; *.dpk; *.pp; *.lpr; *.lpk; *.txt|' +
|
'All source|*.pas; *.dpr; *.dpk; *.pp; *.lpr; *.lpk; *.txt|' +
|
||||||
|
@ -40,7 +40,7 @@ See http://www.gnu.org/licenses/gpl.html
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Registry, Classes, SysUtils,
|
Classes, SysUtils, IniFiles,
|
||||||
{ local }
|
{ local }
|
||||||
ConvertTypes;
|
ConvertTypes;
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ type
|
|||||||
|
|
||||||
TJCFRegistrySettings = class(TObject)
|
TJCFRegistrySettings = class(TObject)
|
||||||
private
|
private
|
||||||
fcReg: TRegIniFile;
|
fcReg: TIniFile;
|
||||||
fbHasRead: boolean;
|
fbHasRead: boolean;
|
||||||
|
|
||||||
{ general settings }
|
{ general settings }
|
||||||
@ -239,7 +239,7 @@ end;
|
|||||||
constructor TJCFRegistrySettings.Create;
|
constructor TJCFRegistrySettings.Create;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
fcReg := TRegIniFile.Create(REG_ROOT_KEY);
|
fcReg := TIniFile.Create(GetConfigFileNameJcf());
|
||||||
|
|
||||||
fcExclusionsFiles := TStringList.Create; // Will compare with CompareText.
|
fcExclusionsFiles := TStringList.Create; // Will compare with CompareText.
|
||||||
fcExclusionsFiles.UseLocale := False;
|
fcExclusionsFiles.UseLocale := False;
|
||||||
@ -367,7 +367,7 @@ begin
|
|||||||
feLogPlace := TLogPlace(fcReg.ReadInteger(REG_LOG_SECTION, REG_LOG_PLACE,
|
feLogPlace := TLogPlace(fcReg.ReadInteger(REG_LOG_SECTION, REG_LOG_PLACE,
|
||||||
Ord(eLogTempDir)));
|
Ord(eLogTempDir)));
|
||||||
fsSpecifiedDirectory := fcReg.ReadString(REG_LOG_SECTION,
|
fsSpecifiedDirectory := fcReg.ReadString(REG_LOG_SECTION,
|
||||||
REG_SPECIFIED_DIRECTORY, 'c:\');
|
REG_SPECIFIED_DIRECTORY, {$ifdef Windows} 'c:\' {$else}'/'{$endif});
|
||||||
fbViewLogAfterRun := fcReg.ReadBool(REG_LOG_SECTION, REG_VIEW_LOG_AFTER_RUN, False);
|
fbViewLogAfterRun := fcReg.ReadBool(REG_LOG_SECTION, REG_VIEW_LOG_AFTER_RUN, False);
|
||||||
fbLogTime := fcReg.ReadBool(REG_LOG_SECTION, REG_LOG_TIME, False);
|
fbLogTime := fcReg.ReadBool(REG_LOG_SECTION, REG_LOG_TIME, False);
|
||||||
fbLogStats := fcReg.ReadBool(REG_LOG_SECTION, REG_LOG_STATS, False);
|
fbLogStats := fcReg.ReadBool(REG_LOG_SECTION, REG_LOG_STATS, False);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
unit RegistrySettings;
|
unit RegistrySettings deprecated 'Not used by JPF component';
|
||||||
|
// Unit not used in any package.
|
||||||
|
// TODO: delete from jcfbase and delete file.
|
||||||
{(*}
|
{(*}
|
||||||
(*------------------------------------------------------------------------------
|
(*------------------------------------------------------------------------------
|
||||||
Delphi Code formatter source code
|
Delphi Code formatter source code
|
||||||
@ -38,7 +39,7 @@ interface
|
|||||||
this object serves as both the root and the section
|
this object serves as both the root and the section
|
||||||
}
|
}
|
||||||
uses
|
uses
|
||||||
Registry, Classes, SysUtils,
|
IniFiles, Classes, SysUtils,
|
||||||
{ local }
|
{ local }
|
||||||
SettingsStream;
|
SettingsStream;
|
||||||
|
|
||||||
@ -46,7 +47,7 @@ type
|
|||||||
|
|
||||||
TSettingsRegistryOutput = class(TSettingsOutput)
|
TSettingsRegistryOutput = class(TSettingsOutput)
|
||||||
private
|
private
|
||||||
fReg: TRegIniFile;
|
fReg: TIniFile;
|
||||||
fsSection: string;
|
fsSection: string;
|
||||||
|
|
||||||
public
|
public
|
||||||
@ -70,13 +71,13 @@ type
|
|||||||
|
|
||||||
TSettingsInputRegistry = class(TSettingsInput)
|
TSettingsInputRegistry = class(TSettingsInput)
|
||||||
private
|
private
|
||||||
fReg: TRegIniFile;
|
fReg: TIniFile;
|
||||||
fsSection: string;
|
fsSection: string;
|
||||||
fbOwnReg: boolean;
|
fbOwnReg: boolean;
|
||||||
|
|
||||||
public
|
public
|
||||||
constructor Create(const psRootKey: string); overload;
|
constructor Create(const psRootKey: string); overload;
|
||||||
constructor Create(const pcReg: TRegIniFile; const psSection: string); overload;
|
constructor Create(const pcReg: TIniFile; const psSection: string); overload;
|
||||||
|
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
|
||||||
@ -107,8 +108,7 @@ begin
|
|||||||
Assert(psRootKey <> '');
|
Assert(psRootKey <> '');
|
||||||
inherited Create;
|
inherited Create;
|
||||||
|
|
||||||
fReg := TRegIniFile.Create;
|
fReg := TIniFile.Create(psRootKey);
|
||||||
fReg.OpenKey(psRootKey, True);
|
|
||||||
fsSection := '';
|
fsSection := '';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -182,14 +182,13 @@ begin
|
|||||||
Assert(psRootKey <> '');
|
Assert(psRootKey <> '');
|
||||||
inherited Create;
|
inherited Create;
|
||||||
|
|
||||||
fReg := TRegIniFile.Create;
|
fReg := TIniFile.Create(psRootKey);
|
||||||
fReg.OpenKey(psRootKey, True);
|
|
||||||
|
|
||||||
fsSection := '';
|
fsSection := '';
|
||||||
fbOwnReg := True;
|
fbOwnReg := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TSettingsInputRegistry.Create(const pcReg: TRegIniFile;
|
constructor TSettingsInputRegistry.Create(const pcReg: TIniFile;
|
||||||
const psSection: string);
|
const psSection: string);
|
||||||
begin
|
begin
|
||||||
Assert(psSection <> '');
|
Assert(psSection <> '');
|
||||||
|
@ -50,6 +50,8 @@ interface
|
|||||||
uses
|
uses
|
||||||
Classes, SysUtils, JcfStringUtils, lconvencoding;
|
Classes, SysUtils, JcfStringUtils, lconvencoding;
|
||||||
|
|
||||||
|
type
|
||||||
|
GetConfigFileNameFunction=function:string;
|
||||||
|
|
||||||
function GetApplicationFolder: string;
|
function GetApplicationFolder: string;
|
||||||
|
|
||||||
@ -65,6 +67,10 @@ function SetFileNameExtension(const psFileName, psExt: string): string;
|
|||||||
procedure AdvanceTextPos(const AText: String; var ARow, ACol: integer);
|
procedure AdvanceTextPos(const AText: String; var ARow, ACol: integer);
|
||||||
function LastLineLength(const AString: string): integer;
|
function LastLineLength(const AString: string): integer;
|
||||||
function ReadFileToUTF8String(AFilename: string): string;
|
function ReadFileToUTF8String(AFilename: string): string;
|
||||||
|
function GetConfigFileNameJcf:string;
|
||||||
|
|
||||||
|
var
|
||||||
|
GetConfigFileNameJcfFunction:GetConfigFileNameFunction = nil;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -332,4 +338,25 @@ begin
|
|||||||
end;
|
end;
|
||||||
{$pop}
|
{$pop}
|
||||||
|
|
||||||
|
function JcfApplicationName: string;
|
||||||
|
begin
|
||||||
|
Result := 'JediCodeFormat';
|
||||||
|
end;
|
||||||
|
|
||||||
|
function GetConfigFileNameJcf: string;
|
||||||
|
var
|
||||||
|
lOld: TGetAppNameEvent;
|
||||||
|
begin
|
||||||
|
if Assigned(GetConfigFileNameJcfFunction) then
|
||||||
|
Exit(GetConfigFileNameJcfFunction());
|
||||||
|
|
||||||
|
lOld := OnGetApplicationName;
|
||||||
|
OnGetApplicationName := @JcfApplicationName;
|
||||||
|
try
|
||||||
|
Result := GetAppConfigDir(True) + 'JediCodeFormat.ini';
|
||||||
|
finally
|
||||||
|
OnGetApplicationName := lOld;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user