40 m_AutoTrackWidth( true ),
42 m_PrototypeZoneFill( false ),
43 m_TrackOpacity( 1.0 ),
47 m_ShapeOpacity( 1.0 ),
48 m_ImageOpacity( 0.6 ),
49 m_PcbSelectionFilter(),
50 m_project( aProject ),
51 m_wasMigrated( false )
62 [&](
const std::string& aString )
69 [&]() -> nlohmann::json
71 nlohmann::json ret = nlohmann::json::array();
81 ret.push_back(
"none" );
85 [&](
const nlohmann::json& aVal )
87 if( !aVal.is_array() || aVal.empty() )
97 for(
const nlohmann::json& entry : aVal )
101 std::string vs = entry.get<std::string>();
105 else if( vs ==
"none" )
116 if( !visible.any() && !none )
124 [&]() -> nlohmann::json
142 [&](
const nlohmann::json& aVal )
144 if( aVal.empty() || !aVal.is_object() )
160 {
"lockedItems",
false },
161 {
"footprints",
true },
166 {
"graphics",
true },
168 {
"keepouts",
true },
169 {
"dimensions",
true },
170 {
"otherItems",
true }
181 HIGH_CONTRAST_MODE::NORMAL, HIGH_CONTRAST_MODE::HIDDEN ) );
197 NET_COLOR_MODE::ALL ) );
204 ZONE_DISPLAY_MODE::SHOW_FILLED, ZONE_DISPLAY_MODE::SHOW_FILLED,
205 ZONE_DISPLAY_MODE::SHOW_TRIANGULATION ) );
229 m_params.emplace_back(
new PARAM<bool>(
"net_inspector_panel.show_zero_pad_nets",
230 &m_NetInspectorPanel.show_zero_pad_nets,
false ) );
231 m_params.emplace_back(
new PARAM<bool>(
"net_inspector_panel.show_unconnected_nets",
232 &m_NetInspectorPanel.show_unconnected_nets,
false ) );
233 m_params.emplace_back(
new PARAM<int>(
"net_inspector_panel.sorting_column",
234 &m_NetInspectorPanel.sorting_column, -1 ) );
235 m_params.emplace_back(
new PARAM<bool>(
"net_inspector_panel.sort_ascending",
236 &m_NetInspectorPanel.sort_order_asc,
true ) );
237 m_params.emplace_back(
new PARAM_LIST<int>(
"net_inspector_panel.col_order",
238 &m_NetInspectorPanel.col_order, {} ) );
239 m_params.emplace_back(
new PARAM_LIST<int>(
"net_inspector_panel.col_widths",
240 &m_NetInspectorPanel.col_widths, {} ) );
241 m_params.emplace_back(
new PARAM_LIST<bool>(
"net_inspector_panel.col_hidden",
242 &m_NetInspectorPanel.col_hidden, {} ) );
244 &m_NetInspectorPanel.expanded_rows, {} ) );
249 [&]() -> nlohmann::json
251 nlohmann::json ret = nlohmann::json::array();
256 file[
"name"] = fileState.fileName;
257 file[
"open"] = fileState.open;
259 nlohmann::json window;
260 window[
"maximized"] = fileState.window.maximized;
261 window[
"size_x"] = fileState.window.size_x;
262 window[
"size_y"] = fileState.window.size_y;
263 window[
"pos_x"] = fileState.window.pos_x;
264 window[
"pos_y"] = fileState.window.pos_y;
265 window[
"display"] = fileState.window.display;
267 file[
"window"] = window;
269 ret.push_back( file );
274 [&](
const nlohmann::json& aVal )
276 if( !aVal.is_array() || aVal.empty() )
281 for(
const nlohmann::json& file : aVal )
287 SetIfPresent( file,
"name", fileState.
fileName );
288 SetIfPresent( file,
"open", fileState.
open );
289 SetIfPresent( file,
"window.size_x", fileState.
window.
size_x );
290 SetIfPresent( file,
"window.size_y", fileState.
window.
size_y );
291 SetIfPresent( file,
"window.pos_x", fileState.
window.
pos_x );
292 SetIfPresent( file,
"window.pos_y", fileState.
window.
pos_y );
294 SetIfPresent( file,
"window.display", fileState.
window.
display );
296 m_files.push_back( fileState );
309 [&]() -> nlohmann::json
313 ret[
"lockedItems"] = m_SchSelectionFilter.lockedItems;
314 ret[
"symbols"] = m_SchSelectionFilter.symbols;
315 ret[
"text"] = m_SchSelectionFilter.text;
316 ret[
"wires"] = m_SchSelectionFilter.wires;
317 ret[
"labels"] = m_SchSelectionFilter.labels;
318 ret[
"pins"] = m_SchSelectionFilter.pins;
319 ret[
"graphics"] = m_SchSelectionFilter.graphics;
320 ret[
"images"] = m_SchSelectionFilter.images;
321 ret[
"otherItems"] = m_SchSelectionFilter.otherItems;
325 [&](
const nlohmann::json& aVal )
327 if( aVal.empty() || !aVal.is_object() )
330 SetIfPresent( aVal,
"lockedItems", m_SchSelectionFilter.lockedItems );
331 SetIfPresent( aVal,
"symbols", m_SchSelectionFilter.symbols );
332 SetIfPresent( aVal,
"text", m_SchSelectionFilter.text );
333 SetIfPresent( aVal,
"wires", m_SchSelectionFilter.wires );
334 SetIfPresent( aVal,
"labels", m_SchSelectionFilter.labels );
335 SetIfPresent( aVal,
"pins", m_SchSelectionFilter.pins );
336 SetIfPresent( aVal,
"graphics", m_SchSelectionFilter.graphics );
337 SetIfPresent( aVal,
"images", m_SchSelectionFilter.images );
338 SetIfPresent( aVal,
"otherItems", m_SchSelectionFilter.otherItems );
341 {
"lockedItems",
false },
347 {
"graphics",
true },
349 {
"otherItems",
true }
352 registerMigration( 1, 2,
360 std::string ptr(
"board.visible_items" );
362 if( Contains( ptr ) )
364 if( At( ptr ).is_array() )
371 At(
"board" ).erase(
"visible_items" );
374 m_wasMigrated =
true;
380 registerMigration( 2, 3,
390 const std::map<int, int> offsets = {
409 std::string ptr(
"board.visible_items" );
411 if( Contains( ptr ) && At( ptr ).is_array() )
413 nlohmann::json visible = nlohmann::json::array();
415 for(
const nlohmann::json& val : At( ptr ) )
419 int layer = val.get<
int>();
421 if( offsets.count( layer ) )
422 visible.push_back( offsets.at( layer ) );
424 visible.push_back( layer );
432 At(
"board" )[
"visible_items"] = visible;
433 m_wasMigrated =
true;
439 registerMigration( 3, 4,
444 std::string ptr(
"board.visible_items" );
446 if( Contains( ptr ) )
448 if( At( ptr ).is_array() )
451 At(
"board" ).erase(
"visible_items" );
453 m_wasMigrated =
true;
459 registerMigration( 4, 5,
464 std::string ptr(
"board.visible_items" );
466 if( Contains( ptr ) && At( ptr ).is_array() )
468 std::vector<std::string> newLayers;
470 for( nlohmann::json& entry : At( ptr ) )
472 if( !entry.is_number_integer() )
475 if( std::optional<VISIBILITY_LAYER> vl =
482 At( ptr ) = newLayers;
483 m_wasMigrated =
true;
506 Set(
"meta.filename",
538 return a.fileName == aFileName;
556 return a.fileName == aFileName;
563 fileState.
open =
false;
571 m_files.push_back( fileState );
576 ( *it ).window = aWindowCfg->
state;
577 ( *it ).open = aOpen;
@ NORMAL
Use all material properties from model file.
HIGH_CONTRAST_MODE
Determine how inactive layers should be displayed.
@ RATSNEST
Net/netclass colors are shown on ratsnest lines only.
int ParseHex(const std::string &str)
Convert the output of FmtHex() and replaces this set's values with those given in the input string.
std::string FmtHex() const
Return a hex string showing contents of this set.
Helper for storing and iterating over GAL_LAYER_IDs.
static GAL_SET DefaultVisible()
std::vector< GAL_LAYER_ID > Seq() const
void Set(const std::string &aPath, ValueType aVal)
Stores a value into the JSON document Will throw an exception if ValueType isn't something that the l...
static bool SetIfPresent(const nlohmann::json &aObj, const std::string &aPath, wxString &aTarget)
Sets the given string if the given key/path is present.
std::vector< PARAM_BASE * > m_params
The list of parameters (owned by this object)
bool m_deleteLegacyAfterMigration
Whether or not to delete legacy file after migration.
void SetFilename(const wxString &aFilename)
virtual bool SaveToFile(const wxString &aDirectory="", bool aForce=false)
Calls Store() and then writes the contents of the JSON document to a file.
static LSET AllLayersMask()
Stores an enum as an integer.
Like a normal param, but with custom getter and setter functions.
bool SaveAs(const wxString &aDirectory, const wxString &aFile)
bool m_PrototypeZoneFill
Whether Zone fill should always be solid for performance with large boards.
LSET m_VisibleLayers
Board settings.
double m_PadOpacity
Opacity override for SMD pads and PTH.
bool SaveToFile(const wxString &aDirectory="", bool aForce=false) override
Calls Store() and then writes the contents of the JSON document to a file.
std::vector< PROJECT_FILE_STATE > m_files
Project scope.
double m_ViaOpacity
Opacity override for all types of via.
PANEL_NET_INSPECTOR_SETTINGS m_NetInspectorPanel
The state of the net inspector panel.
PCB_SELECTION_FILTER_OPTIONS m_PcbSelectionFilter
State of the selection filter widgets.
wxString m_ActiveLayerPreset
The name of a LAYER_PRESET that is currently activated (or blank if none)
double m_TrackOpacity
Opacity override for all tracks.
wxString m_GitRepoUsername
PROJECT * m_project
A link to the owning project.
double m_ZoneOpacity
Opacity override for filled zones.
bool m_AutoTrackWidth
The current setting for whether to automatically adjust track widths to match.
ZONE_DISPLAY_MODE m_ZoneDisplayMode
How zones are drawn.
double m_ShapeOpacity
Opacity override for graphic shapes.
PCB_LAYER_ID m_ActiveLayer
The current (active) board layer for editing.
HIGH_CONTRAST_MODE m_ContrastModeDisplay
The current contrast mode.
NET_COLOR_MODE m_NetColorMode
The current net color mode.
bool MigrateFromLegacy(wxConfigBase *aLegacyConfig) override
Migrates from wxConfig to JSON-based configuration.
GAL_SET m_VisibleItems
The GAL layers (aka items) that are turned on for viewing (.
std::vector< wxString > m_HiddenNets
A list of netnames that have been manually hidden in the board editor.
PROJECT_LOCAL_SETTINGS(PROJECT *aProject, const wxString &aFilename)
std::set< wxString > m_HiddenNetclasses
void SaveFileState(const wxString &aFileName, const WINDOW_SETTINGS *aWindowCfg, bool aOpen)
double m_ImageOpacity
Opacity override for user images.
const PROJECT_FILE_STATE * GetFileState(const wxString &aFileName)
Container for project specific data.
virtual const wxString GetProjectName() const
Return the short name of the project.
static const std::string ProjectLocalSettingsFileExtension
constexpr PCB_LAYER_ID PCBNEW_LAYER_ID_START
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
@ LAYER_ZONES
Control for copper zone opacity/visibility (color ignored).
@ LAYER_SHAPES
Copper graphic shape opacity/visibility (color ignored).
@ LAYER_PADS
Meta control for all pads opacity/visibility (color ignored).
std::optional< VISIBILITY_LAYER > VisibilityLayerFromRenderLayer(GAL_LAYER_ID aLayerId)
GAL_SET UserVisbilityLayers()
The set of GAL_LAYER_IDs that correspond to VISIBILITY_LAYERS.
std::string VisibilityLayerToString(VISIBILITY_LAYER aLayerId)
std::optional< GAL_LAYER_ID > RenderLayerFromVisbilityString(const std::string &aLayer)
const int projectLocalSettingsVersion
std::vector< wxString > custom_group_rules
bool otherItems
Anything not fitting one of the above categories.
bool vias
Vias (all types>
bool keepouts
Keepout zones.
bool graphics
Graphic lines, shapes, polygons.
bool footprints
Allow selecting entire footprints.
bool text
Text (free or attached to a footprint)
bool lockedItems
Allow selecting locked items.
bool tracks
Copper tracks.
bool dimensions
Dimension items.
struct WINDOW_STATE window
Store the common settings that are saved and loaded for each window / frame.