mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 09:19:32 +02:00
MG: client rect bugs nearly completed
git-svn-id: trunk@1674 -
This commit is contained in:
parent
5c631902b8
commit
872140dc14
@ -110,9 +110,11 @@ type
|
||||
function IndexOfKey(Key: Pointer): integer;
|
||||
function FindHashItem(Item: Pointer): PDynHashArrayItem;
|
||||
function FindHashItemWithKey(Key: Pointer): PDynHashArrayItem;
|
||||
property FirstHashItem: PDynHashArrayItem read FFirstItem;
|
||||
function GetHashItem(HashIndex: integer): PDynHashArrayItem;
|
||||
procedure Delete(ADynHashArrayItem: PDynHashArrayItem);
|
||||
procedure AssignTo(List: TList);
|
||||
|
||||
property FirstHashItem: PDynHashArrayItem read FFirstItem;
|
||||
property MinCapacity: integer read FMinCapacity write FMinCapacity;
|
||||
property MaxCapacity: integer read FMaxCapacity write FMaxCapacity;
|
||||
property Capacity: integer read FCapacity;
|
||||
@ -382,47 +384,43 @@ begin
|
||||
end;
|
||||
|
||||
procedure TDynHashArray.Remove(Item: Pointer);
|
||||
var Index: integer;
|
||||
OldNext, Old: PDynHashArrayItem;
|
||||
begin
|
||||
if (Item=nil) or (FItems=nil) then exit;
|
||||
Index:=IndexOf(Item);
|
||||
if (Index<0) then exit;
|
||||
Old:=FItems[Index];
|
||||
if Old=nil then exit;
|
||||
if Old^.Item=Item then begin
|
||||
OldNext:=Old^.Next;
|
||||
if (OldNext=nil) or (OldNext^.IsOverflow) then
|
||||
FItems[Index]:=OldNext
|
||||
else
|
||||
FItems[Index]:=nil;
|
||||
end else begin
|
||||
repeat
|
||||
Old:=Old^.Next;
|
||||
if Old=nil then exit;
|
||||
if Old^.IsOverflow=false then exit;
|
||||
until (Old^.Item=Item);
|
||||
end;
|
||||
Delete(Old);
|
||||
Delete(FindHashItem(Item));
|
||||
end;
|
||||
|
||||
procedure TDynHashArray.Delete(ADynHashArrayItem: PDynHashArrayItem);
|
||||
var Index: integer;
|
||||
OldNext: PDynHashArrayItem;
|
||||
begin
|
||||
if ADynHashArrayItem=nil then exit;
|
||||
// delete from cache
|
||||
if (FHashCacheIndex>=0)
|
||||
and ((ADynHashArrayItem^.Item=FHashCacheItem)
|
||||
or (Assigned(OnGetKeyForHashItem)
|
||||
and (OnGetKeyForHashItem(ADynHashArrayItem^.Item)=FHashCacheItem)))
|
||||
then
|
||||
// if the user removes an item, changes the key and readds it, the hash
|
||||
// can change for it, so the cache must be cleared
|
||||
// of the item can change
|
||||
// => the cache must be cleared
|
||||
ClearCache;
|
||||
if (ADynHashArrayItem^.IsOverflow=false) and (ADynHashArrayItem^.Next<>nil)
|
||||
then
|
||||
ADynHashArrayItem^.Next^.IsOverflow:=false;
|
||||
// delete from FItems
|
||||
if not ADynHashArrayItem^.IsOverflow then begin
|
||||
// Item is first item with hash
|
||||
Index:=IndexOf(ADynHashArrayItem^.Item);
|
||||
OldNext:=ADynHashArrayItem^.Next;
|
||||
if (OldNext=nil) or (not (OldNext^.IsOverflow)) then
|
||||
FItems[Index]:=nil
|
||||
else begin
|
||||
FItems[Index]:=OldNext;
|
||||
OldNext^.IsOverflow:=false;
|
||||
end;
|
||||
end;
|
||||
// adjust FFirstItem
|
||||
if FFirstItem=ADynHashArrayItem then
|
||||
FFirstItem:=FFirstItem^.Next;
|
||||
// free storage item
|
||||
DisposeHashItem(ADynHashArrayItem);
|
||||
// adjust count and capacity
|
||||
dec(FCount);
|
||||
if FCount<FLowWaterMark then begin
|
||||
// resize
|
||||
@ -430,6 +428,20 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDynHashArray.AssignTo(List: TList);
|
||||
var i: integer;
|
||||
HashItem: PDynHashArrayItem;
|
||||
begin
|
||||
List.Count:=Count;
|
||||
HashItem:=FirstHashItem;
|
||||
i:=0;
|
||||
while HashItem<>nil do begin
|
||||
List[i]:=HashItem^.Item;
|
||||
inc(i);
|
||||
HashItem:=HashItem^.Next;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TDynHashArray.First: Pointer;
|
||||
begin
|
||||
if FFirstItem<>nil then
|
||||
|
@ -478,7 +478,7 @@ end;
|
||||
|
||||
|
||||
{$I form.inc}
|
||||
{$I Customform.inc}
|
||||
{$I customform.inc}
|
||||
{$I screen.inc}
|
||||
{$I application.inc}
|
||||
{$I hintwindow.inc}
|
||||
|
@ -304,6 +304,13 @@ begin
|
||||
Result := InterfaceObject.GetWindowRect(Handle, Rect);
|
||||
end;
|
||||
|
||||
{$IFDEF ClientRectBugFix}
|
||||
Function GetWindowSize(Handle : hwnd; var Width, Height: integer): boolean;
|
||||
begin
|
||||
Result := InterfaceObject.GetWindowSize(Handle, Width, Height);
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
Function GetWindowOrgEx(dc : hdc; var P : TPoint): Integer;
|
||||
begin
|
||||
Result := InterfaceObject.GetWindowOrgEx(dc,P);
|
||||
@ -1085,6 +1092,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.29 2002/05/12 04:56:20 lazarus
|
||||
MG: client rect bugs nearly completed
|
||||
|
||||
Revision 1.28 2002/05/10 06:05:56 lazarus
|
||||
MG: changed license to LGPL
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user