|
@@ -141,18 +141,23 @@ end;
|
|
|
|
|
|
Procedure TList.Delete(Index: Integer);
|
|
Procedure TList.Delete(Index: Integer);
|
|
|
|
|
|
|
|
+Var
|
|
|
|
+ OldPointer :Pointer;
|
|
|
|
+
|
|
begin
|
|
begin
|
|
If (Index<0) or (Index>=FCount) then
|
|
If (Index<0) or (Index>=FCount) then
|
|
Error (SListIndexError,Index);
|
|
Error (SListIndexError,Index);
|
|
FCount:=FCount-1;
|
|
FCount:=FCount-1;
|
|
|
|
+ OldPointer:=Flist^[Index];
|
|
System.Move (FList^[Index+1],FList^[Index],(FCount-Index)*SizeOf(Pointer));
|
|
System.Move (FList^[Index+1],FList^[Index],(FCount-Index)*SizeOf(Pointer));
|
|
-
|
|
|
|
// Shrink the list if appropiate
|
|
// Shrink the list if appropiate
|
|
if (FCapacity > 256) and (FCount < FCapacity shr 2) then
|
|
if (FCapacity > 256) and (FCount < FCapacity shr 2) then
|
|
begin
|
|
begin
|
|
FCapacity := FCapacity shr 1;
|
|
FCapacity := FCapacity shr 1;
|
|
ReallocMem(FList, SizeOf(Pointer) * FCapacity);
|
|
ReallocMem(FList, SizeOf(Pointer) * FCapacity);
|
|
end;
|
|
end;
|
|
|
|
+ If OldPointer<>nil then
|
|
|
|
+ Notify(OldPointer,lnDeleted);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -228,6 +233,8 @@ begin
|
|
System.Move (Flist^[Index],Flist^[Index+1],(FCount-Index)*SizeOf(Pointer));
|
|
System.Move (Flist^[Index],Flist^[Index+1],(FCount-Index)*SizeOf(Pointer));
|
|
FList^[Index]:=Item;
|
|
FList^[Index]:=Item;
|
|
FCount:=FCount+1;
|
|
FCount:=FCount+1;
|
|
|
|
+ If Item<>NIl then
|
|
|
|
+ Notify(Item,lnAdded);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -253,10 +260,12 @@ begin
|
|
If (NewINdex<0) then
|
|
If (NewINdex<0) then
|
|
Error(SlistIndexError,NewIndex);
|
|
Error(SlistIndexError,NewIndex);
|
|
Temp:=FList^[CurIndex];
|
|
Temp:=FList^[CurIndex];
|
|
|
|
+ FList^[CurIndex]:=Nil;
|
|
Self.Delete(CurIndex);
|
|
Self.Delete(CurIndex);
|
|
// ?? If NewIndex>CurIndex then NewIndex:=NewIndex-1;
|
|
// ?? If NewIndex>CurIndex then NewIndex:=NewIndex-1;
|
|
// Newindex changes when deleting ??
|
|
// Newindex changes when deleting ??
|
|
- Self.Insert (NewIndex,Temp);
|
|
|
|
|
|
+ Self.Insert (NewIndex,Nil);
|
|
|
|
+ FList^[NewIndex]:=Temp;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -431,7 +440,10 @@ end;
|
|
|
|
|
|
{
|
|
{
|
|
$Log$
|
|
$Log$
|
|
- Revision 1.7 2002-07-16 14:00:55 florian
|
|
|
|
|
|
+ Revision 1.8 2002-08-16 10:04:58 michael
|
|
|
|
+ + Notify correctly implemented
|
|
|
|
+
|
|
|
|
+ Revision 1.7 2002/07/16 14:00:55 florian
|
|
* raise takes now a void pointer as at and frame address
|
|
* raise takes now a void pointer as at and frame address
|
|
instead of a longint, fixed
|
|
instead of a longint, fixed
|
|
|
|
|
|
@@ -453,4 +465,4 @@ end;
|
|
Revision 1.2 2000/07/13 11:32:59 michael
|
|
Revision 1.2 2000/07/13 11:32:59 michael
|
|
+ removed logs
|
|
+ removed logs
|
|
|
|
|
|
-}
|
|
|
|
|
|
+}
|