mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 23:19:12 +02:00
implemented TPointerToPointerTree.Remove
git-svn-id: trunk@10777 -
This commit is contained in:
parent
ba7e804254
commit
a2ffc321b3
@ -150,6 +150,7 @@ type
|
|||||||
constructor Create;
|
constructor Create;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure Clear;
|
procedure Clear;
|
||||||
|
procedure Remove(Key: Pointer);
|
||||||
function Contains(const Key: Pointer): Boolean;
|
function Contains(const Key: Pointer): Boolean;
|
||||||
function GetFirst(out Key, Value: Pointer): Boolean;
|
function GetFirst(out Key, Value: Pointer): Boolean;
|
||||||
function GetLast(out Key, Value: Pointer): Boolean;
|
function GetLast(out Key, Value: Pointer): Boolean;
|
||||||
@ -1546,6 +1547,18 @@ begin
|
|||||||
FItems.Clear;
|
FItems.Clear;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TPointerToPointerTree.Remove(Key: Pointer);
|
||||||
|
var
|
||||||
|
Node: TAvgLvlTreeNode;
|
||||||
|
Item: PPointerToPointerItem;
|
||||||
|
begin
|
||||||
|
Node:=FindNode(Key);
|
||||||
|
if Node=nil then exit;
|
||||||
|
Item:=PPointerToPointerItem(Node.Data);
|
||||||
|
FItems.Delete(Node);
|
||||||
|
Dispose(Item);
|
||||||
|
end;
|
||||||
|
|
||||||
function TPointerToPointerTree.Contains(const Key: Pointer): Boolean;
|
function TPointerToPointerTree.Contains(const Key: Pointer): Boolean;
|
||||||
begin
|
begin
|
||||||
Result:=FindNode(Key)<>nil;
|
Result:=FindNode(Key)<>nil;
|
||||||
|
@ -233,7 +233,7 @@ type
|
|||||||
Side: TAnchorKind): boolean;
|
Side: TAnchorKind): boolean;
|
||||||
function DockAsPage(Layout: TLazDockConfigNode): boolean;
|
function DockAsPage(Layout: TLazDockConfigNode): boolean;
|
||||||
procedure FixControlBounds(Layout: TLazDockConfigNode;
|
procedure FixControlBounds(Layout: TLazDockConfigNode;
|
||||||
AddedControl: TControl);
|
ResizedControl: TControl);
|
||||||
procedure ShrinkNeighbourhood(Layout: TLazDockConfigNode;
|
procedure ShrinkNeighbourhood(Layout: TLazDockConfigNode;
|
||||||
AControl: TControl; Sides: TAnchors);
|
AControl: TControl; Sides: TAnchors);
|
||||||
function FindPageNeighbours(Layout: TLazDockConfigNode;
|
function FindPageNeighbours(Layout: TLazDockConfigNode;
|
||||||
@ -844,7 +844,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomLazControlDocker.FixControlBounds(Layout: TLazDockConfigNode;
|
procedure TCustomLazControlDocker.FixControlBounds(Layout: TLazDockConfigNode;
|
||||||
AddedControl: TControl);
|
ResizedControl: TControl);
|
||||||
{ Fix bounds after inserting AddedControl }
|
{ Fix bounds after inserting AddedControl }
|
||||||
type
|
type
|
||||||
TControlInfo = record
|
TControlInfo = record
|
||||||
@ -1015,25 +1015,25 @@ var
|
|||||||
OldRect: TRect;
|
OldRect: TRect;
|
||||||
SideControl: TControl;
|
SideControl: TControl;
|
||||||
begin
|
begin
|
||||||
for i:=0 to AddedControl.Parent.ControlCount-1 do begin
|
for i:=0 to ResizedControl.Parent.ControlCount-1 do begin
|
||||||
Sibling:=AddedControl.Parent.Controls[i];
|
Sibling:=ResizedControl.Parent.Controls[i];
|
||||||
Info:=GetInfo(Sibling);
|
Info:=GetInfo(Sibling);
|
||||||
NewRect.Left:=Info^.MinLeft;
|
NewRect.Left:=Info^.MinLeft;
|
||||||
NewRect.Right:=NewRect.Left+Sibling.Width;
|
NewRect.Right:=NewRect.Left+Sibling.Width;
|
||||||
SideControl:=Sibling.AnchorSide[akRight].Control;
|
SideControl:=Sibling.AnchorSide[akRight].Control;
|
||||||
if (akRight in Sibling.Anchors) and (SideControl<>nil) then begin
|
if (akRight in Sibling.Anchors) and (SideControl<>nil) then begin
|
||||||
if SideControl=AddedControl.Parent then
|
if SideControl=ResizedControl.Parent then
|
||||||
NewRect.Right:=ParentClientWidth
|
NewRect.Right:=ParentClientWidth
|
||||||
else if SideControl.Parent=AddedControl.Parent then
|
else if SideControl.Parent=ResizedControl.Parent then
|
||||||
NewRect.Right:=CalculateMinimumLeft(SideControl);
|
NewRect.Right:=CalculateMinimumLeft(SideControl);
|
||||||
end;
|
end;
|
||||||
NewRect.Top:=Info^.MinTop;
|
NewRect.Top:=Info^.MinTop;
|
||||||
NewRect.Bottom:=NewRect.Top+Sibling.Height;
|
NewRect.Bottom:=NewRect.Top+Sibling.Height;
|
||||||
SideControl:=Sibling.AnchorSide[akBottom].Control;
|
SideControl:=Sibling.AnchorSide[akBottom].Control;
|
||||||
if (akBottom in Sibling.Anchors) and (SideControl<>nil) then begin
|
if (akBottom in Sibling.Anchors) and (SideControl<>nil) then begin
|
||||||
if SideControl=AddedControl.Parent then
|
if SideControl=ResizedControl.Parent then
|
||||||
NewRect.Bottom:=ParentClientHeight
|
NewRect.Bottom:=ParentClientHeight
|
||||||
else if SideControl.Parent=AddedControl.Parent then
|
else if SideControl.Parent=ResizedControl.Parent then
|
||||||
NewRect.Bottom:=CalculateMinimumTop(SideControl);
|
NewRect.Bottom:=CalculateMinimumTop(SideControl);
|
||||||
end;
|
end;
|
||||||
OldRect:=Sibling.BoundsRect;
|
OldRect:=Sibling.BoundsRect;
|
||||||
@ -1049,9 +1049,10 @@ var
|
|||||||
CurParent: TWinControl;
|
CurParent: TWinControl;
|
||||||
DiffWidth: Integer;
|
DiffWidth: Integer;
|
||||||
DiffHeight: Integer;
|
DiffHeight: Integer;
|
||||||
|
AlignDisabledControl: TWinControl;
|
||||||
begin
|
begin
|
||||||
DebugLn(['TCustomLazControlDocker.FixControlBounds ',DbgSName(AddedControl)]);
|
DebugLn(['TCustomLazControlDocker.FixControlBounds ',DbgSName(ResizedControl)]);
|
||||||
CurParent:=AddedControl.Parent;
|
CurParent:=ResizedControl.Parent;
|
||||||
if CurParent=nil then begin
|
if CurParent=nil then begin
|
||||||
DebugLn(['TCustomLazControlDocker.FixControlBounds WARNING: no parent']);
|
DebugLn(['TCustomLazControlDocker.FixControlBounds WARNING: no parent']);
|
||||||
exit;
|
exit;
|
||||||
@ -1065,9 +1066,10 @@ begin
|
|||||||
DiffHeight:=ParentSize.Y-CurParent.ClientHeight;
|
DiffHeight:=ParentSize.Y-CurParent.ClientHeight;
|
||||||
if (DiffWidth<>0) or (DiffHeight<>0) then begin
|
if (DiffWidth<>0) or (DiffHeight<>0) then begin
|
||||||
// parent needs resizing
|
// parent needs resizing
|
||||||
DebugLn(['TCustomLazControlDocker.FixControlBounds Parent=',DbgSName(AddedControl.Parent),' needs resizing to ',dbgs(ParentSize)]);
|
DebugLn(['TCustomLazControlDocker.FixControlBounds Parent=',DbgSName(ResizedControl.Parent),' needs resizing to ',dbgs(ParentSize)]);
|
||||||
if CurParent.Parent<>nil then
|
AlignDisabledControl:=CurParent.Parent;
|
||||||
CurParent.Parent.DisableAlign;
|
if AlignDisabledControl<>nil then
|
||||||
|
AlignDisabledControl.DisableAlign;
|
||||||
try
|
try
|
||||||
CurParent.ClientWidth:=ParentSize.X;
|
CurParent.ClientWidth:=ParentSize.X;
|
||||||
CurParent.ClientHeight:=ParentSize.Y;
|
CurParent.ClientHeight:=ParentSize.Y;
|
||||||
@ -1078,12 +1080,13 @@ begin
|
|||||||
end else begin
|
end else begin
|
||||||
// parent is a free form
|
// parent is a free form
|
||||||
// => decide where to move the form on the screen using the Layout
|
// => decide where to move the form on the screen using the Layout
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
DebugLn(['TCustomLazControlDocker.FixControlBounds TODO move parent ',DbgSName(CurParent)]);
|
DebugLn(['TCustomLazControlDocker.FixControlBounds TODO move parent ',DbgSName(CurParent)]);
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
if CurParent.Parent<>nil then
|
if AlignDisabledControl<>nil then
|
||||||
CurParent.Parent.EnableAlign;
|
AlignDisabledControl.EnableAlign;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
ApplyBounds(ParentSize.X,ParentSize.Y);
|
ApplyBounds(ParentSize.X,ParentSize.Y);
|
||||||
|
Loading…
Reference in New Issue
Block a user