mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-19 16:00:16 +02:00
LCL: HighDPI: use relative font scaling, not the absolute PPI (fix for r54210 #eb28e06e83). Issue #31276
git-svn-id: trunk@54211 -
This commit is contained in:
parent
eb28e06e83
commit
592b495a47
@ -159,7 +159,7 @@ type
|
|||||||
procedure LMDrawItem(var Message: TLMDrawItems); message LM_DRAWITEM;
|
procedure LMDrawItem(var Message: TLMDrawItems); message LM_DRAWITEM;
|
||||||
|
|
||||||
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
||||||
const AXProportion, AYProportion: Double; const AToDPI: Integer); override;
|
const AXProportion, AYProportion: Double); override;
|
||||||
public
|
public
|
||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -1490,7 +1490,7 @@ type
|
|||||||
procedure DoItemChecked(AItem: TListItem);
|
procedure DoItemChecked(AItem: TListItem);
|
||||||
procedure DoSelectItem(AItem: TListItem; ASelected: Boolean); virtual;
|
procedure DoSelectItem(AItem: TListItem; ASelected: Boolean); virtual;
|
||||||
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
||||||
const AXProportion, AYProportion: Double; const AToDPI: Integer); override;
|
const AXProportion, AYProportion: Double); override;
|
||||||
procedure DoSetBounds(ALeft, ATop, AWidth, AHeight: integer); override;
|
procedure DoSetBounds(ALeft, ATop, AWidth, AHeight: integer); override;
|
||||||
|
|
||||||
procedure DoEndEdit(AItem: TListItem; const AValue: String); virtual;
|
procedure DoEndEdit(AItem: TListItem; const AValue: String); virtual;
|
||||||
@ -2252,7 +2252,7 @@ type
|
|||||||
Simulate: boolean): Boolean;
|
Simulate: boolean): Boolean;
|
||||||
procedure CNDropDownClosed(var Message: TLMessage); message CN_DROPDOWNCLOSED;
|
procedure CNDropDownClosed(var Message: TLMessage); message CN_DROPDOWNCLOSED;
|
||||||
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
||||||
const AXProportion, AYProportion: Double; const AToDPI: Integer); override;
|
const AXProportion, AYProportion: Double); override;
|
||||||
public
|
public
|
||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
@ -1419,7 +1419,7 @@ type
|
|||||||
class function GetControlClassDefaultSize: TSize; virtual;
|
class function GetControlClassDefaultSize: TSize; virtual;
|
||||||
function ColorIsStored: boolean; virtual;
|
function ColorIsStored: boolean; virtual;
|
||||||
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
||||||
const AXProportion, AYProportion: Double; const AToDPI: Integer); virtual;
|
const AXProportion, AYProportion: Double); virtual;
|
||||||
class procedure DoFixDesignFontPPI(const AFont: TFont; const ADesignTimePPI: Integer);
|
class procedure DoFixDesignFontPPI(const AFont: TFont; const ADesignTimePPI: Integer);
|
||||||
protected
|
protected
|
||||||
// actions
|
// actions
|
||||||
|
@ -549,7 +549,7 @@ type
|
|||||||
procedure CreateWnd; override;
|
procedure CreateWnd; override;
|
||||||
procedure Deactivate; virtual;
|
procedure Deactivate; virtual;
|
||||||
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
||||||
const AXProportion, AYProportion: Double; const AToDPI: Integer); override;
|
const AXProportion, AYProportion: Double); override;
|
||||||
procedure DoClose(var CloseAction: TCloseAction); virtual;
|
procedure DoClose(var CloseAction: TCloseAction); virtual;
|
||||||
procedure DoCreate; virtual;
|
procedure DoCreate; virtual;
|
||||||
procedure DoDestroy; virtual;
|
procedure DoDestroy; virtual;
|
||||||
|
@ -960,7 +960,7 @@ type
|
|||||||
function DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean; override;
|
function DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean; override;
|
||||||
function DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean; override;
|
function DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean; override;
|
||||||
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
||||||
const AXProportion, AYProportion: Double; const AToDPI: Integer); override;
|
const AXProportion, AYProportion: Double); override;
|
||||||
procedure DoOnChangeBounds; override;
|
procedure DoOnChangeBounds; override;
|
||||||
procedure DoOPDeleteColRow(IsColumn: Boolean; index: Integer);
|
procedure DoOPDeleteColRow(IsColumn: Boolean; index: Integer);
|
||||||
procedure DoOPExchangeColRow(IsColumn: Boolean; index, WithIndex: Integer);
|
procedure DoOPExchangeColRow(IsColumn: Boolean; index, WithIndex: Integer);
|
||||||
@ -6749,7 +6749,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomGrid.DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
procedure TCustomGrid.DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
||||||
const AXProportion, AYProportion: Double; const AToDPI: Integer);
|
const AXProportion, AYProportion: Double);
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
C: TGridColumn;
|
C: TGridColumn;
|
||||||
|
@ -179,7 +179,7 @@ type
|
|||||||
procedure SetTextHint(AValue: TTranslateString);
|
procedure SetTextHint(AValue: TTranslateString);
|
||||||
protected
|
protected
|
||||||
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
||||||
const AXProportion, AYProportion: Double; const AToDPI: Integer); override;
|
const AXProportion, AYProportion: Double); override;
|
||||||
procedure CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer;
|
procedure CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer;
|
||||||
WithThemeSpace: Boolean); override;
|
WithThemeSpace: Boolean); override;
|
||||||
function CreateBuddy: TControl; virtual;
|
function CreateBuddy: TControl; virtual;
|
||||||
@ -1246,8 +1246,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomAbstractGroupedEdit.DoAutoAdjustLayout(
|
procedure TCustomAbstractGroupedEdit.DoAutoAdjustLayout(
|
||||||
const AMode: TLayoutAdjustmentPolicy; const AXProportion,
|
const AMode: TLayoutAdjustmentPolicy; const AXProportion, AYProportion: Double
|
||||||
AYProportion: Double; const AToDPI: Integer);
|
);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
|
@ -2976,13 +2976,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TControl.DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
procedure TControl.DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
||||||
const AXProportion, AYProportion: Double; const AToDPI: Integer);
|
const AXProportion, AYProportion: Double);
|
||||||
var
|
var
|
||||||
AAWidth, AAHeight: Boolean;
|
AAWidth, AAHeight: Boolean;
|
||||||
NewLeft, NewTop, NewWidth, NewHeight, NewRight, NewBottom, OldWidth, OldHeight: Integer;
|
NewLeft, NewTop, NewWidth, NewHeight, NewRight, NewBottom, OldWidth, OldHeight: Integer;
|
||||||
begin
|
begin
|
||||||
if not ParentFont or (Parent=nil) then
|
if not ParentFont or (Parent=nil) then
|
||||||
Font.PixelsPerInch := AToDPI;
|
Font.PixelsPerInch := Round(Font.PixelsPerInch*AYProportion);
|
||||||
|
|
||||||
// Apply the changes
|
// Apply the changes
|
||||||
if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then
|
if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then
|
||||||
@ -4008,7 +4008,7 @@ begin
|
|||||||
if AFromDPI > 0 then lYProportion := AToDPI / AFromDPI
|
if AFromDPI > 0 then lYProportion := AToDPI / AFromDPI
|
||||||
else lYProportion := 1.0;
|
else lYProportion := 1.0;
|
||||||
|
|
||||||
DoAutoAdjustLayout(lMode, lXProportion, lYProportion, AToDPI);
|
DoAutoAdjustLayout(lMode, lXProportion, lYProportion);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Auto-adjust the layout of controls.
|
// Auto-adjust the layout of controls.
|
||||||
|
@ -1568,7 +1568,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomForm.DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
procedure TCustomForm.DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
||||||
const AXProportion, AYProportion: Double; const AToDPI: Integer);
|
const AXProportion, AYProportion: Double);
|
||||||
var
|
var
|
||||||
NewWidth, NewHeight, OldWidth, OldHeight: Integer;
|
NewWidth, NewHeight, OldWidth, OldHeight: Integer;
|
||||||
begin
|
begin
|
||||||
@ -1579,7 +1579,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
if not ParentFont or (Parent=nil) then
|
if not ParentFont or (Parent=nil) then
|
||||||
Font.PixelsPerInch := AToDPI;
|
Font.PixelsPerInch := Round(Font.PixelsPerInch*AYProportion);
|
||||||
|
|
||||||
// Apply the changes
|
// Apply the changes
|
||||||
if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then
|
if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then
|
||||||
|
@ -470,8 +470,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomListBox.DoAutoAdjustLayout(
|
procedure TCustomListBox.DoAutoAdjustLayout(
|
||||||
const AMode: TLayoutAdjustmentPolicy; const AXProportion,
|
const AMode: TLayoutAdjustmentPolicy; const AXProportion, AYProportion: Double
|
||||||
AYProportion: Double; const AToDPI: Integer);
|
);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
|
@ -612,8 +612,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomListView.DoAutoAdjustLayout(
|
procedure TCustomListView.DoAutoAdjustLayout(
|
||||||
const AMode: TLayoutAdjustmentPolicy; const AXProportion,
|
const AMode: TLayoutAdjustmentPolicy; const AXProportion, AYProportion: Double
|
||||||
AYProportion: Double; const AToDPI: Integer);
|
);
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
C: TListColumn;
|
C: TListColumn;
|
||||||
|
@ -148,7 +148,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TStatusBar.DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
procedure TStatusBar.DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
||||||
const AXProportion, AYProportion: Double; const AToDPI: Integer);
|
const AXProportion, AYProportion: Double);
|
||||||
var
|
var
|
||||||
I: Integer;
|
I: Integer;
|
||||||
begin
|
begin
|
||||||
|
@ -342,7 +342,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TToolBar.DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
procedure TToolBar.DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
||||||
const AXProportion, AYProportion: Double; const AToDPI: Integer);
|
const AXProportion, AYProportion: Double);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
|
@ -551,7 +551,7 @@ type
|
|||||||
procedure SetStyle(Val: TListBoxStyle); virtual;
|
procedure SetStyle(Val: TListBoxStyle); virtual;
|
||||||
procedure DrawItem(Index: Integer; ARect: TRect; State: TOwnerDrawState); virtual;
|
procedure DrawItem(Index: Integer; ARect: TRect; State: TOwnerDrawState); virtual;
|
||||||
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
||||||
const AXProportion, AYProportion: Double; const AToDPI: Integer); override;
|
const AXProportion, AYProportion: Double); override;
|
||||||
procedure DoSelectionChange(User: Boolean); virtual;
|
procedure DoSelectionChange(User: Boolean); virtual;
|
||||||
procedure SendItemIndex;
|
procedure SendItemIndex;
|
||||||
public
|
public
|
||||||
|
Loading…
Reference in New Issue
Block a user