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  class GAL_DISPLAY_OPTIONS;
66 
68  {
69  public:
70  virtual void OnGalDisplayOptionsChanged( const GAL_DISPLAY_OPTIONS& ) = 0;
71  protected:
72  // Observer lifetimes aren't handled by base class pointer
74  };
75 
76  class GAL_DISPLAY_OPTIONS : public UTIL::OBSERVABLE<GAL_DISPLAY_OPTIONS_OBSERVER>
77  {
78  public:
80 
85  void ReadWindowSettings( WINDOW_SETTINGS& aCfg );
86 
92  void ReadCommonConfig( COMMON_SETTINGS& aCommonSettings, wxWindow* aWindow );
93 
101  void ReadConfig( COMMON_SETTINGS& aCommonConfig, WINDOW_SETTINGS& aWindowConfig,
102  wxWindow* aWindow );
103 
104  void WriteConfig( WINDOW_SETTINGS& aCfg );
105 
106  void UpdateScaleFactor();
107 
108  void NotifyChanged();
109 
111 
113 
115 
118 
121 
124 
127 
130 
133 
136  };
137 
138 }
139 
140 #endif
141 
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:68
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.