mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 01:39:25 +02:00
IDE: controlselection: using FreeNotification opRemove for selected components
git-svn-id: trunk@22627 -
This commit is contained in:
parent
fa3198bffe
commit
f246b17923
@ -263,7 +263,7 @@ type
|
|||||||
|
|
||||||
{ TControlSelection }
|
{ TControlSelection }
|
||||||
|
|
||||||
TControlSelection = class(TObject)
|
TControlSelection = class(TComponent)
|
||||||
private
|
private
|
||||||
FControls: TList; // list of TSelectedControl
|
FControls: TList; // list of TSelectedControl
|
||||||
FMediator: TDesignerMediator;
|
FMediator: TDesignerMediator;
|
||||||
@ -348,6 +348,8 @@ type
|
|||||||
procedure UpdateRealBounds;
|
procedure UpdateRealBounds;
|
||||||
procedure UpdateParentChildFlags;
|
procedure UpdateParentChildFlags;
|
||||||
procedure DoDrawMarker(Index: integer; DC: TDesignerDeviceContext);
|
procedure DoDrawMarker(Index: integer; DC: TDesignerDeviceContext);
|
||||||
|
procedure Notification(AComponent: TComponent; Operation: TOperation);
|
||||||
|
override;
|
||||||
|
|
||||||
// snapping
|
// snapping
|
||||||
function CleanGridSizeX: integer;
|
function CleanGridSizeX: integer;
|
||||||
@ -371,7 +373,7 @@ type
|
|||||||
procedure FindNearestTopGuideLine(var NearestInt: TNearestInt);
|
procedure FindNearestTopGuideLine(var NearestInt: TNearestInt);
|
||||||
procedure ImproveNearestInt(var NearestInt: TNearestInt; Candidate: integer);
|
procedure ImproveNearestInt(var NearestInt: TNearestInt; Candidate: integer);
|
||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create; reintroduce;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure OnIdle(Sender: TObject; var Done: Boolean);
|
procedure OnIdle(Sender: TObject; var Done: Boolean);
|
||||||
|
|
||||||
@ -393,7 +395,7 @@ type
|
|||||||
procedure Clear;
|
procedure Clear;
|
||||||
function Equals(const ASelection: TPersistentSelectionList): boolean; reintroduce;
|
function Equals(const ASelection: TPersistentSelectionList): boolean; reintroduce;
|
||||||
function AssignPersistent(APersistent: TPersistent): boolean;
|
function AssignPersistent(APersistent: TPersistent): boolean;
|
||||||
procedure Assign(AControlSelection: TControlSelection);
|
procedure Assign(AControlSelection: TControlSelection); reintroduce;
|
||||||
procedure AssignSelection(const ASelection: TPersistentSelectionList);
|
procedure AssignSelection(const ASelection: TPersistentSelectionList);
|
||||||
function IsSelected(APersistent: TPersistent): Boolean;
|
function IsSelected(APersistent: TPersistent): Boolean;
|
||||||
function IsOnlySelected(APersistent: TPersistent): Boolean;
|
function IsOnlySelected(APersistent: TPersistent): Boolean;
|
||||||
@ -904,7 +906,7 @@ end;
|
|||||||
constructor TControlSelection.Create;
|
constructor TControlSelection.Create;
|
||||||
var g:TGrabIndex;
|
var g:TGrabIndex;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create(nil);
|
||||||
FControls:=TList.Create;
|
FControls:=TList.Create;
|
||||||
FGrabberSize:=5;
|
FGrabberSize:=5;
|
||||||
FMarkerSize:=5;
|
FMarkerSize:=5;
|
||||||
@ -1328,6 +1330,15 @@ begin
|
|||||||
CurItem.MarkerPaintedBounds:=Bounds(CompLeft,CompTop,CompWidth,CompHeight);
|
CurItem.MarkerPaintedBounds:=Bounds(CompLeft,CompTop,CompWidth,CompHeight);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TControlSelection.Notification(AComponent: TComponent;
|
||||||
|
Operation: TOperation);
|
||||||
|
begin
|
||||||
|
inherited Notification(AComponent, Operation);
|
||||||
|
if Operation=opRemove then begin
|
||||||
|
Remove(AComponent);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TControlSelection.CleanGridSizeX: integer;
|
function TControlSelection.CleanGridSizeX: integer;
|
||||||
begin
|
begin
|
||||||
Result:=EnvironmentOptions.GridSizeX;
|
Result:=EnvironmentOptions.GridSizeX;
|
||||||
@ -2011,6 +2022,8 @@ begin
|
|||||||
FStates:=FStates+cssSelectionChangeFlags;
|
FStates:=FStates+cssSelectionChangeFlags;
|
||||||
if Count=1 then SetCustomForm;
|
if Count=1 then SetCustomForm;
|
||||||
if APersistent=FLookupRoot then Include(FStates,cssLookupRootSelected);
|
if APersistent=FLookupRoot then Include(FStates,cssLookupRootSelected);
|
||||||
|
if APersistent is TComponent then
|
||||||
|
TComponent(APersistent).FreeNotification(Self);
|
||||||
DoChange;
|
DoChange;
|
||||||
UpdateBounds;
|
UpdateBounds;
|
||||||
SaveBounds;
|
SaveBounds;
|
||||||
|
Loading…
Reference in New Issue
Block a user