mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-04 21:39:35 +01:00
IDE: Save Application Bundle and resource XPManifest to default project configuration. Issue #22286.
git-svn-id: trunk@51059 -
This commit is contained in:
parent
c224456e7f
commit
42e68fd86d
@ -18,10 +18,13 @@ type
|
|||||||
|
|
||||||
{ TAbstractProjectResource }
|
{ TAbstractProjectResource }
|
||||||
TAbstractProjectResource = class
|
TAbstractProjectResource = class
|
||||||
protected
|
private
|
||||||
FModified: boolean;
|
FModified: boolean;
|
||||||
FOnModified: TNotifyEvent;
|
FOnModified: TNotifyEvent;
|
||||||
procedure SetModified(const AValue: boolean);
|
procedure SetModified(const AValue: boolean);
|
||||||
|
protected
|
||||||
|
// This resource is used when reading project default options.
|
||||||
|
FIsDefaultOption: Boolean;
|
||||||
public
|
public
|
||||||
constructor Create; virtual;
|
constructor Create; virtual;
|
||||||
|
|
||||||
@ -33,6 +36,7 @@ type
|
|||||||
|
|
||||||
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;
|
||||||
|
property IsDefaultOption: Boolean read FIsDefaultOption;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TAbstractProjectResourceClass = class of TAbstractProjectResource;
|
TAbstractProjectResourceClass = class of TAbstractProjectResource;
|
||||||
|
|||||||
@ -255,10 +255,13 @@ begin
|
|||||||
begin
|
begin
|
||||||
TitleEdit.Text := Title;
|
TitleEdit.Text := Title;
|
||||||
UseAppBundleCheckBox.Checked := UseAppBundle;
|
UseAppBundleCheckBox.Checked := UseAppBundle;
|
||||||
UseXPManifestCheckBox.Checked := TProjectXPManifest(ProjResources[TProjectXPManifest]).UseManifest;
|
with ProjResources.XPManifest do
|
||||||
DpiAwareCheckBox.Checked := TProjectXPManifest(ProjResources[TProjectXPManifest]).DpiAware;
|
begin
|
||||||
ExecutionLevelComboBox.ItemIndex := Ord(TProjectXPManifest(ProjResources[TProjectXPManifest]).ExecutionLevel);
|
UseXPManifestCheckBox.Checked := UseManifest;
|
||||||
UIAccessCheckBox.Checked := TProjectXPManifest(ProjResources[TProjectXPManifest]).UIAccess;
|
DpiAwareCheckBox.Checked := DpiAware;
|
||||||
|
ExecutionLevelComboBox.ItemIndex := Ord(ExecutionLevel);
|
||||||
|
UIAccessCheckBox.Checked := UIAccess;
|
||||||
|
end;
|
||||||
DpiAwareCheckBox.Enabled := UseXPManifestCheckBox.Checked;
|
DpiAwareCheckBox.Enabled := UseXPManifestCheckBox.Checked;
|
||||||
ExecutionLevelLabel.Enabled := UseXPManifestCheckBox.Checked;
|
ExecutionLevelLabel.Enabled := UseXPManifestCheckBox.Checked;
|
||||||
ExecutionLevelComboBox.Enabled := UseXPManifestCheckBox.Checked;
|
ExecutionLevelComboBox.Enabled := UseXPManifestCheckBox.Checked;
|
||||||
|
|||||||
@ -817,19 +817,9 @@ begin
|
|||||||
AFilename:=AppendPathDelim(GetPrimaryConfigPath)+DefaultProjectOptionsFilename;
|
AFilename:=AppendPathDelim(GetPrimaryConfigPath)+DefaultProjectOptionsFilename;
|
||||||
if not FileExistsUTF8(AFilename) then
|
if not FileExistsUTF8(AFilename) then
|
||||||
CopySecondaryConfigFile(DefaultProjectOptionsFilename);
|
CopySecondaryConfigFile(DefaultProjectOptionsFilename);
|
||||||
if FileExistsUTF8(AFilename) then begin
|
if FileExistsUTF8(AFilename) then
|
||||||
if AProject.ReadProject(AFilename,nil,True)<>mrOk then
|
if AProject.ReadProject(AFilename,nil,False)<>mrOk then
|
||||||
DebugLn(['TMainIDEBase.DoLoadDefaultCompilerOptions failed']);
|
DebugLn(['TMainIDEBase.DoLoadDefaultCompilerOptions failed']);
|
||||||
end else begin
|
|
||||||
// old way (<0.9.31)
|
|
||||||
// load default compiler options if exists
|
|
||||||
AFilename:=AppendPathDelim(GetPrimaryConfigPath)+DefaultProjectCompilerOptionsFilename;
|
|
||||||
if not FileExistsUTF8(AFilename) then
|
|
||||||
CopySecondaryConfigFile(DefaultProjectCompilerOptionsFilename);
|
|
||||||
if not FileExistsUTF8(AFilename) then exit;
|
|
||||||
if AProject.CompilerOptions.LoadFromFile(AFilename)<>mrOk then
|
|
||||||
DebugLn(['TMainIDEBase.DoLoadDefaultCompilerOptions failed']);
|
|
||||||
end;
|
|
||||||
|
|
||||||
// change target file name
|
// change target file name
|
||||||
AFilename:=ExtractFileName(AProject.CompilerOptions.TargetFilename);
|
AFilename:=ExtractFileName(AProject.CompilerOptions.TargetFilename);
|
||||||
|
|||||||
@ -653,7 +653,7 @@ type
|
|||||||
// load, save
|
// load, save
|
||||||
procedure LoadProjOptsFromXMLConfig(XMLConfig: TXMLConfig; const Path: string);
|
procedure LoadProjOptsFromXMLConfig(XMLConfig: TXMLConfig; const Path: string);
|
||||||
procedure LoadSessionFromXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
procedure LoadSessionFromXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
||||||
LoadParts: boolean);
|
LoadAllOptions: boolean);
|
||||||
procedure SaveProjOptsToXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
procedure SaveProjOptsToXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
||||||
SaveSession: boolean);
|
SaveSession: boolean);
|
||||||
procedure SaveSessionOptsToXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
procedure SaveSessionOptsToXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
||||||
@ -759,7 +759,7 @@ type
|
|||||||
FUseAsDefault: Boolean;
|
FUseAsDefault: Boolean;
|
||||||
// Variables used by ReadProject / WriteProject
|
// Variables used by ReadProject / WriteProject
|
||||||
FXMLConfig: TXMLConfig;
|
FXMLConfig: TXMLConfig;
|
||||||
FLoadParts: Boolean;
|
FLoadAllOptions: Boolean; // All options / just options used as default for new projects
|
||||||
FFileVersion: Integer;
|
FFileVersion: Integer;
|
||||||
FNewMainUnitID: LongInt;
|
FNewMainUnitID: LongInt;
|
||||||
FProjectWriteFlags: TProjectWriteFlags;
|
FProjectWriteFlags: TProjectWriteFlags;
|
||||||
@ -884,10 +884,10 @@ type
|
|||||||
procedure IgnoreProjectInfoFileOnDisk;
|
procedure IgnoreProjectInfoFileOnDisk;
|
||||||
function ReadProject(const NewProjectInfoFile: string;
|
function ReadProject(const NewProjectInfoFile: string;
|
||||||
GlobalMatrixOptions: TBuildMatrixOptions;
|
GlobalMatrixOptions: TBuildMatrixOptions;
|
||||||
LoadParts: Boolean = False): TModalResult;
|
LoadAllOptions: Boolean): TModalResult;
|
||||||
function WriteProject(ProjectWriteFlags: TProjectWriteFlags;
|
function WriteProject(ProjectWriteFlags: TProjectWriteFlags;
|
||||||
const OverrideProjectInfoFile: string;
|
const OverrideProjectInfoFile: string;
|
||||||
GlobalMatrixOptions: TBuildMatrixOptions): TModalResult;
|
GlobalMatrixOptions: TBuildMatrixOptions): TModalResult;
|
||||||
procedure UpdateExecutableType; override;
|
procedure UpdateExecutableType; override;
|
||||||
procedure BackupSession;
|
procedure BackupSession;
|
||||||
procedure RestoreSession;
|
procedure RestoreSession;
|
||||||
@ -2847,7 +2847,6 @@ begin
|
|||||||
// automatically fixes broken lpi files.
|
// automatically fixes broken lpi files.
|
||||||
FNewMainUnitID := FXMLConfig.GetValue(Path+'General/MainUnit/Value', 0);
|
FNewMainUnitID := FXMLConfig.GetValue(Path+'General/MainUnit/Value', 0);
|
||||||
Title := FXMLConfig.GetValue(Path+'General/Title/Value', '');
|
Title := FXMLConfig.GetValue(Path+'General/Title/Value', '');
|
||||||
UseAppBundle := FXMLConfig.GetValue(Path+'General/UseAppBundle/Value', True);
|
|
||||||
AutoCreateForms := FXMLConfig.GetValue(Path+'General/AutoCreateForms/Value', true);
|
AutoCreateForms := FXMLConfig.GetValue(Path+'General/AutoCreateForms/Value', true);
|
||||||
|
|
||||||
// fpdoc
|
// fpdoc
|
||||||
@ -2867,9 +2866,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject E reading comp sets');{$ENDIF}
|
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject E reading comp sets');{$ENDIF}
|
||||||
|
|
||||||
// Resources
|
|
||||||
ProjResources.ReadFromProjectFile(FXMLConfig, Path);
|
|
||||||
|
|
||||||
// load custom data
|
// load custom data
|
||||||
LoadStringToStringTree(FXMLConfig,CustomData,Path+'CustomData/');
|
LoadStringToStringTree(FXMLConfig,CustomData,Path+'CustomData/');
|
||||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject update ct boss');{$ENDIF}
|
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject update ct boss');{$ENDIF}
|
||||||
@ -2905,7 +2901,7 @@ begin
|
|||||||
FFileVersion:=FXMLConfig.GetValue(Path+'Version/Value',0);
|
FFileVersion:=FXMLConfig.GetValue(Path+'Version/Value',0);
|
||||||
|
|
||||||
// load MacroValues and compiler options
|
// load MacroValues and compiler options
|
||||||
BuildModes.LoadSessionFromXMLConfig(FXMLConfig, Path, FLoadParts);
|
BuildModes.LoadSessionFromXMLConfig(FXMLConfig, Path, FLoadAllOptions);
|
||||||
|
|
||||||
// load defines used for custom options
|
// load defines used for custom options
|
||||||
LoadOtherDefines(Path);
|
LoadOtherDefines(Path);
|
||||||
@ -2922,21 +2918,8 @@ var
|
|||||||
PIFile: String;
|
PIFile: String;
|
||||||
begin
|
begin
|
||||||
Result:=mrOk;
|
Result:=mrOk;
|
||||||
if FLoadParts then begin
|
if FLoadAllOptions then
|
||||||
// read only parts of the lpi, keep other values
|
begin
|
||||||
try
|
|
||||||
FXMLConfig := TCodeBufXMLConfig.CreateWithCache(Filename,true)
|
|
||||||
except
|
|
||||||
on E: Exception do begin
|
|
||||||
IDEMessageDialog(lisUnableToReadLpi,
|
|
||||||
Format(lisUnableToReadTheProjectInfoFile,[LineEnding,Filename])+LineEnding+E.Message,
|
|
||||||
mtError, [mbOk]);
|
|
||||||
Result:=mrCancel;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end
|
|
||||||
else begin
|
|
||||||
// read the whole lpi, clear any old values
|
// read the whole lpi, clear any old values
|
||||||
Clear;
|
Clear;
|
||||||
ProjectInfoFile:=Filename;
|
ProjectInfoFile:=Filename;
|
||||||
@ -2966,6 +2949,20 @@ begin
|
|||||||
fLastReadLPIFilename:=PIFile;
|
fLastReadLPIFilename:=PIFile;
|
||||||
fLastReadLPIFileDate:=Now;
|
fLastReadLPIFileDate:=Now;
|
||||||
FNewMainUnitID:=-1;
|
FNewMainUnitID:=-1;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
// read only parts of the lpi, keep other values
|
||||||
|
try
|
||||||
|
FXMLConfig := TCodeBufXMLConfig.CreateWithCache(Filename,true)
|
||||||
|
except
|
||||||
|
on E: Exception do begin
|
||||||
|
IDEMessageDialog(lisUnableToReadLpi,
|
||||||
|
Format(lisUnableToReadTheProjectInfoFile,[LineEnding,Filename])+LineEnding+E.Message,
|
||||||
|
mtError, [mbOk]);
|
||||||
|
Result:=mrCancel;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -2975,8 +2972,11 @@ begin
|
|||||||
fCurStorePathDelim:=StorePathDelim;
|
fCurStorePathDelim:=StorePathDelim;
|
||||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject C reading values');{$ENDIF}
|
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject C reading values');{$ENDIF}
|
||||||
FFileVersion:= FXMLConfig.GetValue(ProjOptionsPath+'Version/Value',0);
|
FFileVersion:= FXMLConfig.GetValue(ProjOptionsPath+'Version/Value',0);
|
||||||
if not FLoadParts then
|
UseAppBundle := FXMLConfig.GetValue(ProjOptionsPath+'General/UseAppBundle/Value', True);
|
||||||
|
if FLoadAllOptions then
|
||||||
LoadFromLPI;
|
LoadFromLPI;
|
||||||
|
// Resources
|
||||||
|
ProjResources.ReadFromProjectFile(FXMLConfig, ProjOptionsPath, FLoadAllOptions);
|
||||||
// load MacroValues and compiler options
|
// load MacroValues and compiler options
|
||||||
ClearBuildModes;
|
ClearBuildModes;
|
||||||
BuildModes.LoadProjOptsFromXMLConfig(FXMLConfig, ProjOptionsPath);
|
BuildModes.LoadProjOptsFromXMLConfig(FXMLConfig, ProjOptionsPath);
|
||||||
@ -3027,13 +3027,13 @@ end;
|
|||||||
|
|
||||||
// Method ReadProject itself
|
// Method ReadProject itself
|
||||||
function TProject.ReadProject(const NewProjectInfoFile: string;
|
function TProject.ReadProject(const NewProjectInfoFile: string;
|
||||||
GlobalMatrixOptions: TBuildMatrixOptions; LoadParts: Boolean): TModalResult;
|
GlobalMatrixOptions: TBuildMatrixOptions; LoadAllOptions: Boolean): TModalResult;
|
||||||
begin
|
begin
|
||||||
Result := mrCancel;
|
Result := mrCancel;
|
||||||
BeginUpdate(true);
|
BeginUpdate(true);
|
||||||
try
|
try
|
||||||
BuildModes.FGlobalMatrixOptions := GlobalMatrixOptions;
|
BuildModes.FGlobalMatrixOptions := GlobalMatrixOptions;
|
||||||
FLoadParts := LoadParts;
|
FLoadAllOptions := LoadAllOptions;
|
||||||
|
|
||||||
// load project lpi file
|
// load project lpi file
|
||||||
Result:=DoLoadLPI(NewProjectInfoFile);
|
Result:=DoLoadLPI(NewProjectInfoFile);
|
||||||
@ -3042,7 +3042,7 @@ begin
|
|||||||
// load session file (if available)
|
// load session file (if available)
|
||||||
if (SessionStorage in pssHasSeparateSession)
|
if (SessionStorage in pssHasSeparateSession)
|
||||||
and (CompareFilenames(ProjectInfoFile,ProjectSessionFile)<>0)
|
and (CompareFilenames(ProjectInfoFile,ProjectSessionFile)<>0)
|
||||||
and not FLoadParts then
|
and FLoadAllOptions then
|
||||||
begin
|
begin
|
||||||
Result:=DoLoadSession(ProjectSessionFile);
|
Result:=DoLoadSession(ProjectSessionFile);
|
||||||
if Result<>mrOK then Exit;
|
if Result<>mrOK then Exit;
|
||||||
@ -3189,7 +3189,8 @@ begin
|
|||||||
// save lpi to disk
|
// save lpi to disk
|
||||||
//debugln(['TProject.WriteProject ',DbgSName(FXMLConfig),' FCfgFilename=',FCfgFilename]);
|
//debugln(['TProject.WriteProject ',DbgSName(FXMLConfig),' FCfgFilename=',FCfgFilename]);
|
||||||
FXMLConfig.Flush;
|
FXMLConfig.Flush;
|
||||||
Modified:=false;
|
if not (pwfIgnoreModified in FProjectWriteFlags) then
|
||||||
|
Modified:=false;
|
||||||
if FSaveSessionInLPI then
|
if FSaveSessionInLPI then
|
||||||
SessionModified:=false;
|
SessionModified:=false;
|
||||||
end;
|
end;
|
||||||
@ -3304,8 +3305,12 @@ begin
|
|||||||
FSaveSessionInLPI:=(SessFilename='') or (CompareFilenames(SessFilename,CfgFilename)=0);
|
FSaveSessionInLPI:=(SessFilename='') or (CompareFilenames(SessFilename,CfgFilename)=0);
|
||||||
|
|
||||||
// check if modified
|
// check if modified
|
||||||
if not (pwfIgnoreModified in ProjectWriteFlags) then
|
if pwfIgnoreModified in ProjectWriteFlags then
|
||||||
begin
|
begin
|
||||||
|
WriteLPI:=true;
|
||||||
|
WriteLPS:=true;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
WriteLPI:=SomeDataModified or (not FileExistsUTF8(CfgFilename));
|
WriteLPI:=SomeDataModified or (not FileExistsUTF8(CfgFilename));
|
||||||
if (CompareFilenames(ProjectInfoFile,CfgFilename)=0) then
|
if (CompareFilenames(ProjectInfoFile,CfgFilename)=0) then
|
||||||
// save to default lpi
|
// save to default lpi
|
||||||
@ -3319,10 +3324,7 @@ begin
|
|||||||
end else begin
|
end else begin
|
||||||
WriteLPS:=WriteLPI or SomeSessionModified or (not FileExistsUTF8(SessFilename));
|
WriteLPS:=WriteLPI or SomeSessionModified or (not FileExistsUTF8(SessFilename));
|
||||||
end;
|
end;
|
||||||
if (not WriteLPI) and (not WriteLPS) then exit(mrOk);
|
if not (WriteLPI or WriteLPS) then exit(mrOk);
|
||||||
end else begin
|
|
||||||
WriteLPI:=true;
|
|
||||||
WriteLPS:=true;
|
|
||||||
end;
|
end;
|
||||||
//debugln(['TProject.WriteProject WriteLPI=',WriteLPI,' WriteLPS=',WriteLPS,' Modifed=',Modified,' SessionModified=',SessionModified]);
|
//debugln(['TProject.WriteProject WriteLPI=',WriteLPI,' WriteLPS=',WriteLPS,' Modifed=',Modified,' SessionModified=',SessionModified]);
|
||||||
|
|
||||||
@ -3777,12 +3779,12 @@ end;
|
|||||||
|
|
||||||
function TProject.GetUseManifest: boolean;
|
function TProject.GetUseManifest: boolean;
|
||||||
begin
|
begin
|
||||||
Result:=TProjectXPManifest(ProjResources[TProjectXPManifest]).UseManifest;
|
Result:=ProjResources.XPManifest.UseManifest;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TProject.SetUseManifest(AValue: boolean);
|
procedure TProject.SetUseManifest(AValue: boolean);
|
||||||
begin
|
begin
|
||||||
TProjectXPManifest(ProjResources[TProjectXPManifest]).UseManifest:=AValue;
|
ProjResources.XPManifest.UseManifest:=AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TProject.UnitCount:integer;
|
function TProject.UnitCount:integer;
|
||||||
@ -7089,14 +7091,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TProjectBuildModes.LoadSessionFromXMLConfig(XMLConfig: TXMLConfig;
|
procedure TProjectBuildModes.LoadSessionFromXMLConfig(XMLConfig: TXMLConfig;
|
||||||
const Path: string; LoadParts: boolean);
|
const Path: string; LoadAllOptions: boolean);
|
||||||
// Load for session
|
// Load for session
|
||||||
var
|
var
|
||||||
Cnt: Integer;
|
Cnt: Integer;
|
||||||
begin
|
begin
|
||||||
FXMLConfig := XMLConfig;
|
FXMLConfig := XMLConfig;
|
||||||
|
|
||||||
if not LoadParts then
|
if LoadAllOptions then
|
||||||
// load matrix options
|
// load matrix options
|
||||||
SessionMatrixOptions.LoadFromXMLConfig(FXMLConfig, Path+'BuildModes/SessionMatrixOptions/');
|
SessionMatrixOptions.LoadFromXMLConfig(FXMLConfig, Path+'BuildModes/SessionMatrixOptions/');
|
||||||
|
|
||||||
@ -7107,7 +7109,7 @@ begin
|
|||||||
LoadAllMacroValues(Path+'MacroValues/', Cnt);
|
LoadAllMacroValues(Path+'MacroValues/', Cnt);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if not LoadParts then
|
if LoadAllOptions then
|
||||||
// load what matrix options are enabled in session build modes
|
// load what matrix options are enabled in session build modes
|
||||||
LoadSessionEnabledNonSessionMatrixOptions(Path+'BuildModes/SessionEnabledMatrixOptions/');
|
LoadSessionEnabledNonSessionMatrixOptions(Path+'BuildModes/SessionEnabledMatrixOptions/');
|
||||||
|
|
||||||
|
|||||||
@ -1260,8 +1260,7 @@ begin
|
|||||||
Result := GetLocalizedName + LineEnding+LineEnding + lisApplicationProgramDescriptor;
|
Result := GetLocalizedName + LineEnding+LineEnding + lisApplicationProgramDescriptor;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TProjectApplicationDescriptor.InitProject(
|
function TProjectApplicationDescriptor.InitProject(AProject: TLazProject): TModalResult;
|
||||||
AProject: TLazProject): TModalResult;
|
|
||||||
var
|
var
|
||||||
NewSource: String;
|
NewSource: String;
|
||||||
MainFile: TLazProjectFile;
|
MainFile: TLazProjectFile;
|
||||||
|
|||||||
@ -37,14 +37,22 @@ unit ProjectResources;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Contnrs, Controls, LCLProc, LResources, LazFileUtils,
|
// RTL + LCL
|
||||||
Dialogs, AvgLvlTree, Laz2_XMLCfg, resource, reswriter,
|
Classes, SysUtils, Contnrs, resource, reswriter, fgl,
|
||||||
|
Controls, LCLProc, LResources, Dialogs,
|
||||||
|
// LazUtils
|
||||||
|
LazFileUtils, AvgLvlTree, Laz2_XMLCfg,
|
||||||
|
// Codetools
|
||||||
KeywordFuncLists, BasicCodeTools, CodeToolManager, CodeCache,
|
KeywordFuncLists, BasicCodeTools, CodeToolManager, CodeCache,
|
||||||
|
// IdeIntf
|
||||||
ProjectIntf, ProjectResourcesIntf, CompOptsIntf,
|
ProjectIntf, ProjectResourcesIntf, CompOptsIntf,
|
||||||
|
// IDE
|
||||||
LazarusIDEStrConsts, IDEProcs, DialogProcs,
|
LazarusIDEStrConsts, IDEProcs, DialogProcs,
|
||||||
W32Manifest, W32VersionInfo, ProjectIcon, ProjectUserResources;
|
W32Manifest, W32VersionInfo, ProjectIcon, ProjectUserResources;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
TResourceList = specialize TFPGObjectList<TAbstractProjectResource>;
|
||||||
|
|
||||||
{ TProjectResources }
|
{ TProjectResources }
|
||||||
|
|
||||||
TProjectResources = class(TAbstractProjectResources)
|
TProjectResources = class(TAbstractProjectResources)
|
||||||
@ -54,7 +62,7 @@ type
|
|||||||
FInModified: Boolean;
|
FInModified: Boolean;
|
||||||
FLrsIncludeAllowed: Boolean;
|
FLrsIncludeAllowed: Boolean;
|
||||||
|
|
||||||
FResources: TObjectList;
|
FResources: TResourceList;
|
||||||
FSystemResources: TResources;
|
FSystemResources: TResources;
|
||||||
FLazarusResources: TStringList;
|
FLazarusResources: TStringList;
|
||||||
|
|
||||||
@ -100,7 +108,7 @@ type
|
|||||||
function HasLazarusResources: Boolean;
|
function HasLazarusResources: Boolean;
|
||||||
|
|
||||||
procedure WriteToProjectFile(AConfig: TXMLConfig; Path: String);
|
procedure WriteToProjectFile(AConfig: TXMLConfig; Path: String);
|
||||||
procedure ReadFromProjectFile(AConfig: TXMLConfig; Path: String);
|
procedure ReadFromProjectFile(AConfig: TXMLConfig; 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;
|
||||||
@ -377,7 +385,7 @@ begin
|
|||||||
if not FModified then
|
if not FModified then
|
||||||
begin
|
begin
|
||||||
for i := 0 to FResources.Count - 1 do
|
for i := 0 to FResources.Count - 1 do
|
||||||
TAbstractProjectResource(FResources[i]).Modified := False;
|
FResources[i].Modified := False;
|
||||||
end;
|
end;
|
||||||
if Assigned(FOnModified) then
|
if Assigned(FOnModified) then
|
||||||
OnModified(Self);
|
OnModified(Self);
|
||||||
@ -388,16 +396,14 @@ end;
|
|||||||
function TProjectResources.Update: Boolean;
|
function TProjectResources.Update: Boolean;
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
Res: TAbstractProjectResource;
|
|
||||||
begin
|
begin
|
||||||
Result:=true;
|
Result:=true;
|
||||||
Clear;
|
Clear;
|
||||||
for i := 0 to FResources.Count - 1 do
|
for i := 0 to FResources.Count - 1 do
|
||||||
begin
|
begin
|
||||||
Res:=TAbstractProjectResource(FResources[i]);
|
Result := FResources[i].UpdateResources(Self, resFileName);
|
||||||
Result := Res.UpdateResources(Self, resFileName);
|
|
||||||
if not Result then begin
|
if not Result then begin
|
||||||
debugln(['TProjectResources.Update UpdateResources of ',DbgSName(Res),' failed']);
|
debugln(['TProjectResources.Update UpdateResources of ',DbgSName(FResources[i]),' failed']);
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -423,7 +429,7 @@ begin
|
|||||||
FSystemResources := TResources.Create;
|
FSystemResources := TResources.Create;
|
||||||
FLazarusResources := TStringList.Create;
|
FLazarusResources := TStringList.Create;
|
||||||
|
|
||||||
FResources := TObjectList.Create;
|
FResources := TResourceList.Create;
|
||||||
L := GetRegisteredResources;
|
L := GetRegisteredResources;
|
||||||
for i := 0 to L.Count - 1 do
|
for i := 0 to L.Count - 1 do
|
||||||
begin
|
begin
|
||||||
@ -470,7 +476,7 @@ var
|
|||||||
begin
|
begin
|
||||||
for i := 0 to FResources.Count - 1 do
|
for i := 0 to FResources.Count - 1 do
|
||||||
begin
|
begin
|
||||||
Result := TAbstractProjectResource(FResources[i]);
|
Result := FResources[i];
|
||||||
if Result.InheritsFrom(AIndex) then
|
if Result.InheritsFrom(AIndex) then
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
@ -482,7 +488,7 @@ var
|
|||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
for i := 0 to FResources.Count - 1 do
|
for i := 0 to FResources.Count - 1 do
|
||||||
TAbstractProjectResource(FResources[i]).DoAfterBuild(Self, AReason, SaveToTestDir);
|
FResources[i].DoAfterBuild(Self, AReason, SaveToTestDir);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TProjectResources.DoBeforeBuild(AReason: TCompileReason; SaveToTestDir: boolean);
|
procedure TProjectResources.DoBeforeBuild(AReason: TCompileReason; SaveToTestDir: boolean);
|
||||||
@ -490,7 +496,7 @@ var
|
|||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
for i := 0 to FResources.Count - 1 do
|
for i := 0 to FResources.Count - 1 do
|
||||||
TAbstractProjectResource(FResources[i]).DoBeforeBuild(Self, AReason, SaveToTestDir);
|
FResources[i].DoBeforeBuild(Self, AReason, SaveToTestDir);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TProjectResources.Clear;
|
procedure TProjectResources.Clear;
|
||||||
@ -558,16 +564,17 @@ var
|
|||||||
begin
|
begin
|
||||||
AConfig.SetDeleteValue(Path+'General/ResourceType/Value', ResourceTypeNames[ResourceType], ResourceTypeNames[rtLRS]);
|
AConfig.SetDeleteValue(Path+'General/ResourceType/Value', ResourceTypeNames[ResourceType], ResourceTypeNames[rtLRS]);
|
||||||
for i := 0 to FResources.Count - 1 do
|
for i := 0 to FResources.Count - 1 do
|
||||||
TAbstractProjectResource(FResources[i]).WriteToProjectFile(AConfig, Path);
|
FResources[i].WriteToProjectFile(AConfig, Path);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TProjectResources.ReadFromProjectFile(AConfig: TXMLConfig; Path: String);
|
procedure TProjectResources.ReadFromProjectFile(AConfig: TXMLConfig; Path: String; ReadAll: Boolean);
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
ResourceType := StrToResourceType(AConfig.GetValue(Path+'General/ResourceType/Value', ResourceTypeNames[rtLRS]));
|
ResourceType := StrToResourceType(AConfig.GetValue(Path+'General/ResourceType/Value', ResourceTypeNames[rtLRS]));
|
||||||
for i := 0 to FResources.Count - 1 do
|
for i := 0 to FResources.Count - 1 do
|
||||||
TAbstractProjectResource(FResources[i]).ReadFromProjectFile(AConfig, Path);
|
if ReadAll or FResources[i].IsDefaultOption then
|
||||||
|
FResources[i].ReadFromProjectFile(AConfig, Path);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TProjectResources.UpdateMainSourceFile(const AFileName: string): Boolean;
|
function TProjectResources.UpdateMainSourceFile(const AFileName: string): Boolean;
|
||||||
|
|||||||
@ -3601,7 +3601,7 @@ begin
|
|||||||
|
|
||||||
// read project info file
|
// read project info file
|
||||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TLazSourceFileManager.InitOpenedProjectFile B3');{$ENDIF}
|
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TLazSourceFileManager.InitOpenedProjectFile B3');{$ENDIF}
|
||||||
Project1.ReadProject(AFilename,EnvironmentOptions.BuildMatrixOptions);
|
Project1.ReadProject(AFilename, EnvironmentOptions.BuildMatrixOptions, True);
|
||||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TLazSourceFileManager.InitOpenedProjectFile B4');{$ENDIF}
|
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TLazSourceFileManager.InitOpenedProjectFile B4');{$ENDIF}
|
||||||
Result:=CompleteLoadingProjectInfo;
|
Result:=CompleteLoadingProjectInfo;
|
||||||
finally
|
finally
|
||||||
@ -3626,7 +3626,7 @@ begin
|
|||||||
|
|
||||||
// restore files
|
// restore files
|
||||||
while EditorInfoIndex < Project1.AllEditorsInfoCount do begin
|
while EditorInfoIndex < Project1.AllEditorsInfoCount do begin
|
||||||
// TProject.ReadProject sorts alle UnitEditorInfos
|
// TProject.ReadProject sorts all UnitEditorInfos
|
||||||
AnEditorInfo := Project1.AllEditorsInfo[EditorInfoIndex];
|
AnEditorInfo := Project1.AllEditorsInfo[EditorInfoIndex];
|
||||||
AnUnitInfo := AnEditorInfo.UnitInfo;
|
AnUnitInfo := AnEditorInfo.UnitInfo;
|
||||||
if (not AnUnitInfo.Loaded) or (AnEditorInfo.PageIndex < 0) then begin
|
if (not AnUnitInfo.Loaded) or (AnEditorInfo.PageIndex < 0) then begin
|
||||||
|
|||||||
@ -152,6 +152,7 @@ end;
|
|||||||
constructor TProjectXPManifest.Create;
|
constructor TProjectXPManifest.Create;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
|
FIsDefaultOption := True;
|
||||||
UseManifest := False;
|
UseManifest := False;
|
||||||
DpiAware := False;
|
DpiAware := False;
|
||||||
ExecutionLevel := xmelAsInvoker;
|
ExecutionLevel := xmelAsInvoker;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user