Commit 4578ea8b authored by Dick Hollenbeck's avatar Dick Hollenbeck

1) Add 32 Cu Layers.

2) Change from legacy Cu stack to counting down from top=(F_Cu or 0).
   The old Cu stack required knowing the count of Cu layers to make
   sense of the layer number when converting to many exported file types.
   The new Cu stack is more commonly used, although ours still gives
   B_Cu a fixed number.
3) Introduce class LSET and enum LAYER_ID.
4) Change *.kicad_pcb file format version to 4 from 3.
5) Change fixed names Inner1_Cu-Inner14_Cu to In1_Cu-In30_Cu and their
   meanings are typically flipped.
6) Moved the #define LAYER_N_* stuff into legacy_plugin.cpp where they
   can die a quiet death, and switch to enum LAYER_ID symbols throughout.
7) Removed the LEGACY_PLUGIN::Save() and FootprintSave() functions.
   You will need to convert to the format immediately, *.kicad_pcb and
   *.kicad_mod (=pretty) since legacy format was never going to know
   about 32 Cu layers and additional technical layers and the reversed Cu
   stack.
parent 21b70093
This diff is collapsed.
......@@ -132,53 +132,52 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
// Fill remaining unused copper layers and front layer zpos
// with m_EpoxyThickness
// Solder mask and Solder paste have the same Z position
for( ; layer <= LAST_COPPER_LAYER; layer++ )
for( ; layer < MAX_CU_LAYERS; layer++ )
{
m_LayerZcoord[layer] = m_EpoxyThickness;
}
// calculate z position for each non copper layer
for( int layer_id = FIRST_NON_COPPER_LAYER; layer_id < NB_PCB_LAYERS; layer_id++ )
for( int layer_id = MAX_CU_LAYERS; layer_id < LAYER_ID_COUNT; layer_id++ )
{
double zpos;
switch( layer_id )
{
case ADHESIVE_N_BACK:
case B_Adhes:
zpos = zpos_copper_back - 3 * zpos_offset;
break;
case ADHESIVE_N_FRONT:
case F_Adhes:
zpos = zpos_copper_front + 3 * zpos_offset;
break;
case SOLDERPASTE_N_BACK:
case B_Paste:
zpos = zpos_copper_back - 1 * zpos_offset;
break;
case SOLDERPASTE_N_FRONT:
case F_Paste:
zpos = zpos_copper_front + 1 * zpos_offset;
break;
case SOLDERMASK_N_BACK:
case B_Mask:
zpos = zpos_copper_back - 1 * zpos_offset;
break;
case SOLDERMASK_N_FRONT:
case F_Mask:
zpos = zpos_copper_front + 1 * zpos_offset;
break;
case SILKSCREEN_N_BACK:
case B_SilkS:
zpos = zpos_copper_back - 2 * zpos_offset;
break;
case SILKSCREEN_N_FRONT:
case F_SilkS:
zpos = zpos_copper_front + 2 * zpos_offset;
break;
default:
zpos = zpos_copper_front +
(layer_id - FIRST_NON_COPPER_LAYER + 4) * zpos_offset;
zpos = zpos_copper_front + (layer_id - MAX_CU_LAYERS + 4) * zpos_offset;
break;
}
......@@ -196,8 +195,8 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
double INFO3D_VISU::GetModulesZcoord3DIU( bool aIsFlipped )
{
if( aIsFlipped )
return m_LayerZcoord[LAYER_N_BACK] - ( m_CopperThickness / 2 );
return m_LayerZcoord[B_Cu] - ( m_CopperThickness / 2 );
else
return m_LayerZcoord[LAYER_N_FRONT] + ( m_CopperThickness / 2 );
return m_LayerZcoord[F_Cu] + ( m_CopperThickness / 2 );
}
......@@ -95,7 +95,7 @@ public:
double m_CurrentZpos; // temporary storage of current value of Z position,
// used in some calculation
private:
double m_LayerZcoord[NB_LAYERS]; // Z position of each layer (normalized)
double m_LayerZcoord[LAYER_ID_COUNT]; // Z position of each layer (normalized)
double m_CopperThickness; // Copper thickness (normalized)
double m_EpoxyThickness; // Epoxy thickness (normalized)
double m_NonCopperLayerThickness; // Non copper layers thickness
......@@ -188,11 +188,12 @@ public: INFO3D_VISU();
*
* Note: if m_drawFlags[FL_USE_COPPER_THICKNESS] is not set, returns 0
*/
int GetLayerObjectThicknessBIU( int aLayerId) const
int GetLayerObjectThicknessBIU( int aLayerId ) const
{
return aLayerId >= FIRST_NON_COPPER_LAYER ?
GetNonCopperLayerThicknessBIU() :
GetCopperThicknessBIU();
return IsCopperLayer( aLayerId ) ?
GetCopperThicknessBIU() :
GetNonCopperLayerThicknessBIU()
;
}
bool IsRealisticMode() { return GetFlag( FL_USE_REALISTIC_MODE ); }
......
......@@ -355,7 +355,7 @@ void BITMAPCONV_INFO::OuputOnePolygon( KPolygon & aPolygon )
case PCBNEW_LEGACY_EMP:
{
LAYER_NUM layer = SILKSCREEN_N_FRONT;
LAYER_NUM layer = F_SilkS;
int width = 1;
fprintf( m_Outfile, "DP %d %d %d %d %d %d %d\n",
0, 0, 0, 0,
......
......@@ -250,6 +250,7 @@ set( PCB_COMMON_SRCS
eda_text.cpp
class_page_info.cpp
pcbcommon.cpp
lset.cpp
footprint_info.cpp
../pcbnew/basepcbframe.cpp
../pcbnew/class_board.cpp
......
......@@ -15,8 +15,7 @@
/* Initial colors values: optimized for Pcbnew, but are also Ok for Eeschema
* these values are superseded by config reading
*/
static const EDA_COLOR_T default_layer_color[LAYERSCOLORSBUFFERSIZE] =
{
static const EDA_COLOR_T default_layer_color[] = {
GREEN, BLUE, LIGHTGRAY, BROWN,
RED, MAGENTA, LIGHTGRAY, MAGENTA,
DARKGRAY, BLUE, GREEN, CYAN,
......@@ -34,8 +33,8 @@ static const EDA_COLOR_T default_layer_color[LAYERSCOLORSBUFFERSIZE] =
DARKGRAY
};
static const EDA_COLOR_T default_items_color[LAYERSCOLORSBUFFERSIZE] =
{
static const EDA_COLOR_T default_items_color[] = {
LIGHTGRAY, // unused
CYAN, // VIA_MICROVIA_VISIBLE
BROWN, // VIA_BBLIND_VISIBLE
......@@ -56,13 +55,24 @@ static const EDA_COLOR_T default_items_color[LAYERSCOLORSBUFFERSIZE] =
LIGHTGRAY, LIGHTGRAY, LIGHTGRAY
};
COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS()
{
for( unsigned ii = 0; ii < DIM(m_LayersColors); ii++ )
m_LayersColors[ii] = default_layer_color[ii];
for( unsigned src = 0, dst = 0; dst < DIM(m_LayersColors); ++dst )
{
m_LayersColors[dst] = default_layer_color[src++];
for( unsigned ii = 0; ii < DIM(m_ItemsColors); ii++ )
m_ItemsColors[ii] = default_items_color[ii];
if( src >= DIM( default_layer_color ) )
src = 0; // wrap the source.
}
for( unsigned src = 0, dst = 0; dst < DIM(m_ItemsColors); ++dst )
{
m_ItemsColors[dst] = default_items_color[src++];
if( src >= DIM( default_items_color ) )
src = 0;
}
}
......
......@@ -13,19 +13,11 @@
LAYER_SELECTOR::LAYER_SELECTOR()
{
m_layerorder = true;
m_layerhotkeys = true;
m_hotkeys = NULL;
}
bool LAYER_SELECTOR::SetLayersOrdered( bool value )
{
m_layerorder = value;
return m_layerorder;
}
bool LAYER_SELECTOR::SetLayersHotkeys( bool value )
{
m_layerhotkeys = value;
......@@ -33,7 +25,7 @@ bool LAYER_SELECTOR::SetLayersHotkeys( bool value )
}
void LAYER_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer )
void LAYER_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_ID aLayer )
{
wxMemoryDC bmpDC;
wxBrush brush;
......@@ -120,12 +112,15 @@ int LAYER_BOX_SELECTOR::SetLayerSelection( LAYER_NUM layer )
return -1;
}
void LAYER_BOX_SELECTOR::ResyncBitmapOnly()
{
LAYER_NUM elements = GetCount();
for( LAYER_NUM i = FIRST_LAYER; i < elements; ++i )
int elements = GetCount();
for( LAYER_NUM i = 0; i < elements; ++i )
{
wxBitmap layerbmp( 14, 14 );
SetBitmapLayer( layerbmp, i );
SetBitmapLayer( layerbmp, LAYER_ID( i ) );
}
}
......@@ -327,7 +327,7 @@ void EDA_DRAW_FRAME::ToolOnRightClick( wxCommandEvent& event )
}
void EDA_DRAW_FRAME::PrintPage( wxDC* aDC,LAYER_MSK aPrintMask, bool aPrintMirrorMode, void* aData )
void EDA_DRAW_FRAME::PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode, void* aData )
{
wxMessageBox( wxT("EDA_DRAW_FRAME::PrintPage() error") );
}
......
......@@ -43,16 +43,6 @@
class MODULE;
/* Look up Table for conversion copper layer count -> general copper layer
* mask: */
LAYER_MSK g_TabAllCopperLayerMask[NB_COPPER_LAYERS] = {
0x0001, 0x8001, 0x8003, 0x8007,
0x800F, 0x801F, 0x803F, 0x807F,
0x80FF, 0x81FF, 0x83FF, 0x87FF,
0x8FFF, 0x9FFF, 0xCFFF, 0xFFFF
};
DISPLAY_OPTIONS DisplayOpt; // Display options for board items
int g_AnchorColor = BLUE;
......@@ -71,124 +61,20 @@ int g_PadCMPColor = RED;
*/
DLIST<TRACK> g_CurrentTrackList;
LAYER_NUM FlipLayer( LAYER_NUM oldlayer )
{
switch( oldlayer )
{
case LAYER_N_BACK:
return LAYER_N_FRONT;
case LAYER_N_FRONT:
return LAYER_N_BACK;
case SILKSCREEN_N_BACK:
return SILKSCREEN_N_FRONT;
case SILKSCREEN_N_FRONT:
return SILKSCREEN_N_BACK;
case ADHESIVE_N_BACK:
return ADHESIVE_N_FRONT;
case ADHESIVE_N_FRONT:
return ADHESIVE_N_BACK;
case SOLDERMASK_N_BACK:
return SOLDERMASK_N_FRONT;
case SOLDERMASK_N_FRONT:
return SOLDERMASK_N_BACK;
case SOLDERPASTE_N_BACK:
return SOLDERPASTE_N_FRONT;
case SOLDERPASTE_N_FRONT:
return SOLDERPASTE_N_BACK;
// No change for the other layers
default:
return oldlayer;
}
}
LAYER_MSK FlipLayerMask( LAYER_MSK aMask )
void AccumulateDescription( wxString &aDesc, const wxString &aItem )
{
LAYER_MSK newMask;
newMask = aMask & ~(LAYER_BACK | LAYER_FRONT |
SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT |
ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT |
SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT |
SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT |
ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT);
if( aMask & LAYER_BACK )
newMask |= LAYER_FRONT;
if( aMask & LAYER_FRONT )
newMask |= LAYER_BACK;
if( aMask & SILKSCREEN_LAYER_BACK )
newMask |= SILKSCREEN_LAYER_FRONT;
if( aMask & SILKSCREEN_LAYER_FRONT )
newMask |= SILKSCREEN_LAYER_BACK;
if( aMask & ADHESIVE_LAYER_BACK )
newMask |= ADHESIVE_LAYER_FRONT;
if( aMask & ADHESIVE_LAYER_FRONT )
newMask |= ADHESIVE_LAYER_BACK;
if( aMask & SOLDERMASK_LAYER_BACK )
newMask |= SOLDERMASK_LAYER_FRONT;
if( aMask & SOLDERMASK_LAYER_FRONT )
newMask |= SOLDERMASK_LAYER_BACK;
if( aMask & SOLDERPASTE_LAYER_BACK )
newMask |= SOLDERPASTE_LAYER_FRONT;
if( aMask & SOLDERPASTE_LAYER_FRONT )
newMask |= SOLDERPASTE_LAYER_BACK;
if( aMask & ADHESIVE_LAYER_BACK )
newMask |= ADHESIVE_LAYER_FRONT;
if( aMask & ADHESIVE_LAYER_FRONT )
newMask |= ADHESIVE_LAYER_BACK;
return newMask;
if( !aDesc.IsEmpty() )
aDesc << wxT(", ");
aDesc << aItem;
}
LAYER_NUM ExtractLayer( LAYER_MSK aMask )
{
if( aMask == NO_LAYERS )
return UNSELECTED_LAYER;
LAYER_NUM candidate = UNDEFINED_LAYER;
// Scan all the layers and take note of the first set; if other are
// then found return UNDEFINED_LAYER
for( LAYER_NUM i = FIRST_LAYER; i < NB_LAYERS; ++i )
{
if( aMask & GetLayerMask( i ) )
{
if( candidate == UNDEFINED_LAYER )
candidate = i;
else
return UNDEFINED_LAYER;
}
}
return candidate;
}
wxString LayerMaskDescribe( const BOARD *aBoard, LAYER_MSK aMask )
wxString LayerMaskDescribe( const BOARD *aBoard, LSET aMask )
{
// Try the single or no- layer case (easy)
LAYER_NUM layer = ExtractLayer( aMask );
switch( layer )
LAYER_ID layer = aMask.ExtractLayer();
switch( (int) layer )
{
case UNSELECTED_LAYER:
return _( "No layers" );
......@@ -203,24 +89,19 @@ wxString LayerMaskDescribe( const BOARD *aBoard, LAYER_MSK aMask )
// Try to be smart and useful, starting with outer copper
// (which are more important than internal ones)
wxString layerInfo;
if( aMask & LAYER_FRONT )
AccumulateDescription( layerInfo, aBoard->GetLayerName( LAYER_N_FRONT ) );
if( aMask & LAYER_BACK )
AccumulateDescription( layerInfo, aBoard->GetLayerName( LAYER_N_BACK ) );
if( aMask[F_Cu] )
AccumulateDescription( layerInfo, aBoard->GetLayerName( F_Cu ) );
if( aMask[B_Cu] )
AccumulateDescription( layerInfo, aBoard->GetLayerName( B_Cu ) );
if( aMask & INTERNAL_CU_LAYERS )
if( ( aMask & LSET::InternalCuMask() ).any() )
AccumulateDescription( layerInfo, _("Internal" ) );
if( aMask & ALL_NO_CU_LAYERS )
if( ( aMask & LSET::AllNonCuMask() ).any() )
AccumulateDescription( layerInfo, _("Non-copper" ) );
return layerInfo;
}
void AccumulateDescription( wxString &aDesc, const wxString &aItem )
{
if( !aDesc.IsEmpty() )
aDesc << wxT(", ");
aDesc << aItem;
}
......@@ -183,7 +183,7 @@ void LIB_EDIT_FRAME::SVG_PlotComponent( const wxString& aFullFileName )
delete plotter;
}
void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, LAYER_MSK aPrintMask, bool aPrintMirrorMode, void* aData)
void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode, void* aData)
{
if( ! m_component )
return;
......
......@@ -608,7 +608,7 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMask,
virtual void PrintPage( wxDC* aDC, LSET aPrintMask,
bool aPrintMirrorMode, void* aData = NULL );
/**
......
......@@ -931,7 +931,7 @@ void SCH_EDIT_FRAME::OnPrint( wxCommandEvent& event )
}
void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, LAYER_MSK aPrintMask, bool aPrintMirrorMode,
void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode,
void* aData )
{
GetScreen()->Draw( m_canvas, aDC, GR_DEFAULT_DRAWMODE );
......
......@@ -9,13 +9,11 @@ class GBR_LAYER_BOX_SELECTOR : public LAYER_BOX_SELECTOR
{
public:
GBR_LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL )
:LAYER_BOX_SELECTOR( parent, id, pos, size, n, choices )
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL ) :
LAYER_BOX_SELECTOR( parent, id, pos, size, n, choices )
{
m_layerhotkeys = false;
m_layerorder = false;
}
// Reload the Layers names and bitmaps
......
......@@ -27,7 +27,7 @@ private:
PAGE_INFO m_paper;
TITLE_BLOCK m_titles;
wxPoint m_originAxisPosition;
LAYER_MSK m_printLayersMask; // When printing: the list of layers to print
LSET m_printLayersMask; // When printing: the list of layers to print
public:
DLIST<GERBER_DRAW_ITEM> m_Drawings; // linked list of Gerber Items
......@@ -93,7 +93,7 @@ public:
* changes the bit-mask of visible layers
* @param aLayerMask = The new bit-mask of visible layers
*/
void SetVisibleLayers( LAYER_MSK aLayerMask )
void SetVisibleLayers( LSET aLayerMask )
{
m_printLayersMask = aLayerMask;
}
......
......@@ -86,7 +86,7 @@ GBR_SCREEN::GBR_SCREEN( const wxSize& aPageSizeIU ) :
// Set the working grid size to a reasonable value (in 1/10000 inch)
SetGrid( DMIL_GRID( 500 ) );
m_Active_Layer = LAYER_N_BACK; // default active layer = bottom layer
m_Active_Layer = B_Cu; // default active layer = bottom layer
SetZoom( ZOOM_FACTOR( 350 ) ); // a default value for zoom
......
......@@ -134,7 +134,7 @@ public:
*/
void SetLayer( LAYER_NUM aLayer ) { m_Layer = aLayer; }
LAYER_MSK GetLayerMask()
LSET GetLayerMask()
{
return ::GetLayerMask( m_Layer );
}
......
......@@ -169,7 +169,7 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
int rowCount;
int menuId = event.GetId();
bool visible = (menuId == ID_SHOW_ALL_LAYERS) ? true : false;;
LAYER_MSK visibleLayers = NO_LAYERS;
LSET visibleLayers = NO_LAYERS;
bool force_active_layer_visible;
m_alwaysShowActiveLayer = ( menuId == ID_ALWAYS_SHOW_NO_LAYERS_BUT_ACTIVE );
......@@ -195,9 +195,9 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
cb->SetValue( loc_visible );
if( loc_visible )
visibleLayers |= GetLayerMask( row );
visibleLayers |= GetLayerSet( row );
else
visibleLayers &= ~GetLayerMask( row );
visibleLayers &= ~GetLayerSet( row );
}
myframe->SetVisibleLayers( visibleLayers );
......@@ -237,7 +237,7 @@ void GERBER_LAYER_WIDGET::ReFill()
//-----<LAYER_WIDGET callbacks>-------------------------------------------
void GERBER_LAYER_WIDGET::OnLayerColorChange( LAYER_NUM aLayer, EDA_COLOR_T aColor )
void GERBER_LAYER_WIDGET::OnLayerColorChange( int aLayer, EDA_COLOR_T aColor )
{
myframe->SetLayerColor( aLayer, aColor );
myframe->m_SelLayerBox->ResyncBitmapOnly();
......@@ -263,12 +263,12 @@ bool GERBER_LAYER_WIDGET::OnLayerSelect( LAYER_NUM aLayer )
void GERBER_LAYER_WIDGET::OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal )
{
LAYER_MSK visibleLayers = myframe->GetVisibleLayers();
LSET visibleLayers = myframe->GetVisibleLayers();
if( isVisible )
visibleLayers |= GetLayerMask( aLayer );
visibleLayers |= GetLayerSet( aLayer );
else
visibleLayers &= ~GetLayerMask( aLayer );
visibleLayers &= ~GetLayerSet( aLayer );
myframe->SetVisibleLayers( visibleLayers );
......
......@@ -91,9 +91,9 @@ public:
void ReFillRender();
//-----<implement LAYER_WIDGET abstract callback functions>-----------
void OnLayerColorChange( LAYER_NUM aLayer, EDA_COLOR_T aColor );
bool OnLayerSelect( LAYER_NUM aLayer );
void OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal );
void OnLayerColorChange( int aLayer, EDA_COLOR_T aColor );
bool OnLayerSelect( int aLayer );
void OnLayerVisible( int aLayer, bool isVisible, bool isFinal );
void OnRenderColorChange( int aId, EDA_COLOR_T aColor );
void OnRenderEnable( int aId, bool isEnabled );
/**
......
......@@ -63,7 +63,7 @@ private:
public:
bool IsMirrored() { return m_Print_Mirror->IsChecked(); }
bool PrintUsingSinglePage() { return true; }
int SetLayerMaskFromListSelection();
int SetLayerSetFromListSelection();
};
......@@ -136,7 +136,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
// Create layer list
for( LAYER_NUM ii = FIRST_LAYER; ii < layer_max; ++ii )
{
LAYER_MSK mask = GetLayerMask( ii );
LSET mask = GetLayerSet( ii );
msg = _( "Layer" );
msg << wxT( " " ) << ii + 1;
m_BoxSelectLayer[ii] = new wxCheckBox( this, -1, msg );
......@@ -183,7 +183,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
{
m_BoxSelectLayer[layer]->SetValue( option );
if( option )
s_SelectedLayers |= GetLayerMask( layer );
s_SelectedLayers |= GetLayerSet( layer );
}
}
}
......@@ -215,7 +215,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
}
/**************************************************************/
int DIALOG_PRINT_USING_PRINTER::SetLayerMaskFromListSelection()
int DIALOG_PRINT_USING_PRINTER::SetLayerSetFromListSelection()
/**************************************************************/
{
int page_count = 0;
......@@ -225,7 +225,7 @@ int DIALOG_PRINT_USING_PRINTER::SetLayerMaskFromListSelection()
if( m_BoxSelectLayer[ii]->IsChecked() )
{
page_count++;
s_Parameters.m_PrintMaskLayer |= GetLayerMask( ii );
s_Parameters.m_PrintMaskLayer |= GetLayerSet( ii );
}
}
......@@ -271,7 +271,7 @@ void DIALOG_PRINT_USING_PRINTER::SetPrintParameters( )
// because these objects create artefact when they are printed on an existing image.
s_Parameters.m_OptionPrintPage = false;
SetLayerMaskFromListSelection();
SetLayerSetFromListSelection();
int idx = m_ScaleOption->GetSelection();
s_Parameters.m_PrintScale = s_ScaleList[idx];
......@@ -342,7 +342,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
return;
}
SetLayerMaskFromListSelection();
SetLayerSetFromListSelection();
// If no layer selected, we have no plot. prompt user if it happens
// because he could think there is a bug in Pcbnew:
......
......@@ -189,7 +189,7 @@ const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber )
// Use a switch to explicitly show the mapping more clearly
switch( aLayerNumber )
{
case LAYER_N_FRONT: txt = wxT( "F.Cu" ); break;
case F_Cu: txt = wxT( "F.Cu" ); break;
case LAYER_N_2: txt = wxT( "Inner1.Cu" ); break;
case LAYER_N_3: txt = wxT( "Inner2.Cu" ); break;
case LAYER_N_4: txt = wxT( "Inner3.Cu" ); break;
......@@ -204,20 +204,20 @@ const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber )
case LAYER_N_13: txt = wxT( "Inner12.Cu" ); break;
case LAYER_N_14: txt = wxT( "Inner13.Cu" ); break;
case LAYER_N_15: txt = wxT( "Inner14.Cu" ); break;
case LAYER_N_BACK: txt = wxT( "B.Cu" ); break;
case ADHESIVE_N_BACK: txt = wxT( "B.Adhes" ); break;
case ADHESIVE_N_FRONT: txt = wxT( "F.Adhes" ); break;
case SOLDERPASTE_N_BACK: txt = wxT( "B.Paste" ); break;
case SOLDERPASTE_N_FRONT: txt = wxT( "F.Paste" ); break;
case SILKSCREEN_N_BACK: txt = wxT( "B.SilkS" ); break;
case SILKSCREEN_N_FRONT: txt = wxT( "F.SilkS" ); break;
case SOLDERMASK_N_BACK: txt = wxT( "B.Mask" ); break;
case SOLDERMASK_N_FRONT: txt = wxT( "F.Mask" ); break;
case DRAW_N: txt = wxT( "Dwgs.User" ); break;
case COMMENT_N: txt = wxT( "Cmts.User" ); break;
case ECO1_N: txt = wxT( "Eco1.User" ); break;
case ECO2_N: txt = wxT( "Eco2.User" ); break;
case EDGE_N: txt = wxT( "Edge.Cuts" ); break;
case B_Cu: txt = wxT( "B.Cu" ); break;
case B_Adhes: txt = wxT( "B.Adhes" ); break;
case F_Adhes: txt = wxT( "F.Adhes" ); break;
case B_Paste: txt = wxT( "B.Paste" ); break;
case F_Paste: txt = wxT( "F.Paste" ); break;
case B_SilkS: txt = wxT( "B.SilkS" ); break;
case F_SilkS: txt = wxT( "F.SilkS" ); break;
case B_Mask: txt = wxT( "B.Mask" ); break;
case F_Mask: txt = wxT( "F.Mask" ); break;
case Dwgs_User: txt = wxT( "Dwgs.User" ); break;
case Cmts_User: txt = wxT( "Cmts.User" ); break;
case Eco1_User: txt = wxT( "Eco1.User" ); break;
case Eco2_User: txt = wxT( "Eco2.User" ); break;
case Edge_Cuts: txt = wxT( "Edge.Cuts" ); break;
default: txt = wxT( "BAD_INDEX" ); break;
}
......
......@@ -42,11 +42,11 @@
#include <printout_controler.h>
void GERBVIEW_FRAME::PrintPage( wxDC* aDC, LAYER_MSK aPrintMasklayer,
void GERBVIEW_FRAME::PrintPage( wxDC* aDC, LSET aPrintMasklayer,
bool aPrintMirrorMode, void* aData )
{
// Save current draw options, because print mode has specific options:
LAYER_MSK visiblemask = GetVisibleLayers();
LSET visiblemask = GetVisibleLayers();
GBR_DISPLAY_OPTIONS imgDisplayOptions = m_DisplayOptions;
// Set draw options for printing:
......
......@@ -551,7 +551,7 @@ void GERBVIEW_FRAME::SetVisibleAlls()
* Returns a bit-mask of all the layers that are visible
* @return int - the visible layers in bit-mapped form.
*/
LAYER_MSK GERBVIEW_FRAME::GetVisibleLayers() const
LSET GERBVIEW_FRAME::GetVisibleLayers() const
{
return FULL_LAYERS; // TODO
}
......@@ -563,7 +563,7 @@ LAYER_MSK GERBVIEW_FRAME::GetVisibleLayers() const
* changes the bit-mask of visible layers
* @param aLayerMask = The new bit-mask of visible layers
*/
void GERBVIEW_FRAME::SetVisibleLayers( LAYER_MSK aLayerMask )
void GERBVIEW_FRAME::SetVisibleLayers( LSET aLayerMask )
{
GetGerberLayout()->SetVisibleLayers( aLayerMask );
}
......
......@@ -308,7 +308,7 @@ public:
* Returns a bit-mask of all the layers that are visible
* @return int - the visible layers in bit-mapped form.
*/
LAYER_MSK GetVisibleLayers() const;
LSET GetVisibleLayers() const;
/**
* Function SetVisibleLayers
......@@ -316,7 +316,7 @@ public:
* changes the bit-mask of visible layers
* @param aLayerMask = The new bit-mask of visible layers
*/
void SetVisibleLayers( LAYER_MSK aLayerMask );
void SetVisibleLayers( LSET aLayerMask );
/**
* Function IsLayerVisible
......@@ -667,7 +667,7 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMasklayer, bool aPrintMirrorMode,
virtual void PrintPage( wxDC* aDC, LSET aPrintMasklayer, bool aPrintMirrorMode,
void* aData = NULL );
/**
......
......@@ -128,7 +128,7 @@ void LAYERS_MAP_DIALOG::initDialog()
if( (pcb_layer_num == m_exportBoardCopperLayersCount - 1)
&& (m_exportBoardCopperLayersCount > 1) )
pcb_layer_num = LAYER_N_FRONT;
pcb_layer_num = F_Cu;
m_buttonTable[m_itemsCount] = ii;
m_layersLookUpTable[ii] = pcb_layer_num;
......@@ -288,7 +288,7 @@ void LAYERS_MAP_DIALOG::OnResetClick( wxCommandEvent& event )
{
if( (layer == m_exportBoardCopperLayersCount - 1)
&& (m_exportBoardCopperLayersCount > 1) )
layer = LAYER_N_FRONT;
layer = F_Cu;
m_layersLookUpTable[ii] = layer;
msg = GetPCBDefaultLayerName( layer );
m_layersList[ii]->SetLabel( msg );
......@@ -362,7 +362,7 @@ void LAYERS_MAP_DIALOG::OnSelectLayer( wxCommandEvent& event )
LAYER_NUM jj = m_layersLookUpTable[m_buttonTable[ii]];
if( !IsValidLayer( jj ) )
jj = LAYER_N_BACK; // (Defaults to "Copper" layer.)
jj = B_Cu; // (Defaults to "Copper" layer.)
jj = m_Parent->SelectPCBLayer( jj, m_exportBoardCopperLayersCount, true );
......@@ -408,7 +408,7 @@ void LAYERS_MAP_DIALOG::OnOkClick( wxCommandEvent& event )
int inner_layer_max = 0;
for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii )
{
if( m_layersLookUpTable[ii] < LAYER_N_FRONT )
if( m_layersLookUpTable[ii] < F_Cu )
{
if( m_layersLookUpTable[ii ] > inner_layer_max )
inner_layer_max = m_layersLookUpTable[ii];
......
......@@ -47,6 +47,7 @@ struct VIA_DIMENSION
}
};
/**
* Class BOARD_DESIGN_SETTINGS
* contains design settings for a BOARD object.
......@@ -326,7 +327,7 @@ public:
* returns a bit-mask of all the layers that are visible
* @return int - the visible layers in bit-mapped form.
*/
inline LAYER_MSK GetVisibleLayers() const
inline LSET GetVisibleLayers() const
{
return m_visibleLayers;
}
......@@ -343,30 +344,30 @@ public:
* changes the bit-mask of visible layers
* @param aMask = The new bit-mask of visible layers
*/
inline void SetVisibleLayers( LAYER_MSK aMask )
inline void SetVisibleLayers( LSET aMask )
{
m_visibleLayers = aMask & m_enabledLayers & FULL_LAYERS;
m_visibleLayers = aMask & m_enabledLayers;
}
/**
* Function IsLayerVisible
* tests whether a given layer is visible
* @param aLayer = The layer to be tested
* @param aLayerId = The layer to be tested
* @return bool - true if the layer is visible.
*/
inline bool IsLayerVisible( LAYER_NUM aLayer ) const
inline bool IsLayerVisible( LAYER_ID aLayerId ) const
{
// If a layer is disabled, it is automatically invisible
return m_visibleLayers & m_enabledLayers & GetLayerMask( aLayer );
return (m_visibleLayers & m_enabledLayers)[aLayerId];
}
/**
* Function SetLayerVisibility
* changes the visibility of a given layer
* @param aLayer = The layer to be changed
* @param aLayerId = The layer to be changed
* @param aNewState = The new visibility state of the layer
*/
void SetLayerVisibility( LAYER_NUM aLayer, bool aNewState );
void SetLayerVisibility( LAYER_ID aLayerId, bool aNewState );
/**
* Function GetVisibleElements
......@@ -417,7 +418,7 @@ public:
* returns a bit-mask of all the layers that are enabled
* @return int - the enabled layers in bit-mapped form.
*/
inline LAYER_MSK GetEnabledLayers() const
inline LSET GetEnabledLayers() const
{
return m_enabledLayers;
}
......@@ -427,17 +428,17 @@ public:
* changes the bit-mask of enabled layers
* @param aMask = The new bit-mask of enabled layers
*/
void SetEnabledLayers( LAYER_MSK aMask );
void SetEnabledLayers( LSET aMask );
/**
* Function IsLayerEnabled
* tests whether a given layer is enabled
* @param aLayer = The of the layer to be tested
* @param aLayerId = The layer to be tested
* @return bool - true if the layer is enabled
*/
inline bool IsLayerEnabled( LAYER_NUM aLayer ) const
inline bool IsLayerEnabled( LAYER_ID aLayerId ) const
{
return m_enabledLayers & GetLayerMask( aLayer );
return m_enabledLayers[aLayerId];
}
/**
......@@ -486,8 +487,10 @@ private:
VIA_DIMENSION m_customViaSize;
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
LSET m_enabledLayers; ///< Bit-mask for layer enabling
LSET m_visibleLayers; ///< Bit-mask for layer visibility
int m_visibleElements; ///< Bit-mask for element category visibility
int m_boardThickness; ///< Board thickness for 3D viewer
......
......@@ -76,12 +76,12 @@ class BOARD_ITEM : public EDA_ITEM
void SetBack( EDA_ITEM* aBack ) { Pback = aBack; }
protected:
LAYER_NUM m_Layer;
LAYER_ID m_Layer;
public:
BOARD_ITEM( BOARD_ITEM* aParent, KICAD_T idtype ) :
EDA_ITEM( aParent, idtype ), m_Layer( FIRST_LAYER )
EDA_ITEM( aParent, idtype ), m_Layer( F_Cu )
{
}
......@@ -114,7 +114,7 @@ public:
* Function GetLayer
* returns the layer this item is on.
*/
LAYER_NUM GetLayer() const { return m_Layer; }
LAYER_ID GetLayer() const { return m_Layer; }
/**
* Function SetLayer
......@@ -123,7 +123,7 @@ public:
* is virtual because some items (in fact: class DIMENSION)
* have a slightly different initialization
*/
virtual void SetLayer( LAYER_NUM aLayer )
virtual void SetLayer( LAYER_ID aLayer )
{
// trap any invalid layers, then go find the caller and fix it.
// wxASSERT( unsigned( aLayer ) < unsigned( NB_PCB_LAYERS ) );
......
......@@ -7,8 +7,6 @@
#define _COLORS_DESIGN_SETTING_H
#include <layers_id_colors_and_visibility.h>
#define LAYERSCOLORSBUFFERSIZE NB_LAYERS
#define ITEMSCOLORSBUFFERSIZE 32
/**
* Class COLORS_DESIGN_SETTINGS
......@@ -20,10 +18,10 @@ public:
// Color options for screen display of the Printed Board and schematic:
// Common to Eeschema, Pcbnew, GerbView
EDA_COLOR_T m_LayersColors[LAYERSCOLORSBUFFERSIZE]; ///< Layer colors (tracks and graphic items)
EDA_COLOR_T m_LayersColors[LAYER_ID_COUNT]; ///< Layer colors (tracks and graphic items)
// Common to Eeschema, Pcbnew
EDA_COLOR_T m_ItemsColors[ITEMSCOLORSBUFFERSIZE]; ///< All others items but layers
EDA_COLOR_T m_ItemsColors[32]; ///< All others items but layers
public:
COLORS_DESIGN_SETTINGS();
......
......@@ -15,7 +15,6 @@ class LAYER_SELECTOR
{
protected:
bool m_layerhotkeys;
bool m_layerorder;
public:
// Hotkey Info
......@@ -41,12 +40,13 @@ public:
protected:
// Fills the layer bitmap aLayerbmp with the layer color
void SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer );
void SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_ID aLayer );
};
/* class to display a layer list in a wxBitmapComboBox.
*/
class LAYER_BOX_SELECTOR :public wxBitmapComboBox, public LAYER_SELECTOR
class LAYER_BOX_SELECTOR : public wxBitmapComboBox, public LAYER_SELECTOR
{
public:
// Hotkey Info
......@@ -69,7 +69,7 @@ public:
LAYER_NUM GetLayerSelection() const;
// Set Layer #
int SetLayerSelection(LAYER_NUM layer);
int SetLayerSelection( LAYER_NUM layer );
// Reload the Layers
// Virtual pure function because GerbView uses its own functions in a derived class
......@@ -79,23 +79,4 @@ public:
void ResyncBitmapOnly();
};
#define DECLARE_LAYERS_HOTKEY(list) int list[NB_LAYERS] = \
{ \
HK_SWITCH_LAYER_TO_COPPER, \
HK_SWITCH_LAYER_TO_INNER1, \
HK_SWITCH_LAYER_TO_INNER2, \
HK_SWITCH_LAYER_TO_INNER3, \
HK_SWITCH_LAYER_TO_INNER4, \
HK_SWITCH_LAYER_TO_INNER5, \
HK_SWITCH_LAYER_TO_INNER6, \
HK_SWITCH_LAYER_TO_INNER7, \
HK_SWITCH_LAYER_TO_INNER8, \
HK_SWITCH_LAYER_TO_INNER9, \
HK_SWITCH_LAYER_TO_INNER10, \
HK_SWITCH_LAYER_TO_INNER11, \
HK_SWITCH_LAYER_TO_INNER12, \
HK_SWITCH_LAYER_TO_INNER13, \
HK_SWITCH_LAYER_TO_INNER14, \
HK_SWITCH_LAYER_TO_COMPONENT \
};
#endif //CLASS_LAYER_BOX_SELECTOR_H
#endif // CLASS_LAYER_BOX_SELECTOR_H
......@@ -17,9 +17,9 @@ class UNDO_REDO_CONTAINER;
class PCB_SCREEN : public BASE_SCREEN
{
public:
LAYER_NUM m_Active_Layer;
LAYER_NUM m_Route_Layer_TOP;
LAYER_NUM m_Route_Layer_BOTTOM;
LAYER_ID m_Active_Layer;
LAYER_ID m_Route_Layer_TOP;
LAYER_ID m_Route_Layer_BOTTOM;
public:
......
......@@ -613,7 +613,7 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMask, bool aPrintMirrorMode, void* aData = NULL );
virtual void PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode, void* aData = NULL );
/**
* Function CoordinateToString
......
This diff is collapsed.
......@@ -18,9 +18,6 @@ class TRACK;
class BOARD;
class DISPLAY_OPTIONS;
/// Look up Table for conversion copper layer count -> general copper layer mask:
extern LAYER_MSK g_TabAllCopperLayerMask[NB_COPPER_LAYERS];
extern DISPLAY_OPTIONS DisplayOpt;
extern int g_CurrentVersionPCB;
......
......@@ -606,8 +606,8 @@ public:
* @param aDlgPosition = position of dialog ( defualt = centered)
* @return the selected layer id
*/
LAYER_NUM SelectLayer( LAYER_NUM aDefaultLayer,
LAYER_MSK aNotAllowedLayersMask = 0,
LAYER_ID SelectLayer( LAYER_ID aDefaultLayer,
LSET aNotAllowedLayersMask = 0,
wxPoint aDlgPosition = wxDefaultPosition );
/* Display a list of two copper layers to choose a pair of copper layers
......@@ -615,7 +615,7 @@ public:
*/
void SelectCopperLayerPair();
virtual void SwitchLayer( wxDC* DC, LAYER_NUM layer );
virtual void SwitchLayer( wxDC* DC, LAYER_ID layer );
void LoadSettings( wxConfigBase* aCfg ); // override virtual
void SaveSettings( wxConfigBase* aCfg ); // override virtual
......
......@@ -1257,7 +1257,7 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMask,
virtual void PrintPage( wxDC* aDC, LSET aPrintMask,
bool aPrintMirrorMode, void* aData = NULL );
void SetSimulatorCommand( const wxString& aCommand ) { m_simulatorCommand = aCommand; }
......
......@@ -283,8 +283,8 @@ public:
* @param aPrintMirrorMode = true to plot mirrored
* @param aData = a pointer on an auxiliary data (NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMaskLayer, bool aPrintMirrorMode,
void * aData = NULL );
virtual void PrintPage( wxDC* aDC, LSET aPrintMaskLayer, bool aPrintMirrorMode,
void* aData = NULL );
void GetKicadAbout( wxCommandEvent& event );
......@@ -535,26 +535,26 @@ public:
* Function SetHighContrastLayer
* takes care of display settings for the given layer to be displayed in high contrast mode.
*/
void SetHighContrastLayer( LAYER_NUM aLayer );
void SetHighContrastLayer( LAYER_ID aLayer );
/**
* Function SetTopLayer
* moves the selected layer to the top, so it is displayed above all others.
*/
void SetTopLayer( LAYER_NUM aLayer );
void SetTopLayer( LAYER_ID aLayer );
/**
* Function SetActiveLayer
* will change the currently active layer to \a aLayer and also
* update the PCB_LAYER_WIDGET.
*/
void SetActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate = true );
void SetActiveLayer( LAYER_ID aLayer, bool doLayerWidgetUpdate = true );
/**
* Function GetActiveLayer
* returns the active layer
*/
LAYER_NUM GetActiveLayer() const
LAYER_ID GetActiveLayer() const
{
return ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer;
}
......@@ -784,8 +784,6 @@ public:
void InstallDisplayOptionsDialog( wxCommandEvent& aEvent );
void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
void InstallDialogLayerSetup();
/**
* Function GenFootprintsPositionFile
* Calls DoGenFootprintsPositionFile to create a footprint position file
......@@ -1263,7 +1261,7 @@ public:
bool MergeCollinearTracks( TRACK* track, wxDC* DC, int end );
void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC );
void SwitchLayer( wxDC* DC, LAYER_NUM layer );
void SwitchLayer( wxDC* DC, LAYER_ID layer );
/**
* Function Add45DegreeSegment
......@@ -1463,7 +1461,7 @@ public:
DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, STROKE_T shape, wxDC* DC );
void End_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Delete_Drawings_All_Layer( LAYER_NUM aLayer );
void Delete_Drawings_All_Layer( LAYER_ID aLayer );
// Dimension handling:
void ShowDimensionPropertyDialog( DIMENSION* aDimension, wxDC* aDC );
......
......@@ -496,7 +496,7 @@ void PL_EDITOR_FRAME::UpdateStatusBar()
// Display units
}
void PL_EDITOR_FRAME::PrintPage( wxDC* aDC, LAYER_MSK aPrintMasklayer,
void PL_EDITOR_FRAME::PrintPage( wxDC* aDC, LSET aPrintMasklayer,
bool aPrintMirrorMode, void * aData )
{
GetScreen()-> m_ScreenNumber = GetPageNumberOption() ? 1 : 2;
......
......@@ -263,7 +263,7 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMasklayer,
virtual void PrintPage( wxDC* aDC, LSET aPrintMasklayer,
bool aPrintMirrorMode, void * aData );
void OnFileHistory( wxCommandEvent& event );
......
......@@ -122,7 +122,7 @@ static void drawPlacementRoutingMatrix( BOARD* aBrd, wxDC* DC );
static int TstModuleOnBoard( BOARD* Pcb, MODULE* Module, bool TstOtherSide );
static void CreateKeepOutRectangle( int ux0, int uy0, int ux1, int uy1,
int marge, int aKeepOut, int aLayerMask );
int marge, int aKeepOut, LSET aLayerMask );
static MODULE* PickModule( PCB_EDIT_FRAME* pcbframe, wxDC* DC );
static int propagate();
......@@ -133,7 +133,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
wxPoint PosOK;
wxPoint memopos;
int error;
LAYER_NUM lay_tmp_TOP, lay_tmp_BOTTOM;
LAYER_ID lay_tmp_TOP, lay_tmp_BOTTOM;
// Undo: init list
PICKED_ITEMS_LIST newList;
......@@ -488,12 +488,12 @@ int genPlacementRoutingMatrix( BOARD* aBrd, EDA_MSG_PANEL* messagePanel )
msg.Printf( wxT( "%d" ), RoutingMatrix.m_MemSize / 1024 );
messagePanel->SetMessage( 24, wxT( "Mem(Kb)" ), msg, CYAN );
g_Route_Layer_BOTTOM = LAYER_N_FRONT;
g_Route_Layer_BOTTOM = F_Cu;
if( RoutingMatrix.m_RoutingLayersCount > 1 )
g_Route_Layer_BOTTOM = LAYER_N_BACK;
g_Route_Layer_BOTTOM = B_Cu;
g_Route_Layer_TOP = LAYER_N_FRONT;
g_Route_Layer_TOP = F_Cu;
// Place the edge layer segments
TRACK TmpSegm( NULL );
......@@ -513,7 +513,7 @@ int genPlacementRoutingMatrix( BOARD* aBrd, EDA_MSG_PANEL* messagePanel )
case PCB_LINE_T:
DrawSegm = (DRAWSEGMENT*) PtStruct;
if( DrawSegm->GetLayer() != EDGE_N )
if( DrawSegm->GetLayer() != Edge_Cuts )
break;
TraceSegmentPcb( DrawSegm, HOLE | CELL_is_EDGE,
......@@ -550,7 +550,7 @@ int genPlacementRoutingMatrix( BOARD* aBrd, EDA_MSG_PANEL* messagePanel )
void genModuleOnRoutingMatrix( MODULE* Module )
{
int ox, oy, fx, fy;
int layerMask;
LSET layerMask;
D_PAD* Pad;
EDA_RECT fpBBox = Module->GetBoundingBox();
......@@ -585,13 +585,11 @@ void genModuleOnRoutingMatrix( MODULE* Module )
if( fy > RoutingMatrix.m_BrdBox.GetBottom() )
fy = RoutingMatrix.m_BrdBox.GetBottom();
layerMask = 0;
if( Module->GetLayer() == F_Cu )
layerMask.set( F_Cu );
if( Module->GetLayer() == LAYER_N_FRONT )
layerMask = LAYER_FRONT;
if( Module->GetLayer() == LAYER_N_BACK )
layerMask = LAYER_BACK;
if( Module->GetLayer() == B_Cu )
layerMask.set( B_Cu );
TraceFilledRectangle( ox, oy, fx, fy, layerMask,
CELL_is_MODULE, WRITE_OR_CELL );
......@@ -666,15 +664,11 @@ int getOptimalModulePlacement( PCB_EDIT_FRAME* aFrame, MODULE* aModule, wxDC* aD
if( RoutingMatrix.m_RoutingLayersCount > 1 )
{
D_PAD* Pad;
int otherLayerMask = LAYER_BACK;
if( aModule->GetLayer() == LAYER_N_BACK )
otherLayerMask = LAYER_FRONT;
LSET other( aModule->GetLayer() == B_Cu ? F_Cu : B_Cu );
for( Pad = aModule->Pads(); Pad != NULL; Pad = Pad->Next() )
for( D_PAD* pad = aModule->Pads(); pad; pad = pad->Next() )
{
if( ( Pad->GetLayerMask() & otherLayerMask ) == 0 )
if( !( pad->GetLayerSet() & other ).any() )
continue;
TstOtherSide = true;
......@@ -875,7 +869,7 @@ int TstModuleOnBoard( BOARD* Pcb, MODULE* aModule, bool TstOtherSide )
int side = TOP;
int otherside = BOTTOM;
if( aModule->GetLayer() == LAYER_N_BACK )
if( aModule->GetLayer() == B_Cu )
{
side = BOTTOM; otherside = TOP;
}
......@@ -966,7 +960,7 @@ double compute_Ratsnest_PlaceModule( BOARD* aBrd )
* Therefore the cost is high in rect x0,y0 to x1,y1, and decrease outside this rectangle
*/
void CreateKeepOutRectangle( int ux0, int uy0, int ux1, int uy1,
int marge, int aKeepOut, int aLayerMask )
int marge, int aKeepOut, LSET aLayerMask )
{
int row, col;
int row_min, row_max, col_min, col_max, pmarge;
......@@ -974,10 +968,10 @@ void CreateKeepOutRectangle( int ux0, int uy0, int ux1, int uy1,
DIST_CELL data, LocalKeepOut;
int lgain, cgain;
if( aLayerMask & GetLayerMask( g_Route_Layer_BOTTOM ) )
if( aLayerMask[g_Route_Layer_BOTTOM] )
trace = 1; // Trace on bottom layer.
if( ( aLayerMask & GetLayerMask( g_Route_Layer_TOP ) ) && RoutingMatrix.m_RoutingLayersCount )
if( aLayerMask[g_Route_Layer_TOP] && RoutingMatrix.m_RoutingLayersCount )
trace |= 2; // Trace on top layer.
if( trace == 0 )
......
......@@ -66,7 +66,7 @@ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode )
}
else
{
g_Route_Layer_TOP = g_Route_Layer_BOTTOM = LAYER_N_BACK;
g_Route_Layer_TOP = g_Route_Layer_BOTTOM = B_Cu;
}
switch( mode )
......
......@@ -206,12 +206,12 @@ void TraceSegmentPcb( DRAWSEGMENT* pt_segm, int type, int marge, int op_logic );
* op_logic = WRITE_CELL, WRITE_OR_CELL, WRITE_XOR_CELL, WRITE_AND_CELL
*/
void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1,
int side, int color, int op_logic);
LSET side, int color, int op_logic);
/* Same as above, but the rectangle is inclined angle angle. */
void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1,
double angle, LAYER_MSK masque_layer,
double angle, LSET masque_layer,
int color, int op_logic );
/* QUEUE.CPP */
......
......@@ -59,7 +59,7 @@ static void DrawSegmentQcq( int ux0, int uy0,
int op_logic );
static void TraceFilledCircle( int cx, int cy, int radius,
LAYER_MSK aLayerMask,
LSET aLayerMask,
int color,
int op_logic );
......@@ -96,7 +96,7 @@ void PlacePad( D_PAD* aPad, int color, int marge, int op_logic )
if( aPad->GetShape() == PAD_CIRCLE )
{
TraceFilledCircle( shape_pos.x, shape_pos.y, dx,
aPad->GetLayerMask(), color, op_logic );
aPad->GetLayerSet(), color, op_logic );
return;
}
......@@ -120,14 +120,14 @@ void PlacePad( D_PAD* aPad, int color, int marge, int op_logic )
TraceFilledRectangle( shape_pos.x - dx, shape_pos.y - dy,
shape_pos.x + dx, shape_pos.y + dy,
aPad->GetLayerMask(), color, op_logic );
aPad->GetLayerSet(), color, op_logic );
}
else
{
TraceFilledRectangle( shape_pos.x - dx, shape_pos.y - dy,
shape_pos.x + dx, shape_pos.y + dy,
aPad->GetOrientation(),
aPad->GetLayerMask(), color, op_logic );
aPad->GetLayerSet(), color, op_logic );
}
}
......@@ -141,9 +141,7 @@ void PlacePad( D_PAD* aPad, int color, int marge, int op_logic )
* op_logic: type of writing in the cell (WRITE, OR)
*/
void TraceFilledCircle( int cx, int cy, int radius,
LAYER_MSK aLayerMask,
int color,
int op_logic )
LSET aLayerMask, int color, int op_logic )
{
int row, col;
int ux0, uy0, ux1, uy1;
......@@ -153,10 +151,10 @@ void TraceFilledCircle( int cx, int cy, int radius,
int tstwrite = 0;
int distmin;
if( aLayerMask & GetLayerMask( g_Route_Layer_BOTTOM ) )
if( aLayerMask[g_Route_Layer_BOTTOM] )
trace = 1; // Trace on BOTTOM
if( aLayerMask & GetLayerMask( g_Route_Layer_TOP ) )
if( aLayerMask[g_Route_Layer_TOP] )
if( RoutingMatrix.m_RoutingLayersCount > 1 )
trace |= 2; // Trace on TOP
......@@ -297,23 +295,23 @@ void TraceSegmentPcb( TRACK* aTrack, int color, int marge, int op_logic )
// Test if VIA (filled circle need to be drawn)
if( aTrack->Type() == PCB_VIA_T )
{
LAYER_MSK layer_mask = NO_LAYERS;
LSET layer_mask;
if( aTrack->IsOnLayer( g_Route_Layer_BOTTOM ) )
layer_mask = GetLayerMask( g_Route_Layer_BOTTOM );
layer_mask.set( g_Route_Layer_BOTTOM );
if( aTrack->IsOnLayer( g_Route_Layer_TOP ) )
{
if( layer_mask == 0 )
layer_mask = GetLayerMask( g_Route_Layer_TOP );
if( !layer_mask.any() )
layer_mask = LSET( g_Route_Layer_TOP );
else
layer_mask = FULL_LAYERS;
layer_mask.set();
}
if( color == VIA_IMPOSSIBLE )
layer_mask = FULL_LAYERS;
layer_mask.set();
if( layer_mask )
if( layer_mask.any() )
TraceFilledCircle( aTrack->GetStart().x, aTrack->GetStart().y,
half_width, layer_mask, color, op_logic );
}
......@@ -326,7 +324,7 @@ void TraceSegmentPcb( TRACK* aTrack, int color, int marge, int op_logic )
int uy1 = aTrack->GetEnd().y - RoutingMatrix.GetBrdCoordOrigin().y;
// Ordinary track
LAYER_NUM layer = aTrack->GetLayer();
LAYER_ID layer = aTrack->GetLayer();
if( color == VIA_IMPOSSIBLE )
layer = UNDEFINED_LAYER;
......@@ -478,17 +476,16 @@ void TracePcbLine( int x0, int y0, int x1, int y1, LAYER_NUM layer, int color, i
void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1,
int aLayerMask, int color, int op_logic )
LSET aLayerMask, int color, int op_logic )
{
int row, col;
int row_min, row_max, col_min, col_max;
int trace = 0;
if( ( aLayerMask & GetLayerMask( g_Route_Layer_BOTTOM ) ) )
if( aLayerMask[g_Route_Layer_BOTTOM] )
trace = 1; // Trace on BOTTOM
if( ( aLayerMask & GetLayerMask( g_Route_Layer_TOP ) ) &&
RoutingMatrix.m_RoutingLayersCount > 1 )
if( aLayerMask[g_Route_Layer_TOP] && RoutingMatrix.m_RoutingLayersCount > 1 )
trace |= 2; // Trace on TOP
if( trace == 0 )
......@@ -541,7 +538,7 @@ void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1,
void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1,
double angle, LAYER_MSK aLayerMask, int color, int op_logic )
double angle, LSET aLayerMask, int color, int op_logic )
{
int row, col;
int cx, cy; // Center of rectangle
......@@ -550,10 +547,10 @@ void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1,
int rotrow, rotcol;
int trace = 0;
if( aLayerMask & GetLayerMask( g_Route_Layer_BOTTOM ) )
if( aLayerMask[g_Route_Layer_BOTTOM] )
trace = 1; // Trace on BOTTOM
if( aLayerMask & GetLayerMask( g_Route_Layer_TOP ) )
if( aLayerMask[g_Route_Layer_TOP] )
{
if( RoutingMatrix.m_RoutingLayersCount > 1 )
trace |= 2; // Trace on TOP
......
......@@ -115,7 +115,7 @@ int MATRIX_ROUTING_HEAD::InitRoutingMatrix()
m_DistSide[side] = NULL;
m_DirSide[side] = NULL;
/* allocate matrix & initialize everything to empty */
// allocate matrix & initialize everything to empty
m_BoardSide[side] = (MATRIX_CELL*) operator new( ii * sizeof(MATRIX_CELL) );
memset( m_BoardSide[side], 0, ii * sizeof(MATRIX_CELL) );
......@@ -198,7 +198,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
{
int ux0 = 0, uy0 = 0, ux1, uy1, dx, dy;
int marge, via_marge;
LAYER_MSK layerMask;
LSET layerMask;
// use the default NETCLASS?
NETCLASSPTR nc = aPcb->GetDesignSettings().GetDefault();
......@@ -237,7 +237,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
EDGE_MODULE* edge = (EDGE_MODULE*) item;
EDGE_MODULE tmpEdge( *edge );
if( tmpEdge.GetLayer() == EDGE_N )
if( tmpEdge.GetLayer() == Edge_Cuts )
tmpEdge.SetLayer( UNDEFINED_LAYER );
TraceSegmentPcb( &tmpEdge, HOLE, marge, WRITE_CELL );
......@@ -264,7 +264,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
DrawSegm = (DRAWSEGMENT*) item;
DRAWSEGMENT tmpSegm( DrawSegm );
if( DrawSegm->GetLayer() == EDGE_N )
if( DrawSegm->GetLayer() == Edge_Cuts )
{
tmpSegm.SetLayer( UNDEFINED_LAYER );
type_cell |= CELL_is_EDGE;
......@@ -276,8 +276,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
case PCB_TEXT_T:
{
TEXTE_PCB* PtText;
PtText = (TEXTE_PCB*) item;
TEXTE_PCB* PtText = (TEXTE_PCB*) item;
if( PtText->GetText().Length() == 0 )
break;
......@@ -288,7 +287,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
dx = textbox.GetWidth();
dy = textbox.GetHeight();
/* Put bounding box (rectangle) on matrix */
// Put bounding box (rectangle) on matrix
dx /= 2;
dy /= 2;
......@@ -298,7 +297,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
ux0 -= dx;
uy0 -= dy;
layerMask = GetLayerMask( PtText->GetLayer() );
layerMask = LSET( PtText->GetLayer() );
TraceFilledRectangle( ux0 - marge, uy0 - marge, ux1 + marge,
uy1 + marge, PtText->GetOrientation(),
......@@ -316,7 +315,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
}
}
/* Put tracks and vias on matrix */
// Put tracks and vias on matrix
for( TRACK* track = aPcb->m_Track; track; track = track->Next() )
{
if( net_code == track->GetNetCode() )
......@@ -337,7 +336,7 @@ int Build_Work( BOARD* Pcb )
int demi_pas = RoutingMatrix.m_GridRouting / 2;
wxString msg;
InitWork(); /* clear work list */
InitWork(); // clear work list
int cellCount = 0;
for( unsigned ii = 0; ii < Pcb->GetRatsnestsCount(); ii++ )
......@@ -509,8 +508,8 @@ void MATRIX_ROUTING_HEAD::AddCell( int aRow, int aCol, int aSide, MATRIX_CELL x
}
/* fetch distance cell */
DIST_CELL MATRIX_ROUTING_HEAD::GetDist( int aRow, int aCol, int aSide ) /* fetch distance cell */
// fetch distance cell
DIST_CELL MATRIX_ROUTING_HEAD::GetDist( int aRow, int aCol, int aSide ) // fetch distance cell
{
DIST_CELL* p;
......@@ -519,7 +518,7 @@ DIST_CELL MATRIX_ROUTING_HEAD::GetDist( int aRow, int aCol, int aSide ) /* fetch
}
/* store distance cell */
// store distance cell
void MATRIX_ROUTING_HEAD::SetDist( int aRow, int aCol, int aSide, DIST_CELL x )
{
DIST_CELL* p;
......@@ -529,7 +528,7 @@ void MATRIX_ROUTING_HEAD::SetDist( int aRow, int aCol, int aSide, DIST_CELL x )
}
/* fetch direction cell */
// fetch direction cell
int MATRIX_ROUTING_HEAD::GetDir( int aRow, int aCol, int aSide )
{
DIR_CELL* p;
......@@ -539,7 +538,7 @@ int MATRIX_ROUTING_HEAD::GetDir( int aRow, int aCol, int aSide )
}
/* store direction cell */
// store direction cell
void MATRIX_ROUTING_HEAD::SetDir( int aRow, int aCol, int aSide, int x )
{
DIR_CELL* p;
......
This diff is collapsed.
......@@ -64,24 +64,26 @@
#include <tool/tool_dispatcher.h>
// Configuration entry names.
static const wxString UserGridSizeXEntry( wxT( "PcbUserGrid_X" ) );
static const wxString UserGridSizeYEntry( wxT( "PcbUserGrid_Y" ) );
static const wxString UserGridUnitsEntry( wxT( "PcbUserGrid_Unit" ) );
static const wxString DisplayPadFillEntry( wxT( "DiPadFi" ) );
static const wxString DisplayViaFillEntry( wxT( "DiViaFi" ) );
static const wxString DisplayPadNumberEntry( wxT( "DiPadNu" ) );
static const wxString DisplayModuleEdgeEntry( wxT( "DiModEd" ) );
static const wxString DisplayModuleTextEntry( wxT( "DiModTx" ) );
static const wxString FastGrid1Entry( wxT( "FastGrid1" ) );
static const wxString FastGrid2Entry( wxT( "FastGrid2" ) );
static const wxChar UserGridSizeXEntry[] = wxT( "PcbUserGrid_X" );
static const wxChar UserGridSizeYEntry[] = wxT( "PcbUserGrid_Y" );
static const wxChar UserGridUnitsEntry[] = wxT( "PcbUserGrid_Unit" );
static const wxChar DisplayPadFillEntry[] = wxT( "DiPadFi" );
static const wxChar DisplayViaFillEntry[] = wxT( "DiViaFi" );
static const wxChar DisplayPadNumberEntry[] = wxT( "DiPadNu" );
static const wxChar DisplayModuleEdgeEntry[] = wxT( "DiModEd" );
static const wxChar DisplayModuleTextEntry[] = wxT( "DiModTx" );
static const wxChar FastGrid1Entry[] = wxT( "FastGrid1" );
static const wxChar FastGrid2Entry[] = wxT( "FastGrid2" );
const LAYER_NUM PCB_BASE_FRAME::GAL_LAYER_ORDER[] =
{
ITEM_GAL_LAYER( GP_OVERLAY ),
ITEM_GAL_LAYER( DRC_VISIBLE ),
NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ),
DRAW_N, COMMENT_N, ECO1_N, ECO2_N, EDGE_N,
UNUSED_LAYER_29, UNUSED_LAYER_30, UNUSED_LAYER_31,
Dwgs_User, Cmts_User, Eco1_User, Eco2_User, Edge_Cuts,
// UNUSED_LAYER_29, UNUSED_LAYER_30, UNUSED_LAYER_31,
ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE ),
ITEM_GAL_LAYER( MOD_REFERENCES_VISIBLE), ITEM_GAL_LAYER( MOD_VALUES_VISIBLE ),
......@@ -89,9 +91,11 @@ const LAYER_NUM PCB_BASE_FRAME::GAL_LAYER_ORDER[] =
ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ),
ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ),
NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ), SOLDERMASK_N_FRONT,
NETNAMES_GAL_LAYER( LAYER_16_NETNAMES_VISIBLE ), LAYER_N_FRONT,
SILKSCREEN_N_FRONT, SOLDERPASTE_N_FRONT, ADHESIVE_N_FRONT,
NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ), F_Mask,
NETNAMES_GAL_LAYER( F_Cu ), F_Cu,
F_SilkS, F_Paste, F_Adhes,
#if 0 // was:
NETNAMES_GAL_LAYER( LAYER_15_NETNAMES_VISIBLE ), LAYER_N_15,
NETNAMES_GAL_LAYER( LAYER_14_NETNAMES_VISIBLE ), LAYER_N_14,
NETNAMES_GAL_LAYER( LAYER_13_NETNAMES_VISIBLE ), LAYER_N_13,
......@@ -106,14 +110,48 @@ const LAYER_NUM PCB_BASE_FRAME::GAL_LAYER_ORDER[] =
NETNAMES_GAL_LAYER( LAYER_4_NETNAMES_VISIBLE ), LAYER_N_4,
NETNAMES_GAL_LAYER( LAYER_3_NETNAMES_VISIBLE ), LAYER_N_3,
NETNAMES_GAL_LAYER( LAYER_2_NETNAMES_VISIBLE ), LAYER_N_2,
NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_BK_VISIBLE ), SOLDERMASK_N_BACK,
NETNAMES_GAL_LAYER( LAYER_1_NETNAMES_VISIBLE ), LAYER_N_BACK,
#else
ADHESIVE_N_BACK, SOLDERPASTE_N_BACK, SILKSCREEN_N_BACK,
NETNAMES_GAL_LAYER( In1_Cu ), In1_Cu,
NETNAMES_GAL_LAYER( In2_Cu ), In2_Cu,
NETNAMES_GAL_LAYER( In3_Cu ), In3_Cu,
NETNAMES_GAL_LAYER( In4_Cu ), In4_Cu,
NETNAMES_GAL_LAYER( In5_Cu ), In5_Cu,
NETNAMES_GAL_LAYER( In6_Cu ), In6_Cu,
NETNAMES_GAL_LAYER( In7_Cu ), In7_Cu,
NETNAMES_GAL_LAYER( In8_Cu ), In8_Cu,
NETNAMES_GAL_LAYER( In9_Cu ), In9_Cu,
NETNAMES_GAL_LAYER( In10_Cu ), In10_Cu,
NETNAMES_GAL_LAYER( In11_Cu ), In11_Cu,
NETNAMES_GAL_LAYER( In12_Cu ), In12_Cu,
NETNAMES_GAL_LAYER( In13_Cu ), In13_Cu,
NETNAMES_GAL_LAYER( In14_Cu ), In14_Cu,
NETNAMES_GAL_LAYER( In15_Cu ), In15_Cu,
NETNAMES_GAL_LAYER( In16_Cu ), In16_Cu,
NETNAMES_GAL_LAYER( In17_Cu ), In17_Cu,
NETNAMES_GAL_LAYER( In18_Cu ), In18_Cu,
NETNAMES_GAL_LAYER( In19_Cu ), In19_Cu,
NETNAMES_GAL_LAYER( In20_Cu ), In20_Cu,
NETNAMES_GAL_LAYER( In21_Cu ), In21_Cu,
NETNAMES_GAL_LAYER( In22_Cu ), In22_Cu,
NETNAMES_GAL_LAYER( In23_Cu ), In23_Cu,
NETNAMES_GAL_LAYER( In24_Cu ), In24_Cu,
NETNAMES_GAL_LAYER( In25_Cu ), In25_Cu,
NETNAMES_GAL_LAYER( In26_Cu ), In26_Cu,
NETNAMES_GAL_LAYER( In27_Cu ), In27_Cu,
NETNAMES_GAL_LAYER( In28_Cu ), In28_Cu,
NETNAMES_GAL_LAYER( In29_Cu ), In29_Cu,
NETNAMES_GAL_LAYER( In30_Cu ), In30_Cu,
#endif
NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_BK_VISIBLE ), B_Mask,
NETNAMES_GAL_LAYER( B_Cu ), B_Cu,
B_Adhes, B_Paste, B_SilkS,
ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE ),
ITEM_GAL_LAYER( WORKSHEET )
};
BEGIN_EVENT_TABLE( PCB_BASE_FRAME, EDA_DRAW_FRAME )
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START, ID_POPUP_PCB_ITEM_SELECTION_END,
PCB_BASE_FRAME::ProcessItemSelection )
......@@ -417,9 +455,9 @@ void PCB_BASE_FRAME::Show3D_Frame( wxCommandEvent& event )
// Note: virtual, overridden in PCB_EDIT_FRAME;
void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, LAYER_NUM layer )
void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, LAYER_ID layer )
{
LAYER_NUM preslayer = ((PCB_SCREEN*)GetScreen())->m_Active_Layer;
LAYER_ID preslayer = ((PCB_SCREEN*)GetScreen())->m_Active_Layer;
// Check if the specified layer matches the present layer
if( layer == preslayer )
......@@ -434,7 +472,7 @@ void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, LAYER_NUM layer )
// selection of any other copper layer is disregarded).
if( m_Pcb->GetCopperLayerCount() < 2 )
{
if( layer != LAYER_N_BACK )
if( layer != B_Cu )
{
return;
}
......@@ -446,7 +484,7 @@ void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, LAYER_NUM layer )
// layers are also capable of being selected.
else
{
if( ( layer != LAYER_N_BACK ) && ( layer != LAYER_N_FRONT )
if( ( layer != B_Cu ) && ( layer != F_Cu )
&& ( layer >= m_Pcb->GetCopperLayerCount() - 1 ) )
{
return;
......@@ -813,7 +851,7 @@ void PCB_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
KIGFX::VIEW* view = GetGalCanvas()->GetView();
// Set rendering order and properties of layers
for( LAYER_NUM i = 0; (unsigned) i < sizeof(GAL_LAYER_ORDER) / sizeof(LAYER_NUM); ++i )
for( LAYER_NUM i = 0; i < (int) DIM(GAL_LAYER_ORDER); ++i )
{
LAYER_NUM layer = GAL_LAYER_ORDER[i];
wxASSERT( layer < KIGFX::VIEW::VIEW_MAX_LAYERS );
......@@ -840,14 +878,14 @@ void PCB_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
view->SetRequired( NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) );
view->SetRequired( NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
view->SetRequired( ADHESIVE_N_FRONT, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
view->SetRequired( SOLDERPASTE_N_FRONT, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
view->SetRequired( SOLDERMASK_N_FRONT, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
view->SetRequired( F_Adhes, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
view->SetRequired( F_Paste, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
view->SetRequired( F_Mask, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
view->SetRequired( NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
view->SetRequired( ADHESIVE_N_BACK, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
view->SetRequired( SOLDERPASTE_N_BACK, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
view->SetRequired( SOLDERMASK_N_BACK, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
view->SetRequired( B_Adhes, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
view->SetRequired( B_Paste, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
view->SetRequired( B_Mask, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
view->SetRequired( ITEM_GAL_LAYER( PAD_FR_VISIBLE ), ITEM_GAL_LAYER( MOD_FR_VISIBLE ) );
view->SetRequired( ITEM_GAL_LAYER( PAD_BK_VISIBLE ), ITEM_GAL_LAYER( MOD_BK_VISIBLE ) );
......
......@@ -381,7 +381,7 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
void PCB_EDIT_FRAME::Block_SelectItems()
{
LAYER_MSK layerMask;
LSET layerMask;
bool selectOnlyComplete = GetScreen()->m_BlockLocate.GetWidth() > 0 ;
GetScreen()->m_BlockLocate.Normalize();
......@@ -392,9 +392,9 @@ void PCB_EDIT_FRAME::Block_SelectItems()
// Add modules
if( blockIncludeModules )
{
for( MODULE* module = m_Pcb->m_Modules; module != NULL; module = module->Next() )
for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
{
LAYER_NUM layer = module->GetLayer();
LAYER_ID layer = module->GetLayer();
if( module->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete )
&& ( !module->IsLocked() || blockIncludeLockedModules ) )
......@@ -418,7 +418,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
if( blockIncludeItemsOnInvisibleLayers
|| m_Pcb->IsLayerVisible( track->GetLayer() ) )
{
picker.SetItem ( track );
picker.SetItem( track );
itemsList->PushItem( picker );
}
}
......@@ -426,13 +426,13 @@ void PCB_EDIT_FRAME::Block_SelectItems()
}
// Add graphic items
layerMask = EDGE_LAYER;
layerMask = LSET( Edge_Cuts );
if( blockIncludeItemsOnTechLayers )
layerMask = ALL_LAYERS;
layerMask.set();
if( !blockIncludeBoardOutlineLayer )
layerMask &= ~EDGE_LAYER;
layerMask.set( Edge_Cuts, false );
for( BOARD_ITEM* PtStruct = m_Pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
{
......@@ -444,7 +444,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
switch( PtStruct->Type() )
{
case PCB_LINE_T:
if( (GetLayerMask( PtStruct->GetLayer() ) & layerMask) == 0 )
if( !layerMask[PtStruct->GetLayer()] )
break;
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) )
......@@ -464,7 +464,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
break;
case PCB_TARGET_T:
if( ( GetLayerMask( PtStruct->GetLayer() ) & layerMask ) == 0 )
if( !layerMask[PtStruct->GetLayer()] )
break;
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) )
......@@ -474,7 +474,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
break;
case PCB_DIMENSION_T:
if( ( GetLayerMask( PtStruct->GetLayer() ) & layerMask ) == 0 )
if( !layerMask[PtStruct->GetLayer()] )
break;
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) )
......
......@@ -39,19 +39,8 @@ static void addTextSegmToPoly( int x0, int y0, int xf, int yf )
s_textCircle2SegmentCount, s_textWidth );
}
/**
* Function ConvertBrdLayerToPolygonalContours
* Build a set of polygons which are the outlines of copper items
* (pads, tracks, texts, zones)
* the holes in vias or pads are ignored
* Usefull to export the shape of copper layers to dxf polygons
* or 3D viewer
* the polygons are not merged.
* @param aLayer = A layer, like LAYER_N_BACK, etc.
* @param aOutlines The CPOLYGONS_LIST to fill in with main outlines.
* @return true if success, false if a contour is not valid
*/
void BOARD::ConvertBrdLayerToPolygonalContours( LAYER_NUM aLayer, CPOLYGONS_LIST& aOutlines )
void BOARD::ConvertBrdLayerToPolygonalContours( LAYER_ID aLayer, CPOLYGONS_LIST& aOutlines )
{
// Number of segments to convert a circle to a polygon
const int segcountforcircle = 18;
......@@ -82,7 +71,7 @@ void BOARD::ConvertBrdLayerToPolygonalContours( LAYER_NUM aLayer, CPOLYGONS_LIST
for( int ii = 0; ii < GetAreaCount(); ii++ )
{
ZONE_CONTAINER* zone = GetArea( ii );
LAYER_NUM zonelayer = zone->GetLayer();
LAYER_ID zonelayer = zone->GetLayer();
if( zonelayer == aLayer )
zone->TransformSolidAreasShapesToPolygonSet(
......@@ -113,18 +102,8 @@ void BOARD::ConvertBrdLayerToPolygonalContours( LAYER_NUM aLayer, CPOLYGONS_LIST
}
}
/* generate pads shapes on layer aLayer as polygons,
* and adds these polygons to aCornerBuffer
* aCornerBuffer = the buffer to store polygons
* aInflateValue = an additionnal size to add to pad shapes
* aCircleToSegmentsCount = number of segments to approximate a circle
* aCorrectionFactor = the correction to apply to a circle radius
* to generate the polygon.
* if aCorrectionFactor = 1.0, the polygon is inside the circle
* the radius of circle approximated by segments is
* initial radius * aCorrectionFactor
*/
void MODULE::TransformPadsShapesWithClearanceToPolygon( LAYER_NUM aLayer,
void MODULE::TransformPadsShapesWithClearanceToPolygon( LAYER_ID aLayer,
CPOLYGONS_LIST& aCornerBuffer,
int aInflateValue,
int aCircleToSegmentsCount,
......@@ -141,13 +120,13 @@ void MODULE::TransformPadsShapesWithClearanceToPolygon( LAYER_NUM aLayer,
switch( aLayer )
{
case SOLDERMASK_N_FRONT:
case SOLDERMASK_N_BACK:
case F_Mask:
case B_Mask:
margin.x = margin.y = pad->GetSolderMaskMargin() + aInflateValue;
break;
case SOLDERPASTE_N_FRONT:
case SOLDERPASTE_N_BACK:
case F_Paste:
case B_Paste:
margin = pad->GetSolderPasteMargin();
margin.x += aInflateValue;
margin.y += aInflateValue;
......@@ -175,7 +154,7 @@ void MODULE::TransformPadsShapesWithClearanceToPolygon( LAYER_NUM aLayer,
* initial radius * aCorrectionFactor
*/
void MODULE::TransformGraphicShapesWithClearanceToPolygonSet(
LAYER_NUM aLayer,
LAYER_ID aLayer,
CPOLYGONS_LIST& aCornerBuffer,
int aInflateValue,
int aCircleToSegmentsCount,
......
This diff is collapsed.
This diff is collapsed.
......@@ -54,10 +54,11 @@
BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
m_Pad_Master( NULL )
{
m_enabledLayers = ALL_LAYERS; // All layers enabled at first.
// SetCopperLayerCount() will adjust this.
LSET all_set = LSET().set();
SetVisibleLayers( FULL_LAYERS );
m_enabledLayers = all_set; // All layers enabled at first.
// SetCopperLayerCount() will adjust this.
SetVisibleLayers( all_set );
// set all but hidden text as visible.
m_visibleElements = ~( 1 << MOD_TEXT_INVISIBLE );
......@@ -305,17 +306,17 @@ void BOARD_DESIGN_SETTINGS::SetTrackWidthIndex( unsigned aIndex )
void BOARD_DESIGN_SETTINGS::SetVisibleAlls()
{
SetVisibleLayers( FULL_LAYERS );
SetVisibleLayers( LSET().set() );
m_visibleElements = -1;
}
void BOARD_DESIGN_SETTINGS::SetLayerVisibility( LAYER_NUM aLayer, bool aNewState )
void BOARD_DESIGN_SETTINGS::SetLayerVisibility( LAYER_ID aLayer, bool aNewState )
{
if( aNewState && IsLayerEnabled( aLayer ) )
m_visibleLayers |= GetLayerMask( aLayer );
m_visibleLayers.set( aLayer, true );
else
m_visibleLayers &= ~GetLayerMask( aLayer );
m_visibleLayers.set( aLayer, false );
}
......@@ -338,6 +339,8 @@ void BOARD_DESIGN_SETTINGS::SetCopperLayerCount( int aNewLayerCount )
m_copperLayerCount = aNewLayerCount;
// ensure consistency with the m_EnabledLayers member
#if 0
// was:
m_enabledLayers &= ~ALL_CU_LAYERS;
m_enabledLayers |= LAYER_BACK;
......@@ -345,14 +348,17 @@ void BOARD_DESIGN_SETTINGS::SetCopperLayerCount( int aNewLayerCount )
m_enabledLayers |= LAYER_FRONT;
for( LAYER_NUM ii = LAYER_N_2; ii < aNewLayerCount - 1; ++ii )
m_enabledLayers |= GetLayerMask( ii );
m_enabledLayers |= GetLayerSet( ii );
#else
m_enabledLayers = LSET::AllCuMask( aNewLayerCount );
#endif
}
void BOARD_DESIGN_SETTINGS::SetEnabledLayers( LAYER_MSK aMask )
void BOARD_DESIGN_SETTINGS::SetEnabledLayers( LSET aMask )
{
// Back and front layers are always enabled.
aMask |= LAYER_BACK | LAYER_FRONT;
aMask.set( B_Cu ).set( F_Cu );
m_enabledLayers = aMask;
......@@ -360,7 +366,7 @@ void BOARD_DESIGN_SETTINGS::SetEnabledLayers( LAYER_MSK aMask )
m_visibleLayers &= aMask;
// update m_CopperLayerCount to ensure its consistency with m_EnabledLayers
m_copperLayerCount = LayerMaskCountSet( aMask & ALL_CU_LAYERS);
m_copperLayerCount = ( aMask & LSET::AllCuMask() ).count();
}
......
......@@ -49,7 +49,7 @@ DIMENSION::DIMENSION( BOARD_ITEM* aParent ) :
BOARD_ITEM( aParent, PCB_DIMENSION_T ),
m_Width( Millimeter2iu( 0.2 ) ), m_Unit( INCHES ), m_Value( 0 ), m_Height( 0 ), m_Text( this )
{
m_Layer = DRAW_N;
m_Layer = Dwgs_User;
}
......@@ -82,7 +82,7 @@ const wxString DIMENSION::GetText() const
}
void DIMENSION::SetLayer( LAYER_NUM aLayer )
void DIMENSION::SetLayer( LAYER_ID aLayer )
{
m_Layer = aLayer;
m_Text.SetLayer( aLayer );
......
......@@ -95,7 +95,7 @@ public:
m_Text.SetSize( aTextSize );
}
void SetLayer( LAYER_NUM aLayer );
void SetLayer( LAYER_ID aLayer );
void SetShape( int aShape ) { m_Shape = aShape; }
int GetShape() const { return m_Shape; }
......
......@@ -185,7 +185,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
if( ( draw_mode & GR_ALLOW_HIGHCONTRAST ) && DisplayOpt.ContrastModeDisplay )
{
if( !IsOnLayer( curr_layer ) && !IsOnLayer( EDGE_N ) )
if( !IsOnLayer( curr_layer ) && !IsOnLayer( Edge_Cuts ) )
ColorTurnToDarkDarkGray( &color );
}
......
......@@ -57,7 +57,7 @@ EDGE_MODULE::EDGE_MODULE( MODULE* parent, STROKE_T aShape ) :
{
m_Shape = aShape;
m_Angle = 0;
m_Layer = SILKSCREEN_N_FRONT;
m_Layer = F_SilkS;
}
......@@ -149,7 +149,7 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
GRSetDrawMode( DC, draw_mode );
typeaff = frame->m_DisplayModEdge;
if( m_Layer <= LAST_COPPER_LAYER )
if( IsCopperLayer( m_Layer ) )
{
typeaff = frame->m_DisplayPcbTrackFill;
......
......@@ -51,10 +51,10 @@ PCB_TARGET::PCB_TARGET( BOARD_ITEM* aParent ) :
m_Shape = 0;
m_Size = Millimeter2iu( 5 ); // Gives a decent size
m_Width = Millimeter2iu( 0.15 ); // Gives a decent width
m_Layer = EDGE_N; // a target is on all layers
m_Layer = Edge_Cuts; // a target is on all layers
}
PCB_TARGET::PCB_TARGET( BOARD_ITEM* aParent, int aShape, LAYER_NUM aLayer,
PCB_TARGET::PCB_TARGET( BOARD_ITEM* aParent, int aShape, LAYER_ID aLayer,
const wxPoint& aPos, int aSize, int aWidth ) :
BOARD_ITEM( aParent, PCB_TARGET_T )
{
......
......@@ -51,7 +51,7 @@ public:
// Do not create a copy constructor. The one generated by the compiler is adequate.
PCB_TARGET( BOARD_ITEM* aParent, int aShape, LAYER_NUM aLayer,
PCB_TARGET( BOARD_ITEM* aParent, int aShape, LAYER_ID aLayer,
const wxPoint& aPos, int aSize, int aWidth );
~PCB_TARGET();
......
......@@ -57,7 +57,7 @@ MODULE::MODULE( BOARD* parent ) :
m_initial_comments( 0 )
{
m_Attributs = MOD_DEFAULT;
m_Layer = LAYER_N_FRONT;
m_Layer = F_Cu;
m_Orient = 0;
m_ModuleStatus = 0;
flag = 0;
......@@ -590,12 +590,12 @@ D_PAD* MODULE::FindPadByName( const wxString& aPadName ) const
}
D_PAD* MODULE::GetPad( const wxPoint& aPosition, LAYER_MSK aLayerMask )
D_PAD* MODULE::GetPad( const wxPoint& aPosition, LSET aLayerMask )
{
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
{
// ... and on the correct layer.
if( ( pad->GetLayerMask() & aLayerMask ) == 0 )
if( ( pad->GetLayerSet() & aLayerMask ) == 0 )
continue;
if( pad->HitTest( aPosition ) )
......
......@@ -189,7 +189,7 @@ public:
* function IsFlipped
* @return true if the module is flipped, i.e. on the back side of the board
*/
bool IsFlipped() const {return GetLayer() == LAYER_N_BACK; }
bool IsFlipped() const {return GetLayer() == B_Cu; }
// m_ModuleStatus bits:
#define MODULE_is_LOCKED 0x01 ///< module LOCKED: no autoplace allowed
......@@ -282,7 +282,7 @@ public:
* the radius of circle approximated by segments is
* initial radius * aCorrectionFactor
*/
void TransformPadsShapesWithClearanceToPolygon( LAYER_NUM aLayer,
void TransformPadsShapesWithClearanceToPolygon( LAYER_ID aLayer,
CPOLYGONS_LIST& aCornerBuffer,
int aInflateValue,
int aCircleToSegmentsCount,
......@@ -306,13 +306,12 @@ public:
* initial radius * aCorrectionFactor
*/
void TransformGraphicShapesWithClearanceToPolygonSet(
LAYER_NUM aLayer,
LAYER_ID aLayer,
CPOLYGONS_LIST& aCornerBuffer,
int aInflateValue,
int aCircleToSegmentsCount,
double aCorrectionFactor );
/**
* Function DrawEdgesOnly
* Draws the footprint edges only to the current Device Context
......@@ -400,7 +399,7 @@ public:
* @param aLayerMask A layer or layers to mask the hit test.
* @return A pointer to a D_PAD object if found otherwise NULL.
*/
D_PAD* GetPad( const wxPoint& aPosition, LAYER_MSK aLayerMask = ALL_LAYERS );
D_PAD* GetPad( const wxPoint& aPosition, LSET aLayerMask = LSET::AllLayersMask() );
enum INCLUDE_NPTH_T
{
......
......@@ -78,7 +78,7 @@ D_PAD::D_PAD( MODULE* parent ) :
m_ThermalGap = 0; // Use parent setting by default
// Set layers mask to default for a standard thru hole pad.
m_layerMask = PAD_STANDARD_DEFAULT_LAYERS;
m_layerMask = StandardMask();
SetSubRatsnest( 0 ); // used in ratsnest calculations
......@@ -86,6 +86,38 @@ D_PAD::D_PAD( MODULE* parent ) :
}
LSET D_PAD::StandardMask()
{
static LSET saved = LSET::AllCuMask() | LSET( 3, F_SilkS, B_Mask, F_Mask );
return saved;
}
LSET D_PAD::ConnMask()
{
// was: #define PAD_CONN_DEFAULT_LAYERS LAYER_FRONT | SOLDERPASTE_LAYER_FRONT | SOLDERMASK_LAYER_FRONT
static LSET saved( 3, F_Cu, F_Paste, F_Mask );
return saved;
}
LSET D_PAD::SMDMask()
{
// was: #define PAD_SMD_DEFAULT_LAYERS LAYER_FRONT | SOLDERMASK_LAYER_FRONT
static LSET saved( 2, F_Cu, F_Mask );
return saved;
}
LSET D_PAD::UnplatedHoleMask()
{
// was #define PAD_HOLE_NOT_PLATED_DEFAULT_LAYERS ALL_CU_LAYERS |
// SILKSCREEN_LAYER_FRONT | SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT
static LSET saved = LSET::AllCuMask() | LSET( 3, F_SilkS, B_Mask, F_Mask );
return saved;
}
int D_PAD::boundingRadius() const
{
int x, y;
......@@ -231,7 +263,7 @@ void D_PAD::Flip( const wxPoint& aCentre )
SetOrientation( -GetOrientation() );
// flip pads layers
SetLayerMask( FlipLayerMask( m_layerMask ) );
SetLayerSet( FlipLayerMask( m_layerMask ) );
// m_boundingRadius = -1; the shape has not been changed
}
......@@ -630,13 +662,6 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList )
}
// see class_pad.h
bool D_PAD::IsOnLayer( LAYER_NUM aLayer ) const
{
return ::GetLayerMask( aLayer ) & m_layerMask;
}
void D_PAD::GetOblongDrillGeometry( wxPoint& aStartPoint,
wxPoint& aEndPoint, int& aWidth ) const
{
......@@ -773,10 +798,21 @@ int D_PAD::Compare( const D_PAD* padref, const D_PAD* padcmp )
// Dick: specctra_export needs this
// Lorenzo: gencad also needs it to implement padstacks!
if( ( diff = padref->m_layerMask - padcmp->m_layerMask ) != 0 )
return diff;
#if __cplusplus >= 201103L
long long d = padref->m_layerMask.to_ullong() - padcmp->m_layerMask.to_ullong();
if( d < 0 )
return -1;
else if( d > 0 )
return 1;
return 0;
#else
// these strings are not typically constructed, since we don't get here often.
std::string s1 = padref->m_layerMask.to_string();
std::string s2 = padcmp->m_layerMask.to_string();
return s1.compare( s2 );
#endif
}
......@@ -861,40 +897,40 @@ void D_PAD::ViewGetLayers( int aLayers[], int& aCount ) const
if( m_Attribute == PAD_STANDARD || m_Attribute == PAD_HOLE_NOT_PLATED )
aLayers[aCount++] = ITEM_GAL_LAYER( PADS_HOLES_VISIBLE );
if( IsOnLayer( LAYER_N_FRONT ) && IsOnLayer( LAYER_N_BACK ) )
if( IsOnLayer( F_Cu ) && IsOnLayer( B_Cu ) )
{
// Multi layer pad
aLayers[aCount++] = ITEM_GAL_LAYER( PADS_VISIBLE );
aLayers[aCount++] = NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE );
}
else if( IsOnLayer( LAYER_N_FRONT ) )
else if( IsOnLayer( F_Cu ) )
{
aLayers[aCount++] = ITEM_GAL_LAYER( PAD_FR_VISIBLE );
aLayers[aCount++] = NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE );
}
else if( IsOnLayer( LAYER_N_BACK ) )
else if( IsOnLayer( B_Cu ) )
{
aLayers[aCount++] = ITEM_GAL_LAYER( PAD_BK_VISIBLE );
aLayers[aCount++] = NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE );
}
if( IsOnLayer( SOLDERMASK_N_FRONT ) )
aLayers[aCount++] = SOLDERMASK_N_FRONT;
if( IsOnLayer( F_Mask ) )
aLayers[aCount++] = F_Mask;
if( IsOnLayer( SOLDERMASK_N_BACK ) )
aLayers[aCount++] = SOLDERMASK_N_BACK;
if( IsOnLayer( B_Mask ) )
aLayers[aCount++] = B_Mask;
if( IsOnLayer( SOLDERPASTE_N_FRONT ) )
aLayers[aCount++] = SOLDERPASTE_N_FRONT;
if( IsOnLayer( F_Paste ) )
aLayers[aCount++] = F_Paste;
if( IsOnLayer( SOLDERPASTE_N_BACK ) )
aLayers[aCount++] = SOLDERPASTE_N_BACK;
if( IsOnLayer( B_Paste ) )
aLayers[aCount++] = B_Paste;
if( IsOnLayer( ADHESIVE_N_BACK ) )
aLayers[aCount++] = ADHESIVE_N_BACK;
if( IsOnLayer( B_Adhes ) )
aLayers[aCount++] = B_Adhes;
if( IsOnLayer( ADHESIVE_N_FRONT ) )
aLayers[aCount++] = ADHESIVE_N_FRONT;
if( IsOnLayer( F_Adhes ) )
aLayers[aCount++] = F_Adhes;
#ifdef __WXDEBUG__
if( aCount == 0 ) // Should not occur
......
......@@ -47,25 +47,6 @@ class TRACK;
class MSG_PANEL_INFO;
/* Default layers used for pads, according to the pad type.
* this is default values only, they can be changed for a given pad
*/
// PAD_STANDARD:
#define PAD_STANDARD_DEFAULT_LAYERS ALL_CU_LAYERS | SILKSCREEN_LAYER_FRONT | \
SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT
// PAD_CONN:
#define PAD_CONN_DEFAULT_LAYERS LAYER_FRONT | SOLDERPASTE_LAYER_FRONT | SOLDERMASK_LAYER_FRONT
// PAD_SMD:
#define PAD_SMD_DEFAULT_LAYERS LAYER_FRONT | SOLDERMASK_LAYER_FRONT
//PAD_HOLE_NOT_PLATED:
#define PAD_HOLE_NOT_PLATED_DEFAULT_LAYERS ALL_CU_LAYERS | SILKSCREEN_LAYER_FRONT | \
SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT
// Helper class to store parameters used to draw a pad
class PAD_DRAWINFO
{
......@@ -104,6 +85,14 @@ public:
// Do not create a copy constructor. The one generated by the compiler is adequate.
// D_PAD( const D_PAD& o );
/* Default layers used for pads, according to the pad type.
* this is default values only, they can be changed for a given pad
*/
static LSET StandardMask();
static LSET ConnMask();
static LSET SMDMask();
static LSET UnplatedHoleMask();
void Copy( D_PAD* source );
D_PAD* Next() const { return static_cast<D_PAD*>( Pnext ); }
......@@ -180,8 +169,8 @@ public:
*/
void GetOblongDrillGeometry( wxPoint& aStartPoint, wxPoint& aEndPoint, int& aWidth ) const;
void SetLayerMask( LAYER_MSK aLayerMask ) { m_layerMask = aLayerMask; }
LAYER_MSK GetLayerMask() const { return m_layerMask; }
void SetLayerSet( LSET aLayerMask ) { m_layerMask = aLayerMask; }
LSET GetLayerSet() const { return m_layerMask; }
void SetAttribute( PAD_ATTR_T aAttribute );
PAD_ATTR_T GetAttribute() const { return m_Attribute; }
......@@ -377,7 +366,10 @@ public:
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList );
bool IsOnLayer( LAYER_NUM aLayer ) const;
bool IsOnLayer( LAYER_ID aLayer ) const
{
return m_layerMask[aLayer];
}
bool HitTest( const wxPoint& aPosition ) const;
......@@ -506,7 +498,7 @@ private:
*/
wxPoint m_Offset;
LAYER_MSK m_layerMask; ///< Bitwise layer :1= copper layer, 15= cmp,
LSET m_layerMask; ///< Bitwise layer :1= copper layer, 15= cmp,
///< 2..14 = internal layers
///< 16 .. 31 = technical layers
......
......@@ -107,19 +107,16 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
if( !frontVisible && !backVisible )
return;
/* If pad are only on front side (no layer on back side)
* and if hide front side pads is enabled, do not draw
*/
if( !frontVisible && ( (m_layerMask & BACK_LAYERS) == 0 ) )
// If pad is only on front side (no layer on back side)
// and if hide front side pads is enabled, do not draw
if( !frontVisible && !( m_layerMask & LSET::BackMask() ).any() )
return;
/* If pad are only on back side (no layer on front side)
* and if hide back side pads is enabled, do not draw
*/
if( !backVisible && ( (m_layerMask & FRONT_LAYERS) == 0 ) )
// If pad is only on back side (no layer on front side)
// and if hide back side pads is enabled, do not draw
if( !backVisible && !( m_layerMask & LSET::FrontMask() ).any() )
return;
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) aPanel->GetParent();
PCB_SCREEN* screen = frame->GetScreen();
......@@ -129,12 +126,12 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
drawInfo.m_ShowPadFilled = false;
EDA_COLOR_T color = BLACK;
if( m_layerMask & LAYER_FRONT )
if( ( m_layerMask & LSET::FrontMask() ).any() )
{
color = brd->GetVisibleElementColor( PAD_FR_VISIBLE );
}
if( m_layerMask & LAYER_BACK )
if( ( m_layerMask & LSET::BackMask() ).any() )
{
color = ColorMix( color, brd->GetVisibleElementColor( PAD_BK_VISIBLE ) );
}
......@@ -142,12 +139,14 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
if( color == BLACK ) // Not on a visible copper layer (i.e. still nothing to show)
{
// If the pad is on only one tech layer, use the layer color else use DARKGRAY
LAYER_MSK mask_non_copper_layers = m_layerMask & ~ALL_CU_LAYERS;
LSET mask_non_copper_layers = m_layerMask & ~LSET::AllCuMask();
#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
mask_non_copper_layers &= brd->GetVisibleLayers();
#endif
LAYER_NUM pad_layer = ExtractLayer( mask_non_copper_layers );
switch( pad_layer )
LAYER_ID pad_layer = mask_non_copper_layers.ExtractLayer();
switch( (int) pad_layer )
{
case UNDEFINED_LAYER: // More than one layer
color = DARKGRAY;
......@@ -172,14 +171,16 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
// when routing tracks
if( frame && frame->GetToolId() == ID_TRACK_BUTT )
{
LAYER_NUM routeTop = screen->m_Route_Layer_TOP;
LAYER_NUM routeBot = screen->m_Route_Layer_BOTTOM;
LAYER_ID routeTop = screen->m_Route_Layer_TOP;
LAYER_ID routeBot = screen->m_Route_Layer_BOTTOM;
// if routing between copper and component layers,
// or the current layer is one of said 2 external copper layers,
// then highlight only the current layer.
if( ( ::GetLayerMask( routeTop ) | ::GetLayerMask( routeBot ) ) == ( LAYER_BACK | LAYER_FRONT )
|| ( ::GetLayerMask( screen->m_Active_Layer ) & ( LAYER_BACK | LAYER_FRONT ) ) )
if( ( screen->m_Active_Layer == F_Cu || screen->m_Active_Layer == B_Cu ) ||
( routeTop==F_Cu && routeBot==B_Cu ) ||
( routeTop==B_Cu && routeBot==F_Cu )
)
{
if( !IsOnLayer( screen->m_Active_Layer ) )
ColorTurnToDarkDarkGray( &color );
......@@ -208,13 +209,13 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
{
switch( showActualMaskSize )
{
case SOLDERMASK_N_BACK:
case SOLDERMASK_N_FRONT:
case B_Mask:
case F_Mask:
mask_margin.x = mask_margin.y = GetSolderMaskMargin();
break;
case SOLDERPASTE_N_BACK:
case SOLDERPASTE_N_FRONT:
case B_Paste:
case F_Paste:
mask_margin = GetSolderPasteMargin();
break;
......@@ -239,13 +240,13 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
// layer shows the pad size with the mask clearance
switch( screen->m_Active_Layer )
{
case SOLDERMASK_N_BACK:
case SOLDERMASK_N_FRONT:
case B_Mask:
case F_Mask:
mask_margin.x = mask_margin.y = GetSolderMaskMargin();
break;
case SOLDERPASTE_N_BACK:
case SOLDERPASTE_N_FRONT:
case B_Paste:
case F_Paste:
mask_margin = GetSolderPasteMargin();
break;
......@@ -265,7 +266,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
bool DisplayIsol = DisplayOpt.DisplayPadIsol;
if( ( m_layerMask & ALL_CU_LAYERS ) == 0 )
if( !( m_layerMask & LSET::AllCuMask() ).any() )
DisplayIsol = false;
if( ( GetAttribute() == PAD_HOLE_NOT_PLATED ) &&
......@@ -462,11 +463,11 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
int dx0 = std::min( halfsize.x, halfsize.y );
EDA_COLOR_T nc_color = BLUE;
if( m_layerMask & LAYER_FRONT ) /* Draw \ */
if( m_layerMask[F_Cu] ) /* Draw \ */
GRLine( aClipBox, aDC, holepos.x - dx0, holepos.y - dx0,
holepos.x + dx0, holepos.y + dx0, 0, nc_color );
if( m_layerMask & LAYER_BACK ) // Draw /
if( m_layerMask[B_Cu] ) // Draw /
GRLine( aClipBox, aDC, holepos.x + dx0, holepos.y - dx0,
holepos.x - dx0, holepos.y + dx0, 0, nc_color );
}
......
......@@ -40,6 +40,28 @@
#include <class_pcb_layer_box_selector.h>
#define DECLARE_LAYERS_HOTKEY(list) int list[] = \
{ \
HK_SWITCH_LAYER_TO_COPPER, \
HK_SWITCH_LAYER_TO_INNER1, \
HK_SWITCH_LAYER_TO_INNER2, \
HK_SWITCH_LAYER_TO_INNER3, \
HK_SWITCH_LAYER_TO_INNER4, \
HK_SWITCH_LAYER_TO_INNER5, \
HK_SWITCH_LAYER_TO_INNER6, \
HK_SWITCH_LAYER_TO_INNER7, \
HK_SWITCH_LAYER_TO_INNER8, \
HK_SWITCH_LAYER_TO_INNER9, \
HK_SWITCH_LAYER_TO_INNER10, \
HK_SWITCH_LAYER_TO_INNER11, \
HK_SWITCH_LAYER_TO_INNER12, \
HK_SWITCH_LAYER_TO_INNER13, \
HK_SWITCH_LAYER_TO_INNER14, \
HK_SWITCH_LAYER_TO_COMPONENT \
};
// class to display a layer list in a wxBitmapComboBox.
// Reload the Layers
......@@ -47,38 +69,35 @@ void PCB_LAYER_BOX_SELECTOR::Resync()
{
Clear();
static DECLARE_LAYERS_ORDER_LIST( layertranscode );
static DECLARE_LAYERS_HOTKEY( layerhk );
static const DECLARE_LAYERS_HOTKEY( layerhk );
// Tray to fix a minimum width fot the BitmapComboBox
int minwidth = 80, h;
wxClientDC dc( GetParent() ); // The DC for "this" is not always initialized
#define BM_SIZE 14
for( LAYER_NUM i = FIRST_LAYER; i < NB_LAYERS; ++i )
{
wxBitmap layerbmp( BM_SIZE, BM_SIZE );
wxString layername;
LAYER_NUM layerid = i;
if( m_layerorder )
layerid = layertranscode[i];
LSET show = getEnabledLayers() & ~m_layerMaskDisable;
if( ! IsLayerEnabled( layerid ) )
continue;
for( LSEQ seq = show.UIOrder(); seq; ++seq )
{
LAYER_ID layerid = *seq;
if( ( m_layerMaskDisable & GetLayerMask( layerid ) ) )
continue;
wxBitmap layerbmp( BM_SIZE, BM_SIZE );
SetBitmapLayer( layerbmp, layerid );
layername = GetLayerName( layerid );
wxString layername = GetLayerName( layerid );
if( m_layerhotkeys && m_hotkeys != NULL )
if( m_layerhotkeys && m_hotkeys && layerid < DIM(layerhk) )
{
layername = AddHotkeyName( layername, m_hotkeys,
layerhk[layerid], IS_COMMENT );
}
Append( layername, layerbmp, (void*)(intptr_t) layerid );
int w;
dc.GetTextExtent ( layername, &w, &h );
minwidth = std::max( minwidth, w );
......@@ -96,27 +115,38 @@ bool PCB_LAYER_BOX_SELECTOR::IsLayerEnabled( LAYER_NUM aLayer ) const
BOARD* board = m_boardFrame->GetBoard();
wxASSERT( board != NULL );
return board->IsLayerEnabled( aLayer );
return board->IsLayerEnabled( (LAYER_ID) aLayer );
}
// Returns a color index from the layer id
EDA_COLOR_T PCB_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayer ) const
LSET PCB_LAYER_BOX_SELECTOR::getEnabledLayers() const
{
wxASSERT( m_boardFrame != NULL );
BOARD* board = m_boardFrame->GetBoard();
wxASSERT( board != NULL );
return board->GetLayerColor( aLayer );
return board->GetEnabledLayers();
}
// Returns a color index from the layer id
EDA_COLOR_T PCB_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayer ) const
{
wxASSERT( m_boardFrame );
BOARD* board = m_boardFrame->GetBoard();
wxASSERT( board );
return board->GetLayerColor( (LAYER_ID) aLayer );
}
// Returns the name of the layer id
wxString PCB_LAYER_BOX_SELECTOR::GetLayerName( LAYER_NUM aLayer ) const
{
wxASSERT( m_boardFrame != NULL );
wxASSERT( m_boardFrame );
BOARD* board = m_boardFrame->GetBoard();
wxASSERT( board != NULL );
wxASSERT( board );
return board->GetLayerName( aLayer );
return board->GetLayerName( (LAYER_ID) aLayer );
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -181,9 +181,9 @@ public:
* Function IsOnCopperLayer
* @return true if this zone is on a copper layer, false if on a technical layer
*/
bool IsOnCopperLayer( void ) const
bool IsOnCopperLayer() const
{
return ( GetLayer() < FIRST_NON_COPPER_LAYER ) ? true : false;
return LSET::AllNonCuMask()[GetLayer()];
}
/// How to fill areas: 0 = use filled polygons, 1 => fill with segments.
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment