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

View File

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

View File

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

View File

@ -879,10 +879,6 @@ type
procedure AddToOrRemoveFromComponentList(AnUnitInfo: TUnitInfo);
procedure AddToOrRemoveFromLoadedList(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
constructor Create(ProjectDescription: TProjectDescriptor); override;
destructor Destroy; override;
@ -4048,24 +4044,6 @@ begin
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;
begin
Result:=FLazCompilerOptions.TargetFilename;

View File

@ -609,17 +609,13 @@ type
function GetModified: boolean; override;
procedure SetFilename(const AValue: string); override;
procedure SetModified(const AValue: boolean); override;
procedure SetName(const AValue: string); override;
procedure SetName(const NewName: TComponentName); override;
procedure VersionChanged(Sender: TObject); override;
function GetRemovedCount: integer; override;
function GetRemovedPkgFiles(Index: integer): TLazPackageFile; override;
procedure SetAutoInstall(AValue: TPackageInstallType); override;
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
constructor Create;
constructor Create; override;
destructor Destroy; override;
procedure AssignOptions(Source: TPersistent); override;
// IDE options
@ -2421,24 +2417,6 @@ begin
FAutoInstall:=AValue;
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);
begin
if AValue=AutoUpdate then exit;
@ -2614,10 +2592,10 @@ begin
Editor.UpdateAll(false);
end;
procedure TLazPackage.SetName(const AValue: string);
procedure TLazPackage.SetName(const NewName: TComponentName);
begin
if FName=AValue then exit;
inherited SetName(AValue);
if Name=NewName then exit;
inherited SetName(NewName);
FDefineTemplates.IDChanged;
Modified:=true;
end;
@ -2747,7 +2725,7 @@ begin
FFilename:='';
FIconFile:='';
FInstalled:=pitNope;
FName:='';
Name:='';
FPackageType:=lptRunAndDesignTime;
FRegistered:=false;
FFPDocPaths:='';
@ -2968,7 +2946,7 @@ begin
UsePathDelim:=StorePathDelim;
XMLConfig.SetValue(Path+'Version',LazPkgXMLFileVersion);
XMLConfig.SetDeleteValue(Path+'PathDelim/Value',PathDelimSwitchToDelim[UsePathDelim],'/');
XMLConfig.SetDeleteValue(Path+'Name/Value',FName,'');
XMLConfig.SetDeleteValue(Path+'Name/Value',Name,'');
XMLConfig.SetDeleteValue(Path+'AddToProjectUsesSection/Value',
FAddToProjectUsesSection,false);
XMLConfig.SetDeleteValue(Path+'Author/Value',FAuthor,'');
@ -2981,7 +2959,6 @@ begin
SaveFiles(Path+'Files/',FFiles);
SaveFlags(Path);
XMLConfig.SetDeleteValue(Path+'IconFile/Value',f(FIconFile),'');
XMLConfig.SetDeleteValue(Path+'Name/Value',FName,'');
XMLConfig.SetDeleteValue(Path+'OutputStateFile/Value',f(OutputStateFile),'');
XMLConfig.SetDeleteValue(Path+'LazDoc/Paths',f(FFPDocPaths),'');
XMLConfig.SetDeleteValue(Path+'LazDoc/PackageName',FFPDocPackageName,'');