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.

200 lines
6.8 KiB

14 years ago
14 years ago
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
  1. /**********************************************************/
  2. /* class_board_design_settings.h : handle board options */
  3. /**********************************************************/
  4. #ifndef BOARD_DESIGN_SETTINGS_H_
  5. #define BOARD_DESIGN_SETTINGS_H_
  6. #include <pcbstruct.h> // NB_COLORS
  7. #include <class_pad.h>
  8. #include <param_config.h>
  9. /**
  10. * Class BOARD_DESIGN_SETTINGS
  11. * contains design settings for a BOARD object.
  12. */
  13. class BOARD_DESIGN_SETTINGS
  14. {
  15. public:
  16. bool m_MicroViasAllowed; ///< true to allow micro vias
  17. int m_CurrentViaType; ///< via type (VIA_BLIND_BURIED, VIA_TROUGHT VIA_MICROVIA)
  18. /// if true, when creating a new track starting on an existing track, use this track width
  19. bool m_UseConnectedTrackWidth;
  20. int m_DrawSegmentWidth; ///< current graphic line width (not EDGE layer)
  21. int m_EdgeSegmentWidth; ///< current graphic line width (EDGE layer only)
  22. int m_PcbTextWidth; ///< current Pcb (not module) Text width
  23. wxSize m_PcbTextSize; ///< current Pcb (not module) Text size
  24. int m_TrackMinWidth; ///< track min value for width ((min copper size value
  25. int m_ViasMinSize; ///< vias (not micro vias) min diameter
  26. int m_ViasMinDrill; ///< vias (not micro vias) min drill diameter
  27. int m_MicroViasMinSize; ///< micro vias (not vias) min diameter
  28. int m_MicroViasMinDrill; ///< micro vias (not vias) min drill diameter
  29. // Global mask margins:
  30. int m_SolderMaskMargin; ///< Solder mask margin
  31. int m_SolderMaskMinWidth; ///< Solder mask min width
  32. // 2 areas near than m_SolderMaskMinWidth
  33. // are merged
  34. int m_SolderPasteMargin; ///< Solder paste margin absolute value
  35. double m_SolderPasteMarginRatio; ///< Solder pask margin ratio value of pad size
  36. ///< The final margin is the sum of these 2 values
  37. // Variables used in footprint handling
  38. wxSize m_ModuleTextSize; ///< Default footprint texts size
  39. int m_ModuleTextWidth;
  40. int m_ModuleSegmentWidth;
  41. D_PAD m_Pad_Master;
  42. public:
  43. BOARD_DESIGN_SETTINGS();
  44. /**
  45. * Function GetVisibleLayers
  46. * returns a bit-mask of all the layers that are visible
  47. * @return int - the visible layers in bit-mapped form.
  48. */
  49. LAYER_MSK GetVisibleLayers() const;
  50. /**
  51. * Function SetVisibleAlls
  52. * Set the bit-mask of all visible elements categories,
  53. * including enabled layers
  54. */
  55. void SetVisibleAlls();
  56. /**
  57. * Function SetVisibleLayers
  58. * changes the bit-mask of visible layers
  59. * @param aMask = The new bit-mask of visible layers
  60. */
  61. void SetVisibleLayers( LAYER_MSK aMask );
  62. /**
  63. * Function IsLayerVisible
  64. * tests whether a given layer is visible
  65. * @param aLayer = The layer to be tested
  66. * @return bool - true if the layer is visible.
  67. */
  68. bool IsLayerVisible( LAYER_NUM aLayer ) const
  69. {
  70. // If a layer is disabled, it is automatically invisible
  71. return m_VisibleLayers & m_EnabledLayers & GetLayerMask( aLayer );
  72. }
  73. /**
  74. * Function SetLayerVisibility
  75. * changes the visibility of a given layer
  76. * @param aLayer = The layer to be changed
  77. * @param aNewState = The new visibility state of the layer
  78. */
  79. void SetLayerVisibility( LAYER_NUM aLayer, bool aNewState );
  80. /**
  81. * Function GetVisibleElements
  82. * returns a bit-mask of all the element categories that are visible
  83. * @return int - the visible element categories in bit-mapped form.
  84. */
  85. int GetVisibleElements() const
  86. {
  87. return m_VisibleElements;
  88. }
  89. /**
  90. * Function SetVisibleElements
  91. * changes the bit-mask of visible element categories
  92. * @param aMask = The new bit-mask of visible element categories
  93. */
  94. void SetVisibleElements( int aMask )
  95. {
  96. m_VisibleElements = aMask;
  97. }
  98. /**
  99. * Function IsElementVisible
  100. * tests whether a given element category is visible. Keep this as an
  101. * inline function.
  102. * @param aPCB_VISIBLE is from the enum by the same name
  103. * @return bool - true if the element is visible.
  104. * @see enum PCB_VISIBLE
  105. */
  106. bool IsElementVisible( int aPCB_VISIBLE ) const
  107. {
  108. return bool( m_VisibleElements & (1 << aPCB_VISIBLE) );
  109. }
  110. /**
  111. * Function SetElementVisibility
  112. * changes the visibility of an element category
  113. * @param aPCB_VISIBLE is from the enum by the same name
  114. * @param aNewState = The new visibility state of the element category
  115. * @see enum PCB_VISIBLE
  116. */
  117. void SetElementVisibility( int aPCB_VISIBLE, bool aNewState );
  118. /**
  119. * Function GetEnabledLayers
  120. * returns a bit-mask of all the layers that are enabled
  121. * @return int - the enabled layers in bit-mapped form.
  122. */
  123. inline LAYER_MSK GetEnabledLayers() const
  124. {
  125. return m_EnabledLayers;
  126. }
  127. /**
  128. * Function SetEnabledLayers
  129. * changes the bit-mask of enabled layers
  130. * @param aMask = The new bit-mask of enabled layers
  131. */
  132. void SetEnabledLayers( LAYER_MSK aMask );
  133. /**
  134. * Function IsLayerEnabled
  135. * tests whether a given layer is enabled
  136. * @param aLayer = The of the layer to be tested
  137. * @return bool - true if the layer is enabled
  138. */
  139. bool IsLayerEnabled( LAYER_NUM aLayer ) const
  140. {
  141. return m_EnabledLayers & GetLayerMask( aLayer );
  142. }
  143. /**
  144. * Function GetCopperLayerCount
  145. * @return int - the number of neabled copper layers
  146. */
  147. int GetCopperLayerCount() const
  148. {
  149. return m_CopperLayerCount;
  150. }
  151. /**
  152. * Function SetCopperLayerCount
  153. * do what its name says...
  154. * @param aNewLayerCount = The new number of enabled copper layers
  155. */
  156. void SetCopperLayerCount( int aNewLayerCount );
  157. /**
  158. * Function AppendConfigs
  159. * appends to @a aResult the configuration setting accessors which will later
  160. * allow reading or writing of configuration file information directly into
  161. * this object.
  162. */
  163. void AppendConfigs( PARAM_CFG_ARRAY* aResult );
  164. int GetBoardThickness() const { return m_boardThickness; }
  165. void SetBoardThickness( int aThickness ) { m_boardThickness = aThickness; }
  166. private:
  167. int m_CopperLayerCount; ///< Number of copper layers for this design
  168. LAYER_MSK m_EnabledLayers; ///< Bit-mask for layer enabling
  169. LAYER_MSK m_VisibleLayers; ///< Bit-mask for layer visibility
  170. int m_VisibleElements; ///< Bit-mask for element category visibility
  171. int m_boardThickness; ///< Board thickness for 3D viewer
  172. };
  173. #endif // BOARD_DESIGN_SETTINGS_H_