mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 10:50:53 +02:00
IDE: mediator in controlselection
git-svn-id: trunk@21625 -
This commit is contained in:
parent
4e4340b68b
commit
6e272afa14
@ -38,7 +38,8 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Math, LCLIntf, LCLType, LCLProc, Controls, Forms,
|
||||
GraphType, Graphics, Menus, EnvironmentOpts, PropEdits, DesignerProcs;
|
||||
GraphType, Graphics, Menus, EnvironmentOpts, PropEdits,
|
||||
FormEditingIntf, NonControlDesigner, DesignerProcs;
|
||||
|
||||
type
|
||||
TControlSelection = class;
|
||||
@ -265,7 +266,9 @@ type
|
||||
{ TControlSelection }
|
||||
|
||||
TControlSelection = class(TObject)
|
||||
private
|
||||
FControls: TList; // list of TSelectedControl
|
||||
FMediator: TDesignerMediator;
|
||||
|
||||
// current bounds of the selection (only valid if Count>0)
|
||||
// These are the values set by the user
|
||||
@ -494,6 +497,7 @@ type
|
||||
property Visible:boolean read GetVisible write SetVisible;
|
||||
|
||||
property SelectionForm: TCustomForm read FForm;
|
||||
property Mediator: TDesignerMediator read FMediator;
|
||||
property OnSelectionFormChanged: TOnSelectionFormChanged
|
||||
read FOnSelectionFormChanged write FOnSelectionFormChanged;
|
||||
property LookupRoot: TComponent read FLookupRoot;
|
||||
@ -971,6 +975,10 @@ begin
|
||||
InvalidateGrabbers;
|
||||
OldCustomForm:=FForm;
|
||||
FForm:=NewCustomForm;
|
||||
if FForm is TNonControlDesignerForm then
|
||||
FMediator:=TNonControlDesignerForm(FForm).Mediator
|
||||
else
|
||||
FMediator:=nil;
|
||||
FLookupRoot:=GetSelectionOwner;
|
||||
if Assigned(FOnSelectionFormChanged) then
|
||||
FOnSelectionFormChanged(Self,OldCustomForm,NewCustomForm);
|
||||
@ -1950,6 +1958,7 @@ begin
|
||||
FControls.Clear;
|
||||
FStates:=FStates+cssSelectionChangeFlags-[cssLookupRootSelected];
|
||||
FForm:=nil;
|
||||
FMediator:=nil;
|
||||
UpdateBounds;
|
||||
SaveBounds;
|
||||
DoChange;
|
||||
|
@ -135,6 +135,7 @@ var
|
||||
CurDataModule: TDataModule;
|
||||
NewLeft, NewTop: integer;
|
||||
NewWidth, NewHeight: Integer;
|
||||
NewBounds: TRect;
|
||||
begin
|
||||
inherited DoLoadBounds;
|
||||
|
||||
@ -150,8 +151,18 @@ begin
|
||||
end else
|
||||
if LookupRoot <> nil then
|
||||
begin
|
||||
GetComponentLeftTopOrDesignInfo(LookupRoot,NewLeft,NewTop);
|
||||
SetNewBounds(NewLeft, NewTop, Width, Height);
|
||||
if Mediator<>nil then begin
|
||||
Mediator.GetBounds(LookupRoot,NewBounds);
|
||||
NewLeft:=NewBounds.Left;
|
||||
NewTop:=NewBounds.Top;
|
||||
NewWidth:=NewBounds.Right-NewBounds.Left;
|
||||
NewHeight:=NewBounds.Bottom-NewBounds.Top;
|
||||
end else begin
|
||||
GetComponentLeftTopOrDesignInfo(LookupRoot,NewLeft,NewTop);
|
||||
NewWidth:=Width;
|
||||
NewHeight:=Height;
|
||||
end;
|
||||
SetNewBounds(NewLeft, NewTop, NewWidth, NewHeight);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -164,8 +175,12 @@ begin
|
||||
//debugln('TNonControlDesignerForm.DoSaveBounds (TDataModule) ',dbgsName(LookupRoot),' ',dbgs(DesignOffset.X),',',dbgs(DesignOffset.Y));
|
||||
end;
|
||||
end else if LookupRoot<>nil then begin
|
||||
//debugln('TNonControlDesignerForm.DoSaveBounds ',dbgsName(LookupRoot),' ',dbgs(Left),',',dbgs(Top));
|
||||
SetComponentLeftTopOrDesignInfo(LookupRoot,Left,Top);
|
||||
//debugln(['TNonControlDesignerForm.DoSaveBounds ',dbgsName(LookupRoot),' ',dbgs(Left),',',dbgs(Top),' ',DbgSName(Mediator)]);
|
||||
if Mediator<>nil then begin
|
||||
Mediator.SetBounds(LookupRoot,BoundsRect);
|
||||
end else begin
|
||||
SetComponentLeftTopOrDesignInfo(LookupRoot,Left,Top);
|
||||
end;
|
||||
end;
|
||||
inherited DoSaveBounds;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user