lcl: controls: highDPI: add AScaleFonts parameter to AutoAdjustLayout

git-svn-id: trunk@53516 -
This commit is contained in:
ondrej 2016-12-01 22:43:50 +00:00
parent e5ef90de53
commit c186773b00
3 changed files with 14 additions and 7 deletions

View File

@ -1523,7 +1523,8 @@ type
property BaseParentClientSize: TSize read FBaseParentClientSize;
procedure WriteLayoutDebugReport(const Prefix: string); virtual;
procedure AutoAdjustLayout(AMode: TLayoutAdjustmentPolicy;
const AFromDPI, AToDPI, AOldFormWidth, ANewFormWidth: Integer); virtual;
const AFromDPI, AToDPI, AOldFormWidth, ANewFormWidth: Integer;
const AScaleFonts: Boolean); virtual;
function ShouldAutoAdjustLeftAndTop: Boolean; virtual;
function ShouldAutoAdjustWidthAndHeight: Boolean; virtual;
public
@ -2195,8 +2196,9 @@ type
procedure ScrollBy_WS(DeltaX, DeltaY: Integer);
procedure ScrollBy(DeltaX, DeltaY: Integer); virtual;
procedure WriteLayoutDebugReport(const Prefix: string); override;
procedure AutoAdjustLayout(AMode: TLayoutAdjustmentPolicy;
const AFromDPI, AToDPI, AOldFormWidth, ANewFormWidth: Integer); override;
procedure AutoAdjustLayout(AMode: TLayoutAdjustmentPolicy; const AFromDPI,
AToDPI, AOldFormWidth, ANewFormWidth: Integer;
const AScaleFonts: Boolean); override;
public
constructor Create(TheOwner: TComponent);override;
constructor CreateParented(AParentWindow: HWND);

View File

@ -3834,7 +3834,8 @@ begin
end;
procedure TControl.AutoAdjustLayout(AMode: TLayoutAdjustmentPolicy;
const AFromDPI, AToDPI, AOldFormWidth, ANewFormWidth: Integer);
const AFromDPI, AToDPI, AOldFormWidth, ANewFormWidth: Integer;
const AScaleFonts: Boolean);
var
lXProportion, lYProportion: Double;
NewLeft, NewTop, NewHeight, NewWidth: Integer;
@ -3859,6 +3860,9 @@ begin
if AFromDPI > 0 then lYProportion := AToDPI / AFromDPI
else lYProportion := 1.0;
if AScaleFonts and not ParentFont then
Font.Height := Round(GetFontData(Font.Reference.Handle).Height*lYProportion);
// Apply the changes
if lMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then
begin

View File

@ -3836,14 +3836,15 @@ begin
end;
procedure TWinControl.AutoAdjustLayout(AMode: TLayoutAdjustmentPolicy;
const AFromDPI, AToDPI, AOldFormWidth, ANewFormWidth: Integer);
const AFromDPI, AToDPI, AOldFormWidth, ANewFormWidth: Integer;
const AScaleFonts: Boolean);
var
i: Integer;
begin
inherited AutoAdjustLayout(AMode, AFromDPI, AToDPI, AOldFormWidth, ANewFormWidth);
inherited AutoAdjustLayout(AMode, AFromDPI, AToDPI, AOldFormWidth, ANewFormWidth, AScaleFonts);
for i:=0 to ControlCount-1 do
Controls[i].AutoAdjustLayout(AMode, AFromDPI, AToDPI, AOldFormWidth, ANewFormWidth);
Controls[i].AutoAdjustLayout(AMode, AFromDPI, AToDPI, AOldFormWidth, ANewFormWidth, AScaleFonts);
end;
{------------------------------------------------------------------------------