KiCad PCB EDA Suite
BOARD_DESIGN_SETTINGS Class Reference

BOARD_DESIGN_SETTINGS contains design settings for a BOARD object. More...

#include <board_design_settings.h>

Inheritance diagram for BOARD_DESIGN_SETTINGS:
NESTED_SETTINGS JSON_SETTINGS

Public Member Functions

 BOARD_DESIGN_SETTINGS (JSON_SETTINGS *aParent, const std::string &aPath)
 
virtual ~BOARD_DESIGN_SETTINGS ()
 
 BOARD_DESIGN_SETTINGS (const BOARD_DESIGN_SETTINGS &aOther)
 
BOARD_DESIGN_SETTINGSoperator= (const BOARD_DESIGN_SETTINGS &aOther)
 
bool LoadFromFile (const wxString &aDirectory="") override
 Loads the backing file from disk and then calls Load() More...
 
bool Migrate () override
 Migrates the schema of this settings from the version in the file to the latest version. More...
 
BOARD_STACKUPGetStackupDescriptor ()
 
int GetSeverity (int aDRCErrorCode)
 
bool Ignore (int aDRCErrorCode)
 returns true if the DRC error code's severity is SEVERITY_IGNORE More...
 
NETCLASSESGetNetClasses () const
 
void SetNetClasses (NETCLASSES *aNetClasses)
 
ZONE_SETTINGSGetDefaultZoneSettings ()
 
void SetDefaultZoneSettings (const ZONE_SETTINGS &aSettings)
 
NETCLASSGetDefault () const
 Function GetDefault. More...
 
const wxString & GetCurrentNetClassName () const
 Function GetCurrentNetClassName. More...
 
bool UseNetClassTrack () const
 Function UseNetClassTrack returns true if netclass values should be used to obtain appropriate track width. More...
 
bool UseNetClassVia () const
 Function UseNetClassVia returns true if netclass values should be used to obtain appropriate via size. More...
 
bool UseNetClassDiffPair () const
 Function UseNetClassDiffPair returns true if netclass values should be used to obtain appropriate diff pair dimensions. More...
 
bool SetCurrentNetClass (const wxString &aNetClassName)
 Function SetCurrentNetClass Must be called after a netclass selection (or after a netclass parameter change Initialize vias and tracks values displayed in comb boxes of the auxiliary toolbar and some others parameters (netclass name ....) More...
 
int GetBiggestClearanceValue ()
 Function GetBiggestClearanceValue. More...
 
int GetSmallestClearanceValue ()
 Function GetSmallestClearanceValue. More...
 
int GetCurrentMicroViaSize ()
 Function GetCurrentMicroViaSize. More...
 
int GetCurrentMicroViaDrill ()
 Function GetCurrentMicroViaDrill. More...
 
unsigned GetTrackWidthIndex () const
 Function GetTrackWidthIndex. More...
 
void SetTrackWidthIndex (unsigned aIndex)
 Function SetTrackWidthIndex sets the current track width list index to aIndex. More...
 
int GetCurrentTrackWidth () const
 Function GetCurrentTrackWidth. More...
 
void SetCustomTrackWidth (int aWidth)
 Function SetCustomTrackWidth Sets custom width for track (i.e. More...
 
int GetCustomTrackWidth () const
 Function GetCustomTrackWidth. More...
 
unsigned GetViaSizeIndex () const
 Function GetViaSizeIndex. More...
 
void SetViaSizeIndex (unsigned aIndex)
 Function SetViaSizeIndex sets the current via size list index to aIndex. More...
 
int GetCurrentViaSize () const
 Function GetCurrentViaSize. More...
 
void SetCustomViaSize (int aSize)
 Function SetCustomViaSize Sets custom size for via diameter (i.e. More...
 
int GetCustomViaSize () const
 Function GetCustomViaSize. More...
 
int GetCurrentViaDrill () const
 Function GetCurrentViaDrill. More...
 
void SetCustomViaDrill (int aDrill)
 Function SetCustomViaDrill Sets custom size for via drill (i.e. More...
 
int GetCustomViaDrill () const
 Function GetCustomViaDrill. More...
 
void UseCustomTrackViaSize (bool aEnabled)
 Function UseCustomTrackViaSize Enables/disables custom track/via size settings. More...
 
bool UseCustomTrackViaSize () const
 Function UseCustomTrackViaSize. More...
 
unsigned GetDiffPairIndex () const
 Function GetDiffPairIndex. More...
 
void SetDiffPairIndex (unsigned aIndex)
 Function SetDiffPairIndex. More...
 
void SetCustomDiffPairWidth (int aWidth)
 Function SetCustomDiffPairWidth Sets custom track width for differential pairs (i.e. More...
 
int GetCustomDiffPairWidth ()
 Function GetCustomDiffPairWidth. More...
 
void SetCustomDiffPairGap (int aGap)
 Function SetCustomDiffPairGap Sets custom gap for differential pairs (i.e. More...
 
int GetCustomDiffPairGap ()
 Function GetCustomDiffPairGap. More...
 
void SetCustomDiffPairViaGap (int aGap)
 Function SetCustomDiffPairViaGap Sets custom via gap for differential pairs (i.e. More...
 
int GetCustomDiffPairViaGap ()
 Function GetCustomDiffPairViaGap. More...
 
void UseCustomDiffPairDimensions (bool aEnabled)
 Function UseCustomDiffPairDimensions Enables/disables custom differential pair dimensions. More...
 
bool UseCustomDiffPairDimensions () const
 Function UseCustomDiffPairDimensions. More...
 
int GetCurrentDiffPairWidth () const
 Function GetCurrentDiffPairWidth. More...
 
int GetCurrentDiffPairGap () const
 Function GetCurrentDiffPairGap. More...
 
int GetCurrentDiffPairViaGap () const
 Function GetCurrentDiffPairViaGap. More...
 
void SetMinHoleSeparation (int aDistance)
 Function SetMinHoleSeparation. More...
 
void SetCopperEdgeClearance (int aDistance)
 Function SetCopperEdgeClearance. More...
 
LSET GetEnabledLayers () const
 Function GetEnabledLayers returns a bit-mask of all the layers that are enabled. More...
 
void SetEnabledLayers (LSET aMask)
 Function SetEnabledLayers changes the bit-mask of enabled layers. More...
 
bool IsLayerEnabled (PCB_LAYER_ID aLayerId) const
 Function IsLayerEnabled tests whether a given layer is enabled. More...
 
int GetCopperLayerCount () const
 Function GetCopperLayerCount. More...
 
void SetCopperLayerCount (int aNewLayerCount)
 Function SetCopperLayerCount do what its name says... More...
 
int GetBoardThickness () const
 
void SetBoardThickness (int aThickness)
 
int GetDRCEpsilon () const
 
int GetHolePlatingThickness () const
 Pad & via drills are finish size. More...
 
int GetLineThickness (PCB_LAYER_ID aLayer) const
 Function GetLineThickness Returns the default graphic segment thickness from the layer class for the given layer. More...
 
wxSize GetTextSize (PCB_LAYER_ID aLayer) const
 Function GetTextSize Returns the default text size from the layer class for the given layer. More...
 
int GetTextThickness (PCB_LAYER_ID aLayer) const
 Function GetTextThickness Returns the default text thickness from the layer class for the given layer. More...
 
bool GetTextItalic (PCB_LAYER_ID aLayer) const
 
bool GetTextUpright (PCB_LAYER_ID aLayer) const
 
int GetLayerClass (PCB_LAYER_ID aLayer) const
 
bool SaveToFile (const wxString &aDirectory="", bool aForce=false) override
 Calls Store() and then saves the JSON document contents into the parent JSON_SETTINGS. More...
 
void SetParent (JSON_SETTINGS *aParent)
 
JSON_SETTINGSGetParent ()
 
wxString GetFilename () const
 
wxString GetFullFilename () const
 
SETTINGS_LOC GetLocation () const
 
void SetLegacyFilename (const wxString &aFilename)
 
virtual void Load ()
 Updates the parameters of this object based on the current JSON document contents. More...
 
virtual bool Store ()
 Stores the current parameters into the JSON document represented by this object Note: this doesn't do any writing to disk; that's handled by SETTINGS_MANAGER. More...
 
void ResetToDefaults ()
 Resets all parameters to default values. More...
 
OPT< nlohmann::jsonGetJson (const std::string &aPath) const
 Fetches a JSON object that is a subset of this JSON_SETTINGS object, using a path of the form "key1.key2.key3" to refer to nested objects. More...
 
template<typename ValueType >
OPT< ValueType > Get (const std::string &aPath) const
 Fetches a value from within the JSON document. More...
 
template<>
OPT< wxString > Get (const std::string &aPath) const
 
template<typename ValueType >
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 library can handle. More...
 
template<>
void Set (const std::string &aPath, wxString aVal)
 
template<>
void Set (const std::string &aPath, wxString aVal)
 
virtual bool MigrateFromLegacy (wxConfigBase *aLegacyConfig)
 Migrates from wxConfig to JSON-based configuration. More...
 
void AddNestedSettings (NESTED_SETTINGS *aSettings)
 Transfers ownership of a given NESTED_SETTINGS to this object. More...
 
void ReleaseNestedSettings (NESTED_SETTINGS *aSettings)
 Saves and frees a nested settings object, if it exists within this one. More...
 
void SetManager (SETTINGS_MANAGER *aManager)
 

Static Public Member Functions

static nlohmann::json::json_pointer PointerFromString (std::string aPath)
 Builds a JSON pointer based on a given string. More...
 
static bool SetIfPresent (const nlohmann::json &aObj, const std::string &aPath, wxString &aTarget)
 Sets the given string if the given key/path is present. More...
 
static bool SetIfPresent (const nlohmann::json &aObj, const std::string &aPath, bool &aTarget)
 Sets the given bool if the given key/path is present. More...
 
static bool SetIfPresent (const nlohmann::json &aObj, const std::string &aPath, int &aTarget)
 Sets the given int if the given key/path is present. More...
 
static bool SetIfPresent (const nlohmann::json &aObj, const std::string &aPath, unsigned int &aTarget)
 Sets the given unsigned int if the given key/path is present. More...
 

Public Attributes

std::vector< int > m_TrackWidthList
 
std::vector< VIA_DIMENSIONm_ViasDimensionsList
 
std::vector< DIFF_PAIR_DIMENSIONm_DiffPairDimensionsList
 
bool m_MicroViasAllowed
 true to allow micro vias More...
 
bool m_BlindBuriedViaAllowed
 true to allow blind/buried vias More...
 
VIATYPE m_CurrentViaType
 (VIA_BLIND_BURIED, VIA_THROUGH, VIA_MICROVIA) More...
 
bool m_UseConnectedTrackWidth
 
int m_MinClearance
 
int m_TrackMinWidth
 
int m_ViasMinAnnulus
 
int m_ViasMinSize
 
int m_MinThroughDrill
 
int m_MicroViasMinSize
 
int m_MicroViasMinDrill
 
int m_CopperEdgeClearance
 
int m_HoleToHoleMin
 
std::shared_ptr< DRC_ENGINEm_DRCEngine
 
std::map< int, int > m_DRCSeverities
 
std::set< wxString > m_DrcExclusions
 
int m_ZoneFillVersion
 
bool m_ZoneKeepExternalFillets
 
int m_MaxError
 
int m_SolderMaskMargin
 
int m_SolderMaskMinWidth
 
int m_SolderPasteMargin
 
double m_SolderPasteMarginRatio
 
std::vector< TEXT_ITEM_INFOm_DefaultFPTextItems
 
int m_LineThickness [LAYER_CLASS_COUNT]
 
wxSize m_TextSize [LAYER_CLASS_COUNT]
 
int m_TextThickness [LAYER_CLASS_COUNT]
 
bool m_TextItalic [LAYER_CLASS_COUNT]
 
bool m_TextUpright [LAYER_CLASS_COUNT]
 
DIM_UNITS_MODE m_DimensionUnitsMode
 
int m_DimensionPrecision
 Number of digits after the decimal. More...
 
DIM_UNITS_FORMAT m_DimensionUnitsFormat
 
bool m_DimensionSuppressZeroes
 
DIM_TEXT_POSITION m_DimensionTextPosition
 
bool m_DimensionKeepTextAligned
 
int m_DimensionArrowLength
 
int m_DimensionExtensionOffset
 
wxPoint m_AuxOrigin
 origin for plot exports More...
 
wxPoint m_GridOrigin
 origin for grid offsets More...
 
D_PAD m_Pad_Master
 
bool m_HasStackup
 

Protected Member Functions

template<typename ValueType >
bool fromLegacy (wxConfigBase *aConfig, const std::string &aKey, const std::string &aDest)
 Translates a legacy wxConfig value to a given JSON pointer value. More...
 
bool fromLegacyString (wxConfigBase *aConfig, const std::string &aKey, const std::string &aDest)
 Translates a legacy wxConfig string value to a given JSON pointer value. More...
 
bool fromLegacyColor (wxConfigBase *aConfig, const std::string &aKey, const std::string &aDest)
 Translates a legacy COLOR4D stored in a wxConfig string to a given JSON pointer value. More...
 
virtual wxString getFileExt () const
 
virtual wxString getLegacyFileExt () const
 

Protected Attributes

JSON_SETTINGSm_parent
 A pointer to the parent object to load and store from. More...
 
std::string m_path
 The path (in pointer format) of where to store this document in the parent. More...
 
wxString m_filename
 The filename (not including path) of this settings file (inicode) More...
 
wxString m_legacy_filename
 The filename of the wxConfig legacy file (if different from m_filename) More...
 
SETTINGS_LOC m_location
 The location of this settings file (. More...
 
std::vector< PARAM_BASE * > m_params
 The list of parameters (owned by this object) More...
 
std::vector< NESTED_SETTINGS * > m_nested_settings
 Nested settings files that live inside this one, if any. More...
 
bool m_createIfMissing
 Whether or not the backing store file should be created it if doesn't exist. More...
 
bool m_createIfDefault
 Whether or not the backing store file should be created if all parameters are still at their default values. More...
 
bool m_writeFile
 Whether or not the backing store file should be written. More...
 
bool m_deleteLegacyAfterMigration
 Whether or not to delete legacy file after migration. More...
 
bool m_resetParamsIfMissing
 Whether or not to set parameters to their default value if missing from JSON on Load() More...
 
int m_schemaVersion
 Version of this settings schema. More...
 
SETTINGS_MANAGERm_manager
 A pointer to the settings manager managing this file (may be null) More...
 
std::vector< nlohmann::json::json_pointer > m_preserved_paths
 A list of JSON pointers that are preserved during a read-update-write to disk. More...
 

Private Member Functions

void initFromOther (const BOARD_DESIGN_SETTINGS &aOther)
 
bool migrateSchema0to1 ()
 

Private Attributes

unsigned m_trackWidthIndex
 
unsigned m_viaSizeIndex
 
unsigned m_diffPairIndex
 
bool m_useCustomTrackVia
 
int m_customTrackWidth
 
VIA_DIMENSION m_customViaSize
 
bool m_useCustomDiffPair
 
DIFF_PAIR_DIMENSION m_customDiffPair
 
int m_copperLayerCount
 Number of copper layers for this design. More...
 
LSET m_enabledLayers
 Bit-mask for layer enabling. More...
 
int m_boardThickness
 Board thickness for 3D viewer. More...
 
wxString m_currentNetClassName
 Current net class name used to display netclass info. More...
 
BOARD_STACKUP m_stackup
 the description of layers stackup, for board fabrication only physical layers are in layers stackup. More...
 
NETCLASSES m_internalNetClasses
 Net classes that are loaded from the board file before these were stored in the project. More...
 
NETCLASSESm_netClasses
 This will point to m_internalNetClasses until it is repointed to the project after load. More...
 
ZONE_SETTINGS m_defaultZoneSettings
 The defualt settings that will be used for new zones. More...
 

Detailed Description

BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.

Definition at line 219 of file board_design_settings.h.

Constructor & Destructor Documentation

◆ BOARD_DESIGN_SETTINGS() [1/2]

BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS ( JSON_SETTINGS aParent,
const std::string &  aPath 
)

Definition at line 40 of file board_design_settings.cpp.

40  :
41  NESTED_SETTINGS( "board_design_settings", bdsSchemaVersion, aParent, aPath ),
43 {
44  // We want to leave alone parameters that aren't found in the project JSON as they may be
45  // initialized by the board file parser before NESTED_SETTINGS::LoadFromFile is called.
46  m_resetParamsIfMissing = false;
47 
48  // Create a default NETCLASS list so that things don't break horribly if there's no project
49  // loaded. This also is used during file load for legacy boards that have netclasses stored
50  // in the file. After load, this information will be moved to the project and the pointer
51  // updated.
53 
54  m_HasStackup = false; // no stackup defined by default
55 
56  LSET all_set = LSET().set();
57  m_enabledLayers = all_set; // All layers enabled at first.
58  // SetCopperLayerCount() will adjust this.
59 
60  SetCopperLayerCount( 2 ); // Default design is a double sided board
62 
63  // if true, when creating a new track starting on an existing track, use this track width
65 
67  m_MicroViasAllowed = false;
68 
69  // First is always the reference designator
70  m_DefaultFPTextItems.emplace_back( wxT( "REF**" ), true, F_SilkS );
71  // Second is always the value
72  m_DefaultFPTextItems.emplace_back( wxT( "" ), true, F_Fab );
73  // Any following ones are freebies
74  m_DefaultFPTextItems.emplace_back( wxT( "${REF}" ), true, F_Fab );
75 
80  m_TextItalic[ LAYER_CLASS_SILK ] = false;
82 
89 
90  // Edges & Courtyards; text properties aren't used but better to have them holding
91  // reasonable values than not.
98 
105 
110  m_TextItalic[ LAYER_CLASS_FAB ] = false;
111  m_TextUpright[ LAYER_CLASS_FAB ] = false;
112 
117  m_TextItalic[ LAYER_CLASS_OTHERS ] = false;
119 
128 
129  m_useCustomTrackVia = false;
133 
134  m_useCustomDiffPair = false;
138 
148 
149  for( int errorCode = DRCE_FIRST; errorCode <= DRCE_LAST; ++errorCode )
150  m_DRCSeverities[ errorCode ] = RPT_SEVERITY_ERROR;
151 
155 
158 
163 
164  m_MaxError = ARC_HIGH_DEF;
165  m_ZoneFillVersion = 6; // Use new algo by default to fill zones
166  m_ZoneKeepExternalFillets = false; // Use new algo by default. Legacy boards might
167  // want to set it to true for old algo....
168 
169  // Global mask margins:
172  m_SolderPasteMargin = 0; // Solder paste margin absolute value
173  m_SolderPasteMarginRatio = 0.0; // Solder paste margin as a ratio of pad size
174  // The final margin is the sum of these 2 values
175  // Usually < 0 because the mask is smaller than pad
176  // Layer thickness for 3D viewer
178 
179  m_viaSizeIndex = 0;
180  m_trackWidthIndex = 0;
181  m_diffPairIndex = 0;
182 
183  // Parameters stored in JSON in the project file
184 
185  // NOTE: Previously, BOARD_DESIGN_SETTINGS stored the basic board layer information (layer
186  // names and enable/disable state) in the project file even though this information is also
187  // stored in the board file. This was implemented for importing these settings from another
188  // project. Going forward, the import feature will just import from other board files (since
189  // we could have multi-board projects in the future anyway) so this functionality is dropped.
190 
191  m_params.emplace_back( new PARAM<bool>( "rules.allow_microvias", &m_MicroViasAllowed, false ) );
192 
193  m_params.emplace_back( new PARAM<bool>( "rules.allow_blind_buried_vias",
194  &m_BlindBuriedViaAllowed, false ) );
195 
196  m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_clearance", &m_MinClearance,
198  MM_PER_IU ) );
199 
200  m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_track_width", &m_TrackMinWidth,
202  MM_PER_IU ) );
203 
204  m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_via_annulus", &m_ViasMinAnnulus,
206  MM_PER_IU ) );
207 
208  m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_via_diameter", &m_ViasMinSize,
210  MM_PER_IU ) );
211 
212  m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_through_hole_diameter",
214  Millimeter2iu( 25.0 ), MM_PER_IU ) );
215 
216  m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_microvia_diameter",
218  Millimeter2iu( 10.0 ), MM_PER_IU ) );
219 
220  m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_microvia_drill", &m_MicroViasMinDrill,
222  Millimeter2iu( 10.0 ), MM_PER_IU ) );
223 
224  m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_hole_to_hole", &m_HoleToHoleMin,
226  MM_PER_IU ) );
227 
228  // Note: a clearance of -0.01 is a flag indicating we should use the legacy (pre-6.0) method
229  // based on the edge cut thicknesses.
230  m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_copper_edge_clearance",
232  Millimeter2iu( -0.01 ), Millimeter2iu( 25.0 ), MM_PER_IU ) );
233 
234  m_params.emplace_back( new PARAM_SCALED<int>( "rules.solder_mask_clearance",
236  Millimeter2iu( -1.0 ), Millimeter2iu( 1.0 ), MM_PER_IU ) );
237 
238  m_params.emplace_back( new PARAM_SCALED<int>( "rules.solder_mask_min_width",
240  Millimeter2iu( 1.0 ), MM_PER_IU ) );
241 
242  m_params.emplace_back( new PARAM_SCALED<int>( "rules.solder_paste_clearance",
244  Millimeter2iu( -1.0 ), Millimeter2iu( 1.0 ), MM_PER_IU ) );
245 
246  m_params.emplace_back( new PARAM<double>( "rules.solder_paste_margin_ratio",
248 
249  m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "rule_severities",
250  [&]() -> nlohmann::json
251  {
252  nlohmann::json ret = {};
253 
254  for( const RC_ITEM& item : DRC_ITEM::GetItemsWithSeverities() )
255  {
256  int code = item.GetErrorCode();
257 
258  if( !m_DRCSeverities.count( code ) )
259  continue;
260 
261  wxString name = item.GetSettingsKey();
262 
263  ret[std::string( name.ToUTF8() )] =
264  SeverityToString( static_cast<SEVERITY>( m_DRCSeverities[code] ) );
265  }
266 
267  return ret;
268  },
269  [&]( const nlohmann::json& aJson )
270  {
271  if( !aJson.is_object() )
272  return;
273 
274  for( const RC_ITEM& item : DRC_ITEM::GetItemsWithSeverities() )
275  {
276  wxString name = item.GetSettingsKey();
277  std::string key( name.ToUTF8() );
278 
279  if( aJson.contains( key ) )
280  m_DRCSeverities[item.GetErrorCode()] = SeverityFromString( aJson[key] );
281  }
282  }, {} ) );
283 
284  m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "drc_exclusions",
285  [&]() -> nlohmann::json
286  {
287  nlohmann::json js = nlohmann::json::array();
288 
289  for( const auto& entry : m_DrcExclusions )
290  js.push_back( entry );
291 
292  return js;
293  },
294  [&]( const nlohmann::json& aObj )
295  {
296  m_DrcExclusions.clear();
297 
298  if( !aObj.is_array() )
299  return;
300 
301  for( const nlohmann::json& entry : aObj )
302  {
303  if( entry.empty() )
304  continue;
305 
306  m_DrcExclusions.insert( entry.get<wxString>() );
307  }
308  },
309  {} ) );
310 
311  m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "track_widths",
312  [&]() -> nlohmann::json
313  {
314  nlohmann::json js = nlohmann::json::array();
315 
316  for( const int& width : m_TrackWidthList )
317  js.push_back( Iu2Millimeter( width ) );
318 
319  return js;
320  },
321  [&]( const nlohmann::json& aJson )
322  {
323  if( !aJson.is_array() )
324  return;
325 
326  m_TrackWidthList.clear();
327 
328  for( const nlohmann::json& entry : aJson )
329  {
330  if( entry.empty() )
331  continue;
332 
333  m_TrackWidthList.emplace_back( Millimeter2iu( entry.get<double>() ) );
334  }
335  },
336  {} ) );
337 
338  m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "via_dimensions",
339  [&]() -> nlohmann::json
340  {
341  nlohmann::json js = nlohmann::json::array();
342 
343  for( const auto& via : m_ViasDimensionsList )
344  {
345  nlohmann::json entry = {};
346 
347  entry["diameter"] = Iu2Millimeter( via.m_Diameter );
348  entry["drill"] = Iu2Millimeter( via.m_Drill );
349 
350  js.push_back( entry );
351  }
352 
353  return js;
354  },
355  [&]( const nlohmann::json& aObj )
356  {
357  if( !aObj.is_array() )
358  return;
359 
360  m_ViasDimensionsList.clear();
361 
362  for( const nlohmann::json& entry : aObj )
363  {
364  if( entry.empty() || !entry.is_object() )
365  continue;
366 
367  if( !entry.contains( "diameter" ) || !entry.contains( "drill" ) )
368  continue;
369 
370  int diameter = Millimeter2iu( entry["diameter"].get<double>() );
371  int drill = Millimeter2iu( entry["drill"].get<double>() );
372 
373  m_ViasDimensionsList.emplace_back( VIA_DIMENSION( diameter, drill ) );
374  }
375  },
376  {} ) );
377 
378  m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "diff_pair_dimensions",
379  [&]() -> nlohmann::json
380  {
381  nlohmann::json js = nlohmann::json::array();
382 
383  for( const auto& pair : m_DiffPairDimensionsList )
384  {
385  nlohmann::json entry = {};
386 
387  entry["width"] = Iu2Millimeter( pair.m_Width );
388  entry["gap"] = Iu2Millimeter( pair.m_Gap );
389  entry["via_gap"] = Iu2Millimeter( pair.m_ViaGap );
390 
391  js.push_back( entry );
392  }
393 
394  return js;
395  },
396  [&]( const nlohmann::json& aObj )
397  {
398  if( !aObj.is_array() )
399  return;
400 
401  m_DiffPairDimensionsList.clear();
402 
403  for( const nlohmann::json& entry : aObj )
404  {
405  if( entry.empty() || !entry.is_object() )
406  continue;
407 
408  if( !entry.contains( "width" ) || !entry.contains( "gap" )
409  || !entry.contains( "via_gap" ) )
410  continue;
411 
412  int width = Millimeter2iu( entry["width"].get<int>() );
413  int gap = Millimeter2iu( entry["gap"].get<int>() );
414  int via_gap = Millimeter2iu( entry["via_gap"].get<int>() );
415 
416  m_DiffPairDimensionsList.emplace_back(
417  DIFF_PAIR_DIMENSION( width, gap, via_gap ) );
418  }
419  },
420  {} ) );
421 
422  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.silk_line_width",
424  Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), MM_PER_IU ) );
425 
426  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.silk_text_size_v",
428  TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, MM_PER_IU ) );
429 
430  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.silk_text_size_h",
432  TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, MM_PER_IU ) );
433 
434  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.silk_text_thickness",
436  TEXTS_MAX_WIDTH, MM_PER_IU ) );
437 
438  m_params.emplace_back( new PARAM<bool>( "defaults.silk_text_italic",
439  &m_TextItalic[LAYER_CLASS_SILK], false ) );
440 
441  m_params.emplace_back( new PARAM<bool>( "defaults.silk_text_upright",
442  &m_TextUpright[ LAYER_CLASS_SILK ], true ) );
443 
444  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.copper_line_width",
446  Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), MM_PER_IU ) );
447 
448  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.copper_text_size_v",
450  TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, MM_PER_IU ) );
451 
452  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.copper_text_size_h",
454  TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, MM_PER_IU ) );
455 
456  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.copper_text_thickness",
458  Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), MM_PER_IU ) );
459 
460  m_params.emplace_back( new PARAM<bool>( "defaults.copper_text_italic",
461  &m_TextItalic[LAYER_CLASS_COPPER], false ) );
462 
463  m_params.emplace_back( new PARAM<bool>( "defaults.copper_text_upright",
464  &m_TextUpright[LAYER_CLASS_COPPER], true ) );
465 
466  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.board_outline_line_width",
468  Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), MM_PER_IU ) );
469 
470  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.courtyard_line_width",
472  Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), MM_PER_IU ) );
473 
474  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.fab_line_width",
476  Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), MM_PER_IU ) );
477 
478  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.fab_text_size_v",
480  TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, MM_PER_IU ) );
481 
482  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.fab_text_size_h",
484  TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, MM_PER_IU ) );
485 
486  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.fab_text_thickness",
488  Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), MM_PER_IU ) );
489 
490  m_params.emplace_back( new PARAM<bool>( "defaults.fab_text_italic",
491  &m_TextItalic[LAYER_CLASS_FAB], false ) );
492 
493  m_params.emplace_back( new PARAM<bool>( "defaults.fab_text_upright",
494  &m_TextUpright[LAYER_CLASS_FAB], true ) );
495 
496  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.other_line_width",
498  Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), MM_PER_IU ) );
499 
500  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.other_text_size_v",
502  TEXTS_MAX_SIZE, MM_PER_IU ) );
503 
504  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.other_text_size_h",
506  TEXTS_MAX_SIZE, MM_PER_IU ) );
507 
508  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.other_text_thickness",
510  Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), MM_PER_IU ) );
511 
512  m_params.emplace_back( new PARAM<bool>( "defaults.other_text_italic",
513  &m_TextItalic[LAYER_CLASS_OTHERS], false ) );
514 
515  m_params.emplace_back( new PARAM<bool>( "defaults.other_text_upright",
516  &m_TextUpright[LAYER_CLASS_OTHERS], true ) );
517 
518  m_params.emplace_back( new PARAM_ENUM<DIM_UNITS_MODE>( "defaults.dimension_units",
521 
522  m_params.emplace_back( new PARAM<int>( "defaults.dimension_precision",
523  &m_DimensionPrecision, 4, 0, 5 ) );
524 
525  m_params.emplace_back( new PARAM_ENUM<DIM_UNITS_FORMAT>( "defaults.dimensions.units_format",
528 
529  m_params.emplace_back( new PARAM<bool>( "defaults.dimensions.suppress_zeroes",
530  &m_DimensionSuppressZeroes, false ) );
531 
532  // NOTE: excluding DIM_TEXT_POSITION::MANUAL from the valid range here
533  m_params.emplace_back( new PARAM_ENUM<DIM_TEXT_POSITION>( "defaults.dimensions.text_position",
536 
537  m_params.emplace_back( new PARAM<bool>( "defaults.dimensions.keep_text_aligned",
538  &m_DimensionKeepTextAligned, true ) );
539 
540  m_params.emplace_back( new PARAM<int>( "defaults.dimensions.arrow_length",
542  Mils2iu( DEFAULT_DIMENSION_ARROW_LENGTH ) ) );
543 
544  m_params.emplace_back( new PARAM<int>( "defaults.dimensions.extension_offset",
547 
548  m_params.emplace_back( new PARAM<bool>( "defaults.zones.45_degree_only",
550 
551  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.zones.min_clearance",
553  Millimeter2iu( 0.0 ), Millimeter2iu( 25.0 ), MM_PER_IU ) );
554 
555  m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "defaults.pads",
556  [&]() -> nlohmann::json
557  {
558  nlohmann::json ret =
559  {
560  { "width", Iu2Millimeter( m_Pad_Master.GetSize().x ) },
561  { "height", Iu2Millimeter( m_Pad_Master.GetSize().y ) },
562  { "drill", Iu2Millimeter( m_Pad_Master.GetDrillSize().x ) }
563  };
564 
565  return ret;
566  },
567  [&]( const nlohmann::json& aJson )
568  {
569  if( aJson.contains( "width" ) && aJson.contains( "height" )
570  && aJson.contains( "drill" ) )
571  {
572  wxSize sz;
573  sz.SetWidth( Millimeter2iu( aJson["width"].get<double>() ) );
574  sz.SetHeight( Millimeter2iu( aJson["height"].get<double>() ) );
575 
576  m_Pad_Master.SetSize( sz );
577 
578  int drill = Millimeter2iu( aJson["drill"].get<double>() );
579 
580  m_Pad_Master.SetDrillSize( wxSize( drill, drill ) );
581  }
582  }, {} ) );
583 
584  m_params.emplace_back( new PARAM_SCALED<int>( "rules.max_error", &m_MaxError, ARC_HIGH_DEF,
585  Millimeter2iu( 0.0001 ), Millimeter2iu( 1.0 ), MM_PER_IU ) );
586 
587  // TODO: replace with zones_fill_version parameter and migrate zones_use_no_outline?
588  m_params.emplace_back( new PARAM_LAMBDA<bool>( "zones_use_no_outline",
589  [this]() -> bool
590  {
591  return m_ZoneFillVersion >= 6;
592  },
593  [this]( bool aVal )
594  {
595  m_ZoneFillVersion = aVal ? 6 : 5;
596  },
597  6 ) );
598 
599  m_params.emplace_back( new PARAM<bool>( "zones_allow_external_fillets",
600  &m_ZoneKeepExternalFillets, false ) );
601 }
#define DEFAULT_EDGE_WIDTH
#define DEFAULT_SILK_TEXT_WIDTH
void SetCopperLayerCount(int aNewLayerCount)
Function SetCopperLayerCount do what its name says...
#define DEFAULT_TRACKMINWIDTH
Struct VIA_DIMENSION is a small helper container to handle a stock of specific vias each with unique ...
#define DEFAULT_COURTYARD_WIDTH
Text appears outside the dimension line (default)
std::vector< TEXT_ITEM_INFO > m_DefaultFPTextItems
std::vector< PARAM_BASE * > m_params
The list of parameters (owned by this object)
#define DEFAULT_SOLDERPASTE_RATIO
Like a normal param, but with custom getter and setter functions.
Definition: parameters.h:296
#define DEFAULT_VIASMINSIZE
#define TEXTS_MAX_WIDTH
Maximum text width in internal units (10 inches)
Definition: pcbnew.h:34
std::vector< int > m_TrackWidthList
std::vector< DIFF_PAIR_DIMENSION > m_DiffPairDimensionsList
RC_ITEM is a holder for a DRC (in Pcbnew) or ERC (in Eeschema) error item.
Definition: rc_item.h:74
NETCLASSES m_internalNetClasses
Net classes that are loaded from the board file before these were stored in the project.
#define LEGACY_COPPEREDGECLEARANCE
#define DEFAULT_BOARD_THICKNESS_MM
int m_DimensionPrecision
Number of digits after the decimal.
ZONE_SETTINGS m_defaultZoneSettings
The defualt settings that will be used for new zones.
#define DEFAULT_LINE_WIDTH
#define DEFAULT_DIMENSION_ARROW_LENGTH
#define DEFAULT_COPPER_LINE_WIDTH
#define DEFAULT_HOLETOHOLEMIN
Stores an enum as an integer.
Definition: parameters.h:226
void SetDrillSize(const wxSize &aSize)
Definition: class_pad.h:229
DIFF_PAIR_DIMENSION m_customDiffPair
#define DEFAULT_CUSTOMDPAIRGAP
VIATYPE m_CurrentViaType
(VIA_BLIND_BURIED, VIA_THROUGH, VIA_MICROVIA)
nlohmann::json json
Definition: gerbview.cpp:40
Struct DIFF_PAIR_DIMENSION is a small helper container to handle a stock of specific differential pai...
#define DEFAULT_MINCLEARANCE
#define DEFAULT_MINTHROUGHDRILL
DIM_TEXT_POSITION m_DimensionTextPosition
DIM_UNITS_MODE m_DimensionUnitsMode
#define DEFAULT_CUSTOMDPAIRVIAGAP
#define DEFAULT_DIMENSION_EXTENSION_OFFSET
#define DEFAULT_SOLDERPASTE_CLEARANCE
#define DEFAULT_TEXT_WIDTH
wxSize m_TextSize[LAYER_CLASS_COUNT]
#define DEFAULT_CUSTOMDPAIRWIDTH
#define DEFAULT_SILK_TEXT_SIZE
int m_TextThickness[LAYER_CLASS_COUNT]
LSET is a set of PCB_LAYER_IDs.
#define DEFAULT_SILK_LINE_WIDTH
#define NULL
bool m_TextItalic[LAYER_CLASS_COUNT]
Text appears in line with the dimension line.
Represents a parameter that has a scaling factor between the value in the file and the value used int...
Definition: parameters.h:388
void SetSize(const wxSize &aSize)
Definition: class_pad.h:223
#define ZONE_CLEARANCE_MIL
Definition: zones.h:33
bool m_BlindBuriedViaAllowed
true to allow blind/buried vias
const int bdsSchemaVersion
#define TEXTS_MAX_SIZE
Maximum text size in internal units (10 inches)
Definition: pcbnew.h:33
#define DEFAULT_MICROVIASMINSIZE
#define DEFAULT_MICROVIASMINDRILL
#define DEFAULT_SOLDERMASK_MIN_WIDTH
int m_LineThickness[LAYER_CLASS_COUNT]
std::map< int, int > m_DRCSeverities
#define TEXTS_MIN_SIZE
Minimum text size in internal units (1 mil)
Definition: pcbnew.h:32
#define DEFAULT_COPPEREDGECLEARANCE
bool m_resetParamsIfMissing
Whether or not to set parameters to their default value if missing from JSON on Load()
wxString SeverityToString(const SEVERITY &aSeverity)
Definition: ui_common.cpp:135
const char * name
Definition: DXF_plotter.cpp:60
SEVERITY SeverityFromString(const wxString &aSeverity)
Definition: ui_common.cpp:124
static std::vector< std::reference_wrapper< RC_ITEM > > GetItemsWithSeverities()
Definition: drc_item.h:93
const wxSize & GetDrillSize() const
Definition: class_pad.h:230
NESTED_SETTINGS(const std::string &aName, int aSchemaVersion, JSON_SETTINGS *aParent, const std::string &aPath)
#define DEFAULT_COPPER_TEXT_WIDTH
std::vector< VIA_DIMENSION > m_ViasDimensionsList
#define DEFAULT_CUSTOMTRACKWIDTH
DIM_UNITS_FORMAT m_DimensionUnitsFormat
#define DEFAULT_TEXT_SIZE
The offset of the pin name string from the end of the pin in mils.
NETCLASSES * m_netClasses
This will point to m_internalNetClasses until it is repointed to the project after load.
#define DEFAULT_SOLDERMASK_CLEARANCE
#define DEFAULT_COPPER_TEXT_SIZE
bool m_MicroViasAllowed
true to allow micro vias
const wxSize & GetSize() const
Definition: class_pad.h:224
std::set< wxString > m_DrcExclusions
static constexpr int Millimeter2iu(double mm)
LSET m_enabledLayers
Bit-mask for layer enabling.
int m_boardThickness
Board thickness for 3D viewer.
bool m_TextUpright[LAYER_CLASS_COUNT]

References AUTOMATIC, BARE_SUFFIX, DEFAULT_BOARD_THICKNESS_MM, DEFAULT_COPPER_LINE_WIDTH, DEFAULT_COPPER_TEXT_SIZE, DEFAULT_COPPER_TEXT_WIDTH, DEFAULT_COPPEREDGECLEARANCE, DEFAULT_COURTYARD_WIDTH, DEFAULT_CUSTOMDPAIRGAP, DEFAULT_CUSTOMDPAIRVIAGAP, DEFAULT_CUSTOMDPAIRWIDTH, DEFAULT_CUSTOMTRACKWIDTH, DEFAULT_DIMENSION_ARROW_LENGTH, DEFAULT_DIMENSION_EXTENSION_OFFSET, DEFAULT_EDGE_WIDTH, DEFAULT_HOLETOHOLEMIN, DEFAULT_LINE_WIDTH, DEFAULT_MICROVIASMINDRILL, DEFAULT_MICROVIASMINSIZE, DEFAULT_MINCLEARANCE, DEFAULT_MINTHROUGHDRILL, DEFAULT_SILK_LINE_WIDTH, DEFAULT_SILK_TEXT_SIZE, DEFAULT_SILK_TEXT_WIDTH, DEFAULT_SOLDERMASK_CLEARANCE, DEFAULT_SOLDERMASK_MIN_WIDTH, DEFAULT_SOLDERPASTE_CLEARANCE, DEFAULT_SOLDERPASTE_RATIO, DEFAULT_TEXT_SIZE, DEFAULT_TEXT_WIDTH, DEFAULT_TRACKMINWIDTH, DEFAULT_VIASMINSIZE, DRCE_DANGLING_TRACK, DRCE_DANGLING_VIA, DRCE_DUPLICATE_FOOTPRINT, DRCE_EXTRA_FOOTPRINT, DRCE_FIRST, DRCE_LAST, DRCE_MISSING_COURTYARD, DRCE_MISSING_FOOTPRINT, DRCE_NET_CONFLICT, DRCE_NPTH_IN_COURTYARD, DRCE_PTH_IN_COURTYARD, F_Fab, F_SilkS, D_PAD::GetDrillSize(), DRC_ITEM::GetItemsWithSeverities(), D_PAD::GetSize(), INCHES, INLINE, LAYER_CLASS_COPPER, LAYER_CLASS_COURTYARD, LAYER_CLASS_EDGES, LAYER_CLASS_FAB, LAYER_CLASS_OTHERS, LAYER_CLASS_SILK, LEGACY_COPPEREDGECLEARANCE, m_BlindBuriedViaAllowed, m_boardThickness, m_CopperEdgeClearance, m_CurrentViaType, m_customDiffPair, m_customTrackWidth, m_customViaSize, m_DefaultFPTextItems, m_defaultZoneSettings, VIA_DIMENSION::m_Diameter, m_DiffPairDimensionsList, m_diffPairIndex, m_DimensionArrowLength, m_DimensionExtensionOffset, m_DimensionKeepTextAligned, m_DimensionPrecision, m_DimensionSuppressZeroes, m_DimensionTextPosition, m_DimensionUnitsFormat, m_DimensionUnitsMode, m_DrcExclusions, m_DRCSeverities, VIA_DIMENSION::m_Drill, m_enabledLayers, DIFF_PAIR_DIMENSION::m_Gap, m_HasStackup, m_HoleToHoleMin, m_internalNetClasses, m_LineThickness, m_MaxError, m_MicroViasAllowed, m_MicroViasMinDrill, m_MicroViasMinSize, m_MinClearance, m_MinThroughDrill, m_netClasses, m_Pad_Master, JSON_SETTINGS::m_params, JSON_SETTINGS::m_resetParamsIfMissing, m_SolderMaskMargin, m_SolderMaskMinWidth, m_SolderPasteMargin, m_SolderPasteMarginRatio, m_TextItalic, m_TextSize, m_TextThickness, m_TextUpright, m_TrackMinWidth, m_trackWidthIndex, m_TrackWidthList, m_UseConnectedTrackWidth, m_useCustomDiffPair, m_useCustomTrackVia, DIFF_PAIR_DIMENSION::m_ViaGap, m_ViasDimensionsList, m_viaSizeIndex, m_ViasMinAnnulus, m_ViasMinSize, DIFF_PAIR_DIMENSION::m_Width, ZONE_SETTINGS::m_Zone_45_Only, ZONE_SETTINGS::m_ZoneClearance, m_ZoneFillVersion, m_ZoneKeepExternalFillets, Millimeter2iu(), name, NO_SUFFIX, OUTSIDE, PAREN_SUFFIX, RPT_SEVERITY_ERROR, RPT_SEVERITY_IGNORE, RPT_SEVERITY_WARNING, SetCopperLayerCount(), D_PAD::SetDrillSize(), D_PAD::SetSize(), SeverityFromString(), SeverityToString(), TEXTS_MAX_SIZE, TEXTS_MAX_WIDTH, TEXTS_MIN_SIZE, THROUGH, and ZONE_CLEARANCE_MIL.

◆ ~BOARD_DESIGN_SETTINGS()

BOARD_DESIGN_SETTINGS::~BOARD_DESIGN_SETTINGS ( )
virtual

Definition at line 604 of file board_design_settings.cpp.

605 {
606  if( m_parent )
607  {
609  m_parent = nullptr;
610  }
611 }
JSON_SETTINGS * m_parent
A pointer to the parent object to load and store from.
void ReleaseNestedSettings(NESTED_SETTINGS *aSettings)
Saves and frees a nested settings object, if it exists within this one.

References NESTED_SETTINGS::m_parent, and JSON_SETTINGS::ReleaseNestedSettings().

◆ BOARD_DESIGN_SETTINGS() [2/2]

BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS ( const BOARD_DESIGN_SETTINGS aOther)

Definition at line 614 of file board_design_settings.cpp.

614  :
615  NESTED_SETTINGS( "board_design_settings", bdsSchemaVersion, aOther.m_parent,
616  aOther.m_path ),
617  m_Pad_Master( nullptr )
618 {
619  initFromOther( aOther );
620 }
JSON_SETTINGS * m_parent
A pointer to the parent object to load and store from.
const int bdsSchemaVersion
NESTED_SETTINGS(const std::string &aName, int aSchemaVersion, JSON_SETTINGS *aParent, const std::string &aPath)
void initFromOther(const BOARD_DESIGN_SETTINGS &aOther)
std::string m_path
The path (in pointer format) of where to store this document in the parent.

References initFromOther().

Member Function Documentation

◆ AddNestedSettings()

void JSON_SETTINGS::AddNestedSettings ( NESTED_SETTINGS aSettings)
inherited

Transfers ownership of a given NESTED_SETTINGS to this object.

Can be used to construct a NESTED_SETTINGS without the parent object needing to know about the implementation of the nested object;

Parameters
aSettingsis the settings object to take ownership of
aTargetis a pointer to update to the passed in settings

Definition at line 607 of file json_settings.cpp.

608 {
609  wxLogTrace( traceSettings, "AddNestedSettings %s", aSettings->GetFilename() );
610  m_nested_settings.push_back( aSettings );
611 }
wxString GetFilename() const
Definition: json_settings.h:64
std::vector< NESTED_SETTINGS * > m_nested_settings
Nested settings files that live inside this one, if any.
const wxChar *const traceSettings
Flag to enable debug output of settings operations and management.

References JSON_SETTINGS::GetFilename(), JSON_SETTINGS::m_nested_settings, and traceSettings.

Referenced by NESTED_SETTINGS::SetParent().

◆ fromLegacy()

template<typename ValueType >
template bool JSON_SETTINGS::fromLegacy< bool > ( wxConfigBase *  aConfig,
const std::string &  aKey,
const std::string &  aDest 
)
protectedinherited

Translates a legacy wxConfig value to a given JSON pointer value.

Template Parameters
ValueTypeis the basic type of the value
Parameters
aConfigis the legacy config to read from
aKeyis the key (within the current path) to read
aDestis a string that will form a JSON pointer (key1.key2.key3) to write to

Definition at line 519 of file json_settings.cpp.

521 {
522  ValueType val;
523 
524  if( aConfig->Read( aKey, &val ) )
525  {
526  try
527  {
528  ( *this )[PointerFromString( aDest )] = val;
529  }
530  catch( ... )
531  {
532  wxASSERT_MSG( false, wxT( "Could not write value in fromLegacy!" ) );
533  return false;
534  }
535 
536  return true;
537  }
538 
539  return false;
540 }
static nlohmann::json::json_pointer PointerFromString(std::string aPath)
Builds a JSON pointer based on a given string.

References JSON_SETTINGS::PointerFromString().

◆ fromLegacyColor()

bool JSON_SETTINGS::fromLegacyColor ( wxConfigBase *  aConfig,
const std::string &  aKey,
const std::string &  aDest 
)
protectedinherited

Translates a legacy COLOR4D stored in a wxConfig string to a given JSON pointer value.

Parameters
aConfigis the legacy config to read from
aKeyis the key (within the current path) to read
aDestis a string that will form a JSON pointer (key1.key2.key3) to write to

Definition at line 579 of file json_settings.cpp.

581 {
582  wxString str;
583 
584  if( aConfig->Read( aKey, &str ) )
585  {
587  color.SetFromWxString( str );
588 
589  try
590  {
591  nlohmann::json js = nlohmann::json::array( { color.r, color.g, color.b, color.a } );
592  ( *this )[PointerFromString( aDest )] = js;
593  }
594  catch( ... )
595  {
596  wxASSERT_MSG( false, wxT( "Could not write value in fromLegacyColor!" ) );
597  return false;
598  }
599 
600  return true;
601  }
602 
603  return false;
604 }
int color
Definition: DXF_plotter.cpp:61
nlohmann::json json
Definition: gerbview.cpp:40
static nlohmann::json::json_pointer PointerFromString(std::string aPath)
Builds a JSON pointer based on a given string.
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:99

References color, and JSON_SETTINGS::PointerFromString().

Referenced by APP_SETTINGS_BASE::migrateWindowConfig().

◆ fromLegacyString()

bool JSON_SETTINGS::fromLegacyString ( wxConfigBase *  aConfig,
const std::string &  aKey,
const std::string &  aDest 
)
protectedinherited

Translates a legacy wxConfig string value to a given JSON pointer value.

Parameters
aConfigis the legacy config to read from
aKeyis the key (within the current path) to read
aDestis a string that will form a JSON pointer (key1.key2.key3) to write to

Definition at line 555 of file json_settings.cpp.

557 {
558  wxString str;
559 
560  if( aConfig->Read( aKey, &str ) )
561  {
562  try
563  {
564  ( *this )[PointerFromString( aDest )] = str.ToUTF8();
565  }
566  catch( ... )
567  {
568  wxASSERT_MSG( false, wxT( "Could not write value in fromLegacyString!" ) );
569  return false;
570  }
571 
572  return true;
573  }
574 
575  return false;
576 }
static nlohmann::json::json_pointer PointerFromString(std::string aPath)
Builds a JSON pointer based on a given string.

References JSON_SETTINGS::PointerFromString().

Referenced by BITMAP2CMP_SETTINGS::MigrateFromLegacy(), FOOTPRINT_EDITOR_SETTINGS::MigrateFromLegacy(), GERBVIEW_SETTINGS::MigrateFromLegacy(), LIBEDIT_SETTINGS::MigrateFromLegacy(), PROJECT_FILE::MigrateFromLegacy(), COMMON_SETTINGS::MigrateFromLegacy(), PCB_CALCULATOR_SETTINGS::MigrateFromLegacy(), APP_SETTINGS_BASE::MigrateFromLegacy(), EESCHEMA_SETTINGS::MigrateFromLegacy(), PCBNEW_SETTINGS::MigrateFromLegacy(), and APP_SETTINGS_BASE::migrateWindowConfig().

◆ Get() [1/2]

template<typename ValueType >
OPT<ValueType> JSON_SETTINGS::Get ( const std::string &  aPath) const
inlineinherited

Fetches a value from within the JSON document.

Will return an empty optional if the value is not found or a mismatching type.

Template Parameters
ValueTypeis the type to cast to
Parameters
aPathis the path within the document to retrieve
Returns
a value from within this document

Definition at line 119 of file json_settings.h.

120  {
121  if( OPT<nlohmann::json> ret = GetJson( aPath ) )
122  {
123  try
124  {
125  return ret->get<ValueType>();
126  }
127  catch( ... )
128  {
129  }
130  }
131 
132  return NULLOPT;
133  }
OPT< nlohmann::json > GetJson(const std::string &aPath) const
Fetches a JSON object that is a subset of this JSON_SETTINGS object, using a path of the form "key1....
const auto NULLOPT
Definition: optional.h:9
boost::optional< T > OPT
Definition: optional.h:7

References JSON_SETTINGS::GetJson(), and NULLOPT.

Referenced by PARAM< wxString >::Load(), COLOR_MAP_PARAM::Load(), PARAM_ENUM< EnumType >::Load(), PARAM_LAMBDA< ValueType >::Load(), PARAM_SCALED< ValueType >::Load(), LoadFromFile(), PARAM< wxString >::MatchesFile(), COLOR_MAP_PARAM::MatchesFile(), PARAM_PATH::MatchesFile(), PARAM_ENUM< EnumType >::MatchesFile(), PARAM_LAMBDA< ValueType >::MatchesFile(), and PARAM_SCALED< ValueType >::MatchesFile().

◆ Get() [2/2]

OPT< wxString > JSON_SETTINGS::Get ( const std::string &  aPath) const
inherited

Definition at line 637 of file json_settings.cpp.

638 {
639  if( OPT<nlohmann::json> opt_json = GetJson( aPath ) )
640  return wxString( opt_json->get<std::string>().c_str(), wxConvUTF8 );
641 
642  return NULLOPT;
643 }
OPT< nlohmann::json > GetJson(const std::string &aPath) const
Fetches a JSON object that is a subset of this JSON_SETTINGS object, using a path of the form "key1....
const auto NULLOPT
Definition: optional.h:9
boost::optional< T > OPT
Definition: optional.h:7

References JSON_SETTINGS::GetJson(), and NULLOPT.

◆ GetBiggestClearanceValue()

int BOARD_DESIGN_SETTINGS::GetBiggestClearanceValue ( )

Function GetBiggestClearanceValue.

Returns
the biggest clearance value found in NetClasses list

Definition at line 942 of file board_design_settings.cpp.

943 {
944  DRC_CONSTRAINT constraint;
945 
946  if( m_DRCEngine )
947  {
948  m_DRCEngine->QueryWorstConstraint( DRC_CONSTRAINT_TYPE_CLEARANCE, constraint,
950  }
951 
952  return constraint.Value().HasMin() ? constraint.Value().Min() : 0;
953 }
bool HasMin() const
Definition: drc_rule.h:78
MINOPTMAX< int > & Value()
Definition: drc_rule.h:133
T Min() const
Definition: drc_rule.h:74
std::shared_ptr< DRC_ENGINE > m_DRCEngine

References DRC_CONSTRAINT_TYPE_CLEARANCE, DRCCQ_LARGEST_MINIMUM, MINOPTMAX< T >::HasMin(), m_DRCEngine, MINOPTMAX< T >::Min(), and DRC_CONSTRAINT::Value().

Referenced by ZONE_FILLER::buildCopperItemClearances(), ZONE_FILLER::buildThermalSpokes(), ZONE_FILLER::Fill(), MODULE::GetBoundingPoly(), PNS_KICAD_IFACE_BASE::SyncWorld(), and MODULE::ViewBBox().

◆ GetBoardThickness()

◆ GetCopperLayerCount()

int BOARD_DESIGN_SETTINGS::GetCopperLayerCount ( ) const
inline

Function GetCopperLayerCount.

Returns
int - the number of neabled copper layers

Definition at line 806 of file board_design_settings.h.

807  {
808  return m_copperLayerCount;
809  }
int m_copperLayerCount
Number of copper layers for this design.

References m_copperLayerCount.

Referenced by BOARD_STACKUP::BuildDefaultStackupList(), PANEL_SETUP_BOARD_STACKUP::buildLayerStackPanel(), BOARD::GetCopperLayerCount(), and ROUTER_TOOL::onViaCommand().

◆ GetCurrentDiffPairGap()

int BOARD_DESIGN_SETTINGS::GetCurrentDiffPairGap ( ) const
inline

Function GetCurrentDiffPairGap.

Returns
the current diff pair gap, according to the selected options ( using the default netclass value or a preset/custom value ) the default netclass is always in m_DiffPairDimensionsList[0]

Definition at line 739 of file board_design_settings.h.

740  {
741  if( m_useCustomDiffPair )
742  return m_customDiffPair.m_Gap;
743  else
745  }
std::vector< DIFF_PAIR_DIMENSION > m_DiffPairDimensionsList
DIFF_PAIR_DIMENSION m_customDiffPair

References m_diffPairIndex, and DIFF_PAIR_DIMENSION::m_Gap.

Referenced by PNS::SIZES_SETTINGS::ImportCurrent().

◆ GetCurrentDiffPairViaGap()

int BOARD_DESIGN_SETTINGS::GetCurrentDiffPairViaGap ( ) const
inline

Function GetCurrentDiffPairViaGap.

Returns
the current diff pair via gap, according to the selected options ( using the default netclass value or a preset/custom value ) the default netclass is always in m_DiffPairDimensionsList[0]

Definition at line 753 of file board_design_settings.h.

754  {
755  if( m_useCustomDiffPair )
756  return m_customDiffPair.m_ViaGap;
757  else
758  return m_DiffPairDimensionsList[m_diffPairIndex].m_ViaGap;
759  }
std::vector< DIFF_PAIR_DIMENSION > m_DiffPairDimensionsList
DIFF_PAIR_DIMENSION m_customDiffPair

References m_diffPairIndex, and DIFF_PAIR_DIMENSION::m_ViaGap.

Referenced by PNS::SIZES_SETTINGS::ImportCurrent().

◆ GetCurrentDiffPairWidth()

int BOARD_DESIGN_SETTINGS::GetCurrentDiffPairWidth ( ) const
inline

Function GetCurrentDiffPairWidth.

Returns
the current diff pair track width, according to the selected options ( using the default netclass value or a preset/custom value ) the default netclass is always in m_DiffPairDimensionsList[0]

Definition at line 725 of file board_design_settings.h.

726  {
727  if( m_useCustomDiffPair )
728  return m_customDiffPair.m_Width;
729  else
731  }
std::vector< DIFF_PAIR_DIMENSION > m_DiffPairDimensionsList
DIFF_PAIR_DIMENSION m_customDiffPair

References m_diffPairIndex, and DIFF_PAIR_DIMENSION::m_Width.

Referenced by PNS::SIZES_SETTINGS::ImportCurrent().

◆ GetCurrentMicroViaDrill()

int BOARD_DESIGN_SETTINGS::GetCurrentMicroViaDrill ( )

Function GetCurrentMicroViaDrill.

Returns
the current micro via drill, that is the current netclass value

Definition at line 975 of file board_design_settings.cpp.

976 {
977  NETCLASSPTR netclass = GetNetClasses().Find( m_currentNetClassName );
978 
979  return netclass->GetuViaDrill();
980 }
wxString m_currentNetClassName
Current net class name used to display netclass info.
NETCLASSPTR Find(const wxString &aName) const
Function Find searches this container for a NETCLASS given by aName.
Definition: netclass.cpp:132
NETCLASSES & GetNetClasses() const

References NETCLASSES::Find(), GetNetClasses(), and m_currentNetClassName.

Referenced by ROUTER_TOOL::onViaCommand().

◆ GetCurrentMicroViaSize()

int BOARD_DESIGN_SETTINGS::GetCurrentMicroViaSize ( )

Function GetCurrentMicroViaSize.

Returns
the current micro via size, that is the current netclass value

Definition at line 967 of file board_design_settings.cpp.

968 {
969  NETCLASSPTR netclass = GetNetClasses().Find( m_currentNetClassName );
970 
971  return netclass->GetuViaDiameter();
972 }
wxString m_currentNetClassName
Current net class name used to display netclass info.
NETCLASSPTR Find(const wxString &aName) const
Function Find searches this container for a NETCLASS given by aName.
Definition: netclass.cpp:132
NETCLASSES & GetNetClasses() const

References NETCLASSES::Find(), GetNetClasses(), and m_currentNetClassName.

Referenced by ROUTER_TOOL::onViaCommand().

◆ GetCurrentNetClassName()

const wxString& BOARD_DESIGN_SETTINGS::GetCurrentNetClassName ( ) const
inline

Function GetCurrentNetClassName.

Returns
the current net class name.

Definition at line 412 of file board_design_settings.h.

413  {
414  return m_currentNetClassName;
415  }
wxString m_currentNetClassName
Current net class name used to display netclass info.

References m_currentNetClassName.

Referenced by DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildFilterLists().

◆ GetCurrentTrackWidth()

int BOARD_DESIGN_SETTINGS::GetCurrentTrackWidth ( ) const
inline

Function GetCurrentTrackWidth.

Returns
the current track width, according to the selected options ( using the default netclass value or a preset/custom value ) the default netclass is always in m_TrackWidthList[0]

Definition at line 500 of file board_design_settings.h.

References m_customTrackWidth, and m_trackWidthIndex.

Referenced by BOARD::BOARD(), EDIT_TOOL::ChangeTrackWidth(), MICROWAVE_TOOL::createBaseFootprint(), MICROWAVE_TOOL::createFootprint(), MICROWAVE_TOOL::createInductorBetween(), PNS::SIZES_SETTINGS::ImportCurrent(), PNS::SIZES_SETTINGS::Init(), and PCB_EDIT_FRAME::SetTrackSegmentWidth().

◆ GetCurrentViaDrill()

int BOARD_DESIGN_SETTINGS::GetCurrentViaDrill ( ) const

Function GetCurrentViaDrill.

Returns
the current via size, according to the selected options ( using the default netclass value or a preset/custom value ) the default netclass is always in m_TrackWidthList[0]

Definition at line 990 of file board_design_settings.cpp.

991 {
992  int drill;
993 
994  if( m_useCustomTrackVia )
995  drill = m_customViaSize.m_Drill;
996  else
997  drill = m_ViasDimensionsList[m_viaSizeIndex].m_Drill;
998 
999  return drill > 0 ? drill : -1;
1000 }
std::vector< VIA_DIMENSION > m_ViasDimensionsList

References m_customViaSize, VIA_DIMENSION::m_Drill, m_useCustomTrackVia, m_ViasDimensionsList, and m_viaSizeIndex.

Referenced by BOARD::BOARD(), EDIT_TOOL::ChangeTrackWidth(), PNS::SIZES_SETTINGS::ImportCurrent(), PNS::SIZES_SETTINGS::Init(), ROUTER_TOOL::onViaCommand(), and PCB_EDIT_FRAME::SetTrackSegmentWidth().

◆ GetCurrentViaSize()

int BOARD_DESIGN_SETTINGS::GetCurrentViaSize ( ) const
inline

Function GetCurrentViaSize.

Returns
the current via size, according to the selected options ( using the default netclass value or a preset/custom value ) the default netclass is always in m_TrackWidthList[0]

Definition at line 549 of file board_design_settings.h.

550  {
551  if( m_useCustomTrackVia )
553  else
554  return m_ViasDimensionsList[m_viaSizeIndex].m_Diameter;
555  }
std::vector< VIA_DIMENSION > m_ViasDimensionsList

References VIA_DIMENSION::m_Diameter, and m_viaSizeIndex.

Referenced by BOARD::BOARD(), EDIT_TOOL::ChangeTrackWidth(), PNS::SIZES_SETTINGS::ImportCurrent(), PNS::SIZES_SETTINGS::Init(), ROUTER_TOOL::onViaCommand(), and PCB_EDIT_FRAME::SetTrackSegmentWidth().

◆ GetCustomDiffPairGap()

int BOARD_DESIGN_SETTINGS::GetCustomDiffPairGap ( )
inline

Function GetCustomDiffPairGap.

Returns
Current custom gap width for differential pairs.

Definition at line 675 of file board_design_settings.h.

676  {
677  return m_customDiffPair.m_Gap;
678  }
DIFF_PAIR_DIMENSION m_customDiffPair

References DIFF_PAIR_DIMENSION::m_Gap.

Referenced by PNS::SIZES_SETTINGS::Init().

◆ GetCustomDiffPairViaGap()

int BOARD_DESIGN_SETTINGS::GetCustomDiffPairViaGap ( )
inline

Function GetCustomDiffPairViaGap.

Returns
Current custom via gap width for differential pairs.

Definition at line 695 of file board_design_settings.h.

References DIFF_PAIR_DIMENSION::m_Gap, and DIFF_PAIR_DIMENSION::m_ViaGap.

Referenced by PNS::SIZES_SETTINGS::Init().

◆ GetCustomDiffPairWidth()

int BOARD_DESIGN_SETTINGS::GetCustomDiffPairWidth ( )
inline

Function GetCustomDiffPairWidth.

Returns
Current custom track width for differential pairs.

Definition at line 655 of file board_design_settings.h.

656  {
657  return m_customDiffPair.m_Width;
658  }
DIFF_PAIR_DIMENSION m_customDiffPair

References DIFF_PAIR_DIMENSION::m_Width.

Referenced by PNS::SIZES_SETTINGS::Init().

◆ GetCustomTrackWidth()

int BOARD_DESIGN_SETTINGS::GetCustomTrackWidth ( ) const
inline

Function GetCustomTrackWidth.

Returns
Current custom width for a track.

Definition at line 521 of file board_design_settings.h.

522  {
523  return m_customTrackWidth;
524  }

References m_customTrackWidth.

Referenced by DIALOG_TRACK_VIA_SIZE::TransferDataToWindow().

◆ GetCustomViaDrill()

int BOARD_DESIGN_SETTINGS::GetCustomViaDrill ( ) const
inline

Function GetCustomViaDrill.

Returns
Current custom size for the via drill.

Definition at line 602 of file board_design_settings.h.

603  {
604  return m_customViaSize.m_Drill;
605  }

References VIA_DIMENSION::m_Drill.

Referenced by DIALOG_TRACK_VIA_SIZE::TransferDataToWindow().

◆ GetCustomViaSize()

int BOARD_DESIGN_SETTINGS::GetCustomViaSize ( ) const
inline

Function GetCustomViaSize.

Returns
Current custom size for the via diameter.

Definition at line 573 of file board_design_settings.h.

574  {
576  }

References VIA_DIMENSION::m_Diameter.

Referenced by DIALOG_TRACK_VIA_SIZE::TransferDataToWindow().

◆ GetDefault()

◆ GetDefaultZoneSettings()

ZONE_SETTINGS& BOARD_DESIGN_SETTINGS::GetDefaultZoneSettings ( )
inline

Definition at line 389 of file board_design_settings.h.

390  {
391  return m_defaultZoneSettings;
392  }
ZONE_SETTINGS m_defaultZoneSettings
The defualt settings that will be used for new zones.

References m_defaultZoneSettings.

Referenced by PCB_BASE_FRAME::GetZoneSettings(), BOARD::GetZoneSettings(), and PCB_PARSER::parseSetup().

◆ GetDiffPairIndex()

unsigned BOARD_DESIGN_SETTINGS::GetDiffPairIndex ( ) const
inline

Function GetDiffPairIndex.

Returns
the current diff pair dimension list index.

Definition at line 632 of file board_design_settings.h.

632 { return m_diffPairIndex; }

References m_diffPairIndex.

Referenced by PNS::SIZES_SETTINGS::Init(), SetCurrentNetClass(), and DIFF_PAIR_MENU::update().

◆ GetDRCEpsilon()

int BOARD_DESIGN_SETTINGS::GetDRCEpsilon ( ) const

Definition at line 1072 of file board_design_settings.cpp.

1073 {
1074  return Millimeter2iu( ADVANCED_CFG::GetCfg().m_DRCEpsilon );
1075 }
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers of advanced config.
static constexpr int Millimeter2iu(double mm)

References ADVANCED_CFG::GetCfg(), and Millimeter2iu().

Referenced by DRC_TEST_PROVIDER_COPPER_CLEARANCE::doPadToPadsDrc(), and DRC_TEST_PROVIDER_COPPER_CLEARANCE::doTrackDrc().

◆ GetEnabledLayers()

LSET BOARD_DESIGN_SETTINGS::GetEnabledLayers ( ) const
inline

Function GetEnabledLayers returns a bit-mask of all the layers that are enabled.

Returns
int - the enabled layers in bit-mapped form.

Definition at line 779 of file board_design_settings.h.

780  {
781  return m_enabledLayers;
782  }
LSET m_enabledLayers
Bit-mask for layer enabling.

References m_enabledLayers.

Referenced by BOARD_STACKUP::BuildDefaultStackupList(), CreatePadsShapesSection(), CreateRoutesSection(), BOARD::GetEnabledLayers(), and HYPERLYNX_EXPORTER::writeStackupInfo().

◆ getFileExt()

virtual wxString JSON_SETTINGS::getFileExt ( ) const
inlineprotectedvirtualinherited

Reimplemented in PROJECT_FILE, and PROJECT_LOCAL_SETTINGS.

Definition at line 258 of file json_settings.h.

259  {
260  return wxT( "json" );
261  }

Referenced by JSON_SETTINGS::GetFullFilename(), JSON_SETTINGS::LoadFromFile(), and JSON_SETTINGS::SaveToFile().

◆ GetFilename()

◆ GetFullFilename()

wxString JSON_SETTINGS::GetFullFilename ( ) const
inherited

Definition at line 78 of file json_settings.cpp.

79 {
80  return wxString( m_filename + "." + getFileExt() );
81 }
wxString m_filename
The filename (not including path) of this settings file (inicode)
virtual wxString getFileExt() const

References JSON_SETTINGS::getFileExt(), and JSON_SETTINGS::m_filename.

Referenced by JSON_SETTINGS::JSON_SETTINGS(), NESTED_SETTINGS::LoadFromFile(), JSON_SETTINGS::LoadFromFile(), and JSON_SETTINGS::SaveToFile().

◆ GetHolePlatingThickness()

int BOARD_DESIGN_SETTINGS::GetHolePlatingThickness ( ) const

Pad & via drills are finish size.

Adding the hole plating thickness gives you the acutal hole size.

Definition at line 1078 of file board_design_settings.cpp.

1079 {
1080  return Millimeter2iu( ADVANCED_CFG::GetCfg().m_HoleWallThickness );
1081 }
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers of advanced config.
static constexpr int Millimeter2iu(double mm)

References ADVANCED_CFG::GetCfg(), and Millimeter2iu().

Referenced by ZONE_FILLER::buildCopperItemClearances(), and setupDummyPadForHole().

◆ GetJson()

OPT< nlohmann::json > JSON_SETTINGS::GetJson ( const std::string &  aPath) const
inherited

Fetches a JSON object that is a subset of this JSON_SETTINGS object, using a path of the form "key1.key2.key3" to refer to nested objects.

Parameters
aPathis a string containing one or more keys separated by '.'
Returns
a JSON object from within this one

Definition at line 404 of file json_settings.cpp.

405 {
406  nlohmann::json::json_pointer ptr = PointerFromString( aPath );
407 
408  if( this->contains( ptr ) )
409  {
410  try
411  {
412  return OPT<nlohmann::json>{ this->at( ptr ) };
413  }
414  catch( ... )
415  {
416  }
417  }
418 
419  return OPT<nlohmann::json>{};
420 }
boost::optional< T > OPT
Definition: optional.h:7
static nlohmann::json::json_pointer PointerFromString(std::string aPath)
Builds a JSON pointer based on a given string.

References JSON_SETTINGS::PointerFromString().

Referenced by JSON_SETTINGS::Get(), PARAM_LAMBDA< ValueType >::Load(), PARAM_LIST< wxString >::Load(), PARAM_MAP< Value >::Load(), PARAM_WXSTRING_MAP::Load(), PARAM_LAMBDA< ValueType >::MatchesFile(), PARAM_LIST< wxString >::MatchesFile(), PARAM_PATH_LIST::MatchesFile(), PARAM_MAP< Value >::MatchesFile(), and PARAM_WXSTRING_MAP::MatchesFile().

◆ GetLayerClass()

int BOARD_DESIGN_SETTINGS::GetLayerClass ( PCB_LAYER_ID  aLayer) const

Definition at line 1055 of file board_design_settings.cpp.

1056 {
1057  if( aLayer == F_SilkS || aLayer == B_SilkS )
1058  return LAYER_CLASS_SILK;
1059  else if( IsCopperLayer( aLayer ) )
1060  return LAYER_CLASS_COPPER;
1061  else if( aLayer == Edge_Cuts )
1062  return LAYER_CLASS_EDGES;
1063  else if( aLayer == F_CrtYd || aLayer == B_CrtYd )
1064  return LAYER_CLASS_COURTYARD;
1065  else if( aLayer == F_Fab || aLayer == B_Fab )
1066  return LAYER_CLASS_FAB;
1067  else
1068  return LAYER_CLASS_OTHERS;
1069 }
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.

References B_CrtYd, B_Fab, B_SilkS, Edge_Cuts, F_CrtYd, F_Fab, F_SilkS, IsCopperLayer(), LAYER_CLASS_COPPER, LAYER_CLASS_COURTYARD, LAYER_CLASS_EDGES, LAYER_CLASS_FAB, LAYER_CLASS_OTHERS, and LAYER_CLASS_SILK.

Referenced by GetLineThickness(), GetTextItalic(), GetTextSize(), GetTextThickness(), and GetTextUpright().

◆ getLegacyFileExt()

virtual wxString JSON_SETTINGS::getLegacyFileExt ( ) const
inlineprotectedvirtualinherited

Reimplemented in PROJECT_FILE, and PROJECT_LOCAL_SETTINGS.

Definition at line 263 of file json_settings.h.

264  {
265  return wxEmptyString;
266  }

Referenced by JSON_SETTINGS::LoadFromFile().

◆ GetLineThickness()

int BOARD_DESIGN_SETTINGS::GetLineThickness ( PCB_LAYER_ID  aLayer) const

Function GetLineThickness Returns the default graphic segment thickness from the layer class for the given layer.

Definition at line 1084 of file board_design_settings.cpp.

1085 {
1086  return m_LineThickness[ GetLayerClass( aLayer ) ];
1087 }
int GetLayerClass(PCB_LAYER_ID aLayer) const
int m_LineThickness[LAYER_CLASS_COUNT]

References GetLayerClass(), and m_LineThickness.

Referenced by DRAWING_TOOL::getSegmentWidth(), ALTIUM_PCB::HelperCreateBoardOutline(), EAGLE_PLUGIN::loadPlain(), DIALOG_PAD_PROPERTIES::onAddPrimitive(), EAGLE_PLUGIN::packageWire(), PCB_EDITOR_CONTROL::PlaceTarget(), DIALOG_PLOT::Plot(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem().

◆ GetLocation()

SETTINGS_LOC JSON_SETTINGS::GetLocation ( ) const
inlineinherited

Definition at line 68 of file json_settings.h.

68 { return m_location; }
SETTINGS_LOC m_location
The location of this settings file (.

References JSON_SETTINGS::m_location.

Referenced by SETTINGS_MANAGER::GetPathForSettingsFile().

◆ GetNetClasses()

◆ GetParent()

JSON_SETTINGS* NESTED_SETTINGS::GetParent ( void  )
inlineinherited

Definition at line 54 of file nested_settings.h.

55  {
56  return m_parent;
57  }
JSON_SETTINGS * m_parent
A pointer to the parent object to load and store from.

References NESTED_SETTINGS::m_parent.

Referenced by LoadFromFile().

◆ GetSeverity()

◆ GetSmallestClearanceValue()

int BOARD_DESIGN_SETTINGS::GetSmallestClearanceValue ( )

Function GetSmallestClearanceValue.

Returns
the smallest clearance value found in NetClasses list

Definition at line 956 of file board_design_settings.cpp.

957 {
958  int clearance = GetDefault()->GetClearance();
959 
960  for( const std::pair<const wxString, NETCLASSPTR>& netclass : GetNetClasses().NetClasses() )
961  clearance = std::min( clearance, netclass.second->GetClearance() );
962 
963  return clearance;
964 }
int GetClearance(wxString *aSource=nullptr) const
Definition: netclass.h:158
NETCLASSES & GetNetClasses() const
NETCLASS * GetDefault() const
Function GetDefault.

References NETCLASS::GetClearance(), GetDefault(), and GetNetClasses().

Referenced by DIALOG_PLOT::init_Dialog().

◆ GetStackupDescriptor()

◆ GetTextItalic()

bool BOARD_DESIGN_SETTINGS::GetTextItalic ( PCB_LAYER_ID  aLayer) const

◆ GetTextSize()

wxSize BOARD_DESIGN_SETTINGS::GetTextSize ( PCB_LAYER_ID  aLayer) const

Function GetTextSize Returns the default text size from the layer class for the given layer.

Definition at line 1090 of file board_design_settings.cpp.

1091 {
1092  return m_TextSize[ GetLayerClass( aLayer ) ];
1093 }
int GetLayerClass(PCB_LAYER_ID aLayer) const
wxSize m_TextSize[LAYER_CLASS_COUNT]

References GetLayerClass(), and m_TextSize.

Referenced by PCB_BASE_FRAME::CreateNewModule(), EAGLE_PLUGIN::loadPlain(), DIALOG_FOOTPRINT_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAddField(), DRAWING_TOOL::PlaceText(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem().

◆ GetTextThickness()

int BOARD_DESIGN_SETTINGS::GetTextThickness ( PCB_LAYER_ID  aLayer) const

Function GetTextThickness Returns the default text thickness from the layer class for the given layer.

Definition at line 1096 of file board_design_settings.cpp.

1097 {
1098  return m_TextThickness[ GetLayerClass( aLayer ) ];
1099 }
int GetLayerClass(PCB_LAYER_ID aLayer) const
int m_TextThickness[LAYER_CLASS_COUNT]

References GetLayerClass(), and m_TextThickness.

Referenced by PCB_BASE_FRAME::CreateNewModule(), EAGLE_PLUGIN::loadPlain(), DIALOG_FOOTPRINT_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAddField(), DRAWING_TOOL::PlaceText(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem().

◆ GetTextUpright()

bool BOARD_DESIGN_SETTINGS::GetTextUpright ( PCB_LAYER_ID  aLayer) const

◆ GetTrackWidthIndex()

unsigned BOARD_DESIGN_SETTINGS::GetTrackWidthIndex ( ) const
inline

◆ GetViaSizeIndex()

unsigned BOARD_DESIGN_SETTINGS::GetViaSizeIndex ( ) const
inline

◆ Ignore()

bool BOARD_DESIGN_SETTINGS::Ignore ( int  aDRCErrorCode)

returns true if the DRC error code's severity is SEVERITY_IGNORE

Definition at line 854 of file board_design_settings.cpp.

855 {
856  return m_DRCSeverities[ aDRCErrorCode ] == RPT_SEVERITY_IGNORE;
857 }
std::map< int, int > m_DRCSeverities

References m_DRCSeverities, and RPT_SEVERITY_IGNORE.

Referenced by DRC_ENGINE::RunTests().

◆ initFromOther()

void BOARD_DESIGN_SETTINGS::initFromOther ( const BOARD_DESIGN_SETTINGS aOther)
private

Definition at line 630 of file board_design_settings.cpp.

631 {
632  // Copy of NESTED_SETTINGS around is not allowed, so let's just update the params.
643  m_ViasMinSize = aOther.m_ViasMinSize;
653  m_MaxError = aOther.m_MaxError;
659 
660  std::copy( std::begin( aOther.m_LineThickness ), std::end( aOther.m_LineThickness ),
661  std::begin( m_LineThickness ) );
662 
663  std::copy( std::begin( aOther.m_TextSize ), std::end( aOther.m_TextSize ),
664  std::begin( m_TextSize ) );
665 
666  std::copy( std::begin( aOther.m_TextThickness ), std::end( aOther.m_TextThickness ),
667  std::begin( m_TextThickness ) );
668 
669  std::copy( std::begin( aOther.m_TextItalic ), std::end( aOther.m_TextItalic ),
670  std::begin( m_TextItalic ) );
671 
672  std::copy( std::begin( aOther.m_TextUpright ), std::end( aOther.m_TextUpright ),
673  std::begin( m_TextUpright ) );
674 
683 
684  m_AuxOrigin = aOther.m_AuxOrigin;
685  m_GridOrigin = aOther.m_GridOrigin;
686  m_HasStackup = aOther.m_HasStackup;
687 
700  m_stackup = aOther.m_stackup;
701 
702  // Only take the pointer from the other if it isn't the default
703  if( aOther.m_netClasses == &aOther.m_internalNetClasses )
705  else
706  m_netClasses = aOther.m_netClasses;
707 
709 }
wxString m_currentNetClassName
Current net class name used to display netclass info.
std::vector< TEXT_ITEM_INFO > m_DefaultFPTextItems
wxPoint m_GridOrigin
origin for grid offsets
std::vector< int > m_TrackWidthList
BOARD_STACKUP m_stackup
the description of layers stackup, for board fabrication only physical layers are in layers stackup.
std::vector< DIFF_PAIR_DIMENSION > m_DiffPairDimensionsList
NETCLASSES m_internalNetClasses
Net classes that are loaded from the board file before these were stored in the project.
int m_DimensionPrecision
Number of digits after the decimal.
ZONE_SETTINGS m_defaultZoneSettings
The defualt settings that will be used for new zones.
DIFF_PAIR_DIMENSION m_customDiffPair
VIATYPE m_CurrentViaType
(VIA_BLIND_BURIED, VIA_THROUGH, VIA_MICROVIA)
DIM_TEXT_POSITION m_DimensionTextPosition
DIM_UNITS_MODE m_DimensionUnitsMode
wxSize m_TextSize[LAYER_CLASS_COUNT]
int m_TextThickness[LAYER_CLASS_COUNT]
bool m_TextItalic[LAYER_CLASS_COUNT]
bool m_BlindBuriedViaAllowed
true to allow blind/buried vias
int m_LineThickness[LAYER_CLASS_COUNT]
std::map< int, int > m_DRCSeverities
std::vector< VIA_DIMENSION > m_ViasDimensionsList
DIM_UNITS_FORMAT m_DimensionUnitsFormat
NETCLASSES * m_netClasses
This will point to m_internalNetClasses until it is repointed to the project after load.
int m_copperLayerCount
Number of copper layers for this design.
bool m_MicroViasAllowed
true to allow micro vias
std::set< wxString > m_DrcExclusions
LSET m_enabledLayers
Bit-mask for layer enabling.
wxPoint m_AuxOrigin
origin for plot exports
int m_boardThickness
Board thickness for 3D viewer.
bool m_TextUpright[LAYER_CLASS_COUNT]

References m_AuxOrigin, m_BlindBuriedViaAllowed, m_boardThickness, m_CopperEdgeClearance, m_copperLayerCount, m_currentNetClassName, m_CurrentViaType, m_customDiffPair, m_customTrackWidth, m_customViaSize, m_DefaultFPTextItems, m_defaultZoneSettings, m_DiffPairDimensionsList, m_diffPairIndex, m_DimensionArrowLength, m_DimensionExtensionOffset, m_DimensionKeepTextAligned, m_DimensionPrecision, m_DimensionSuppressZeroes, m_DimensionTextPosition, m_DimensionUnitsFormat, m_DimensionUnitsMode, m_DrcExclusions, m_DRCSeverities, m_enabledLayers, m_GridOrigin, m_HasStackup, m_HoleToHoleMin, m_internalNetClasses, m_LineThickness, m_MaxError, m_MicroViasAllowed, m_MicroViasMinDrill, m_MicroViasMinSize, m_MinClearance, m_MinThroughDrill, m_netClasses, m_SolderMaskMargin, m_SolderMaskMinWidth, m_SolderPasteMargin, m_SolderPasteMarginRatio, m_stackup, m_TextItalic, m_TextSize, m_TextThickness, m_TextUpright, m_TrackMinWidth, m_trackWidthIndex, m_TrackWidthList, m_UseConnectedTrackWidth, m_useCustomDiffPair, m_useCustomTrackVia, m_ViasDimensionsList, m_viaSizeIndex, m_ViasMinAnnulus, m_ViasMinSize, m_ZoneFillVersion, and m_ZoneKeepExternalFillets.

Referenced by BOARD_DESIGN_SETTINGS(), and operator=().

◆ IsLayerEnabled()

bool BOARD_DESIGN_SETTINGS::IsLayerEnabled ( PCB_LAYER_ID  aLayerId) const
inline

Function IsLayerEnabled tests whether a given layer is enabled.

Parameters
aLayerId= The layer to be tested
Returns
bool - true if the layer is enabled

Definition at line 797 of file board_design_settings.h.

798  {
799  return m_enabledLayers[aLayerId];
800  }
LSET m_enabledLayers
Bit-mask for layer enabling.

Referenced by BOARD::IsLayerEnabled(), and BOARD::IsLayerVisible().

◆ Load()

void JSON_SETTINGS::Load ( )
virtualinherited

Updates the parameters of this object based on the current JSON document contents.

Definition at line 84 of file json_settings.cpp.

85 {
86  for( auto param : m_params )
87  {
88  try
89  {
90  param->Load( this, m_resetParamsIfMissing );
91  }
92  catch( ... )
93  {
94  // Skip unreadable parameters in file
95  wxLogTrace( traceSettings, "param '%s' load err", param->GetJsonPath().c_str() );
96  }
97  }
98 }
std::vector< PARAM_BASE * > m_params
The list of parameters (owned by this object)
bool m_resetParamsIfMissing
Whether or not to set parameters to their default value if missing from JSON on Load()
const wxChar *const traceSettings
Flag to enable debug output of settings operations and management.

References JSON_SETTINGS::m_params, JSON_SETTINGS::m_resetParamsIfMissing, and traceSettings.

Referenced by NESTED_SETTINGS::LoadFromFile(), JSON_SETTINGS::LoadFromFile(), LoadFromFile(), COLOR_SETTINGS::migrateSchema0to1(), and SETTINGS_MANAGER::SaveColorSettings().

◆ LoadFromFile()

bool BOARD_DESIGN_SETTINGS::LoadFromFile ( const wxString &  aDirectory = "")
overridevirtual

Loads the backing file from disk and then calls Load()

Parameters
aDirectoryis the path to the file
Returns
true if the file was found on disk and loaded or migrated

Reimplemented from JSON_SETTINGS.

Definition at line 782 of file board_design_settings.cpp.

783 {
784  bool ret = NESTED_SETTINGS::LoadFromFile( aDirectory );
785 
786  // A number of things won't have been translated by the PROJECT_FILE migration because of
787  // descoped objects required to decode this data. So, it will be in the legacy.pcbnew
788  // section and needs to be pulled out here
789 
790  PROJECT_FILE* project = dynamic_cast<PROJECT_FILE*>( GetParent() );
791 
792  if( !project )
793  return ret;
794 
795  bool migrated = false;
796 
797  auto drcName =
798  []( int aCode ) -> std::string
799  {
800  std::shared_ptr<DRC_ITEM> item = DRC_ITEM::Create( aCode );
801  wxString name = item->GetSettingsKey();
802  return std::string( name.ToUTF8() );
803  };
804 
805  std::string bp = "board.design_settings.rule_severities.";
806  std::string rs = "rule_severities.";
807 
808  if( OPT<bool> v =
809  project->Get<bool>( PointerFromString( bp + "legacy_no_courtyard_defined" ) ) )
810  {
811  if( *v )
812  ( *this )[PointerFromString( rs + drcName( DRCE_MISSING_COURTYARD ) )] = "error";
813  else
814  ( *this )[PointerFromString( rs + drcName( DRCE_MISSING_COURTYARD ) )] = "ignore";
815 
816  project->erase( PointerFromString( bp + "legacy_no_courtyard_defined" ) );
817  migrated = true;
818  }
819 
820  if( OPT<bool> v = project->Get<bool>( PointerFromString( bp + "legacy_courtyards_overlap" ) ) )
821  {
822  if( *v )
823  ( *this )[PointerFromString( rs + drcName( DRCE_OVERLAPPING_FOOTPRINTS ) )] = "error";
824  else
825  ( *this )[PointerFromString( rs + drcName( DRCE_OVERLAPPING_FOOTPRINTS ) )] = "ignore";
826 
827  project->erase( PointerFromString( bp + "legacy_courtyards_overlap" ) );
828  migrated = true;
829  }
830 
831  if( project->contains( "legacy" ) )
832  {
833  // This defaults to false for new boards, but version 5.1.x and prior kept the fillets
834  // so we do the same for legacy boards.
836 
837  project->at( "legacy" ).erase( "pcbnew" );
838  }
839 
840  // Now that we have everything, we need to load again
841  if( migrated )
842  Load();
843 
844  return ret;
845 }
static std::shared_ptr< DRC_ITEM > Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
Definition: drc_item.cpp:205
JSON_SETTINGS * GetParent()
bool LoadFromFile(const wxString &aDirectory="") override
Loads the JSON document from the parent and then calls Load()
PROJECT_FILE is the backing store for a PROJECT, in JSON format.
Definition: project_file.h:62
OPT< ValueType > Get(const std::string &aPath) const
Fetches a value from within the JSON document.
const char * name
Definition: DXF_plotter.cpp:60
boost::optional< T > OPT
Definition: optional.h:7
static nlohmann::json::json_pointer PointerFromString(std::string aPath)
Builds a JSON pointer based on a given string.
virtual void Load()
Updates the parameters of this object based on the current JSON document contents.

References DRC_ITEM::Create(), DRCE_MISSING_COURTYARD, DRCE_OVERLAPPING_FOOTPRINTS, JSON_SETTINGS::Get(), NESTED_SETTINGS::GetParent(), JSON_SETTINGS::Load(), NESTED_SETTINGS::LoadFromFile(), m_ZoneKeepExternalFillets, name, and JSON_SETTINGS::PointerFromString().

◆ Migrate()

bool BOARD_DESIGN_SETTINGS::Migrate ( )
overridevirtual

Migrates the schema of this settings from the version in the file to the latest version.

Schema migration doesn't need to be used every time a setting is added! This is intended to be more of an "escape hatch" in the event that we decide to move settings around or make other changes to a settings file format that can't simply be handled by loading a new default

Returns
true if migration was successful

Reimplemented from JSON_SETTINGS.

Definition at line 712 of file board_design_settings.cpp.

713 {
714  bool ret = true;
715  int filever = at( PointerFromString( "meta.version" ) ).get<int>();
716 
717  if( filever == 0 )
718  {
719  ret &= migrateSchema0to1();
720 
721  if( ret )
722  {
723  ( *this )[PointerFromString( "meta.version" )] = 1;
724  }
725  }
726 
727  return ret;
728 }
static nlohmann::json::json_pointer PointerFromString(std::string aPath)
Builds a JSON pointer based on a given string.

References migrateSchema0to1(), and JSON_SETTINGS::PointerFromString().

◆ MigrateFromLegacy()

bool JSON_SETTINGS::MigrateFromLegacy ( wxConfigBase *  aLegacyConfig)
virtualinherited

Migrates from wxConfig to JSON-based configuration.

Should be implemented by any subclasses of JSON_SETTINGS that map to a legacy (wxConfig-based) config file.

Parameters
aLegacyConfigis a wxConfigBase holding a loaded configuration to migrate
Returns
true if migration was successful

Reimplemented in PCBNEW_SETTINGS, EESCHEMA_SETTINGS, APP_SETTINGS_BASE, PCB_CALCULATOR_SETTINGS, COMMON_SETTINGS, EDA_3D_VIEWER_SETTINGS, COLOR_SETTINGS, PROJECT_FILE, PROJECT_LOCAL_SETTINGS, LIBEDIT_SETTINGS, GERBVIEW_SETTINGS, FOOTPRINT_EDITOR_SETTINGS, CVPCB_SETTINGS, BITMAP2CMP_SETTINGS, PL_EDITOR_SETTINGS, and KICAD_SETTINGS.

Definition at line 430 of file json_settings.cpp.

431 {
432  wxLogTrace( traceSettings,
433  "MigrateFromLegacy() not implemented for %s", typeid( *this ).name() );
434  return false;
435 }
const wxChar *const traceSettings
Flag to enable debug output of settings operations and management.

References traceSettings.

Referenced by JSON_SETTINGS::LoadFromFile().

◆ migrateSchema0to1()

bool BOARD_DESIGN_SETTINGS::migrateSchema0to1 ( )
private

Schema 0 to 1: default dimension precision changed in meaning. Previously it was an enum with the following meaning:

0: 0.01mm / 1 mil / 0.001 in 1: 0.001mm / 0.1 mil / 0.0001 in 2: 0.0001mm / 0.01 mil / 0.00001 in

Now it is indepenent of display units and is an integer meaning the number of digits displayed after the decimal point, so we have to migrate based on the default units.

The units is an integer with the following mapping:

0: Inches 1: Mils 2: Millimetres

Definition at line 731 of file board_design_settings.cpp.

732 {
750  nlohmann::json::json_pointer units_ptr( "/defaults/dimension_units" );
751  nlohmann::json::json_pointer precision_ptr( "/defaults/dimension_precision" );
752 
753  if( !( contains( units_ptr ) && contains( precision_ptr ) &&
754  at( units_ptr ).is_number_integer() &&
755  at( precision_ptr ).is_number_integer() ) )
756  {
757  // if either is missing or invalid, migration doesn't make sense
758  return true;
759  }
760 
761  int units = at( units_ptr ).get<int>();
762  int precision = at( precision_ptr ).get<int>();
763 
764  // The enum maps directly to precision if the units is mils
765  int extraDigits = 0;
766 
767  switch( units )
768  {
769  case 0: extraDigits = 3; break;
770  case 2: extraDigits = 2; break;
771  default: break;
772  }
773 
774  precision += extraDigits;
775 
776  ( *this )[precision_ptr] = precision;
777 
778  return true;
779 }

Referenced by Migrate().

◆ operator=()

BOARD_DESIGN_SETTINGS & BOARD_DESIGN_SETTINGS::operator= ( const BOARD_DESIGN_SETTINGS aOther)

Definition at line 623 of file board_design_settings.cpp.

624 {
625  initFromOther( aOther );
626  return *this;
627 }
void initFromOther(const BOARD_DESIGN_SETTINGS &aOther)

References initFromOther().

◆ PointerFromString()

nlohmann::json::json_pointer JSON_SETTINGS::PointerFromString ( std::string  aPath)
staticinherited

Builds a JSON pointer based on a given string.

Parameters
aPathis the path in the form "key1.key2.key3"
Returns
a JSON pointer that can be used to index into a JSON object

Definition at line 438 of file json_settings.cpp.

439 {
440  std::replace( aPath.begin(), aPath.end(), '.', '/' );
441  aPath.insert( 0, "/" );
442 
443  nlohmann::json::json_pointer p;
444 
445  try
446  {
447  p = nlohmann::json::json_pointer( aPath );
448  }
449  catch( ... )
450  {
451  wxASSERT_MSG( false, wxT( "Invalid pointer path in PointerFromString!" ) );
452  }
453 
454  return p;
455 }

Referenced by JSON_SETTINGS::fromLegacy(), JSON_SETTINGS::fromLegacyColor(), JSON_SETTINGS::fromLegacyString(), JSON_SETTINGS::GetJson(), JSON_SETTINGS::JSON_SETTINGS(), NESTED_SETTINGS::LoadFromFile(), JSON_SETTINGS::LoadFromFile(), LoadFromFile(), FOOTPRINT_EDITOR_SETTINGS::Migrate(), PROJECT_LOCAL_SETTINGS::Migrate(), COLOR_SETTINGS::Migrate(), COMMON_SETTINGS::Migrate(), Migrate(), APP_SETTINGS_BASE::migrateFindReplace(), FOOTPRINT_EDITOR_SETTINGS::MigrateFromLegacy(), GERBVIEW_SETTINGS::MigrateFromLegacy(), PROJECT_FILE::MigrateFromLegacy(), EDA_3D_VIEWER_SETTINGS::MigrateFromLegacy(), COMMON_SETTINGS::MigrateFromLegacy(), PCB_CALCULATOR_SETTINGS::MigrateFromLegacy(), APP_SETTINGS_BASE::MigrateFromLegacy(), EESCHEMA_SETTINGS::MigrateFromLegacy(), PCBNEW_SETTINGS::MigrateFromLegacy(), SETTINGS_MANAGER::SaveColorSettings(), NESTED_SETTINGS::SaveToFile(), PROJECT_LOCAL_SETTINGS::SaveToFile(), PROJECT_FILE::SaveToFile(), JSON_SETTINGS::Set(), and JSON_SETTINGS::SetIfPresent().

◆ ReleaseNestedSettings()

void JSON_SETTINGS::ReleaseNestedSettings ( NESTED_SETTINGS aSettings)
inherited

Saves and frees a nested settings object, if it exists within this one.

Parameters
aSettingsis a pointer to a NESTED_SETTINGS that has already been added to this one

Definition at line 614 of file json_settings.cpp.

615 {
616  if( !aSettings )
617  return;
618 
619  auto it = std::find_if( m_nested_settings.begin(), m_nested_settings.end(),
620  [&aSettings]( const JSON_SETTINGS* aPtr ) {
621  return aPtr == aSettings;
622  } );
623 
624  if( it != m_nested_settings.end() )
625  {
626  wxLogTrace( traceSettings, "Flush and release %s", ( *it )->GetFilename() );
627  ( *it )->SaveToFile();
628  m_nested_settings.erase( it );
629  }
630 
631  aSettings->SetParent( nullptr );
632 }
std::vector< NESTED_SETTINGS * > m_nested_settings
Nested settings files that live inside this one, if any.
const wxChar *const traceSettings
Flag to enable debug output of settings operations and management.
void SetParent(JSON_SETTINGS *aParent)

References JSON_SETTINGS::m_nested_settings, NESTED_SETTINGS::SetParent(), and traceSettings.

Referenced by BOARD::ClearProject(), ~BOARD_DESIGN_SETTINGS(), ERC_SETTINGS::~ERC_SETTINGS(), NESTED_SETTINGS::~NESTED_SETTINGS(), NET_SETTINGS::~NET_SETTINGS(), and SCHEMATIC_SETTINGS::~SCHEMATIC_SETTINGS().

◆ ResetToDefaults()

void JSON_SETTINGS::ResetToDefaults ( )
inherited

Resets all parameters to default values.

Does NOT write to file or update underlying JSON.

Definition at line 298 of file json_settings.cpp.

299 {
300  for( auto param : m_params )
301  param->SetDefault();
302 }
std::vector< PARAM_BASE * > m_params
The list of parameters (owned by this object)

References JSON_SETTINGS::m_params.

Referenced by EDA_3D_VIEWER::Process_Special_Functions(), PANEL_COMMON_SETTINGS::ResetPanel(), and PANEL_MOUSE_SETTINGS::ResetPanel().

◆ SaveToFile()

bool NESTED_SETTINGS::SaveToFile ( const wxString &  aDirectory = "",
bool  aForce = false 
)
overridevirtualinherited

Calls Store() and then saves the JSON document contents into the parent JSON_SETTINGS.

Parameters
aDirectoryis ignored
Returns
true if the document contents were updated

Reimplemented from JSON_SETTINGS.

Definition at line 117 of file nested_settings.cpp.

118 {
119  if( !m_parent )
120  return false;
121 
122  bool modified = Store();
123 
124  try
125  {
126  nlohmann::json patch =
127  nlohmann::json::diff( *this, ( *m_parent )[PointerFromString( m_path )] );
128  modified |= !patch.empty();
129  }
130  catch( ... )
131  {
132  modified = true;
133  }
134 
135  if( !modified && !aForce )
136  return false;
137 
138  try
139  {
140  ( *m_parent )[PointerFromString( m_path ) ].update( *this );
141 
142  wxLogTrace( traceSettings, "Stored NESTED_SETTINGS %s with schema %d",
144  }
145  catch( ... )
146  {
147  wxLogTrace( traceSettings, "NESTED_SETTINGS %s: Could not store to %s at %s",
149  }
150 
151  return modified;
152 }
virtual bool Store()
Stores the current parameters into the JSON document represented by this object Note: this doesn't do...
wxString GetFilename() const
Definition: json_settings.h:64
nlohmann::json json
Definition: gerbview.cpp:40
wxString m_filename
The filename (not including path) of this settings file (inicode)
JSON_SETTINGS * m_parent
A pointer to the parent object to load and store from.
std::string m_path
The path (in pointer format) of where to store this document in the parent.
const wxChar *const traceSettings
Flag to enable debug output of settings operations and management.
static nlohmann::json::json_pointer PointerFromString(std::string aPath)
Builds a JSON pointer based on a given string.
int m_schemaVersion
Version of this settings schema.

References JSON_SETTINGS::GetFilename(), JSON_SETTINGS::m_filename, NESTED_SETTINGS::m_parent, NESTED_SETTINGS::m_path, JSON_SETTINGS::m_schemaVersion, JSON_SETTINGS::PointerFromString(), JSON_SETTINGS::Store(), and traceSettings.

◆ Set() [1/3]

template<typename ValueType >
void JSON_SETTINGS::Set ( const std::string &  aPath,
ValueType  aVal 
)
inlineinherited

Stores a value into the JSON document Will throw an exception if ValueType isn't something that the library can handle.

Template Parameters
ValueTypeis the type to store
Parameters
aPathis a path to store in the form "key1.key2.key3"
aValis the value to store

Definition at line 143 of file json_settings.h.

144  {
145  ( *this )[PointerFromString( aPath ) ] = aVal;
146  }
static nlohmann::json::json_pointer PointerFromString(std::string aPath)
Builds a JSON pointer based on a given string.

References JSON_SETTINGS::PointerFromString().

Referenced by COLOR_MAP_PARAM::Store(), PARAM< wxString >::Store(), PARAM_PATH::Store(), PARAM_ENUM< EnumType >::Store(), PARAM_LAMBDA< ValueType >::Store(), PARAM_SCALED< ValueType >::Store(), PARAM_LIST< wxString >::Store(), PARAM_PATH_LIST::Store(), PARAM_MAP< Value >::Store(), and PARAM_WXSTRING_MAP::Store().

◆ Set() [2/3]

template<>
void JSON_SETTINGS::Set ( const std::string &  aPath,
wxString  aVal 
)
inherited

◆ Set() [3/3]

template<>
void JSON_SETTINGS::Set ( const std::string &  aPath,
wxString  aVal 
)
inherited

Definition at line 646 of file json_settings.cpp.

647 {
648  ( *this )[PointerFromString( std::move( aPath ) ) ] = aVal.ToUTF8();
649 }
static nlohmann::json::json_pointer PointerFromString(std::string aPath)
Builds a JSON pointer based on a given string.

References JSON_SETTINGS::PointerFromString().

◆ SetBoardThickness()

void BOARD_DESIGN_SETTINGS::SetBoardThickness ( int  aThickness)
inline

Definition at line 819 of file board_design_settings.h.

819 { m_boardThickness = aThickness; }
int m_boardThickness
Board thickness for 3D viewer.

Referenced by LEGACY_PLUGIN::loadGENERAL(), and PANEL_SETUP_BOARD_STACKUP::TransferDataFromWindow().

◆ SetCopperEdgeClearance()

void BOARD_DESIGN_SETTINGS::SetCopperEdgeClearance ( int  aDistance)

Function SetCopperEdgeClearance.

Parameters
aValueThe minimum distance between copper items and board edges.

Definition at line 1023 of file board_design_settings.cpp.

1024 {
1025  m_CopperEdgeClearance = aDistance;
1026 }

References m_CopperEdgeClearance.

Referenced by PANEL_SETUP_FEATURE_CONSTRAINTS::TransferDataFromWindow().

◆ SetCopperLayerCount()

void BOARD_DESIGN_SETTINGS::SetCopperLayerCount ( int  aNewLayerCount)

Function SetCopperLayerCount do what its name says...

Parameters
aNewLayerCount= The new number of enabled copper layers

Definition at line 1029 of file board_design_settings.cpp.

1030 {
1031  m_copperLayerCount = aNewLayerCount;
1032 
1033  // Update only enabled copper layers mask
1034  m_enabledLayers &= ~LSET::AllCuMask();
1035 
1036  if( aNewLayerCount > 0 )
1037  m_enabledLayers |= LSET::AllCuMask( aNewLayerCount );
1038 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:719
LSET is a set of PCB_LAYER_IDs.
int m_copperLayerCount
Number of copper layers for this design.
LSET m_enabledLayers
Bit-mask for layer enabling.

References LSET::AllCuMask(), m_copperLayerCount, and m_enabledLayers.

Referenced by BOARD_DESIGN_SETTINGS(), and BOARD::SetCopperLayerCount().

◆ SetCurrentNetClass()

bool BOARD_DESIGN_SETTINGS::SetCurrentNetClass ( const wxString &  aNetClassName)

Function SetCurrentNetClass Must be called after a netclass selection (or after a netclass parameter change Initialize vias and tracks values displayed in comb boxes of the auxiliary toolbar and some others parameters (netclass name ....)

Parameters
aNetClassName= the new netclass name
Returns
true if lists of tracks and vias sizes are modified

Definition at line 860 of file board_design_settings.cpp.

861 {
862  NETCLASSPTR netClass = GetNetClasses().Find( aNetClassName );
863  bool lists_sizes_modified = false;
864 
865  // if not found (should not happen) use the default
866  if( !netClass )
867  netClass = GetNetClasses().GetDefault();
868 
869  m_currentNetClassName = netClass->GetName();
870 
871  // Initialize others values:
872  if( m_TrackWidthList.size() == 0 )
873  {
874  lists_sizes_modified = true;
875  m_TrackWidthList.push_back( 0 );
876  }
877 
878  if( m_ViasDimensionsList.size() == 0 )
879  {
880  lists_sizes_modified = true;
881  m_ViasDimensionsList.emplace_back( VIA_DIMENSION() );
882  }
883 
884  if( m_DiffPairDimensionsList.size() == 0 )
885  {
886  lists_sizes_modified = true;
888  }
889 
890  /* note the m_ViasDimensionsList[0] and m_TrackWidthList[0] values
891  * are always the Netclass values
892  */
893  if( m_TrackWidthList[0] != netClass->GetTrackWidth() )
894  {
895  lists_sizes_modified = true;
896  m_TrackWidthList[0] = netClass->GetTrackWidth();
897  }
898 
899  if( m_ViasDimensionsList[0].m_Diameter != netClass->GetViaDiameter() )
900  {
901  lists_sizes_modified = true;
902  m_ViasDimensionsList[0].m_Diameter = netClass->GetViaDiameter();
903  }
904 
905  if( m_ViasDimensionsList[0].m_Drill != netClass->GetViaDrill() )
906  {
907  lists_sizes_modified = true;
908  m_ViasDimensionsList[0].m_Drill = netClass->GetViaDrill();
909  }
910 
911  if( m_DiffPairDimensionsList[0].m_Width != netClass->GetDiffPairWidth() )
912  {
913  lists_sizes_modified = true;
914  m_DiffPairDimensionsList[0].m_Width = netClass->GetDiffPairWidth();
915  }
916 
917  if( m_DiffPairDimensionsList[0].m_Gap != netClass->GetDiffPairGap() )
918  {
919  lists_sizes_modified = true;
920  m_DiffPairDimensionsList[0].m_Gap = netClass->GetDiffPairGap();
921  }
922 
923  if( m_DiffPairDimensionsList[0].m_ViaGap != netClass->GetDiffPairViaGap() )
924  {
925  lists_sizes_modified = true;
926  m_DiffPairDimensionsList[0].m_ViaGap = netClass->GetDiffPairViaGap();
927  }
928 
929  if( GetViaSizeIndex() >= m_ViasDimensionsList.size() )
931 
932  if( GetTrackWidthIndex() >= m_TrackWidthList.size() )
934 
937 
938  return lists_sizes_modified;
939 }
Struct VIA_DIMENSION is a small helper container to handle a stock of specific vias each with unique ...
void SetTrackWidthIndex(unsigned aIndex)
Function SetTrackWidthIndex sets the current track width list index to aIndex.
wxString m_currentNetClassName
Current net class name used to display netclass info.
NETCLASSPTR Find(const wxString &aName) const
Function Find searches this container for a NETCLASS given by aName.
Definition: netclass.cpp:132
std::vector< int > m_TrackWidthList
std::vector< DIFF_PAIR_DIMENSION > m_DiffPairDimensionsList
Struct DIFF_PAIR_DIMENSION is a small helper container to handle a stock of specific differential pai...
void SetViaSizeIndex(unsigned aIndex)
Function SetViaSizeIndex sets the current via size list index to aIndex.
unsigned GetViaSizeIndex() const
Function GetViaSizeIndex.
unsigned GetTrackWidthIndex() const
Function GetTrackWidthIndex.
NETCLASSES & GetNetClasses() const
void SetDiffPairIndex(unsigned aIndex)
Function SetDiffPairIndex.
std::vector< VIA_DIMENSION > m_ViasDimensionsList
NETCLASSPTR GetDefault() const
Function GetDefault.
Definition: netclass.h:264
unsigned GetDiffPairIndex() const
Function GetDiffPairIndex.

References NETCLASSES::Find(), NETCLASSES::GetDefault(), GetDiffPairIndex(), GetNetClasses(), GetTrackWidthIndex(), GetViaSizeIndex(), m_currentNetClassName, m_DiffPairDimensionsList, m_TrackWidthList, m_ViasDimensionsList, SetDiffPairIndex(), SetTrackWidthIndex(), and SetViaSizeIndex().

Referenced by BOARD::BOARD(), SaveBoard(), and PCB_EDIT_FRAME::ShowBoardSetupDialog().

◆ SetCustomDiffPairGap()

void BOARD_DESIGN_SETTINGS::SetCustomDiffPairGap ( int  aGap)
inline

Function SetCustomDiffPairGap Sets custom gap for differential pairs (i.e.

not available in netclasses or preset list).

Parameters
aGapis the new gap.

Definition at line 666 of file board_design_settings.h.

667  {
668  m_customDiffPair.m_Gap = aGap;
669  }
DIFF_PAIR_DIMENSION m_customDiffPair

References DIFF_PAIR_DIMENSION::m_Gap.

Referenced by ROUTER_TOOL::DpDimensionsDialog(), and BOARD::SynchronizeNetsAndNetClasses().

◆ SetCustomDiffPairViaGap()

void BOARD_DESIGN_SETTINGS::SetCustomDiffPairViaGap ( int  aGap)
inline

Function SetCustomDiffPairViaGap Sets custom via gap for differential pairs (i.e.

not available in netclasses or preset list).

Parameters
aGapis the new gap. Specify 0 to use the DiffPairGap for vias as well.

Definition at line 686 of file board_design_settings.h.

687  {
688  m_customDiffPair.m_ViaGap = aGap;
689  }
DIFF_PAIR_DIMENSION m_customDiffPair

References DIFF_PAIR_DIMENSION::m_ViaGap.

Referenced by ROUTER_TOOL::DpDimensionsDialog(), and BOARD::SynchronizeNetsAndNetClasses().

◆ SetCustomDiffPairWidth()

void BOARD_DESIGN_SETTINGS::SetCustomDiffPairWidth ( int  aWidth)
inline

Function SetCustomDiffPairWidth Sets custom track width for differential pairs (i.e.

not available in netclasses or preset list).

Parameters
aDrillis the new track wdith.

Definition at line 646 of file board_design_settings.h.

647  {
648  m_customDiffPair.m_Width = aWidth;
649  }
DIFF_PAIR_DIMENSION m_customDiffPair

References DIFF_PAIR_DIMENSION::m_Width.

Referenced by ROUTER_TOOL::DpDimensionsDialog(), and BOARD::SynchronizeNetsAndNetClasses().

◆ SetCustomTrackWidth()

void BOARD_DESIGN_SETTINGS::SetCustomTrackWidth ( int  aWidth)
inline

Function SetCustomTrackWidth Sets custom width for track (i.e.

not available in netclasses or preset list). To have it returned with GetCurrentTrackWidth() you need to enable custom track & via sizes (UseCustomTrackViaSize()).

Parameters
aWidthis the new track width.

Definition at line 512 of file board_design_settings.h.

513  {
514  m_customTrackWidth = aWidth;
515  }

Referenced by BOARD::BOARD(), BOARD::SynchronizeNetsAndNetClasses(), and DIALOG_TRACK_VIA_SIZE::TransferDataFromWindow().

◆ SetCustomViaDrill()

void BOARD_DESIGN_SETTINGS::SetCustomViaDrill ( int  aDrill)
inline

Function SetCustomViaDrill Sets custom size for via drill (i.e.

not available in netclasses or preset list). To have it returned with GetCurrentViaDrill() you need to enable custom track & via sizes (UseCustomTrackViaSize()).

Parameters
aDrillis the new drill size.

Definition at line 593 of file board_design_settings.h.

594  {
595  m_customViaSize.m_Drill = aDrill;
596  }

References VIA_DIMENSION::m_Drill.

Referenced by BOARD::BOARD(), BOARD::SynchronizeNetsAndNetClasses(), and DIALOG_TRACK_VIA_SIZE::TransferDataFromWindow().

◆ SetCustomViaSize()

void BOARD_DESIGN_SETTINGS::SetCustomViaSize ( int  aSize)
inline

Function SetCustomViaSize Sets custom size for via diameter (i.e.

not available in netclasses or preset list). To have it returned with GetCurrentViaSize() you need to enable custom track & via sizes (UseCustomTrackViaSize()).

Parameters
aSizeis the new drill diameter.

Definition at line 564 of file board_design_settings.h.

565  {
566  m_customViaSize.m_Diameter = aSize;
567  }

References VIA_DIMENSION::m_Diameter.

Referenced by BOARD::BOARD(), BOARD::SynchronizeNetsAndNetClasses(), and DIALOG_TRACK_VIA_SIZE::TransferDataFromWindow().

◆ SetDefaultZoneSettings()

void BOARD_DESIGN_SETTINGS::SetDefaultZoneSettings ( const ZONE_SETTINGS aSettings)
inline

Definition at line 394 of file board_design_settings.h.

395  {
396  m_defaultZoneSettings = aSettings;
397  }
ZONE_SETTINGS m_defaultZoneSettings
The defualt settings that will be used for new zones.

Referenced by PCB_BASE_FRAME::SetZoneSettings(), and BOARD::SetZoneSettings().

◆ SetDiffPairIndex()

void BOARD_DESIGN_SETTINGS::SetDiffPairIndex ( unsigned  aIndex)

Function SetDiffPairIndex.

Parameters
aIndexis the diff pair dimensions list index to set.

Definition at line 1010 of file board_design_settings.cpp.

1011 {
1012  m_diffPairIndex = std::min( aIndex, (unsigned) 8 );
1013  m_useCustomDiffPair = false;
1014 }

References m_diffPairIndex, and m_useCustomDiffPair.

Referenced by DIFF_PAIR_MENU::eventHandler(), and SetCurrentNetClass().

◆ SetEnabledLayers()

void BOARD_DESIGN_SETTINGS::SetEnabledLayers ( LSET  aMask)

Function SetEnabledLayers changes the bit-mask of enabled layers.

Parameters
aMask= The new bit-mask of enabled layers

Definition at line 1041 of file board_design_settings.cpp.

1042 {
1043  // Back and front layers are always enabled.
1044  aMask.set( B_Cu ).set( F_Cu );
1045 
1046  m_enabledLayers = aMask;
1047 
1048  // update m_CopperLayerCount to ensure its consistency with m_EnabledLayers
1049  m_copperLayerCount = ( aMask & LSET::AllCuMask() ).count();
1050 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:719
int m_copperLayerCount
Number of copper layers for this design.
LSET m_enabledLayers
Bit-mask for layer enabling.

References LSET::AllCuMask(), B_Cu, F_Cu, m_copperLayerCount, and m_enabledLayers.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::loadBoardStackup(), and BOARD::SetEnabledLayers().

◆ SetIfPresent() [1/4]

bool JSON_SETTINGS::SetIfPresent ( const nlohmann::json aObj,
const std::string &  aPath,
wxString &  aTarget 
)
staticinherited

Sets the given string if the given key/path is present.

Parameters
aObjis the source object
aTargetis the storage destination
Returns
True if set, false if not

Definition at line 458 of file json_settings.cpp.

460 {
461  nlohmann::json::json_pointer ptr = PointerFromString( aPath );
462 
463  if( aObj.contains( ptr ) && aObj.at( ptr ).is_string() )
464  {
465  aTarget = aObj.at( ptr ).get<wxString>();
466  return true;
467  }
468 
469  return false;
470 }
static nlohmann::json::json_pointer PointerFromString(std::string aPath)
Builds a JSON pointer based on a given string.

References JSON_SETTINGS::PointerFromString().

Referenced by PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS().

◆ SetIfPresent() [2/4]

bool JSON_SETTINGS::SetIfPresent ( const nlohmann::json aObj,
const std::string &  aPath,
bool &  aTarget 
)
staticinherited

Sets the given bool if the given key/path is present.

Parameters
aObjis the source object
aTargetis the storage destination
Returns
True if set, false if not

Definition at line 473 of file json_settings.cpp.

475 {
476  nlohmann::json::json_pointer ptr = PointerFromString( aPath );
477 
478  if( aObj.contains( ptr ) && aObj.at( ptr ).is_boolean() )
479  {
480  aTarget = aObj.at( ptr ).get<bool>();
481  return true;
482  }
483 
484  return false;
485 }
static nlohmann::json::json_pointer PointerFromString(std::string aPath)
Builds a JSON pointer based on a given string.

References JSON_SETTINGS::PointerFromString().

◆ SetIfPresent() [3/4]

bool JSON_SETTINGS::SetIfPresent ( const nlohmann::json aObj,
const std::string &  aPath,
int &  aTarget 
)
staticinherited

Sets the given int if the given key/path is present.

Parameters
aObjis the source object
aTargetis the storage destination
Returns
True if set, false if not

Definition at line 488 of file json_settings.cpp.

490 {
491  nlohmann::json::json_pointer ptr = PointerFromString( aPath );
492 
493  if( aObj.contains( ptr ) && aObj.at( ptr ).is_number_integer() )
494  {
495  aTarget = aObj.at( ptr ).get<int>();
496  return true;
497  }
498 
499  return false;
500 }
static nlohmann::json::json_pointer PointerFromString(std::string aPath)
Builds a JSON pointer based on a given string.

References JSON_SETTINGS::PointerFromString().

◆ SetIfPresent() [4/4]

bool JSON_SETTINGS::SetIfPresent ( const nlohmann::json aObj,
const std::string &  aPath,
unsigned int &  aTarget 
)
staticinherited

Sets the given unsigned int if the given key/path is present.

Parameters
aObjis the source object
aTargetis the storage destination
Returns
True if set, false if not

Definition at line 503 of file json_settings.cpp.

505 {
506  nlohmann::json::json_pointer ptr = PointerFromString( aPath );
507 
508  if( aObj.contains( ptr ) && aObj.at( ptr ).is_number_unsigned() )
509  {
510  aTarget = aObj.at( ptr ).get<unsigned int>();
511  return true;
512  }
513 
514  return false;
515 }
static nlohmann::json::json_pointer PointerFromString(std::string aPath)
Builds a JSON pointer based on a given string.

References JSON_SETTINGS::PointerFromString().

◆ SetLegacyFilename()

void JSON_SETTINGS::SetLegacyFilename ( const wxString &  aFilename)
inlineinherited

Definition at line 70 of file json_settings.h.

70 { m_legacy_filename = aFilename; }
wxString m_legacy_filename
The filename of the wxConfig legacy file (if different from m_filename)

References JSON_SETTINGS::m_legacy_filename.

Referenced by LIBEDIT_SETTINGS::LIBEDIT_SETTINGS().

◆ SetManager()

void JSON_SETTINGS::SetManager ( SETTINGS_MANAGER aManager)
inlineinherited

Definition at line 183 of file json_settings.h.

184  {
185  m_manager = aManager;
186  }
SETTINGS_MANAGER * m_manager
A pointer to the settings manager managing this file (may be null)

References JSON_SETTINGS::m_manager.

◆ SetMinHoleSeparation()

void BOARD_DESIGN_SETTINGS::SetMinHoleSeparation ( int  aDistance)

Function SetMinHoleSeparation.

Parameters
aValueThe minimum distance between the edges of two holes or 0 to disable hole-to-hole separation checking.

Definition at line 1017 of file board_design_settings.cpp.

1018 {
1019  m_HoleToHoleMin = aDistance;
1020 }

References m_HoleToHoleMin.

Referenced by PANEL_SETUP_FEATURE_CONSTRAINTS::TransferDataFromWindow().

◆ SetNetClasses()

void BOARD_DESIGN_SETTINGS::SetNetClasses ( NETCLASSES aNetClasses)
inline

Definition at line 381 of file board_design_settings.h.

382  {
383  if( aNetClasses )
384  m_netClasses = aNetClasses;
385  else
387  }
NETCLASSES m_internalNetClasses
Net classes that are loaded from the board file before these were stored in the project.
NETCLASSES * m_netClasses
This will point to m_internalNetClasses until it is repointed to the project after load.

References m_internalNetClasses.

Referenced by BOARD::SetProject().

◆ SetParent()

void NESTED_SETTINGS::SetParent ( JSON_SETTINGS aParent)
inherited

Definition at line 155 of file nested_settings.cpp.

156 {
157  m_parent = aParent;
158 
159  if( m_parent )
160  {
161  m_parent->AddNestedSettings( this );
162 
163  // In case we were created after the parent's ctor
164  LoadFromFile();
165  }
166 }
bool LoadFromFile(const wxString &aDirectory="") override
Loads the JSON document from the parent and then calls Load()
void AddNestedSettings(NESTED_SETTINGS *aSettings)
Transfers ownership of a given NESTED_SETTINGS to this object.
JSON_SETTINGS * m_parent
A pointer to the parent object to load and store from.

References JSON_SETTINGS::AddNestedSettings(), NESTED_SETTINGS::LoadFromFile(), and NESTED_SETTINGS::m_parent.

Referenced by BOARD::ClearProject(), NESTED_SETTINGS::NESTED_SETTINGS(), JSON_SETTINGS::ReleaseNestedSettings(), and BOARD::SetProject().

◆ SetTrackWidthIndex()

void BOARD_DESIGN_SETTINGS::SetTrackWidthIndex ( unsigned  aIndex)

Function SetTrackWidthIndex sets the current track width list index to aIndex.

Parameters
aIndexis the track width list index.

Definition at line 1003 of file board_design_settings.cpp.

1004 {
1005  m_trackWidthIndex = std::min( aIndex, (unsigned) m_TrackWidthList.size() );
1006  m_useCustomTrackVia = false;
1007 }
std::vector< int > m_TrackWidthList

References m_trackWidthIndex, m_TrackWidthList, and m_useCustomTrackVia.

Referenced by TRACK_WIDTH_MENU::eventHandler(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), SetCurrentNetClass(), PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), and PCB_EDIT_FRAME::UpdateTrackWidthSelectBox().

◆ SetViaSizeIndex()

void BOARD_DESIGN_SETTINGS::SetViaSizeIndex ( unsigned  aIndex)

Function SetViaSizeIndex sets the current via size list index to aIndex.

Parameters
aIndexis the via size list index.

Definition at line 983 of file board_design_settings.cpp.

984 {
985  m_viaSizeIndex = std::min( aIndex, (unsigned) m_ViasDimensionsList.size() );
986  m_useCustomTrackVia = false;
987 }
std::vector< VIA_DIMENSION > m_ViasDimensionsList

References m_useCustomTrackVia, m_ViasDimensionsList, and m_viaSizeIndex.

Referenced by VIA_SIZE_MENU::eventHandler(), TRACK_WIDTH_MENU::eventHandler(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), SetCurrentNetClass(), PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event(), PCB_EDIT_FRAME::UpdateViaSizeSelectBox(), PCB_EDITOR_CONTROL::ViaSizeDec(), and PCB_EDITOR_CONTROL::ViaSizeInc().

◆ Store()

bool JSON_SETTINGS::Store ( )
virtualinherited

Stores the current parameters into the JSON document represented by this object Note: this doesn't do any writing to disk; that's handled by SETTINGS_MANAGER.

Returns
true if any part of the JSON document was updated

Definition at line 284 of file json_settings.cpp.

285 {
286  bool modified = false;
287 
288  for( auto param : m_params )
289  {
290  modified |= !param->MatchesFile( this );
291  param->Store( this );
292  }
293 
294  return modified;
295 }
std::vector< PARAM_BASE * > m_params
The list of parameters (owned by this object)

References JSON_SETTINGS::m_params.

Referenced by PANEL_MODEDIT_COLOR_SETTINGS::PANEL_MODEDIT_COLOR_SETTINGS(), SETTINGS_MANAGER::SaveColorSettings(), NESTED_SETTINGS::SaveToFile(), and JSON_SETTINGS::SaveToFile().

◆ UseCustomDiffPairDimensions() [1/2]

void BOARD_DESIGN_SETTINGS::UseCustomDiffPairDimensions ( bool  aEnabled)
inline

Function UseCustomDiffPairDimensions Enables/disables custom differential pair dimensions.

Parameters
aEnableddecides if custom settings should be used for new differential pairs.

Definition at line 705 of file board_design_settings.h.

706  {
707  m_useCustomDiffPair = aEnabled;
708  }

Referenced by DIFF_PAIR_MENU::eventHandler(), PNS::SIZES_SETTINGS::Init(), and DIFF_PAIR_MENU::update().

◆ UseCustomDiffPairDimensions() [2/2]

bool BOARD_DESIGN_SETTINGS::UseCustomDiffPairDimensions ( ) const
inline

Function UseCustomDiffPairDimensions.

Returns
True if custom sizes of diff pairs are enabled, false otherwise.

Definition at line 714 of file board_design_settings.h.

715  {
716  return m_useCustomDiffPair;
717  }

References m_useCustomDiffPair.

◆ UseCustomTrackViaSize() [1/2]

void BOARD_DESIGN_SETTINGS::UseCustomTrackViaSize ( bool  aEnabled)
inline

Function UseCustomTrackViaSize Enables/disables custom track/via size settings.

If enabled, values set with SetCustomTrackWidth()/SetCustomViaSize()/SetCustomViaDrill() are used for newly created tracks and vias.

Parameters
aEnableddecides if custom settings should be used for new tracks/vias.

Definition at line 614 of file board_design_settings.h.

615  {
616  m_useCustomTrackVia = aEnabled;
617  }

Referenced by BOARD::BOARD(), ROUTER_TOOL::CustomTrackWidthDialog(), VIA_SIZE_MENU::eventHandler(), TRACK_WIDTH_MENU::eventHandler(), BOARD::SynchronizeNetsAndNetClasses(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), VIA_SIZE_MENU::update(), TRACK_WIDTH_MENU::update(), PCB_EDITOR_CONTROL::ViaSizeDec(), and PCB_EDITOR_CONTROL::ViaSizeInc().

◆ UseCustomTrackViaSize() [2/2]

bool BOARD_DESIGN_SETTINGS::UseCustomTrackViaSize ( ) const
inline

Function UseCustomTrackViaSize.

Returns
True if custom sizes of tracks & vias are enabled, false otherwise.

Definition at line 623 of file board_design_settings.h.

624  {
625  return m_useCustomTrackVia;
626  }

References m_useCustomTrackVia.

◆ UseNetClassDiffPair()

bool BOARD_DESIGN_SETTINGS::UseNetClassDiffPair ( ) const
inline

Function UseNetClassDiffPair returns true if netclass values should be used to obtain appropriate diff pair dimensions.

Definition at line 439 of file board_design_settings.h.

440  {
441  return ( m_diffPairIndex == 0 && !m_useCustomDiffPair );
442  }

Referenced by PNS::SIZES_SETTINGS::Init().

◆ UseNetClassTrack()

bool BOARD_DESIGN_SETTINGS::UseNetClassTrack ( ) const
inline

Function UseNetClassTrack returns true if netclass values should be used to obtain appropriate track width.

Definition at line 421 of file board_design_settings.h.

422  {
423  return ( m_trackWidthIndex == 0 && !m_useCustomTrackVia );
424  }

Referenced by PNS::SIZES_SETTINGS::Init().

◆ UseNetClassVia()

bool BOARD_DESIGN_SETTINGS::UseNetClassVia ( ) const
inline

Function UseNetClassVia returns true if netclass values should be used to obtain appropriate via size.

Definition at line 430 of file board_design_settings.h.

431  {
432  return ( m_viaSizeIndex == 0 && !m_useCustomTrackVia );
433  }

Referenced by PNS::SIZES_SETTINGS::Init().

Member Data Documentation

◆ m_AuxOrigin

◆ m_BlindBuriedViaAllowed

◆ m_boardThickness

int BOARD_DESIGN_SETTINGS::m_boardThickness
private

Board thickness for 3D viewer.

Definition at line 329 of file board_design_settings.h.

Referenced by BOARD_DESIGN_SETTINGS(), GetBoardThickness(), and initFromOther().

◆ m_CopperEdgeClearance

◆ m_copperLayerCount

int BOARD_DESIGN_SETTINGS::m_copperLayerCount
private

Number of copper layers for this design.

Definition at line 325 of file board_design_settings.h.

Referenced by GetCopperLayerCount(), initFromOther(), SetCopperLayerCount(), and SetEnabledLayers().

◆ m_createIfDefault

bool JSON_SETTINGS::m_createIfDefault
protectedinherited

Whether or not the backing store file should be created if all parameters are still at their default values.

Ignored if m_createIfMissing is false or m_writeFile is false.

Definition at line 290 of file json_settings.h.

Referenced by JSON_SETTINGS::SaveToFile().

◆ m_createIfMissing

bool JSON_SETTINGS::m_createIfMissing
protectedinherited

Whether or not the backing store file should be created it if doesn't exist.

Definition at line 284 of file json_settings.h.

Referenced by JSON_SETTINGS::SaveToFile().

◆ m_currentNetClassName

wxString BOARD_DESIGN_SETTINGS::m_currentNetClassName
private

Current net class name used to display netclass info.

This is also the last used netclass after starting a track.

Definition at line 333 of file board_design_settings.h.

Referenced by GetCurrentMicroViaDrill(), GetCurrentMicroViaSize(), GetCurrentNetClassName(), initFromOther(), and SetCurrentNetClass().

◆ m_CurrentViaType

VIATYPE BOARD_DESIGN_SETTINGS::m_CurrentViaType

(VIA_BLIND_BURIED, VIA_THROUGH, VIA_MICROVIA)

Definition at line 229 of file board_design_settings.h.

Referenced by BOARD_DESIGN_SETTINGS(), and initFromOther().

◆ m_customDiffPair

DIFF_PAIR_DIMENSION BOARD_DESIGN_SETTINGS::m_customDiffPair
private

Definition at line 323 of file board_design_settings.h.

Referenced by BOARD_DESIGN_SETTINGS(), and initFromOther().

◆ m_customTrackWidth

int BOARD_DESIGN_SETTINGS::m_customTrackWidth
private

◆ m_customViaSize

VIA_DIMENSION BOARD_DESIGN_SETTINGS::m_customViaSize
private

◆ m_DefaultFPTextItems

◆ m_defaultZoneSettings

ZONE_SETTINGS BOARD_DESIGN_SETTINGS::m_defaultZoneSettings
private

The defualt settings that will be used for new zones.

Definition at line 348 of file board_design_settings.h.

Referenced by BOARD_DESIGN_SETTINGS(), GetDefaultZoneSettings(), and initFromOther().

◆ m_deleteLegacyAfterMigration

bool JSON_SETTINGS::m_deleteLegacyAfterMigration
protectedinherited

Whether or not to delete legacy file after migration.

Definition at line 296 of file json_settings.h.

Referenced by JSON_SETTINGS::LoadFromFile(), and PROJECT_FILE::PROJECT_FILE().

◆ m_DiffPairDimensionsList

◆ m_diffPairIndex

unsigned BOARD_DESIGN_SETTINGS::m_diffPairIndex
private

◆ m_DimensionArrowLength

◆ m_DimensionExtensionOffset

◆ m_DimensionKeepTextAligned

◆ m_DimensionPrecision

int BOARD_DESIGN_SETTINGS::m_DimensionPrecision

◆ m_DimensionSuppressZeroes

◆ m_DimensionTextPosition

◆ m_DimensionUnitsFormat

◆ m_DimensionUnitsMode

◆ m_DRCEngine

◆ m_DrcExclusions

std::set<wxString> BOARD_DESIGN_SETTINGS::m_DrcExclusions

◆ m_DRCSeverities

◆ m_enabledLayers

LSET BOARD_DESIGN_SETTINGS::m_enabledLayers
private

Bit-mask for layer enabling.

Definition at line 327 of file board_design_settings.h.

Referenced by BOARD_DESIGN_SETTINGS(), GetEnabledLayers(), initFromOther(), SetCopperLayerCount(), and SetEnabledLayers().

◆ m_filename

wxString JSON_SETTINGS::m_filename
protectedinherited

◆ m_GridOrigin

◆ m_HasStackup

◆ m_HoleToHoleMin

◆ m_internalNetClasses

NETCLASSES BOARD_DESIGN_SETTINGS::m_internalNetClasses
private

Net classes that are loaded from the board file before these were stored in the project.

Definition at line 342 of file board_design_settings.h.

Referenced by BOARD_DESIGN_SETTINGS(), initFromOther(), and SetNetClasses().

◆ m_legacy_filename

wxString JSON_SETTINGS::m_legacy_filename
protectedinherited

The filename of the wxConfig legacy file (if different from m_filename)

Definition at line 272 of file json_settings.h.

Referenced by JSON_SETTINGS::LoadFromFile(), and JSON_SETTINGS::SetLegacyFilename().

◆ m_LineThickness

◆ m_location

SETTINGS_LOC JSON_SETTINGS::m_location
protectedinherited

The location of this settings file (.

See also
SETTINGS_LOC)

Definition at line 275 of file json_settings.h.

Referenced by JSON_SETTINGS::GetLocation().

◆ m_manager

SETTINGS_MANAGER* JSON_SETTINGS::m_manager
protectedinherited

A pointer to the settings manager managing this file (may be null)

Definition at line 305 of file json_settings.h.

Referenced by FOOTPRINT_EDITOR_SETTINGS::migrateSchema0to1(), COLOR_SETTINGS::migrateSchema0to1(), and JSON_SETTINGS::SetManager().

◆ m_MaxError

◆ m_MicroViasAllowed

◆ m_MicroViasMinDrill

◆ m_MicroViasMinSize

◆ m_MinClearance

◆ m_MinThroughDrill

◆ m_nested_settings

std::vector<NESTED_SETTINGS*> JSON_SETTINGS::m_nested_settings
protectedinherited

Nested settings files that live inside this one, if any.

Definition at line 281 of file json_settings.h.

Referenced by JSON_SETTINGS::AddNestedSettings(), JSON_SETTINGS::LoadFromFile(), JSON_SETTINGS::ReleaseNestedSettings(), and JSON_SETTINGS::SaveToFile().

◆ m_netClasses

NETCLASSES* BOARD_DESIGN_SETTINGS::m_netClasses
private

This will point to m_internalNetClasses until it is repointed to the project after load.

Definition at line 345 of file board_design_settings.h.

Referenced by BOARD_DESIGN_SETTINGS(), GetNetClasses(), and initFromOther().

◆ m_Pad_Master

◆ m_params

◆ m_parent

◆ m_path

std::string NESTED_SETTINGS::m_path
protectedinherited

The path (in pointer format) of where to store this document in the parent.

Definition at line 65 of file nested_settings.h.

Referenced by NESTED_SETTINGS::LoadFromFile(), and NESTED_SETTINGS::SaveToFile().

◆ m_preserved_paths

std::vector<nlohmann::json::json_pointer> JSON_SETTINGS::m_preserved_paths
protectedinherited

A list of JSON pointers that are preserved during a read-update-write to disk.

Definition at line 308 of file json_settings.h.

◆ m_resetParamsIfMissing

bool JSON_SETTINGS::m_resetParamsIfMissing
protectedinherited

Whether or not to set parameters to their default value if missing from JSON on Load()

Definition at line 299 of file json_settings.h.

Referenced by BOARD_DESIGN_SETTINGS(), and JSON_SETTINGS::Load().

◆ m_schemaVersion

int JSON_SETTINGS::m_schemaVersion
protectedinherited

◆ m_SolderMaskMargin

◆ m_SolderMaskMinWidth

◆ m_SolderPasteMargin

◆ m_SolderPasteMarginRatio

◆ m_stackup

BOARD_STACKUP BOARD_DESIGN_SETTINGS::m_stackup
private

the description of layers stackup, for board fabrication only physical layers are in layers stackup.

It includes not only layers enabled for the board edition, but also dielectic layers

Definition at line 339 of file board_design_settings.h.

Referenced by GetStackupDescriptor(), and initFromOther().

◆ m_TextItalic

◆ m_TextSize

◆ m_TextThickness

◆ m_TextUpright

◆ m_TrackMinWidth

◆ m_trackWidthIndex

unsigned BOARD_DESIGN_SETTINGS::m_trackWidthIndex
private

◆ m_TrackWidthList

◆ m_UseConnectedTrackWidth

◆ m_useCustomDiffPair

bool BOARD_DESIGN_SETTINGS::m_useCustomDiffPair
private

◆ m_useCustomTrackVia

bool BOARD_DESIGN_SETTINGS::m_useCustomTrackVia
private

◆ m_ViasDimensionsList

◆ m_viaSizeIndex

unsigned BOARD_DESIGN_SETTINGS::m_viaSizeIndex
private

◆ m_ViasMinAnnulus

◆ m_ViasMinSize

◆ m_writeFile

bool JSON_SETTINGS::m_writeFile
protectedinherited

Whether or not the backing store file should be written.

Definition at line 293 of file json_settings.h.

Referenced by JSON_SETTINGS::SaveToFile().

◆ m_ZoneFillVersion

◆ m_ZoneKeepExternalFillets


The documentation for this class was generated from the following files: