IDE; anchoreditor: less annoying circle checks

git-svn-id: trunk@26280 -
This commit is contained in:
mattias 2010-06-24 12:17:43 +00:00
parent 5f8cbd5a41
commit 2bd8a3a414

View File

@ -284,6 +284,9 @@ var
SelectedControls: TList; SelectedControls: TList;
i: Integer; i: Integer;
CurControl: TControl; CurControl: TControl;
ReferenceControl: TControl;
ReferenceSide: TAnchorSideReference;
CheckPosition: Integer;
begin begin
//debugln('TAnchorDesigner.AnchorEnabledCheckBoxChange ',DbgSName(Sender),' ',dbgs(TCheckBox(Sender).Checked)); //debugln('TAnchorDesigner.AnchorEnabledCheckBoxChange ',DbgSName(Sender),' ',dbgs(TCheckBox(Sender).Checked));
if FUpdating or (Values=nil) then exit; if FUpdating or (Values=nil) then exit;
@ -305,6 +308,27 @@ begin
// user changed an anchor // user changed an anchor
SelectedControls:=GetSelectedControls; SelectedControls:=GetSelectedControls;
if SelectedControls=nil then exit; 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 for i:=0 to SelectedControls.Count-1 do begin
CurControl:=TControl(SelectedControls[i]); CurControl:=TControl(SelectedControls[i]);
if NewValue then if NewValue then
@ -508,9 +532,10 @@ begin
NewSibling:=findNeighbour(i); NewSibling:=findNeighbour(i);
if (NewSibling=nil) and (i<>0) then continue; if (NewSibling=nil) and (i<>0) then continue;
end; end;
if not CurControl.AnchorSide[Kind].CheckSidePosition(NewSibling, if (Kind in CurControl.Anchors)
and (not CurControl.AnchorSide[Kind].CheckSidePosition(NewSibling,
CurControl.AnchorSide[Kind].Side, CurControl.AnchorSide[Kind].Side,
ReferenceControl,ReferenceSide,CheckPosition) ReferenceControl,ReferenceSide,CheckPosition))
then begin then begin
if MessageDlg(lisCCOWarningCaption, if MessageDlg(lisCCOWarningCaption,
lisThisWillCreateACircle, mtWarning, [mbIgnore, mbCancel], 0)<> lisThisWillCreateACircle, mtWarning, [mbIgnore, mbCancel], 0)<>
@ -519,6 +544,7 @@ begin
Refresh(false); Refresh(false);
exit; exit;
end; end;
break;
end; end;
end; end;
// commit // commit
@ -617,9 +643,10 @@ begin
// check // check
for i:=0 to SelectedControls.Count-1 do begin for i:=0 to SelectedControls.Count-1 do begin
CurControl:=TControl(SelectedControls[i]); 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, CurControl.AnchorSide[Kind].Control,Side,
ReferenceControl,ReferenceSide,CheckPosition) ReferenceControl,ReferenceSide,CheckPosition))
then begin then begin
if MessageDlg(lisCCOWarningCaption, if MessageDlg(lisCCOWarningCaption,
lisThisWillCreateACircle, mtWarning, [mbIgnore, mbCancel], 0)<> lisThisWillCreateACircle, mtWarning, [mbIgnore, mbCancel], 0)<>
@ -628,6 +655,7 @@ begin
Refresh(false); Refresh(false);
exit; exit;
end; end;
break;
end; end;
end; end;
// commit // commit