2009-10-28 11:48:47 +00:00
|
|
|
/**********************************************************/
|
|
|
|
/* class_board_design_settings.h : handle board options */
|
|
|
|
/**********************************************************/
|
|
|
|
|
|
|
|
#ifndef _BOARD_DESIGN_SETTING_H
|
|
|
|
#define _BOARD_DESIGN_SETTING_H
|
|
|
|
|
2010-01-21 07:41:30 +00:00
|
|
|
#include "pcbstruct.h" // NB_COLORS
|
|
|
|
|
2009-10-28 11:48:47 +00:00
|
|
|
// Class for handle current printed board design settings
|
2010-01-31 20:01:46 +00:00
|
|
|
class BOARD_DESIGN_SETTINGS
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
|
|
|
protected:
|
2011-09-23 13:57:12 +00:00
|
|
|
int m_CopperLayerCount; // Number of copper layers for this design
|
2009-10-28 11:48:47 +00:00
|
|
|
public:
|
2011-09-23 13:57:12 +00:00
|
|
|
bool m_MicroViasAllowed; // true to allow micro vias
|
|
|
|
int m_CurrentViaType; // via type (VIA_BLIND_BURIED, VIA_TROUGHT VIA_MICROVIA)
|
|
|
|
|
|
|
|
// if true, when creating a new track starting on an existing track, use this track width
|
|
|
|
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
|
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
// Global mask margins:
|
2011-09-23 13:57:12 +00:00
|
|
|
int m_SolderMaskMargin; // Solder mask margin
|
|
|
|
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
|
|
|
|
int m_BoardThickness; // Board Thickness for 3D viewer
|
2009-10-28 11:48:47 +00:00
|
|
|
|
|
|
|
protected:
|
2011-09-23 13:57:12 +00:00
|
|
|
int m_EnabledLayers; // Bit-mask for layer enabling
|
|
|
|
int m_VisibleLayers; // Bit-mask for layer visibility
|
|
|
|
int m_VisibleElements; // Bit-mask for element category visibility
|
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.
|
|
|
|
*/
|
2009-11-04 19:08:08 +00:00
|
|
|
int GetVisibleLayers() const;
|
2009-10-28 11:48:47 +00:00
|
|
|
|
2010-01-27 20:07:50 +00:00
|
|
|
/**
|
|
|
|
* Function SetVisibleAlls
|
|
|
|
* Set the bit-mask of all visible elements categories, including layers
|
|
|
|
*/
|
|
|
|
void SetVisibleAlls( );
|
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
void SetVisibleLayers( int aMask );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2009-12-07 03:46:13 +00:00
|
|
|
bool IsLayerVisible( int 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
|
2011-09-23 13:57:12 +00:00
|
|
|
if( aLayerIndex < 0 || aLayerIndex >= 32 )
|
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
|
2010-01-21 20:53:01 +00:00
|
|
|
return (bool) ( m_VisibleLayers & m_EnabledLayers & (1 << aLayerIndex) );
|
2009-10-28 11:48:47 +00:00
|
|
|
}
|
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
void SetLayerVisibility( int aLayerIndex, bool aNewState );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
}
|
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2009-10-28 11:48:47 +00:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
inline int GetEnabledLayers() const
|
|
|
|
{
|
|
|
|
return m_EnabledLayers;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetEnabledLayers
|
|
|
|
* changes the bit-mask of enabled layers
|
|
|
|
* @param aMask = The new bit-mask of enabled layers
|
|
|
|
*/
|
2009-12-21 12:05:36 +00:00
|
|
|
void SetEnabledLayers( int 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
|
|
|
|
*/
|
2010-01-31 20:01:46 +00:00
|
|
|
bool IsLayerEnabled( int aLayerIndex ) const
|
2009-10-28 11:48:47 +00:00
|
|
|
{
|
2010-01-21 20:53:01 +00:00
|
|
|
return bool( m_EnabledLayers & (1 << aLayerIndex) );
|
2009-10-28 11:48:47 +00:00
|
|
|
}
|
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2009-10-28 11:48:47 +00:00
|
|
|
/**
|
|
|
|
* Function SetCopperLayerCount
|
|
|
|
* do what its name says...
|
|
|
|
* @param aNewLayerCount = The new number of enabled copper layers
|
|
|
|
*/
|
|
|
|
void SetCopperLayerCount( int aNewLayerCount );
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
2009-11-04 19:08:08 +00:00
|
|
|
|
|
|
|
// _BOARD_DESIGN_SETTING_H
|