DockedFormEditor: Fixed a bug with multiple source editor windows

git-svn-id: trunk@64595 -
This commit is contained in:
michl 2021-02-16 21:12:42 +00:00
parent 26427d65ae
commit 5cc908ff89
4 changed files with 28 additions and 8 deletions

View File

@ -41,7 +41,6 @@ type
FDesignForm: TDesignForm;
FMenuAttachDetach: TMenuItem;
FMousePos: TPoint;
FParent: TWinControl;
FPopupMenu: TPopupMenu;
FPopupAnchors: TAnchors;
FPreviousControl: TAnchorControl;
@ -76,6 +75,7 @@ type
procedure SelectedAdaptBorder;
procedure SelectedAdaptBounds(RemoveAnchorSides: Boolean);
procedure SelectedAnchorNewTarget(AKind: TAnchorKind);
procedure SetParent(AValue: TWinControl); override;
procedure SetSelectedControl(AValue: TAnchorControl);
public
constructor Create(ADesignForm: TDesignForm; AParent: TWinControl);
@ -388,7 +388,7 @@ end;
procedure TAnchorDesigner.CreateAnchorGrips;
begin
FAnchorGrips := TAnchorGrips.Create(FParent);
FAnchorGrips := TAnchorGrips.Create(FBackGround);
FAnchorGrips.BackGround := FBackGround;
FAnchorGrips.OnMouseDown := @AnchorGripMouseDown;
FAnchorGrips.OnMouseMove := @AnchorGripMouseMove;
@ -398,11 +398,11 @@ end;
procedure TAnchorDesigner.CreateBackGround;
begin
FBackGround := TAnchorControl.Create(FParent, FDesignControl);
FBackGround := TAnchorControl.Create(Parent, FDesignControl);
FBackGround.BevelOuter := bvNone;
FBackGround.Align := alClient;
FBackGround.Name := 'AnchorBackGround';
FBackGround.Parent := FParent;
FBackGround.Parent := Parent;
FBackGround.OnMouseDown := @AnchorControlMouseDown;
FBackGround.OnPaint := @AnchorControlPaint;
FBackGround.OnMouseWheel := @AnchorControlMouseWheel;
@ -836,6 +836,13 @@ begin
FSelectedControl.Anchors := FSelectedControl.Anchors + [AKind];
end;
procedure TAnchorDesigner.SetParent(AValue: TWinControl);
begin
inherited SetParent(AValue);
if Assigned(FBackGround) then
FBackGround.Parent := Parent;
end;
procedure TAnchorDesigner.SetSelectedControl(AValue: TAnchorControl);
begin
if FSelectedControl = AValue then Exit;
@ -853,7 +860,7 @@ constructor TAnchorDesigner.Create(ADesignForm: TDesignForm; AParent: TWinContro
begin
FState := [];
FDesignForm := ADesignForm;
FParent := AParent;
Parent := AParent;
FAnchorBarWidth := -1;
FDesignControl := FDesignForm.DesignWinControl;
FAnchorControls := TAnchorControls.Create;
@ -891,7 +898,7 @@ end;
procedure TAnchorDesigner.BeginUpdate;
begin
if not FParent.Visible then Exit;
if not Parent.Visible then Exit;
FAnchorGrips.Hide;
FBorderControl.Visible := False;
FAnchorControls.BeginUpdate;
@ -900,7 +907,7 @@ end;
procedure TAnchorDesigner.EndUpdate;
begin
if not FParent.Visible then Exit;
if not Parent.Visible then Exit;
FAnchorControls.EndUpdate;
if (FBackGround.Height <> FCurrentBounds.Height)
or (FBackGround.Width <> FCurrentBounds.Width) then

View File

@ -32,18 +32,29 @@ type
private
FOnDesignerSetFocus: TProcedureOfObject;
FOnMouseWheel: TMouseWheelEvent;
FParent: TWinControl;
public
procedure Abort; virtual; abstract;
procedure BeginUpdate; virtual; abstract;
procedure EndUpdate; virtual; abstract;
procedure Invalidate; virtual; abstract;
procedure Refresh; virtual; abstract;
procedure SetParent(AValue: TWinControl); virtual;
public
property OnDesignerSetFocus: TProcedureOfObject read FOnDesignerSetFocus write FOnDesignerSetFocus;
property OnMouseWheel: TMouseWheelEvent read FOnMouseWheel write FOnMouseWheel;
property Parent: TWinControl read FParent write SetParent;
end;
implementation
{ TBasicAnchorDesigner }
procedure TBasicAnchorDesigner.SetParent(AValue: TWinControl);
begin
if FParent = AValue then Exit;
FParent := AValue;
end;
end.

View File

@ -588,7 +588,7 @@ begin
// deactivate design tab in other source editor page control
for LSourceEditorWindow in SourceEditorWindows do
if LSourceEditorWindow.SourceEditorWindowInterface = LActiveSourceWindowInterface then
Continue
LPageCtrl.DesignForm := LDesignForm
else begin
for LSourceEditorPageControl in LSourceEditorWindow.PageControlList do
if (LSourceEditorPageControl.PageControl.DesignForm = LDesignForm) and (LSourceEditorPageControl.PageControl <> Sender) then

View File

@ -120,6 +120,8 @@ begin
FDesignForm.Form.Parent := ResizeFrame.PanelFormContainer;
FDesignForm.EndUpdate;
FDesignForm.OnChangeHackedBounds := @AdjustResizer;
if Assigned(FDesignForm.AnchorDesigner) then
FDesignForm.AnchorDesigner.Parent := ResizeFrame.PanelAnchorContainer;
end;
ResizeFrame.DesignForm := AValue;
end;