mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-25 00:29:40 +01:00
IDE designer: limit component position to form client area
git-svn-id: trunk@13996 -
This commit is contained in:
parent
5e3feae994
commit
a7714f09e0
@ -716,12 +716,22 @@ begin
|
||||
end;
|
||||
|
||||
procedure TSelectedControl.SetLeft(ALeft: integer);
|
||||
var
|
||||
M: Word;
|
||||
begin
|
||||
if FIsTControl then
|
||||
TControl(FPersistent).Left:=Aleft
|
||||
else if FIsTComponent then
|
||||
LongRec(TComponent(FPersistent).DesignInfo).Lo:=
|
||||
word(Min(32000,Max(0,ALeft)));
|
||||
else
|
||||
if FIsTComponent then
|
||||
begin
|
||||
M := 32000;
|
||||
if DesignerForm <> nil then
|
||||
M := Max(0, Min(M, DesignerForm.ClientWidth - NonVisualCompWidth));
|
||||
|
||||
LongRec(TComponent(FPersistent).DesignInfo).Lo:=
|
||||
word(Min(M, Max(0,ALeft)));
|
||||
end;
|
||||
|
||||
FCachedLeft:=ALeft;
|
||||
end;
|
||||
|
||||
@ -742,12 +752,22 @@ begin
|
||||
end;
|
||||
|
||||
procedure TSelectedControl.SetTop(ATop: integer);
|
||||
var
|
||||
M: Word;
|
||||
begin
|
||||
if FIsTControl then
|
||||
TControl(FPersistent).Top:=ATop
|
||||
else if FIsTComponent then
|
||||
LongRec(TComponent(FPersistent).DesignInfo).Hi:=
|
||||
word(Min(32000,Max(0,ATop)));
|
||||
else
|
||||
if FIsTComponent then
|
||||
begin
|
||||
M := 32000;
|
||||
if DesignerForm <> nil then
|
||||
M := Max(0, Min(M, DesignerForm.ClientHeight - NonVisualCompWidth));
|
||||
|
||||
LongRec(TComponent(FPersistent).DesignInfo).Hi:=
|
||||
word(Min(M, Max(0,ATop)));
|
||||
end;
|
||||
|
||||
FCachedTop:=ATop;
|
||||
end;
|
||||
|
||||
|
||||
@ -1075,10 +1075,10 @@ end;
|
||||
|
||||
function TDesigner.NonVisualComponentLeftTop(AComponent: TComponent): TPoint;
|
||||
begin
|
||||
Result.X:=Min(LongRec(AComponent.DesignInfo).Lo,
|
||||
Form.ClientWidth-NonVisualCompWidth);
|
||||
Result.Y:=Min(LongRec(AComponent.DesignInfo).Hi,
|
||||
Form.ClientHeight-NonVisualCompWidth);
|
||||
Result.X:=Max(0, Min(LongRec(AComponent.DesignInfo).Lo,
|
||||
Form.ClientWidth-NonVisualCompWidth));
|
||||
Result.Y:=Max(0, Min(LongRec(AComponent.DesignInfo).Hi,
|
||||
Form.ClientHeight-NonVisualCompWidth));
|
||||
end;
|
||||
|
||||
procedure TDesigner.InvalidateWithParent(AComponent: TComponent);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user