IDE: designer: fixed csDesignFixedBounds

git-svn-id: trunk@40153 -
This commit is contained in:
mattias 2013-02-03 11:51:16 +00:00
parent a49c504df0
commit 251a4c02ff

View File

@ -403,7 +403,7 @@ type
function OnlyNonVisualPersistentsSelected: boolean; function OnlyNonVisualPersistentsSelected: boolean;
function OnlyVisualComponentsSelected: boolean; function OnlyVisualComponentsSelected: boolean;
function OnlyInvisiblePersistentsSelected: boolean; function OnlyInvisiblePersistentsSelected: boolean;
function OnlyBoundLessComponentsSelected: boolean; function OnlyBoundlessComponentsSelected: boolean;
function LookupRootSelected: boolean; function LookupRootSelected: boolean;
// resizing, moving, aligning, mirroring, ... // resizing, moving, aligning, mirroring, ...
@ -1185,8 +1185,10 @@ var
i: integer; i: integer;
OldLeftTop: TPoint; OldLeftTop: TPoint;
NewLeft, NewTop, NewRight, NewBottom, NewWidth, NewHeight: integer; NewLeft, NewTop, NewRight, NewBottom, NewWidth, NewHeight: integer;
Item: TSelectedControl;
begin begin
BeginUpdate; BeginUpdate;
try
if Count=1 then begin if Count=1 then begin
// single selection // single selection
NewLeft:=FLeft; NewLeft:=FLeft;
@ -1198,14 +1200,18 @@ begin
DbgS(FOldLeft,FOldTop,FOldWidth,FOldHeight), DbgS(FOldLeft,FOldTop,FOldWidth,FOldHeight),
' User=',Dbgs(FLeft,FTop,FWidth,FHeight)); ' User=',Dbgs(FLeft,FTop,FWidth,FHeight));
{$ENDIF} {$ENDIF}
//DebugLn(['TControlSelection.DoApplyUserBounds BEFORE ',Items[0].Left,' ',Items[0].Top]); Item:=Items[0];
Items[0].SetFormRelativeBounds( //DebugLn(['TControlSelection.DoApplyUserBounds BEFORE ',Items.Left,' ',Items[0].Top]);
if Item.IsTComponent
and (not ComponentBoundsDesignable(TComponent(Item.Persistent))) then
exit;
Item.SetFormRelativeBounds(
Min(NewLeft,NewRight), Min(NewLeft,NewRight),
Min(NewTop,NewBottom), Min(NewTop,NewBottom),
Abs(FWidth), Abs(FWidth),
Abs(FHeight) Abs(FHeight)
); );
//DebugLn(['TControlSelection.DoApplyUserBounds AFTER ',Items[0].Left,' ',Items[0].Top]); //DebugLn(['TControlSelection.DoApplyUserBounds AFTER ',Items.Left,' ',Items[0].Top]);
InvalidateGuideLinesCache; InvalidateGuideLinesCache;
end else if Count>1 then begin end else if Count>1 then begin
// multi selection // multi selection
@ -1219,11 +1225,15 @@ begin
if (FOldWidth<>0) and (FOldHeight<>0) then begin if (FOldWidth<>0) and (FOldHeight<>0) then begin
for i:=0 to Count-1 do begin for i:=0 to Count-1 do begin
Item:=Items[i];
if Item.IsTComponent
and (not ComponentBoundsDesignable(TComponent(Item.Persistent))) then
continue;
OldLeftTop:=Items[i].OldFormRelativeLeftTop; OldLeftTop:=Items[i].OldFormRelativeLeftTop;
NewLeft:=FLeft + (((OldLeftTop.X-FOldLeft) * FWidth) div FOldWidth); NewLeft:=FLeft + (((OldLeftTop.X-FOldLeft) * FWidth) div FOldWidth);
NewTop:=FTop + (((OldLeftTop.Y-FOldTop) * FHeight) div FOldHeight); NewTop:=FTop + (((OldLeftTop.Y-FOldTop) * FHeight) div FOldHeight);
NewWidth:=(Items[i].OldWidth*FWidth) div FOldWidth; NewWidth:=(Item.OldWidth*FWidth) div FOldWidth;
NewHeight:=(Items[i].OldHeight*FHeight) div FOldHeight; NewHeight:=(Item.OldHeight*FHeight) div FOldHeight;
if NewWidth<0 then begin if NewWidth<0 then begin
NewWidth:=-NewWidth; NewWidth:=-NewWidth;
dec(NewLeft,NewWidth); dec(NewLeft,NewWidth);
@ -1234,18 +1244,20 @@ begin
dec(NewTop,NewHeight); dec(NewTop,NewHeight);
end; end;
if NewHeight<1 then NewHeight:=1; if NewHeight<1 then NewHeight:=1;
Items[i].SetFormRelativeBounds(NewLeft,NewTop,NewWidth,NewHeight); Item.SetFormRelativeBounds(NewLeft,NewTop,NewWidth,NewHeight);
{$IFDEF VerboseDesigner} {$IFDEF VerboseDesigner}
DebugLn(' i=',Dbgs(i),' ',DbgSName(Items[i].Persistent), DebugLn(' i=',Dbgs(i),' ',DbgSName(Item.Persistent),
' ',DbgS(Items[i].Left,Items[i].Top,Items[i].Width,Items[i].Height)); ' ',DbgS(Item.Left,Item.Top,Item.Width,Item.Height));
{$ENDIF} {$ENDIF}
end; end;
InvalidateGuideLinesCache; InvalidateGuideLinesCache;
end; end;
end; end;
finally
UpdateBounds; UpdateBounds;
EndUpdate; EndUpdate;
end; end;
end;
procedure TControlSelection.UpdateRealBounds; procedure TControlSelection.UpdateRealBounds;
var var
@ -2722,7 +2734,7 @@ begin
Result:=cssOnlyInvisibleSelected in FStates; Result:=cssOnlyInvisibleSelected in FStates;
end; end;
function TControlSelection.OnlyBoundLessComponentsSelected: boolean; function TControlSelection.OnlyBoundlessComponentsSelected: boolean;
var var
i: Integer; i: Integer;
begin begin