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 ) ...@@ -132,53 +132,52 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
// Fill remaining unused copper layers and front layer zpos // Fill remaining unused copper layers and front layer zpos
// with m_EpoxyThickness // with m_EpoxyThickness
// Solder mask and Solder paste have the same Z position // 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; m_LayerZcoord[layer] = m_EpoxyThickness;
} }
// calculate z position for each non copper layer // 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; double zpos;
switch( layer_id ) switch( layer_id )
{ {
case ADHESIVE_N_BACK: case B_Adhes:
zpos = zpos_copper_back - 3 * zpos_offset; zpos = zpos_copper_back - 3 * zpos_offset;
break; break;
case ADHESIVE_N_FRONT: case F_Adhes:
zpos = zpos_copper_front + 3 * zpos_offset; zpos = zpos_copper_front + 3 * zpos_offset;
break; break;
case SOLDERPASTE_N_BACK: case B_Paste:
zpos = zpos_copper_back - 1 * zpos_offset; zpos = zpos_copper_back - 1 * zpos_offset;
break; break;
case SOLDERPASTE_N_FRONT: case F_Paste:
zpos = zpos_copper_front + 1 * zpos_offset; zpos = zpos_copper_front + 1 * zpos_offset;
break; break;
case SOLDERMASK_N_BACK: case B_Mask:
zpos = zpos_copper_back - 1 * zpos_offset; zpos = zpos_copper_back - 1 * zpos_offset;
break; break;
case SOLDERMASK_N_FRONT: case F_Mask:
zpos = zpos_copper_front + 1 * zpos_offset; zpos = zpos_copper_front + 1 * zpos_offset;
break; break;
case SILKSCREEN_N_BACK: case B_SilkS:
zpos = zpos_copper_back - 2 * zpos_offset; zpos = zpos_copper_back - 2 * zpos_offset;
break; break;
case SILKSCREEN_N_FRONT: case F_SilkS:
zpos = zpos_copper_front + 2 * zpos_offset; zpos = zpos_copper_front + 2 * zpos_offset;
break; break;
default: default:
zpos = zpos_copper_front + zpos = zpos_copper_front + (layer_id - MAX_CU_LAYERS + 4) * zpos_offset;
(layer_id - FIRST_NON_COPPER_LAYER + 4) * zpos_offset;
break; break;
} }
...@@ -196,8 +195,8 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard ) ...@@ -196,8 +195,8 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
double INFO3D_VISU::GetModulesZcoord3DIU( bool aIsFlipped ) double INFO3D_VISU::GetModulesZcoord3DIU( bool aIsFlipped )
{ {
if( aIsFlipped ) if( aIsFlipped )
return m_LayerZcoord[LAYER_N_BACK] - ( m_CopperThickness / 2 ); return m_LayerZcoord[B_Cu] - ( m_CopperThickness / 2 );
else else
return m_LayerZcoord[LAYER_N_FRONT] + ( m_CopperThickness / 2 ); return m_LayerZcoord[F_Cu] + ( m_CopperThickness / 2 );
} }
...@@ -95,7 +95,7 @@ public: ...@@ -95,7 +95,7 @@ public:
double m_CurrentZpos; // temporary storage of current value of Z position, double m_CurrentZpos; // temporary storage of current value of Z position,
// used in some calculation // used in some calculation
private: 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_CopperThickness; // Copper thickness (normalized)
double m_EpoxyThickness; // Epoxy thickness (normalized) double m_EpoxyThickness; // Epoxy thickness (normalized)
double m_NonCopperLayerThickness; // Non copper layers thickness double m_NonCopperLayerThickness; // Non copper layers thickness
...@@ -188,11 +188,12 @@ public: INFO3D_VISU(); ...@@ -188,11 +188,12 @@ public: INFO3D_VISU();
* *
* Note: if m_drawFlags[FL_USE_COPPER_THICKNESS] is not set, returns 0 * 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 ? return IsCopperLayer( aLayerId ) ?
GetNonCopperLayerThicknessBIU() : GetCopperThicknessBIU() :
GetCopperThicknessBIU(); GetNonCopperLayerThicknessBIU()
;
} }
bool IsRealisticMode() { return GetFlag( FL_USE_REALISTIC_MODE ); } bool IsRealisticMode() { return GetFlag( FL_USE_REALISTIC_MODE ); }
......
...@@ -355,7 +355,7 @@ void BITMAPCONV_INFO::OuputOnePolygon( KPolygon & aPolygon ) ...@@ -355,7 +355,7 @@ void BITMAPCONV_INFO::OuputOnePolygon( KPolygon & aPolygon )
case PCBNEW_LEGACY_EMP: case PCBNEW_LEGACY_EMP:
{ {
LAYER_NUM layer = SILKSCREEN_N_FRONT; LAYER_NUM layer = F_SilkS;
int width = 1; int width = 1;
fprintf( m_Outfile, "DP %d %d %d %d %d %d %d\n", fprintf( m_Outfile, "DP %d %d %d %d %d %d %d\n",
0, 0, 0, 0, 0, 0, 0, 0,
......
...@@ -250,6 +250,7 @@ set( PCB_COMMON_SRCS ...@@ -250,6 +250,7 @@ set( PCB_COMMON_SRCS
eda_text.cpp eda_text.cpp
class_page_info.cpp class_page_info.cpp
pcbcommon.cpp pcbcommon.cpp
lset.cpp
footprint_info.cpp footprint_info.cpp
../pcbnew/basepcbframe.cpp ../pcbnew/basepcbframe.cpp
../pcbnew/class_board.cpp ../pcbnew/class_board.cpp
......
...@@ -15,8 +15,7 @@ ...@@ -15,8 +15,7 @@
/* Initial colors values: optimized for Pcbnew, but are also Ok for Eeschema /* Initial colors values: optimized for Pcbnew, but are also Ok for Eeschema
* these values are superseded by config reading * 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, GREEN, BLUE, LIGHTGRAY, BROWN,
RED, MAGENTA, LIGHTGRAY, MAGENTA, RED, MAGENTA, LIGHTGRAY, MAGENTA,
DARKGRAY, BLUE, GREEN, CYAN, DARKGRAY, BLUE, GREEN, CYAN,
...@@ -34,8 +33,8 @@ static const EDA_COLOR_T default_layer_color[LAYERSCOLORSBUFFERSIZE] = ...@@ -34,8 +33,8 @@ static const EDA_COLOR_T default_layer_color[LAYERSCOLORSBUFFERSIZE] =
DARKGRAY DARKGRAY
}; };
static const EDA_COLOR_T default_items_color[LAYERSCOLORSBUFFERSIZE] =
{ static const EDA_COLOR_T default_items_color[] = {
LIGHTGRAY, // unused LIGHTGRAY, // unused
CYAN, // VIA_MICROVIA_VISIBLE CYAN, // VIA_MICROVIA_VISIBLE
BROWN, // VIA_BBLIND_VISIBLE BROWN, // VIA_BBLIND_VISIBLE
...@@ -56,13 +55,24 @@ static const EDA_COLOR_T default_items_color[LAYERSCOLORSBUFFERSIZE] = ...@@ -56,13 +55,24 @@ static const EDA_COLOR_T default_items_color[LAYERSCOLORSBUFFERSIZE] =
LIGHTGRAY, LIGHTGRAY, LIGHTGRAY LIGHTGRAY, LIGHTGRAY, LIGHTGRAY
}; };
COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS() COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS()
{ {
for( unsigned ii = 0; ii < DIM(m_LayersColors); ii++ ) for( unsigned src = 0, dst = 0; dst < DIM(m_LayersColors); ++dst )
m_LayersColors[ii] = default_layer_color[ii]; {
m_LayersColors[dst] = default_layer_color[src++];
for( unsigned ii = 0; ii < DIM(m_ItemsColors); ii++ ) if( src >= DIM( default_layer_color ) )
m_ItemsColors[ii] = default_items_color[ii]; 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 @@ ...@@ -13,19 +13,11 @@
LAYER_SELECTOR::LAYER_SELECTOR() LAYER_SELECTOR::LAYER_SELECTOR()
{ {
m_layerorder = true;
m_layerhotkeys = true; m_layerhotkeys = true;
m_hotkeys = NULL; m_hotkeys = NULL;
} }
bool LAYER_SELECTOR::SetLayersOrdered( bool value )
{
m_layerorder = value;
return m_layerorder;
}
bool LAYER_SELECTOR::SetLayersHotkeys( bool value ) bool LAYER_SELECTOR::SetLayersHotkeys( bool value )
{ {
m_layerhotkeys = value; m_layerhotkeys = value;
...@@ -33,7 +25,7 @@ bool LAYER_SELECTOR::SetLayersHotkeys( bool 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; wxMemoryDC bmpDC;
wxBrush brush; wxBrush brush;
...@@ -120,12 +112,15 @@ int LAYER_BOX_SELECTOR::SetLayerSelection( LAYER_NUM layer ) ...@@ -120,12 +112,15 @@ int LAYER_BOX_SELECTOR::SetLayerSelection( LAYER_NUM layer )
return -1; return -1;
} }
void LAYER_BOX_SELECTOR::ResyncBitmapOnly() void LAYER_BOX_SELECTOR::ResyncBitmapOnly()
{ {
LAYER_NUM elements = GetCount(); int elements = GetCount();
for( LAYER_NUM i = FIRST_LAYER; i < elements; ++i )
for( LAYER_NUM i = 0; i < elements; ++i )
{ {
wxBitmap layerbmp( 14, 14 ); wxBitmap layerbmp( 14, 14 );
SetBitmapLayer( layerbmp, i ); SetBitmapLayer( layerbmp, LAYER_ID( i ) );
} }
} }
...@@ -420,14 +420,14 @@ void SVG_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList, ...@@ -420,14 +420,14 @@ void SVG_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList,
switch( aFill ) switch( aFill )
{ {
case NO_FILL: case NO_FILL:
fprintf( outputFile, "<polyline fill=\"none;\"\n" ); fprintf( outputFile, "<polyline fill=\"none;\"\n" );
break; break;
case FILLED_WITH_BG_BODYCOLOR: case FILLED_WITH_BG_BODYCOLOR:
case FILLED_SHAPE: case FILLED_SHAPE:
fprintf( outputFile, "<polyline style=\"fill-rule:evenodd;\"\n" ); fprintf( outputFile, "<polyline style=\"fill-rule:evenodd;\"\n" );
break; break;
} }
DPOINT pos = userToDeviceCoordinates( aCornerList[0] ); DPOINT pos = userToDeviceCoordinates( aCornerList[0] );
......
...@@ -327,7 +327,7 @@ void EDA_DRAW_FRAME::ToolOnRightClick( wxCommandEvent& event ) ...@@ -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") ); wxMessageBox( wxT("EDA_DRAW_FRAME::PrintPage() error") );
} }
......
...@@ -43,16 +43,6 @@ ...@@ -43,16 +43,6 @@
class MODULE; 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 DISPLAY_OPTIONS DisplayOpt; // Display options for board items
int g_AnchorColor = BLUE; int g_AnchorColor = BLUE;
...@@ -71,124 +61,20 @@ int g_PadCMPColor = RED; ...@@ -71,124 +61,20 @@ int g_PadCMPColor = RED;
*/ */
DLIST<TRACK> g_CurrentTrackList; DLIST<TRACK> g_CurrentTrackList;
LAYER_NUM FlipLayer( LAYER_NUM oldlayer ) void AccumulateDescription( wxString &aDesc, const wxString &aItem )
{
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 )
{ {
LAYER_MSK newMask; if( !aDesc.IsEmpty() )
aDesc << wxT(", ");
newMask = aMask & ~(LAYER_BACK | LAYER_FRONT | aDesc << aItem;
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;
} }
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 wxString LayerMaskDescribe( const BOARD *aBoard, LSET aMask )
// 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 )
{ {
// Try the single or no- layer case (easy) // Try the single or no- layer case (easy)
LAYER_NUM layer = ExtractLayer( aMask ); LAYER_ID layer = aMask.ExtractLayer();
switch( layer )
switch( (int) layer )
{ {
case UNSELECTED_LAYER: case UNSELECTED_LAYER:
return _( "No layers" ); return _( "No layers" );
...@@ -203,24 +89,19 @@ wxString LayerMaskDescribe( const BOARD *aBoard, LAYER_MSK aMask ) ...@@ -203,24 +89,19 @@ wxString LayerMaskDescribe( const BOARD *aBoard, LAYER_MSK aMask )
// Try to be smart and useful, starting with outer copper // Try to be smart and useful, starting with outer copper
// (which are more important than internal ones) // (which are more important than internal ones)
wxString layerInfo; wxString layerInfo;
if( aMask & LAYER_FRONT )
AccumulateDescription( layerInfo, aBoard->GetLayerName( LAYER_N_FRONT ) );
if( aMask & LAYER_BACK ) if( aMask[F_Cu] )
AccumulateDescription( layerInfo, aBoard->GetLayerName( LAYER_N_BACK ) ); AccumulateDescription( layerInfo, aBoard->GetLayerName( F_Cu ) );
if( aMask & INTERNAL_CU_LAYERS ) if( aMask[B_Cu] )
AccumulateDescription( layerInfo, aBoard->GetLayerName( B_Cu ) );
if( ( aMask & LSET::InternalCuMask() ).any() )
AccumulateDescription( layerInfo, _("Internal" ) ); AccumulateDescription( layerInfo, _("Internal" ) );
if( aMask & ALL_NO_CU_LAYERS ) if( ( aMask & LSET::AllNonCuMask() ).any() )
AccumulateDescription( layerInfo, _("Non-copper" ) ); AccumulateDescription( layerInfo, _("Non-copper" ) );
return layerInfo; 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 ) ...@@ -183,7 +183,7 @@ void LIB_EDIT_FRAME::SVG_PlotComponent( const wxString& aFullFileName )
delete plotter; 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 ) if( ! m_component )
return; return;
......
...@@ -608,7 +608,7 @@ public: ...@@ -608,7 +608,7 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode) * @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) * @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 ); bool aPrintMirrorMode, void* aData = NULL );
/** /**
......
...@@ -931,7 +931,7 @@ void SCH_EDIT_FRAME::OnPrint( wxCommandEvent& event ) ...@@ -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 ) void* aData )
{ {
GetScreen()->Draw( m_canvas, aDC, GR_DEFAULT_DRAWMODE ); GetScreen()->Draw( m_canvas, aDC, GR_DEFAULT_DRAWMODE );
......
...@@ -9,14 +9,12 @@ class GBR_LAYER_BOX_SELECTOR : public LAYER_BOX_SELECTOR ...@@ -9,14 +9,12 @@ class GBR_LAYER_BOX_SELECTOR : public LAYER_BOX_SELECTOR
{ {
public: public:
GBR_LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id, GBR_LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
const wxSize& size = wxDefaultSize, int n = 0, const wxString choices[] = NULL ) :
int n = 0, const wxString choices[] = NULL ) LAYER_BOX_SELECTOR( parent, id, pos, size, n, choices )
:LAYER_BOX_SELECTOR( parent, id, pos, size, n, choices ) {
{ m_layerhotkeys = false;
m_layerhotkeys = false; }
m_layerorder = false;
}
// Reload the Layers names and bitmaps // Reload the Layers names and bitmaps
// Virtual function // Virtual function
......
...@@ -27,7 +27,7 @@ private: ...@@ -27,7 +27,7 @@ private:
PAGE_INFO m_paper; PAGE_INFO m_paper;
TITLE_BLOCK m_titles; TITLE_BLOCK m_titles;
wxPoint m_originAxisPosition; 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: public:
DLIST<GERBER_DRAW_ITEM> m_Drawings; // linked list of Gerber Items DLIST<GERBER_DRAW_ITEM> m_Drawings; // linked list of Gerber Items
...@@ -93,7 +93,7 @@ public: ...@@ -93,7 +93,7 @@ public:
* changes the bit-mask of visible layers * changes the bit-mask of visible layers
* @param aLayerMask = The new 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; m_printLayersMask = aLayerMask;
} }
......
...@@ -86,7 +86,7 @@ GBR_SCREEN::GBR_SCREEN( const wxSize& aPageSizeIU ) : ...@@ -86,7 +86,7 @@ GBR_SCREEN::GBR_SCREEN( const wxSize& aPageSizeIU ) :
// Set the working grid size to a reasonable value (in 1/10000 inch) // Set the working grid size to a reasonable value (in 1/10000 inch)
SetGrid( DMIL_GRID( 500 ) ); 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 SetZoom( ZOOM_FACTOR( 350 ) ); // a default value for zoom
......
...@@ -134,7 +134,7 @@ public: ...@@ -134,7 +134,7 @@ public:
*/ */
void SetLayer( LAYER_NUM aLayer ) { m_Layer = aLayer; } void SetLayer( LAYER_NUM aLayer ) { m_Layer = aLayer; }
LAYER_MSK GetLayerMask() LSET GetLayerMask()
{ {
return ::GetLayerMask( m_Layer ); return ::GetLayerMask( m_Layer );
} }
......
...@@ -169,7 +169,7 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) ...@@ -169,7 +169,7 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
int rowCount; int rowCount;
int menuId = event.GetId(); int menuId = event.GetId();
bool visible = (menuId == ID_SHOW_ALL_LAYERS) ? true : false;; bool visible = (menuId == ID_SHOW_ALL_LAYERS) ? true : false;;
LAYER_MSK visibleLayers = NO_LAYERS; LSET visibleLayers = NO_LAYERS;
bool force_active_layer_visible; bool force_active_layer_visible;
m_alwaysShowActiveLayer = ( menuId == ID_ALWAYS_SHOW_NO_LAYERS_BUT_ACTIVE ); m_alwaysShowActiveLayer = ( menuId == ID_ALWAYS_SHOW_NO_LAYERS_BUT_ACTIVE );
...@@ -195,9 +195,9 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) ...@@ -195,9 +195,9 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
cb->SetValue( loc_visible ); cb->SetValue( loc_visible );
if( loc_visible ) if( loc_visible )
visibleLayers |= GetLayerMask( row ); visibleLayers |= GetLayerSet( row );
else else
visibleLayers &= ~GetLayerMask( row ); visibleLayers &= ~GetLayerSet( row );
} }
myframe->SetVisibleLayers( visibleLayers ); myframe->SetVisibleLayers( visibleLayers );
...@@ -237,7 +237,7 @@ void GERBER_LAYER_WIDGET::ReFill() ...@@ -237,7 +237,7 @@ void GERBER_LAYER_WIDGET::ReFill()
//-----<LAYER_WIDGET callbacks>------------------------------------------- //-----<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->SetLayerColor( aLayer, aColor );
myframe->m_SelLayerBox->ResyncBitmapOnly(); myframe->m_SelLayerBox->ResyncBitmapOnly();
...@@ -263,12 +263,12 @@ bool GERBER_LAYER_WIDGET::OnLayerSelect( LAYER_NUM aLayer ) ...@@ -263,12 +263,12 @@ bool GERBER_LAYER_WIDGET::OnLayerSelect( LAYER_NUM aLayer )
void GERBER_LAYER_WIDGET::OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal ) void GERBER_LAYER_WIDGET::OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal )
{ {
LAYER_MSK visibleLayers = myframe->GetVisibleLayers(); LSET visibleLayers = myframe->GetVisibleLayers();
if( isVisible ) if( isVisible )
visibleLayers |= GetLayerMask( aLayer ); visibleLayers |= GetLayerSet( aLayer );
else else
visibleLayers &= ~GetLayerMask( aLayer ); visibleLayers &= ~GetLayerSet( aLayer );
myframe->SetVisibleLayers( visibleLayers ); myframe->SetVisibleLayers( visibleLayers );
......
...@@ -91,9 +91,9 @@ public: ...@@ -91,9 +91,9 @@ public:
void ReFillRender(); void ReFillRender();
//-----<implement LAYER_WIDGET abstract callback functions>----------- //-----<implement LAYER_WIDGET abstract callback functions>-----------
void OnLayerColorChange( LAYER_NUM aLayer, EDA_COLOR_T aColor ); void OnLayerColorChange( int aLayer, EDA_COLOR_T aColor );
bool OnLayerSelect( LAYER_NUM aLayer ); bool OnLayerSelect( int aLayer );
void OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal ); void OnLayerVisible( int aLayer, bool isVisible, bool isFinal );
void OnRenderColorChange( int aId, EDA_COLOR_T aColor ); void OnRenderColorChange( int aId, EDA_COLOR_T aColor );
void OnRenderEnable( int aId, bool isEnabled ); void OnRenderEnable( int aId, bool isEnabled );
/** /**
......
...@@ -63,7 +63,7 @@ private: ...@@ -63,7 +63,7 @@ private:
public: public:
bool IsMirrored() { return m_Print_Mirror->IsChecked(); } bool IsMirrored() { return m_Print_Mirror->IsChecked(); }
bool PrintUsingSinglePage() { return true; } bool PrintUsingSinglePage() { return true; }
int SetLayerMaskFromListSelection(); int SetLayerSetFromListSelection();
}; };
...@@ -136,7 +136,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) ...@@ -136,7 +136,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
// Create layer list // Create layer list
for( LAYER_NUM ii = FIRST_LAYER; ii < layer_max; ++ii ) for( LAYER_NUM ii = FIRST_LAYER; ii < layer_max; ++ii )
{ {
LAYER_MSK mask = GetLayerMask( ii ); LSET mask = GetLayerSet( ii );
msg = _( "Layer" ); msg = _( "Layer" );
msg << wxT( " " ) << ii + 1; msg << wxT( " " ) << ii + 1;
m_BoxSelectLayer[ii] = new wxCheckBox( this, -1, msg ); m_BoxSelectLayer[ii] = new wxCheckBox( this, -1, msg );
...@@ -183,7 +183,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) ...@@ -183,7 +183,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
{ {
m_BoxSelectLayer[layer]->SetValue( option ); m_BoxSelectLayer[layer]->SetValue( option );
if( option ) if( option )
s_SelectedLayers |= GetLayerMask( layer ); s_SelectedLayers |= GetLayerSet( layer );
} }
} }
} }
...@@ -215,7 +215,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) ...@@ -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; int page_count = 0;
...@@ -225,7 +225,7 @@ int DIALOG_PRINT_USING_PRINTER::SetLayerMaskFromListSelection() ...@@ -225,7 +225,7 @@ int DIALOG_PRINT_USING_PRINTER::SetLayerMaskFromListSelection()
if( m_BoxSelectLayer[ii]->IsChecked() ) if( m_BoxSelectLayer[ii]->IsChecked() )
{ {
page_count++; page_count++;
s_Parameters.m_PrintMaskLayer |= GetLayerMask( ii ); s_Parameters.m_PrintMaskLayer |= GetLayerSet( ii );
} }
} }
...@@ -271,7 +271,7 @@ void DIALOG_PRINT_USING_PRINTER::SetPrintParameters( ) ...@@ -271,7 +271,7 @@ void DIALOG_PRINT_USING_PRINTER::SetPrintParameters( )
// because these objects create artefact when they are printed on an existing image. // because these objects create artefact when they are printed on an existing image.
s_Parameters.m_OptionPrintPage = false; s_Parameters.m_OptionPrintPage = false;
SetLayerMaskFromListSelection(); SetLayerSetFromListSelection();
int idx = m_ScaleOption->GetSelection(); int idx = m_ScaleOption->GetSelection();
s_Parameters.m_PrintScale = s_ScaleList[idx]; s_Parameters.m_PrintScale = s_ScaleList[idx];
...@@ -342,7 +342,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event ) ...@@ -342,7 +342,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
return; return;
} }
SetLayerMaskFromListSelection(); SetLayerSetFromListSelection();
// If no layer selected, we have no plot. prompt user if it happens // If no layer selected, we have no plot. prompt user if it happens
// because he could think there is a bug in Pcbnew: // because he could think there is a bug in Pcbnew:
......
...@@ -189,7 +189,7 @@ const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber ) ...@@ -189,7 +189,7 @@ const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber )
// Use a switch to explicitly show the mapping more clearly // Use a switch to explicitly show the mapping more clearly
switch( aLayerNumber ) 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_2: txt = wxT( "Inner1.Cu" ); break;
case LAYER_N_3: txt = wxT( "Inner2.Cu" ); break; case LAYER_N_3: txt = wxT( "Inner2.Cu" ); break;
case LAYER_N_4: txt = wxT( "Inner3.Cu" ); break; case LAYER_N_4: txt = wxT( "Inner3.Cu" ); break;
...@@ -204,20 +204,20 @@ const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber ) ...@@ -204,20 +204,20 @@ const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber )
case LAYER_N_13: txt = wxT( "Inner12.Cu" ); break; case LAYER_N_13: txt = wxT( "Inner12.Cu" ); break;
case LAYER_N_14: txt = wxT( "Inner13.Cu" ); break; case LAYER_N_14: txt = wxT( "Inner13.Cu" ); break;
case LAYER_N_15: txt = wxT( "Inner14.Cu" ); break; case LAYER_N_15: txt = wxT( "Inner14.Cu" ); break;
case LAYER_N_BACK: txt = wxT( "B.Cu" ); break; case B_Cu: txt = wxT( "B.Cu" ); break;
case ADHESIVE_N_BACK: txt = wxT( "B.Adhes" ); break; case B_Adhes: txt = wxT( "B.Adhes" ); break;
case ADHESIVE_N_FRONT: txt = wxT( "F.Adhes" ); break; case F_Adhes: txt = wxT( "F.Adhes" ); break;
case SOLDERPASTE_N_BACK: txt = wxT( "B.Paste" ); break; case B_Paste: txt = wxT( "B.Paste" ); break;
case SOLDERPASTE_N_FRONT: txt = wxT( "F.Paste" ); break; case F_Paste: txt = wxT( "F.Paste" ); break;
case SILKSCREEN_N_BACK: txt = wxT( "B.SilkS" ); break; case B_SilkS: txt = wxT( "B.SilkS" ); break;
case SILKSCREEN_N_FRONT: txt = wxT( "F.SilkS" ); break; case F_SilkS: txt = wxT( "F.SilkS" ); break;
case SOLDERMASK_N_BACK: txt = wxT( "B.Mask" ); break; case B_Mask: txt = wxT( "B.Mask" ); break;
case SOLDERMASK_N_FRONT: txt = wxT( "F.Mask" ); break; case F_Mask: txt = wxT( "F.Mask" ); break;
case DRAW_N: txt = wxT( "Dwgs.User" ); break; case Dwgs_User: txt = wxT( "Dwgs.User" ); break;
case COMMENT_N: txt = wxT( "Cmts.User" ); break; case Cmts_User: txt = wxT( "Cmts.User" ); break;
case ECO1_N: txt = wxT( "Eco1.User" ); break; case Eco1_User: txt = wxT( "Eco1.User" ); break;
case ECO2_N: txt = wxT( "Eco2.User" ); break; case Eco2_User: txt = wxT( "Eco2.User" ); break;
case EDGE_N: txt = wxT( "Edge.Cuts" ); break; case Edge_Cuts: txt = wxT( "Edge.Cuts" ); break;
default: txt = wxT( "BAD_INDEX" ); break; default: txt = wxT( "BAD_INDEX" ); break;
} }
......
...@@ -42,11 +42,11 @@ ...@@ -42,11 +42,11 @@
#include <printout_controler.h> #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 ) bool aPrintMirrorMode, void* aData )
{ {
// Save current draw options, because print mode has specific options: // Save current draw options, because print mode has specific options:
LAYER_MSK visiblemask = GetVisibleLayers(); LSET visiblemask = GetVisibleLayers();
GBR_DISPLAY_OPTIONS imgDisplayOptions = m_DisplayOptions; GBR_DISPLAY_OPTIONS imgDisplayOptions = m_DisplayOptions;
// Set draw options for printing: // Set draw options for printing:
......
...@@ -551,7 +551,7 @@ void GERBVIEW_FRAME::SetVisibleAlls() ...@@ -551,7 +551,7 @@ void GERBVIEW_FRAME::SetVisibleAlls()
* Returns a bit-mask of all the layers that are visible * Returns a bit-mask of all the layers that are visible
* @return int - the visible layers in bit-mapped form. * @return int - the visible layers in bit-mapped form.
*/ */
LAYER_MSK GERBVIEW_FRAME::GetVisibleLayers() const LSET GERBVIEW_FRAME::GetVisibleLayers() const
{ {
return FULL_LAYERS; // TODO return FULL_LAYERS; // TODO
} }
...@@ -563,7 +563,7 @@ LAYER_MSK GERBVIEW_FRAME::GetVisibleLayers() const ...@@ -563,7 +563,7 @@ LAYER_MSK GERBVIEW_FRAME::GetVisibleLayers() const
* changes the bit-mask of visible layers * changes the bit-mask of visible layers
* @param aLayerMask = The new 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 ); GetGerberLayout()->SetVisibleLayers( aLayerMask );
} }
......
...@@ -308,7 +308,7 @@ public: ...@@ -308,7 +308,7 @@ public:
* Returns a bit-mask of all the layers that are visible * Returns a bit-mask of all the layers that are visible
* @return int - the visible layers in bit-mapped form. * @return int - the visible layers in bit-mapped form.
*/ */
LAYER_MSK GetVisibleLayers() const; LSET GetVisibleLayers() const;
/** /**
* Function SetVisibleLayers * Function SetVisibleLayers
...@@ -316,7 +316,7 @@ public: ...@@ -316,7 +316,7 @@ public:
* changes the bit-mask of visible layers * changes the bit-mask of visible layers
* @param aLayerMask = The new 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 * Function IsLayerVisible
...@@ -667,7 +667,7 @@ public: ...@@ -667,7 +667,7 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode) * @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) * @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 ); void* aData = NULL );
/** /**
......
...@@ -128,7 +128,7 @@ void LAYERS_MAP_DIALOG::initDialog() ...@@ -128,7 +128,7 @@ void LAYERS_MAP_DIALOG::initDialog()
if( (pcb_layer_num == m_exportBoardCopperLayersCount - 1) if( (pcb_layer_num == m_exportBoardCopperLayersCount - 1)
&& (m_exportBoardCopperLayersCount > 1) ) && (m_exportBoardCopperLayersCount > 1) )
pcb_layer_num = LAYER_N_FRONT; pcb_layer_num = F_Cu;
m_buttonTable[m_itemsCount] = ii; m_buttonTable[m_itemsCount] = ii;
m_layersLookUpTable[ii] = pcb_layer_num; m_layersLookUpTable[ii] = pcb_layer_num;
...@@ -288,7 +288,7 @@ void LAYERS_MAP_DIALOG::OnResetClick( wxCommandEvent& event ) ...@@ -288,7 +288,7 @@ void LAYERS_MAP_DIALOG::OnResetClick( wxCommandEvent& event )
{ {
if( (layer == m_exportBoardCopperLayersCount - 1) if( (layer == m_exportBoardCopperLayersCount - 1)
&& (m_exportBoardCopperLayersCount > 1) ) && (m_exportBoardCopperLayersCount > 1) )
layer = LAYER_N_FRONT; layer = F_Cu;
m_layersLookUpTable[ii] = layer; m_layersLookUpTable[ii] = layer;
msg = GetPCBDefaultLayerName( layer ); msg = GetPCBDefaultLayerName( layer );
m_layersList[ii]->SetLabel( msg ); m_layersList[ii]->SetLabel( msg );
...@@ -362,7 +362,7 @@ void LAYERS_MAP_DIALOG::OnSelectLayer( wxCommandEvent& event ) ...@@ -362,7 +362,7 @@ void LAYERS_MAP_DIALOG::OnSelectLayer( wxCommandEvent& event )
LAYER_NUM jj = m_layersLookUpTable[m_buttonTable[ii]]; LAYER_NUM jj = m_layersLookUpTable[m_buttonTable[ii]];
if( !IsValidLayer( jj ) ) 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 ); jj = m_Parent->SelectPCBLayer( jj, m_exportBoardCopperLayersCount, true );
...@@ -408,7 +408,7 @@ void LAYERS_MAP_DIALOG::OnOkClick( wxCommandEvent& event ) ...@@ -408,7 +408,7 @@ void LAYERS_MAP_DIALOG::OnOkClick( wxCommandEvent& event )
int inner_layer_max = 0; int inner_layer_max = 0;
for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii ) 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 ) if( m_layersLookUpTable[ii ] > inner_layer_max )
inner_layer_max = m_layersLookUpTable[ii]; inner_layer_max = m_layersLookUpTable[ii];
......
...@@ -47,6 +47,7 @@ struct VIA_DIMENSION ...@@ -47,6 +47,7 @@ struct VIA_DIMENSION
} }
}; };
/** /**
* Class BOARD_DESIGN_SETTINGS * Class BOARD_DESIGN_SETTINGS
* contains design settings for a BOARD object. * contains design settings for a BOARD object.
...@@ -326,7 +327,7 @@ public: ...@@ -326,7 +327,7 @@ public:
* returns a bit-mask of all the layers that are visible * returns a bit-mask of all the layers that are visible
* @return int - the visible layers in bit-mapped form. * @return int - the visible layers in bit-mapped form.
*/ */
inline LAYER_MSK GetVisibleLayers() const inline LSET GetVisibleLayers() const
{ {
return m_visibleLayers; return m_visibleLayers;
} }
...@@ -343,30 +344,30 @@ public: ...@@ -343,30 +344,30 @@ public:
* changes the bit-mask of visible layers * changes the bit-mask of visible layers
* @param aMask = The new 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 * Function IsLayerVisible
* tests whether a given layer is visible * 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. * @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 // If a layer is disabled, it is automatically invisible
return m_visibleLayers & m_enabledLayers & GetLayerMask( aLayer ); return (m_visibleLayers & m_enabledLayers)[aLayerId];
} }
/** /**
* Function SetLayerVisibility * Function SetLayerVisibility
* changes the visibility of a given layer * 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 * @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 * Function GetVisibleElements
...@@ -417,7 +418,7 @@ public: ...@@ -417,7 +418,7 @@ public:
* returns a bit-mask of all the layers that are enabled * returns a bit-mask of all the layers that are enabled
* @return int - the enabled layers in bit-mapped form. * @return int - the enabled layers in bit-mapped form.
*/ */
inline LAYER_MSK GetEnabledLayers() const inline LSET GetEnabledLayers() const
{ {
return m_enabledLayers; return m_enabledLayers;
} }
...@@ -427,17 +428,17 @@ public: ...@@ -427,17 +428,17 @@ public:
* changes the bit-mask of enabled layers * changes the bit-mask of enabled layers
* @param aMask = The new 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 * Function IsLayerEnabled
* tests whether a given layer is enabled * 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 * @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];
} }
/** /**
...@@ -485,11 +486,13 @@ private: ...@@ -485,11 +486,13 @@ private:
///> Custom via size (used after UseCustomTrackViaSize( true ) was called). ///> Custom via size (used after UseCustomTrackViaSize( true ) was called).
VIA_DIMENSION m_customViaSize; VIA_DIMENSION m_customViaSize;
int m_copperLayerCount; ///< Number of copper layers for this design 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
int m_visibleElements; ///< Bit-mask for element category visibility LSET m_visibleLayers; ///< Bit-mask for layer visibility
int m_boardThickness; ///< Board thickness for 3D viewer
int m_visibleElements; ///< Bit-mask for element category visibility
int m_boardThickness; ///< Board thickness for 3D viewer
/// Current net class name used to display netclass info. /// Current net class name used to display netclass info.
/// This is also the last used netclass after starting a track. /// This is also the last used netclass after starting a track.
......
...@@ -76,12 +76,12 @@ class BOARD_ITEM : public EDA_ITEM ...@@ -76,12 +76,12 @@ class BOARD_ITEM : public EDA_ITEM
void SetBack( EDA_ITEM* aBack ) { Pback = aBack; } void SetBack( EDA_ITEM* aBack ) { Pback = aBack; }
protected: protected:
LAYER_NUM m_Layer; LAYER_ID m_Layer;
public: public:
BOARD_ITEM( BOARD_ITEM* aParent, KICAD_T idtype ) : 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: ...@@ -114,7 +114,7 @@ public:
* Function GetLayer * Function GetLayer
* returns the layer this item is on. * returns the layer this item is on.
*/ */
LAYER_NUM GetLayer() const { return m_Layer; } LAYER_ID GetLayer() const { return m_Layer; }
/** /**
* Function SetLayer * Function SetLayer
...@@ -123,7 +123,7 @@ public: ...@@ -123,7 +123,7 @@ public:
* is virtual because some items (in fact: class DIMENSION) * is virtual because some items (in fact: class DIMENSION)
* have a slightly different initialization * 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. // trap any invalid layers, then go find the caller and fix it.
// wxASSERT( unsigned( aLayer ) < unsigned( NB_PCB_LAYERS ) ); // wxASSERT( unsigned( aLayer ) < unsigned( NB_PCB_LAYERS ) );
......
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
#define _COLORS_DESIGN_SETTING_H #define _COLORS_DESIGN_SETTING_H
#include <layers_id_colors_and_visibility.h> #include <layers_id_colors_and_visibility.h>
#define LAYERSCOLORSBUFFERSIZE NB_LAYERS
#define ITEMSCOLORSBUFFERSIZE 32
/** /**
* Class COLORS_DESIGN_SETTINGS * Class COLORS_DESIGN_SETTINGS
...@@ -20,10 +18,10 @@ public: ...@@ -20,10 +18,10 @@ public:
// Color options for screen display of the Printed Board and schematic: // Color options for screen display of the Printed Board and schematic:
// Common to Eeschema, Pcbnew, GerbView // 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 // 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: public:
COLORS_DESIGN_SETTINGS(); COLORS_DESIGN_SETTINGS();
......
...@@ -15,7 +15,6 @@ class LAYER_SELECTOR ...@@ -15,7 +15,6 @@ class LAYER_SELECTOR
{ {
protected: protected:
bool m_layerhotkeys; bool m_layerhotkeys;
bool m_layerorder;
public: public:
// Hotkey Info // Hotkey Info
...@@ -41,12 +40,13 @@ public: ...@@ -41,12 +40,13 @@ public:
protected: protected:
// Fills the layer bitmap aLayerbmp with the layer color // 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 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: public:
// Hotkey Info // Hotkey Info
...@@ -69,7 +69,7 @@ public: ...@@ -69,7 +69,7 @@ public:
LAYER_NUM GetLayerSelection() const; LAYER_NUM GetLayerSelection() const;
// Set Layer # // Set Layer #
int SetLayerSelection(LAYER_NUM layer); int SetLayerSelection( LAYER_NUM layer );
// Reload the Layers // Reload the Layers
// Virtual pure function because GerbView uses its own functions in a derived class // Virtual pure function because GerbView uses its own functions in a derived class
...@@ -79,23 +79,4 @@ public: ...@@ -79,23 +79,4 @@ public:
void ResyncBitmapOnly(); void ResyncBitmapOnly();
}; };
#define DECLARE_LAYERS_HOTKEY(list) int list[NB_LAYERS] = \ #endif // CLASS_LAYER_BOX_SELECTOR_H
{ \
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
...@@ -17,9 +17,9 @@ class UNDO_REDO_CONTAINER; ...@@ -17,9 +17,9 @@ class UNDO_REDO_CONTAINER;
class PCB_SCREEN : public BASE_SCREEN class PCB_SCREEN : public BASE_SCREEN
{ {
public: public:
LAYER_NUM m_Active_Layer; LAYER_ID m_Active_Layer;
LAYER_NUM m_Route_Layer_TOP; LAYER_ID m_Route_Layer_TOP;
LAYER_NUM m_Route_Layer_BOTTOM; LAYER_ID m_Route_Layer_BOTTOM;
public: public:
......
...@@ -613,7 +613,7 @@ public: ...@@ -613,7 +613,7 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode) * @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) * @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 * Function CoordinateToString
......
This diff is collapsed.
...@@ -18,9 +18,6 @@ class TRACK; ...@@ -18,9 +18,6 @@ class TRACK;
class BOARD; class BOARD;
class DISPLAY_OPTIONS; 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 DISPLAY_OPTIONS DisplayOpt;
extern int g_CurrentVersionPCB; extern int g_CurrentVersionPCB;
......
...@@ -507,7 +507,7 @@ public: ...@@ -507,7 +507,7 @@ public:
*/ */
void UpdateItems(); void UpdateItems();
const BOX2I CalculateExtents() ; const BOX2I CalculateExtents() ;
static const int VIEW_MAX_LAYERS = 128; ///< maximum number of layers that may be shown static const int VIEW_MAX_LAYERS = 128; ///< maximum number of layers that may be shown
......
...@@ -606,16 +606,16 @@ public: ...@@ -606,16 +606,16 @@ public:
* @param aDlgPosition = position of dialog ( defualt = centered) * @param aDlgPosition = position of dialog ( defualt = centered)
* @return the selected layer id * @return the selected layer id
*/ */
LAYER_NUM SelectLayer( LAYER_NUM aDefaultLayer, LAYER_ID SelectLayer( LAYER_ID aDefaultLayer,
LAYER_MSK aNotAllowedLayersMask = 0, LSET aNotAllowedLayersMask = 0,
wxPoint aDlgPosition = wxDefaultPosition ); wxPoint aDlgPosition = wxDefaultPosition );
/* Display a list of two copper layers to choose a pair of copper layers /* Display a list of two copper layers to choose a pair of copper layers
* the layer pair is used to fast switch between copper layers when placing vias * the layer pair is used to fast switch between copper layers when placing vias
*/ */
void SelectCopperLayerPair(); 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 LoadSettings( wxConfigBase* aCfg ); // override virtual
void SaveSettings( wxConfigBase* aCfg ); // override virtual void SaveSettings( wxConfigBase* aCfg ); // override virtual
......
...@@ -1257,7 +1257,7 @@ public: ...@@ -1257,7 +1257,7 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode) * @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) * @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 ); bool aPrintMirrorMode, void* aData = NULL );
void SetSimulatorCommand( const wxString& aCommand ) { m_simulatorCommand = aCommand; } void SetSimulatorCommand( const wxString& aCommand ) { m_simulatorCommand = aCommand; }
......
...@@ -283,8 +283,8 @@ public: ...@@ -283,8 +283,8 @@ public:
* @param aPrintMirrorMode = true to plot mirrored * @param aPrintMirrorMode = true to plot mirrored
* @param aData = a pointer on an auxiliary data (NULL if not used) * @param aData = a pointer on an auxiliary data (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 ); void* aData = NULL );
void GetKicadAbout( wxCommandEvent& event ); void GetKicadAbout( wxCommandEvent& event );
...@@ -535,26 +535,26 @@ public: ...@@ -535,26 +535,26 @@ public:
* Function SetHighContrastLayer * Function SetHighContrastLayer
* takes care of display settings for the given layer to be displayed in high contrast mode. * 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 * Function SetTopLayer
* moves the selected layer to the top, so it is displayed above all others. * 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 * Function SetActiveLayer
* will change the currently active layer to \a aLayer and also * will change the currently active layer to \a aLayer and also
* update the PCB_LAYER_WIDGET. * update the PCB_LAYER_WIDGET.
*/ */
void SetActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate = true ); void SetActiveLayer( LAYER_ID aLayer, bool doLayerWidgetUpdate = true );
/** /**
* Function GetActiveLayer * Function GetActiveLayer
* returns the active layer * returns the active layer
*/ */
LAYER_NUM GetActiveLayer() const LAYER_ID GetActiveLayer() const
{ {
return ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer; return ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer;
} }
...@@ -784,8 +784,6 @@ public: ...@@ -784,8 +784,6 @@ public:
void InstallDisplayOptionsDialog( wxCommandEvent& aEvent ); void InstallDisplayOptionsDialog( wxCommandEvent& aEvent );
void InstallPcbGlobalDeleteFrame( const wxPoint& pos ); void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
void InstallDialogLayerSetup();
/** /**
* Function GenFootprintsPositionFile * Function GenFootprintsPositionFile
* Calls DoGenFootprintsPositionFile to create a footprint position file * Calls DoGenFootprintsPositionFile to create a footprint position file
...@@ -1263,7 +1261,7 @@ public: ...@@ -1263,7 +1261,7 @@ public:
bool MergeCollinearTracks( TRACK* track, wxDC* DC, int end ); bool MergeCollinearTracks( TRACK* track, wxDC* DC, int end );
void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC ); void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC );
void SwitchLayer( wxDC* DC, LAYER_NUM layer ); void SwitchLayer( wxDC* DC, LAYER_ID layer );
/** /**
* Function Add45DegreeSegment * Function Add45DegreeSegment
...@@ -1463,7 +1461,7 @@ public: ...@@ -1463,7 +1461,7 @@ public:
DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, STROKE_T shape, wxDC* DC ); DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, STROKE_T shape, wxDC* DC );
void End_Edge( DRAWSEGMENT* Segment, wxDC* DC ); void End_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Delete_Segment_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: // Dimension handling:
void ShowDimensionPropertyDialog( DIMENSION* aDimension, wxDC* aDC ); void ShowDimensionPropertyDialog( DIMENSION* aDimension, wxDC* aDC );
......
...@@ -496,7 +496,7 @@ void PL_EDITOR_FRAME::UpdateStatusBar() ...@@ -496,7 +496,7 @@ void PL_EDITOR_FRAME::UpdateStatusBar()
// Display units // 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 ) bool aPrintMirrorMode, void * aData )
{ {
GetScreen()-> m_ScreenNumber = GetPageNumberOption() ? 1 : 2; GetScreen()-> m_ScreenNumber = GetPageNumberOption() ? 1 : 2;
......
...@@ -263,7 +263,7 @@ public: ...@@ -263,7 +263,7 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode) * @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) * @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 ); bool aPrintMirrorMode, void * aData );
void OnFileHistory( wxCommandEvent& event ); void OnFileHistory( wxCommandEvent& event );
......
...@@ -122,7 +122,7 @@ static void drawPlacementRoutingMatrix( BOARD* aBrd, wxDC* DC ); ...@@ -122,7 +122,7 @@ static void drawPlacementRoutingMatrix( BOARD* aBrd, wxDC* DC );
static int TstModuleOnBoard( BOARD* Pcb, MODULE* Module, bool TstOtherSide ); static int TstModuleOnBoard( BOARD* Pcb, MODULE* Module, bool TstOtherSide );
static void CreateKeepOutRectangle( int ux0, int uy0, int ux1, int uy1, 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 MODULE* PickModule( PCB_EDIT_FRAME* pcbframe, wxDC* DC );
static int propagate(); static int propagate();
...@@ -133,7 +133,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC ) ...@@ -133,7 +133,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
wxPoint PosOK; wxPoint PosOK;
wxPoint memopos; wxPoint memopos;
int error; int error;
LAYER_NUM lay_tmp_TOP, lay_tmp_BOTTOM; LAYER_ID lay_tmp_TOP, lay_tmp_BOTTOM;
// Undo: init list // Undo: init list
PICKED_ITEMS_LIST newList; PICKED_ITEMS_LIST newList;
...@@ -488,12 +488,12 @@ int genPlacementRoutingMatrix( BOARD* aBrd, EDA_MSG_PANEL* messagePanel ) ...@@ -488,12 +488,12 @@ int genPlacementRoutingMatrix( BOARD* aBrd, EDA_MSG_PANEL* messagePanel )
msg.Printf( wxT( "%d" ), RoutingMatrix.m_MemSize / 1024 ); msg.Printf( wxT( "%d" ), RoutingMatrix.m_MemSize / 1024 );
messagePanel->SetMessage( 24, wxT( "Mem(Kb)" ), msg, CYAN ); 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 ) 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 // Place the edge layer segments
TRACK TmpSegm( NULL ); TRACK TmpSegm( NULL );
...@@ -513,7 +513,7 @@ int genPlacementRoutingMatrix( BOARD* aBrd, EDA_MSG_PANEL* messagePanel ) ...@@ -513,7 +513,7 @@ int genPlacementRoutingMatrix( BOARD* aBrd, EDA_MSG_PANEL* messagePanel )
case PCB_LINE_T: case PCB_LINE_T:
DrawSegm = (DRAWSEGMENT*) PtStruct; DrawSegm = (DRAWSEGMENT*) PtStruct;
if( DrawSegm->GetLayer() != EDGE_N ) if( DrawSegm->GetLayer() != Edge_Cuts )
break; break;
TraceSegmentPcb( DrawSegm, HOLE | CELL_is_EDGE, TraceSegmentPcb( DrawSegm, HOLE | CELL_is_EDGE,
...@@ -550,7 +550,7 @@ int genPlacementRoutingMatrix( BOARD* aBrd, EDA_MSG_PANEL* messagePanel ) ...@@ -550,7 +550,7 @@ int genPlacementRoutingMatrix( BOARD* aBrd, EDA_MSG_PANEL* messagePanel )
void genModuleOnRoutingMatrix( MODULE* Module ) void genModuleOnRoutingMatrix( MODULE* Module )
{ {
int ox, oy, fx, fy; int ox, oy, fx, fy;
int layerMask; LSET layerMask;
D_PAD* Pad; D_PAD* Pad;
EDA_RECT fpBBox = Module->GetBoundingBox(); EDA_RECT fpBBox = Module->GetBoundingBox();
...@@ -585,13 +585,11 @@ void genModuleOnRoutingMatrix( MODULE* Module ) ...@@ -585,13 +585,11 @@ void genModuleOnRoutingMatrix( MODULE* Module )
if( fy > RoutingMatrix.m_BrdBox.GetBottom() ) if( fy > RoutingMatrix.m_BrdBox.GetBottom() )
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 ) if( Module->GetLayer() == B_Cu )
layerMask = LAYER_FRONT; layerMask.set( B_Cu );
if( Module->GetLayer() == LAYER_N_BACK )
layerMask = LAYER_BACK;
TraceFilledRectangle( ox, oy, fx, fy, layerMask, TraceFilledRectangle( ox, oy, fx, fy, layerMask,
CELL_is_MODULE, WRITE_OR_CELL ); CELL_is_MODULE, WRITE_OR_CELL );
...@@ -666,15 +664,11 @@ int getOptimalModulePlacement( PCB_EDIT_FRAME* aFrame, MODULE* aModule, wxDC* aD ...@@ -666,15 +664,11 @@ int getOptimalModulePlacement( PCB_EDIT_FRAME* aFrame, MODULE* aModule, wxDC* aD
if( RoutingMatrix.m_RoutingLayersCount > 1 ) if( RoutingMatrix.m_RoutingLayersCount > 1 )
{ {
D_PAD* Pad; LSET other( aModule->GetLayer() == B_Cu ? F_Cu : B_Cu );
int otherLayerMask = LAYER_BACK;
if( aModule->GetLayer() == LAYER_N_BACK )
otherLayerMask = LAYER_FRONT;
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; continue;
TstOtherSide = true; TstOtherSide = true;
...@@ -875,7 +869,7 @@ int TstModuleOnBoard( BOARD* Pcb, MODULE* aModule, bool TstOtherSide ) ...@@ -875,7 +869,7 @@ int TstModuleOnBoard( BOARD* Pcb, MODULE* aModule, bool TstOtherSide )
int side = TOP; int side = TOP;
int otherside = BOTTOM; int otherside = BOTTOM;
if( aModule->GetLayer() == LAYER_N_BACK ) if( aModule->GetLayer() == B_Cu )
{ {
side = BOTTOM; otherside = TOP; side = BOTTOM; otherside = TOP;
} }
...@@ -966,7 +960,7 @@ double compute_Ratsnest_PlaceModule( BOARD* aBrd ) ...@@ -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 * 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, 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, col;
int row_min, row_max, col_min, col_max, pmarge; int row_min, row_max, col_min, col_max, pmarge;
...@@ -974,10 +968,10 @@ void CreateKeepOutRectangle( int ux0, int uy0, int ux1, int uy1, ...@@ -974,10 +968,10 @@ void CreateKeepOutRectangle( int ux0, int uy0, int ux1, int uy1,
DIST_CELL data, LocalKeepOut; DIST_CELL data, LocalKeepOut;
int lgain, cgain; int lgain, cgain;
if( aLayerMask & GetLayerMask( g_Route_Layer_BOTTOM ) ) if( aLayerMask[g_Route_Layer_BOTTOM] )
trace = 1; // Trace on bottom layer. 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. trace |= 2; // Trace on top layer.
if( trace == 0 ) if( trace == 0 )
......
...@@ -66,7 +66,7 @@ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode ) ...@@ -66,7 +66,7 @@ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode )
} }
else else
{ {
g_Route_Layer_TOP = g_Route_Layer_BOTTOM = LAYER_N_BACK; g_Route_Layer_TOP = g_Route_Layer_BOTTOM = B_Cu;
} }
switch( mode ) switch( mode )
......
...@@ -206,12 +206,12 @@ void TraceSegmentPcb( DRAWSEGMENT* pt_segm, int type, int marge, int op_logic ); ...@@ -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 * op_logic = WRITE_CELL, WRITE_OR_CELL, WRITE_XOR_CELL, WRITE_AND_CELL
*/ */
void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1, 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. */ /* Same as above, but the rectangle is inclined angle angle. */
void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1, 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 ); int color, int op_logic );
/* QUEUE.CPP */ /* QUEUE.CPP */
......
...@@ -59,7 +59,7 @@ static void DrawSegmentQcq( int ux0, int uy0, ...@@ -59,7 +59,7 @@ static void DrawSegmentQcq( int ux0, int uy0,
int op_logic ); int op_logic );
static void TraceFilledCircle( int cx, int cy, int radius, static void TraceFilledCircle( int cx, int cy, int radius,
LAYER_MSK aLayerMask, LSET aLayerMask,
int color, int color,
int op_logic ); int op_logic );
...@@ -96,7 +96,7 @@ void PlacePad( D_PAD* aPad, int color, int marge, int op_logic ) ...@@ -96,7 +96,7 @@ void PlacePad( D_PAD* aPad, int color, int marge, int op_logic )
if( aPad->GetShape() == PAD_CIRCLE ) if( aPad->GetShape() == PAD_CIRCLE )
{ {
TraceFilledCircle( shape_pos.x, shape_pos.y, dx, TraceFilledCircle( shape_pos.x, shape_pos.y, dx,
aPad->GetLayerMask(), color, op_logic ); aPad->GetLayerSet(), color, op_logic );
return; return;
} }
...@@ -120,14 +120,14 @@ void PlacePad( D_PAD* aPad, int color, int marge, int op_logic ) ...@@ -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, TraceFilledRectangle( shape_pos.x - dx, shape_pos.y - dy,
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 else
{ {
TraceFilledRectangle( shape_pos.x - dx, shape_pos.y - dy, TraceFilledRectangle( shape_pos.x - dx, shape_pos.y - dy,
shape_pos.x + dx, shape_pos.y + dy, shape_pos.x + dx, shape_pos.y + dy,
aPad->GetOrientation(), aPad->GetOrientation(),
aPad->GetLayerMask(), color, op_logic ); aPad->GetLayerSet(), color, op_logic );
} }
} }
...@@ -140,10 +140,8 @@ void PlacePad( D_PAD* aPad, int color, int marge, int op_logic ) ...@@ -140,10 +140,8 @@ void PlacePad( D_PAD* aPad, int color, int marge, int op_logic )
* color: mask write in cells * color: mask write in cells
* op_logic: type of writing in the cell (WRITE, OR) * op_logic: type of writing in the cell (WRITE, OR)
*/ */
void TraceFilledCircle( int cx, int cy, int radius, void TraceFilledCircle( int cx, int cy, int radius,
LAYER_MSK aLayerMask, LSET aLayerMask, int color, int op_logic )
int color,
int op_logic )
{ {
int row, col; int row, col;
int ux0, uy0, ux1, uy1; int ux0, uy0, ux1, uy1;
...@@ -153,10 +151,10 @@ void TraceFilledCircle( int cx, int cy, int radius, ...@@ -153,10 +151,10 @@ void TraceFilledCircle( int cx, int cy, int radius,
int tstwrite = 0; int tstwrite = 0;
int distmin; int distmin;
if( aLayerMask & GetLayerMask( g_Route_Layer_BOTTOM ) ) if( aLayerMask[g_Route_Layer_BOTTOM] )
trace = 1; // Trace on BOTTOM trace = 1; // Trace on BOTTOM
if( aLayerMask & GetLayerMask( g_Route_Layer_TOP ) ) if( aLayerMask[g_Route_Layer_TOP] )
if( RoutingMatrix.m_RoutingLayersCount > 1 ) if( RoutingMatrix.m_RoutingLayersCount > 1 )
trace |= 2; // Trace on TOP trace |= 2; // Trace on TOP
...@@ -297,23 +295,23 @@ void TraceSegmentPcb( TRACK* aTrack, int color, int marge, int op_logic ) ...@@ -297,23 +295,23 @@ void TraceSegmentPcb( TRACK* aTrack, int color, int marge, int op_logic )
// Test if VIA (filled circle need to be drawn) // Test if VIA (filled circle need to be drawn)
if( aTrack->Type() == PCB_VIA_T ) if( aTrack->Type() == PCB_VIA_T )
{ {
LAYER_MSK layer_mask = NO_LAYERS; LSET layer_mask;
if( aTrack->IsOnLayer( g_Route_Layer_BOTTOM ) ) 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( aTrack->IsOnLayer( g_Route_Layer_TOP ) )
{ {
if( layer_mask == 0 ) if( !layer_mask.any() )
layer_mask = GetLayerMask( g_Route_Layer_TOP ); layer_mask = LSET( g_Route_Layer_TOP );
else else
layer_mask = FULL_LAYERS; layer_mask.set();
} }
if( color == VIA_IMPOSSIBLE ) 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, TraceFilledCircle( aTrack->GetStart().x, aTrack->GetStart().y,
half_width, layer_mask, color, op_logic ); half_width, layer_mask, color, op_logic );
} }
...@@ -326,7 +324,7 @@ void TraceSegmentPcb( TRACK* aTrack, int color, int marge, int 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; int uy1 = aTrack->GetEnd().y - RoutingMatrix.GetBrdCoordOrigin().y;
// Ordinary track // Ordinary track
LAYER_NUM layer = aTrack->GetLayer(); LAYER_ID layer = aTrack->GetLayer();
if( color == VIA_IMPOSSIBLE ) if( color == VIA_IMPOSSIBLE )
layer = UNDEFINED_LAYER; layer = UNDEFINED_LAYER;
...@@ -478,17 +476,16 @@ void TracePcbLine( int x0, int y0, int x1, int y1, LAYER_NUM layer, int color, i ...@@ -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, 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, col;
int row_min, row_max, col_min, col_max; int row_min, row_max, col_min, col_max;
int trace = 0; int trace = 0;
if( ( aLayerMask & GetLayerMask( g_Route_Layer_BOTTOM ) ) ) if( aLayerMask[g_Route_Layer_BOTTOM] )
trace = 1; // Trace on BOTTOM trace = 1; // Trace on BOTTOM
if( ( aLayerMask & GetLayerMask( g_Route_Layer_TOP ) ) && if( aLayerMask[g_Route_Layer_TOP] && RoutingMatrix.m_RoutingLayersCount > 1 )
RoutingMatrix.m_RoutingLayersCount > 1 )
trace |= 2; // Trace on TOP trace |= 2; // Trace on TOP
if( trace == 0 ) if( trace == 0 )
...@@ -541,7 +538,7 @@ void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1, ...@@ -541,7 +538,7 @@ void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1,
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 row, col;
int cx, cy; // Center of rectangle int cx, cy; // Center of rectangle
...@@ -550,10 +547,10 @@ void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1, ...@@ -550,10 +547,10 @@ void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1,
int rotrow, rotcol; int rotrow, rotcol;
int trace = 0; int trace = 0;
if( aLayerMask & GetLayerMask( g_Route_Layer_BOTTOM ) ) if( aLayerMask[g_Route_Layer_BOTTOM] )
trace = 1; // Trace on BOTTOM trace = 1; // Trace on BOTTOM
if( aLayerMask & GetLayerMask( g_Route_Layer_TOP ) ) if( aLayerMask[g_Route_Layer_TOP] )
{ {
if( RoutingMatrix.m_RoutingLayersCount > 1 ) if( RoutingMatrix.m_RoutingLayersCount > 1 )
trace |= 2; // Trace on TOP trace |= 2; // Trace on TOP
......
...@@ -115,7 +115,7 @@ int MATRIX_ROUTING_HEAD::InitRoutingMatrix() ...@@ -115,7 +115,7 @@ int MATRIX_ROUTING_HEAD::InitRoutingMatrix()
m_DistSide[side] = NULL; m_DistSide[side] = NULL;
m_DirSide[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) ); m_BoardSide[side] = (MATRIX_CELL*) operator new( ii * sizeof(MATRIX_CELL) );
memset( m_BoardSide[side], 0, ii * sizeof(MATRIX_CELL) ); memset( m_BoardSide[side], 0, ii * sizeof(MATRIX_CELL) );
...@@ -196,16 +196,16 @@ void MATRIX_ROUTING_HEAD::UnInitRoutingMatrix() ...@@ -196,16 +196,16 @@ void MATRIX_ROUTING_HEAD::UnInitRoutingMatrix()
*/ */
void PlaceCells( BOARD* aPcb, int net_code, int flag ) void PlaceCells( BOARD* aPcb, int net_code, int flag )
{ {
int ux0 = 0, uy0 = 0, ux1, uy1, dx, dy; int ux0 = 0, uy0 = 0, ux1, uy1, dx, dy;
int marge, via_marge; int marge, via_marge;
LAYER_MSK layerMask; LSET layerMask;
// use the default NETCLASS? // use the default NETCLASS?
NETCLASSPTR nc = aPcb->GetDesignSettings().GetDefault(); NETCLASSPTR nc = aPcb->GetDesignSettings().GetDefault();
int trackWidth = nc->GetTrackWidth(); int trackWidth = nc->GetTrackWidth();
int clearance = nc->GetClearance(); int clearance = nc->GetClearance();
int viaSize = nc->GetViaDiameter(); int viaSize = nc->GetViaDiameter();
marge = clearance + (trackWidth / 2); marge = clearance + (trackWidth / 2);
via_marge = clearance + (viaSize / 2); via_marge = clearance + (viaSize / 2);
...@@ -237,7 +237,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag ) ...@@ -237,7 +237,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
EDGE_MODULE* edge = (EDGE_MODULE*) item; EDGE_MODULE* edge = (EDGE_MODULE*) item;
EDGE_MODULE tmpEdge( *edge ); EDGE_MODULE tmpEdge( *edge );
if( tmpEdge.GetLayer() == EDGE_N ) if( tmpEdge.GetLayer() == Edge_Cuts )
tmpEdge.SetLayer( UNDEFINED_LAYER ); tmpEdge.SetLayer( UNDEFINED_LAYER );
TraceSegmentPcb( &tmpEdge, HOLE, marge, WRITE_CELL ); TraceSegmentPcb( &tmpEdge, HOLE, marge, WRITE_CELL );
...@@ -257,66 +257,65 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag ) ...@@ -257,66 +257,65 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
switch( item->Type() ) switch( item->Type() )
{ {
case PCB_LINE_T: case PCB_LINE_T:
{ {
DRAWSEGMENT* DrawSegm; DRAWSEGMENT* DrawSegm;
int type_cell = HOLE; int type_cell = HOLE;
DrawSegm = (DRAWSEGMENT*) item; DrawSegm = (DRAWSEGMENT*) item;
DRAWSEGMENT tmpSegm( DrawSegm ); DRAWSEGMENT tmpSegm( DrawSegm );
if( DrawSegm->GetLayer() == EDGE_N ) if( DrawSegm->GetLayer() == Edge_Cuts )
{ {
tmpSegm.SetLayer( UNDEFINED_LAYER ); tmpSegm.SetLayer( UNDEFINED_LAYER );
type_cell |= CELL_is_EDGE; type_cell |= CELL_is_EDGE;
} }
TraceSegmentPcb( &tmpSegm, type_cell, marge, WRITE_CELL ); TraceSegmentPcb( &tmpSegm, type_cell, marge, WRITE_CELL );
} }
break; break;
case PCB_TEXT_T: case PCB_TEXT_T:
{ {
TEXTE_PCB* PtText; TEXTE_PCB* PtText = (TEXTE_PCB*) item;
PtText = (TEXTE_PCB*) item;
if( PtText->GetText().Length() == 0 ) if( PtText->GetText().Length() == 0 )
break; break;
EDA_RECT textbox = PtText->GetTextBox( -1 ); EDA_RECT textbox = PtText->GetTextBox( -1 );
ux0 = textbox.GetX(); ux0 = textbox.GetX();
uy0 = textbox.GetY(); uy0 = textbox.GetY();
dx = textbox.GetWidth(); dx = textbox.GetWidth();
dy = textbox.GetHeight(); dy = textbox.GetHeight();
/* Put bounding box (rectangle) on matrix */ // Put bounding box (rectangle) on matrix
dx /= 2; dx /= 2;
dy /= 2; dy /= 2;
ux1 = ux0 + dx; ux1 = ux0 + dx;
uy1 = uy0 + dy; uy1 = uy0 + dy;
ux0 -= dx; ux0 -= dx;
uy0 -= dy; uy0 -= dy;
layerMask = GetLayerMask( PtText->GetLayer() ); layerMask = LSET( PtText->GetLayer() );
TraceFilledRectangle( ux0 - marge, uy0 - marge, ux1 + marge, TraceFilledRectangle( ux0 - marge, uy0 - marge, ux1 + marge,
uy1 + marge, PtText->GetOrientation(), uy1 + marge, PtText->GetOrientation(),
layerMask, HOLE, WRITE_CELL ); layerMask, HOLE, WRITE_CELL );
TraceFilledRectangle( ux0 - via_marge, uy0 - via_marge, TraceFilledRectangle( ux0 - via_marge, uy0 - via_marge,
ux1 + via_marge, uy1 + via_marge, ux1 + via_marge, uy1 + via_marge,
PtText->GetOrientation(), PtText->GetOrientation(),
layerMask, VIA_IMPOSSIBLE, WRITE_OR_CELL ); layerMask, VIA_IMPOSSIBLE, WRITE_OR_CELL );
} }
break; break;
default: default:
break; break;
} }
} }
/* Put tracks and vias on matrix */ // Put tracks and vias on matrix
for( TRACK* track = aPcb->m_Track; track; track = track->Next() ) for( TRACK* track = aPcb->m_Track; track; track = track->Next() )
{ {
if( net_code == track->GetNetCode() ) if( net_code == track->GetNetCode() )
...@@ -337,7 +336,7 @@ int Build_Work( BOARD* Pcb ) ...@@ -337,7 +336,7 @@ int Build_Work( BOARD* Pcb )
int demi_pas = RoutingMatrix.m_GridRouting / 2; int demi_pas = RoutingMatrix.m_GridRouting / 2;
wxString msg; wxString msg;
InitWork(); /* clear work list */ InitWork(); // clear work list
int cellCount = 0; int cellCount = 0;
for( unsigned ii = 0; ii < Pcb->GetRatsnestsCount(); ii++ ) 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 ...@@ -509,8 +508,8 @@ void MATRIX_ROUTING_HEAD::AddCell( int aRow, int aCol, int aSide, MATRIX_CELL x
} }
/* fetch distance cell */ // fetch distance cell
DIST_CELL MATRIX_ROUTING_HEAD::GetDist( int aRow, int aCol, int aSide ) /* fetch distance cell */ DIST_CELL MATRIX_ROUTING_HEAD::GetDist( int aRow, int aCol, int aSide ) // fetch distance cell
{ {
DIST_CELL* p; DIST_CELL* p;
...@@ -519,7 +518,7 @@ DIST_CELL MATRIX_ROUTING_HEAD::GetDist( int aRow, int aCol, int aSide ) /* fetch ...@@ -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 ) void MATRIX_ROUTING_HEAD::SetDist( int aRow, int aCol, int aSide, DIST_CELL x )
{ {
DIST_CELL* p; DIST_CELL* p;
...@@ -529,7 +528,7 @@ void MATRIX_ROUTING_HEAD::SetDist( int aRow, int aCol, int aSide, DIST_CELL x ) ...@@ -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 ) int MATRIX_ROUTING_HEAD::GetDir( int aRow, int aCol, int aSide )
{ {
DIR_CELL* p; DIR_CELL* p;
...@@ -539,7 +538,7 @@ int MATRIX_ROUTING_HEAD::GetDir( int aRow, int aCol, int aSide ) ...@@ -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 ) void MATRIX_ROUTING_HEAD::SetDir( int aRow, int aCol, int aSide, int x )
{ {
DIR_CELL* p; DIR_CELL* p;
......
This diff is collapsed.
...@@ -64,24 +64,26 @@ ...@@ -64,24 +64,26 @@
#include <tool/tool_dispatcher.h> #include <tool/tool_dispatcher.h>
// Configuration entry names. // Configuration entry names.
static const wxString UserGridSizeXEntry( wxT( "PcbUserGrid_X" ) ); static const wxChar UserGridSizeXEntry[] = wxT( "PcbUserGrid_X" );
static const wxString UserGridSizeYEntry( wxT( "PcbUserGrid_Y" ) ); static const wxChar UserGridSizeYEntry[] = wxT( "PcbUserGrid_Y" );
static const wxString UserGridUnitsEntry( wxT( "PcbUserGrid_Unit" ) ); static const wxChar UserGridUnitsEntry[] = wxT( "PcbUserGrid_Unit" );
static const wxString DisplayPadFillEntry( wxT( "DiPadFi" ) ); static const wxChar DisplayPadFillEntry[] = wxT( "DiPadFi" );
static const wxString DisplayViaFillEntry( wxT( "DiViaFi" ) ); static const wxChar DisplayViaFillEntry[] = wxT( "DiViaFi" );
static const wxString DisplayPadNumberEntry( wxT( "DiPadNu" ) ); static const wxChar DisplayPadNumberEntry[] = wxT( "DiPadNu" );
static const wxString DisplayModuleEdgeEntry( wxT( "DiModEd" ) ); static const wxChar DisplayModuleEdgeEntry[] = wxT( "DiModEd" );
static const wxString DisplayModuleTextEntry( wxT( "DiModTx" ) ); static const wxChar DisplayModuleTextEntry[] = wxT( "DiModTx" );
static const wxString FastGrid1Entry( wxT( "FastGrid1" ) ); static const wxChar FastGrid1Entry[] = wxT( "FastGrid1" );
static const wxString FastGrid2Entry( wxT( "FastGrid2" ) ); static const wxChar FastGrid2Entry[] = wxT( "FastGrid2" );
const LAYER_NUM PCB_BASE_FRAME::GAL_LAYER_ORDER[] = const LAYER_NUM PCB_BASE_FRAME::GAL_LAYER_ORDER[] =
{ {
ITEM_GAL_LAYER( GP_OVERLAY ), ITEM_GAL_LAYER( GP_OVERLAY ),
ITEM_GAL_LAYER( DRC_VISIBLE ), ITEM_GAL_LAYER( DRC_VISIBLE ),
NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ), NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ),
DRAW_N, COMMENT_N, ECO1_N, ECO2_N, EDGE_N, Dwgs_User, Cmts_User, Eco1_User, Eco2_User, Edge_Cuts,
UNUSED_LAYER_29, UNUSED_LAYER_30, UNUSED_LAYER_31,
// UNUSED_LAYER_29, UNUSED_LAYER_30, UNUSED_LAYER_31,
ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE ), ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE ),
ITEM_GAL_LAYER( MOD_REFERENCES_VISIBLE), ITEM_GAL_LAYER( MOD_VALUES_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[] = ...@@ -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( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ),
ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ), ITEM_GAL_LAYER( PADS_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( PAD_FR_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ), F_Mask,
NETNAMES_GAL_LAYER( LAYER_16_NETNAMES_VISIBLE ), LAYER_N_FRONT, NETNAMES_GAL_LAYER( F_Cu ), F_Cu,
SILKSCREEN_N_FRONT, SOLDERPASTE_N_FRONT, ADHESIVE_N_FRONT, F_SilkS, F_Paste, F_Adhes,
#if 0 // was:
NETNAMES_GAL_LAYER( LAYER_15_NETNAMES_VISIBLE ), LAYER_N_15, NETNAMES_GAL_LAYER( LAYER_15_NETNAMES_VISIBLE ), LAYER_N_15,
NETNAMES_GAL_LAYER( LAYER_14_NETNAMES_VISIBLE ), LAYER_N_14, NETNAMES_GAL_LAYER( LAYER_14_NETNAMES_VISIBLE ), LAYER_N_14,
NETNAMES_GAL_LAYER( LAYER_13_NETNAMES_VISIBLE ), LAYER_N_13, NETNAMES_GAL_LAYER( LAYER_13_NETNAMES_VISIBLE ), LAYER_N_13,
...@@ -106,14 +110,48 @@ const LAYER_NUM PCB_BASE_FRAME::GAL_LAYER_ORDER[] = ...@@ -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_4_NETNAMES_VISIBLE ), LAYER_N_4,
NETNAMES_GAL_LAYER( LAYER_3_NETNAMES_VISIBLE ), LAYER_N_3, NETNAMES_GAL_LAYER( LAYER_3_NETNAMES_VISIBLE ), LAYER_N_3,
NETNAMES_GAL_LAYER( LAYER_2_NETNAMES_VISIBLE ), LAYER_N_2, 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, #else
NETNAMES_GAL_LAYER( LAYER_1_NETNAMES_VISIBLE ), LAYER_N_BACK,
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( MOD_TEXT_BK_VISIBLE ),
ITEM_GAL_LAYER( WORKSHEET ) ITEM_GAL_LAYER( WORKSHEET )
}; };
BEGIN_EVENT_TABLE( PCB_BASE_FRAME, EDA_DRAW_FRAME ) BEGIN_EVENT_TABLE( PCB_BASE_FRAME, EDA_DRAW_FRAME )
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START, ID_POPUP_PCB_ITEM_SELECTION_END, EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START, ID_POPUP_PCB_ITEM_SELECTION_END,
PCB_BASE_FRAME::ProcessItemSelection ) PCB_BASE_FRAME::ProcessItemSelection )
...@@ -417,9 +455,9 @@ void PCB_BASE_FRAME::Show3D_Frame( wxCommandEvent& event ) ...@@ -417,9 +455,9 @@ void PCB_BASE_FRAME::Show3D_Frame( wxCommandEvent& event )
// Note: virtual, overridden in PCB_EDIT_FRAME; // 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 // Check if the specified layer matches the present layer
if( layer == preslayer ) if( layer == preslayer )
...@@ -434,7 +472,7 @@ void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, LAYER_NUM layer ) ...@@ -434,7 +472,7 @@ void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, LAYER_NUM layer )
// selection of any other copper layer is disregarded). // selection of any other copper layer is disregarded).
if( m_Pcb->GetCopperLayerCount() < 2 ) if( m_Pcb->GetCopperLayerCount() < 2 )
{ {
if( layer != LAYER_N_BACK ) if( layer != B_Cu )
{ {
return; return;
} }
...@@ -446,7 +484,7 @@ void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, LAYER_NUM layer ) ...@@ -446,7 +484,7 @@ void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, LAYER_NUM layer )
// layers are also capable of being selected. // layers are also capable of being selected.
else else
{ {
if( ( layer != LAYER_N_BACK ) && ( layer != LAYER_N_FRONT ) if( ( layer != B_Cu ) && ( layer != F_Cu )
&& ( layer >= m_Pcb->GetCopperLayerCount() - 1 ) ) && ( layer >= m_Pcb->GetCopperLayerCount() - 1 ) )
{ {
return; return;
...@@ -813,7 +851,7 @@ void PCB_BASE_FRAME::LoadSettings( wxConfigBase* aCfg ) ...@@ -813,7 +851,7 @@ void PCB_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
KIGFX::VIEW* view = GetGalCanvas()->GetView(); KIGFX::VIEW* view = GetGalCanvas()->GetView();
// Set rendering order and properties of layers // 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]; LAYER_NUM layer = GAL_LAYER_ORDER[i];
wxASSERT( layer < KIGFX::VIEW::VIEW_MAX_LAYERS ); wxASSERT( layer < KIGFX::VIEW::VIEW_MAX_LAYERS );
...@@ -840,14 +878,14 @@ void PCB_BASE_FRAME::LoadSettings( wxConfigBase* aCfg ) ...@@ -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( 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( 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( F_Adhes, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
view->SetRequired( SOLDERPASTE_N_FRONT, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) ); view->SetRequired( F_Paste, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
view->SetRequired( SOLDERMASK_N_FRONT, 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( 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( B_Adhes, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
view->SetRequired( SOLDERPASTE_N_BACK, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) ); view->SetRequired( B_Paste, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
view->SetRequired( SOLDERMASK_N_BACK, 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_FR_VISIBLE ), ITEM_GAL_LAYER( MOD_FR_VISIBLE ) );
view->SetRequired( ITEM_GAL_LAYER( PAD_BK_VISIBLE ), ITEM_GAL_LAYER( MOD_BK_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 ) ...@@ -381,7 +381,7 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
void PCB_EDIT_FRAME::Block_SelectItems() void PCB_EDIT_FRAME::Block_SelectItems()
{ {
LAYER_MSK layerMask; LSET layerMask;
bool selectOnlyComplete = GetScreen()->m_BlockLocate.GetWidth() > 0 ; bool selectOnlyComplete = GetScreen()->m_BlockLocate.GetWidth() > 0 ;
GetScreen()->m_BlockLocate.Normalize(); GetScreen()->m_BlockLocate.Normalize();
...@@ -392,9 +392,9 @@ void PCB_EDIT_FRAME::Block_SelectItems() ...@@ -392,9 +392,9 @@ void PCB_EDIT_FRAME::Block_SelectItems()
// Add modules // Add modules
if( blockIncludeModules ) 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 ) if( module->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete )
&& ( !module->IsLocked() || blockIncludeLockedModules ) ) && ( !module->IsLocked() || blockIncludeLockedModules ) )
...@@ -418,7 +418,7 @@ void PCB_EDIT_FRAME::Block_SelectItems() ...@@ -418,7 +418,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
if( blockIncludeItemsOnInvisibleLayers if( blockIncludeItemsOnInvisibleLayers
|| m_Pcb->IsLayerVisible( track->GetLayer() ) ) || m_Pcb->IsLayerVisible( track->GetLayer() ) )
{ {
picker.SetItem ( track ); picker.SetItem( track );
itemsList->PushItem( picker ); itemsList->PushItem( picker );
} }
} }
...@@ -426,13 +426,13 @@ void PCB_EDIT_FRAME::Block_SelectItems() ...@@ -426,13 +426,13 @@ void PCB_EDIT_FRAME::Block_SelectItems()
} }
// Add graphic items // Add graphic items
layerMask = EDGE_LAYER; layerMask = LSET( Edge_Cuts );
if( blockIncludeItemsOnTechLayers ) if( blockIncludeItemsOnTechLayers )
layerMask = ALL_LAYERS; layerMask.set();
if( !blockIncludeBoardOutlineLayer ) if( !blockIncludeBoardOutlineLayer )
layerMask &= ~EDGE_LAYER; layerMask.set( Edge_Cuts, false );
for( BOARD_ITEM* PtStruct = m_Pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() ) for( BOARD_ITEM* PtStruct = m_Pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
{ {
...@@ -444,7 +444,7 @@ void PCB_EDIT_FRAME::Block_SelectItems() ...@@ -444,7 +444,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
switch( PtStruct->Type() ) switch( PtStruct->Type() )
{ {
case PCB_LINE_T: case PCB_LINE_T:
if( (GetLayerMask( PtStruct->GetLayer() ) & layerMask) == 0 ) if( !layerMask[PtStruct->GetLayer()] )
break; break;
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) ) if( !PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) )
...@@ -464,7 +464,7 @@ void PCB_EDIT_FRAME::Block_SelectItems() ...@@ -464,7 +464,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
break; break;
case PCB_TARGET_T: case PCB_TARGET_T:
if( ( GetLayerMask( PtStruct->GetLayer() ) & layerMask ) == 0 ) if( !layerMask[PtStruct->GetLayer()] )
break; break;
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) ) if( !PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) )
...@@ -474,7 +474,7 @@ void PCB_EDIT_FRAME::Block_SelectItems() ...@@ -474,7 +474,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
break; break;
case PCB_DIMENSION_T: case PCB_DIMENSION_T:
if( ( GetLayerMask( PtStruct->GetLayer() ) & layerMask ) == 0 ) if( !layerMask[PtStruct->GetLayer()] )
break; break;
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) ) if( !PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) )
......
...@@ -39,19 +39,8 @@ static void addTextSegmToPoly( int x0, int y0, int xf, int yf ) ...@@ -39,19 +39,8 @@ static void addTextSegmToPoly( int x0, int y0, int xf, int yf )
s_textCircle2SegmentCount, s_textWidth ); s_textCircle2SegmentCount, s_textWidth );
} }
/**
* Function ConvertBrdLayerToPolygonalContours void BOARD::ConvertBrdLayerToPolygonalContours( LAYER_ID aLayer, CPOLYGONS_LIST& aOutlines )
* 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 )
{ {
// Number of segments to convert a circle to a polygon // Number of segments to convert a circle to a polygon
const int segcountforcircle = 18; const int segcountforcircle = 18;
...@@ -82,7 +71,7 @@ void BOARD::ConvertBrdLayerToPolygonalContours( LAYER_NUM aLayer, CPOLYGONS_LIST ...@@ -82,7 +71,7 @@ void BOARD::ConvertBrdLayerToPolygonalContours( LAYER_NUM aLayer, CPOLYGONS_LIST
for( int ii = 0; ii < GetAreaCount(); ii++ ) for( int ii = 0; ii < GetAreaCount(); ii++ )
{ {
ZONE_CONTAINER* zone = GetArea( ii ); ZONE_CONTAINER* zone = GetArea( ii );
LAYER_NUM zonelayer = zone->GetLayer(); LAYER_ID zonelayer = zone->GetLayer();
if( zonelayer == aLayer ) if( zonelayer == aLayer )
zone->TransformSolidAreasShapesToPolygonSet( zone->TransformSolidAreasShapesToPolygonSet(
...@@ -113,18 +102,8 @@ void BOARD::ConvertBrdLayerToPolygonalContours( LAYER_NUM aLayer, CPOLYGONS_LIST ...@@ -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 void MODULE::TransformPadsShapesWithClearanceToPolygon( LAYER_ID aLayer,
* 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,
CPOLYGONS_LIST& aCornerBuffer, CPOLYGONS_LIST& aCornerBuffer,
int aInflateValue, int aInflateValue,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
...@@ -141,13 +120,13 @@ void MODULE::TransformPadsShapesWithClearanceToPolygon( LAYER_NUM aLayer, ...@@ -141,13 +120,13 @@ void MODULE::TransformPadsShapesWithClearanceToPolygon( LAYER_NUM aLayer,
switch( aLayer ) switch( aLayer )
{ {
case SOLDERMASK_N_FRONT: case F_Mask:
case SOLDERMASK_N_BACK: case B_Mask:
margin.x = margin.y = pad->GetSolderMaskMargin() + aInflateValue; margin.x = margin.y = pad->GetSolderMaskMargin() + aInflateValue;
break; break;
case SOLDERPASTE_N_FRONT: case F_Paste:
case SOLDERPASTE_N_BACK: case B_Paste:
margin = pad->GetSolderPasteMargin(); margin = pad->GetSolderPasteMargin();
margin.x += aInflateValue; margin.x += aInflateValue;
margin.y += aInflateValue; margin.y += aInflateValue;
...@@ -175,7 +154,7 @@ void MODULE::TransformPadsShapesWithClearanceToPolygon( LAYER_NUM aLayer, ...@@ -175,7 +154,7 @@ void MODULE::TransformPadsShapesWithClearanceToPolygon( LAYER_NUM aLayer,
* initial radius * aCorrectionFactor * initial radius * aCorrectionFactor
*/ */
void MODULE::TransformGraphicShapesWithClearanceToPolygonSet( void MODULE::TransformGraphicShapesWithClearanceToPolygonSet(
LAYER_NUM aLayer, LAYER_ID aLayer,
CPOLYGONS_LIST& aCornerBuffer, CPOLYGONS_LIST& aCornerBuffer,
int aInflateValue, int aInflateValue,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
......
This diff is collapsed.
This diff is collapsed.
...@@ -54,10 +54,11 @@ ...@@ -54,10 +54,11 @@
BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() : BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
m_Pad_Master( NULL ) m_Pad_Master( NULL )
{ {
m_enabledLayers = ALL_LAYERS; // All layers enabled at first. LSET all_set = LSET().set();
// SetCopperLayerCount() will adjust this.
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. // set all but hidden text as visible.
m_visibleElements = ~( 1 << MOD_TEXT_INVISIBLE ); m_visibleElements = ~( 1 << MOD_TEXT_INVISIBLE );
...@@ -305,17 +306,17 @@ void BOARD_DESIGN_SETTINGS::SetTrackWidthIndex( unsigned aIndex ) ...@@ -305,17 +306,17 @@ void BOARD_DESIGN_SETTINGS::SetTrackWidthIndex( unsigned aIndex )
void BOARD_DESIGN_SETTINGS::SetVisibleAlls() void BOARD_DESIGN_SETTINGS::SetVisibleAlls()
{ {
SetVisibleLayers( FULL_LAYERS ); SetVisibleLayers( LSET().set() );
m_visibleElements = -1; 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 ) ) if( aNewState && IsLayerEnabled( aLayer ) )
m_visibleLayers |= GetLayerMask( aLayer ); m_visibleLayers.set( aLayer, true );
else else
m_visibleLayers &= ~GetLayerMask( aLayer ); m_visibleLayers.set( aLayer, false );
} }
...@@ -338,6 +339,8 @@ void BOARD_DESIGN_SETTINGS::SetCopperLayerCount( int aNewLayerCount ) ...@@ -338,6 +339,8 @@ void BOARD_DESIGN_SETTINGS::SetCopperLayerCount( int aNewLayerCount )
m_copperLayerCount = aNewLayerCount; m_copperLayerCount = aNewLayerCount;
// ensure consistency with the m_EnabledLayers member // ensure consistency with the m_EnabledLayers member
#if 0
// was:
m_enabledLayers &= ~ALL_CU_LAYERS; m_enabledLayers &= ~ALL_CU_LAYERS;
m_enabledLayers |= LAYER_BACK; m_enabledLayers |= LAYER_BACK;
...@@ -345,14 +348,17 @@ void BOARD_DESIGN_SETTINGS::SetCopperLayerCount( int aNewLayerCount ) ...@@ -345,14 +348,17 @@ void BOARD_DESIGN_SETTINGS::SetCopperLayerCount( int aNewLayerCount )
m_enabledLayers |= LAYER_FRONT; m_enabledLayers |= LAYER_FRONT;
for( LAYER_NUM ii = LAYER_N_2; ii < aNewLayerCount - 1; ++ii ) 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. // Back and front layers are always enabled.
aMask |= LAYER_BACK | LAYER_FRONT; aMask.set( B_Cu ).set( F_Cu );
m_enabledLayers = aMask; m_enabledLayers = aMask;
...@@ -360,7 +366,7 @@ void BOARD_DESIGN_SETTINGS::SetEnabledLayers( LAYER_MSK aMask ) ...@@ -360,7 +366,7 @@ void BOARD_DESIGN_SETTINGS::SetEnabledLayers( LAYER_MSK aMask )
m_visibleLayers &= aMask; m_visibleLayers &= aMask;
// update m_CopperLayerCount to ensure its consistency with m_EnabledLayers // 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 ) : ...@@ -49,7 +49,7 @@ DIMENSION::DIMENSION( BOARD_ITEM* aParent ) :
BOARD_ITEM( aParent, PCB_DIMENSION_T ), BOARD_ITEM( aParent, PCB_DIMENSION_T ),
m_Width( Millimeter2iu( 0.2 ) ), m_Unit( INCHES ), m_Value( 0 ), m_Height( 0 ), m_Text( this ) 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 ...@@ -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_Layer = aLayer;
m_Text.SetLayer( aLayer ); m_Text.SetLayer( aLayer );
......
...@@ -95,7 +95,7 @@ public: ...@@ -95,7 +95,7 @@ public:
m_Text.SetSize( aTextSize ); m_Text.SetSize( aTextSize );
} }
void SetLayer( LAYER_NUM aLayer ); void SetLayer( LAYER_ID aLayer );
void SetShape( int aShape ) { m_Shape = aShape; } void SetShape( int aShape ) { m_Shape = aShape; }
int GetShape() const { return m_Shape; } int GetShape() const { return m_Shape; }
......
...@@ -185,7 +185,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, ...@@ -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( ( draw_mode & GR_ALLOW_HIGHCONTRAST ) && DisplayOpt.ContrastModeDisplay )
{ {
if( !IsOnLayer( curr_layer ) && !IsOnLayer( EDGE_N ) ) if( !IsOnLayer( curr_layer ) && !IsOnLayer( Edge_Cuts ) )
ColorTurnToDarkDarkGray( &color ); ColorTurnToDarkDarkGray( &color );
} }
......
...@@ -57,7 +57,7 @@ EDGE_MODULE::EDGE_MODULE( MODULE* parent, STROKE_T aShape ) : ...@@ -57,7 +57,7 @@ EDGE_MODULE::EDGE_MODULE( MODULE* parent, STROKE_T aShape ) :
{ {
m_Shape = aShape; m_Shape = aShape;
m_Angle = 0; 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, ...@@ -149,7 +149,7 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
GRSetDrawMode( DC, draw_mode ); GRSetDrawMode( DC, draw_mode );
typeaff = frame->m_DisplayModEdge; typeaff = frame->m_DisplayModEdge;
if( m_Layer <= LAST_COPPER_LAYER ) if( IsCopperLayer( m_Layer ) )
{ {
typeaff = frame->m_DisplayPcbTrackFill; typeaff = frame->m_DisplayPcbTrackFill;
......
...@@ -51,11 +51,11 @@ PCB_TARGET::PCB_TARGET( BOARD_ITEM* aParent ) : ...@@ -51,11 +51,11 @@ PCB_TARGET::PCB_TARGET( BOARD_ITEM* aParent ) :
m_Shape = 0; m_Shape = 0;
m_Size = Millimeter2iu( 5 ); // Gives a decent size m_Size = Millimeter2iu( 5 ); // Gives a decent size
m_Width = Millimeter2iu( 0.15 ); // Gives a decent width 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 ) : const wxPoint& aPos, int aSize, int aWidth ) :
BOARD_ITEM( aParent, PCB_TARGET_T ) BOARD_ITEM( aParent, PCB_TARGET_T )
{ {
m_Shape = aShape; m_Shape = aShape;
......
...@@ -51,7 +51,7 @@ public: ...@@ -51,7 +51,7 @@ public:
// Do not create a copy constructor. The one generated by the compiler is adequate. // 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 ); const wxPoint& aPos, int aSize, int aWidth );
~PCB_TARGET(); ~PCB_TARGET();
......
...@@ -57,7 +57,7 @@ MODULE::MODULE( BOARD* parent ) : ...@@ -57,7 +57,7 @@ MODULE::MODULE( BOARD* parent ) :
m_initial_comments( 0 ) m_initial_comments( 0 )
{ {
m_Attributs = MOD_DEFAULT; m_Attributs = MOD_DEFAULT;
m_Layer = LAYER_N_FRONT; m_Layer = F_Cu;
m_Orient = 0; m_Orient = 0;
m_ModuleStatus = 0; m_ModuleStatus = 0;
flag = 0; flag = 0;
...@@ -424,7 +424,7 @@ EDA_RECT MODULE::GetFootprintRect() const ...@@ -424,7 +424,7 @@ EDA_RECT MODULE::GetFootprintRect() const
for( const BOARD_ITEM* item = m_Drawings.GetFirst(); item; item = item->Next() ) for( const BOARD_ITEM* item = m_Drawings.GetFirst(); item; item = item->Next() )
{ {
const EDGE_MODULE* edge = dyn_cast<const EDGE_MODULE*>( item ); const EDGE_MODULE* edge = dyn_cast<const EDGE_MODULE*>( item );
if( edge ) if( edge )
area.Merge( edge->GetBoundingBox() ); area.Merge( edge->GetBoundingBox() );
...@@ -590,12 +590,12 @@ D_PAD* MODULE::FindPadByName( const wxString& aPadName ) const ...@@ -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() ) for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
{ {
// ... and on the correct layer. // ... and on the correct layer.
if( ( pad->GetLayerMask() & aLayerMask ) == 0 ) if( ( pad->GetLayerSet() & aLayerMask ) == 0 )
continue; continue;
if( pad->HitTest( aPosition ) ) if( pad->HitTest( aPosition ) )
......
...@@ -189,7 +189,7 @@ public: ...@@ -189,7 +189,7 @@ public:
* function IsFlipped * function IsFlipped
* @return true if the module is flipped, i.e. on the back side of the board * @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: // m_ModuleStatus bits:
#define MODULE_is_LOCKED 0x01 ///< module LOCKED: no autoplace allowed #define MODULE_is_LOCKED 0x01 ///< module LOCKED: no autoplace allowed
...@@ -282,7 +282,7 @@ public: ...@@ -282,7 +282,7 @@ public:
* the radius of circle approximated by segments is * the radius of circle approximated by segments is
* initial radius * aCorrectionFactor * initial radius * aCorrectionFactor
*/ */
void TransformPadsShapesWithClearanceToPolygon( LAYER_NUM aLayer, void TransformPadsShapesWithClearanceToPolygon( LAYER_ID aLayer,
CPOLYGONS_LIST& aCornerBuffer, CPOLYGONS_LIST& aCornerBuffer,
int aInflateValue, int aInflateValue,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
...@@ -306,13 +306,12 @@ public: ...@@ -306,13 +306,12 @@ public:
* initial radius * aCorrectionFactor * initial radius * aCorrectionFactor
*/ */
void TransformGraphicShapesWithClearanceToPolygonSet( void TransformGraphicShapesWithClearanceToPolygonSet(
LAYER_NUM aLayer, LAYER_ID aLayer,
CPOLYGONS_LIST& aCornerBuffer, CPOLYGONS_LIST& aCornerBuffer,
int aInflateValue, int aInflateValue,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
double aCorrectionFactor ); double aCorrectionFactor );
/** /**
* Function DrawEdgesOnly * Function DrawEdgesOnly
* Draws the footprint edges only to the current Device Context * Draws the footprint edges only to the current Device Context
...@@ -400,7 +399,7 @@ public: ...@@ -400,7 +399,7 @@ public:
* @param aLayerMask A layer or layers to mask the hit test. * @param aLayerMask A layer or layers to mask the hit test.
* @return A pointer to a D_PAD object if found otherwise NULL. * @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 enum INCLUDE_NPTH_T
{ {
......
...@@ -78,7 +78,7 @@ D_PAD::D_PAD( MODULE* parent ) : ...@@ -78,7 +78,7 @@ D_PAD::D_PAD( MODULE* parent ) :
m_ThermalGap = 0; // Use parent setting by default m_ThermalGap = 0; // Use parent setting by default
// Set layers mask to default for a standard thru hole pad. // 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 SetSubRatsnest( 0 ); // used in ratsnest calculations
...@@ -86,6 +86,38 @@ D_PAD::D_PAD( MODULE* parent ) : ...@@ -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 D_PAD::boundingRadius() const
{ {
int x, y; int x, y;
...@@ -231,7 +263,7 @@ void D_PAD::Flip( const wxPoint& aCentre ) ...@@ -231,7 +263,7 @@ void D_PAD::Flip( const wxPoint& aCentre )
SetOrientation( -GetOrientation() ); SetOrientation( -GetOrientation() );
// flip pads layers // flip pads layers
SetLayerMask( FlipLayerMask( m_layerMask ) ); SetLayerSet( FlipLayerMask( m_layerMask ) );
// m_boundingRadius = -1; the shape has not been changed // m_boundingRadius = -1; the shape has not been changed
} }
...@@ -630,13 +662,6 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList ) ...@@ -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, void D_PAD::GetOblongDrillGeometry( wxPoint& aStartPoint,
wxPoint& aEndPoint, int& aWidth ) const wxPoint& aEndPoint, int& aWidth ) const
{ {
...@@ -773,10 +798,21 @@ int D_PAD::Compare( const D_PAD* padref, const D_PAD* padcmp ) ...@@ -773,10 +798,21 @@ int D_PAD::Compare( const D_PAD* padref, const D_PAD* padcmp )
// Dick: specctra_export needs this // Dick: specctra_export needs this
// Lorenzo: gencad also needs it to implement padstacks! // 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; 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 ...@@ -861,40 +897,40 @@ void D_PAD::ViewGetLayers( int aLayers[], int& aCount ) const
if( m_Attribute == PAD_STANDARD || m_Attribute == PAD_HOLE_NOT_PLATED ) if( m_Attribute == PAD_STANDARD || m_Attribute == PAD_HOLE_NOT_PLATED )
aLayers[aCount++] = ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ); 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 // Multi layer pad
aLayers[aCount++] = ITEM_GAL_LAYER( PADS_VISIBLE ); aLayers[aCount++] = ITEM_GAL_LAYER( PADS_VISIBLE );
aLayers[aCount++] = NETNAMES_GAL_LAYER( PADS_NETNAMES_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++] = ITEM_GAL_LAYER( PAD_FR_VISIBLE );
aLayers[aCount++] = NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_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++] = ITEM_GAL_LAYER( PAD_BK_VISIBLE );
aLayers[aCount++] = NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ); aLayers[aCount++] = NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE );
} }
if( IsOnLayer( SOLDERMASK_N_FRONT ) ) if( IsOnLayer( F_Mask ) )
aLayers[aCount++] = SOLDERMASK_N_FRONT; aLayers[aCount++] = F_Mask;
if( IsOnLayer( SOLDERMASK_N_BACK ) ) if( IsOnLayer( B_Mask ) )
aLayers[aCount++] = SOLDERMASK_N_BACK; aLayers[aCount++] = B_Mask;
if( IsOnLayer( SOLDERPASTE_N_FRONT ) ) if( IsOnLayer( F_Paste ) )
aLayers[aCount++] = SOLDERPASTE_N_FRONT; aLayers[aCount++] = F_Paste;
if( IsOnLayer( SOLDERPASTE_N_BACK ) ) if( IsOnLayer( B_Paste ) )
aLayers[aCount++] = SOLDERPASTE_N_BACK; aLayers[aCount++] = B_Paste;
if( IsOnLayer( ADHESIVE_N_BACK ) ) if( IsOnLayer( B_Adhes ) )
aLayers[aCount++] = ADHESIVE_N_BACK; aLayers[aCount++] = B_Adhes;
if( IsOnLayer( ADHESIVE_N_FRONT ) ) if( IsOnLayer( F_Adhes ) )
aLayers[aCount++] = ADHESIVE_N_FRONT; aLayers[aCount++] = F_Adhes;
#ifdef __WXDEBUG__ #ifdef __WXDEBUG__
if( aCount == 0 ) // Should not occur if( aCount == 0 ) // Should not occur
......
...@@ -47,25 +47,6 @@ class TRACK; ...@@ -47,25 +47,6 @@ class TRACK;
class MSG_PANEL_INFO; 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 // Helper class to store parameters used to draw a pad
class PAD_DRAWINFO class PAD_DRAWINFO
{ {
...@@ -104,6 +85,14 @@ public: ...@@ -104,6 +85,14 @@ public:
// Do not create a copy constructor. The one generated by the compiler is adequate. // Do not create a copy constructor. The one generated by the compiler is adequate.
// D_PAD( const D_PAD& o ); // 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 ); void Copy( D_PAD* source );
D_PAD* Next() const { return static_cast<D_PAD*>( Pnext ); } D_PAD* Next() const { return static_cast<D_PAD*>( Pnext ); }
...@@ -180,8 +169,8 @@ public: ...@@ -180,8 +169,8 @@ public:
*/ */
void GetOblongDrillGeometry( wxPoint& aStartPoint, wxPoint& aEndPoint, int& aWidth ) const; void GetOblongDrillGeometry( wxPoint& aStartPoint, wxPoint& aEndPoint, int& aWidth ) const;
void SetLayerMask( LAYER_MSK aLayerMask ) { m_layerMask = aLayerMask; } void SetLayerSet( LSET aLayerMask ) { m_layerMask = aLayerMask; }
LAYER_MSK GetLayerMask() const { return m_layerMask; } LSET GetLayerSet() const { return m_layerMask; }
void SetAttribute( PAD_ATTR_T aAttribute ); void SetAttribute( PAD_ATTR_T aAttribute );
PAD_ATTR_T GetAttribute() const { return m_Attribute; } PAD_ATTR_T GetAttribute() const { return m_Attribute; }
...@@ -189,7 +178,7 @@ public: ...@@ -189,7 +178,7 @@ public:
void SetPadToDieLength( int aLength ) { m_LengthPadToDie = aLength; } void SetPadToDieLength( int aLength ) { m_LengthPadToDie = aLength; }
int GetPadToDieLength() const { return m_LengthPadToDie; } int GetPadToDieLength() const { return m_LengthPadToDie; }
int GetLocalSolderMaskMargin() const { return m_LocalSolderMaskMargin; } int GetLocalSolderMaskMargin() const { return m_LocalSolderMaskMargin; }
void SetLocalSolderMaskMargin( int aMargin ) { m_LocalSolderMaskMargin = aMargin; } void SetLocalSolderMaskMargin( int aMargin ) { m_LocalSolderMaskMargin = aMargin; }
int GetLocalClearance() const { return m_LocalClearance; } int GetLocalClearance() const { return m_LocalClearance; }
...@@ -371,13 +360,16 @@ public: ...@@ -371,13 +360,16 @@ public:
* Function GetSubRatsnest * Function GetSubRatsnest
* @return int - the netcode * @return int - the netcode
*/ */
int GetSubRatsnest() const { return m_SubRatsnest; } int GetSubRatsnest() const { return m_SubRatsnest; }
void SetSubRatsnest( int aSubRatsnest ) { m_SubRatsnest = aSubRatsnest; } void SetSubRatsnest( int aSubRatsnest ) { m_SubRatsnest = aSubRatsnest; }
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); 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; bool HitTest( const wxPoint& aPosition ) const;
...@@ -506,7 +498,7 @@ private: ...@@ -506,7 +498,7 @@ private:
*/ */
wxPoint m_Offset; 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 ///< 2..14 = internal layers
///< 16 .. 31 = technical layers ///< 16 .. 31 = technical layers
......
This diff is collapsed.
This diff is collapsed.
...@@ -5,17 +5,18 @@ ...@@ -5,17 +5,18 @@
class PCB_BASE_FRAME; class PCB_BASE_FRAME;
/* class to display a pcb layer list in a wxBitmapComboBox. /**
* Class to display a pcb layer list in a wxBitmapComboBox.
*/ */
class PCB_LAYER_BOX_SELECTOR : public LAYER_BOX_SELECTOR class PCB_LAYER_BOX_SELECTOR : public LAYER_BOX_SELECTOR
{ {
PCB_BASE_FRAME * m_boardFrame; PCB_BASE_FRAME* m_boardFrame;
LAYER_MSK m_layerMaskDisable; // A mask to remove some layers from layer list
LSET m_layerMaskDisable; // A mask to remove some layers from layer list
public: public:
// Hotkey Info // Hotkey Info
struct EDA_HOTKEY_CONFIG* m_hotkeys; EDA_HOTKEY_CONFIG* m_hotkeys;
public: public:
// If you are thinking the constructor is a bit curious, // If you are thinking the constructor is a bit curious,
...@@ -27,8 +28,8 @@ public: ...@@ -27,8 +28,8 @@ public:
const wxString& value = wxEmptyString, const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL, int style = 0 ) int n = 0, const wxString choices[] = NULL, int style = 0 ) :
:LAYER_BOX_SELECTOR( parent, id, pos, size, n, choices ) LAYER_BOX_SELECTOR( parent, id, pos, size, n, choices )
{ {
m_boardFrame = NULL; m_boardFrame = NULL;
m_layerMaskDisable = 0; m_layerMaskDisable = 0;
...@@ -39,11 +40,11 @@ public: ...@@ -39,11 +40,11 @@ public:
// SetBoardFrame should be called after creating a PCB_LAYER_BOX_SELECTOR // SetBoardFrame should be called after creating a PCB_LAYER_BOX_SELECTOR
// It is not passed through the constructor because when using wxFormBuilder // It is not passed through the constructor because when using wxFormBuilder
// we should use a constructor compatible with a wxBitmapComboBox // we should use a constructor compatible with a wxBitmapComboBox
void SetBoardFrame( PCB_BASE_FRAME * aFrame ) { m_boardFrame = aFrame; }; void SetBoardFrame( PCB_BASE_FRAME* aFrame ) { m_boardFrame = aFrame; };
// SetLayerMask allows disableing some layers, whiech are not // SetLayerSet allows disableing some layers, which are not
// shown in list; // shown in list;
void SetLayerMask( LAYER_MSK aMask ) { m_layerMaskDisable = aMask; } void SetLayerSet( LSET aMask ) { m_layerMaskDisable = aMask; }
// Reload the Layers names and bitmaps // Reload the Layers names and bitmaps
// Virtual function // Virtual function
...@@ -61,6 +62,8 @@ private: ...@@ -61,6 +62,8 @@ private:
// Returns the name of the layer id // Returns the name of the layer id
// Virtual function // Virtual function
wxString GetLayerName( LAYER_NUM aLayer ) const; wxString GetLayerName( LAYER_NUM aLayer ) const;
LSET getEnabledLayers() const;
}; };
#endif //CLASS_PCB_PCB_LAYER_BOX_SELECTOR_H #endif // CLASS_PCB_PCB_LAYER_BOX_SELECTOR_H
This diff is collapsed.
...@@ -82,9 +82,9 @@ public: ...@@ -82,9 +82,9 @@ public:
void SetLayersManagerTabsText(); void SetLayersManagerTabsText();
//-----<implement LAYER_WIDGET abstract callback functions>----------- //-----<implement LAYER_WIDGET abstract callback functions>-----------
void OnLayerColorChange( LAYER_NUM aLayer, EDA_COLOR_T aColor ); void OnLayerColorChange( int aLayer, EDA_COLOR_T aColor );
bool OnLayerSelect( LAYER_NUM aLayer ); bool OnLayerSelect( int aLayer );
void OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal ); void OnLayerVisible( int aLayer, bool isVisible, bool isFinal );
void OnRenderColorChange( int aId, EDA_COLOR_T aColor ); void OnRenderColorChange( int aId, EDA_COLOR_T aColor );
void OnRenderEnable( int aId, bool isEnabled ); void OnRenderEnable( int aId, bool isEnabled );
//-----</implement LAYER_WIDGET abstract callback functions>---------- //-----</implement LAYER_WIDGET abstract callback functions>----------
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -181,9 +181,9 @@ public: ...@@ -181,9 +181,9 @@ public:
* Function IsOnCopperLayer * Function IsOnCopperLayer
* @return true if this zone is on a copper layer, false if on a technical layer * @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. /// How to fill areas: 0 = use filled polygons, 1 => fill with segments.
......
...@@ -38,18 +38,18 @@ ...@@ -38,18 +38,18 @@
ZONE_SETTINGS::ZONE_SETTINGS() ZONE_SETTINGS::ZONE_SETTINGS()
{ {
m_ZonePriority = 0; m_ZonePriority = 0;
m_FillMode = 0; // Mode for filling zone : 1 use segments, 0 use polygons m_FillMode = 0; // Mode for filling zone : 1 use segments, 0 use polygons
// Clearance value // Clearance value
m_ZoneClearance = Mils2iu( ZONE_CLEARANCE_MIL ); m_ZoneClearance = Mils2iu( ZONE_CLEARANCE_MIL );
// Min thickness value in filled areas (this is the minimum width of copper to fill solid areas) : // Min thickness value in filled areas (this is the minimum width of copper to fill solid areas) :
m_ZoneMinThickness = Mils2iu( ZONE_THICKNESS_MIL ); m_ZoneMinThickness = Mils2iu( ZONE_THICKNESS_MIL );
m_NetcodeSelection = 0; // Net code selection for the current zone m_NetcodeSelection = 0; // Net code selection for the current zone
m_CurrentZone_Layer = FIRST_LAYER; // Layer used to create the current zone m_CurrentZone_Layer = F_Cu; // Layer used to create the current zone
m_Zone_HatchingStyle = CPolyLine::DIAGONAL_EDGE; // Option to show the zone area (outlines only, short hatches or full hatches m_Zone_HatchingStyle = CPolyLine::DIAGONAL_EDGE; // Option to show the zone area (outlines only, short hatches or full hatches
m_ArcToSegmentsCount = ARC_APPROX_SEGMENTS_COUNT_LOW_DEF; // Option to select number of segments to approximate a circle m_ArcToSegmentsCount = ARC_APPROX_SEGMENTS_COUNT_LOW_DEF; // Option to select number of segments to approximate a circle
// ARC_APPROX_SEGMENTS_COUNT_LOW_DEF // ARC_APPROX_SEGMENTS_COUNT_LOW_DEF
// or ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF segments // or ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF segments
// thickness of the gap in thermal reliefs: // thickness of the gap in thermal reliefs:
m_ThermalReliefGap = Mils2iu( ZONE_THERMAL_RELIEF_GAP_MIL ); m_ThermalReliefGap = Mils2iu( ZONE_THERMAL_RELIEF_GAP_MIL );
......
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