KiCad PCB EDA Suite
|
Class to handle configuration and automatic determination of the DPI scale to use for canvases. More...
#include <dpi_scaling.h>
Public Member Functions | |
DPI_SCALING (COMMON_SETTINGS *aConfig, const wxWindow *aWindow) | |
Construct a DPI scale provider. More... | |
double | GetScaleFactor () const |
Get the DPI scale from all known sources in order: More... | |
double | GetContentScaleFactor () const |
Get the content scale factor, which may be different from the scale factor on some platforms. More... | |
bool | GetCanvasIsAutoScaled () const |
Is the current value auto scaled, or is it user-set in the config. More... | |
void | SetDpiConfig (bool aAuto, double aValue) |
Set the common DPI config in a given config object. More... | |
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. More... | |
Private Attributes | |
COMMON_SETTINGS * | m_config |
The configuration object to use to get/set user setting. More... | |
const wxWindow * | m_window |
The WX window to use for WX's automatic DPI checking. More... | |
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 36 of file dpi_scaling.h.
DPI_SCALING::DPI_SCALING | ( | 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 85 of file dpi_scaling.cpp.
bool DPI_SCALING::GetCanvasIsAutoScaled | ( | ) | const |
Is the current value auto scaled, or is it user-set in the config.
Definition at line 169 of file dpi_scaling.cpp.
References getKiCadConfiguredScale(), m_config, and traceHiDpi.
Referenced by PANEL_COMMON_SETTINGS::applySettingsToPanel().
double DPI_SCALING::GetContentScaleFactor | ( | ) | const |
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.
Definition at line 130 of file dpi_scaling.cpp.
References KIPLATFORM::UI::GetContentScaleFactor(), GetDefaultScaleFactor(), getEnvironmentScale(), getKiCadConfiguredScale(), m_config, m_window, and traceHiDpi.
Referenced by APPEARANCE_CONTROLS::APPEARANCE_CONTROLS(), COLOR_SWATCH::COLOR_SWATCH(), GBR_LAYER_BOX_SELECTOR::Resync(), and PCB_LAYER_BOX_SELECTOR::Resync().
|
static |
Get the "default" scaling factor to use if not other config is available.
Definition at line 207 of file dpi_scaling.cpp.
Referenced by GetContentScaleFactor(), GetScaleFactor(), and PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS().
|
static |
Definition at line 193 of file dpi_scaling.cpp.
Referenced by PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS().
|
static |
Definition at line 201 of file dpi_scaling.cpp.
Referenced by PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS().
double DPI_SCALING::GetScaleFactor | ( | ) | const |
Get the DPI scale from all known sources in order:
Definition at line 91 of file dpi_scaling.cpp.
References GetDefaultScaleFactor(), getEnvironmentScale(), getKiCadConfiguredScale(), KIPLATFORM::UI::GetPixelScaleFactor(), m_config, m_window, and traceHiDpi.
Referenced by PANEL_COMMON_SETTINGS::applySettingsToPanel(), APPEARANCE_CONTROLS::GetBestSize(), PANEL_COMMON_SETTINGS::OnCanvasScaleAuto(), LAYER_BOX_SELECTOR::ResyncBitmapOnly(), and KIGFX::GAL_DISPLAY_OPTIONS::UpdateScaleFactor().
void DPI_SCALING::SetDpiConfig | ( | bool | aAuto, |
double | aValue | ||
) |
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) |
Definition at line 183 of file dpi_scaling.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 103 of file dpi_scaling.h.
Referenced by GetCanvasIsAutoScaled(), GetContentScaleFactor(), GetScaleFactor(), and SetDpiConfig().
|
private |
The WX window to use for WX's automatic DPI checking.
Definition at line 108 of file dpi_scaling.h.
Referenced by GetContentScaleFactor(), and GetScaleFactor().