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 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 
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,
55  };
56 
58  {
59  NONE,
60  FAST,
61  GOOD,
62  BEST,
63  };
64 
65  enum class GRID_SNAPPING
66  {
67  ALWAYS,
68  WITH_GRID,
69  NEVER
70  };
71 
72  class GAL_DISPLAY_OPTIONS;
73 
75  {
76  public:
77  virtual void OnGalDisplayOptionsChanged( const GAL_DISPLAY_OPTIONS& ) = 0;
78  protected:
79  // Observer lifetimes aren't handled by base class pointer
81  };
82 
83  class GAL_DISPLAY_OPTIONS : public UTIL::OBSERVABLE<GAL_DISPLAY_OPTIONS_OBSERVER>
84  {
85  public:
87 
92  void ReadWindowSettings( WINDOW_SETTINGS& aCfg );
93 
99  void ReadCommonConfig( COMMON_SETTINGS& aCommonSettings, wxWindow* aWindow );
100 
108  void ReadConfig( COMMON_SETTINGS& aCommonConfig, WINDOW_SETTINGS& aWindowConfig,
109  wxWindow* aWindow );
110 
111  void WriteConfig( WINDOW_SETTINGS& aCfg );
112 
113  void UpdateScaleFactor();
114 
115  void NotifyChanged();
116 
118 
120 
122 
125 
128 
131 
134 
137 
140 
143 
146  };
147 
148 }
149 
150 #endif
151 
Use lines for the grid.
GRID_STYLE
GRID_STYLE: Type definition of the grid style.
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:175
KIGFX::GRID_STYLE m_gridStyle
The grid style to draw the grid in
bool m_forceDisplayCursor
Force cursor display
double m_gridMinSpacing
Minimum pixel distance between displayed grid lines
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
Whether or not to draw the coordinate system axes
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
Snapping options for the grid
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.
virtual void OnGalDisplayOptionsChanged(const GAL_DISPLAY_OPTIONS &)=0
double m_scaleFactor
The pixel scale factor (>1 for hi-DPI scaled displays)
double m_gridLineWidth
Thickness to render grid lines/dots
void ReadConfig(COMMON_SETTINGS &aCommonConfig, WINDOW_SETTINGS &aWindowConfig, wxWindow *aWindow)
Read application and common configs.
bool m_fullscreenCursor
Fullscreen crosshair or small cross
void ReadWindowSettings(WINDOW_SETTINGS &aCfg)
Read GAL config options from applicaton-level config.