mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-29 11:30:28 +02:00
IDE: add const for string parameters in resource handling classes
git-svn-id: trunk@52402 -
This commit is contained in:
parent
b2605a63b4
commit
0f8dcb2831
@ -31,8 +31,8 @@ type
|
|||||||
procedure DoAfterBuild({%H-}AResources: TAbstractProjectResources; {%H-}AReason: TCompileReason; {%H-}SaveToTestDir: boolean); virtual;
|
procedure DoAfterBuild({%H-}AResources: TAbstractProjectResources; {%H-}AReason: TCompileReason; {%H-}SaveToTestDir: boolean); virtual;
|
||||||
procedure DoBeforeBuild({%H-}AResources: TAbstractProjectResources; {%H-}AReason: TCompileReason; {%H-}SaveToTestDir: boolean); virtual;
|
procedure DoBeforeBuild({%H-}AResources: TAbstractProjectResources; {%H-}AReason: TCompileReason; {%H-}SaveToTestDir: boolean); virtual;
|
||||||
function UpdateResources(AResources: TAbstractProjectResources; const MainFilename: string): Boolean; virtual; abstract;
|
function UpdateResources(AResources: TAbstractProjectResources; const MainFilename: string): Boolean; virtual; abstract;
|
||||||
procedure WriteToProjectFile(AConfig: {TXMLConfig}TObject; Path: String); virtual; abstract;
|
procedure WriteToProjectFile(AConfig: {TXMLConfig}TObject; const Path: String); virtual; abstract;
|
||||||
procedure ReadFromProjectFile(AConfig: {TXMLConfig}TObject; Path: String); virtual; abstract;
|
procedure ReadFromProjectFile(AConfig: {TXMLConfig}TObject; const Path: String); virtual; abstract;
|
||||||
|
|
||||||
property Modified: boolean read FModified write SetModified;
|
property Modified: boolean read FModified write SetModified;
|
||||||
property OnModified: TNotifyEvent read FOnModified write FOnModified;
|
property OnModified: TNotifyEvent read FOnModified write FOnModified;
|
||||||
|
@ -63,8 +63,8 @@ type
|
|||||||
|
|
||||||
function UpdateResources(AResources: TAbstractProjectResources;
|
function UpdateResources(AResources: TAbstractProjectResources;
|
||||||
const MainFilename: string): Boolean; override;
|
const MainFilename: string): Boolean; override;
|
||||||
procedure WriteToProjectFile(AConfig: {TXMLConfig}TObject; Path: String); override;
|
procedure WriteToProjectFile(AConfig: {TXMLConfig}TObject; const Path: String); override;
|
||||||
procedure ReadFromProjectFile(AConfig: {TXMLConfig}TObject; Path: String); override;
|
procedure ReadFromProjectFile(AConfig: {TXMLConfig}TObject; const Path: String); override;
|
||||||
|
|
||||||
function SaveIconFile: Boolean;
|
function SaveIconFile: Boolean;
|
||||||
|
|
||||||
@ -164,12 +164,12 @@ begin
|
|||||||
AResources.AddSystemResource(ARes);
|
AResources.AddSystemResource(ARes);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TProjectIcon.WriteToProjectFile(AConfig: TObject; Path: String);
|
procedure TProjectIcon.WriteToProjectFile(AConfig: TObject; const Path: String);
|
||||||
begin
|
begin
|
||||||
TXMLConfig(AConfig).SetDeleteValue(Path+'General/Icon/Value', BoolToStr(IsEmpty), BoolToStr(true));
|
TXMLConfig(AConfig).SetDeleteValue(Path+'General/Icon/Value', BoolToStr(IsEmpty), BoolToStr(true));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TProjectIcon.ReadFromProjectFile(AConfig: TObject; Path: String);
|
procedure TProjectIcon.ReadFromProjectFile(AConfig: TObject; const Path: String);
|
||||||
begin
|
begin
|
||||||
with TXMLConfig(AConfig) do
|
with TXMLConfig(AConfig) do
|
||||||
begin
|
begin
|
||||||
|
@ -100,15 +100,15 @@ type
|
|||||||
procedure Clear;
|
procedure Clear;
|
||||||
function Regenerate(const MainFileName: String;
|
function Regenerate(const MainFileName: String;
|
||||||
UpdateSource, PerformSave: boolean;
|
UpdateSource, PerformSave: boolean;
|
||||||
SaveToTestDir: string): Boolean;
|
const SaveToTestDir: string): Boolean;
|
||||||
function RenameDirectives(const CurFileName, NewFileName: String): Boolean;
|
function RenameDirectives(const CurFileName, NewFileName: String): Boolean;
|
||||||
procedure DeleteResourceBuffers;
|
procedure DeleteResourceBuffers;
|
||||||
|
|
||||||
function HasSystemResources: Boolean;
|
function HasSystemResources: Boolean;
|
||||||
function HasLazarusResources: Boolean;
|
function HasLazarusResources: Boolean;
|
||||||
|
|
||||||
procedure WriteToProjectFile(AConfig: TXMLConfig; Path: String);
|
procedure WriteToProjectFile(AConfig: TXMLConfig; const Path: String);
|
||||||
procedure ReadFromProjectFile(AConfig: TXMLConfig; Path: String; ReadAll: Boolean);
|
procedure ReadFromProjectFile(AConfig: TXMLConfig; const Path: String; ReadAll: Boolean);
|
||||||
|
|
||||||
property Modified: Boolean read FModified write SetModified;
|
property Modified: Boolean read FModified write SetModified;
|
||||||
property OnModified: TNotifyEvent read FOnModified write FOnModified;
|
property OnModified: TNotifyEvent read FOnModified write FOnModified;
|
||||||
@ -506,8 +506,8 @@ begin
|
|||||||
FMessages.Clear;
|
FMessages.Clear;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TProjectResources.Regenerate(const MainFileName: String;
|
function TProjectResources.Regenerate(const MainFileName: String; UpdateSource,
|
||||||
UpdateSource, PerformSave: boolean; SaveToTestDir: string): Boolean;
|
PerformSave: boolean; const SaveToTestDir: string): Boolean;
|
||||||
begin
|
begin
|
||||||
//DebugLn(['TProjectResources.Regenerate MainFilename=',MainFilename,' UpdateSource=',UpdateSource,' PerformSave=',PerformSave]);
|
//DebugLn(['TProjectResources.Regenerate MainFilename=',MainFilename,' UpdateSource=',UpdateSource,' PerformSave=',PerformSave]);
|
||||||
//DumpStack;
|
//DumpStack;
|
||||||
@ -558,7 +558,8 @@ begin
|
|||||||
Result := FLazarusResources.Count > 0;
|
Result := FLazarusResources.Count > 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TProjectResources.WriteToProjectFile(AConfig: TXMLConfig; Path: String);
|
procedure TProjectResources.WriteToProjectFile(AConfig: TXMLConfig;
|
||||||
|
const Path: String);
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
@ -567,7 +568,8 @@ begin
|
|||||||
FResources[i].WriteToProjectFile(AConfig, Path);
|
FResources[i].WriteToProjectFile(AConfig, Path);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TProjectResources.ReadFromProjectFile(AConfig: TXMLConfig; Path: String; ReadAll: Boolean);
|
procedure TProjectResources.ReadFromProjectFile(AConfig: TXMLConfig;
|
||||||
|
const Path: String; ReadAll: Boolean);
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
|
@ -57,10 +57,10 @@ type
|
|||||||
FileName: String;
|
FileName: String;
|
||||||
ResType: TUserResourceType;
|
ResType: TUserResourceType;
|
||||||
ResName: String;
|
ResName: String;
|
||||||
procedure ReadFromProjectFile(AConfig: TXMLConfig; Path: String);
|
procedure ReadFromProjectFile(AConfig: TXMLConfig; const Path: String);
|
||||||
procedure WriteToProjectFile(AConfig: TXMLConfig; Path: String);
|
procedure WriteToProjectFile(AConfig: TXMLConfig; const Path: String);
|
||||||
function CreateResource(ProjectDirectory: String): TAbstractResource;
|
function CreateResource(const ProjectDirectory: String): TAbstractResource;
|
||||||
function GetRealFileName(ProjectDirectory: String): String;
|
function GetRealFileName(const ProjectDirectory: String): String;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TResourceList }
|
{ TResourceList }
|
||||||
@ -72,7 +72,7 @@ type
|
|||||||
procedure Notify(Ptr: Pointer; Action: TListNotification); override;
|
procedure Notify(Ptr: Pointer; Action: TListNotification); override;
|
||||||
public
|
public
|
||||||
function AddItem: PResourceItem;
|
function AddItem: PResourceItem;
|
||||||
procedure AddResource(FileName: String; ResType: TUserResourceType; ResName: String);
|
procedure AddResource(const FileName: String; ResType: TUserResourceType; const ResName: String);
|
||||||
property Items[AIndex: Integer]: PResourceItem read GetItem; default;
|
property Items[AIndex: Integer]: PResourceItem read GetItem; default;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -87,8 +87,8 @@ type
|
|||||||
|
|
||||||
function UpdateResources(AResources: TAbstractProjectResources;
|
function UpdateResources(AResources: TAbstractProjectResources;
|
||||||
const MainFilename: string): Boolean; override;
|
const MainFilename: string): Boolean; override;
|
||||||
procedure WriteToProjectFile(AConfig: {TXMLConfig}TObject; Path: String); override;
|
procedure WriteToProjectFile(AConfig: {TXMLConfig}TObject; const Path: String); override;
|
||||||
procedure ReadFromProjectFile(AConfig: {TXMLConfig}TObject; Path: String); override;
|
procedure ReadFromProjectFile(AConfig: {TXMLConfig}TObject; const Path: String); override;
|
||||||
property List: TResourceList read FList;
|
property List: TResourceList read FList;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -101,11 +101,11 @@ const
|
|||||||
{ rtRCData } 'RCDATA'
|
{ rtRCData } 'RCDATA'
|
||||||
);
|
);
|
||||||
|
|
||||||
function StrToResourceType(AStr: String): TUserResourceType;
|
function StrToResourceType(const AStr: String): TUserResourceType;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
function StrToResourceType(AStr: String): TUserResourceType;
|
function StrToResourceType(const AStr: String): TUserResourceType;
|
||||||
begin
|
begin
|
||||||
case AStr of
|
case AStr of
|
||||||
'ICON': Result := rtIcon;
|
'ICON': Result := rtIcon;
|
||||||
@ -119,21 +119,23 @@ end;
|
|||||||
|
|
||||||
{ TResourceItem }
|
{ TResourceItem }
|
||||||
|
|
||||||
procedure TResourceItem.ReadFromProjectFile(AConfig: TXMLConfig; Path: String);
|
procedure TResourceItem.ReadFromProjectFile(AConfig: TXMLConfig;
|
||||||
|
const Path: String);
|
||||||
begin
|
begin
|
||||||
FileName := AConfig.GetValue(Path + 'FileName', '');
|
FileName := AConfig.GetValue(Path + 'FileName', '');
|
||||||
ResType := StrToResourceType(AConfig.GetValue(Path + 'Type', ''));
|
ResType := StrToResourceType(AConfig.GetValue(Path + 'Type', ''));
|
||||||
ResName := AConfig.GetValue(Path + 'ResourceName', '');
|
ResName := AConfig.GetValue(Path + 'ResourceName', '');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TResourceItem.WriteToProjectFile(AConfig: TXMLConfig; Path: String);
|
procedure TResourceItem.WriteToProjectFile(AConfig: TXMLConfig;
|
||||||
|
const Path: String);
|
||||||
begin
|
begin
|
||||||
AConfig.SetValue(Path + 'FileName', FileName);
|
AConfig.SetValue(Path + 'FileName', FileName);
|
||||||
AConfig.SetValue(Path + 'Type', ResourceTypeToStr[ResType]);
|
AConfig.SetValue(Path + 'Type', ResourceTypeToStr[ResType]);
|
||||||
AConfig.SetValue(Path + 'ResourceName', ResName);
|
AConfig.SetValue(Path + 'ResourceName', ResName);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TResourceItem.CreateResource(ProjectDirectory: String): TAbstractResource;
|
function TResourceItem.CreateResource(const ProjectDirectory: String): TAbstractResource;
|
||||||
var
|
var
|
||||||
Stream: TFileStream;
|
Stream: TFileStream;
|
||||||
TypeDesc, NameDesc: TResourceDesc;
|
TypeDesc, NameDesc: TResourceDesc;
|
||||||
@ -188,7 +190,7 @@ begin
|
|||||||
AddIDEMessage(mluError,Format(lisFileNotFound2, [Filename]));
|
AddIDEMessage(mluError,Format(lisFileNotFound2, [Filename]));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TResourceItem.GetRealFileName(ProjectDirectory: String): String;
|
function TResourceItem.GetRealFileName(const ProjectDirectory: String): String;
|
||||||
begin
|
begin
|
||||||
Result := FileName;
|
Result := FileName;
|
||||||
if not IDEMacros.SubstituteMacros(Result) then
|
if not IDEMacros.SubstituteMacros(Result) then
|
||||||
@ -219,8 +221,8 @@ begin
|
|||||||
Add(Result);
|
Add(Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TResourceList.AddResource(FileName: String; ResType: TUserResourceType;
|
procedure TResourceList.AddResource(const FileName: String;
|
||||||
ResName: String);
|
ResType: TUserResourceType; const ResName: String);
|
||||||
var
|
var
|
||||||
Data: PResourceItem;
|
Data: PResourceItem;
|
||||||
begin
|
begin
|
||||||
@ -246,7 +248,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TProjectUserResources.WriteToProjectFile(AConfig: TObject; Path: String);
|
procedure TProjectUserResources.WriteToProjectFile(AConfig: TObject;
|
||||||
|
const Path: String);
|
||||||
var
|
var
|
||||||
I: Integer;
|
I: Integer;
|
||||||
begin
|
begin
|
||||||
@ -255,7 +258,8 @@ begin
|
|||||||
List[I]^.WriteToProjectFile(TXMLConfig(AConfig), Path + 'General/Resources/Resource_' + IntToStr(I) + '/')
|
List[I]^.WriteToProjectFile(TXMLConfig(AConfig), Path + 'General/Resources/Resource_' + IntToStr(I) + '/')
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TProjectUserResources.ReadFromProjectFile(AConfig: TObject; Path: String);
|
procedure TProjectUserResources.ReadFromProjectFile(AConfig: TObject;
|
||||||
|
const Path: String);
|
||||||
var
|
var
|
||||||
I, Count: Integer;
|
I, Count: Integer;
|
||||||
begin
|
begin
|
||||||
|
@ -63,8 +63,8 @@ type
|
|||||||
public
|
public
|
||||||
constructor Create; override;
|
constructor Create; override;
|
||||||
function UpdateResources(AResources: TAbstractProjectResources; const {%H-}MainFilename: string): Boolean; override;
|
function UpdateResources(AResources: TAbstractProjectResources; const {%H-}MainFilename: string): Boolean; override;
|
||||||
procedure WriteToProjectFile(AConfig: {TXMLConfig}TObject; Path: String); override;
|
procedure WriteToProjectFile(AConfig: {TXMLConfig}TObject; const Path: String); override;
|
||||||
procedure ReadFromProjectFile(AConfig: {TXMLConfig}TObject; Path: String); override;
|
procedure ReadFromProjectFile(AConfig: {TXMLConfig}TObject; const Path: String); override;
|
||||||
|
|
||||||
property UseManifest: boolean read FUseManifest write SetUseManifest;
|
property UseManifest: boolean read FUseManifest write SetUseManifest;
|
||||||
property DpiAware: boolean read FIsDpiaAware write SetDpiAware;
|
property DpiAware: boolean read FIsDpiaAware write SetDpiAware;
|
||||||
@ -183,7 +183,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TProjectXPManifest.WriteToProjectFile(AConfig: TObject; Path: String);
|
procedure TProjectXPManifest.WriteToProjectFile(AConfig: TObject;
|
||||||
|
const Path: String);
|
||||||
begin
|
begin
|
||||||
TXMLConfig(AConfig).SetDeleteValue(Path+'General/UseXPManifest/Value', UseManifest, False);
|
TXMLConfig(AConfig).SetDeleteValue(Path+'General/UseXPManifest/Value', UseManifest, False);
|
||||||
TXMLConfig(AConfig).SetDeleteValue(Path+'General/XPManifest/DpiAware/Value', DpiAware, False);
|
TXMLConfig(AConfig).SetDeleteValue(Path+'General/XPManifest/DpiAware/Value', DpiAware, False);
|
||||||
@ -191,7 +192,8 @@ begin
|
|||||||
TXMLConfig(AConfig).SetDeleteValue(Path+'General/XPManifest/UIAccess/Value', UIAccess, False);
|
TXMLConfig(AConfig).SetDeleteValue(Path+'General/XPManifest/UIAccess/Value', UIAccess, False);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TProjectXPManifest.ReadFromProjectFile(AConfig: TObject; Path: String);
|
procedure TProjectXPManifest.ReadFromProjectFile(AConfig: TObject;
|
||||||
|
const Path: String);
|
||||||
begin
|
begin
|
||||||
UseManifest := TXMLConfig(AConfig).GetValue(Path+'General/UseXPManifest/Value', False);
|
UseManifest := TXMLConfig(AConfig).GetValue(Path+'General/UseXPManifest/Value', False);
|
||||||
DpiAware := TXMLConfig(AConfig).GetValue(Path+'General/XPManifest/DpiAware/Value', False);
|
DpiAware := TXMLConfig(AConfig).GetValue(Path+'General/XPManifest/DpiAware/Value', False);
|
||||||
|
@ -51,8 +51,8 @@ type
|
|||||||
TProjectVersionStringTable = class(TVersionStringTable)
|
TProjectVersionStringTable = class(TVersionStringTable)
|
||||||
private
|
private
|
||||||
FOnModified: TNotifyEvent;
|
FOnModified: TNotifyEvent;
|
||||||
function GetValues(Key: string): string;
|
function GetValues(const Key: string): string;
|
||||||
procedure SetValues(Key: string; const AValue: string);
|
procedure SetValues(const Key: string; const AValue: string);
|
||||||
protected
|
protected
|
||||||
procedure DoModified;
|
procedure DoModified;
|
||||||
function KeyToIndex(const aKey: String): Integer;
|
function KeyToIndex(const aKey: String): Integer;
|
||||||
@ -115,8 +115,8 @@ type
|
|||||||
AReason: TCompileReason; {%H-}SaveToTestDir: boolean); override;
|
AReason: TCompileReason; {%H-}SaveToTestDir: boolean); override;
|
||||||
function UpdateResources(AResources: TAbstractProjectResources;
|
function UpdateResources(AResources: TAbstractProjectResources;
|
||||||
const {%H-}MainFilename: string): boolean; override;
|
const {%H-}MainFilename: string): boolean; override;
|
||||||
procedure WriteToProjectFile(AConfig: {TXMLConfig}TObject; Path: string); override;
|
procedure WriteToProjectFile(AConfig: {TXMLConfig}TObject; const Path: string); override;
|
||||||
procedure ReadFromProjectFile(AConfig: {TXMLConfig}TObject; Path: string); override;
|
procedure ReadFromProjectFile(AConfig: {TXMLConfig}TObject; const Path: string); override;
|
||||||
|
|
||||||
property UseVersionInfo: boolean read FUseVersionInfo write SetUseVersionInfo;
|
property UseVersionInfo: boolean read FUseVersionInfo write SetUseVersionInfo;
|
||||||
property AutoIncrementBuild: boolean read FAutoIncrementBuild write SetAutoIncrementBuild;
|
property AutoIncrementBuild: boolean read FAutoIncrementBuild write SetAutoIncrementBuild;
|
||||||
@ -422,7 +422,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TProjectVersionInfo.WriteToProjectFile(AConfig: TObject; Path: string);
|
procedure TProjectVersionInfo.WriteToProjectFile(AConfig: TObject;
|
||||||
|
const Path: string);
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
Key: string;
|
Key: string;
|
||||||
@ -460,7 +461,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TProjectVersionInfo.ReadFromProjectFile(AConfig: TObject; Path: string);
|
procedure TProjectVersionInfo.ReadFromProjectFile(AConfig: TObject;
|
||||||
|
const Path: string);
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
Node: TDomNode;
|
Node: TDomNode;
|
||||||
@ -681,7 +683,7 @@ end;
|
|||||||
|
|
||||||
{ TProjectVersionStringTable }
|
{ TProjectVersionStringTable }
|
||||||
|
|
||||||
function TProjectVersionStringTable.GetValues(Key: string): string;
|
function TProjectVersionStringTable.GetValues(const Key: string): string;
|
||||||
var
|
var
|
||||||
idx: Integer;
|
idx: Integer;
|
||||||
begin
|
begin
|
||||||
@ -692,7 +694,8 @@ begin
|
|||||||
Result := ValuesByIndex[idx];
|
Result := ValuesByIndex[idx];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TProjectVersionStringTable.SetValues(Key: string; const AValue: string);
|
procedure TProjectVersionStringTable.SetValues(const Key: string;
|
||||||
|
const AValue: string);
|
||||||
var
|
var
|
||||||
idx: Integer;
|
idx: Integer;
|
||||||
begin
|
begin
|
||||||
@ -722,8 +725,7 @@ begin
|
|||||||
// - SpecialBuild
|
// - SpecialBuild
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TProjectVersionStringTable.Equals(aTable: TProjectVersionStringTable
|
function TProjectVersionStringTable.Equals(aTable: TProjectVersionStringTable): boolean;
|
||||||
): boolean;
|
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user