63 [&](
const std::string& aString )
70 [&]() -> nlohmann::json
72 nlohmann::json ret = nlohmann::json::array();
82 ret.push_back(
"none" );
86 [&](
const nlohmann::json& aVal )
88 if( !aVal.is_array() || aVal.empty() )
98 for(
const nlohmann::json& entry : aVal )
102 std::string vs = entry.get<std::string>();
106 else if( vs ==
"none" )
117 if( !visible.any() && !none )
125 [&]() -> nlohmann::json
143 [&](
const nlohmann::json& aVal )
145 if( aVal.empty() || !aVal.is_object() )
161 {
"lockedItems",
false },
162 {
"footprints",
true },
167 {
"graphics",
true },
169 {
"keepouts",
true },
170 {
"dimensions",
true },
171 {
"otherItems",
true }
253 [&]() -> nlohmann::json
255 nlohmann::json ret = nlohmann::json::array();
257 for( PROJECT_FILE_STATE& fileState : m_files )
260 file[
"name"] = fileState.fileName;
261 file[
"open"] = fileState.open;
263 nlohmann::json window;
264 window[
"maximized"] = fileState.window.maximized;
265 window[
"size_x"] = fileState.window.size_x;
266 window[
"size_y"] = fileState.window.size_y;
267 window[
"pos_x"] = fileState.window.pos_x;
268 window[
"pos_y"] = fileState.window.pos_y;
269 window[
"display"] = fileState.window.display;
271 file[
"window"] = window;
273 ret.push_back( file );
278 [&](
const nlohmann::json& aVal )
280 if( !aVal.is_array() || aVal.empty() )
285 for(
const nlohmann::json& file : aVal )
291 SetIfPresent( file,
"name", fileState.
fileName );
292 SetIfPresent( file,
"open", fileState.
open );
293 SetIfPresent( file,
"window.size_x", fileState.
window.
size_x );
294 SetIfPresent( file,
"window.size_y", fileState.
window.
size_y );
295 SetIfPresent( file,
"window.pos_x", fileState.
window.
pos_x );
296 SetIfPresent( file,
"window.pos_y", fileState.
window.
pos_y );
298 SetIfPresent( file,
"window.display", fileState.
window.
display );
300 m_files.push_back( fileState );
313 [&]() -> nlohmann::json
317 ret[
"lockedItems"] = m_SchSelectionFilter.lockedItems;
318 ret[
"symbols"] = m_SchSelectionFilter.symbols;
319 ret[
"text"] = m_SchSelectionFilter.text;
320 ret[
"wires"] = m_SchSelectionFilter.wires;
321 ret[
"labels"] = m_SchSelectionFilter.labels;
322 ret[
"pins"] = m_SchSelectionFilter.pins;
323 ret[
"graphics"] = m_SchSelectionFilter.graphics;
324 ret[
"images"] = m_SchSelectionFilter.images;
325 ret[
"ruleAreas"] = m_SchSelectionFilter.ruleAreas;
326 ret[
"otherItems"] = m_SchSelectionFilter.otherItems;
330 [&](
const nlohmann::json& aVal )
332 if( aVal.empty() || !aVal.is_object() )
335 SetIfPresent( aVal,
"lockedItems", m_SchSelectionFilter.lockedItems );
336 SetIfPresent( aVal,
"symbols", m_SchSelectionFilter.symbols );
337 SetIfPresent( aVal,
"text", m_SchSelectionFilter.text );
338 SetIfPresent( aVal,
"wires", m_SchSelectionFilter.wires );
339 SetIfPresent( aVal,
"labels", m_SchSelectionFilter.labels );
340 SetIfPresent( aVal,
"pins", m_SchSelectionFilter.pins );
341 SetIfPresent( aVal,
"graphics", m_SchSelectionFilter.graphics );
342 SetIfPresent( aVal,
"images", m_SchSelectionFilter.images );
343 SetIfPresent( aVal,
"ruleAreas", m_SchSelectionFilter.ruleAreas );
344 SetIfPresent( aVal,
"otherItems", m_SchSelectionFilter.otherItems );
347 {
"lockedItems",
false },
353 {
"graphics",
true },
355 {
"ruleAreas",
true },
356 {
"otherItems",
true }
360 &m_SchHierarchyCollapsed, {} ) );
362 registerMigration( 1, 2,
370 std::string ptr(
"board.visible_items" );
372 if( Contains( ptr ) )
374 if( At( ptr ).is_array() )
381 At(
"board" ).erase(
"visible_items" );
384 m_wasMigrated =
true;
390 registerMigration( 2, 3,
400 const std::map<int, int> offsets = {
419 std::string ptr(
"board.visible_items" );
421 if( Contains( ptr ) && At( ptr ).is_array() )
423 nlohmann::json visible = nlohmann::json::array();
425 for(
const nlohmann::json& val : At( ptr ) )
429 int layer = val.get<
int>();
431 if( offsets.count( layer ) )
432 visible.push_back( offsets.at( layer ) );
434 visible.push_back( layer );
442 At(
"board" )[
"visible_items"] = visible;
443 m_wasMigrated =
true;
449 registerMigration( 3, 4,
454 std::string ptr(
"board.visible_items" );
456 if( Contains( ptr ) )
458 if( At( ptr ).is_array() && !At( ptr ).
empty() )
461 At(
"board" ).erase(
"visible_items" );
463 m_wasMigrated =
true;
469 registerMigration( 4, 5,
474 std::string ptr(
"board.visible_items" );
476 if( Contains( ptr ) && At( ptr ).is_array() )
478 std::vector<std::string> newLayers;
480 for( nlohmann::json& entry : At( ptr ) )
482 if( !entry.is_number_integer() )
485 if( std::optional<VISIBILITY_LAYER> vl =
492 At( ptr ) = newLayers;
493 m_wasMigrated =
true;
516 Set(
"meta.filename",
548 return a.fileName == aFileName;
566 return a.fileName == aFileName;
573 fileState.
open =
false;
581 m_files.push_back( fileState );
586 ( *it ).window = aWindowCfg->
state;
587 ( *it ).open = aOpen;
HIGH_CONTRAST_MODE
Determine how inactive layers should be displayed.
@ NORMAL
Inactive layers are shown normally (no high-contrast mode)
@ HIDDEN
Inactive layers are hidden.
@ RATSNEST
Net/netclass colors are shown on ratsnest lines only.
@ ALL
Net/netclass colors are shown on all net copper.
@ OFF
Net (and netclass) colors are not shown.
std::string FmtHex() const
Return a hex string showing contents of this set.
Helper for storing and iterating over GAL_LAYER_IDs.
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)
JSON_SETTINGS(const wxString &aFilename, SETTINGS_LOC aLocation, int aSchemaVersion)
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 const 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.
bool m_GitIntegrationDisabled
If true, KiCad will not use Git integration for this project even if a .git directory exists.
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.
std::vector< wxString > m_OpenJobSets
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.
static bool empty(const wxTextEntryBase *aCtrl)
static const std::string ProjectLocalSettingsFileExtension
NORMAL
Follows standard pretty-printing rules.
constexpr PCB_LAYER_ID PCBNEW_LAYER_ID_START
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
@ LAYER_FILLED_SHAPES
Copper graphic shape opacity/visibility (color ignored).
@ LAYER_ZONES
Control for copper zone 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
struct WINDOW_STATE window
Store the common settings that are saved and loaded for each window / frame.