mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-24 09:53:41 +02:00
IDEIntf: added TLazProject.Resources
git-svn-id: trunk@32596 -
This commit is contained in:
parent
f5d82af704
commit
38c75a8c1f
@ -1286,7 +1286,7 @@ begin
|
||||
if AnUnitInfo.IsPartOfProject then
|
||||
begin
|
||||
// use project resource type
|
||||
Result := Project1.Resources.ResourceType;
|
||||
Result := Project1.ProjResources.ResourceType;
|
||||
end
|
||||
else
|
||||
Result := rtLRS;
|
||||
@ -1357,7 +1357,7 @@ var
|
||||
Code: TCodeBuffer;
|
||||
begin
|
||||
// update project resource
|
||||
Project1.Resources.Regenerate(Project1.MainFileName, False, True, TestDir);
|
||||
Project1.ProjResources.Regenerate(Project1.MainFileName, False, True, TestDir);
|
||||
AnUnitInfo := Project1.FirstPartOfProject;
|
||||
while AnUnitInfo<>nil do
|
||||
begin
|
||||
|
||||
@ -217,10 +217,10 @@ begin
|
||||
begin
|
||||
TitleEdit.Text := Title;
|
||||
UseAppBundleCheckBox.Checked := UseAppBundle;
|
||||
UseXPManifestCheckBox.Checked := TProjectXPManifest(Resources[TProjectXPManifest]).UseManifest;
|
||||
DpiAwareCheckBox.Checked := TProjectXPManifest(Resources[TProjectXPManifest]).DpiAware;
|
||||
UseXPManifestCheckBox.Checked := TProjectXPManifest(ProjResources[TProjectXPManifest]).UseManifest;
|
||||
DpiAwareCheckBox.Checked := TProjectXPManifest(ProjResources[TProjectXPManifest]).DpiAware;
|
||||
DpiAwareCheckBox.Enabled := UseXPManifestCheckBox.Checked;
|
||||
AStream := TProjectIcon(Resources[TProjectIcon]).GetStream;
|
||||
AStream := TProjectIcon(ProjResources[TProjectIcon]).GetStream;
|
||||
try
|
||||
SetIconFromStream(AStream);
|
||||
finally
|
||||
@ -238,13 +238,13 @@ begin
|
||||
Title := TitleEdit.Text;
|
||||
AStream := GetIconAsStream;
|
||||
try
|
||||
TProjectIcon(Resources[TProjectIcon]).SetStream(AStream);
|
||||
TProjectIcon(ProjResources[TProjectIcon]).SetStream(AStream);
|
||||
finally
|
||||
AStream.Free;
|
||||
end;
|
||||
UseAppBundle := UseAppBundleCheckBox.Checked;
|
||||
TProjectXPManifest(Resources[TProjectXPManifest]).UseManifest := UseXPManifestCheckBox.Checked;
|
||||
TProjectXPManifest(Resources[TProjectXPManifest]).DpiAware := DpiAwareCheckBox.Checked;
|
||||
TProjectXPManifest(ProjResources[TProjectXPManifest]).UseManifest := UseXPManifestCheckBox.Checked;
|
||||
TProjectXPManifest(ProjResources[TProjectXPManifest]).DpiAware := DpiAwareCheckBox.Checked;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
@ -84,7 +84,7 @@ begin
|
||||
UseDesignTimePkgsCheckBox.Checked := (pfUseDesignTimePackages in Flags);
|
||||
AlwaysBuildCheckBox.Checked := (pfAlwaysBuild in Flags);
|
||||
LRSInOutputDirCheckBox.Checked := (pfLRSFilesInOutputDirectory in Flags);
|
||||
case Resources.ResourceType of
|
||||
case ProjResources.ResourceType of
|
||||
rtLRS: UseLRSFilesRadioButton.Checked := True;
|
||||
rtRes: UseFPCResourcesRadioButton.Checked := True;
|
||||
end;
|
||||
@ -127,9 +127,9 @@ begin
|
||||
SetProjectFlag(pfLRSFilesInOutputDirectory, LRSInOutputDirCheckBox.Checked);
|
||||
Project.Flags := NewFlags;
|
||||
if UseLRSFilesRadioButton.Checked then
|
||||
Project.Resources.ResourceType := rtLRS
|
||||
Project.ProjResources.ResourceType := rtLRS
|
||||
else
|
||||
Project.Resources.ResourceType := rtRes;
|
||||
Project.ProjResources.ResourceType := rtRes;
|
||||
case PathDelimComboBox.ItemIndex of
|
||||
0: Project.StorePathDelim:=pdsNone;
|
||||
1: Project.StorePathDelim:=pdsUnix;
|
||||
|
||||
@ -127,7 +127,7 @@ procedure TProjectVersionInfoOptionsFrame.ReadSettings(AOptions: TAbstractIDEOpt
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
FVersionInfo := TProjectVersionInfo((AOptions as TProject).Resources[TProjectVersionInfo]);
|
||||
FVersionInfo := TProjectVersionInfo((AOptions as TProject).ProjResources[TProjectVersionInfo]);
|
||||
|
||||
UseVersionInfoCheckBox.Checked := FVersionInfo.UseVersionInfo;
|
||||
MajorVersionSpinEdit.Value := FVersionInfo.MajorVersionNr;
|
||||
@ -164,7 +164,7 @@ var
|
||||
i: integer;
|
||||
t: TProjectVersionStringTable;
|
||||
begin
|
||||
VersionInfo := TProjectVersionInfo((AOptions as TProject).Resources[TProjectVersionInfo]);
|
||||
VersionInfo := TProjectVersionInfo((AOptions as TProject).ProjResources[TProjectVersionInfo]);
|
||||
VersionInfo.UseVersionInfo := UseVersionInfoCheckBox.Checked;
|
||||
VersionInfo.AutoIncrementBuild := AutomaticallyIncreaseBuildCheckBox.Checked;
|
||||
VersionInfo.MajorVersionNr := MajorVersionSpinEdit.Value;
|
||||
|
||||
18
ide/main.pp
18
ide/main.pp
@ -5105,10 +5105,10 @@ begin
|
||||
SetAutoCreateForms;
|
||||
// extend include path
|
||||
AProject.AutoAddOutputDirToIncPath;
|
||||
if AProject.Resources.Modified and (AProject.MainUnitID >= 0) then
|
||||
if AProject.ProjResources.Modified and (AProject.MainUnitID >= 0) then
|
||||
begin
|
||||
if not AProject.Resources.Regenerate(AProject.MainFilename, True, False, '') then
|
||||
MessageDlg(AProject.Resources.Messages.Text, mtWarning, [mbOk], 0);
|
||||
if not AProject.ProjResources.Regenerate(AProject.MainFilename, True, False, '') then
|
||||
MessageDlg(AProject.ProjResources.Messages.Text, mtWarning, [mbOk], 0);
|
||||
end;
|
||||
UpdateCaption;
|
||||
AProject.DefineTemplates.AllChanged;
|
||||
@ -8272,7 +8272,7 @@ begin
|
||||
begin
|
||||
GetMainUnit(MainUnitInfo, MainUnitSrcEdit, true);
|
||||
|
||||
if not Project1.Resources.RenameDirectives(MainUnitInfo.Filename,NewProgramFilename)
|
||||
if not Project1.ProjResources.RenameDirectives(MainUnitInfo.Filename,NewProgramFilename)
|
||||
then begin
|
||||
DebugLn(['TMainIDE.DoShowSaveProjectAsDialog failed renaming directives Old="',MainUnitInfo.Filename,'" New="',NewProgramFilename,'"']);
|
||||
// silently ignore
|
||||
@ -10552,7 +10552,7 @@ begin
|
||||
end;
|
||||
|
||||
// init resource files
|
||||
if not Project1.Resources.Regenerate(Project1.MainFilename, True, False,'') then
|
||||
if not Project1.ProjResources.Regenerate(Project1.MainFilename, True, False,'') then
|
||||
DebugLn('TMainIDE.DoNewProject Project1.Resources.Regenerate failed');
|
||||
finally
|
||||
Project1.EndUpdate;
|
||||
@ -11319,7 +11319,7 @@ begin
|
||||
Result:=DoSaveAll([sfCheckAmbiguousFiles])
|
||||
else
|
||||
Result:=DoSaveProjectToTestDirectory([sfSaveNonProjectFiles]);
|
||||
Project1.Resources.DoBeforeBuild(AReason, Project1.IsVirtual);
|
||||
Project1.ProjResources.DoBeforeBuild(AReason, Project1.IsVirtual);
|
||||
Project1.UpdateExecutableType;
|
||||
if Result<>mrOk then begin
|
||||
{$IFDEF VerboseSaveForBuild}
|
||||
@ -11599,7 +11599,7 @@ begin
|
||||
Result:=DoSaveForBuild(AReason);
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
if (Project1.Resources.ResourceType=rtRes) then begin
|
||||
if (Project1.ProjResources.ResourceType=rtRes) then begin
|
||||
// FPC resources are only supported with FPC 2.4+
|
||||
CodeToolBoss.GetFPCVersionForDirectory(
|
||||
ExtractFilePath(Project1.MainFilename),FPCVersion,FPCRelease,FPCPatch);
|
||||
@ -11730,7 +11730,7 @@ begin
|
||||
if not (Result in [mrOk,mrIgnore]) then exit;
|
||||
end;
|
||||
|
||||
if not Project1.Resources.Regenerate(Project1.MainFilename, False, True, TargetExeDirectory) then
|
||||
if not Project1.ProjResources.Regenerate(Project1.MainFilename, False, True, TargetExeDirectory) then
|
||||
Exit;
|
||||
|
||||
// execute compilation tool 'Before'
|
||||
@ -11809,7 +11809,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
Project1.Resources.DoAfterBuild(AReason, Project1.IsVirtual);
|
||||
Project1.ProjResources.DoAfterBuild(AReason, Project1.IsVirtual);
|
||||
// add success message
|
||||
MessagesView.AddMsg(Format(lisProjectSuccessfullyBuilt, ['"',
|
||||
Project1.ShortDescription, '"']),'',-1);
|
||||
|
||||
@ -647,7 +647,7 @@ end;
|
||||
|
||||
function TFileDescPascalUnitWithProjectResource.GetResourceType: TResourceType;
|
||||
begin
|
||||
Result := Project1.Resources.ResourceType;
|
||||
Result := Project1.ProjResources.ResourceType;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
@ -784,7 +784,6 @@ type
|
||||
fProjectInfoFileBufChangeStamp: integer;
|
||||
fProjectInfoFileDate: LongInt;
|
||||
FPublishOptions: TPublishProjectOptions;
|
||||
FResources: TProjectResources;
|
||||
FRevertLockCount: integer;
|
||||
FRunParameterOptions: TRunParamsOptions;
|
||||
FSessionModifiedBackup: boolean;
|
||||
@ -804,6 +803,7 @@ type
|
||||
function GetFirstUnitWithEditorIndex: TUnitInfo;
|
||||
function GetMainFilename: String;
|
||||
function GetMainUnitInfo: TUnitInfo;
|
||||
function GetProjResources: TProjectResources;
|
||||
function GetTargetFilename: string;
|
||||
function GetUnits(Index: integer): TUnitInfo;
|
||||
function JumpHistoryCheckPosition(
|
||||
@ -1088,7 +1088,7 @@ type
|
||||
read GetProjectInfoFile write SetProjectInfoFile;
|
||||
property PublishOptions: TPublishProjectOptions
|
||||
read FPublishOptions write FPublishOptions;
|
||||
property Resources: TProjectResources read FResources;
|
||||
property ProjResources: TProjectResources read GetProjResources;
|
||||
|
||||
property RunParameterOptions: TRunParamsOptions read FRunParameterOptions;
|
||||
property SourceDirectories: TFileReferenceList read FSourceDirectories;
|
||||
@ -2575,7 +2575,7 @@ begin
|
||||
FUnitList := TFPList.Create; // list of TUnitInfo
|
||||
|
||||
FResources := TProjectResources.Create(Self);
|
||||
FResources.OnModified := @EmbeddedObjectModified;
|
||||
ProjResources.OnModified := @EmbeddedObjectModified;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -2864,7 +2864,7 @@ begin
|
||||
'');
|
||||
|
||||
// Resources
|
||||
Resources.WriteToProjectFile(xmlconfig, Path);
|
||||
ProjResources.WriteToProjectFile(xmlconfig, Path);
|
||||
|
||||
// save custom data
|
||||
SaveStringToStringTree(xmlconfig,CustomData,Path+'CustomData/');
|
||||
@ -3410,7 +3410,7 @@ begin
|
||||
LoadBuildModes(XMLConfig,Path,true);
|
||||
|
||||
// Resources
|
||||
Resources.ReadFromProjectFile(xmlconfig, Path);
|
||||
ProjResources.ReadFromProjectFile(xmlconfig, Path);
|
||||
|
||||
// load custom data
|
||||
LoadStringToStringTree(xmlconfig,CustomData,Path+'CustomData/');
|
||||
@ -3834,7 +3834,7 @@ begin
|
||||
if not AValue then
|
||||
begin
|
||||
PublishOptions.Modified := False;
|
||||
Resources.Modified := False;
|
||||
ProjResources.Modified := False;
|
||||
BuildModes.Modified:=false;
|
||||
SessionModified := False;
|
||||
end;
|
||||
@ -4236,7 +4236,7 @@ end;
|
||||
|
||||
procedure TProject.EmbeddedObjectModified(Sender: TObject);
|
||||
begin
|
||||
if Resources.Modified then
|
||||
if ProjResources.Modified then
|
||||
Modified := True;
|
||||
end;
|
||||
|
||||
@ -4268,6 +4268,11 @@ begin
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
function TProject.GetProjResources: TProjectResources;
|
||||
begin
|
||||
Result:=TProjectResources(Resources);
|
||||
end;
|
||||
|
||||
function TProject.GetProjectInfoFile:string;
|
||||
begin
|
||||
Result:=fProjectInfoFile;
|
||||
@ -5137,7 +5142,7 @@ begin
|
||||
if MainUnitInfo = AnUnitInfo then
|
||||
begin
|
||||
// we are renaming a project => update resource directives
|
||||
Resources.RenameDirectives(OldUnitName, NewUnitName);
|
||||
ProjResources.RenameDirectives(OldUnitName, NewUnitName);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -39,7 +39,8 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, Laz_XMLCfg,
|
||||
Controls, Forms, SynRegExpr, FileProcs, LCLProc,
|
||||
CompOptsIntf, ProjectIntf, PublishModule, LazIDEIntf,
|
||||
CompOptsIntf, ProjectIntf, PublishModule, LazIDEIntf, W32Manifest,
|
||||
ProjectResourcesIntf,
|
||||
frmCustomApplicationOptions, IDEProcs, LazarusIDEStrConsts;
|
||||
|
||||
type
|
||||
@ -1276,6 +1277,7 @@ begin
|
||||
AProject.AddFile(MainFile,false);
|
||||
AProject.MainFileID:=0;
|
||||
AProject.UseAppBundle:=true;
|
||||
TProjectXPManifest(TAbstractProjectResources(AProject.Resources)[TProjectXPManifest]).UseManifest:=true;
|
||||
|
||||
// create program source
|
||||
le:=LineEnding;
|
||||
@ -1339,6 +1341,7 @@ begin
|
||||
AProject.AddFile(MainFile,false);
|
||||
AProject.MainFileID:=0;
|
||||
AProject.UseAppBundle:=true;
|
||||
TProjectXPManifest(TAbstractProjectResources(AProject.Resources)[TProjectXPManifest]).UseManifest:=true;
|
||||
|
||||
// create program source
|
||||
le:=LineEnding;
|
||||
|
||||
@ -106,7 +106,7 @@ end;
|
||||
constructor TProjectXPManifest.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
UseManifest := True;
|
||||
UseManifest := False;
|
||||
DpiAware := False;
|
||||
end;
|
||||
|
||||
|
||||
@ -354,6 +354,7 @@ type
|
||||
protected
|
||||
FLazCompilerOptions: TLazCompilerOptions;
|
||||
FFlags: TProjectFlags;
|
||||
FResources: TObject;
|
||||
function GetMainFile: TLazProjectFile; virtual; abstract;
|
||||
function GetMainFileID: Integer; virtual; abstract;
|
||||
procedure SetMainFileID(const AValue: Integer); virtual; abstract;
|
||||
@ -418,6 +419,7 @@ type
|
||||
property CustomData: TStringToStringTree read FCustomData;
|
||||
property CustomSessionData: TStringToStringTree read FCustomSessionData;
|
||||
property UseAppBundle: Boolean read FUseAppBundle write FUseAppBundle;
|
||||
property Resources: TObject read FResources; // TAbstractProjectResources
|
||||
end;
|
||||
|
||||
TLazProjectClass = class of TLazProject;
|
||||
|
||||
@ -68,7 +68,7 @@ type
|
||||
property Resource[AIndex: TAbstractProjectResourceClass]: TAbstractProjectResource read GetProjectResource; default;
|
||||
end;
|
||||
|
||||
procedure RegisterProjectResource(AResource: TAbstractProjectResourceClass);
|
||||
procedure RegisterProjectResource(AResource: TAbstractProjectResourceClass);
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user