added methods to ideintf for NewItemIntf to register custom categories

git-svn-id: trunk@7425 -
This commit is contained in:
mattias 2005-07-25 23:34:48 +00:00
parent 63ebe03976
commit 21a9d058d9
3 changed files with 41 additions and 2 deletions

View File

@ -83,6 +83,7 @@ type
destructor Destroy; override;
procedure Clear; override;
procedure Add(ACategory: TNewIDEItemCategory); override;
Procedure Add(ACategoryName : String); override;
function Count: integer; override;
function IndexOf(const CategoryName: string): integer; override;
function FindByName(const CategoryName: string): TNewIDEItemCategory; override;
@ -459,6 +460,21 @@ begin
FItems.Add(ACategory);
end;
procedure TNewLazIDEItemCategories.Add(ACategoryName : String);
Var
I : integer;
begin
I:=IndexOf(ACategoryName);
If I<>-1 then
begin
Items[I].Free;
FItems.Delete(I);
end;
Add(TNewLazIDEItemCategoryFile.Create(ACategoryName));
end;
function TNewLazIDEItemCategories.Count: integer;
begin
Result:=FItems.Count;

View File

@ -67,6 +67,7 @@ type
public
procedure Clear; virtual; abstract;
procedure Add(ACategory: TNewIDEItemCategory); virtual; abstract;
Procedure Add(ACategoryName : String); virtual; abstract;
function Count: integer; virtual; abstract;
function IndexOf(const CategoryName: string): integer; virtual; abstract;
function FindByName(const CategoryName: string): TNewIDEItemCategory; virtual; abstract;
@ -115,9 +116,17 @@ procedure RegisterNewDialogItem(const Paths: string;
NewItem: TNewIDEItemTemplate);
procedure UnregisterNewDialogItem(NewItem: TNewIDEItemTemplate);
procedure RegisterNewItemCategory(const ACategory: String);
implementation
procedure RegisterNewItemCategory(const ACategory: String);
begin
NewIdeItems.Add(ACategory);
end;
procedure RegisterNewDialogItem(const Paths: string;
NewItem: TNewIDEItemTemplate);
begin

View File

@ -560,12 +560,20 @@ function ProjectFlagsToStr(Flags: TProjectFlags): string;
procedure RegisterProjectFileDescriptor(FileDesc: TProjectFileDescriptor);
procedure RegisterProjectDescriptor(ProjDesc: TProjectDescriptor);
procedure RegisterProjectFileDescriptor(FileDesc: TProjectFileDescriptor; ACategory : String);
procedure RegisterProjectDescriptor(ProjDesc: TProjectDescriptor; ACategory : String);
implementation
procedure RegisterProjectFileDescriptor(FileDesc: TProjectFileDescriptor);
begin
RegisterProjectFileDescriptor(FileDesc,FileDescGroupName);
end;
procedure RegisterProjectFileDescriptor(FileDesc: TProjectFileDescriptor; ACategory : String);
var
NewItemFile: TNewItemProjectFile;
begin
@ -573,11 +581,17 @@ begin
if FileDesc.VisibleInNewDialog then begin
NewItemFile:=TNewItemProjectFile.Create(FileDesc.Name,niifCopy,[niifCopy]);
NewItemFile.Descriptor:=FileDesc;
RegisterNewDialogItem(FileDescGroupName,NewItemFile);
RegisterNewDialogItem(ACategory,NewItemFile);
end;
end;
procedure RegisterProjectDescriptor(ProjDesc: TProjectDescriptor);
begin
RegisterProjectDescriptor(ProjDesc,ProjDescGroupName);
end;
procedure RegisterProjectDescriptor(ProjDesc: TProjectDescriptor; ACategory : String);
var
NewItemProject: TNewItemProject;
begin
@ -585,7 +599,7 @@ begin
if ProjDesc.VisibleInNewDialog then begin
NewItemProject:=TNewItemProject.Create(ProjDesc.Name,niifCopy,[niifCopy]);
NewItemProject.Descriptor:=ProjDesc;
RegisterNewDialogItem(ProjDescGroupName,NewItemProject);
RegisterNewDialogItem(ACategory,NewItemProject);
end;
end;