42const wxChar*
const traceHiDpi = wxT(
"KICAD_TRACE_HIGH_DPI" );
52 std::optional<double>
scale;
55 if( canvas_scale > 0.0 )
72 const wxPortId port_id = wxPlatformInfo::Get().GetPortId();
73 std::optional<double>
scale;
75 if( port_id == wxPORT_GTK )
78 scale = ENV_VAR::GetEnvVar<double>( wxS(
"GDK_SCALE" ) );
86 : m_config( aConfig ), m_window( aWindow )
93 std::optional<double> val;
99 src = wxS(
"config" );
114 src = wxS(
"platform" );
121 src = wxS(
"default" );
124 wxLogTrace(
traceHiDpi, wxS(
"Scale factor (%s): %f" ), src, *val );
132 std::optional<double> val;
138 src = wxS(
"config" );
153 src = wxS(
"platform" );
160 src = wxS(
"default" );
163 wxLogTrace(
traceHiDpi, wxS(
"Content scale factor (%s): %f" ), src, *val );
178 wxLogTrace(
traceHiDpi, wxS(
"Scale is automatic: %d" ), automatic );
185 wxCHECK_RET(
m_config !=
nullptr, wxS(
"Setting DPI config without a config store." ) );
187 const double value = aAuto ? 0.0 : aValue;
double GetScaleFactor() const
Get the DPI scale from all known sources in order:
void SetDpiConfig(bool aAuto, double aValue)
Set the common DPI config in a given config object.
double GetContentScaleFactor() const
Get the content scale factor, which may be different from the scale factor on some platforms.
DPI_SCALING(COMMON_SETTINGS *aConfig, const wxWindow *aWindow)
Construct a DPI scale provider.
COMMON_SETTINGS * m_config
The configuration object to use to get/set user setting.
static double GetDefaultScaleFactor()
Get the "default" scaling factor to use if not other config is available.
const wxWindow * m_window
The WX window to use for WX's automatic DPI checking.
static double GetMaxScaleFactor()
bool GetCanvasIsAutoScaled() const
Is the current value auto scaled, or is it user-set in the config.
static double GetMinScaleFactor()
static std::optional< double > getKiCadConfiguredScale(const COMMON_SETTINGS &aConfig)
Get a user-configured scale factor from KiCad config file.
static std::optional< double > getEnvironmentScale()
Get the toolkit scale factor from a user-set environment variable (for example GDK_SCALE on GTK).
Functions related to environment variables, including help functions.
const wxChar *const traceHiDpi
Flag to enable trace for HiDPI scaling factors.