IDE: replaced compiler options property Active with function IsActive

git-svn-id: trunk@27600 -
This commit is contained in:
mattias 2010-10-07 10:42:27 +00:00
parent 376cb466ca
commit f572c7f13c
4 changed files with 18 additions and 10 deletions

View File

@ -93,7 +93,6 @@
- disabled project compiler options, used only for storage
ToDo:
- replace property Active with function IsActive
- check if OwnerProject is still needed
- create Makefile:
- create a special .compiled file

View File

@ -509,6 +509,7 @@ type
public
constructor Create(const AOwner: TObject); override;
destructor Destroy; override;
function IsActive: boolean; override;
class function GetInstance: TAbstractIDEOptions; override;
class function GetGroupCaption: string; override;
procedure Clear; override;
@ -2457,7 +2458,6 @@ begin
FEditorInfoList := TUnitEditorInfoList.Create(nil);
FBookmarks := TProjectBookmarkList.Create;
CompilerOptions := TProjectCompilerOptions.Create(Self);
CompilerOptions.Active:=true;
CompilerOptions.ParsedOpts.InvalidateParseOnChange:=true;
FDefineTemplates:=TProjectDefineTemplates.Create(Self);
FFlags:=DefaultProjectFlags;
@ -5477,14 +5477,14 @@ end;
procedure TProjectCompilerOptions.SetTargetCPU(const AValue: string);
begin
inherited SetTargetCPU(AValue);
if Active then
if IsActive then
FGlobals.TargetCPU:=TargetCPU;
end;
procedure TProjectCompilerOptions.SetTargetOS(const AValue: string);
begin
inherited SetTargetOS(AValue);
if Active then
if IsActive then
FGlobals.TargetOS:=TargetOS;
end;
@ -5493,7 +5493,7 @@ begin
if CustomOptions=AValue then exit;
InvalidateOptions;
inherited SetCustomOptions(AValue);
if Active and (Project<>nil) then
if IsActive and (Project<>nil) then
Project.DefineTemplates.CustomDefinesChanged;
end;
@ -5544,7 +5544,7 @@ begin
if UnitOutputDirectory=AValue then exit;
InvalidateOptions;
inherited SetUnitOutputDir(AValue);
if Active and (Project<>nil) then
if IsActive and (Project<>nil) then
Project.DefineTemplates.OutputDirectoryChanged;
end;
@ -5606,7 +5606,7 @@ end;
procedure TProjectCompilerOptions.UpdateGlobals;
begin
if not Active then exit;
if not IsActive then exit;
FGlobals.TargetCPU:=TargetCPU;
FGlobals.TargetOS:=TargetOS;
end;
@ -5645,6 +5645,11 @@ begin
FreeAndNil(FGlobals);
end;
function TProjectCompilerOptions.IsActive: boolean;
begin
Result:=(OwnerProject<>nil) and (OwnerProject.CompilerOptions=Self);
end;
procedure TProjectCompilerOptions.Clear;
begin
inherited Clear;

View File

@ -121,7 +121,6 @@ type
TLazCompilerOptions = class(TAbstractIDEProjectOptions)
private
FActive: boolean;
FOnModified: TNotifyEvent;
fOwner: TObject;
protected
@ -236,8 +235,8 @@ type
procedure SetUnitPaths(const AValue: String); virtual; abstract;
public
constructor Create(const TheOwner: TObject); virtual;
function IsActive: boolean; virtual; abstract;
public
property Active: boolean read FActive write FActive;
property Owner: TObject read fOwner write fOwner;
property Modified: boolean read FModified write SetModified;
property OnModified: TNotifyEvent read FOnModified write FOnModified;

View File

@ -375,6 +375,7 @@ type
procedure SetConditionals(const AValue: string); override;
public
constructor Create(const AOwner: TObject); override;
function IsActive: boolean; override;
procedure Clear; override;
procedure GetInheritedCompilerOptions(var OptionsList: TFPList); override;
function GetOwnerName: string; override;
@ -2419,7 +2420,6 @@ begin
FMacros.MarkUnhandledMacros:=false;
FMacros.OnSubstitution:=@OnMacroListSubstitution;
FCompilerOptions:=TPkgCompilerOptions.Create(Self);
FCompilerOptions.Active:=true;
FCompilerOptions.ParsedOpts.InvalidateParseOnChange:=true;
FCompilerOptions.ParsedOpts.OnLocalSubstitute:=@SubstitutePkgMacros;
FCompilerOptions.DefaultMakeOptionsFlags:=[ccloNoLinkerOpts];
@ -3717,6 +3717,11 @@ begin
FLazPackage := AOwner as TLazPackage;
end;
function TPkgCompilerOptions.IsActive: boolean;
begin
Result:=(LazPackage<>nil) and (LazPackage.CompilerOptions=Self);
end;
procedure TPkgCompilerOptions.Clear;
begin
inherited Clear;