mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 19:39: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
|
||||
|
||||
{ TFileDescPascalUnitWithProjectResource }
|
||||
|
||||
TFileDescPascalUnitWithProjectResource = class(TFileDescPascalUnitWithResource)
|
||||
protected
|
||||
function GetResourceType: TLFMResourceType; override;
|
||||
end;
|
||||
{ TFileDescPascalUnitWithForm }
|
||||
|
||||
TFileDescPascalUnitWithForm = class(TFileDescPascalUnitWithResource)
|
||||
TFileDescPascalUnitWithForm = class(TFileDescPascalUnitWithProjectResource)
|
||||
public
|
||||
constructor Create; override;
|
||||
function GetInterfaceUsesSection: string; override;
|
||||
@ -244,7 +251,7 @@ type
|
||||
|
||||
{ TFileDescPascalUnitWithDataModule }
|
||||
|
||||
TFileDescPascalUnitWithDataModule = class(TFileDescPascalUnitWithResource)
|
||||
TFileDescPascalUnitWithDataModule = class(TFileDescPascalUnitWithProjectResource)
|
||||
public
|
||||
constructor Create; override;
|
||||
function GetInterfaceUsesSection: string; override;
|
||||
@ -254,7 +261,7 @@ type
|
||||
|
||||
{ TFileDescPascalUnitWithFrame }
|
||||
|
||||
TFileDescPascalUnitWithFrame = class(TFileDescPascalUnitWithResource)
|
||||
TFileDescPascalUnitWithFrame = class(TFileDescPascalUnitWithProjectResource)
|
||||
public
|
||||
constructor Create; override;
|
||||
function GetInterfaceUsesSection: string; override;
|
||||
@ -264,7 +271,7 @@ type
|
||||
|
||||
{ TFileDescInheritedItem }
|
||||
|
||||
TFileDescInheritedItem = class(TFileDescPascalUnitWithResource)
|
||||
TFileDescInheritedItem = class(TFileDescPascalUnitWithProjectResource)
|
||||
private
|
||||
FInheritedUnits: string;
|
||||
public
|
||||
@ -596,6 +603,13 @@ begin
|
||||
+LE;
|
||||
end;
|
||||
|
||||
{ TFileDescPascalUnitWithProjectResource }
|
||||
|
||||
function TFileDescPascalUnitWithProjectResource.GetResourceType: TLFMResourceType;
|
||||
begin
|
||||
Result := Project1.Resources.LFMResourceType;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
||||
|
@ -44,11 +44,6 @@ uses
|
||||
CodeToolManager, CodeCache;
|
||||
|
||||
type
|
||||
TLFMResourceType = (
|
||||
lfmrtLRS,
|
||||
lfmrtRes
|
||||
);
|
||||
|
||||
{ TProjectResources }
|
||||
|
||||
TProjectResources = class(TAbstractProjectResources)
|
||||
|
@ -45,6 +45,11 @@ const
|
||||
ProjDescNameEmpty = 'Empty';
|
||||
|
||||
type
|
||||
TLFMResourceType = (
|
||||
lfmrtLRS,
|
||||
lfmrtRes
|
||||
);
|
||||
|
||||
TCOCNodeType = (
|
||||
cocntNone,
|
||||
cocntIf,
|
||||
@ -566,6 +571,8 @@ type
|
||||
TFileDescPascalUnitWithResource = class(TFileDescPascalUnit)
|
||||
private
|
||||
FDeclareClassVariable: Boolean;
|
||||
protected
|
||||
function GetResourceType: TLFMResourceType; virtual;
|
||||
public
|
||||
constructor Create; override;
|
||||
|
||||
@ -1345,6 +1352,11 @@ end;
|
||||
|
||||
{ TFileDescPascalUnitWithResource }
|
||||
|
||||
function TFileDescPascalUnitWithResource.GetResourceType: TLFMResourceType;
|
||||
begin
|
||||
Result := lfmrtLRS;
|
||||
end;
|
||||
|
||||
constructor TFileDescPascalUnitWithResource.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
@ -1354,7 +1366,9 @@ end;
|
||||
function TFileDescPascalUnitWithResource.GetInterfaceUsesSection: string;
|
||||
begin
|
||||
Result:=inherited GetInterfaceUsesSection;
|
||||
Result:=Result+', FileUtil, LResources';
|
||||
Result:=Result+', FileUtil';
|
||||
if GetResourceType = lfmrtLRS then
|
||||
Result := Result +', LResources';
|
||||
end;
|
||||
|
||||
function TFileDescPascalUnitWithResource.GetInterfaceSource(const Filename,
|
||||
@ -1386,11 +1400,15 @@ var
|
||||
ResourceFilename: String;
|
||||
LE: String;
|
||||
begin
|
||||
ResourceFilename:=TrimFilename(ExtractFilenameOnly(Filename)+DefaultResFileExt);
|
||||
LE:=LineEnding;
|
||||
Result:='initialization'+LE
|
||||
+' {$I '+ResourceFilename+'}'+LE
|
||||
+LE
|
||||
case GetResourceType of
|
||||
lfmrtLRS:
|
||||
begin
|
||||
ResourceFilename:=TrimFilename(ExtractFilenameOnly(Filename)+DefaultResFileExt);
|
||||
Result:='initialization'+LE+' {$I '+ResourceFilename+'}'+LE+LE;
|
||||
end;
|
||||
lfmrtRes: Result := LE+'{$R *.lfm}'+LE+LE;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TProjectDescriptor }
|
||||
|
Loading…
Reference in New Issue
Block a user