42 const wxChar*
const traceHiDpi = wxT(
"KICAD_TRACE_HIGH_DPI" );
55 if( canvas_scale > 0.0 )
62 wxLogTrace(
traceHiDpi, wxT(
"Scale factor (configured): %f" ), *
scale );
77 const wxPortId port_id = wxPlatformInfo::Get().GetPortId();
80 if( port_id == wxPORT_GTK )
83 scale = ENV_VAR::GetEnvVar<double>(
"GDK_SCALE" );
88 wxLogTrace(
traceHiDpi, wxT(
"Scale factor (environment): %f" ), *
scale );
96 : m_config( aConfig ), m_window( aWindow )
121 wxLogTrace(
traceHiDpi, wxT(
"Scale factor (WX): %f" ), *val );
128 wxLogTrace(
traceHiDpi, wxT(
"Scale factor (default): %f" ), *val );
144 wxLogTrace(
traceHiDpi, wxT(
"Scale is automatic: %d" ), automatic );
151 wxCHECK_RET(
m_config !=
nullptr, wxT(
"Setting DPI config without a config store." ) );
153 const double value = aAuto ? 0.0 : aValue;
DPI_SCALING(COMMON_SETTINGS *aConfig, const wxWindow *aWindow)
Construct a DPI scale provider.
static double GetDefaultScaleFactor()
Get the "default" scaling factor to use if not other config is available.
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.
static double GetMaxScaleFactor()
static double GetMinScaleFactor()
const wxChar *const traceHiDpi
Flag to enable trace for HiDPI scaling factors.
static OPT< double > getKiCadConfiguredScale(const COMMON_SETTINGS &aConfig)
Get a user-configured scale factor from KiCad config file.
static OPT< 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 wxWindow * m_window
The WX window to use for WX's automatic DPI checking.
COMMON_SETTINGS * m_config
The configuration object to use to get/set user setting.
bool GetCanvasIsAutoScaled() const
Is the current value auto scaled, or is it user-set in the config.