43const wxChar*
const traceHiDpi = wxT(
"KICAD_TRACE_HIGH_DPI" );
53 std::optional<double>
scale;
56 if( canvas_scale > 0.0 )
73 const wxPortId port_id = wxPlatformInfo::Get().GetPortId();
74 std::optional<double>
scale;
76 if( port_id == wxPORT_GTK )
79 scale = ENV_VAR::GetEnvVar<double>( wxS(
"GDK_SCALE" ) );
95 std::optional<double> val;
101 src = wxS(
"config" );
116 src = wxS(
"platform" );
123 src = wxS(
"default" );
126 wxLogTrace(
traceHiDpi, wxS(
"Scale factor (%s): %f" ), src, *val );
134 std::optional<double> val;
140 src = wxS(
"config" );
155 src = wxS(
"platform" );
162 src = wxS(
"default" );
165 wxLogTrace(
traceHiDpi, wxS(
"Content scale factor (%s): %f" ), src, *val );
180 wxLogTrace(
traceHiDpi, wxS(
"Scale is automatic: %d" ), automatic );
187 wxCHECK_RET(
m_config !=
nullptr, wxS(
"Setting DPI config without a config store." ) );
189 const double value = aAuto ? 0.0 : aValue;
const wxWindow * m_window
The WX window to use for WX's automatic DPI checking.
bool GetCanvasIsAutoScaled() const override
Is the current value auto scaled, or is it user-set in the config.
double GetContentScaleFactor() const override
Get the content scale factor, which may be different from the scale factor on some platforms.
double GetScaleFactor() const override
Get the DPI scale from all known sources in order:
void SetDpiConfig(bool aAuto, double aValue) override
Set the common DPI config in a given config object.
DPI_SCALING_COMMON(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.
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.