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.

204 lines
7.0 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
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. int 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( int aMask );
  62. /**
  63. * Function IsLayerVisible
  64. * tests whether a given layer is visible
  65. * @param aLayerIndex = The index of the layer to be tested
  66. * @return bool - true if the layer is visible.
  67. */
  68. bool IsLayerVisible( int aLayerIndex ) const
  69. {
  70. // @@IMB: Altough Pcbnew uses only 29, GerbView uses all 32 layers
  71. if( aLayerIndex < 0 || aLayerIndex >= 32 )
  72. return false;
  73. // If a layer is disabled, it is automatically invisible
  74. return (bool) ( m_VisibleLayers & m_EnabledLayers & (1 << aLayerIndex) );
  75. }
  76. /**
  77. * Function SetLayerVisibility
  78. * changes the visibility of a given layer
  79. * @param aLayerIndex = The index of the layer to be changed
  80. * @param aNewState = The new visibility state of the layer
  81. */
  82. void SetLayerVisibility( int aLayerIndex, bool aNewState );
  83. /**
  84. * Function GetVisibleElements
  85. * returns a bit-mask of all the element categories that are visible
  86. * @return int - the visible element categories in bit-mapped form.
  87. */
  88. int GetVisibleElements() const
  89. {
  90. return m_VisibleElements;
  91. }
  92. /**
  93. * Function SetVisibleElements
  94. * changes the bit-mask of visible element categories
  95. * @param aMask = The new bit-mask of visible element categories
  96. */
  97. void SetVisibleElements( int aMask )
  98. {
  99. m_VisibleElements = aMask;
  100. }
  101. /**
  102. * Function IsElementVisible
  103. * tests whether a given element category is visible. Keep this as an
  104. * inline function.
  105. * @param aPCB_VISIBLE is from the enum by the same name
  106. * @return bool - true if the element is visible.
  107. * @see enum PCB_VISIBLE
  108. */
  109. bool IsElementVisible( int aPCB_VISIBLE ) const
  110. {
  111. return bool( m_VisibleElements & (1 << aPCB_VISIBLE) );
  112. }
  113. /**
  114. * Function SetElementVisibility
  115. * changes the visibility of an element category
  116. * @param aPCB_VISIBLE is from the enum by the same name
  117. * @param aNewState = The new visibility state of the element category
  118. * @see enum PCB_VISIBLE
  119. */
  120. void SetElementVisibility( int aPCB_VISIBLE, bool aNewState );
  121. /**
  122. * Function GetEnabledLayers
  123. * returns a bit-mask of all the layers that are enabled
  124. * @return int - the enabled layers in bit-mapped form.
  125. */
  126. inline int GetEnabledLayers() const
  127. {
  128. return m_EnabledLayers;
  129. }
  130. /**
  131. * Function SetEnabledLayers
  132. * changes the bit-mask of enabled layers
  133. * @param aMask = The new bit-mask of enabled layers
  134. */
  135. void SetEnabledLayers( int aMask );
  136. /**
  137. * Function IsLayerEnabled
  138. * tests whether a given layer is enabled
  139. * @param aLayerIndex = The index of the layer to be tested
  140. * @return bool - true if the layer is enabled
  141. */
  142. bool IsLayerEnabled( int aLayerIndex ) const
  143. {
  144. return bool( m_EnabledLayers & (1 << aLayerIndex) );
  145. }
  146. /**
  147. * Function GetCopperLayerCount
  148. * @return int - the number of neabled copper layers
  149. */
  150. int GetCopperLayerCount() const
  151. {
  152. return m_CopperLayerCount;
  153. }
  154. /**
  155. * Function SetCopperLayerCount
  156. * do what its name says...
  157. * @param aNewLayerCount = The new number of enabled copper layers
  158. */
  159. void SetCopperLayerCount( int aNewLayerCount );
  160. /**
  161. * Function AppendConfigs
  162. * appends to @a aResult the configuration setting accessors which will later
  163. * allow reading or writing of configuration file information directly into
  164. * this object.
  165. */
  166. void AppendConfigs( PARAM_CFG_ARRAY* aResult );
  167. int GetBoardThickness() const { return m_boardThickness; }
  168. void SetBoardThickness( int aThickness ) { m_boardThickness = aThickness; }
  169. private:
  170. int m_CopperLayerCount; ///< Number of copper layers for this design
  171. int m_EnabledLayers; ///< Bit-mask for layer enabling
  172. int m_VisibleLayers; ///< Bit-mask for layer visibility
  173. int m_VisibleElements; ///< Bit-mask for element category visibility
  174. int m_boardThickness; ///< Board thickness for 3D viewer
  175. };
  176. #endif // BOARD_DESIGN_SETTINGS_H_