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 <[email protected]>
5 * Copyright (C) 2020-2022 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>
26
31{
36};
37
42{
45};
46
51{
53 std::vector<wxString> sizes;
54 wxString user_grid_x;
55 wxString user_grid_y;
59 double line_width;
61 bool show;
62 int style;
63 int snap;
64};
65
70{
72 int size_x;
73 int size_y;
74 int pos_x;
75 int pos_y;
76 unsigned int display;
77};
78
83{
85 wxString mru_path;
86 wxString perspective;
87 std::vector<double> zoom_factors;
88
91};
92
101{
102public:
104 {
105 wxString find_string;
106 std::vector<wxString> find_history;
108 std::vector<wxString> replace_history;
109
111
114 };
115
116 struct GRAPHICS
117 {
121 };
122
124 {
126 };
127
128 struct LIB_TREE
129 {
130 std::vector<wxString> columns;
131 std::map<wxString, int> column_widths;
132 };
133
134 struct PRINTING
135 {
138 double scale;
140 wxString color_theme;
142 std::vector<int> layers;
143 };
144
145 struct SYSTEM
146 {
149 std::vector<wxString> file_history;
150 int units;
153 };
154
155 APP_SETTINGS_BASE( const std::string& aFilename, int aSchemaVersion );
156
158
159 virtual bool MigrateFromLegacy( wxConfigBase* aCfg ) override;
160
167 virtual const std::vector<wxString> DefaultGridSizeList() const;
168
169public:
171
173
175
177
179
181
183
185
187 wxString m_ColorTheme;
188
191
192protected:
193
194 virtual std::string getLegacyFrameName() const { return std::string(); }
195
197 void migrateFindReplace( wxConfigBase* aCfg );
198
206 bool migrateWindowConfig( wxConfigBase* aCfg, const std::string& aFrameName,
207 const std::string& aJsonPath );
208
214 void addParamsForWindow( WINDOW_SETTINGS* aWindow, const std::string& aJsonPath );
215
219 bool migrateLibTreeWidth();
220};
221
222#endif
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:101
WINDOW_SETTINGS m_Window
Definition: app_settings.h:184
APP_SETTINGS_BASE(const std::string &aFilename, int aSchemaVersion)
FIND_REPLACE m_FindReplace
Definition: app_settings.h:172
bool migrateWindowConfig(wxConfigBase *aCfg, const std::string &aFrameName, const std::string &aJsonPath)
Migrates legacy window settings into the JSON document.
void migrateFindReplace(wxConfigBase *aCfg)
! Migrates the find/replace history string lists
virtual const std::vector< wxString > DefaultGridSizeList() const
By default, this returns the list of grids available in PcbNew-based applications.
COLOR_PICKER m_ColorPicker
Definition: app_settings.h:176
virtual ~APP_SETTINGS_BASE()
Definition: app_settings.h:157
virtual std::string getLegacyFrameName() const
Definition: app_settings.h:194
virtual bool MigrateFromLegacy(wxConfigBase *aCfg) override
Migrates from wxConfig to JSON-based configuration.
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:187
CROSS_PROBING_SETTINGS m_CrossProbing
Definition: app_settings.h:170
void addParamsForWindow(WINDOW_SETTINGS *aWindow, const std::string &aJsonPath)
Adds parameters for the given window object.
bool migrateLibTreeWidth()
Migrates the library tree width setting from a single column (Item) to multi-column.
int m_appSettingsSchemaVersion
! Local schema version for common app settings
Definition: app_settings.h:190
std::vector< wxString > replace_history
Definition: app_settings.h:108
std::vector< wxString > find_history
Definition: app_settings.h:106
float highlight_factor
How much to brighten highlighted objects by.
Definition: app_settings.h:119
float select_factor
How much to brighten selected objects by.
Definition: app_settings.h:120
std::vector< wxString > columns
Ordered list of visible columns in the tree.
Definition: app_settings.h:130
std::map< wxString, int > column_widths
Column widths, keyed by header name.
Definition: app_settings.h:131
bool monochrome
Whether or not to print in monochrome.
Definition: app_settings.h:137
bool background
Whether or not to print background color.
Definition: app_settings.h:136
std::vector< int > layers
List of enabled layers for printing.
Definition: app_settings.h:142
wxString color_theme
Color theme to use for printing.
Definition: app_settings.h:140
double scale
Printout scale.
Definition: app_settings.h:138
bool title_block
Whether or not to print title block.
Definition: app_settings.h:141
bool use_theme
If false, display color theme will be used.
Definition: app_settings.h:139
std::vector< wxString > file_history
Definition: app_settings.h:149
Cross-probing behavior.
Definition: app_settings.h:31
bool on_selection
Synchronize the selection for multiple items too.
Definition: app_settings.h:32
bool zoom_to_fit
Zoom to fit items (ignored if center_on_items is off)
Definition: app_settings.h:34
bool center_on_items
Automatically pan to cross-probed items.
Definition: app_settings.h:33
bool auto_highlight
Automatically turn on highlight mode in the target frame.
Definition: app_settings.h:35
Common cursor settings, available to every frame.
Definition: app_settings.h:42
bool always_show_cursor
Definition: app_settings.h:43
bool fullscreen_cursor
Definition: app_settings.h:44
Common grid settings, available to every frame.
Definition: app_settings.h:51
wxString user_grid_x
Definition: app_settings.h:54
double line_width
Definition: app_settings.h:59
wxString user_grid_y
Definition: app_settings.h:55
double min_spacing
Definition: app_settings.h:60
std::vector< wxString > sizes
Definition: app_settings.h:53
Stores the common settings that are saved and loaded for each window / frame.
Definition: app_settings.h:83
CURSOR_SETTINGS cursor
Definition: app_settings.h:89
WINDOW_STATE state
Definition: app_settings.h:84
GRID_SETTINGS grid
Definition: app_settings.h:90
wxString mru_path
Definition: app_settings.h:85
std::vector< double > zoom_factors
Definition: app_settings.h:87
wxString perspective
Definition: app_settings.h:86
Stores the window positioning/state.
Definition: app_settings.h:70
unsigned int display
Definition: app_settings.h:76