IDE: TIDEProjPackBase changed to TComponent

git-svn-id: trunk@45956 -
This commit is contained in:
mattias 2014-07-23 11:32:58 +00:00
parent f6e6eb0ed1
commit de1b9bea42
5 changed files with 18 additions and 77 deletions

View File

@ -105,21 +105,19 @@ type
function GetIDAsString: string; function GetIDAsString: string;
function GetIDAsWord: string; function GetIDAsWord: string;
protected protected
FName: string;
FVersion: TPkgVersion; FVersion: TPkgVersion;
procedure SetName(const AValue: string); virtual; procedure SetName(const NewName: TComponentName); override;
procedure UpdateIDAsString; procedure UpdateIDAsString;
procedure VersionChanged(Sender: TObject); virtual; procedure VersionChanged(Sender: TObject); virtual;
public public
procedure AssignOptions(Source: TPersistent); virtual; procedure AssignOptions(Source: TPersistent); virtual;
constructor Create; constructor Create; virtual; reintroduce;
destructor Destroy; override; destructor Destroy; override;
function StringToID(const s: string): boolean; function StringToID(const s: string): boolean;
function Compare(PackageID2: TLazPackageID): integer; function Compare(PackageID2: TLazPackageID): integer;
function CompareMask(ExactPackageID: TLazPackageID): integer; function CompareMask(ExactPackageID: TLazPackageID): integer;
procedure AssignID(Source: TLazPackageID); virtual; procedure AssignID(Source: TLazPackageID); virtual;
public public
property Name: string read FName write SetName;
property Version: TPkgVersion read FVersion; property Version: TPkgVersion read FVersion;
property IDAsString: string read GetIDAsString; property IDAsString: string read GetIDAsString;
property IDAsWord: string read GetIDAsWord; property IDAsWord: string read GetIDAsWord;
@ -152,7 +150,7 @@ type
procedure AssignOptions(Source: TPersistent); override; procedure AssignOptions(Source: TPersistent); override;
function IsVirtual: boolean; virtual; abstract; function IsVirtual: boolean; virtual; abstract;
function ReadOnly: boolean; virtual; abstract; function ReadOnly: boolean; virtual; abstract;
constructor Create; constructor Create; override;
destructor Destroy; override; destructor Destroy; override;
procedure ClearCustomOptions; procedure ClearCustomOptions;
public public
@ -574,6 +572,7 @@ end;
constructor TLazPackageID.Create; constructor TLazPackageID.Create;
begin begin
inherited Create(nil);
FVersion:=TPkgVersion.Create; FVersion:=TPkgVersion.Create;
FVersion.OnChange:=@VersionChanged; FVersion.OnChange:=@VersionChanged;
end; end;
@ -611,7 +610,7 @@ begin
begin begin
aSource:=TLazPackageID(Source); aSource:=TLazPackageID(Source);
FVersion.Assign(aSource.Version); FVersion.Assign(aSource.Version);
Name:=aSource.FName; Name:=aSource.Name;
UpdateIDAsString; UpdateIDAsString;
end else end else
raise Exception.Create('TLazPackageID.AssignOptions: can not copy from '+DbgSName(Source)); raise Exception.Create('TLazPackageID.AssignOptions: can not copy from '+DbgSName(Source));
@ -676,10 +675,10 @@ begin
Result := FIDAsWord; Result := FIDAsWord;
end; end;
procedure TLazPackageID.SetName(const AValue: string); procedure TLazPackageID.SetName(const NewName: TComponentName);
begin begin
if FName=AValue then exit; if Name=NewName then exit;
FName:=AValue; inherited SetName(NewName);
UpdateIDAsString; UpdateIDAsString;
end; end;

View File

@ -408,7 +408,7 @@ type
procedure SetTitle(const AValue: String); virtual; procedure SetTitle(const AValue: String); virtual;
procedure SetUseManifest(AValue: boolean); virtual; abstract; procedure SetUseManifest(AValue: boolean); virtual; abstract;
public public
constructor Create({%H-}ProjectDescription: TProjectDescriptor); virtual; constructor Create({%H-}ProjectDescription: TProjectDescriptor); virtual; reintroduce;
destructor Destroy; override; destructor Destroy; override;
procedure Clear; virtual; procedure Clear; virtual;
function IsVirtual: boolean; virtual; abstract; function IsVirtual: boolean; virtual; abstract;
@ -1085,7 +1085,7 @@ end;
constructor TLazProject.Create(ProjectDescription: TProjectDescriptor); constructor TLazProject.Create(ProjectDescription: TProjectDescriptor);
begin begin
inherited Create; inherited Create(nil);
FSessionStorage:=DefaultNewProjectSessionStorage; FSessionStorage:=DefaultNewProjectSessionStorage;
FCleanOutputFileMask:=DefaultProjectCleanOutputFileMask; FCleanOutputFileMask:=DefaultProjectCleanOutputFileMask;
FCleanSourcesFileMask:=DefaultProjectCleanSourcesFileMask; FCleanSourcesFileMask:=DefaultProjectCleanSourcesFileMask;

View File

@ -45,15 +45,12 @@ type
{ TIDEProjPackBase } { TIDEProjPackBase }
TIDEProjPackBase = class(TPersistent) TIDEProjPackBase = class(TComponent)
private private
protected protected
FIDEOptions: TAbstractIDEOptions; //actually TProjectIDEOptions or TPackageIDEOptions; FIDEOptions: TAbstractIDEOptions; //actually TProjectIDEOptions or TPackageIDEOptions;
FLazCompilerOptions: TLazCompilerOptions; FLazCompilerOptions: TLazCompilerOptions;
function GetLazCompilerOptions: TLazCompilerOptions; function GetLazCompilerOptions: TLazCompilerOptions;
public
//constructor Create;
//destructor Destroy; override;
public public
property LazCompilerOptions: TLazCompilerOptions read GetLazCompilerOptions; property LazCompilerOptions: TLazCompilerOptions read GetLazCompilerOptions;
end; end;
@ -62,17 +59,7 @@ type
implementation implementation
{ TIDEProjPackBase } { TIDEProjPackBase }
{
constructor TIDEProjPackBase.Create;
begin
inherited Create;
end;
destructor TIDEProjPackBase.Destroy;
begin
inherited Destroy;
end;
}
function TIDEProjPackBase.GetLazCompilerOptions: TLazCompilerOptions; function TIDEProjPackBase.GetLazCompilerOptions: TLazCompilerOptions;
begin begin
Result := FLazCompilerOptions; Result := FLazCompilerOptions;

View File

@ -879,10 +879,6 @@ type
procedure AddToOrRemoveFromComponentList(AnUnitInfo: TUnitInfo); procedure AddToOrRemoveFromComponentList(AnUnitInfo: TUnitInfo);
procedure AddToOrRemoveFromLoadedList(AnUnitInfo: TUnitInfo); procedure AddToOrRemoveFromLoadedList(AnUnitInfo: TUnitInfo);
procedure AddToOrRemoveFromPartOfProjectList(AnUnitInfo: TUnitInfo); procedure AddToOrRemoveFromPartOfProjectList(AnUnitInfo: TUnitInfo);
public
function QueryInterface(constref iid: TGuid; out obj): LongInt; {$IFDEF WINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
function _AddRef: LongInt; {$IFDEF WINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
function _Release: LongInt; {$IFDEF WINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
public public
constructor Create(ProjectDescription: TProjectDescriptor); override; constructor Create(ProjectDescription: TProjectDescriptor); override;
destructor Destroy; override; destructor Destroy; override;
@ -4048,24 +4044,6 @@ begin
end; end;
end; end;
function TProject.QueryInterface(constref iid: TGuid; out obj): LongInt; {$IFDEF WINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
begin
if GetInterface(iid, obj) then
Result := S_OK
else
Result := E_NOINTERFACE;
end;
function TProject._AddRef: LongInt; {$IFDEF WINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
begin
Result := -1;
end;
function TProject._Release: LongInt; {$IFDEF WINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
begin
Result := -1;
end;
function TProject.GetTargetFilename: string; function TProject.GetTargetFilename: string;
begin begin
Result:=FLazCompilerOptions.TargetFilename; Result:=FLazCompilerOptions.TargetFilename;

View File

@ -609,17 +609,13 @@ type
function GetModified: boolean; override; function GetModified: boolean; override;
procedure SetFilename(const AValue: string); override; procedure SetFilename(const AValue: string); override;
procedure SetModified(const AValue: boolean); override; procedure SetModified(const AValue: boolean); override;
procedure SetName(const AValue: string); override; procedure SetName(const NewName: TComponentName); override;
procedure VersionChanged(Sender: TObject); override; procedure VersionChanged(Sender: TObject); override;
function GetRemovedCount: integer; override; function GetRemovedCount: integer; override;
function GetRemovedPkgFiles(Index: integer): TLazPackageFile; override; function GetRemovedPkgFiles(Index: integer): TLazPackageFile; override;
procedure SetAutoInstall(AValue: TPackageInstallType); override; procedure SetAutoInstall(AValue: TPackageInstallType); override;
public public
function QueryInterface(constref iid: TGuid; out obj): LongInt; {$IFDEF WINDOWS}stdcall{$ELSE}cdecl{$ENDIF}; constructor Create; override;
function _AddRef: LongInt; {$IFDEF WINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
function _Release: LongInt; {$IFDEF WINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
public
constructor Create;
destructor Destroy; override; destructor Destroy; override;
procedure AssignOptions(Source: TPersistent); override; procedure AssignOptions(Source: TPersistent); override;
// IDE options // IDE options
@ -2421,24 +2417,6 @@ begin
FAutoInstall:=AValue; FAutoInstall:=AValue;
end; end;
function TLazPackage.QueryInterface(constref iid: TGuid; out obj): LongInt; {$IFDEF WINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
begin
if GetInterface(iid, obj) then
Result := S_OK
else
Result := E_NOINTERFACE;
end;
function TLazPackage._AddRef: LongInt; {$IFDEF WINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
begin
Result := -1;
end;
function TLazPackage._Release: LongInt; {$IFDEF WINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
begin
Result := -1;
end;
procedure TLazPackage.SetAutoUpdate(const AValue: TPackageUpdatePolicy); procedure TLazPackage.SetAutoUpdate(const AValue: TPackageUpdatePolicy);
begin begin
if AValue=AutoUpdate then exit; if AValue=AutoUpdate then exit;
@ -2614,10 +2592,10 @@ begin
Editor.UpdateAll(false); Editor.UpdateAll(false);
end; end;
procedure TLazPackage.SetName(const AValue: string); procedure TLazPackage.SetName(const NewName: TComponentName);
begin begin
if FName=AValue then exit; if Name=NewName then exit;
inherited SetName(AValue); inherited SetName(NewName);
FDefineTemplates.IDChanged; FDefineTemplates.IDChanged;
Modified:=true; Modified:=true;
end; end;
@ -2747,7 +2725,7 @@ begin
FFilename:=''; FFilename:='';
FIconFile:=''; FIconFile:='';
FInstalled:=pitNope; FInstalled:=pitNope;
FName:=''; Name:='';
FPackageType:=lptRunAndDesignTime; FPackageType:=lptRunAndDesignTime;
FRegistered:=false; FRegistered:=false;
FFPDocPaths:=''; FFPDocPaths:='';
@ -2968,7 +2946,7 @@ begin
UsePathDelim:=StorePathDelim; UsePathDelim:=StorePathDelim;
XMLConfig.SetValue(Path+'Version',LazPkgXMLFileVersion); XMLConfig.SetValue(Path+'Version',LazPkgXMLFileVersion);
XMLConfig.SetDeleteValue(Path+'PathDelim/Value',PathDelimSwitchToDelim[UsePathDelim],'/'); XMLConfig.SetDeleteValue(Path+'PathDelim/Value',PathDelimSwitchToDelim[UsePathDelim],'/');
XMLConfig.SetDeleteValue(Path+'Name/Value',FName,''); XMLConfig.SetDeleteValue(Path+'Name/Value',Name,'');
XMLConfig.SetDeleteValue(Path+'AddToProjectUsesSection/Value', XMLConfig.SetDeleteValue(Path+'AddToProjectUsesSection/Value',
FAddToProjectUsesSection,false); FAddToProjectUsesSection,false);
XMLConfig.SetDeleteValue(Path+'Author/Value',FAuthor,''); XMLConfig.SetDeleteValue(Path+'Author/Value',FAuthor,'');
@ -2981,7 +2959,6 @@ begin
SaveFiles(Path+'Files/',FFiles); SaveFiles(Path+'Files/',FFiles);
SaveFlags(Path); SaveFlags(Path);
XMLConfig.SetDeleteValue(Path+'IconFile/Value',f(FIconFile),''); XMLConfig.SetDeleteValue(Path+'IconFile/Value',f(FIconFile),'');
XMLConfig.SetDeleteValue(Path+'Name/Value',FName,'');
XMLConfig.SetDeleteValue(Path+'OutputStateFile/Value',f(OutputStateFile),''); XMLConfig.SetDeleteValue(Path+'OutputStateFile/Value',f(OutputStateFile),'');
XMLConfig.SetDeleteValue(Path+'LazDoc/Paths',f(FFPDocPaths),''); XMLConfig.SetDeleteValue(Path+'LazDoc/Paths',f(FFPDocPaths),'');
XMLConfig.SetDeleteValue(Path+'LazDoc/PackageName',FFPDocPackageName,''); XMLConfig.SetDeleteValue(Path+'LazDoc/PackageName',FFPDocPackageName,'');