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.

836 lines
27 KiB

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