ideintf: free options index searching

- GetFreeIDEOptionsGroupIndex - to find free group index
  - GetFreeIDEOptionsIndex - to find free options index inside group

git-svn-id: trunk@23092 -
This commit is contained in:
paul 2009-12-12 09:00:46 +00:00
parent cc0ea5f1a0
commit f5cb1ce5f9

View File

@ -113,6 +113,8 @@ type
function FindEditor(AEditor: TAbstractIDEOptionsEditorClass): TAbstractIDEOptionsEditor; virtual; abstract;
end;
function GetFreeIDEOptionsGroupIndex(AStartIndex: Integer): Integer;
function GetFreeIDEOptionsIndex(AGroupIndex: Integer; AStartIndex: Integer): Integer;
procedure RegisterIDEOptionsGroup(AGroupIndex: Integer; AGroupClass: TAbstractIDEOptionsClass);
procedure RegisterIDEOptionsEditor(AGroupIndex: Integer; AEditorClass: TAbstractIDEOptionsEditorClass; AIndex: Integer; AParent: Integer = NoParent);
@ -178,7 +180,7 @@ begin
Result := FIDEEditorGroups;
end;
procedure RegisterIDEOptionsGroup(AGroupIndex: Integer; AGroupClass:TAbstractIDEOptionsClass);
procedure RegisterIDEOptionsGroup(AGroupIndex: Integer; AGroupClass: TAbstractIDEOptionsClass);
begin
IDEEditorGroups.Add(AGroupIndex, AGroupClass);
end;
@ -202,6 +204,30 @@ begin
end;
end;
function GetFreeIDEOptionsGroupIndex(AStartIndex: Integer): Integer;
var
I: Integer;
begin
for I := AStartIndex to High(Integer) do
if IDEEditorGroups.GetByIndex(I) = nil then
Exit(I);
end;
function GetFreeIDEOptionsIndex(AGroupIndex: Integer; AStartIndex: Integer): Integer;
var
Rec: PIDEOptionsGroupRec;
I: Integer;
begin
Result := -1; // -1 = error
Rec := IDEEditorGroups.GetByIndex(AGroupIndex);
if Rec = nil then
Exit;
for I := AStartIndex to High(Integer) do
if Rec^.Items.GetByIndex(I) = nil then
Exit(I);
end;
function GroupListCompare(Item1, Item2: Pointer): Integer;
var
Rec1: PIDEOptionsGroupRec absolute Item1;