KiCad PCB EDA Suite
Loading...
Searching...
No Matches
DPI_SCALING_COMMON Class Reference

Class to handle configuration and automatic determination of the DPI scale to use for canvases. More...

#include <dpi_scaling_common.h>

Inheritance diagram for DPI_SCALING_COMMON:
DPI_SCALING

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_SETTINGSm_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.
 

Detailed Description

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 37 of file dpi_scaling_common.h.

Constructor & Destructor Documentation

◆ DPI_SCALING_COMMON()

DPI_SCALING_COMMON::DPI_SCALING_COMMON ( COMMON_SETTINGS aConfig,
const wxWindow *  aWindow 
)

Construct a DPI scale provider.

Parameters
aConfigthe config store to check for a user value (can be nullptr, in which case on automatically determined values are considered)
aWindowa WX window to use for automatic DPI determination
Returns
the scaling factor (1.0 = no scaling)

Definition at line 86 of file dpi_scaling_common.cpp.

Member Function Documentation

◆ GetCanvasIsAutoScaled()

bool DPI_SCALING_COMMON::GetCanvasIsAutoScaled ( ) const
overridevirtual

Is the current value auto scaled, or is it user-set in the config.

Implements DPI_SCALING.

Definition at line 170 of file dpi_scaling_common.cpp.

References getKiCadConfiguredScale(), m_config, and traceHiDpi.

Referenced by PANEL_COMMON_SETTINGS::applySettingsToPanel().

◆ GetContentScaleFactor()

double DPI_SCALING_COMMON::GetContentScaleFactor ( ) const
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 131 of file dpi_scaling_common.cpp.

References KIPLATFORM::UI::GetContentScaleFactor(), DPI_SCALING::GetDefaultScaleFactor(), getEnvironmentScale(), getKiCadConfiguredScale(), m_config, m_window, and traceHiDpi.

Referenced by APPEARANCE_CONTROLS::APPEARANCE_CONTROLS(), APPEARANCE_CONTROLS_3D::APPEARANCE_CONTROLS_3D(), COLOR_SWATCH::COLOR_SWATCH(), GBR_LAYER_BOX_SELECTOR::Resync(), PCB_LAYER_BOX_SELECTOR::Resync(), and WX_INFOBAR::WX_INFOBAR().

◆ GetDefaultScaleFactor()

double DPI_SCALING::GetDefaultScaleFactor ( )
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().

◆ GetMaxScaleFactor()

double DPI_SCALING::GetMaxScaleFactor ( )
staticinherited

Definition at line 27 of file dpi_scaling.cpp.

Referenced by PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS().

◆ GetMinScaleFactor()

double DPI_SCALING::GetMinScaleFactor ( )
staticinherited

Definition at line 35 of file dpi_scaling.cpp.

Referenced by PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS().

◆ GetScaleFactor()

double DPI_SCALING_COMMON::GetScaleFactor ( ) const
overridevirtual

◆ SetDpiConfig()

void DPI_SCALING_COMMON::SetDpiConfig ( bool  aAuto,
double  aValue 
)
overridevirtual

Set the common DPI config in a given config object.

The encoding of the automatic/manual nature of the config is handled internally.

Parameters
aAutostore a value meaning "no user-set scale"
aValuethe value to store (ignored if aAuto set)

Implements DPI_SCALING.

Definition at line 184 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().

Member Data Documentation

◆ m_config

COMMON_SETTINGS* DPI_SCALING_COMMON::m_config
private

The configuration object to use to get/set user setting.

nullptr if only automatic options are wanted

Definition at line 87 of file dpi_scaling_common.h.

Referenced by GetCanvasIsAutoScaled(), GetContentScaleFactor(), GetScaleFactor(), and SetDpiConfig().

◆ m_window

const wxWindow* DPI_SCALING_COMMON::m_window
private

The WX window to use for WX's automatic DPI checking.

Definition at line 92 of file dpi_scaling_common.h.

Referenced by GetContentScaleFactor(), and GetScaleFactor().


The documentation for this class was generated from the following files: