mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 14:39:13 +02:00
ideintf: sort prop info list after create to correctly compare items when selection components count > 1 (fixes bug #0013138)
git-svn-id: trunk@18606 -
This commit is contained in:
parent
96f22bc669
commit
76a103588d
@ -1410,6 +1410,7 @@ type
|
|||||||
function Contains(P: PPropInfo): Boolean;
|
function Contains(P: PPropInfo): Boolean;
|
||||||
procedure Delete(Index: Integer);
|
procedure Delete(Index: Integer);
|
||||||
procedure Intersect(List: TPropInfoList);
|
procedure Intersect(List: TPropInfoList);
|
||||||
|
procedure Sort;
|
||||||
property Count: Integer read FCount;
|
property Count: Integer read FCount;
|
||||||
property Items[Index: Integer]: PPropInfo read Get; default;
|
property Items[Index: Integer]: PPropInfo read Get; default;
|
||||||
end;
|
end;
|
||||||
@ -1830,6 +1831,7 @@ begin
|
|||||||
GetMem(FList,FSize);
|
GetMem(FList,FSize);
|
||||||
Move(BigList^,FList^,FSize);
|
Move(BigList^,FList^,FSize);
|
||||||
FreeMem(BigList);
|
FreeMem(BigList);
|
||||||
|
Sort;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TPropInfoList.Destroy;
|
destructor TPropInfoList.Destroy;
|
||||||
@ -1839,18 +1841,20 @@ end;
|
|||||||
|
|
||||||
function TPropInfoList.Contains(P:PPropInfo):Boolean;
|
function TPropInfoList.Contains(P:PPropInfo):Boolean;
|
||||||
var
|
var
|
||||||
I:Integer;
|
I: Integer;
|
||||||
begin
|
begin
|
||||||
for I:=0 to FCount-1 do begin
|
for I := 0 to FCount - 1 do
|
||||||
with FList^[I]^ do begin
|
begin
|
||||||
if (PropType^.Kind=P^.PropType^.Kind)
|
with FList^[I]^ do
|
||||||
and (CompareText(Name,P^.Name)=0) then begin
|
begin
|
||||||
Result:=True;
|
if (PropType^.Kind=P^.PropType^.Kind) and (CompareText(Name,P^.Name)=0) then
|
||||||
|
begin
|
||||||
|
Result := True;
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
Result:=False;
|
Result := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPropInfoList.Delete(Index:Integer);
|
procedure TPropInfoList.Delete(Index:Integer);
|
||||||
@ -1874,6 +1878,38 @@ begin
|
|||||||
if not List.Contains(FList^[I]) then Delete(I);
|
if not List.Contains(FList^[I]) then Delete(I);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TPropInfoList.Sort;
|
||||||
|
procedure QuickSort(L, R: Integer);
|
||||||
|
var
|
||||||
|
I, J: Longint;
|
||||||
|
P, Q: PPropInfo;
|
||||||
|
begin
|
||||||
|
repeat
|
||||||
|
I := L;
|
||||||
|
J := R;
|
||||||
|
P := FList^[(L + R) div 2];
|
||||||
|
repeat
|
||||||
|
while CompareText(P^.Name, FList^[i]^.Name) > 0 do
|
||||||
|
inc(I);
|
||||||
|
while CompareText(P^.Name, FList^[J]^.Name) < 0 do
|
||||||
|
dec(J);
|
||||||
|
if I <= J then
|
||||||
|
begin
|
||||||
|
Q := FList^[I];
|
||||||
|
Flist^[I] := FList^[J];
|
||||||
|
FList^[J] := Q;
|
||||||
|
inc(I);
|
||||||
|
dec(J);
|
||||||
|
end;
|
||||||
|
until I > J;
|
||||||
|
if L < J then
|
||||||
|
QuickSort(L, J);
|
||||||
|
L := I;
|
||||||
|
until I >= R;
|
||||||
|
end;
|
||||||
|
begin
|
||||||
|
QuickSort(0, Count - 1);
|
||||||
|
end;
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user