From 2bd8a3a41406c449d9e234f71269ca7a72581d32 Mon Sep 17 00:00:00 2001 From: mattias Date: Thu, 24 Jun 2010 12:17:43 +0000 Subject: [PATCH] IDE; anchoreditor: less annoying circle checks git-svn-id: trunk@26280 - --- designer/anchoreditor.pas | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/designer/anchoreditor.pas b/designer/anchoreditor.pas index 66c7c44caa..78e4464b7a 100644 --- a/designer/anchoreditor.pas +++ b/designer/anchoreditor.pas @@ -284,6 +284,9 @@ var SelectedControls: TList; i: Integer; CurControl: TControl; + ReferenceControl: TControl; + ReferenceSide: TAnchorSideReference; + CheckPosition: Integer; begin //debugln('TAnchorDesigner.AnchorEnabledCheckBoxChange ',DbgSName(Sender),' ',dbgs(TCheckBox(Sender).Checked)); if FUpdating or (Values=nil) then exit; @@ -305,6 +308,27 @@ begin // user changed an anchor SelectedControls:=GetSelectedControls; if SelectedControls=nil then exit; + + // check + for i:=0 to SelectedControls.Count-1 do begin + CurControl:=TControl(SelectedControls[i]); + if NewValue and (not CurControl.AnchorSide[Kind].CheckSidePosition( + CurControl.AnchorSide[Kind].Control, + CurControl.AnchorSide[Kind].Side, + ReferenceControl,ReferenceSide,CheckPosition)) + then begin + if MessageDlg(lisCCOWarningCaption, + lisThisWillCreateACircle, mtWarning, [mbIgnore, mbCancel], 0)<> + mrIgnore + then begin + Refresh(false); + exit; + end; + break; + end; + end; + + // commit for i:=0 to SelectedControls.Count-1 do begin CurControl:=TControl(SelectedControls[i]); if NewValue then @@ -508,9 +532,10 @@ begin NewSibling:=findNeighbour(i); if (NewSibling=nil) and (i<>0) then continue; end; - if not CurControl.AnchorSide[Kind].CheckSidePosition(NewSibling, + if (Kind in CurControl.Anchors) + and (not CurControl.AnchorSide[Kind].CheckSidePosition(NewSibling, CurControl.AnchorSide[Kind].Side, - ReferenceControl,ReferenceSide,CheckPosition) + ReferenceControl,ReferenceSide,CheckPosition)) then begin if MessageDlg(lisCCOWarningCaption, lisThisWillCreateACircle, mtWarning, [mbIgnore, mbCancel], 0)<> @@ -519,6 +544,7 @@ begin Refresh(false); exit; end; + break; end; end; // commit @@ -617,9 +643,10 @@ begin // check for i:=0 to SelectedControls.Count-1 do begin CurControl:=TControl(SelectedControls[i]); - if not CurControl.AnchorSide[Kind].CheckSidePosition( + if (Kind in CurControl.Anchors) + and (not CurControl.AnchorSide[Kind].CheckSidePosition( CurControl.AnchorSide[Kind].Control,Side, - ReferenceControl,ReferenceSide,CheckPosition) + ReferenceControl,ReferenceSide,CheckPosition)) then begin if MessageDlg(lisCCOWarningCaption, lisThisWillCreateACircle, mtWarning, [mbIgnore, mbCancel], 0)<> @@ -628,6 +655,7 @@ begin Refresh(false); exit; end; + break; end; end; // commit