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
69enum class ARC_EDIT_MODE
70{
73};
74
79{
81 int size_x;
82 int size_y;
83 int pos_x;
84 int pos_y;
85 unsigned int display;
86};
87
92{
94 wxString mru_path;
95 wxString perspective;
96 std::vector<double> zoom_factors;
97
100};
101
110{
111public:
113 {
114 wxString find_string;
115 std::vector<wxString> find_history;
117 std::vector<wxString> replace_history;
118
120
123 };
124
125 struct GRAPHICS
126 {
130 };
131
133 {
135 };
136
137 struct LIB_TREE
138 {
139 std::vector<wxString> columns;
140 std::map<wxString, int> column_widths;
141 };
142
143 struct PRINTING
144 {
147 double scale;
149 wxString color_theme;
151 std::vector<int> layers;
152 };
153
154 struct SYSTEM
155 {
156 bool first_run_shown; //@todo RFB remove? - not used
158 std::vector<wxString> file_history;
159 int units;
162 };
163
164 APP_SETTINGS_BASE( const std::string& aFilename, int aSchemaVersion );
165
167
168 virtual bool MigrateFromLegacy( wxConfigBase* aCfg ) override;
169
170 const std::vector<wxString> DefaultGridSizeList() const;
171
172public:
174
176
178
180
182
184
186
188
190 wxString m_ColorTheme;
191
194
195protected:
196
197 virtual std::string getLegacyFrameName() const { return std::string(); }
198
200 void migrateFindReplace( wxConfigBase* aCfg );
201
209 bool migrateWindowConfig( wxConfigBase* aCfg, const std::string& aFrameName,
210 const std::string& aJsonPath );
211
217 void addParamsForWindow( WINDOW_SETTINGS* aWindow, const std::string& aJsonPath );
218
222 bool migrateLibTreeWidth();
223};
224
225#endif
ARC_EDIT_MODE
Settings for arc editing.
Definition: app_settings.h:70
@ KEEP_ENDPOINTS_OR_START_DIRECTION
@ KEEP_CENTER_ADJUST_ANGLE_RADIUS
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:110
WINDOW_SETTINGS m_Window
Definition: app_settings.h:187
APP_SETTINGS_BASE(const std::string &aFilename, int aSchemaVersion)
FIND_REPLACE m_FindReplace
Definition: app_settings.h:175
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
const std::vector< wxString > DefaultGridSizeList() const
COLOR_PICKER m_ColorPicker
Definition: app_settings.h:179
virtual ~APP_SETTINGS_BASE()
Definition: app_settings.h:166
virtual std::string getLegacyFrameName() const
Definition: app_settings.h:197
virtual bool MigrateFromLegacy(wxConfigBase *aCfg) override
Migrates from wxConfig to JSON-based configuration.
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:190
CROSS_PROBING_SETTINGS m_CrossProbing
Definition: app_settings.h:173
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:193
std::vector< wxString > replace_history
Definition: app_settings.h:117
std::vector< wxString > find_history
Definition: app_settings.h:115
float highlight_factor
How much to brighten highlighted objects by.
Definition: app_settings.h:128
float select_factor
How much to brighten selected objects by.
Definition: app_settings.h:129
std::vector< wxString > columns
Ordered list of visible columns in the tree.
Definition: app_settings.h:139
std::map< wxString, int > column_widths
Column widths, keyed by header name.
Definition: app_settings.h:140
bool monochrome
Whether or not to print in monochrome.
Definition: app_settings.h:146
bool background
Whether or not to print background color.
Definition: app_settings.h:145
std::vector< int > layers
List of enabled layers for printing.
Definition: app_settings.h:151
wxString color_theme
Color theme to use for printing.
Definition: app_settings.h:149
double scale
Printout scale.
Definition: app_settings.h:147
bool title_block
Whether or not to print title block.
Definition: app_settings.h:150
bool use_theme
If false, display color theme will be used.
Definition: app_settings.h:148
std::vector< wxString > file_history
Definition: app_settings.h:158
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:92
CURSOR_SETTINGS cursor
Definition: app_settings.h:98
WINDOW_STATE state
Definition: app_settings.h:93
GRID_SETTINGS grid
Definition: app_settings.h:99
wxString mru_path
Definition: app_settings.h:94
std::vector< double > zoom_factors
Definition: app_settings.h:96
wxString perspective
Definition: app_settings.h:95
Stores the window positioning/state.
Definition: app_settings.h:79
unsigned int display
Definition: app_settings.h:85