KiCad PCB EDA Suite
|
Class to handle configuration and automatic determination of the DPI scale to use for canvases. More...
#include <dpi_scaling_common.h>
Public Member Functions | |
DPI_SCALING_COMMON (COMMON_SETTINGS *aConfig, const wxWindow *aWindow) | |
Construct a DPI scale provider. | |
double | GetScaleFactor () const override |
Get the DPI scale from all known sources in order: | |
double | GetContentScaleFactor () const override |
Get the content scale factor, which may be different from the scale factor on some platforms. | |
bool | GetCanvasIsAutoScaled () const override |
Is the current value auto scaled, or is it user-set in the config. | |
void | SetDpiConfig (bool aAuto, double aValue) override |
Set the common DPI config in a given config object. | |
Static Public Member Functions | |
static double | GetMaxScaleFactor () |
static double | GetMinScaleFactor () |
static double | GetDefaultScaleFactor () |
Get the "default" scaling factor to use if not other config is available. | |
Private Attributes | |
COMMON_SETTINGS * | m_config |
The configuration object to use to get/set user setting. | |
const wxWindow * | m_window |
The WX window to use for WX's automatic DPI checking. | |
Class to handle configuration and automatic determination of the DPI scale to use for canvases.
This has several sources and the availability of some of them are platform dependent.
Definition at line 38 of file dpi_scaling_common.h.
DPI_SCALING_COMMON::DPI_SCALING_COMMON | ( | COMMON_SETTINGS * | aConfig, |
const wxWindow * | aWindow | ||
) |
Construct a DPI scale provider.
aConfig | the config store to check for a user value (can be nullptr, in which case on automatically determined values are considered) |
aWindow | a WX window to use for automatic DPI determination |
Definition at line 86 of file dpi_scaling_common.cpp.
|
overridevirtual |
Is the current value auto scaled, or is it user-set in the config.
Implements DPI_SCALING.
Definition at line 171 of file dpi_scaling_common.cpp.
References getKiCadConfiguredScale(), m_config, and traceHiDpi.
Referenced by PANEL_COMMON_SETTINGS::applySettingsToPanel().
|
overridevirtual |
Get the content scale factor, which may be different from the scale factor on some platforms.
This value should be used for scaling user interface elements (fonts, icons, etc) whereas the scale factor should be used for scaling canvases.
Implements DPI_SCALING.
Definition at line 132 of file dpi_scaling_common.cpp.
References KIPLATFORM::UI::GetContentScaleFactor(), DPI_SCALING::GetDefaultScaleFactor(), getEnvironmentScale(), getKiCadConfiguredScale(), m_config, m_window, and traceHiDpi.
Referenced by EDA_DRAW_PANEL_GAL::SetCurrentCursor(), and WX_INFOBAR::WX_INFOBAR().
|
staticinherited |
Get the "default" scaling factor to use if not other config is available.
Definition at line 42 of file dpi_scaling.cpp.
Referenced by GetContentScaleFactor(), GetScaleFactor(), and PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS().
|
staticinherited |
Definition at line 27 of file dpi_scaling.cpp.
Referenced by PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS().
|
staticinherited |
Definition at line 35 of file dpi_scaling.cpp.
Referenced by PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS().
|
overridevirtual |
Get the DPI scale from all known sources in order:
Implements DPI_SCALING.
Definition at line 93 of file dpi_scaling_common.cpp.
References DPI_SCALING::GetDefaultScaleFactor(), getEnvironmentScale(), getKiCadConfiguredScale(), KIPLATFORM::UI::GetPixelScaleFactor(), m_config, m_window, and traceHiDpi.
Referenced by PANEL_COMMON_SETTINGS::applySettingsToPanel(), PCB_TEST_FRAME_BASE::createView(), APPEARANCE_CONTROLS_3D::GetBestSize(), APPEARANCE_CONTROLS::GetBestSize(), PANEL_COMMON_SETTINGS::OnCanvasScaleAuto(), and GAL_DISPLAY_OPTIONS_IMPL::UpdateScaleFactor().
|
overridevirtual |
Set the common DPI config in a given config object.
The encoding of the automatic/manual nature of the config is handled internally.
aAuto | store a value meaning "no user-set scale" |
aValue | the value to store (ignored if aAuto set) |
Implements DPI_SCALING.
Definition at line 185 of file dpi_scaling_common.cpp.
References COMMON_SETTINGS::APPEARANCE::canvas_scale, COMMON_SETTINGS::m_Appearance, and m_config.
Referenced by PANEL_COMMON_SETTINGS::TransferDataFromWindow().
|
private |
The configuration object to use to get/set user setting.
nullptr if only automatic options are wanted
Definition at line 88 of file dpi_scaling_common.h.
Referenced by GetCanvasIsAutoScaled(), GetContentScaleFactor(), GetScaleFactor(), and SetDpiConfig().
|
private |
The WX window to use for WX's automatic DPI checking.
Definition at line 93 of file dpi_scaling_common.h.
Referenced by GetContentScaleFactor(), and GetScaleFactor().