KiCad PCB EDA Suite
gal_display_options.h
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) 2017-2021 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, 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 
24 #ifndef GAL_DISPLAY_OPTIONS_H__
25 #define GAL_DISPLAY_OPTIONS_H__
26 
27 #include <gal/dpi_scaling.h>
28 #include <observable.h>
29 
30 class COMMON_SETTINGS;
31 struct WINDOW_SETTINGS;
32 class wxString;
33 class wxWindow;
34 
35 
36 namespace KIGFX
37 {
41  enum class GRID_STYLE
42  {
43  DOTS,
44  LINES,
46  };
47 
49  {
50  NONE,
51  SMAA,
53  };
54 
56  {
57  NONE,
58  FAST,
59  GOOD,
60  };
61 
62  enum class GRID_SNAPPING
63  {
64  ALWAYS,
65  WITH_GRID,
66  NEVER
67  };
68 
69  class GAL_DISPLAY_OPTIONS;
70 
72  {
73  public:
74  virtual void OnGalDisplayOptionsChanged( const GAL_DISPLAY_OPTIONS& ) = 0;
75  protected:
76  // Observer lifetimes aren't handled by base class pointer
78  };
79 
80  class GAL_DISPLAY_OPTIONS : public UTIL::OBSERVABLE<GAL_DISPLAY_OPTIONS_OBSERVER>
81  {
82  public:
84 
89  void ReadWindowSettings( WINDOW_SETTINGS& aCfg );
90 
96  void ReadCommonConfig( COMMON_SETTINGS& aCommonSettings, wxWindow* aWindow );
97 
105  void ReadConfig( COMMON_SETTINGS& aCommonConfig, WINDOW_SETTINGS& aWindowConfig,
106  wxWindow* aWindow );
107 
108  void WriteConfig( WINDOW_SETTINGS& aCfg );
109 
110  void UpdateScaleFactor();
111 
112  void NotifyChanged();
113 
115 
117 
119 
122 
125 
128 
131 
134 
137 
140 
143  };
144 
145 }
146 
147 #endif
148 
Use lines for the grid.
GRID_STYLE
GRID_STYLE: Type definition of the grid style.
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:194
KIGFX::GRID_STYLE m_gridStyle
Snapping options for the grid.
bool m_forceDisplayCursor
The pixel scale factor (>1 for hi-DPI scaled displays)
double m_gridMinSpacing
Whether or not to draw the coordinate system axes.
OPENGL_ANTIALIASING_MODE gl_antialiasing_mode
Class to handle configuration and automatic determination of the DPI scale to use for canvases.
Definition: dpi_scaling.h:36
bool m_axesEnabled
Fullscreen crosshair or small cross.
CAIRO_ANTIALIASING_MODE cairo_antialiasing_mode
Stores the common settings that are saved and loaded for each window / frame.
Definition: app_settings.h:81
GRID_SNAPPING m_gridSnapping
Thickness to render grid lines/dots.
void WriteConfig(WINDOW_SETTINGS &aCfg)
void ReadCommonConfig(COMMON_SETTINGS &aCommonSettings, wxWindow *aWindow)
Read GAL config options from the common config store.
Use dots for the grid.
Use small cross instead of dots for the grid.
DPI_SCALING m_dpi
The grid style to draw the grid in.
virtual void OnGalDisplayOptionsChanged(const GAL_DISPLAY_OPTIONS &)=0
double m_gridLineWidth
Minimum pixel distance between displayed grid lines.
void ReadConfig(COMMON_SETTINGS &aCommonConfig, WINDOW_SETTINGS &aWindowConfig, wxWindow *aWindow)
Read application and common configs.
bool m_fullscreenCursor
Force cursor display.
void ReadWindowSettings(WINDOW_SETTINGS &aCfg)
Read GAL config options from application-level config.