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;
57  };
58 
59  struct AUTO_BACKUP
60  {
61  bool enabled;
66 
68  unsigned long long limit_total_size;
69  };
70 
71  struct ENVIRONMENT
72  {
74  };
75 
76  struct INPUT
77  {
78  bool auto_pan;
84 
88 
92 
96  };
97 
98  struct GRAPHICS
99  {
102  };
103 
104  struct SESSION
105  {
107  };
108 
109  struct SYSTEM
110  {
112  wxString text_editor;
114  wxString language;
115  wxString pdf_viewer_name;
117  wxString working_dir;
119  };
120 
122  {
126  };
127 
129  {
130  int sash_pos;
131  };
132 
133  COMMON_SETTINGS();
134 
135  virtual ~COMMON_SETTINGS() {}
136 
137  virtual bool MigrateFromLegacy( wxConfigBase* aLegacyConfig ) override;
138 
142  void InitializeEnvironment();
143 
144 private:
145  bool migrateSchema0to1();
146  bool migrateSchema1to2();
147 
148 public:
150 
152 
154 
156 
158 
160 
162 
164 
166 };
167 
168 #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.