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 };
63 
64 
69 {
70  bool maximized;
71  wxString mru_path;
72  int size_x;
73  int size_y;
74  wxString perspective;
75  int pos_x;
76  int pos_y;
77 
78  std::vector<double> zoom_factors;
79 
82 };
83 
92 {
93 public:
94 
95 
96  struct FIND_REPLACE
97  {
98  int flags;
99  wxString find_string;
100  std::vector<wxString> find_history;
101  wxString replace_string;
102  std::vector<wxString> replace_history;
103  };
104 
105  struct GRAPHICS
106  {
108  };
109 
110  struct LIB_TREE
111  {
113  };
114 
115  struct PRINTING
116  {
117  bool background;
118  bool monochrome;
119  double scale;
120  bool use_theme;
121  wxString color_theme;
122  bool title_block;
123  std::vector<int> layers;
124  };
125 
126  struct SYSTEM
127  {
130  std::vector<wxString> file_history;
131  int units;
132  };
133 
134  APP_SETTINGS_BASE( const std::string& aFilename, int aSchemaVersion );
135 
136  virtual ~APP_SETTINGS_BASE() {}
137 
138  virtual bool MigrateFromLegacy( wxConfigBase* aCfg ) override;
139 
140 public:
142 
144 
146 
148 
150 
152 
154 
156  wxString m_ColorTheme;
157 
160 
161 protected:
162 
163  virtual std::string getLegacyFrameName() const { return std::string(); }
164 
166  void migrateFindReplace( wxConfigBase* aCfg );
167 
175  bool migrateWindowConfig( wxConfigBase* aCfg, const std::string& aFrameName,
176  const std::string& aJsonPath );
177 
183  void addParamsForWindow( WINDOW_SETTINGS* aWindow, const std::string& aJsonPath );
184 };
185 
186 #endif
wxString mru_path
Definition: app_settings.h:71
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:130
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:100
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:121
bool title_block
Whether or not to print title block.
Definition: app_settings.h:122
void migrateFindReplace(wxConfigBase *aCfg)
! Migrates the find/replace history string lists
virtual ~APP_SETTINGS_BASE()
Definition: app_settings.h:136
bool use_theme
If false, display color theme will be used.
Definition: app_settings.h:120
bool always_show_cursor
Definition: app_settings.h:42
std::vector< double > zoom_factors
Definition: app_settings.h:78
bool monochrome
Whether or not to print in monochrome.
Definition: app_settings.h:118
double line_width
Definition: app_settings.h:58
virtual std::string getLegacyFrameName() const
Definition: app_settings.h:163
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:68
wxString perspective
Definition: app_settings.h:74
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:91
CURSOR_SETTINGS cursor
Definition: app_settings.h:80
FIND_REPLACE m_FindReplace
Definition: app_settings.h:143
GRID_SETTINGS grid
Definition: app_settings.h:81
APP_SETTINGS_BASE(const std::string &aFilename, int aSchemaVersion)
std::vector< int > layers
List of enabled layers for printing.
Definition: app_settings.h:123
std::vector< wxString > replace_history
Definition: app_settings.h:102
bool background
Whether or not to print background color.
Definition: app_settings.h:117
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:159
WINDOW_SETTINGS m_Window
Definition: app_settings.h:153
bool auto_highlight
Automatically turn on highlight mode in the target frame.
Definition: app_settings.h:34
double scale
Printout scale.
Definition: app_settings.h:119
CROSS_PROBING_SETTINGS m_CrossProbing
Definition: app_settings.h:141
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:156