KiCad PCB EDA Suite
app_settings.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) 2020 Jon Evans <jon@craftyjon.com>
5  * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software: you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License as published by the
9  * Free Software Foundation, either version 3 of the License, or (at your
10  * option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef _APP_SETTINGS_H
22 #define _APP_SETTINGS_H
23 
24 #include <gal/color4d.h>
25 #include <settings/json_settings.h>
26 
31 {
33  bool zoom_to_fit;
35 };
36 
41 {
44 };
45 
50 {
52  std::vector<wxString> sizes;
53  wxString user_grid_x;
54  wxString user_grid_y;
58  double line_width;
59  double min_spacing;
60  bool show;
61  int style;
62  int snap;
63 };
64 
69 {
70  bool maximized;
71  int size_x;
72  int size_y;
73  int pos_x;
74  int pos_y;
75  unsigned int display;
76 };
77 
82 {
84  wxString mru_path;
85  wxString perspective;
86  std::vector<double> zoom_factors;
87 
90 };
91 
100 {
101 public:
102 
103 
105  {
106  int flags;
107  wxString find_string;
108  std::vector<wxString> find_history;
109  wxString replace_string;
110  std::vector<wxString> replace_history;
111  };
112 
113  struct GRAPHICS
114  {
119  };
120 
122  {
124  };
125 
126  struct LIB_TREE
127  {
129  };
130 
131  struct PRINTING
132  {
133  bool background;
134  bool monochrome;
135  double scale;
136  bool use_theme;
137  wxString color_theme;
138  bool title_block;
139  std::vector<int> layers;
140  };
141 
142  struct SYSTEM
143  {
146  std::vector<wxString> file_history;
147  int units;
148  };
149 
150  APP_SETTINGS_BASE( const std::string& aFilename, int aSchemaVersion );
151 
152  virtual ~APP_SETTINGS_BASE() {}
153 
154  virtual bool MigrateFromLegacy( wxConfigBase* aCfg ) override;
155 
156 public:
158 
160 
162 
164 
166 
168 
170 
172 
174  wxString m_ColorTheme;
175 
178 
179 protected:
180 
181  virtual std::string getLegacyFrameName() const { return std::string(); }
182 
184  void migrateFindReplace( wxConfigBase* aCfg );
185 
193  bool migrateWindowConfig( wxConfigBase* aCfg, const std::string& aFrameName,
194  const std::string& aJsonPath );
195 
201  void addParamsForWindow( WINDOW_SETTINGS* aWindow, const std::string& aJsonPath );
202 };
203 
204 #endif
wxString mru_path
Definition: app_settings.h:84
void addParamsForWindow(WINDOW_SETTINGS *aWindow, const std::string &aJsonPath)
Adds parameters for the given window object.
bool fullscreen_cursor
Definition: app_settings.h:43
std::vector< wxString > file_history
Definition: app_settings.h:146
wxString user_grid_y
Definition: app_settings.h:54
wxString user_grid_x
Definition: app_settings.h:53
std::vector< wxString > find_history
Definition: app_settings.h:108
double min_spacing
Definition: app_settings.h:59
virtual bool MigrateFromLegacy(wxConfigBase *aCfg) override
Migrates from wxConfig to JSON-based configuration.
Common cursor settings, available to every frame.
Definition: app_settings.h:40
wxString color_theme
Color theme to use for printing.
Definition: app_settings.h:137
bool title_block
Whether or not to print title block.
Definition: app_settings.h:138
void migrateFindReplace(wxConfigBase *aCfg)
! Migrates the find/replace history string lists
virtual ~APP_SETTINGS_BASE()
Definition: app_settings.h:152
bool use_theme
If false, display color theme will be used.
Definition: app_settings.h:136
float high_contrast_factor
How much to darken inactive layers by.
Definition: app_settings.h:118
bool always_show_cursor
Definition: app_settings.h:42
std::vector< double > zoom_factors
Definition: app_settings.h:86
bool monochrome
Whether or not to print in monochrome.
Definition: app_settings.h:134
double line_width
Definition: app_settings.h:58
virtual std::string getLegacyFrameName() const
Definition: app_settings.h:181
Cross-probing behavior.
Definition: app_settings.h:30
Stores the common settings that are saved and loaded for each window / frame.
Definition: app_settings.h:81
wxString perspective
Definition: app_settings.h:85
std::vector< wxString > sizes
Definition: app_settings.h:52
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:99
CURSOR_SETTINGS cursor
Definition: app_settings.h:88
FIND_REPLACE m_FindReplace
Definition: app_settings.h:159
GRID_SETTINGS grid
Definition: app_settings.h:89
APP_SETTINGS_BASE(const std::string &aFilename, int aSchemaVersion)
std::vector< int > layers
List of enabled layers for printing.
Definition: app_settings.h:139
std::vector< wxString > replace_history
Definition: app_settings.h:110
float select_factor
How much to brighten selected objects by.
Definition: app_settings.h:117
bool background
Whether or not to print background color.
Definition: app_settings.h:133
Stores the window positioning/state.
Definition: app_settings.h:68
bool zoom_to_fit
Zoom to fit items (ignored if center_on_items is off)
Definition: app_settings.h:33
int m_appSettingsSchemaVersion
! Local schema version for common app settings
Definition: app_settings.h:177
WINDOW_SETTINGS m_Window
Definition: app_settings.h:171
bool auto_highlight
Automatically turn on highlight mode in the target frame.
Definition: app_settings.h:34
float highlight_factor
How much to brighten highlighted objects by.
Definition: app_settings.h:116
double scale
Printout scale.
Definition: app_settings.h:135
WINDOW_STATE state
Definition: app_settings.h:83
CROSS_PROBING_SETTINGS m_CrossProbing
Definition: app_settings.h:157
COLOR_PICKER m_ColorPicker
Definition: app_settings.h:163
unsigned int display
Definition: app_settings.h:75
bool center_on_items
Automatically pan to cross-probed items.
Definition: app_settings.h:32
bool migrateWindowConfig(wxConfigBase *aCfg, const std::string &aFrameName, const std::string &aJsonPath)
Migrates legacy window settings into the JSON document.
Common grid settings, available to every frame.
Definition: app_settings.h:49
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:174