IDE: Replace TProjectReadFlags with a boolean LoadParts.

git-svn-id: trunk@45757 -
This commit is contained in:
juha 2014-07-03 11:50:41 +00:00
parent 2cd802037c
commit 4486bfc9ed
3 changed files with 14 additions and 24 deletions

View File

@ -473,7 +473,7 @@ begin
if not FileExistsUTF8(AFilename) then if not FileExistsUTF8(AFilename) then
CopySecondaryConfigFile(DefaultProjectOptionsFilename); CopySecondaryConfigFile(DefaultProjectOptionsFilename);
if FileExistsUTF8(AFilename) then begin if FileExistsUTF8(AFilename) then begin
if AProject.ReadProject(AFilename,nil,[prfLoadParts,prfLoadPartBuildModes])<>mrOk then if AProject.ReadProject(AFilename,nil,True)<>mrOk then
DebugLn(['TMainIDEBase.DoLoadDefaultCompilerOptions failed']); DebugLn(['TMainIDEBase.DoLoadDefaultCompilerOptions failed']);
end else begin end else begin
// old way (<0.9.31) // old way (<0.9.31)

View File

@ -807,7 +807,7 @@ type
FUseAsDefault: Boolean; FUseAsDefault: Boolean;
// Variables used by ReadProject / WriteProject // Variables used by ReadProject / WriteProject
FXMLConfig: TXMLConfig; FXMLConfig: TXMLConfig;
FReadFlags: TProjectReadFlags; FLoadParts: Boolean;
FFileVersion: Integer; FFileVersion: Integer;
FNewMainUnitID: LongInt; FNewMainUnitID: LongInt;
FProjectWriteFlags: TProjectWriteFlags; FProjectWriteFlags: TProjectWriteFlags;
@ -929,7 +929,7 @@ type
procedure IgnoreProjectInfoFileOnDisk; procedure IgnoreProjectInfoFileOnDisk;
function ReadProject(const NewProjectInfoFile: string; function ReadProject(const NewProjectInfoFile: string;
GlobalMatrixOptions: TBuildMatrixOptions; GlobalMatrixOptions: TBuildMatrixOptions;
ReadFlags: TProjectReadFlags = []): TModalResult; LoadParts: Boolean = False): TModalResult;
function WriteProject(ProjectWriteFlags: TProjectWriteFlags; function WriteProject(ProjectWriteFlags: TProjectWriteFlags;
const OverrideProjectInfoFile: string; const OverrideProjectInfoFile: string;
GlobalMatrixOptions: TBuildMatrixOptions): TModalResult; GlobalMatrixOptions: TBuildMatrixOptions): TModalResult;
@ -2829,7 +2829,7 @@ begin
{$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(Path+'Version/Value',0); FFileVersion:= FXMLConfig.GetValue(Path+'Version/Value',0);
if not (prfLoadParts in FReadFlags) then if not FLoadParts then
begin begin
if (FFileVersion=0) and (FXMLConfig.GetValue(Path+'Units/Count',0)=0) then if (FFileVersion=0) and (FXMLConfig.GetValue(Path+'Units/Count',0)=0) then
if IDEMessageDialog(lisStrangeLpiFile, if IDEMessageDialog(lisStrangeLpiFile,
@ -2872,15 +2872,12 @@ begin
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject E reading comp sets');{$ENDIF} {$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject E reading comp sets');{$ENDIF}
end; end;
// load MacroValues and compiler options // load MacroValues and compiler options
if FReadFlags <> [prfLoadParts] then begin // Test for: prfLoadParts, no prfLoadPartBuildModes ClearBuildModes;
if prfLoadParts in FReadFlags then BuildModes.LoadProjOptsFromXMLConfig(FXMLConfig, Path);
ClearBuildModes; // load matrix options
BuildModes.LoadProjOptsFromXMLConfig(FXMLConfig, Path); BuildModes.SharedMatrixOptions.LoadFromXMLConfig(FXMLConfig, Path+'BuildModes/SharedMatrixOptions/');
// load matrix options
BuildModes.SharedMatrixOptions.LoadFromXMLConfig(FXMLConfig, Path+'BuildModes/SharedMatrixOptions/');
end;
// Resources // Resources
if not (prfLoadParts in FReadFlags) then if not FLoadParts then
begin begin
ProjResources.ReadFromProjectFile(FXMLConfig, Path); ProjResources.ReadFromProjectFile(FXMLConfig, Path);
// load custom data // load custom data
@ -2919,7 +2916,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, prfLoadParts in FReadFlags); BuildModes.LoadSessionFromXMLConfig(FXMLConfig, Path, FLoadParts);
// load custom defines // load custom defines
LoadCustomDefines(Path); LoadCustomDefines(Path);
@ -2936,7 +2933,7 @@ var
PIFile: String; PIFile: String;
begin begin
Result:=mrOk; Result:=mrOk;
if prfLoadParts in FReadFlags then begin if FLoadParts then begin
// read only parts of the lpi, keep other values // read only parts of the lpi, keep other values
try try
FXMLConfig := TCodeBufXMLConfig.CreateWithCache(Filename,true) FXMLConfig := TCodeBufXMLConfig.CreateWithCache(Filename,true)
@ -2977,7 +2974,6 @@ begin
exit; exit;
end; end;
end; end;
fLastReadLPIFilename:=PIFile; fLastReadLPIFilename:=PIFile;
fLastReadLPIFileDate:=Now; fLastReadLPIFileDate:=Now;
FNewMainUnitID:=-1; FNewMainUnitID:=-1;
@ -3029,13 +3025,13 @@ end;
// Method ReadProject itself // Method ReadProject itself
function TProject.ReadProject(const NewProjectInfoFile: string; function TProject.ReadProject(const NewProjectInfoFile: string;
GlobalMatrixOptions: TBuildMatrixOptions; ReadFlags: TProjectReadFlags): TModalResult; GlobalMatrixOptions: TBuildMatrixOptions; LoadParts: Boolean): TModalResult;
begin begin
Result := mrCancel; Result := mrCancel;
BeginUpdate(true); BeginUpdate(true);
try try
BuildModes.FGlobalMatrixOptions := GlobalMatrixOptions; BuildModes.FGlobalMatrixOptions := GlobalMatrixOptions;
FReadFlags := ReadFlags; FLoadParts := LoadParts;
// load project lpi file // load project lpi file
Result:=DoLoadLPI(NewProjectInfoFile); Result:=DoLoadLPI(NewProjectInfoFile);
@ -3044,7 +3040,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 (prfLoadParts in ReadFlags) then and not FLoadParts then
begin begin
Result:=DoLoadSession(ProjectSessionFile); Result:=DoLoadSession(ProjectSessionFile);
if Result<>mrOK then Exit; if Result<>mrOK then Exit;

View File

@ -46,12 +46,6 @@ uses
type type
TOnLoadSaveFilename = procedure(var Filename:string; Load:boolean) of object; TOnLoadSaveFilename = procedure(var Filename:string; Load:boolean) of object;
TProjectReadFlag = (
prfLoadParts,
prfLoadPartBuildModes
);
TProjectReadFlags = set of TProjectReadFlag;
TProjectWriteFlag = ( TProjectWriteFlag = (
pwfSkipClosedUnits, // skip history data pwfSkipClosedUnits, // skip history data
pwfSaveOnlyProjectUnits, pwfSaveOnlyProjectUnits,