2009-10-28 11:48:47 +00:00
|
|
|
/**********************************************************/
|
|
|
|
/* class_board_design_settings.h : handle board options */
|
|
|
|
/**********************************************************/
|
|
|
|
|
2012-02-06 07:14:51 +00:00
|
|
|
#ifndef BOARD_DESIGN_SETTINGS_H_
|
|
|
|
#define BOARD_DESIGN_SETTINGS_H_
|
2009-10-28 11:48:47 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <pcbstruct.h> // NB_COLORS
|
2012-02-19 04:02:19 +00:00
|
|
|
#include <class_pad.h>
|
|
|
|
#include <param_config.h>
|
2010-01-21 07:41:30 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class BOARD_DESIGN_SETTINGS
|
|
|
|
* contains design settings for a BOARD object.
|
|
|
|
*/
|
2010-01-31 20:01:46 +00:00
|
|
|
class BOARD_DESIGN_SETTINGS
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
|
|
|
public:
|
2012-02-02 07:23:00 +00:00
|
|
|
bool m_MicroViasAllowed; ///< true to allow micro vias
|
|
|
|
int m_CurrentViaType; ///< via type (VIA_BLIND_BURIED, VIA_TROUGHT VIA_MICROVIA)
|
2011-09-23 13:57:12 +00:00
|
|
|
|
++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()
2011-12-05 06:15:33 +00:00
|
|
|
/// if true, when creating a new track starting on an existing track, use this track width
|
2012-02-02 07:23:00 +00:00
|
|
|
bool m_UseConnectedTrackWidth;
|
|
|
|
int m_DrawSegmentWidth; ///< current graphic line width (not EDGE layer)
|
|
|
|
int m_EdgeSegmentWidth; ///< current graphic line width (EDGE layer only)
|
|
|
|
int m_PcbTextWidth; ///< current Pcb (not module) Text width
|
|
|
|
wxSize m_PcbTextSize; ///< current Pcb (not module) Text size
|
|
|
|
int m_TrackMinWidth; ///< track min value for width ((min copper size value
|
|
|
|
int m_ViasMinSize; ///< vias (not micro vias) min diameter
|
|
|
|
int m_ViasMinDrill; ///< vias (not micro vias) min drill diameter
|
|
|
|
int m_MicroViasMinSize; ///< micro vias (not vias) min diameter
|
|
|
|
int m_MicroViasMinDrill; ///< micro vias (not vias) min drill diameter
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
// Global mask margins:
|
2012-02-02 07:23:00 +00:00
|
|
|
int m_SolderMaskMargin; ///< Solder mask margin
|
2012-11-05 20:20:34 +00:00
|
|
|
int m_SolderMaskMinWidth; ///< Solder mask min width
|
|
|
|
// 2 areas near than m_SolderMaskMinWidth
|
|
|
|
// are merged
|
2012-02-02 07:23:00 +00:00
|
|
|
int m_SolderPasteMargin; ///< Solder paste margin absolute value
|
|
|
|
double m_SolderPasteMarginRatio; ///< Solder pask margin ratio value of pad size
|
|
|
|
///< The final margin is the sum of these 2 values
|
|
|
|
|
|
|
|
// Variables used in footprint handling
|
|
|
|
wxSize m_ModuleTextSize; ///< Default footprint texts size
|
|
|
|
int m_ModuleTextWidth;
|
|
|
|
int m_ModuleSegmentWidth;
|
2009-10-28 11:48:47 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
D_PAD m_Pad_Master;
|
|
|
|
|
2009-10-28 11:48:47 +00:00
|
|
|
public:
|
2010-01-31 20:01:46 +00:00
|
|
|
BOARD_DESIGN_SETTINGS();
|
2009-10-28 11:48:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetVisibleLayers
|
|
|
|
* returns a bit-mask of all the layers that are visible
|
|
|
|
* @return int - the visible layers in bit-mapped form.
|
|
|
|
*/
|
2013-03-30 17:24:04 +00:00
|
|
|
LAYER_MSK GetVisibleLayers() const;
|
2009-10-28 11:48:47 +00:00
|
|
|
|
2010-01-27 20:07:50 +00:00
|
|
|
/**
|
|
|
|
* Function SetVisibleAlls
|
2012-02-06 05:44:19 +00:00
|
|
|
* Set the bit-mask of all visible elements categories,
|
|
|
|
* including enabled layers
|
2010-01-27 20:07:50 +00:00
|
|
|
*/
|
2012-02-06 05:44:19 +00:00
|
|
|
void SetVisibleAlls();
|
2010-01-27 20:07:50 +00:00
|
|
|
|
2009-10-28 11:48:47 +00:00
|
|
|
/**
|
|
|
|
* Function SetVisibleLayers
|
|
|
|
* changes the bit-mask of visible layers
|
|
|
|
* @param aMask = The new bit-mask of visible layers
|
|
|
|
*/
|
2013-03-30 17:24:04 +00:00
|
|
|
void SetVisibleLayers( LAYER_MSK aMask );
|
2009-10-28 11:48:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function IsLayerVisible
|
|
|
|
* tests whether a given layer is visible
|
|
|
|
* @param aLayerIndex = The index of the layer to be tested
|
|
|
|
* @return bool - true if the layer is visible.
|
|
|
|
*/
|
2013-03-31 13:27:46 +00:00
|
|
|
bool IsLayerVisible( LAYER_NUM aLayerIndex ) const
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
2011-09-30 18:15:37 +00:00
|
|
|
// @@IMB: Altough Pcbnew uses only 29, GerbView uses all 32 layers
|
2013-03-31 13:27:46 +00:00
|
|
|
if( aLayerIndex < FIRST_LAYER || aLayerIndex >= NB_LAYERS )
|
2009-10-28 11:48:47 +00:00
|
|
|
return false;
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2009-10-28 11:48:47 +00:00
|
|
|
// If a layer is disabled, it is automatically invisible
|
2013-03-30 17:24:04 +00:00
|
|
|
return bool( m_VisibleLayers & m_EnabledLayers & GetLayerMask( aLayerIndex ) );
|
2009-10-28 11:48:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetLayerVisibility
|
|
|
|
* changes the visibility of a given layer
|
|
|
|
* @param aLayerIndex = The index of the layer to be changed
|
|
|
|
* @param aNewState = The new visibility state of the layer
|
|
|
|
*/
|
2013-03-31 13:27:46 +00:00
|
|
|
void SetLayerVisibility( LAYER_NUM aLayerIndex, bool aNewState );
|
2009-10-28 11:48:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetVisibleElements
|
|
|
|
* returns a bit-mask of all the element categories that are visible
|
|
|
|
* @return int - the visible element categories in bit-mapped form.
|
|
|
|
*/
|
2009-12-07 03:46:13 +00:00
|
|
|
int GetVisibleElements() const
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
|
|
|
return m_VisibleElements;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetVisibleElements
|
|
|
|
* changes the bit-mask of visible element categories
|
|
|
|
* @param aMask = The new bit-mask of visible element categories
|
|
|
|
*/
|
2009-12-07 03:46:13 +00:00
|
|
|
void SetVisibleElements( int aMask )
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
|
|
|
m_VisibleElements = aMask;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function IsElementVisible
|
2010-01-21 20:53:01 +00:00
|
|
|
* tests whether a given element category is visible. Keep this as an
|
|
|
|
* inline function.
|
|
|
|
* @param aPCB_VISIBLE is from the enum by the same name
|
2009-10-28 11:48:47 +00:00
|
|
|
* @return bool - true if the element is visible.
|
2010-01-21 20:53:01 +00:00
|
|
|
* @see enum PCB_VISIBLE
|
2009-10-28 11:48:47 +00:00
|
|
|
*/
|
2010-01-21 20:53:01 +00:00
|
|
|
bool IsElementVisible( int aPCB_VISIBLE ) const
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
2010-01-21 20:53:01 +00:00
|
|
|
return bool( m_VisibleElements & (1 << aPCB_VISIBLE) );
|
2009-10-28 11:48:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetElementVisibility
|
|
|
|
* changes the visibility of an element category
|
2010-01-21 20:53:01 +00:00
|
|
|
* @param aPCB_VISIBLE is from the enum by the same name
|
2009-10-28 11:48:47 +00:00
|
|
|
* @param aNewState = The new visibility state of the element category
|
2010-01-21 20:53:01 +00:00
|
|
|
* @see enum PCB_VISIBLE
|
2009-10-28 11:48:47 +00:00
|
|
|
*/
|
2010-01-21 20:53:01 +00:00
|
|
|
void SetElementVisibility( int aPCB_VISIBLE, bool aNewState );
|
2009-10-28 11:48:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetEnabledLayers
|
|
|
|
* returns a bit-mask of all the layers that are enabled
|
|
|
|
* @return int - the enabled layers in bit-mapped form.
|
|
|
|
*/
|
2013-03-30 17:24:04 +00:00
|
|
|
inline LAYER_MSK GetEnabledLayers() const
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
|
|
|
return m_EnabledLayers;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetEnabledLayers
|
|
|
|
* changes the bit-mask of enabled layers
|
|
|
|
* @param aMask = The new bit-mask of enabled layers
|
|
|
|
*/
|
2013-03-30 17:24:04 +00:00
|
|
|
void SetEnabledLayers( LAYER_MSK aMask );
|
2009-10-28 11:48:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function IsLayerEnabled
|
|
|
|
* tests whether a given layer is enabled
|
|
|
|
* @param aLayerIndex = The index of the layer to be tested
|
|
|
|
* @return bool - true if the layer is enabled
|
|
|
|
*/
|
2013-03-31 13:27:46 +00:00
|
|
|
bool IsLayerEnabled( LAYER_NUM aLayerIndex ) const
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
2013-03-30 17:24:04 +00:00
|
|
|
return bool( m_EnabledLayers & GetLayerMask( aLayerIndex ) );
|
2009-10-28 11:48:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetCopperLayerCount
|
|
|
|
* @return int - the number of neabled copper layers
|
|
|
|
*/
|
2009-12-07 03:46:13 +00:00
|
|
|
int GetCopperLayerCount() const
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
|
|
|
return m_CopperLayerCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetCopperLayerCount
|
|
|
|
* do what its name says...
|
|
|
|
* @param aNewLayerCount = The new number of enabled copper layers
|
|
|
|
*/
|
|
|
|
void SetCopperLayerCount( int aNewLayerCount );
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
/**
|
|
|
|
* Function AppendConfigs
|
|
|
|
* appends to @a aResult the configuration setting accessors which will later
|
|
|
|
* allow reading or writing of configuration file information directly into
|
|
|
|
* this object.
|
|
|
|
*/
|
|
|
|
void AppendConfigs( PARAM_CFG_ARRAY* aResult );
|
2009-10-28 11:48:47 +00:00
|
|
|
|
2012-06-09 17:00:13 +00:00
|
|
|
int GetBoardThickness() const { return m_boardThickness; }
|
|
|
|
void SetBoardThickness( int aThickness ) { m_boardThickness = aThickness; }
|
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
private:
|
2013-03-30 17:24:04 +00:00
|
|
|
int m_CopperLayerCount; ///< Number of copper layers for this design
|
|
|
|
LAYER_MSK m_EnabledLayers; ///< Bit-mask for layer enabling
|
|
|
|
LAYER_MSK m_VisibleLayers; ///< Bit-mask for layer visibility
|
|
|
|
int m_VisibleElements; ///< Bit-mask for element category visibility
|
|
|
|
int m_boardThickness; ///< Board thickness for 3D viewer
|
2009-10-28 11:48:47 +00:00
|
|
|
};
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2012-02-06 07:14:51 +00:00
|
|
|
#endif // BOARD_DESIGN_SETTINGS_H_
|