mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-23 02:19:09 +02:00
IDE: designer: simplified TSelectedControl
git-svn-id: trunk@48743 -
This commit is contained in:
parent
05d3490005
commit
21ab8152c3
@ -111,11 +111,6 @@ type
|
|||||||
|
|
||||||
TSelectedControl = class
|
TSelectedControl = class
|
||||||
private
|
private
|
||||||
FCachedFormRelativeLeftTop: TPoint;
|
|
||||||
FCachedHeight: integer;
|
|
||||||
FCachedLeft: integer;
|
|
||||||
FCachedTop: integer;
|
|
||||||
FCachedWidth: integer;
|
|
||||||
FDesignerForm: TCustomForm;
|
FDesignerForm: TCustomForm;
|
||||||
FFlags: TSelectedControlFlags;
|
FFlags: TSelectedControlFlags;
|
||||||
FIsNonVisualComponent: boolean;
|
FIsNonVisualComponent: boolean;
|
||||||
@ -131,7 +126,6 @@ type
|
|||||||
FOldWidth: integer;
|
FOldWidth: integer;
|
||||||
FOwner: TControlSelection;
|
FOwner: TControlSelection;
|
||||||
FPersistent: TPersistent;
|
FPersistent: TPersistent;
|
||||||
FUseCache: boolean;
|
|
||||||
FUsedHeight: integer;
|
FUsedHeight: integer;
|
||||||
FUsedLeft: integer;
|
FUsedLeft: integer;
|
||||||
FUsedTop: integer;
|
FUsedTop: integer;
|
||||||
@ -142,7 +136,6 @@ type
|
|||||||
function GetTop: integer;
|
function GetTop: integer;
|
||||||
procedure SetTop(ATop: integer);
|
procedure SetTop(ATop: integer);
|
||||||
function GetWidth: integer;
|
function GetWidth: integer;
|
||||||
procedure SetUseCache(const AValue: boolean);
|
|
||||||
procedure SetWidth(AWidth: integer);
|
procedure SetWidth(AWidth: integer);
|
||||||
function GetHeight: integer;
|
function GetHeight: integer;
|
||||||
procedure SetHeight(AHeight: integer);
|
procedure SetHeight(AHeight: integer);
|
||||||
@ -155,7 +148,6 @@ type
|
|||||||
StoreAsUsed: boolean = false);
|
StoreAsUsed: boolean = false);
|
||||||
procedure SetUsedBounds(ALeft, ATop, AWidth, AHeight: integer);
|
procedure SetUsedBounds(ALeft, ATop, AWidth, AHeight: integer);
|
||||||
procedure SaveBounds;
|
procedure SaveBounds;
|
||||||
procedure UpdateCache;
|
|
||||||
function IsTopLvl: boolean;
|
function IsTopLvl: boolean;
|
||||||
function ChildInSelection: boolean;
|
function ChildInSelection: boolean;
|
||||||
function ParentInSelection: boolean;
|
function ParentInSelection: boolean;
|
||||||
@ -178,7 +170,6 @@ type
|
|||||||
property UsedWidth: integer read FUsedWidth write FUsedWidth;
|
property UsedWidth: integer read FUsedWidth write FUsedWidth;
|
||||||
property UsedHeight: integer read FUsedHeight write FUsedHeight;
|
property UsedHeight: integer read FUsedHeight write FUsedHeight;
|
||||||
property Flags: TSelectedControlFlags read FFlags write FFlags;
|
property Flags: TSelectedControlFlags read FFlags write FFlags;
|
||||||
property UseCache: boolean read FUseCache write SetUseCache;
|
|
||||||
property IsVisible: boolean read FIsVisible;
|
property IsVisible: boolean read FIsVisible;
|
||||||
property IsTComponent: boolean read FIsTComponent;
|
property IsTComponent: boolean read FIsTComponent;
|
||||||
property IsTControl: boolean read FIsTControl;
|
property IsTControl: boolean read FIsTControl;
|
||||||
@ -627,10 +618,6 @@ end;
|
|||||||
|
|
||||||
procedure TSelectedControl.SetBounds(ALeft, ATop, AWidth, AHeight: integer);
|
procedure TSelectedControl.SetBounds(ALeft, ATop, AWidth, AHeight: integer);
|
||||||
begin
|
begin
|
||||||
FCachedLeft:=ALeft;
|
|
||||||
FCachedTop:=ATop;
|
|
||||||
FCachedWidth:=AWidth;
|
|
||||||
FCachedHeight:=AHeight;
|
|
||||||
if FIsTControl then begin
|
if FIsTControl then begin
|
||||||
TControl(FPersistent).SetBounds(ALeft, ATop, AWidth, AHeight);
|
TControl(FPersistent).SetBounds(ALeft, ATop, AWidth, AHeight);
|
||||||
end else if FIsNonVisualComponent then begin
|
end else if FIsNonVisualComponent then begin
|
||||||
@ -749,14 +736,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSelectedControl.UpdateCache;
|
|
||||||
begin
|
|
||||||
if not FIsTComponent then exit;
|
|
||||||
GetComponentBounds(TComponent(FPersistent),
|
|
||||||
FCachedLeft,FCachedTop,FCachedWidth,FCachedHeight);
|
|
||||||
FCachedFormRelativeLeftTop:= GetParentFormRelativeTopLeft(TComponent(FPersistent));
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TSelectedControl.IsTopLvl: boolean;
|
function TSelectedControl.IsTopLvl: boolean;
|
||||||
begin
|
begin
|
||||||
Result:=(not FIsTComponent)
|
Result:=(not FIsTComponent)
|
||||||
@ -805,9 +784,7 @@ function TSelectedControl.GetLeft: integer;
|
|||||||
var
|
var
|
||||||
r: TRect;
|
r: TRect;
|
||||||
begin
|
begin
|
||||||
if FUseCache then
|
if FIsTComponent then begin
|
||||||
Result:=FCachedLeft
|
|
||||||
else if FIsTComponent then begin
|
|
||||||
if Owner.Mediator<>nil then begin
|
if Owner.Mediator<>nil then begin
|
||||||
Owner.Mediator.GetBounds(TComponent(FPersistent),r);
|
Owner.Mediator.GetBounds(TComponent(FPersistent),r);
|
||||||
Result:=r.Left;
|
Result:=r.Left;
|
||||||
@ -836,17 +813,12 @@ begin
|
|||||||
TComponent(FPersistent).DesignInfo := LeftTopToDesignInfo(ALeft, Top);
|
TComponent(FPersistent).DesignInfo := LeftTopToDesignInfo(ALeft, Top);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
FCachedLeft := ALeft;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSelectedControl.GetTop: integer;
|
function TSelectedControl.GetTop: integer;
|
||||||
var
|
var
|
||||||
r: TRect;
|
r: TRect;
|
||||||
begin
|
begin
|
||||||
if FUseCache then
|
|
||||||
Result := FCachedTop
|
|
||||||
else
|
|
||||||
if FIsTComponent then begin
|
if FIsTComponent then begin
|
||||||
if Owner.Mediator<>nil then begin
|
if Owner.Mediator<>nil then begin
|
||||||
Owner.Mediator.GetBounds(TComponent(FPersistent),r);
|
Owner.Mediator.GetBounds(TComponent(FPersistent),r);
|
||||||
@ -876,8 +848,6 @@ begin
|
|||||||
TComponent(FPersistent).DesignInfo := LeftTopToDesignInfo(Left, ATop);
|
TComponent(FPersistent).DesignInfo := LeftTopToDesignInfo(Left, ATop);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
FCachedTop := ATop;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSelectedControl.GetWidth: integer;
|
function TSelectedControl.GetWidth: integer;
|
||||||
@ -885,9 +855,6 @@ var
|
|||||||
r: TRect;
|
r: TRect;
|
||||||
begin
|
begin
|
||||||
Result := 0;
|
Result := 0;
|
||||||
if FUseCache then
|
|
||||||
Result := FCachedWidth
|
|
||||||
else
|
|
||||||
if FIsTComponent then begin
|
if FIsTComponent then begin
|
||||||
if Owner.Mediator<>nil then begin
|
if Owner.Mediator<>nil then begin
|
||||||
Owner.Mediator.GetBounds(TComponent(FPersistent),r);
|
Owner.Mediator.GetBounds(TComponent(FPersistent),r);
|
||||||
@ -898,13 +865,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSelectedControl.SetUseCache(const AValue: boolean);
|
|
||||||
begin
|
|
||||||
if FUseCache=AValue then exit;
|
|
||||||
FUseCache:=AValue;
|
|
||||||
if FUseCache then UpdateCache;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSelectedControl.SetWidth(AWidth: integer);
|
procedure TSelectedControl.SetWidth(AWidth: integer);
|
||||||
var
|
var
|
||||||
r: TRect;
|
r: TRect;
|
||||||
@ -916,16 +876,12 @@ begin
|
|||||||
r.Right:=r.Left+AWidth;
|
r.Right:=r.Left+AWidth;
|
||||||
Owner.Mediator.SetBounds(TComponent(FPersistent),r);
|
Owner.Mediator.SetBounds(TComponent(FPersistent),r);
|
||||||
end;
|
end;
|
||||||
FCachedWidth:=AWidth;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSelectedControl.GetHeight: integer;
|
function TSelectedControl.GetHeight: integer;
|
||||||
var
|
var
|
||||||
r: TRect;
|
r: TRect;
|
||||||
begin
|
begin
|
||||||
if FUseCache then
|
|
||||||
Result := FCachedHeight
|
|
||||||
else
|
|
||||||
if FIsTComponent then begin
|
if FIsTComponent then begin
|
||||||
if Owner.Mediator<>nil then begin
|
if Owner.Mediator<>nil then begin
|
||||||
Owner.Mediator.GetBounds(TComponent(FPersistent),r);
|
Owner.Mediator.GetBounds(TComponent(FPersistent),r);
|
||||||
@ -948,7 +904,6 @@ begin
|
|||||||
r.Bottom:=r.Top+AHeight;
|
r.Bottom:=r.Top+AHeight;
|
||||||
Owner.Mediator.SetBounds(TComponent(FPersistent),r);
|
Owner.Mediator.SetBounds(TComponent(FPersistent),r);
|
||||||
end;
|
end;
|
||||||
FCachedHeight:=AHeight;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user