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