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_SETTINGSoperator= (const BOARD_DESIGN_SETTINGS &aOther)
 
bool LoadFromFile (const std::string &aDirectory="") override
 Loads the backing file from disk and then calls Load() 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 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 std::string &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 ()
 
std::string GetFilename () const
 
wxString GetFullFilename () const
 
SETTINGS_LOC GetLocation () const
 
void SetLegacyFilename (const std::string &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 Migrate ()
 Migrates the schema of this settings from the version in the file to the latest version. More...
 
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...
 

Public Attributes

std::vector< int > m_TrackWidthList
 
std::vector< VIA_DIMENSIONm_ViasDimensionsList
 
std::vector< DIFF_PAIR_DIMENSIONm_DiffPairDimensionsList
 
std::vector< DRC_SELECTOR * > m_DRCRuleSelectors
 
std::vector< DRC_RULE * > m_DRCRules
 
std::vector< DRC_SELECTOR * > m_matched
 
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::map< int, int > m_DRCSeverities
 
std::set< wxString > m_DrcExclusions
 Excluded DRC items. More...
 
bool m_ZoneUseNoOutlineInFill
 Option to handle filled polygons in zones: the "legacy" option is using thick outlines around filled polygons: give the best shape the "new" option is using only filled polygons (no outline: give the faster redraw time moreover when exporting zone filled areas, the excatct shape is exported. More...
 
int m_MaxError
 
int m_SolderMaskMargin
 Solder mask margin. More...
 
int m_SolderMaskMinWidth
 Solder mask min width. More...
 
int m_SolderPasteMargin
 Solder paste margin absolute value. More...
 
double m_SolderPasteMarginRatio
 Solder pask margin ratio value of pad size The final margin is the sum of these 2 values. More...
 
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]
 
int m_DimensionUnits
 
int m_DimensionPrecision
 
wxPoint m_AuxOrigin
 origin for plot exports More...
 
wxPoint m_GridOrigin
 origin for grid offsets More...
 
D_PAD m_Pad_Master
 A dummy pad to store all default parameters. More...
 
bool m_HasStackup
 Set to true if the board has a stackup management. More...
 

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...
 
std::string m_filename
 The filename (not including path) of this settings file. More...
 
std::string 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

SEVERITY severityFromString (const wxString &aSeverity)
 
wxString severityToString (const SEVERITY &aSeverity)
 

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 214 of file board_design_settings.h.

Constructor & Destructor Documentation

◆ BOARD_DESIGN_SETTINGS()

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

Definition at line 42 of file board_design_settings.cpp.

42  :
43  NESTED_SETTINGS( "board_design_settings", bdsSchemaVersion, aParent, aPath ),
45 
46 {
47  // We want to leave alone parameters that aren't found in the project JSON as they may be
48  // initialized by the board file parser before NESTED_SETTINGS::LoadFromFile is called.
49  m_resetParamsIfMissing = false;
50 
51  // Create a default NETCLASS list so that things don't break horribly if there's no project
52  // loaded. This also is used during file load for legacy boards that have netclasses stored
53  // in the file. After load, this information will be moved to the project and the pointer
54  // updated.
56 
57  m_HasStackup = false; // no stackup defined by default
58 
59  LSET all_set = LSET().set();
60  m_enabledLayers = all_set; // All layers enabled at first.
61  // SetCopperLayerCount() will adjust this.
62 
63  SetCopperLayerCount( 2 ); // Default design is a double sided board
65 
66  // if true, when creating a new track starting on an existing track, use this track width
68 
70  m_MicroViasAllowed = false;
71 
72  // First is always the reference designator
73  m_DefaultFPTextItems.emplace_back( wxT( "REF**" ), true, F_SilkS );
74  // Second is always the value
75  m_DefaultFPTextItems.emplace_back( wxT( "" ), true, F_Fab );
76  // Any following ones are freebies
77  m_DefaultFPTextItems.emplace_back( wxT( "${REF}" ), true, F_Fab );
78 
80  m_TextSize[ LAYER_CLASS_SILK ] = wxSize( Millimeter2iu( DEFAULT_SILK_TEXT_SIZE ),
81  Millimeter2iu( DEFAULT_SILK_TEXT_SIZE ) );
83  m_TextItalic[ LAYER_CLASS_SILK ] = false;
85 
87  m_TextSize[ LAYER_CLASS_COPPER ] = wxSize( Millimeter2iu( DEFAULT_COPPER_TEXT_SIZE ),
88  Millimeter2iu( DEFAULT_COPPER_TEXT_SIZE ) );
92 
93  // Edges & Courtyards; text properties aren't used but better to have them holding
94  // reasonable values than not.
96  m_TextSize[ LAYER_CLASS_EDGES ] = wxSize( Millimeter2iu( DEFAULT_TEXT_SIZE ),
97  Millimeter2iu( DEFAULT_TEXT_SIZE ) );
100  m_TextUpright[ LAYER_CLASS_EDGES ] = false;
101 
103  m_TextSize[ LAYER_CLASS_COURTYARD ] = wxSize( Millimeter2iu( DEFAULT_TEXT_SIZE ),
104  Millimeter2iu( DEFAULT_TEXT_SIZE ) );
108 
109  m_LineThickness[ LAYER_CLASS_FAB ] = Millimeter2iu( DEFAULT_LINE_WIDTH );
110  m_TextSize[ LAYER_CLASS_FAB ] = wxSize( Millimeter2iu( DEFAULT_TEXT_SIZE ),
111  Millimeter2iu( DEFAULT_TEXT_SIZE ) );
112  m_TextThickness[ LAYER_CLASS_FAB ] = Millimeter2iu( DEFAULT_TEXT_WIDTH );
113  m_TextItalic[ LAYER_CLASS_FAB ] = false;
114  m_TextUpright[ LAYER_CLASS_FAB ] = false;
115 
117  m_TextSize[ LAYER_CLASS_OTHERS ] = wxSize( Millimeter2iu( DEFAULT_TEXT_SIZE ),
118  Millimeter2iu( DEFAULT_TEXT_SIZE ) );
120  m_TextItalic[ LAYER_CLASS_OTHERS ] = false;
122 
123  m_DimensionUnits = 0; // Inches
124  m_DimensionPrecision = 1; // 0.001mm / 0.1 mil
125 
126  m_useCustomTrackVia = false;
127  m_customTrackWidth = Millimeter2iu( DEFAULT_CUSTOMTRACKWIDTH );
130 
131  m_useCustomDiffPair = false;
133  m_customDiffPair.m_Gap = Millimeter2iu( DEFAULT_CUSTOMDPAIRGAP );
135 
136  m_MinClearance = Millimeter2iu( DEFAULT_MINCLEARANCE );
137  m_TrackMinWidth = Millimeter2iu( DEFAULT_TRACKMINWIDTH );
139  m_ViasMinSize = Millimeter2iu( DEFAULT_VIASMINSIZE );
140  m_MinThroughDrill = Millimeter2iu( DEFAULT_MINTHROUGHDRILL );
141  m_MicroViasMinSize = Millimeter2iu( DEFAULT_MICROVIASMINSIZE );
144  m_HoleToHoleMin = Millimeter2iu( DEFAULT_HOLETOHOLEMIN );
145 
146  for( int errorCode = DRCE_FIRST; errorCode <= DRCE_LAST; ++errorCode )
147  m_DRCSeverities[ errorCode ] = RPT_SEVERITY_ERROR;
148 
152 
155 
159 
160  m_MaxError = ARC_HIGH_DEF;
161  m_ZoneUseNoOutlineInFill = false; // Use compatibility mode by default
162 
163  // Global mask margins:
166  m_SolderPasteMargin = 0; // Solder paste margin absolute value
167  m_SolderPasteMarginRatio = 0.0; // Solder paste margin as a ratio of pad size
168  // The final margin is the sum of these 2 values
169  // Usually < 0 because the mask is smaller than pad
170  // Layer thickness for 3D viewer
171  m_boardThickness = Millimeter2iu( DEFAULT_BOARD_THICKNESS_MM );
172 
173  m_viaSizeIndex = 0;
174  m_trackWidthIndex = 0;
175  m_diffPairIndex = 0;
176 
177  // Parameters stored in JSON in the project file
178 
179  // NOTE: Previously, BOARD_DESIGN_SETTINGS stored the basic board layer information (layer
180  // names and enable/disable state) in the project file even though this information is also
181  // stored in the board file. This was implemented for importing these settings from another
182  // project. Going forward, the import feature will just import from other board files (since
183  // we could have multi-board projects in the future anyway) so this functionality is dropped.
184 
185  m_params.emplace_back( new PARAM<bool>( "rules.allow_microvias", &m_MicroViasAllowed, false ) );
186 
187  m_params.emplace_back(
188  new PARAM<bool>( "rules.allow_blind_buried_vias", &m_BlindBuriedViaAllowed, false ) );
189 
190  m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_clearance", &m_MinClearance,
191  Millimeter2iu( DEFAULT_MINCLEARANCE ), Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ),
192  MM_PER_IU ) );
193 
194  m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_track_width", &m_TrackMinWidth,
195  Millimeter2iu( DEFAULT_TRACKMINWIDTH ), Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ),
196  MM_PER_IU ) );
197 
198  m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_via_annulus", &m_ViasMinAnnulus,
199  Millimeter2iu( DEFAULT_VIASMINSIZE ), Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ),
200  MM_PER_IU ) );
201 
202  m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_via_diameter", &m_ViasMinSize,
203  Millimeter2iu( DEFAULT_VIASMINSIZE ), Millimeter2iu( 0.01 ), Millimeter2iu( 25.0 ),
204  MM_PER_IU ) );
205 
206  m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_through_hole_diameter",
207  &m_MinThroughDrill, Millimeter2iu( DEFAULT_MINTHROUGHDRILL ), Millimeter2iu( 0.01 ),
208  Millimeter2iu( 25.0 ), MM_PER_IU ) );
209 
210  m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_microvia_diameter",
211  &m_MicroViasMinSize, Millimeter2iu( DEFAULT_MICROVIASMINSIZE ), Millimeter2iu( 0.01 ),
212  Millimeter2iu( 10.0 ), MM_PER_IU ) );
213 
214  m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_microvia_drill", &m_MicroViasMinDrill,
215  Millimeter2iu( DEFAULT_MICROVIASMINDRILL ), Millimeter2iu( 0.01 ),
216  Millimeter2iu( 10.0 ), MM_PER_IU ) );
217 
218  m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_hole_to_hole", &m_HoleToHoleMin,
219  Millimeter2iu( DEFAULT_HOLETOHOLEMIN ), Millimeter2iu( 0.00 ), Millimeter2iu( 10.0 ),
220  MM_PER_IU ) );
221 
222  // Note: a clearance of -0.01 is a flag indicating we should use the legacy (pre-6.0) method
223  // based on the edge cut thicknesses.
224  m_params.emplace_back( new PARAM_SCALED<int>( "rules.min_copper_edge_clearance",
226  Millimeter2iu( -0.01 ), Millimeter2iu( 25.0 ), MM_PER_IU ) );
227 
228  m_params.emplace_back( new PARAM_SCALED<int>( "rules.solder_mask_clearance",
230  Millimeter2iu( -1.0 ), Millimeter2iu( 1.0 ), MM_PER_IU ) );
231 
232  m_params.emplace_back( new PARAM_SCALED<int>( "rules.solder_mask_min_width",
234  Millimeter2iu( 1.0 ), MM_PER_IU ) );
235 
236  m_params.emplace_back( new PARAM_SCALED<int>( "rules.solder_paste_clearance",
238  Millimeter2iu( -1.0 ), Millimeter2iu( 1.0 ), MM_PER_IU ) );
239 
240  m_params.emplace_back( new PARAM<double>( "rules.solder_paste_margin_ratio",
242 
243  m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "rule_severities",
244  [&]() -> nlohmann::json
245  {
246  nlohmann::json ret = {};
247 
248  for( const RC_ITEM& item : DRC_ITEM::GetItemsWithSeverities() )
249  {
250  int code = item.GetErrorCode();
251 
252  if( !m_DRCSeverities.count( code ) )
253  continue;
254 
255  wxString name = item.GetSettingsKey();
256 
257  ret[std::string( name.ToUTF8() )] =
258  SeverityToString( static_cast<SEVERITY>( m_DRCSeverities[code] ) );
259  }
260 
261  return ret;
262  },
263  [&]( const nlohmann::json& aJson )
264  {
265  if( !aJson.is_object() )
266  return;
267 
268  for( const RC_ITEM& item : DRC_ITEM::GetItemsWithSeverities() )
269  {
270  wxString name = item.GetSettingsKey();
271  std::string key( name.ToUTF8() );
272 
273  if( aJson.contains( key ) )
274  m_DRCSeverities[item.GetErrorCode()] = SeverityFromString( aJson[key] );
275  }
276  }, {} ) );
277 
278  m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "drc_exclusions",
279  [&]() -> nlohmann::json
280  {
281  nlohmann::json js = nlohmann::json::array();
282 
283  for( const auto& entry : m_DrcExclusions )
284  js.push_back( entry );
285 
286  return js;
287  },
288  [&]( const nlohmann::json& aObj )
289  {
290  m_DrcExclusions.clear();
291 
292  if( !aObj.is_array() )
293  return;
294 
295  for( const nlohmann::json& entry : aObj )
296  {
297  if( entry.empty() )
298  continue;
299 
300  m_DrcExclusions.insert( entry.get<wxString>() );
301  }
302  },
303  {} ) );
304 
305  m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "track_widths",
306  [&]() -> nlohmann::json
307  {
308  nlohmann::json js = nlohmann::json::array();
309 
310  for( const int& width : m_TrackWidthList )
311  js.push_back( Iu2Millimeter( width ) );
312 
313  return js;
314  },
315  [&]( const nlohmann::json& aJson )
316  {
317  if( !aJson.is_array() )
318  return;
319 
320  m_TrackWidthList.clear();
321 
322  for( const nlohmann::json& entry : aJson )
323  {
324  if( entry.empty() )
325  continue;
326 
327  m_TrackWidthList.emplace_back( Millimeter2iu( entry.get<double>() ) );
328  }
329  },
330  {} ) );
331 
332  m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "via_dimensions",
333  [&]() -> nlohmann::json
334  {
335  nlohmann::json js = nlohmann::json::array();
336 
337  for( const auto& via : m_ViasDimensionsList )
338  {
339  nlohmann::json entry = {};
340 
341  entry["diameter"] = Iu2Millimeter( via.m_Diameter );
342  entry["drill"] = Iu2Millimeter( via.m_Drill );
343 
344  js.push_back( entry );
345  }
346 
347  return js;
348  },
349  [&]( const nlohmann::json& aObj )
350  {
351  if( !aObj.is_array() )
352  return;
353 
354  m_ViasDimensionsList.clear();
355 
356  for( const nlohmann::json& entry : aObj )
357  {
358  if( entry.empty() || !entry.is_object() )
359  continue;
360 
361  if( !entry.contains( "diameter" ) || !entry.contains( "drill" ) )
362  continue;
363 
364  int diameter = Millimeter2iu( entry["diameter"].get<double>() );
365  int drill = Millimeter2iu( entry["drill"].get<double>() );
366 
367  m_ViasDimensionsList.emplace_back( VIA_DIMENSION( diameter, drill ) );
368  }
369  },
370  {} ) );
371 
372  m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "diff_pair_dimensions",
373  [&]() -> nlohmann::json
374  {
375  nlohmann::json js = nlohmann::json::array();
376 
377  for( const auto& pair : m_DiffPairDimensionsList )
378  {
379  nlohmann::json entry = {};
380 
381  entry["width"] = Iu2Millimeter( pair.m_Width );
382  entry["gap"] = Iu2Millimeter( pair.m_Gap );
383  entry["via_gap"] = Iu2Millimeter( pair.m_ViaGap );
384 
385  js.push_back( entry );
386  }
387 
388  return js;
389  },
390  [&]( const nlohmann::json& aObj )
391  {
392  if( !aObj.is_array() )
393  return;
394 
395  m_DiffPairDimensionsList.clear();
396 
397  for( const nlohmann::json& entry : aObj )
398  {
399  if( entry.empty() || !entry.is_object() )
400  continue;
401 
402  if( !entry.contains( "width" ) || !entry.contains( "gap" )
403  || !entry.contains( "via_gap" ) )
404  continue;
405 
406  int width = Millimeter2iu( entry["width"].get<int>() );
407  int gap = Millimeter2iu( entry["gap"].get<int>() );
408  int via_gap = Millimeter2iu( entry["via_gap"].get<int>() );
409 
410  m_DiffPairDimensionsList.emplace_back(
411  DIFF_PAIR_DIMENSION( width, gap, via_gap ) );
412  }
413  },
414  {} ) );
415 
416  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.silk_line_width",
418  Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), MM_PER_IU ) );
419 
420  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.silk_text_size_v",
421  &m_TextSize[LAYER_CLASS_SILK].y, Millimeter2iu( DEFAULT_SILK_TEXT_SIZE ),
422  TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, MM_PER_IU ) );
423 
424  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.silk_text_size_h",
425  &m_TextSize[LAYER_CLASS_SILK].x, Millimeter2iu( DEFAULT_SILK_TEXT_SIZE ),
426  TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, MM_PER_IU ) );
427 
428  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.silk_text_thickness",
430  TEXTS_MAX_WIDTH, MM_PER_IU ) );
431 
432  m_params.emplace_back( new PARAM<bool>(
433  "defaults.silk_text_italic", &m_TextItalic[LAYER_CLASS_SILK], false ) );
434 
435  m_params.emplace_back( new PARAM<bool>(
436  "defaults.silk_text_upright", &m_TextUpright[ LAYER_CLASS_SILK ], true ) );
437 
438  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.copper_line_width",
440  Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), MM_PER_IU ) );
441 
442  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.copper_text_size_v",
444  TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, MM_PER_IU ) );
445 
446  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.copper_text_size_h",
448  TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, MM_PER_IU ) );
449 
450  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.copper_text_thickness",
452  Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), MM_PER_IU ) );
453 
454  m_params.emplace_back( new PARAM<bool>(
455  "defaults.copper_text_italic", &m_TextItalic[LAYER_CLASS_COPPER], false ) );
456 
457  m_params.emplace_back( new PARAM<bool>(
458  "defaults.copper_text_upright", &m_TextUpright[LAYER_CLASS_COPPER], true ) );
459 
460  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.board_outline_line_width",
462  Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), MM_PER_IU ) );
463 
464  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.courtyard_line_width",
466  Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), MM_PER_IU ) );
467 
468  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.fab_line_width",
470  Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), MM_PER_IU ) );
471 
472  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.fab_text_size_v",
473  &m_TextSize[LAYER_CLASS_FAB].y, Millimeter2iu( DEFAULT_TEXT_SIZE ),
474  TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, MM_PER_IU ) );
475 
476  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.fab_text_size_h",
477  &m_TextSize[LAYER_CLASS_FAB].x, Millimeter2iu( DEFAULT_TEXT_SIZE ),
478  TEXTS_MIN_SIZE, TEXTS_MAX_SIZE, MM_PER_IU ) );
479 
480  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.fab_text_thickness",
482  Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), MM_PER_IU ) );
483 
484  m_params.emplace_back(
485  new PARAM<bool>( "defaults.fab_text_italic", &m_TextItalic[LAYER_CLASS_FAB], false ) );
486 
487  m_params.emplace_back(
488  new PARAM<bool>( "defaults.fab_text_upright", &m_TextUpright[LAYER_CLASS_FAB], true ) );
489 
490  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.other_line_width",
492  Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), MM_PER_IU ) );
493 
494  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.other_text_size_v",
496  TEXTS_MAX_SIZE, MM_PER_IU ) );
497 
498  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.other_text_size_h",
500  TEXTS_MAX_SIZE, MM_PER_IU ) );
501 
502  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.other_text_thickness",
504  Millimeter2iu( 0.01 ), Millimeter2iu( 5.0 ), MM_PER_IU ) );
505 
506  m_params.emplace_back( new PARAM<bool>(
507  "defaults.other_text_italic", &m_TextItalic[LAYER_CLASS_OTHERS], false ) );
508 
509  m_params.emplace_back( new PARAM<bool>(
510  "defaults.other_text_upright", &m_TextUpright[LAYER_CLASS_OTHERS], true ) );
511 
512  m_params.emplace_back(
513  new PARAM<int>( "defaults.dimension_units", &m_DimensionUnits, 0, 0, 2 ) );
514 
515  m_params.emplace_back(
516  new PARAM<int>( "defaults.dimension_precision", &m_DimensionPrecision, 1, 0, 2 ) );
517 
518  m_params.emplace_back( new PARAM<bool>(
519  "defaults.zones.45_degree_only", &m_defaultZoneSettings.m_Zone_45_Only, false ) );
520 
521  m_params.emplace_back( new PARAM_SCALED<int>( "defaults.zones.min_clearance",
523  Millimeter2iu( 0.0 ), Millimeter2iu( 25.0 ), MM_PER_IU ) );
524 
525  m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "defaults.pads",
526  [&]() -> nlohmann::json
527  {
528  nlohmann::json ret =
529  {
530  { "width", Iu2Millimeter( m_Pad_Master.GetSize().x ) },
531  { "height", Iu2Millimeter( m_Pad_Master.GetSize().y ) },
532  { "drill", Iu2Millimeter( m_Pad_Master.GetDrillSize().x ) }
533  };
534 
535  return ret;
536  },
537  [&]( const nlohmann::json& aJson )
538  {
539  if( aJson.contains( "width" ) && aJson.contains( "height" )
540  && aJson.contains( "drill" ) )
541  {
542  wxSize sz;
543  sz.SetWidth( Millimeter2iu( aJson["width"].get<double>() ) );
544  sz.SetHeight( Millimeter2iu( aJson["height"].get<double>() ) );
545 
546  m_Pad_Master.SetSize( sz );
547 
548  int drill = Millimeter2iu( aJson["drill"].get<double>() );
549 
550  m_Pad_Master.SetDrillSize( wxSize( drill, drill ) );
551  }
552  }, {} ) );
553 
554  m_params.emplace_back( new PARAM_SCALED<int>( "rules.max_error", &m_MaxError, ARC_HIGH_DEF,
555  Millimeter2iu( 0.0001 ), Millimeter2iu( 1.0 ), MM_PER_IU ) );
556 
557  m_params.emplace_back(
558  new PARAM<bool>( "zones_use_no_outline", &m_ZoneUseNoOutlineInFill, false ) );
559 }
#define DEFAULT_EDGE_WIDTH
#define DEFAULT_SILK_TEXT_WIDTH
int m_SolderMaskMargin
Solder mask margin.
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
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:227
int m_SolderPasteMargin
Solder paste margin absolute value.
#define DEFAULT_VIASMINSIZE
#define TEXTS_MAX_WIDTH
Maximum text width in internal units (10 inches)
Definition: pcbnew.h:40
std::vector< int > m_TrackWidthList
std::vector< DIFF_PAIR_DIMENSION > m_DiffPairDimensionsList
footprint not found for netlist item
Definition: drc.h:69
std::map< int, int > m_DRCSeverities
RC_ITEM is a holder for a DRC (in Pcbnew) or ERC (in Eeschema) error item.
Definition: rc_item.h:77
NETCLASSES m_internalNetClasses
Net classes that are loaded from the board file before these were stored in the project.
more than one footprints found for netlist item
Definition: drc.h:70
#define LEGACY_COPPEREDGECLEARANCE
#define DEFAULT_BOARD_THICKNESS_MM
ZONE_SETTINGS m_defaultZoneSettings
The defualt settings that will be used for new zones.
#define DEFAULT_LINE_WIDTH
#define DEFAULT_COPPER_LINE_WIDTH
#define DEFAULT_HOLETOHOLEMIN
void SetDrillSize(const wxSize &aSize)
Definition: class_pad.h:225
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
#define DEFAULT_CUSTOMDPAIRVIAGAP
#define DEFAULT_SOLDERPASTE_CLEARANCE
#define DEFAULT_TEXT_WIDTH
netlist item not found for footprint
Definition: drc.h:71
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
Definition: drc.h:75
track with at least one end not connected to anything
Definition: drc.h:50
bool m_TextItalic[LAYER_CLASS_COUNT]
Represents a parameter that has a scaling factor between the value in the file and the value used int...
Definition: parameters.h:319
void SetSize(const wxSize &aSize)
Definition: class_pad.h:219
#define ZONE_CLEARANCE_MIL
Definition: zones.h:33
int m_ZoneClearance
Minimal clearance value.
Definition: zone_settings.h:83
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:39
#define DEFAULT_MICROVIASMINSIZE
#define DEFAULT_MICROVIASMINDRILL
#define DEFAULT_SOLDERMASK_MIN_WIDTH
int m_LineThickness[LAYER_CLASS_COUNT]
#define TEXTS_MIN_SIZE
Minimum text size in internal units (1 mil)
Definition: pcbnew.h:38
#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:119
const char * name
Definition: DXF_plotter.cpp:60
bool m_ZoneUseNoOutlineInFill
Option to handle filled polygons in zones: the "legacy" option is using thick outlines around filled ...
SEVERITY SeverityFromString(const wxString &aSeverity)
Definition: ui_common.cpp:108
footprint has no courtyard defined
Definition: drc.h:62
static std::vector< std::reference_wrapper< RC_ITEM > > GetItemsWithSeverities()
Definition: drc_item.h:49
const wxSize & GetDrillSize() const
Definition: class_pad.h:226
NESTED_SETTINGS(const std::string &aName, int aSchemaVersion, JSON_SETTINGS *aParent, const std::string &aPath)
D_PAD m_Pad_Master
A dummy pad to store all default parameters.
#define DEFAULT_COPPER_TEXT_WIDTH
std::vector< VIA_DIMENSION > m_ViasDimensionsList
#define DEFAULT_CUSTOMTRACKWIDTH
#define DEFAULT_TEXT_SIZE
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
via which isn't connected to anything
Definition: drc.h:49
Definition: drc.h:41
bool m_HasStackup
Set to true if the board has a stackup management.
double m_SolderPasteMarginRatio
Solder pask margin ratio value of pad size The final margin is the sum of these 2 values.
const wxSize & GetSize() const
Definition: class_pad.h:220
std::set< wxString > m_DrcExclusions
Excluded DRC items.
LSET m_enabledLayers
Bit-mask for layer enabling.
int m_boardThickness
Board thickness for 3D viewer.
bool m_TextUpright[LAYER_CLASS_COUNT]
int m_SolderMaskMinWidth
Solder mask min width.

References 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_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_NPTH_IN_COURTYARD, DRCE_PTH_IN_COURTYARD, F_Fab, F_SilkS, D_PAD::GetDrillSize(), DRC_ITEM::GetItemsWithSeverities(), D_PAD::GetSize(), 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_DimensionPrecision, m_DimensionUnits, 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_ZoneUseNoOutlineInFill, name, 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 562 of file board_design_settings.cpp.

563 {
564  if( m_parent )
565  {
567  m_parent = nullptr;
568  }
569 }
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().

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 499 of file json_settings.cpp.

500 {
501  wxLogTrace( traceSettings, "AddNestedSettings %s", aSettings->GetFilename() );
502  m_nested_settings.push_back( aSettings );
503 }
std::vector< NESTED_SETTINGS * > m_nested_settings
Nested settings files that live inside this one, if any.
std::string GetFilename() const
Definition: json_settings.h:56
const char * traceSettings
Flag to enable settings tracing.

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 411 of file json_settings.cpp.

413 {
414  ValueType val;
415 
416  if( aConfig->Read( aKey, &val ) )
417  {
418  try
419  {
420  ( *this )[PointerFromString( aDest )] = val;
421  }
422  catch( ... )
423  {
424  wxASSERT_MSG( false, wxT( "Could not write value in fromLegacy!" ) );
425  return false;
426  }
427 
428  return true;
429  }
430 
431  return false;
432 }
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 471 of file json_settings.cpp.

473 {
474  wxString str;
475 
476  if( aConfig->Read( aKey, &str ) )
477  {
479  color.SetFromWxString( str );
480 
481  try
482  {
483  nlohmann::json js = nlohmann::json::array( { color.r, color.g, color.b, color.a } );
484  ( *this )[PointerFromString( aDest )] = js;
485  }
486  catch( ... )
487  {
488  wxASSERT_MSG( false, wxT( "Could not write value in fromLegacyColor!" ) );
489  return false;
490  }
491 
492  return true;
493  }
494 
495  return false;
496 }
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 447 of file json_settings.cpp.

449 {
450  wxString str;
451 
452  if( aConfig->Read( aKey, &str ) )
453  {
454  try
455  {
456  ( *this )[PointerFromString( aDest )] = str.ToUTF8();
457  }
458  catch( ... )
459  {
460  wxASSERT_MSG( false, wxT( "Could not write value in fromLegacyString!" ) );
461  return false;
462  }
463 
464  return true;
465  }
466 
467  return false;
468 }
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 111 of file json_settings.h.

112  {
113  if( OPT<nlohmann::json> ret = GetJson( aPath ) )
114  {
115  try
116  {
117  return ret->get<ValueType>();
118  }
119  catch( ... )
120  {
121  }
122  }
123 
124  return NULLOPT;
125  }
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_LAMBDA< ValueType >::Load(), PARAM_SCALED< ValueType >::Load(), LoadFromFile(), PARAM< wxString >::MatchesFile(), COLOR_MAP_PARAM::MatchesFile(), PARAM_PATH::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 529 of file json_settings.cpp.

530 {
531  if( OPT<nlohmann::json> opt_json = GetJson( aPath ) )
532  return wxString( opt_json->get<std::string>().c_str(), wxConvUTF8 );
533 
534  return NULLOPT;
535 }
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 780 of file board_design_settings.cpp.

781 {
782  int clearance = GetDefault()->GetClearance();
783 
784  for( const std::pair<const wxString, NETCLASSPTR>& netclass : GetNetClasses().NetClasses() )
785  clearance = std::max( clearance, netclass.second->GetClearance() );
786 
787  for( const DRC_RULE* rule : m_DRCRules )
788  clearance = std::max( clearance, rule->m_Clearance.Min );
789 
790  return clearance;
791 }
int GetClearance(wxString *aSource=nullptr) const
Definition: netclass.h:162
NETCLASSES & GetNetClasses() const
NETCLASS * GetDefault() const
Function GetDefault.
std::vector< DRC_RULE * > m_DRCRules

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

Referenced by ZONE_FILLER::buildCopperItemClearances(), ZONE_FILLER::buildThermalSpokes(), MODULE::GetBoundingPoly(), DRC::RunTests(), 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 793 of file board_design_settings.h.

794  {
795  return m_copperLayerCount;
796  }
int m_copperLayerCount
Number of copper layers for this design.

References m_copperLayerCount.

Referenced by BOARD_STACKUP::BuildDefaultStackupList(), PANEL_SETUP_BOARD_STACKUP::buildLayerStackPanel(), DRC::doTrackDrc(), 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 726 of file board_design_settings.h.

727  {
728  if( m_useCustomDiffPair )
729  return m_customDiffPair.m_Gap;
730  else
732  }
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 740 of file board_design_settings.h.

741  {
742  if( m_useCustomDiffPair )
743  return m_customDiffPair.m_ViaGap;
744  else
745  return m_DiffPairDimensionsList[m_diffPairIndex].m_ViaGap;
746  }
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 712 of file board_design_settings.h.

713  {
714  if( m_useCustomDiffPair )
715  return m_customDiffPair.m_Width;
716  else
718  }
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 813 of file board_design_settings.cpp.

814 {
815  NETCLASSPTR netclass = GetNetClasses().Find( m_currentNetClassName );
816 
817  return netclass->GetuViaDrill();
818 }
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:142
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 805 of file board_design_settings.cpp.

806 {
807  NETCLASSPTR netclass = GetNetClasses().Find( m_currentNetClassName );
808 
809  return netclass->GetuViaDiameter();
810 }
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:142
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 399 of file board_design_settings.h.

400  {
401  return m_currentNetClassName;
402  }
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 487 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 828 of file board_design_settings.cpp.

829 {
830  int drill;
831 
832  if( m_useCustomTrackVia )
833  drill = m_customViaSize.m_Drill;
834  else
835  drill = m_ViasDimensionsList[m_viaSizeIndex].m_Drill;
836 
837  return drill > 0 ? drill : -1;
838 }
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 536 of file board_design_settings.h.

537  {
538  if( m_useCustomTrackVia )
540  else
541  return m_ViasDimensionsList[m_viaSizeIndex].m_Diameter;
542  }
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 662 of file board_design_settings.h.

663  {
664  return m_customDiffPair.m_Gap;
665  }
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 682 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 642 of file board_design_settings.h.

643  {
644  return m_customDiffPair.m_Width;
645  }
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 508 of file board_design_settings.h.

509  {
510  return m_customTrackWidth;
511  }

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 589 of file board_design_settings.h.

590  {
591  return m_customViaSize.m_Drill;
592  }

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 560 of file board_design_settings.h.

561  {
563  }

References VIA_DIMENSION::m_Diameter.

Referenced by DIALOG_TRACK_VIA_SIZE::TransferDataToWindow().

◆ GetDefault()

◆ GetDefaultZoneSettings()

ZONE_SETTINGS& BOARD_DESIGN_SETTINGS::GetDefaultZoneSettings ( )
inline

Definition at line 376 of file board_design_settings.h.

377  {
378  return m_defaultZoneSettings;
379  }
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 619 of file board_design_settings.h.

619 { 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
inline

Definition at line 813 of file board_design_settings.h.

813 { return DRC_EPSILON; }
#define DRC_EPSILON

References DRC_EPSILON.

Referenced by DRC::doPadToPadsDrc(), and DRC::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 766 of file board_design_settings.h.

767  {
768  return m_enabledLayers;
769  }
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 217 of file json_settings.h.

218  {
219  return wxT( "json" );
220  }

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

◆ GetFilename()

◆ GetFullFilename()

wxString JSON_SETTINGS::GetFullFilename ( ) const
inherited

Definition at line 69 of file json_settings.cpp.

70 {
71  return wxString( m_filename.c_str(), wxConvUTF8 ) + "." + getFileExt();
72 }
std::string m_filename
The filename (not including path) of this settings file.
virtual wxString getFileExt() const

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

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

◆ 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 356 of file json_settings.cpp.

357 {
358  nlohmann::json::json_pointer ptr = PointerFromString( aPath );
359 
360  if( this->contains( ptr ) )
361  {
362  try
363  {
364  return OPT<nlohmann::json>{ this->at( ptr ) };
365  }
366  catch( ... )
367  {
368  }
369  }
370 
371  return OPT<nlohmann::json>{};
372 }
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 893 of file board_design_settings.cpp.

894 {
895  if( aLayer == F_SilkS || aLayer == B_SilkS )
896  return LAYER_CLASS_SILK;
897  else if( IsCopperLayer( aLayer ) )
898  return LAYER_CLASS_COPPER;
899  else if( aLayer == Edge_Cuts )
900  return LAYER_CLASS_EDGES;
901  else if( aLayer == F_CrtYd || aLayer == B_CrtYd )
902  return LAYER_CLASS_COURTYARD;
903  else if( aLayer == F_Fab || aLayer == B_Fab )
904  return LAYER_CLASS_FAB;
905  else
906  return LAYER_CLASS_OTHERS;
907 }
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.

Definition at line 222 of file json_settings.h.

223  {
224  return wxEmptyString;
225  }

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 910 of file board_design_settings.cpp.

911 {
912  return m_LineThickness[ GetLayerClass( aLayer ) ];
913 }
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 60 of file json_settings.h.

60 { 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()

int BOARD_DESIGN_SETTINGS::GetSeverity ( int  aDRCErrorCode)

◆ GetSmallestClearanceValue()

int BOARD_DESIGN_SETTINGS::GetSmallestClearanceValue ( )

Function GetSmallestClearanceValue.

Returns
the smallest clearance value found in NetClasses list

Definition at line 794 of file board_design_settings.cpp.

795 {
796  int clearance = GetDefault()->GetClearance();
797 
798  for( const std::pair<const wxString, NETCLASSPTR>& netclass : GetNetClasses().NetClasses() )
799  clearance = std::min( clearance, netclass.second->GetClearance() );
800 
801  return clearance;
802 }
int GetClearance(wxString *aSource=nullptr) const
Definition: netclass.h:162
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 916 of file board_design_settings.cpp.

917 {
918  return m_TextSize[ GetLayerClass( aLayer ) ];
919 }
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 922 of file board_design_settings.cpp.

923 {
924  return m_TextThickness[ GetLayerClass( aLayer ) ];
925 }
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)

◆ 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 784 of file board_design_settings.h.

785  {
786  return m_enabledLayers[aLayerId];
787  }
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 75 of file json_settings.cpp.

76 {
77  for( auto param : m_params )
78  {
79  try
80  {
81  param->Load( this, m_resetParamsIfMissing );
82  }
83  catch( ... )
84  {
85  // Skip unreadable parameters in file:
86 #ifdef DEBUG
87  wxLogMessage( wxString::Format( "param '%s' load err", param->GetJsonPath().c_str() ) );
88 #endif
89  }
90  }
91 }
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()
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205

References Format(), JSON_SETTINGS::m_params, and JSON_SETTINGS::m_resetParamsIfMissing.

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

◆ LoadFromFile()

bool BOARD_DESIGN_SETTINGS::LoadFromFile ( const std::string &  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 625 of file board_design_settings.cpp.

626 {
627  bool ret = NESTED_SETTINGS::LoadFromFile( aDirectory );
628 
629  // A number of things won't have been translated by the PROJECT_FILE migration because of
630  // descoped objects required to decode this data. So, it will be in the legacy.pcbnew
631  // section and needs to be pulled out here
632 
633  PROJECT_FILE* project = dynamic_cast<PROJECT_FILE*>( GetParent() );
634 
635  if( !project )
636  return ret;
637 
638  bool migrated = false;
639 
640  auto drcName =
641  []( int aCode ) -> std::string
642  {
643  DRC_ITEM* item = DRC_ITEM::Create( aCode );
644  wxString name = item->GetSettingsKey();
645  delete item;
646  return std::string( name.ToUTF8() );
647  };
648 
649  std::string bp = "board.design_settings.rule_severities.";
650  std::string rs = "rule_severities.";
651 
652  if( OPT<bool> v =
653  project->Get<bool>( PointerFromString( bp + "legacy_no_courtyard_defined" ) ) )
654  {
655  if( *v )
656  ( *this )[PointerFromString( rs + drcName( DRCE_MISSING_COURTYARD ) )] = "error";
657  else
658  ( *this )[PointerFromString( rs + drcName( DRCE_MISSING_COURTYARD ) )] = "ignore";
659 
660  project->erase( PointerFromString( bp + "legacy_no_courtyard_defined" ) );
661  migrated = true;
662  }
663 
664  if( OPT<bool> v = project->Get<bool>( PointerFromString( bp + "legacy_courtyards_overlap" ) ) )
665  {
666  if( *v )
667  ( *this )[PointerFromString( rs + drcName( DRCE_OVERLAPPING_FOOTPRINTS ) )] = "error";
668  else
669  ( *this )[PointerFromString( rs + drcName( DRCE_OVERLAPPING_FOOTPRINTS ) )] = "ignore";
670 
671  project->erase( PointerFromString( bp + "legacy_courtyards_overlap" ) );
672  migrated = true;
673  }
674 
675  if( project->contains( "legacy" ) )
676  project->at( "legacy" ).erase( "pcbnew" );
677 
678  // Now that we have everything, we need to load again
679  if( migrated )
680  Load();
681 
682  return ret;
683 }
JSON_SETTINGS * GetParent()
PROJECT_FILE is the backing store for a PROJECT, in JSON format.
Definition: project_file.h:61
OPT< ValueType > Get(const std::string &aPath) const
Fetches a value from within the JSON document.
bool LoadFromFile(const std::string &aDirectory="") override
Loads the JSON document from the parent and then calls Load()
static DRC_ITEM * Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
Definition: drc_item.cpp:197
const char * name
Definition: DXF_plotter.cpp:60
footprint has no courtyard defined
Definition: drc.h:62
footprint courtyards overlap
Definition: drc.h:61
boost::optional< T > OPT
Definition: optional.h:7
wxString GetSettingsKey() const
Definition: rc_item.h:174
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(), RC_ITEM::GetSettingsKey(), JSON_SETTINGS::Load(), NESTED_SETTINGS::LoadFromFile(), name, and JSON_SETTINGS::PointerFromString().

◆ Migrate()

bool JSON_SETTINGS::Migrate ( )
virtualinherited

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 in COMMON_SETTINGS, COLOR_SETTINGS, and FOOTPRINT_EDITOR_SETTINGS.

Definition at line 375 of file json_settings.cpp.

376 {
377  wxLogTrace( traceSettings, "Migrate() not implemented for %s", typeid( *this ).name() );
378  return false;
379 }
const char * traceSettings
Flag to enable settings tracing.

References traceSettings.

Referenced by JSON_SETTINGS::LoadFromFile().

◆ 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, LIBEDIT_SETTINGS, PROJECT_LOCAL_SETTINGS, GERBVIEW_SETTINGS, FOOTPRINT_EDITOR_SETTINGS, CVPCB_SETTINGS, BITMAP2CMP_SETTINGS, PL_EDITOR_SETTINGS, and KICAD_SETTINGS.

Definition at line 382 of file json_settings.cpp.

383 {
384  wxLogTrace( traceSettings,
385  "MigrateFromLegacy() not implemented for %s", typeid( *this ).name() );
386  return false;
387 }
const char * traceSettings
Flag to enable settings tracing.

References traceSettings.

Referenced by JSON_SETTINGS::LoadFromFile().

◆ operator=()

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

Definition at line 572 of file board_design_settings.cpp.

573 {
574  // Copy of NESTED_SETTINGS around is not allowed, so let's just update the params.
579  m_DRCRules = aOther.m_DRCRules;
587  m_ViasMinSize = aOther.m_ViasMinSize;
596  m_MaxError = aOther.m_MaxError;
603  m_AuxOrigin = aOther.m_AuxOrigin;
604  m_GridOrigin = aOther.m_GridOrigin;
605 
606  std::copy( std::begin( aOther.m_LineThickness ), std::end( aOther.m_LineThickness ),
607  std::begin( m_LineThickness ) );
608 
609  std::copy( std::begin( aOther.m_TextSize ), std::end( aOther.m_TextSize ),
610  std::begin( m_TextSize ) );
611 
612  std::copy( std::begin( aOther.m_TextThickness ), std::end( aOther.m_TextThickness ),
613  std::begin( m_TextThickness ) );
614 
615  std::copy( std::begin( aOther.m_TextItalic ), std::end( aOther.m_TextItalic ),
616  std::begin( m_TextItalic ) );
617 
618  std::copy( std::begin( aOther.m_TextUpright ), std::end( aOther.m_TextUpright ),
619  std::begin( m_TextUpright ) );
620 
621  return *this;
622 }
int m_SolderMaskMargin
Solder mask margin.
std::vector< TEXT_ITEM_INFO > m_DefaultFPTextItems
wxPoint m_GridOrigin
origin for grid offsets
std::vector< int > m_TrackWidthList
std::vector< DIFF_PAIR_DIMENSION > m_DiffPairDimensionsList
std::map< int, int > m_DRCSeverities
std::vector< DRC_SELECTOR * > m_DRCRuleSelectors
VIATYPE m_CurrentViaType
(VIA_BLIND_BURIED, VIA_THROUGH, VIA_MICROVIA)
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]
bool m_ZoneUseNoOutlineInFill
Option to handle filled polygons in zones: the "legacy" option is using thick outlines around filled ...
std::vector< VIA_DIMENSION > m_ViasDimensionsList
bool m_MicroViasAllowed
true to allow micro vias
double m_SolderPasteMarginRatio
Solder pask margin ratio value of pad size The final margin is the sum of these 2 values.
std::set< wxString > m_DrcExclusions
Excluded DRC items.
std::vector< DRC_RULE * > m_DRCRules
wxPoint m_AuxOrigin
origin for plot exports
bool m_TextUpright[LAYER_CLASS_COUNT]
int m_SolderMaskMinWidth
Solder mask min width.

References m_AuxOrigin, m_BlindBuriedViaAllowed, m_CopperEdgeClearance, m_CurrentViaType, m_DefaultFPTextItems, m_DiffPairDimensionsList, m_DimensionPrecision, m_DimensionUnits, m_DrcExclusions, m_DRCRules, m_DRCRuleSelectors, m_DRCSeverities, m_GridOrigin, m_HoleToHoleMin, m_LineThickness, m_MaxError, m_MicroViasAllowed, m_MicroViasMinDrill, m_MicroViasMinSize, m_MinClearance, m_MinThroughDrill, m_SolderMaskMargin, m_SolderMaskMinWidth, m_SolderPasteMarginRatio, m_TextItalic, m_TextSize, m_TextThickness, m_TextUpright, m_TrackMinWidth, m_TrackWidthList, m_UseConnectedTrackWidth, m_ViasDimensionsList, m_ViasMinAnnulus, m_ViasMinSize, and m_ZoneUseNoOutlineInFill.

◆ 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 390 of file json_settings.cpp.

391 {
392  std::replace( aPath.begin(), aPath.end(), '.', '/' );
393  aPath.insert( 0, "/" );
394 
395  nlohmann::json::json_pointer p;
396 
397  try
398  {
399  p = nlohmann::json::json_pointer( aPath );
400  }
401  catch( ... )
402  {
403  wxASSERT_MSG( false, wxT( "Invalid pointer path in PointerFromString!" ) );
404  }
405 
406  return p;
407 }

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(), COLOR_SETTINGS::Migrate(), COMMON_SETTINGS::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(), and JSON_SETTINGS::Set().

◆ 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 506 of file json_settings.cpp.

507 {
508  if( !aSettings )
509  return;
510 
511  auto it = std::find_if( m_nested_settings.begin(), m_nested_settings.end(),
512  [&aSettings]( const JSON_SETTINGS* aPtr ) {
513  return aPtr == aSettings;
514  } );
515 
516  if( it != m_nested_settings.end() )
517  {
518  wxLogTrace( traceSettings, "Flush and release %s", ( *it )->GetFilename() );
519  ( *it )->SaveToFile();
520  m_nested_settings.erase( it );
521  }
522 
523  aSettings->SetParent( nullptr );
524 }
std::vector< NESTED_SETTINGS * > m_nested_settings
Nested settings files that live inside this one, if any.
const char * traceSettings
Flag to enable settings tracing.
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 272 of file json_settings.cpp.

273 {
274  for( auto param : m_params )
275  param->SetDefault();
276 }
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().

◆ SaveToFile()

bool NESTED_SETTINGS::SaveToFile ( const std::string &  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 78 of file nested_settings.cpp.

79 {
80  if( !m_parent )
81  return false;
82 
83  bool modified = Store();
84 
85  try
86  {
87  nlohmann::json patch =
88  nlohmann::json::diff( *this, ( *m_parent )[PointerFromString( m_path )] );
89  modified |= !patch.empty();
90  }
91  catch( ... )
92  {
93  modified = true;
94  }
95 
96  if( !modified && !aForce )
97  return false;
98 
99  try
100  {
101  ( *m_parent )[PointerFromString( m_path ) ].update( *this );
102 
103  wxLogTrace( traceSettings, "Stored NESTED_SETTINGS %s with schema %d",
105  }
106  catch( ... )
107  {
108  wxLogTrace( traceSettings, "NESTED_SETTINGS %s: Could not store to %s at %s",
110  }
111 
112  return modified;
113 }
virtual bool Store()
Stores the current parameters into the JSON document represented by this object Note: this doesn't do...
std::string m_filename
The filename (not including path) of this settings file.
nlohmann::json json
Definition: gerbview.cpp:40
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.
std::string GetFilename() const
Definition: json_settings.h:56
const char * traceSettings
Flag to enable settings tracing.
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 135 of file json_settings.h.

136  {
137  ( *this )[PointerFromString( aPath ) ] = aVal;
138  }
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_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 538 of file json_settings.cpp.

539 {
540  ( *this )[PointerFromString( std::move( aPath ) ) ] = aVal.ToUTF8();
541 }
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 806 of file board_design_settings.h.

806 { 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 861 of file board_design_settings.cpp.

862 {
863  m_CopperEdgeClearance = aDistance;
864 }

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 867 of file board_design_settings.cpp.

868 {
869  m_copperLayerCount = aNewLayerCount;
870 
871  // Update only enabled copper layers mask
872  m_enabledLayers &= ~LSET::AllCuMask();
873 
874  if( aNewLayerCount > 0 )
875  m_enabledLayers |= LSET::AllCuMask( aNewLayerCount );
876 }
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:712
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 698 of file board_design_settings.cpp.

699 {
700  NETCLASSPTR netClass = GetNetClasses().Find( aNetClassName );
701  bool lists_sizes_modified = false;
702 
703  // if not found (should not happen) use the default
704  if( !netClass )
705  netClass = GetNetClasses().GetDefault();
706 
707  m_currentNetClassName = netClass->GetName();
708 
709  // Initialize others values:
710  if( m_TrackWidthList.size() == 0 )
711  {
712  lists_sizes_modified = true;
713  m_TrackWidthList.push_back( 0 );
714  }
715 
716  if( m_ViasDimensionsList.size() == 0 )
717  {
718  lists_sizes_modified = true;
719  m_ViasDimensionsList.emplace_back( VIA_DIMENSION() );
720  }
721 
722  if( m_DiffPairDimensionsList.size() == 0 )
723  {
724  lists_sizes_modified = true;
726  }
727 
728  /* note the m_ViasDimensionsList[0] and m_TrackWidthList[0] values
729  * are always the Netclass values
730  */
731  if( m_TrackWidthList[0] != netClass->GetTrackWidth() )
732  {
733  lists_sizes_modified = true;
734  m_TrackWidthList[0] = netClass->GetTrackWidth();
735  }
736 
737  if( m_ViasDimensionsList[0].m_Diameter != netClass->GetViaDiameter() )
738  {
739  lists_sizes_modified = true;
740  m_ViasDimensionsList[0].m_Diameter = netClass->GetViaDiameter();
741  }
742 
743  if( m_ViasDimensionsList[0].m_Drill != netClass->GetViaDrill() )
744  {
745  lists_sizes_modified = true;
746  m_ViasDimensionsList[0].m_Drill = netClass->GetViaDrill();
747  }
748 
749  if( m_DiffPairDimensionsList[0].m_Width != netClass->GetDiffPairWidth() )
750  {
751  lists_sizes_modified = true;
752  m_DiffPairDimensionsList[0].m_Width = netClass->GetDiffPairWidth();
753  }
754 
755  if( m_DiffPairDimensionsList[0].m_Gap != netClass->GetDiffPairGap() )
756  {
757  lists_sizes_modified = true;
758  m_DiffPairDimensionsList[0].m_Gap = netClass->GetDiffPairGap();
759  }
760 
761  if( m_DiffPairDimensionsList[0].m_ViaGap != netClass->GetDiffPairViaGap() )
762  {
763  lists_sizes_modified = true;
764  m_DiffPairDimensionsList[0].m_ViaGap = netClass->GetDiffPairViaGap();
765  }
766 
767  if( GetViaSizeIndex() >= m_ViasDimensionsList.size() )
769 
770  if( GetTrackWidthIndex() >= m_TrackWidthList.size() )
772 
775 
776  return lists_sizes_modified;
777 }
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:142
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:265
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 PANEL_SETUP_NETCLASSES::TransferDataFromWindow().

◆ 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 653 of file board_design_settings.h.

654  {
655  m_customDiffPair.m_Gap = aGap;
656  }
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 673 of file board_design_settings.h.

674  {
675  m_customDiffPair.m_ViaGap = aGap;
676  }
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 633 of file board_design_settings.h.

634  {
635  m_customDiffPair.m_Width = aWidth;
636  }
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 499 of file board_design_settings.h.

500  {
501  m_customTrackWidth = aWidth;
502  }

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 580 of file board_design_settings.h.

581  {
582  m_customViaSize.m_Drill = aDrill;
583  }

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 551 of file board_design_settings.h.

552  {
553  m_customViaSize.m_Diameter = aSize;
554  }

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 381 of file board_design_settings.h.

382  {
383  m_defaultZoneSettings = aSettings;
384  }
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 848 of file board_design_settings.cpp.

849 {
850  m_diffPairIndex = std::min( aIndex, (unsigned) 8 );
851  m_useCustomDiffPair = false;
852 }

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 879 of file board_design_settings.cpp.

880 {
881  // Back and front layers are always enabled.
882  aMask.set( B_Cu ).set( F_Cu );
883 
884  m_enabledLayers = aMask;
885 
886  // update m_CopperLayerCount to ensure its consistency with m_EnabledLayers
887  m_copperLayerCount = ( aMask & LSET::AllCuMask() ).count();
888 }
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:712
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 BOARD::SetEnabledLayers().

◆ SetLegacyFilename()

void JSON_SETTINGS::SetLegacyFilename ( const std::string &  aFilename)
inlineinherited

Definition at line 62 of file json_settings.h.

62 { m_legacy_filename = aFilename; }
std::string 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 175 of file json_settings.h.

176  {
177  m_manager = aManager;
178  }
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 855 of file board_design_settings.cpp.

856 {
857  m_HoleToHoleMin = aDistance;
858 }

References m_HoleToHoleMin.

Referenced by PANEL_SETUP_FEATURE_CONSTRAINTS::TransferDataFromWindow().

◆ SetNetClasses()

void BOARD_DESIGN_SETTINGS::SetNetClasses ( NETCLASSES aNetClasses)
inline

Definition at line 368 of file board_design_settings.h.

369  {
370  if( aNetClasses )
371  m_netClasses = aNetClasses;
372  else
374  }
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 116 of file nested_settings.cpp.

117 {
118  m_parent = aParent;
119 
120  if( m_parent )
121  {
122  m_parent->AddNestedSettings( this );
123 
124  // In case we were created after the parent's ctor
125  LoadFromFile();
126  }
127 }
void AddNestedSettings(NESTED_SETTINGS *aSettings)
Transfers ownership of a given NESTED_SETTINGS to this object.
bool LoadFromFile(const std::string &aDirectory="") override
Loads the JSON document from the parent and then calls Load()
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 841 of file board_design_settings.cpp.

842 {
843  m_trackWidthIndex = std::min( aIndex, (unsigned) m_TrackWidthList.size() );
844  m_useCustomTrackVia = false;
845 }
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 821 of file board_design_settings.cpp.

822 {
823  m_viaSizeIndex = std::min( aIndex, (unsigned) m_ViasDimensionsList.size() );
824  m_useCustomTrackVia = false;
825 }
std::vector< VIA_DIMENSION > m_ViasDimensionsList

References m_useCustomTrackVia, m_ViasDimensionsList, and m_viaSizeIndex.

Referenced by 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().

◆ severityFromString()

SEVERITY BOARD_DESIGN_SETTINGS::severityFromString ( const wxString &  aSeverity)
private

◆ severityToString()

wxString BOARD_DESIGN_SETTINGS::severityToString ( const SEVERITY aSeverity)
private

◆ 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 258 of file json_settings.cpp.

259 {
260  bool modified = false;
261 
262  for( auto param : m_params )
263  {
264  modified |= !param->MatchesFile( this );
265  param->Store( this );
266  }
267 
268  return modified;
269 }
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(), PANEL_PCBNEW_COLOR_SETTINGS::PANEL_PCBNEW_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 692 of file board_design_settings.h.

693  {
694  m_useCustomDiffPair = aEnabled;
695  }

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 701 of file board_design_settings.h.

702  {
703  return m_useCustomDiffPair;
704  }

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 601 of file board_design_settings.h.

602  {
603  m_useCustomTrackVia = aEnabled;
604  }

Referenced by BOARD::BOARD(), ROUTER_TOOL::CustomTrackWidthDialog(), TRACK_WIDTH_MENU::eventHandler(), BOARD::SynchronizeNetsAndNetClasses(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), 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 610 of file board_design_settings.h.

611  {
612  return m_useCustomTrackVia;
613  }

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 426 of file board_design_settings.h.

427  {
428  return ( m_diffPairIndex == 0 && !m_useCustomDiffPair );
429  }

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 408 of file board_design_settings.h.

409  {
410  return ( m_trackWidthIndex == 0 && !m_useCustomTrackVia );
411  }

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 417 of file board_design_settings.h.

418  {
419  return ( m_viaSizeIndex == 0 && !m_useCustomTrackVia );
420  }

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 320 of file board_design_settings.h.

Referenced by BOARD_DESIGN_SETTINGS(), and GetBoardThickness().

◆ m_CopperEdgeClearance

◆ m_copperLayerCount

int BOARD_DESIGN_SETTINGS::m_copperLayerCount
private

Number of copper layers for this design.

Definition at line 316 of file board_design_settings.h.

Referenced by GetCopperLayerCount(), 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 249 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 243 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 324 of file board_design_settings.h.

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

◆ m_CurrentViaType

VIATYPE BOARD_DESIGN_SETTINGS::m_CurrentViaType

(VIA_BLIND_BURIED, VIA_THROUGH, VIA_MICROVIA)

Definition at line 232 of file board_design_settings.h.

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

◆ m_customDiffPair

DIFF_PAIR_DIMENSION BOARD_DESIGN_SETTINGS::m_customDiffPair
private

Definition at line 314 of file board_design_settings.h.

Referenced by BOARD_DESIGN_SETTINGS().

◆ m_customTrackWidth

int BOARD_DESIGN_SETTINGS::m_customTrackWidth
private

◆ m_customViaSize

VIA_DIMENSION BOARD_DESIGN_SETTINGS::m_customViaSize
private

Definition at line 310 of file board_design_settings.h.

Referenced by BOARD_DESIGN_SETTINGS(), and GetCurrentViaDrill().

◆ 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 339 of file board_design_settings.h.

Referenced by BOARD_DESIGN_SETTINGS(), and GetDefaultZoneSettings().

◆ m_deleteLegacyAfterMigration

bool JSON_SETTINGS::m_deleteLegacyAfterMigration
protectedinherited

Whether or not to delete legacy file after migration.

Definition at line 255 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_DimensionPrecision

◆ m_DimensionUnits

◆ m_DrcExclusions

std::set<wxString> BOARD_DESIGN_SETTINGS::m_DrcExclusions

◆ m_DRCRules

std::vector<DRC_RULE*> BOARD_DESIGN_SETTINGS::m_DRCRules

Definition at line 225 of file board_design_settings.h.

Referenced by GetBiggestClearanceValue(), DRC::LoadRules(), and operator=().

◆ m_DRCRuleSelectors

std::vector<DRC_SELECTOR*> BOARD_DESIGN_SETTINGS::m_DRCRuleSelectors

Definition at line 224 of file board_design_settings.h.

Referenced by GetRule(), DRC::LoadRules(), and operator=().

◆ m_DRCSeverities

◆ m_enabledLayers

LSET BOARD_DESIGN_SETTINGS::m_enabledLayers
private

Bit-mask for layer enabling.

Definition at line 318 of file board_design_settings.h.

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

◆ m_filename

std::string JSON_SETTINGS::m_filename
protectedinherited

◆ m_GridOrigin

◆ m_HasStackup

bool BOARD_DESIGN_SETTINGS::m_HasStackup

Set to true if the board has a stackup management.

if m_hasStackup is false, a default basic stackup witll be used to generate the ;gbrjob file. if m_hasStackup is true, the stackup defined for the board is used. if not up to date, a error message will be set Could be removed later, or at least always set to true

Definition at line 298 of file board_design_settings.h.

Referenced by GERBER_JOBFILE_WRITER::addJSONMaterialStackup(), BOARD_DESIGN_SETTINGS(), PCB_IO::formatSetup(), and PANEL_SETUP_BOARD_STACKUP::TransferDataFromWindow().

◆ 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 333 of file board_design_settings.h.

Referenced by BOARD_DESIGN_SETTINGS(), and SetNetClasses().

◆ m_legacy_filename

std::string JSON_SETTINGS::m_legacy_filename
protectedinherited

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

Definition at line 231 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 234 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 264 of file json_settings.h.

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

◆ m_matched

std::vector<DRC_SELECTOR*> BOARD_DESIGN_SETTINGS::m_matched

Definition at line 228 of file board_design_settings.h.

◆ 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 240 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 336 of file board_design_settings.h.

Referenced by BOARD_DESIGN_SETTINGS(), and GetNetClasses().

◆ m_Pad_Master

D_PAD BOARD_DESIGN_SETTINGS::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 267 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 258 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

int BOARD_DESIGN_SETTINGS::m_SolderPasteMargin

◆ m_SolderPasteMarginRatio

double BOARD_DESIGN_SETTINGS::m_SolderPasteMarginRatio

Solder pask margin ratio value of pad size The final margin is the sum of these 2 values.

Definition at line 268 of file board_design_settings.h.

Referenced by BOARD_DESIGN_SETTINGS(), LEGACY_PLUGIN::loadSETUP(), operator=(), PCB_PARSER::parseSetup(), PANEL_SETUP_MASK_AND_PASTE::TransferDataFromWindow(), and PANEL_SETUP_MASK_AND_PASTE::TransferDataToWindow().

◆ 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 330 of file board_design_settings.h.

Referenced by GetStackupDescriptor().

◆ 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 252 of file json_settings.h.

Referenced by JSON_SETTINGS::SaveToFile().

◆ m_ZoneUseNoOutlineInFill

bool BOARD_DESIGN_SETTINGS::m_ZoneUseNoOutlineInFill

Option to handle filled polygons in zones: the "legacy" option is using thick outlines around filled polygons: give the best shape the "new" option is using only filled polygons (no outline: give the faster redraw time moreover when exporting zone filled areas, the excatct shape is exported.

the legacy option can really create redraw time issues for large boards.true for new zone filling option

Definition at line 257 of file board_design_settings.h.

Referenced by BOARD_DESIGN_SETTINGS(), ZONE_FILLER::Fill(), operator=(), PCB_PARSER::parseSetup(), PANEL_SETUP_FEATURE_CONSTRAINTS::TransferDataFromWindow(), and PANEL_SETUP_FEATURE_CONSTRAINTS::TransferDataToWindow().


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