KiCad PCB EDA Suite
Loading...
Searching...
No Matches
gal_display_options_common.cpp
Go to the documentation of this file.
1/*
2* This program source code file is part of KICAD, a free EDA CAD application.
3*
4* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5*
6* This program is free software; you can redistribute it and/or
7* modify it under the terms of the GNU General Public License
8* as published by the Free Software Foundation; either version 2
9* of the License, or (at your option) any later version.
10*
11* This program is distributed in the hope that it will be useful,
12* but WITHOUT ANY WARRANTY; without even the implied warranty of
13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14* GNU General Public License for more details.
15*
16* You should have received a copy of the GNU General Public License
17* along with this program. If not, see <https://www.gnu.org/licenses/>.
18*/
19
23
24#include <wx/log.h>
25
26#include <config_map.h>
27#include <dpi_scaling_common.h>
28
29using namespace KIGFX;
30
38static const wxChar* traceGalDispOpts = wxT( "KICAD_GAL_DISPLAY_OPTIONS" );
39
40
46
52
58
59
75
76
78{
79 wxLogTrace( traceGalDispOpts, wxS( "Reading common config" ) );
80
82 static_cast<KIGFX::GAL_ANTIALIASING_MODE>( aSettings.m_Graphics.aa_mode );
83
84 m_dpi = DPI_SCALING_COMMON( &aSettings, aWindow );
86
88}
89
90
92 WINDOW_SETTINGS& aWindowConfig, wxWindow* aWindow )
93{
94 wxLogTrace( traceGalDispOpts, wxS( "Reading common and app config" ) );
95
96 ReadWindowSettings( aWindowConfig );
97
98 ReadCommonConfig( aCommonConfig, aWindow );
99}
100
101
114
115
117{
118 if( m_scaleFactor != m_dpi.GetScaleFactor() )
119 {
120 m_scaleFactor = m_dpi.GetScaleFactor();
122 }
123}
Class to handle configuration and automatic determination of the DPI scale to use for canvases.
void ReadWindowSettings(WINDOW_SETTINGS &aCfg)
Read GAL config options from application-level config.
void ReadConfig(COMMON_SETTINGS &aCommonConfig, WINDOW_SETTINGS &aWindowConfig, wxWindow *aWindow)
Read application and common configs.
void ReadCommonConfig(COMMON_SETTINGS &aCommonSettings, wxWindow *aWindow)
Read GAL config options from the common config store.
void WriteConfig(WINDOW_SETTINGS &aCfg)
CROSS_HAIR_MODE m_crossHairMode
Force cursor display.
double m_gridLineWidth
Minimum pixel distance between displayed grid lines.
double m_gridMinSpacing
Whether or not to draw the coordinate system axes.
GAL_ANTIALIASING_MODE antialiasing_mode
The grid style to draw the grid in.
bool m_forceDisplayCursor
The pixel scale factor (>1 for hi-DPI scaled displays)
KIGFX::GRID_STYLE m_gridStyle
Snapping options for the grid.
bool m_axesEnabled
Crosshair drawing mode.
GRID_SNAPPING m_gridSnapping
Thickness to render grid lines/dots.
static const UTIL::CFG_MAP< KIGFX::GRID_STYLE > gridStyleConfigVals
static const wxChar * traceGalDispOpts
Flag to enable GAL_DISPLAY_OPTIONS logging.
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:29
@ SMALL_CROSS
Use small cross instead of dots for the grid.
@ DOTS
Use dots for the grid.
@ LINES
Use lines for the grid.
std::vector< std::pair< T, long > > CFG_MAP
A config value table is a list of native values (usually enums) to a different set of values,...
Definition config_map.h:45
static long GetConfigForVal(const MAP &aMap, CFG_NATIVE_VAL< MAP > aVal)
Get the mapped config value (the one to write to file, or use in an index) from the given native (pro...
Definition config_map.h:65
static CFG_NATIVE_VAL< MAP > GetValFromConfig(const MAP &aMap, long aConf)
Get the native value corresponding to the config value (read from file or UI, probably) and find it i...
Definition config_map.h:92
static const UTIL::CFG_MAP< KIGFX::GRID_SNAPPING > gridSnapConfigVals
KIGFX::CROSS_HAIR_MODE cross_hair_mode
Store the common settings that are saved and loaded for each window / frame.
CURSOR_SETTINGS cursor
GRID_SETTINGS grid