You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

851 lines
28 KiB

14 years ago
9 months ago
14 years ago
14 years ago
14 years ago
8 months ago
14 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2009-2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
  5. * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. #ifndef BOARD_DESIGN_SETTINGS_H_
  25. #define BOARD_DESIGN_SETTINGS_H_
  26. #include <memory>
  27. #include <netclass.h>
  28. #include <project/net_settings.h>
  29. #include <board_stackup_manager/board_stackup.h>
  30. #include <drc/drc_engine.h>
  31. #include <lset.h>
  32. #include <settings/nested_settings.h>
  33. #include <widgets/ui_common.h>
  34. #include <zone_settings.h>
  35. #include <teardrop/teardrop_parameters.h>
  36. #include <router/pns_meander.h>
  37. #define DEFAULT_SILK_LINE_WIDTH 0.1
  38. #define DEFAULT_COPPER_LINE_WIDTH 0.2
  39. #define DEFAULT_EDGE_WIDTH 0.05
  40. #define DEFAULT_COURTYARD_WIDTH 0.05
  41. #define DEFAULT_LINE_WIDTH 0.10
  42. #define DEFAULT_SILK_TEXT_SIZE 1.0
  43. #define DEFAULT_COPPER_TEXT_SIZE 1.5
  44. #define DEFAULT_TEXT_SIZE 1.0
  45. #define DEFAULT_SILK_TEXT_WIDTH 0.1
  46. #define DEFAULT_COPPER_TEXT_WIDTH 0.30
  47. #define DEFAULT_TEXT_WIDTH 0.15
  48. #define DEFAULT_DIMENSION_ARROW_LENGTH 50 // mils, for legacy purposes
  49. #define DEFAULT_DIMENSION_EXTENSION_OFFSET 0.5
  50. // Board thickness, mainly for 3D view:
  51. #define DEFAULT_BOARD_THICKNESS_MM 1.6
  52. #define DEFAULT_PCB_EDGE_THICKNESS 0.15
  53. // soldermask to pad clearance. The default is 0 because usually board houses
  54. // create a clearance depending on their fab process: mask material, color, price, etc.
  55. #define DEFAULT_SOLDERMASK_EXPANSION 0.0
  56. #define DEFAULT_SOLDERMASK_TO_COPPER_CLEARANCE 0.0
  57. #define DEFAULT_SOLDERMASK_MIN_WIDTH 0.0
  58. #define DEFAULT_SOLDERPASTE_CLEARANCE 0.0
  59. #define DEFAULT_SOLDERPASTE_RATIO 0.0
  60. #define DEFAULT_CUSTOMTRACKWIDTH 0.2
  61. #define DEFAULT_CUSTOMDPAIRWIDTH 0.125
  62. #define DEFAULT_CUSTOMDPAIRGAP 0.18
  63. #define DEFAULT_CUSTOMDPAIRVIAGAP 0.18
  64. #define DEFAULT_MEANDER_SPACING 0.6
  65. #define DEFAULT_DP_MEANDER_SPACING 1.0
  66. #define DEFAULT_MINCLEARANCE 0.0 // overall min clearance
  67. #define DEFAULT_MINCONNECTION 0.0 // overall min connection width
  68. #define DEFAULT_TRACKMINWIDTH 0.0 // track width min value
  69. #define DEFAULT_VIASMINSIZE 0.5 // vias (not micro vias) min diameter
  70. #define DEFAULT_MINTHROUGHDRILL 0.3 // through holes (not micro vias) min drill diameter
  71. #define DEFAULT_MICROVIASMINSIZE 0.2 // micro vias (not vias) min diameter
  72. #define DEFAULT_MICROVIASMINDRILL 0.1 // micro vias (not vias) min drill diameter
  73. #define DEFAULT_HOLETOHOLEMIN 0.25 // minimum web thickness between two drilled holes
  74. #define DEFAULT_HOLECLEARANCE 0.25 // copper-to-hole clearance (from IPC level A)
  75. #define DEFAULT_COPPEREDGECLEARANCE 0.5 // clearance between copper items and edge cuts
  76. #define LEGACY_COPPEREDGECLEARANCE -0.01 // A flag to indicate the legacy method (based
  77. // on edge cut line thicknesses) should be used.
  78. #define DEFAULT_SILKCLEARANCE 0.0
  79. #define DEFAULT_MINGROOVEWIDTH 0.0
  80. #define DEFAULT_MINRESOLVEDSPOKES 2 // Fewer resolved spokes indicates a starved thermal
  81. #define MINIMUM_ERROR_SIZE_MM 0.001 // For arc approximation
  82. #define MAXIMUM_ERROR_SIZE_MM 0.1 // For arc approximation
  83. #define MAXIMUM_CLEARANCE pcbIUScale.mmToIU( 500 ) // to prevent int-overflows
  84. // Min/max values used in dialogs to validate settings
  85. #define MINIMUM_LINE_WIDTH_MM 0.005 // minimal line width entered in a dialog
  86. #define MAXIMUM_LINE_WIDTH_MM 100.0 // max line width entered in a dialog
  87. // Default pad properties
  88. #define DEFAULT_PAD_WIDTH_MM 2.54 // master pad width
  89. #define DEFAULT_PAD_HEIGTH_MM 1.27 // master pad height
  90. #define DEFAULT_PAD_DRILL_DIAMETER_MM 0.8 // master pad drill diameter for PTH
  91. #define DEFAULT_PAD_RR_RADIUS_RATIO 0.15 // master pad corner radius ratio
  92. /**
  93. * Container to handle a stock of specific vias each with unique diameter and drill sizes
  94. * in the #BOARD class.
  95. */
  96. struct VIA_DIMENSION
  97. {
  98. int m_Diameter; // <= 0 means use Netclass via diameter
  99. int m_Drill; // <= 0 means use Netclass via drill
  100. VIA_DIMENSION()
  101. {
  102. m_Diameter = 0;
  103. m_Drill = 0;
  104. }
  105. VIA_DIMENSION( int aDiameter, int aDrill )
  106. {
  107. m_Diameter = aDiameter;
  108. m_Drill = aDrill;
  109. }
  110. bool operator==( const VIA_DIMENSION& aOther ) const
  111. {
  112. return ( m_Diameter == aOther.m_Diameter ) && ( m_Drill == aOther.m_Drill );
  113. }
  114. bool operator!=( const VIA_DIMENSION& aOther ) const { return !operator==( aOther ); }
  115. bool operator<( const VIA_DIMENSION& aOther ) const
  116. {
  117. if( m_Diameter != aOther.m_Diameter )
  118. return m_Diameter < aOther.m_Diameter;
  119. return m_Drill < aOther.m_Drill;
  120. }
  121. };
  122. /**
  123. * Container to handle a stock of specific differential pairs each with unique track width,
  124. * gap and via gap.
  125. */
  126. struct DIFF_PAIR_DIMENSION
  127. {
  128. int m_Width; // <= 0 means use Netclass differential pair width
  129. int m_Gap; // <= 0 means use Netclass differential pair gap
  130. int m_ViaGap; // <= 0 means use Netclass differential pair via gap
  131. DIFF_PAIR_DIMENSION()
  132. {
  133. m_Width = 0;
  134. m_Gap = 0;
  135. m_ViaGap = 0;
  136. }
  137. DIFF_PAIR_DIMENSION( int aWidth, int aGap, int aViaGap )
  138. {
  139. m_Width = aWidth;
  140. m_Gap = aGap;
  141. m_ViaGap = aViaGap;
  142. }
  143. bool operator==( const DIFF_PAIR_DIMENSION& aOther ) const
  144. {
  145. return ( m_Width == aOther.m_Width )
  146. && ( m_Gap == aOther.m_Gap )
  147. && ( m_ViaGap == aOther.m_ViaGap );
  148. }
  149. bool operator!=( const DIFF_PAIR_DIMENSION& aOther ) const { return !operator==( aOther ); }
  150. bool operator<( const DIFF_PAIR_DIMENSION& aOther ) const
  151. {
  152. if( m_Width != aOther.m_Width )
  153. return m_Width < aOther.m_Width;
  154. if( m_Gap != aOther.m_Gap )
  155. return m_Gap < aOther.m_Gap;
  156. return m_ViaGap < aOther.m_ViaGap;
  157. }
  158. };
  159. enum
  160. {
  161. LAYER_CLASS_SILK = 0,
  162. LAYER_CLASS_COPPER,
  163. LAYER_CLASS_EDGES,
  164. LAYER_CLASS_COURTYARD,
  165. LAYER_CLASS_FAB,
  166. LAYER_CLASS_OTHERS,
  167. LAYER_CLASS_COUNT
  168. };
  169. struct TEXT_ITEM_INFO
  170. {
  171. wxString m_Text;
  172. bool m_Visible;
  173. PCB_LAYER_ID m_Layer;
  174. TEXT_ITEM_INFO( const wxString& aText, bool aVisible, PCB_LAYER_ID aLayer )
  175. {
  176. m_Text = aText;
  177. m_Visible = aVisible;
  178. m_Layer = aLayer;
  179. }
  180. bool operator==( const TEXT_ITEM_INFO& aOther ) const
  181. {
  182. return m_Text.IsSameAs( aOther.m_Text )
  183. && ( m_Visible == aOther.m_Visible )
  184. && ( m_Layer == aOther.m_Layer );
  185. }
  186. };
  187. // forward declaration from class_track.h
  188. enum class VIATYPE : int;
  189. // forward declarations from dimension.h
  190. enum class DIM_UNITS_FORMAT : int;
  191. enum class DIM_TEXT_POSITION : int;
  192. enum class DIM_UNITS_MODE : int;
  193. enum class DIM_PRECISION : int;
  194. class PAD;
  195. /**
  196. * Container for design settings for a #BOARD object.
  197. */
  198. class BOARD_DESIGN_SETTINGS : public NESTED_SETTINGS
  199. {
  200. public:
  201. BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath );
  202. virtual ~BOARD_DESIGN_SETTINGS();
  203. bool operator==( const BOARD_DESIGN_SETTINGS& aOther ) const;
  204. bool operator!=( const BOARD_DESIGN_SETTINGS& aOther ) const
  205. {
  206. return !operator==( aOther );
  207. }
  208. BOARD_DESIGN_SETTINGS( const BOARD_DESIGN_SETTINGS& aOther);
  209. BOARD_DESIGN_SETTINGS& operator=( const BOARD_DESIGN_SETTINGS& aOther );
  210. bool LoadFromFile( const wxString& aDirectory = "" ) override;
  211. BOARD_STACKUP& GetStackupDescriptor() { return m_stackup; }
  212. const BOARD_STACKUP& GetStackupDescriptor() const { return m_stackup; }
  213. TEARDROP_PARAMETERS_LIST* GetTeadropParamsList()
  214. {
  215. return &m_TeardropParamsList;
  216. }
  217. SEVERITY GetSeverity( int aDRCErrorCode );
  218. /**
  219. * Return true if the DRC error code's severity is SEVERITY_IGNORE.
  220. */
  221. bool Ignore( int aDRCErrorCode );
  222. ZONE_SETTINGS& GetDefaultZoneSettings()
  223. {
  224. return m_defaultZoneSettings;
  225. }
  226. void SetDefaultZoneSettings( const ZONE_SETTINGS& aSettings )
  227. {
  228. m_defaultZoneSettings = aSettings;
  229. }
  230. /**
  231. * @return the current net class name.
  232. */
  233. inline const wxString& GetCurrentNetClassName() const
  234. {
  235. return m_currentNetClassName;
  236. }
  237. /**
  238. * Return true if netclass values should be used to obtain appropriate track width.
  239. */
  240. inline bool UseNetClassTrack() const
  241. {
  242. return ( m_trackWidthIndex == 0 && !m_useCustomTrackVia );
  243. }
  244. /**
  245. * Return true if netclass values should be used to obtain appropriate via size.
  246. */
  247. inline bool UseNetClassVia() const
  248. {
  249. return ( m_viaSizeIndex == 0 && !m_useCustomTrackVia );
  250. }
  251. /**
  252. * Return true if netclass values should be used to obtain appropriate diff pair dimensions.
  253. */
  254. inline bool UseNetClassDiffPair() const
  255. {
  256. return ( m_diffPairIndex == 0 && !m_useCustomDiffPair );
  257. }
  258. /**
  259. * @return the biggest clearance value found in NetClasses list.
  260. */
  261. int GetBiggestClearanceValue() const;
  262. /**
  263. * @return the smallest clearance value found in NetClasses list.
  264. */
  265. int GetSmallestClearanceValue() const;
  266. /**
  267. * @return the current track width list index.
  268. */
  269. inline unsigned GetTrackWidthIndex() const { return m_trackWidthIndex; }
  270. /**
  271. * Set the current track width list index to \a aIndex.
  272. *
  273. * @param aIndex is the track width list index.
  274. */
  275. void SetTrackWidthIndex( unsigned aIndex );
  276. /**
  277. * @return the current track width according to the selected options
  278. * ( using the default netclass value or a preset/custom value )
  279. * the default netclass is always in m_TrackWidthList[0]
  280. */
  281. int GetCurrentTrackWidth() const;
  282. /**
  283. * Sets custom width for track (i.e. not available in netclasses or preset list).
  284. *
  285. * To have it returned with GetCurrentTrackWidth() you need to enable custom track &
  286. * via sizes with #UseCustomTrackViaSize().
  287. *
  288. * @param aWidth is the new track width.
  289. */
  290. inline void SetCustomTrackWidth( int aWidth )
  291. {
  292. m_customTrackWidth = aWidth;
  293. }
  294. /**
  295. * @return Current custom width for a track.
  296. */
  297. inline int GetCustomTrackWidth() const
  298. {
  299. return m_customTrackWidth;
  300. }
  301. /**
  302. * @return the current via size list index.
  303. */
  304. inline unsigned GetViaSizeIndex() const
  305. {
  306. return m_viaSizeIndex;
  307. }
  308. /**
  309. * Set the current via size list index to \a aIndex.
  310. *
  311. * @param aIndex is the via size list index.
  312. */
  313. void SetViaSizeIndex( unsigned aIndex );
  314. /**
  315. * @return the current via size, according to the selected options
  316. * ( using the default netclass value or a preset/custom value )
  317. * the default netclass is always in m_TrackWidthList[0]
  318. */
  319. int GetCurrentViaSize() const;
  320. /**
  321. * Set custom size for via diameter (i.e. not available in netclasses or preset list).
  322. *
  323. * To have it returned with GetCurrentViaSize() you need to enable custom track & via sizes
  324. * with #UseCustomTrackViaSize().
  325. *
  326. * @param aSize is the new drill diameter.
  327. */
  328. inline void SetCustomViaSize( int aSize )
  329. {
  330. m_customViaSize.m_Diameter = aSize;
  331. }
  332. /**
  333. * @return Current custom size for the via diameter.
  334. */
  335. inline int GetCustomViaSize() const
  336. {
  337. return m_customViaSize.m_Diameter;
  338. }
  339. /**
  340. * @return the current via size, according to the selected options
  341. * ( using the default netclass value or a preset/custom value )
  342. * the default netclass is always in m_TrackWidthList[0].
  343. */
  344. int GetCurrentViaDrill() const;
  345. /**
  346. * Sets custom size for via drill (i.e. not available in netclasses or preset list).
  347. *
  348. * To have it returned with GetCurrentViaDrill() you need to enable custom track & via
  349. * sizes with #UseCustomTrackViaSize().
  350. *
  351. * @param aDrill is the new drill size.
  352. */
  353. inline void SetCustomViaDrill( int aDrill )
  354. {
  355. m_customViaSize.m_Drill = aDrill;
  356. }
  357. /**
  358. * @return Current custom size for the via drill.
  359. */
  360. inline int GetCustomViaDrill() const
  361. {
  362. return m_customViaSize.m_Drill;
  363. }
  364. /**
  365. * Enables/disables custom track/via size settings.
  366. *
  367. * If enabled, values set with #SetCustomTrackWidth(), #SetCustomViaSize(),
  368. * and #SetCustomViaDrill() are used for newly created tracks and vias.
  369. *
  370. * @param aEnabled decides if custom settings should be used for new tracks/vias.
  371. */
  372. inline void UseCustomTrackViaSize( bool aEnabled )
  373. {
  374. m_useCustomTrackVia = aEnabled;
  375. }
  376. /**
  377. * @return True if custom sizes of tracks & vias are enabled, false otherwise.
  378. */
  379. inline bool UseCustomTrackViaSize() const
  380. {
  381. return m_useCustomTrackVia;
  382. }
  383. /**
  384. * @return the current diff pair dimension list index.
  385. */
  386. inline unsigned GetDiffPairIndex() const { return m_diffPairIndex; }
  387. /**
  388. * @param aIndex is the diff pair dimensions list index to set.
  389. */
  390. void SetDiffPairIndex( unsigned aIndex );
  391. /**
  392. * Sets custom track width for differential pairs (i.e. not available in netclasses or
  393. * preset list).
  394. *
  395. * @param aDrill is the new track width.
  396. */
  397. inline void SetCustomDiffPairWidth( int aWidth )
  398. {
  399. m_customDiffPair.m_Width = aWidth;
  400. }
  401. /**
  402. * @return Current custom track width for differential pairs.
  403. */
  404. inline int GetCustomDiffPairWidth()
  405. {
  406. return m_customDiffPair.m_Width;
  407. }
  408. /**
  409. * Sets custom gap for differential pairs (i.e. not available in netclasses or preset
  410. * list).
  411. * @param aGap is the new gap.
  412. */
  413. inline void SetCustomDiffPairGap( int aGap )
  414. {
  415. m_customDiffPair.m_Gap = aGap;
  416. }
  417. /**
  418. * Function GetCustomDiffPairGap
  419. * @return Current custom gap width for differential pairs.
  420. */
  421. inline int GetCustomDiffPairGap()
  422. {
  423. return m_customDiffPair.m_Gap;
  424. }
  425. /**
  426. * Sets custom via gap for differential pairs (i.e. not available in netclasses or
  427. * preset list).
  428. *
  429. * @param aGap is the new gap. Specify 0 to use the DiffPairGap for vias as well.
  430. */
  431. inline void SetCustomDiffPairViaGap( int aGap )
  432. {
  433. m_customDiffPair.m_ViaGap = aGap;
  434. }
  435. /**
  436. * @return Current custom via gap width for differential pairs.
  437. */
  438. inline int GetCustomDiffPairViaGap()
  439. {
  440. return m_customDiffPair.m_ViaGap > 0 ? m_customDiffPair.m_ViaGap : m_customDiffPair.m_Gap;
  441. }
  442. /**
  443. * Enables/disables custom differential pair dimensions.
  444. *
  445. * @param aEnabled decides if custom settings should be used for new differential pairs.
  446. */
  447. inline void UseCustomDiffPairDimensions( bool aEnabled )
  448. {
  449. m_useCustomDiffPair = aEnabled;
  450. }
  451. /**
  452. * @return True if custom sizes of diff pairs are enabled, false otherwise.
  453. */
  454. inline bool UseCustomDiffPairDimensions() const
  455. {
  456. return m_useCustomDiffPair;
  457. }
  458. /**
  459. * @return the current diff pair track width, according to the selected options
  460. * ( using the default netclass value or a preset/custom value )
  461. */
  462. int GetCurrentDiffPairWidth() const;
  463. /**
  464. * @return the current diff pair gap, according to the selected options
  465. * ( using the default netclass value or a preset/custom value )
  466. */
  467. int GetCurrentDiffPairGap() const;
  468. /**
  469. * @return the current diff pair via gap, according to the selected options
  470. * ( using the default netclass value or a preset/custom value )
  471. * the default netclass is always in m_DiffPairDimensionsList[0].
  472. */
  473. int GetCurrentDiffPairViaGap() const;
  474. /**
  475. * Return a bit-mask of all the layers that are enabled.
  476. *
  477. * @return the enabled layers in bit-mapped form.
  478. */
  479. inline const LSET& GetEnabledLayers() const
  480. {
  481. return m_enabledLayers;
  482. }
  483. /**
  484. * Change the bit-mask of enabled layers to \a aMask.
  485. *
  486. * @param aMask = The new bit-mask of enabled layers.
  487. */
  488. void SetEnabledLayers( const LSET& aMask );
  489. /**
  490. * Test whether a given layer \a aLayerId is enabled.
  491. *
  492. * @param aLayerId The layer to be tested.
  493. * @return true if the layer is enabled.
  494. */
  495. inline bool IsLayerEnabled( PCB_LAYER_ID aLayerId ) const
  496. {
  497. if( aLayerId >= 0 && aLayerId < PCB_LAYER_ID_COUNT )
  498. return m_enabledLayers[aLayerId];
  499. return false;
  500. }
  501. /**
  502. * @return the number of enabled copper layers.
  503. */
  504. inline int GetCopperLayerCount() const
  505. {
  506. return m_copperLayerCount;
  507. }
  508. /**
  509. * Set the copper layer count to \a aNewLayerCount.
  510. *
  511. * @param aNewLayerCount The new number of enabled copper layers.
  512. */
  513. void SetCopperLayerCount( int aNewLayerCount );
  514. /**
  515. * @return the number of enabled user defined layers.
  516. */
  517. inline int GetUserDefinedLayerCount() const
  518. {
  519. return m_userDefinedLayerCount;
  520. }
  521. /**
  522. * Set the number of user defined layers to \a aNewLayerCount.
  523. *
  524. * @param aNewLayerCount The new number of enabled user defined layers.
  525. */
  526. void SetUserDefinedLayerCount( int aNewLayerCount );
  527. /**
  528. * The full thickness of the board including copper and masks.
  529. * @return
  530. */
  531. inline int GetBoardThickness() const { return m_boardThickness; }
  532. inline void SetBoardThickness( int aThickness ) { m_boardThickness = aThickness; }
  533. /**
  534. * Return an epsilon which accounts for rounding errors, etc.
  535. *
  536. * While currently an advanced cfg, going through this API allows us to easily change
  537. * it to board-specific if so desired.
  538. */
  539. int GetDRCEpsilon() const;
  540. /**
  541. * Pad & via drills are finish size.
  542. *
  543. * Adding the hole plating thickness gives you the actual hole size.
  544. */
  545. int GetHolePlatingThickness() const;
  546. /**
  547. * Return the default graphic segment thickness from the layer class for the given layer.
  548. */
  549. int GetLineThickness( PCB_LAYER_ID aLayer ) const;
  550. /**
  551. * Return the default text size from the layer class for the given layer.
  552. */
  553. VECTOR2I GetTextSize( PCB_LAYER_ID aLayer ) const;
  554. /**
  555. * Return the default text thickness from the layer class for the given layer.
  556. */
  557. int GetTextThickness( PCB_LAYER_ID aLayer ) const;
  558. bool GetTextItalic( PCB_LAYER_ID aLayer ) const;
  559. bool GetTextUpright( PCB_LAYER_ID aLayer ) const;
  560. int GetLayerClass( PCB_LAYER_ID aLayer ) const;
  561. void SetAuxOrigin( const VECTOR2I& aOrigin ) { m_auxOrigin = aOrigin; }
  562. const VECTOR2I& GetAuxOrigin() const { return m_auxOrigin; }
  563. void SetGridOrigin( const VECTOR2I& aOrigin ) { m_gridOrigin = aOrigin; }
  564. const VECTOR2I& GetGridOrigin() const { return m_gridOrigin; }
  565. void SetDefaultMasterPad();
  566. private:
  567. void initFromOther( const BOARD_DESIGN_SETTINGS& aOther );
  568. bool migrateSchema0to1();
  569. public:
  570. // Note: the first value in each dimensions list is the current netclass value
  571. std::vector<int> m_TrackWidthList;
  572. std::vector<VIA_DIMENSION> m_ViasDimensionsList;
  573. std::vector<DIFF_PAIR_DIMENSION> m_DiffPairDimensionsList;
  574. /**
  575. * The parameters of teardrops for the different teardrop targets (via/pad, track end).
  576. *
  577. * 3 set of parameters always exist: for round shapes, for rect shapes, for track ends.
  578. */
  579. TEARDROP_PARAMETERS_LIST m_TeardropParamsList;
  580. PNS::MEANDER_SETTINGS m_SingleTrackMeanderSettings;
  581. PNS::MEANDER_SETTINGS m_DiffPairMeanderSettings;
  582. PNS::MEANDER_SETTINGS m_SkewMeanderSettings;
  583. VIATYPE m_CurrentViaType; ///< (VIA_BLIND_BURIED, VIA_THROUGH, VIA_MICROVIA)
  584. bool m_UseConnectedTrackWidth; // use width of existing track when creating a new,
  585. // connected track
  586. bool m_TempOverrideTrackWidth; // use selected track width temporarily even when
  587. // using connected track width
  588. int m_MinClearance; // overall min
  589. int m_MinGrooveWidth; // Minimum groove width for creepage checks
  590. int m_MinConn; // overall min connection width
  591. int m_TrackMinWidth; // overall min track width
  592. int m_ViasMinAnnularWidth; // overall minimum width of the via copper ring
  593. int m_ViasMinSize; // overall vias (not micro vias) min diameter
  594. int m_MinThroughDrill; // through hole (not micro vias) min drill diameter
  595. int m_MicroViasMinSize; // micro vias min diameter
  596. int m_MicroViasMinDrill; // micro vias min drill diameter
  597. int m_CopperEdgeClearance;
  598. int m_HoleClearance; // Hole to copper clearance
  599. int m_HoleToHoleMin; // Min width of web between two drilled holes
  600. int m_SilkClearance; // Min dist between two silk items
  601. int m_MinResolvedSpokes; // Min spoke count to not be a starved thermal
  602. int m_MinSilkTextHeight; // Min text height for silkscreen layers
  603. int m_MinSilkTextThickness; // Min text thickness for silkscreen layers
  604. std::shared_ptr<DRC_ENGINE> m_DRCEngine;
  605. std::map<int, SEVERITY> m_DRCSeverities; // Map from DRCErrorCode to SEVERITY
  606. std::set<wxString> m_DrcExclusions; // Serialized excluded DRC markers
  607. std::map<wxString, wxString> m_DrcExclusionComments; // Map from serialization to comment
  608. // When smoothing the zone's outline there's the question of external fillets (that is, those
  609. // applied to concave corners). While it seems safer to never have copper extend outside the
  610. // zone outline, 5.1.x and prior did indeed fill them so we leave the mode available.
  611. bool m_ZoneKeepExternalFillets;
  612. // Maximum error allowed when approximating circles and arcs to segments
  613. int m_MaxError;
  614. // Global mask margins:
  615. int m_SolderMaskExpansion; // Solder mask inflation around the pad or via
  616. int m_SolderMaskMinWidth; // Solder mask min width (2 areas closer than this
  617. // width are merged)
  618. int m_SolderMaskToCopperClearance; // Min distance allowed from copper to a mask
  619. // aperture of another net
  620. int m_SolderPasteMargin; // Solder paste margin absolute value
  621. double m_SolderPasteMarginRatio; // Solder mask margin ratio value of pad size
  622. // The final margin is the sum of these 2 values
  623. bool m_AllowSoldermaskBridgesInFPs;
  624. bool m_TentViasFront; // The default tenting option if not overridden on an
  625. bool m_TentViasBack; // individual via
  626. bool m_CoverViasFront; // The default covering option if not overridden on an
  627. bool m_CoverViasBack; // individual via
  628. bool m_PlugViasFront; // The default plugging option if not overridden on an
  629. bool m_PlugViasBack; // individual via
  630. bool m_CapVias; // The default capping option if not overridden on an
  631. // individual via
  632. bool m_FillVias; // The default filling option if not overridden on ana
  633. // individual via
  634. std::shared_ptr<NET_SETTINGS> m_NetSettings;
  635. // Variables used in footprint editing (default value in item/footprint creation)
  636. std::vector<TEXT_ITEM_INFO> m_DefaultFPTextItems;
  637. // Map between user layer default names and custom names
  638. std::map<std::string, wxString> m_UserLayerNames;
  639. // Arrays of default values for the various layer classes.
  640. int m_LineThickness[ LAYER_CLASS_COUNT ];
  641. VECTOR2I m_TextSize[LAYER_CLASS_COUNT];
  642. int m_TextThickness[ LAYER_CLASS_COUNT ];
  643. bool m_TextItalic[ LAYER_CLASS_COUNT ];
  644. bool m_TextUpright[ LAYER_CLASS_COUNT ];
  645. // Default values for dimension objects
  646. DIM_UNITS_MODE m_DimensionUnitsMode;
  647. DIM_PRECISION m_DimensionPrecision; ///< Number of digits after the decimal
  648. DIM_UNITS_FORMAT m_DimensionUnitsFormat;
  649. bool m_DimensionSuppressZeroes;
  650. DIM_TEXT_POSITION m_DimensionTextPosition;
  651. bool m_DimensionKeepTextAligned;
  652. int m_DimensionArrowLength;
  653. int m_DimensionExtensionOffset;
  654. bool m_StyleFPFields;
  655. bool m_StyleFPText;
  656. bool m_StyleFPShapes;
  657. // Miscellaneous
  658. std::unique_ptr<PAD> m_Pad_Master; // A dummy pad to store all default parameters
  659. // when importing values or creating a new pad
  660. // Set to true if the board has a stackup management.
  661. // If not set a default basic stackup will be used to generate the gbrjob file.
  662. // Could be removed later, or at least always set to true
  663. bool m_HasStackup;
  664. /// Enable inclusion of stackup height in track length measurements and length tuning
  665. bool m_UseHeightForLengthCalcs;
  666. private:
  667. VECTOR2I m_auxOrigin; ///< origin for plot exports
  668. VECTOR2I m_gridOrigin; ///< origin for grid offsets
  669. // Indices into the trackWidth, viaSizes and diffPairDimensions lists.
  670. // The 0 index is always the current netclass value(s)
  671. unsigned m_trackWidthIndex;
  672. unsigned m_viaSizeIndex;
  673. unsigned m_diffPairIndex;
  674. // Custom values for track/via sizes (specified via dialog instead of netclass or lists)
  675. bool m_useCustomTrackVia;
  676. int m_customTrackWidth;
  677. VIA_DIMENSION m_customViaSize;
  678. // Custom values for differential pairs (specified via dialog instead of netclass/lists)
  679. bool m_useCustomDiffPair;
  680. DIFF_PAIR_DIMENSION m_customDiffPair;
  681. int m_copperLayerCount; ///< Number of copper layers for this design
  682. int m_userDefinedLayerCount; ///< Number of user defined layers for this design
  683. LSET m_enabledLayers; ///< Bit-mask for layer enabling
  684. int m_boardThickness; ///< Board thickness for 3D viewer
  685. /// Current net class name used to display netclass info.
  686. /// This is also the last used netclass after starting a track.
  687. wxString m_currentNetClassName;
  688. /**
  689. * The description of layers stackup, for board fabrication only physical layers are in
  690. * layers stackup.
  691. *
  692. * It includes not only layers enabled for the board edition, but also dielectric layers.
  693. */
  694. BOARD_STACKUP m_stackup;
  695. /// The default settings that will be used for new zones.
  696. ZONE_SETTINGS m_defaultZoneSettings;
  697. };
  698. #endif // BOARD_DESIGN_SETTINGS_H_