KiCad PCB EDA Suite
common_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 _COMMON_SETTINGS_H
22 #define _COMMON_SETTINGS_H
23 
24 #include <settings/environment.h>
25 #include <settings/json_settings.h>
26 
27 
29 {
30  // WARNING: these are encoded as integers in the file, so don't change their values.
31  DRAG_ANY = -2,
33  SELECT,
34  ZOOM,
35  PAN,
36  NONE
37 };
38 
39 enum class ICON_THEME
40 {
41  LIGHT,
42  DARK,
43  AUTO
44 };
45 
46 
48 {
49 public:
50  struct APPEARANCE
51  {
52  double canvas_scale;
56  };
57 
58  struct AUTO_BACKUP
59  {
60  bool enabled;
65 
67  unsigned long long limit_total_size;
68  };
69 
70  struct ENVIRONMENT
71  {
73  };
74 
75  struct INPUT
76  {
77  bool auto_pan;
83 
87 
91 
95  };
96 
97  struct GRAPHICS
98  {
101  };
102 
103  struct SESSION
104  {
106  };
107 
108  struct SYSTEM
109  {
111  wxString editor_name;
113  wxString language;
114  wxString pdf_viewer_name;
116  wxString working_dir;
118  };
119 
121  {
125  };
126 
128  {
129  int sash_pos;
130  };
131 
132  COMMON_SETTINGS();
133 
134  virtual ~COMMON_SETTINGS() {}
135 
136  virtual bool MigrateFromLegacy( wxConfigBase* aLegacyConfig ) override;
137 
141  void InitializeEnvironment();
142 
143 private:
144  bool migrateSchema0to1();
145  bool migrateSchema1to2();
146 
147 public:
149 
151 
153 
155 
157 
159 
161 
163 
165 };
166 
167 #endif
unsigned long long limit_total_size
Maximum total size of backups (bytes), 0 for unlimited.
MOUSE_DRAG_ACTION drag_left
bool enabled
Automatically back up the project when files are saved.
AUTO_BACKUP m_Backup
APPEARANCE m_Appearance
virtual bool MigrateFromLegacy(wxConfigBase *aLegacyConfig) override
Migrates from wxConfig to JSON-based configuration.
ICON_THEME
MOUSE_DRAG_ACTION drag_right
void InitializeEnvironment()
Creates the built-in environment variables and sets their default values.
MOUSE_DRAG_ACTION
NETCLASS_PANEL m_NetclassPanel
virtual ~COMMON_SETTINGS()
ENVIRONMENT m_Env
int min_interval
Minimum time, in seconds, between subsequent backups.
DO_NOT_SHOW_AGAIN m_DoNotShowAgain
std::map< wxString, ENV_VAR_ITEM > ENV_VAR_MAP
bool backup_on_autosave
Trigger a backup on autosave.
int limit_daily_files
Maximum files to keep per day, 0 for unlimited.
MOUSE_DRAG_ACTION drag_middle
int limit_total_files
Maximum number of backup archives to retain.