mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 20:19:24 +02:00
ide: if project options has FPC resource chosen then generate all new forms, datamodules and frames with that resources
git-svn-id: trunk@22968 -
This commit is contained in:
parent
4aacf46d20
commit
d342bcff0e
@ -232,9 +232,16 @@ function SaveFlagsToString(Flags: TSaveFlags): string;
|
|||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
type
|
type
|
||||||
|
|
||||||
|
{ TFileDescPascalUnitWithProjectResource }
|
||||||
|
|
||||||
|
TFileDescPascalUnitWithProjectResource = class(TFileDescPascalUnitWithResource)
|
||||||
|
protected
|
||||||
|
function GetResourceType: TLFMResourceType; override;
|
||||||
|
end;
|
||||||
{ TFileDescPascalUnitWithForm }
|
{ TFileDescPascalUnitWithForm }
|
||||||
|
|
||||||
TFileDescPascalUnitWithForm = class(TFileDescPascalUnitWithResource)
|
TFileDescPascalUnitWithForm = class(TFileDescPascalUnitWithProjectResource)
|
||||||
public
|
public
|
||||||
constructor Create; override;
|
constructor Create; override;
|
||||||
function GetInterfaceUsesSection: string; override;
|
function GetInterfaceUsesSection: string; override;
|
||||||
@ -244,7 +251,7 @@ type
|
|||||||
|
|
||||||
{ TFileDescPascalUnitWithDataModule }
|
{ TFileDescPascalUnitWithDataModule }
|
||||||
|
|
||||||
TFileDescPascalUnitWithDataModule = class(TFileDescPascalUnitWithResource)
|
TFileDescPascalUnitWithDataModule = class(TFileDescPascalUnitWithProjectResource)
|
||||||
public
|
public
|
||||||
constructor Create; override;
|
constructor Create; override;
|
||||||
function GetInterfaceUsesSection: string; override;
|
function GetInterfaceUsesSection: string; override;
|
||||||
@ -254,7 +261,7 @@ type
|
|||||||
|
|
||||||
{ TFileDescPascalUnitWithFrame }
|
{ TFileDescPascalUnitWithFrame }
|
||||||
|
|
||||||
TFileDescPascalUnitWithFrame = class(TFileDescPascalUnitWithResource)
|
TFileDescPascalUnitWithFrame = class(TFileDescPascalUnitWithProjectResource)
|
||||||
public
|
public
|
||||||
constructor Create; override;
|
constructor Create; override;
|
||||||
function GetInterfaceUsesSection: string; override;
|
function GetInterfaceUsesSection: string; override;
|
||||||
@ -264,7 +271,7 @@ type
|
|||||||
|
|
||||||
{ TFileDescInheritedItem }
|
{ TFileDescInheritedItem }
|
||||||
|
|
||||||
TFileDescInheritedItem = class(TFileDescPascalUnitWithResource)
|
TFileDescInheritedItem = class(TFileDescPascalUnitWithProjectResource)
|
||||||
private
|
private
|
||||||
FInheritedUnits: string;
|
FInheritedUnits: string;
|
||||||
public
|
public
|
||||||
@ -596,6 +603,13 @@ begin
|
|||||||
+LE;
|
+LE;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TFileDescPascalUnitWithProjectResource }
|
||||||
|
|
||||||
|
function TFileDescPascalUnitWithProjectResource.GetResourceType: TLFMResourceType;
|
||||||
|
begin
|
||||||
|
Result := Project1.Resources.LFMResourceType;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,11 +44,6 @@ uses
|
|||||||
CodeToolManager, CodeCache;
|
CodeToolManager, CodeCache;
|
||||||
|
|
||||||
type
|
type
|
||||||
TLFMResourceType = (
|
|
||||||
lfmrtLRS,
|
|
||||||
lfmrtRes
|
|
||||||
);
|
|
||||||
|
|
||||||
{ TProjectResources }
|
{ TProjectResources }
|
||||||
|
|
||||||
TProjectResources = class(TAbstractProjectResources)
|
TProjectResources = class(TAbstractProjectResources)
|
||||||
|
@ -45,6 +45,11 @@ const
|
|||||||
ProjDescNameEmpty = 'Empty';
|
ProjDescNameEmpty = 'Empty';
|
||||||
|
|
||||||
type
|
type
|
||||||
|
TLFMResourceType = (
|
||||||
|
lfmrtLRS,
|
||||||
|
lfmrtRes
|
||||||
|
);
|
||||||
|
|
||||||
TCOCNodeType = (
|
TCOCNodeType = (
|
||||||
cocntNone,
|
cocntNone,
|
||||||
cocntIf,
|
cocntIf,
|
||||||
@ -566,6 +571,8 @@ type
|
|||||||
TFileDescPascalUnitWithResource = class(TFileDescPascalUnit)
|
TFileDescPascalUnitWithResource = class(TFileDescPascalUnit)
|
||||||
private
|
private
|
||||||
FDeclareClassVariable: Boolean;
|
FDeclareClassVariable: Boolean;
|
||||||
|
protected
|
||||||
|
function GetResourceType: TLFMResourceType; virtual;
|
||||||
public
|
public
|
||||||
constructor Create; override;
|
constructor Create; override;
|
||||||
|
|
||||||
@ -1345,6 +1352,11 @@ end;
|
|||||||
|
|
||||||
{ TFileDescPascalUnitWithResource }
|
{ TFileDescPascalUnitWithResource }
|
||||||
|
|
||||||
|
function TFileDescPascalUnitWithResource.GetResourceType: TLFMResourceType;
|
||||||
|
begin
|
||||||
|
Result := lfmrtLRS;
|
||||||
|
end;
|
||||||
|
|
||||||
constructor TFileDescPascalUnitWithResource.Create;
|
constructor TFileDescPascalUnitWithResource.Create;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
@ -1354,7 +1366,9 @@ end;
|
|||||||
function TFileDescPascalUnitWithResource.GetInterfaceUsesSection: string;
|
function TFileDescPascalUnitWithResource.GetInterfaceUsesSection: string;
|
||||||
begin
|
begin
|
||||||
Result:=inherited GetInterfaceUsesSection;
|
Result:=inherited GetInterfaceUsesSection;
|
||||||
Result:=Result+', FileUtil, LResources';
|
Result:=Result+', FileUtil';
|
||||||
|
if GetResourceType = lfmrtLRS then
|
||||||
|
Result := Result +', LResources';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFileDescPascalUnitWithResource.GetInterfaceSource(const Filename,
|
function TFileDescPascalUnitWithResource.GetInterfaceSource(const Filename,
|
||||||
@ -1386,11 +1400,15 @@ var
|
|||||||
ResourceFilename: String;
|
ResourceFilename: String;
|
||||||
LE: String;
|
LE: String;
|
||||||
begin
|
begin
|
||||||
ResourceFilename:=TrimFilename(ExtractFilenameOnly(Filename)+DefaultResFileExt);
|
|
||||||
LE:=LineEnding;
|
LE:=LineEnding;
|
||||||
Result:='initialization'+LE
|
case GetResourceType of
|
||||||
+' {$I '+ResourceFilename+'}'+LE
|
lfmrtLRS:
|
||||||
+LE
|
begin
|
||||||
|
ResourceFilename:=TrimFilename(ExtractFilenameOnly(Filename)+DefaultResFileExt);
|
||||||
|
Result:='initialization'+LE+' {$I '+ResourceFilename+'}'+LE+LE;
|
||||||
|
end;
|
||||||
|
lfmrtRes: Result := LE+'{$R *.lfm}'+LE+LE;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TProjectDescriptor }
|
{ TProjectDescriptor }
|
||||||
|
Loading…
Reference in New Issue
Block a user