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 (C) 2016-2020 Kicad Developers, see change_log.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, you may find one here:
18* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19* or you may search the http://www.gnu.org website for the version 2 license,
20* or you may write to the Free Software Foundation, Inc.,
21* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22*/
23
27
28#include <wx/log.h>
29
30#include <config_map.h>
31#include <dpi_scaling_common.h>
32
33using namespace KIGFX;
34
42static const wxChar* traceGalDispOpts = wxT( "KICAD_GAL_DISPLAY_OPTIONS" );
43
44
49};
50
55};
56
59 m_dpi( { nullptr, nullptr } )
60{
61}
62
63
65{
66 wxLogTrace( traceGalDispOpts, wxS( "Reading app-specific options" ) );
67
73
76
78}
79
80
82{
83 wxLogTrace( traceGalDispOpts, wxS( "Reading common config" ) );
84
87
90
91 m_dpi = DPI_SCALING_COMMON( &aSettings, aWindow );
93
95}
96
97
99 WINDOW_SETTINGS& aWindowConfig, wxWindow* aWindow )
100{
101 wxLogTrace( traceGalDispOpts, wxS( "Reading common and app config" ) );
102
103 ReadWindowSettings( aWindowConfig );
104
105 ReadCommonConfig( aCommonConfig, aWindow );
106}
107
108
110{
111 wxLogTrace( traceGalDispOpts, wxS( "Writing window settings" ) );
112
120}
121
122
124{
126 {
129 }
130}
Class to handle configuration and automatic determination of the DPI scale to use for canvases.
double GetScaleFactor() const override
Get the DPI scale from all known sources in order:
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)
double m_gridLineWidth
Minimum pixel distance between displayed grid lines.
double m_gridMinSpacing
Whether or not to draw the coordinate system axes.
OPENGL_ANTIALIASING_MODE gl_antialiasing_mode
CAIRO_ANTIALIASING_MODE cairo_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
Fullscreen crosshair or small cross.
bool m_fullscreenCursor
Force cursor display.
GRID_SNAPPING m_gridSnapping
Thickness to render grid lines/dots.
static const UTIL::CFG_MAP< KIGFX::GRID_STYLE > gridStyleConfigVals
static const UTIL::CFG_MAP< KIGFX::GRID_SNAPPING > gridSnapConfigVals
static const wxChar * traceGalDispOpts
Flag to enable GAL_DISPLAY_OPTIONS logging.
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:247
@ 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:49
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:69
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:96
bool always_show_cursor
Definition: app_settings.h:44
bool fullscreen_cursor
Definition: app_settings.h:45
double line_width
Definition: grid_settings.h:72
double min_spacing
Definition: grid_settings.h:73
Stores the common settings that are saved and loaded for each window / frame.
Definition: app_settings.h:74
CURSOR_SETTINGS cursor
Definition: app_settings.h:80
GRID_SETTINGS grid
Definition: app_settings.h:81