IDE: designer: High-DPI: selection grabber. Issue #32397

git-svn-id: trunk@56001 -
This commit is contained in:
ondrej 2017-10-09 07:08:51 +00:00
parent f0349db72b
commit c4eba5ff15

View File

@ -372,6 +372,7 @@ type
function GetBottomGuideLine(var ALine: TRect): boolean; function GetBottomGuideLine(var ALine: TRect): boolean;
function GetLeftGuideLine(var ALine: TRect): boolean; function GetLeftGuideLine(var ALine: TRect): boolean;
function GetRightGuideLine(var ALine: TRect): boolean; function GetRightGuideLine(var ALine: TRect): boolean;
function GetRealGrabberSize: integer;
function GetTopGuideLine(var ALine: TRect): boolean; function GetTopGuideLine(var ALine: TRect): boolean;
procedure FindNearestBottomGuideLine(var NearestInt: TNearestInt); procedure FindNearestBottomGuideLine(var NearestInt: TNearestInt);
procedure FindNearestClientLeftRight(var NearestInt: TNearestInt); procedure FindNearestClientLeftRight(var NearestInt: TNearestInt);
@ -1232,23 +1233,23 @@ procedure TControlSelection.AdjustGrabbers;
var g:TGrabIndex; var g:TGrabIndex;
OutPix, InPix, NewGrabberLeft, NewGrabberTop: integer; OutPix, InPix, NewGrabberLeft, NewGrabberTop: integer;
begin begin
OutPix:=GrabberSize div 2; OutPix:=GetRealGrabberSize div 2;
InPix:=GrabberSize-OutPix; InPix:=GetRealGrabberSize-OutPix;
for g:=Low(TGrabIndex) to High(TGrabIndex) do begin for g:=Low(TGrabIndex) to High(TGrabIndex) do begin
if gpLeft in FGrabbers[g].Positions then if gpLeft in FGrabbers[g].Positions then
NewGrabberLeft:=FRealLeft-OutPix NewGrabberLeft:=FRealLeft-OutPix
else if gpRight in FGrabbers[g].Positions then else if gpRight in FGrabbers[g].Positions then
NewGrabberLeft:=FRealLeft+FRealWidth-InPix NewGrabberLeft:=FRealLeft+FRealWidth-InPix
else else
NewGrabberLeft:=FRealLeft+((FRealWidth-GrabberSize) div 2); NewGrabberLeft:=FRealLeft+((FRealWidth-GetRealGrabberSize) div 2);
if gpTop in FGrabbers[g].Positions then if gpTop in FGrabbers[g].Positions then
NewGrabberTop:=FRealTop-OutPix NewGrabberTop:=FRealTop-OutPix
else if gpBottom in FGrabbers[g].Positions then else if gpBottom in FGrabbers[g].Positions then
NewGrabberTop:=FRealTop+FRealHeight-InPix NewGrabberTop:=FRealTop+FRealHeight-InPix
else else
NewGrabberTop:=FRealTop+((FRealHeight-GrabberSize) div 2); NewGrabberTop:=FRealTop+((FRealHeight-GetRealGrabberSize) div 2);
FGrabbers[g].Width:=GrabberSize; FGrabbers[g].Width:=GetRealGrabberSize;
FGrabbers[g].Height:=GrabberSize; FGrabbers[g].Height:=GetRealGrabberSize;
FGrabbers[g].Move(NewGrabberLeft,NewGrabberTop); FGrabbers[g].Move(NewGrabberLeft,NewGrabberTop);
end; end;
end; end;
@ -2160,6 +2161,13 @@ begin
Result := DesignerProcs.GetParentFormRelativeBounds(AComponent); Result := DesignerProcs.GetParentFormRelativeBounds(AComponent);
end; end;
function TControlSelection.GetRealGrabberSize: integer;
begin
Result := FGrabberSize;
if Assigned(FForm) and Application.Scaled then
Result := FForm.Scale96ToScreen(FGrabberSize);
end;
function TControlSelection.GetItems(Index:integer):TSelectedControl; function TControlSelection.GetItems(Index:integer):TSelectedControl;
begin begin
Result:=TSelectedControl(FControls[Index]); Result:=TSelectedControl(FControls[Index]);