61 [&](
const std::string& aString )
68 [&]() -> nlohmann::json
70 nlohmann::json ret = nlohmann::json::array();
80 ret.push_back(
"none" );
84 [&](
const nlohmann::json& aVal )
86 if( !aVal.is_array() || aVal.empty() )
96 for(
const nlohmann::json& entry : aVal )
100 std::string vs = entry.get<std::string>();
104 else if( vs ==
"none" )
115 if( !visible.any() && !none )
123 [&]() -> nlohmann::json
142 [&](
const nlohmann::json& aVal )
144 if( aVal.empty() || !aVal.is_object() )
161 {
"lockedItems",
false },
162 {
"footprints",
true },
167 {
"graphics",
true },
169 {
"keepouts",
true },
170 {
"dimensions",
true },
171 {
"gridItems",
true },
172 {
"otherItems",
true }
256 [&]() -> nlohmann::json
258 nlohmann::json ret = nlohmann::json::array();
260 for( PROJECT_FILE_STATE& fileState : m_files )
263 file[
"name"] = fileState.fileName;
264 file[
"open"] = fileState.open;
266 nlohmann::json window;
267 window[
"maximized"] = fileState.window.maximized;
268 window[
"size_x"] = fileState.window.size_x;
269 window[
"size_y"] = fileState.window.size_y;
270 window[
"pos_x"] = fileState.window.pos_x;
271 window[
"pos_y"] = fileState.window.pos_y;
272 window[
"display"] = fileState.window.display;
274 file[
"window"] = window;
276 ret.push_back( file );
281 [&](
const nlohmann::json& aVal )
283 if( !aVal.is_array() || aVal.empty() )
288 for(
const nlohmann::json& file : aVal )
294 SetIfPresent( file,
"name", fileState.
fileName );
295 SetIfPresent( file,
"open", fileState.
open );
296 SetIfPresent( file,
"window.size_x", fileState.
window.
size_x );
297 SetIfPresent( file,
"window.size_y", fileState.
window.
size_y );
298 SetIfPresent( file,
"window.pos_x", fileState.
window.
pos_x );
299 SetIfPresent( file,
"window.pos_y", fileState.
window.
pos_y );
301 SetIfPresent( file,
"window.display", fileState.
window.
display );
303 m_files.push_back( fileState );
316 [&]() -> nlohmann::json
320 ret[
"lockedItems"] = m_SchSelectionFilter.lockedItems;
321 ret[
"symbols"] = m_SchSelectionFilter.symbols;
322 ret[
"text"] = m_SchSelectionFilter.text;
323 ret[
"wires"] = m_SchSelectionFilter.wires;
324 ret[
"labels"] = m_SchSelectionFilter.labels;
325 ret[
"pins"] = m_SchSelectionFilter.pins;
326 ret[
"graphics"] = m_SchSelectionFilter.graphics;
327 ret[
"images"] = m_SchSelectionFilter.images;
328 ret[
"ruleAreas"] = m_SchSelectionFilter.ruleAreas;
329 ret[
"otherItems"] = m_SchSelectionFilter.otherItems;
333 [&](
const nlohmann::json& aVal )
335 if( aVal.empty() || !aVal.is_object() )
338 SetIfPresent( aVal,
"lockedItems", m_SchSelectionFilter.lockedItems );
339 SetIfPresent( aVal,
"symbols", m_SchSelectionFilter.symbols );
340 SetIfPresent( aVal,
"text", m_SchSelectionFilter.text );
341 SetIfPresent( aVal,
"wires", m_SchSelectionFilter.wires );
342 SetIfPresent( aVal,
"labels", m_SchSelectionFilter.labels );
343 SetIfPresent( aVal,
"pins", m_SchSelectionFilter.pins );
344 SetIfPresent( aVal,
"graphics", m_SchSelectionFilter.graphics );
345 SetIfPresent( aVal,
"images", m_SchSelectionFilter.images );
346 SetIfPresent( aVal,
"ruleAreas", m_SchSelectionFilter.ruleAreas );
347 SetIfPresent( aVal,
"otherItems", m_SchSelectionFilter.otherItems );
350 {
"lockedItems",
false },
356 {
"graphics",
true },
358 {
"ruleAreas",
true },
359 {
"otherItems",
true }
363 &m_SchHierarchyCollapsed, {} ) );
365 registerMigration( 1, 2,
373 std::string ptr(
"board.visible_items" );
375 if( Contains( ptr ) )
377 if( At( ptr ).is_array() )
384 At(
"board" ).erase(
"visible_items" );
387 m_wasMigrated =
true;
393 registerMigration( 2, 3,
403 const std::map<int, int> offsets = {
422 std::string ptr(
"board.visible_items" );
424 if( Contains( ptr ) && At( ptr ).is_array() )
426 nlohmann::json visible = nlohmann::json::array();
428 for(
const nlohmann::json& val : At( ptr ) )
432 int layer = val.get<
int>();
434 if( offsets.count( layer ) )
435 visible.push_back( offsets.at( layer ) );
437 visible.push_back( layer );
445 At(
"board" )[
"visible_items"] = visible;
446 m_wasMigrated =
true;
452 registerMigration( 3, 4,
457 std::string ptr(
"board.visible_items" );
459 if( Contains( ptr ) )
461 if( At( ptr ).is_array() && !At( ptr ).
empty() )
464 At(
"board" ).erase(
"visible_items" );
466 m_wasMigrated =
true;
472 registerMigration( 4, 5,
480 static const std::map<int, VISIBILITY_LAYER> legacyOffsetToVisibility = {
503 std::string ptr(
"board.visible_items" );
505 if( Contains( ptr ) && At( ptr ).is_array() )
507 std::vector<std::string> newLayers;
509 for( nlohmann::json& entry : At( ptr ) )
511 if( !entry.is_number_integer() )
514 auto it = legacyOffsetToVisibility.find( entry.get<
int>() );
516 if( it != legacyOffsetToVisibility.end() )
520 At( ptr ) = newLayers;
521 m_wasMigrated =
true;
527 registerMigration( 5, 6,
532 std::string ptr(
"board.visible_items" );
534 if( Contains( ptr ) )
536 if( At( ptr ).is_array() && !At( ptr ).
empty() )
539 At(
"board" ).erase(
"visible_items" );
541 m_wasMigrated =
true;
547 registerMigration( 6, 7,
552 std::string ptr(
"board.visible_items" );
554 if( Contains( ptr ) )
556 if( At( ptr ).is_array() && !At( ptr ).
empty() )
559 At(
"board" ).erase(
"visible_items" );
561 m_wasMigrated =
true;
616 return a.fileName == aFileName;
632 return a.fileName == aFileName;
639 fileState.
open =
false;
647 m_files.push_back( fileState );
652 ( *it ).window = aWindowCfg->
state;
653 ( *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.
NET_COLOR_MODE
Determine how net color overrides should be applied.
@ 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.
ZONE_DISPLAY_MODE
Determine how zones should be displayed.
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.
void SetReadOnly(bool aReadOnly)
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.