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.
This commit is contained in:
Dick Hollenbeck 2014-06-24 11:17:18 -05:00
parent 21b70093b0
commit 4578ea8b9e
184 changed files with 13161 additions and 5771 deletions

View File

@ -55,11 +55,11 @@ extern void CheckGLError();
/* Helper function
* returns true if aLayer should be displayed, false otherwise
*/
static bool Is3DLayerEnabled( LAYER_NUM aLayer );
static bool Is3DLayerEnabled( LAYER_ID aLayer );
/* returns the Z orientation parameter 1.0 or -1.0 for aLayer
* Z orientation is 1.0 for all layers but "back" layers:
* LAYER_N_BACK , ADHESIVE_N_BACK, SOLDERPASTE_N_BACK ), SILKSCREEN_N_BACK
* B_Cu , B_Adhes, B_Paste ), B_SilkS
* used to calculate the Z orientation parameter for glNormal3f
*/
static GLfloat Get3DLayer_Z_Orientation( LAYER_NUM aLayer );
@ -205,18 +205,18 @@ static inline void SetGLTechLayersColor( LAYER_NUM aLayer )
{
switch( aLayer )
{
case SOLDERPASTE_N_BACK:
case SOLDERPASTE_N_FRONT:
case B_Paste:
case F_Paste:
SetGLColor( DARKGRAY, 0.7 );
break;
case SILKSCREEN_N_BACK:
case SILKSCREEN_N_FRONT:
case B_SilkS:
case F_SilkS:
SetGLColor( LIGHTGRAY, 0.9 );
break;
case SOLDERMASK_N_BACK:
case SOLDERMASK_N_FRONT:
case B_Mask:
case F_Mask:
SetGLEpoxyColor( 0.7 );
break;
@ -278,12 +278,21 @@ void EDA_3D_CANVAS::BuildBoard3DView()
bool throughHolesListBuilt = false; // flag to build the through hole polygon list only once
bool hightQualityMode = false;
for( LAYER_NUM layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER;
++layer )
LSET cu_set = LSET::AllCuMask( g_Parm_3D_Visu.m_CopperLayersCount );
#if 1
LAYER_ID cu_seq[MAX_CU_LAYERS]; // preferred sequence, could have called CuStack()
// but I assume that's backwards
for( unsigned i=0; i<DIM(cu_seq); ++i )
cu_seq[i] = LAYER_ID( B_Cu - i );
for( LSEQ cu = cu_set.Seq( cu_seq, DIM(cu_seq) ); cu; ++cu )
#else
for( LSEQ cu = cu_set.CuStack(); cu; ++cu )
#endif
{
if( layer != LAST_COPPER_LAYER
&& layer >= g_Parm_3D_Visu.m_CopperLayersCount )
continue;
LAYER_ID layer = *cu;
// Skip non enabled layers in normal mode,
// and internal layers in realistic mode
@ -295,7 +304,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
currLayerHoles.RemoveAllContours();
// Draw tracks:
for( TRACK* track = pcb->m_Track; track != NULL; track = track->Next() )
for( TRACK* track = pcb->m_Track; track; track = track->Next() )
{
if( !track->IsOnLayer( layer ) )
continue;
@ -325,7 +334,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
}
// draw pads
for( MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
for( MODULE* module = pcb->m_Modules; module; module = module->Next() )
{
module->TransformPadsShapesWithClearanceToPolygon( layer,
bufferPolys,
@ -345,7 +354,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
{
D_PAD* pad = module->Pads();
for( ; pad != NULL; pad = pad->Next() )
for( ; pad; pad = pad->Next() )
pad->BuildPadDrillShapePolygon( allLayerHoles, 0,
segcountLowQuality );
}
@ -439,7 +448,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
}
// Draw vias holes (vertical cylinders)
for( const TRACK* track = pcb->m_Track; track != NULL; track = track->Next() )
for( const TRACK* track = pcb->m_Track; track; track = track->Next() )
{
const VIA *via = dynamic_cast<const VIA*>(track);
@ -448,9 +457,9 @@ void EDA_3D_CANVAS::BuildBoard3DView()
}
// Draw pads holes (vertical cylinders)
for( const MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
for( const MODULE* module = pcb->m_Modules; module; module = module->Next() )
{
for( D_PAD* pad = module->Pads(); pad != NULL; pad = pad->Next() )
for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() )
Draw3DPadHole( pad );
}
@ -459,12 +468,14 @@ void EDA_3D_CANVAS::BuildBoard3DView()
( realistic_mode || g_Parm_3D_Visu.GetFlag( FL_SHOW_BOARD_BODY ) ) )
{
int copper_thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();
// a small offset between substrate and external copper layer to avoid artifacts
// when drawing copper items on board
int epsilon = Millimeter2iu( 0.01 );
int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU( LAYER_N_BACK );
int board_thickness = g_Parm_3D_Visu.GetLayerZcoordBIU( LAYER_N_FRONT )
- g_Parm_3D_Visu.GetLayerZcoordBIU( LAYER_N_BACK );
int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU( B_Cu );
int board_thickness = g_Parm_3D_Visu.GetLayerZcoordBIU( F_Cu )
- g_Parm_3D_Visu.GetLayerZcoordBIU( B_Cu );
// items on copper layers and having a thickness = copper_thickness
// are drawn from zpos - copper_thickness/2 to zpos + copper_thickness
// therefore substrate position is copper_thickness/2 to
@ -476,11 +487,11 @@ void EDA_3D_CANVAS::BuildBoard3DView()
SetGLEpoxyColor();
else
{
EDA_COLOR_T color = g_ColorsSettings.GetLayerColor( EDGE_N );
EDA_COLOR_T color = g_ColorsSettings.GetLayerColor( Edge_Cuts );
SetGLColor( color, 0.7 );
}
glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( LAYER_N_FRONT ) );
glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( F_Cu ) );
KI_POLYGON_SET currLayerPolyset;
KI_POLYGON_SET polysetHoles;
@ -515,6 +526,7 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
// to reduce time calculations
// for holes and items which do not need
// a fine representation
double correctionFactorLQ = 1.0 / cos( M_PI / (segcountLowQuality * 2) );
CPOLYGONS_LIST bufferPolys;
@ -537,7 +549,7 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();
// Add via holes
for( VIA* via = GetFirstVia( pcb->m_Track ); via != NULL;
for( VIA* via = GetFirstVia( pcb->m_Track ); via;
via = GetFirstVia( via->Next() ) )
{
VIATYPE_T viatype = via->GetViaType();
@ -551,12 +563,12 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
}
// draw pads holes
for( MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
for( MODULE* module = pcb->m_Modules; module; module = module->Next() )
{
// Add pad hole, if any
D_PAD* pad = module->Pads();
for( ; pad != NULL; pad = pad->Next() )
for( ; pad; pad = pad->Next() )
pad->BuildPadDrillShapePolygon( allLayerHoles, 0,
segcountLowQuality );
}
@ -566,9 +578,21 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
KI_POLYGON_SET brdpolysetHoles;
allLayerHoles.ExportTo( brdpolysetHoles );
for( LAYER_NUM layer = FIRST_NON_COPPER_LAYER; layer <= LAST_NON_COPPER_LAYER;
++layer )
static const LAYER_ID sequence[] = {
B_Adhes,
F_Adhes,
B_Paste,
F_Paste,
B_SilkS,
F_SilkS,
B_Mask,
F_Mask,
};
for( LSEQ seq = pcb->GetEnabledLayers().Seq( sequence, DIM( sequence ) ); seq; ++seq )
{
LAYER_ID layer = *seq;
// Skip user layers, which are not drawn here
if( IsUserLayer( layer) )
continue;
@ -576,7 +600,7 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
if( !Is3DLayerEnabled( layer ) )
continue;
if( layer == EDGE_N && g_Parm_3D_Visu.GetFlag( FL_SHOW_BOARD_BODY ) )
if( layer == Edge_Cuts && g_Parm_3D_Visu.GetFlag( FL_SHOW_BOARD_BODY ) )
continue;
bufferPolys.RemoveAllContours();
@ -603,14 +627,14 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
}
}
for( MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
for( MODULE* module = pcb->m_Modules; module; module = module->Next() )
{
if( layer == SILKSCREEN_N_FRONT || layer == SILKSCREEN_N_BACK )
if( layer == F_SilkS || layer == B_SilkS )
{
D_PAD* pad = module->Pads();
int linewidth = g_DrawDefaultLineThickness;
for( ; pad != NULL; pad = pad->Next() )
for( ; pad; pad = pad->Next() )
{
if( !pad->IsOnLayer( layer ) )
continue;
@ -651,7 +675,7 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
// Solder mask layers are "negative" layers.
// Shapes should be removed from the full board area.
if( layer == SOLDERMASK_N_BACK || layer == SOLDERMASK_N_FRONT )
if( layer == B_Mask || layer == F_Mask )
{
bufferPcbOutlines.ExportTo( currLayerPolyset );
bufferPolys.Append( allLayerHoles );
@ -659,8 +683,8 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
currLayerPolyset -= polyset;
}
// Remove holes from Solder paste layers and siklscreen
else if( layer == SOLDERPASTE_N_BACK || layer == SOLDERPASTE_N_FRONT
|| layer == SILKSCREEN_N_BACK || layer == SILKSCREEN_N_FRONT )
else if( layer == B_Paste || layer == F_Paste
|| layer == B_SilkS || layer == F_SilkS )
{
bufferPolys.ExportTo( currLayerPolyset );
currLayerPolyset -= brdpolysetHoles;
@ -674,11 +698,11 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
int thickness = g_Parm_3D_Visu.GetLayerObjectThicknessBIU( layer );
int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU( layer );
if( layer == EDGE_N )
if( layer == Edge_Cuts )
{
thickness = g_Parm_3D_Visu.GetLayerZcoordBIU( LAYER_N_FRONT )
- g_Parm_3D_Visu.GetLayerZcoordBIU( LAYER_N_BACK );
zpos = g_Parm_3D_Visu.GetLayerZcoordBIU( LAYER_N_BACK )
thickness = g_Parm_3D_Visu.GetLayerZcoordBIU( F_Cu )
- g_Parm_3D_Visu.GetLayerZcoordBIU( B_Cu );
zpos = g_Parm_3D_Visu.GetLayerZcoordBIU( B_Cu )
+ (thickness / 2);
}
else
@ -703,6 +727,7 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
}
}
/**
* Function BuildBoard3DAuxLayers
* Called by CreateDrawGL_List()
@ -714,12 +739,24 @@ void EDA_3D_CANVAS::BuildBoard3DAuxLayers()
const int segcountforcircle = 16;
double correctionFactor = 1.0 / cos( M_PI / (segcountforcircle * 2) );
BOARD* pcb = GetBoard();
CPOLYGONS_LIST bufferPolys;
bufferPolys.reserve( 5000 ); // Reserve for items not on board
for( LAYER_NUM layer = FIRST_USER_LAYER; layer <= LAST_USER_LAYER;
++layer )
static const LAYER_ID sequence[] = {
Dwgs_User,
Cmts_User,
Eco1_User,
Eco2_User,
Edge_Cuts,
Margin
};
for( LSEQ aux( sequence, sequence+DIM(sequence) ); aux; ++aux )
{
LAYER_ID layer = *aux;
if( !Is3DLayerEnabled( layer ) )
continue;
@ -747,7 +784,7 @@ void EDA_3D_CANVAS::BuildBoard3DAuxLayers()
}
}
for( MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
for( MODULE* module = pcb->m_Modules; module; module = module->Next() )
{
module->TransformPadsShapesWithClearanceToPolygon( layer,
bufferPolys,
@ -1067,7 +1104,7 @@ void EDA_3D_CANVAS::Draw3DGrid( double aGriSizeMM )
void EDA_3D_CANVAS::Draw3DViaHole( const VIA* aVia )
{
LAYER_NUM top_layer, bottom_layer;
LAYER_ID top_layer, bottom_layer;
int inner_radius = aVia->GetDrillValue() / 2;
int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();
@ -1115,7 +1152,7 @@ void MODULE::ReadAndInsert3DComponentShape( EDA_3D_CANVAS* glcanvas,
glRotatef( 180.0, 0.0, 0.0, 1.0 );
}
for( ; shape3D != NULL; shape3D = shape3D->Next() )
for( ; shape3D; shape3D = shape3D->Next() )
{
shape3D->SetLoadNonTransparentObjects( aAllowNonTransparentObjects );
shape3D->SetLoadTransparentObjects( aAllowTransparentObjects );
@ -1141,15 +1178,15 @@ void EDA_3D_CANVAS::Draw3DPadHole( const D_PAD* aPad )
// Store here the points to approximate hole by segments
CPOLYGONS_LIST holecornersBuffer;
int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();
int height = g_Parm_3D_Visu.GetLayerZcoordBIU( LAYER_N_FRONT ) -
g_Parm_3D_Visu.GetLayerZcoordBIU( LAYER_N_BACK );
int height = g_Parm_3D_Visu.GetLayerZcoordBIU( F_Cu ) -
g_Parm_3D_Visu.GetLayerZcoordBIU( B_Cu );
if( g_Parm_3D_Visu.IsRealisticMode() )
SetGLCopperColor();
else
SetGLColor( DARKGRAY );
int holeZpoz = g_Parm_3D_Visu.GetLayerZcoordBIU( LAYER_N_BACK ) + thickness / 2;
int holeZpoz = g_Parm_3D_Visu.GetLayerZcoordBIU( B_Cu ) + thickness / 2;
int holeHeight = height - thickness;
if( drillsize.x == drillsize.y ) // usual round hole
@ -1187,7 +1224,7 @@ void EDA_3D_CANVAS::Draw3DPadHole( const D_PAD* aPad )
}
bool Is3DLayerEnabled( LAYER_NUM aLayer )
static bool Is3DLayerEnabled( LAYER_ID aLayer )
{
DISPLAY3D_FLG flg;
bool realistic_mode = g_Parm_3D_Visu.IsRealisticMode();
@ -1196,44 +1233,44 @@ bool Is3DLayerEnabled( LAYER_NUM aLayer )
// check the flags
switch( aLayer )
{
case ADHESIVE_N_BACK:
case ADHESIVE_N_FRONT:
case B_Adhes:
case F_Adhes:
flg = FL_ADHESIVE;
break;
case SOLDERPASTE_N_BACK:
case SOLDERPASTE_N_FRONT:
case B_Paste:
case F_Paste:
flg = FL_SOLDERPASTE;
break;
case SILKSCREEN_N_BACK:
case SILKSCREEN_N_FRONT:
case B_SilkS:
case F_SilkS:
flg = FL_SILKSCREEN;
break;
case SOLDERMASK_N_BACK:
case SOLDERMASK_N_FRONT:
case B_Mask:
case F_Mask:
flg = FL_SOLDERMASK;
break;
case DRAW_N:
case COMMENT_N:
case Dwgs_User:
case Cmts_User:
if( realistic_mode )
return false;
flg = FL_COMMENTS;
break;
case ECO1_N:
case ECO2_N:
case Eco1_User:
case Eco2_User:
if( realistic_mode )
return false;
flg = FL_ECO;
break;
case LAYER_N_BACK:
case LAYER_N_FRONT:
case B_Cu:
case F_Cu:
return g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( aLayer )
|| realistic_mode;
break;
@ -1256,11 +1293,11 @@ GLfloat Get3DLayer_Z_Orientation( LAYER_NUM aLayer )
{
double nZ = 1.0;
if( ( aLayer == LAYER_N_BACK )
|| ( aLayer == ADHESIVE_N_BACK )
|| ( aLayer == SOLDERPASTE_N_BACK )
|| ( aLayer == SILKSCREEN_N_BACK )
|| ( aLayer == SOLDERMASK_N_BACK ) )
if( ( aLayer == B_Cu )
|| ( aLayer == B_Adhes )
|| ( aLayer == B_Paste )
|| ( aLayer == B_SilkS )
|| ( aLayer == B_Mask ) )
nZ = -1.0;
return nZ;

View File

@ -132,53 +132,52 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
// Fill remaining unused copper layers and front layer zpos
// with m_EpoxyThickness
// Solder mask and Solder paste have the same Z position
for( ; layer <= LAST_COPPER_LAYER; layer++ )
for( ; layer < MAX_CU_LAYERS; layer++ )
{
m_LayerZcoord[layer] = m_EpoxyThickness;
}
// calculate z position for each non copper layer
for( int layer_id = FIRST_NON_COPPER_LAYER; layer_id < NB_PCB_LAYERS; layer_id++ )
for( int layer_id = MAX_CU_LAYERS; layer_id < LAYER_ID_COUNT; layer_id++ )
{
double zpos;
switch( layer_id )
{
case ADHESIVE_N_BACK:
case B_Adhes:
zpos = zpos_copper_back - 3 * zpos_offset;
break;
case ADHESIVE_N_FRONT:
case F_Adhes:
zpos = zpos_copper_front + 3 * zpos_offset;
break;
case SOLDERPASTE_N_BACK:
case B_Paste:
zpos = zpos_copper_back - 1 * zpos_offset;
break;
case SOLDERPASTE_N_FRONT:
case F_Paste:
zpos = zpos_copper_front + 1 * zpos_offset;
break;
case SOLDERMASK_N_BACK:
case B_Mask:
zpos = zpos_copper_back - 1 * zpos_offset;
break;
case SOLDERMASK_N_FRONT:
case F_Mask:
zpos = zpos_copper_front + 1 * zpos_offset;
break;
case SILKSCREEN_N_BACK:
case B_SilkS:
zpos = zpos_copper_back - 2 * zpos_offset;
break;
case SILKSCREEN_N_FRONT:
case F_SilkS:
zpos = zpos_copper_front + 2 * zpos_offset;
break;
default:
zpos = zpos_copper_front +
(layer_id - FIRST_NON_COPPER_LAYER + 4) * zpos_offset;
zpos = zpos_copper_front + (layer_id - MAX_CU_LAYERS + 4) * zpos_offset;
break;
}
@ -196,8 +195,8 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
double INFO3D_VISU::GetModulesZcoord3DIU( bool aIsFlipped )
{
if( aIsFlipped )
return m_LayerZcoord[LAYER_N_BACK] - ( m_CopperThickness / 2 );
return m_LayerZcoord[B_Cu] - ( m_CopperThickness / 2 );
else
return m_LayerZcoord[LAYER_N_FRONT] + ( m_CopperThickness / 2 );
return m_LayerZcoord[F_Cu] + ( m_CopperThickness / 2 );
}

View File

@ -95,7 +95,7 @@ public:
double m_CurrentZpos; // temporary storage of current value of Z position,
// used in some calculation
private:
double m_LayerZcoord[NB_LAYERS]; // Z position of each layer (normalized)
double m_LayerZcoord[LAYER_ID_COUNT]; // Z position of each layer (normalized)
double m_CopperThickness; // Copper thickness (normalized)
double m_EpoxyThickness; // Epoxy thickness (normalized)
double m_NonCopperLayerThickness; // Non copper layers thickness
@ -190,9 +190,10 @@ public: INFO3D_VISU();
*/
int GetLayerObjectThicknessBIU( int aLayerId ) const
{
return aLayerId >= FIRST_NON_COPPER_LAYER ?
GetNonCopperLayerThicknessBIU() :
GetCopperThicknessBIU();
return IsCopperLayer( aLayerId ) ?
GetCopperThicknessBIU() :
GetNonCopperLayerThicknessBIU()
;
}
bool IsRealisticMode() { return GetFlag( FL_USE_REALISTIC_MODE ); }

View File

@ -355,7 +355,7 @@ void BITMAPCONV_INFO::OuputOnePolygon( KPolygon & aPolygon )
case PCBNEW_LEGACY_EMP:
{
LAYER_NUM layer = SILKSCREEN_N_FRONT;
LAYER_NUM layer = F_SilkS;
int width = 1;
fprintf( m_Outfile, "DP %d %d %d %d %d %d %d\n",
0, 0, 0, 0,

View File

@ -250,6 +250,7 @@ set( PCB_COMMON_SRCS
eda_text.cpp
class_page_info.cpp
pcbcommon.cpp
lset.cpp
footprint_info.cpp
../pcbnew/basepcbframe.cpp
../pcbnew/class_board.cpp

View File

@ -15,8 +15,7 @@
/* Initial colors values: optimized for Pcbnew, but are also Ok for Eeschema
* these values are superseded by config reading
*/
static const EDA_COLOR_T default_layer_color[LAYERSCOLORSBUFFERSIZE] =
{
static const EDA_COLOR_T default_layer_color[] = {
GREEN, BLUE, LIGHTGRAY, BROWN,
RED, MAGENTA, LIGHTGRAY, MAGENTA,
DARKGRAY, BLUE, GREEN, CYAN,
@ -34,8 +33,8 @@ static const EDA_COLOR_T default_layer_color[LAYERSCOLORSBUFFERSIZE] =
DARKGRAY
};
static const EDA_COLOR_T default_items_color[LAYERSCOLORSBUFFERSIZE] =
{
static const EDA_COLOR_T default_items_color[] = {
LIGHTGRAY, // unused
CYAN, // VIA_MICROVIA_VISIBLE
BROWN, // VIA_BBLIND_VISIBLE
@ -56,13 +55,24 @@ static const EDA_COLOR_T default_items_color[LAYERSCOLORSBUFFERSIZE] =
LIGHTGRAY, LIGHTGRAY, LIGHTGRAY
};
COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS()
{
for( unsigned ii = 0; ii < DIM(m_LayersColors); ii++ )
m_LayersColors[ii] = default_layer_color[ii];
for( unsigned src = 0, dst = 0; dst < DIM(m_LayersColors); ++dst )
{
m_LayersColors[dst] = default_layer_color[src++];
for( unsigned ii = 0; ii < DIM(m_ItemsColors); ii++ )
m_ItemsColors[ii] = default_items_color[ii];
if( src >= DIM( default_layer_color ) )
src = 0; // wrap the source.
}
for( unsigned src = 0, dst = 0; dst < DIM(m_ItemsColors); ++dst )
{
m_ItemsColors[dst] = default_items_color[src++];
if( src >= DIM( default_items_color ) )
src = 0;
}
}

View File

@ -13,19 +13,11 @@
LAYER_SELECTOR::LAYER_SELECTOR()
{
m_layerorder = true;
m_layerhotkeys = true;
m_hotkeys = NULL;
}
bool LAYER_SELECTOR::SetLayersOrdered( bool value )
{
m_layerorder = value;
return m_layerorder;
}
bool LAYER_SELECTOR::SetLayersHotkeys( bool value )
{
m_layerhotkeys = value;
@ -33,7 +25,7 @@ bool LAYER_SELECTOR::SetLayersHotkeys( bool value )
}
void LAYER_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer )
void LAYER_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_ID aLayer )
{
wxMemoryDC bmpDC;
wxBrush brush;
@ -120,12 +112,15 @@ int LAYER_BOX_SELECTOR::SetLayerSelection( LAYER_NUM layer )
return -1;
}
void LAYER_BOX_SELECTOR::ResyncBitmapOnly()
{
LAYER_NUM elements = GetCount();
for( LAYER_NUM i = FIRST_LAYER; i < elements; ++i )
int elements = GetCount();
for( LAYER_NUM i = 0; i < elements; ++i )
{
wxBitmap layerbmp( 14, 14 );
SetBitmapLayer( layerbmp, i );
SetBitmapLayer( layerbmp, LAYER_ID( i ) );
}
}

View File

@ -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") );
}

View File

@ -43,16 +43,6 @@
class MODULE;
/* Look up Table for conversion copper layer count -> general copper layer
* mask: */
LAYER_MSK g_TabAllCopperLayerMask[NB_COPPER_LAYERS] = {
0x0001, 0x8001, 0x8003, 0x8007,
0x800F, 0x801F, 0x803F, 0x807F,
0x80FF, 0x81FF, 0x83FF, 0x87FF,
0x8FFF, 0x9FFF, 0xCFFF, 0xFFFF
};
DISPLAY_OPTIONS DisplayOpt; // Display options for board items
int g_AnchorColor = BLUE;
@ -71,124 +61,20 @@ int g_PadCMPColor = RED;
*/
DLIST<TRACK> g_CurrentTrackList;
LAYER_NUM FlipLayer( LAYER_NUM oldlayer )
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;
}
if( !aDesc.IsEmpty() )
aDesc << wxT(", ");
aDesc << aItem;
}
LAYER_MSK FlipLayerMask( LAYER_MSK aMask )
{
LAYER_MSK newMask;
newMask = aMask & ~(LAYER_BACK | LAYER_FRONT |
SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT |
ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT |
SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT |
SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT |
ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT);
if( aMask & LAYER_BACK )
newMask |= LAYER_FRONT;
if( aMask & LAYER_FRONT )
newMask |= LAYER_BACK;
if( aMask & SILKSCREEN_LAYER_BACK )
newMask |= SILKSCREEN_LAYER_FRONT;
if( aMask & SILKSCREEN_LAYER_FRONT )
newMask |= SILKSCREEN_LAYER_BACK;
if( aMask & ADHESIVE_LAYER_BACK )
newMask |= ADHESIVE_LAYER_FRONT;
if( aMask & ADHESIVE_LAYER_FRONT )
newMask |= ADHESIVE_LAYER_BACK;
if( aMask & SOLDERMASK_LAYER_BACK )
newMask |= SOLDERMASK_LAYER_FRONT;
if( aMask & SOLDERMASK_LAYER_FRONT )
newMask |= SOLDERMASK_LAYER_BACK;
if( aMask & SOLDERPASTE_LAYER_BACK )
newMask |= SOLDERPASTE_LAYER_FRONT;
if( aMask & SOLDERPASTE_LAYER_FRONT )
newMask |= SOLDERPASTE_LAYER_BACK;
if( aMask & ADHESIVE_LAYER_BACK )
newMask |= ADHESIVE_LAYER_FRONT;
if( aMask & ADHESIVE_LAYER_FRONT )
newMask |= ADHESIVE_LAYER_BACK;
return newMask;
}
LAYER_NUM ExtractLayer( LAYER_MSK aMask )
{
if( aMask == NO_LAYERS )
return UNSELECTED_LAYER;
LAYER_NUM candidate = UNDEFINED_LAYER;
// Scan all the layers and take note of the first set; if other are
// then found return UNDEFINED_LAYER
for( LAYER_NUM i = FIRST_LAYER; i < NB_LAYERS; ++i )
{
if( aMask & GetLayerMask( i ) )
{
if( candidate == UNDEFINED_LAYER )
candidate = i;
else
return UNDEFINED_LAYER;
}
}
return candidate;
}
wxString LayerMaskDescribe( const BOARD *aBoard, LAYER_MSK aMask )
wxString LayerMaskDescribe( const BOARD *aBoard, LSET aMask )
{
// Try the single or no- layer case (easy)
LAYER_NUM layer = ExtractLayer( aMask );
switch( layer )
LAYER_ID layer = aMask.ExtractLayer();
switch( (int) layer )
{
case UNSELECTED_LAYER:
return _( "No layers" );
@ -203,24 +89,19 @@ wxString LayerMaskDescribe( const BOARD *aBoard, LAYER_MSK aMask )
// Try to be smart and useful, starting with outer copper
// (which are more important than internal ones)
wxString layerInfo;
if( aMask & LAYER_FRONT )
AccumulateDescription( layerInfo, aBoard->GetLayerName( LAYER_N_FRONT ) );
if( aMask & LAYER_BACK )
AccumulateDescription( layerInfo, aBoard->GetLayerName( LAYER_N_BACK ) );
if( aMask[F_Cu] )
AccumulateDescription( layerInfo, aBoard->GetLayerName( F_Cu ) );
if( aMask & INTERNAL_CU_LAYERS )
if( aMask[B_Cu] )
AccumulateDescription( layerInfo, aBoard->GetLayerName( B_Cu ) );
if( ( aMask & LSET::InternalCuMask() ).any() )
AccumulateDescription( layerInfo, _("Internal" ) );
if( aMask & ALL_NO_CU_LAYERS )
if( ( aMask & LSET::AllNonCuMask() ).any() )
AccumulateDescription( layerInfo, _("Non-copper" ) );
return layerInfo;
}
void AccumulateDescription( wxString &aDesc, const wxString &aItem )
{
if( !aDesc.IsEmpty() )
aDesc << wxT(", ");
aDesc << aItem;
}

View File

@ -183,7 +183,7 @@ void LIB_EDIT_FRAME::SVG_PlotComponent( const wxString& aFullFileName )
delete plotter;
}
void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, LAYER_MSK aPrintMask, bool aPrintMirrorMode, void* aData)
void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode, void* aData)
{
if( ! m_component )
return;

View File

@ -608,7 +608,7 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMask,
virtual void PrintPage( wxDC* aDC, LSET aPrintMask,
bool aPrintMirrorMode, void* aData = NULL );
/**

View File

@ -931,7 +931,7 @@ void SCH_EDIT_FRAME::OnPrint( wxCommandEvent& event )
}
void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, LAYER_MSK aPrintMask, bool aPrintMirrorMode,
void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode,
void* aData )
{
GetScreen()->Draw( m_canvas, aDC, GR_DEFAULT_DRAWMODE );

View File

@ -9,13 +9,11 @@ class GBR_LAYER_BOX_SELECTOR : public LAYER_BOX_SELECTOR
{
public:
GBR_LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL )
:LAYER_BOX_SELECTOR( parent, id, pos, size, n, choices )
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL ) :
LAYER_BOX_SELECTOR( parent, id, pos, size, n, choices )
{
m_layerhotkeys = false;
m_layerorder = false;
}
// Reload the Layers names and bitmaps

View File

@ -27,7 +27,7 @@ private:
PAGE_INFO m_paper;
TITLE_BLOCK m_titles;
wxPoint m_originAxisPosition;
LAYER_MSK m_printLayersMask; // When printing: the list of layers to print
LSET m_printLayersMask; // When printing: the list of layers to print
public:
DLIST<GERBER_DRAW_ITEM> m_Drawings; // linked list of Gerber Items
@ -93,7 +93,7 @@ public:
* changes the bit-mask of visible layers
* @param aLayerMask = The new bit-mask of visible layers
*/
void SetVisibleLayers( LAYER_MSK aLayerMask )
void SetVisibleLayers( LSET aLayerMask )
{
m_printLayersMask = aLayerMask;
}

View File

@ -86,7 +86,7 @@ GBR_SCREEN::GBR_SCREEN( const wxSize& aPageSizeIU ) :
// Set the working grid size to a reasonable value (in 1/10000 inch)
SetGrid( DMIL_GRID( 500 ) );
m_Active_Layer = LAYER_N_BACK; // default active layer = bottom layer
m_Active_Layer = B_Cu; // default active layer = bottom layer
SetZoom( ZOOM_FACTOR( 350 ) ); // a default value for zoom

View File

@ -134,7 +134,7 @@ public:
*/
void SetLayer( LAYER_NUM aLayer ) { m_Layer = aLayer; }
LAYER_MSK GetLayerMask()
LSET GetLayerMask()
{
return ::GetLayerMask( m_Layer );
}

View File

@ -169,7 +169,7 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
int rowCount;
int menuId = event.GetId();
bool visible = (menuId == ID_SHOW_ALL_LAYERS) ? true : false;;
LAYER_MSK visibleLayers = NO_LAYERS;
LSET visibleLayers = NO_LAYERS;
bool force_active_layer_visible;
m_alwaysShowActiveLayer = ( menuId == ID_ALWAYS_SHOW_NO_LAYERS_BUT_ACTIVE );
@ -195,9 +195,9 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
cb->SetValue( loc_visible );
if( loc_visible )
visibleLayers |= GetLayerMask( row );
visibleLayers |= GetLayerSet( row );
else
visibleLayers &= ~GetLayerMask( row );
visibleLayers &= ~GetLayerSet( row );
}
myframe->SetVisibleLayers( visibleLayers );
@ -237,7 +237,7 @@ void GERBER_LAYER_WIDGET::ReFill()
//-----<LAYER_WIDGET callbacks>-------------------------------------------
void GERBER_LAYER_WIDGET::OnLayerColorChange( LAYER_NUM aLayer, EDA_COLOR_T aColor )
void GERBER_LAYER_WIDGET::OnLayerColorChange( int aLayer, EDA_COLOR_T aColor )
{
myframe->SetLayerColor( aLayer, aColor );
myframe->m_SelLayerBox->ResyncBitmapOnly();
@ -263,12 +263,12 @@ bool GERBER_LAYER_WIDGET::OnLayerSelect( LAYER_NUM aLayer )
void GERBER_LAYER_WIDGET::OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal )
{
LAYER_MSK visibleLayers = myframe->GetVisibleLayers();
LSET visibleLayers = myframe->GetVisibleLayers();
if( isVisible )
visibleLayers |= GetLayerMask( aLayer );
visibleLayers |= GetLayerSet( aLayer );
else
visibleLayers &= ~GetLayerMask( aLayer );
visibleLayers &= ~GetLayerSet( aLayer );
myframe->SetVisibleLayers( visibleLayers );

View File

@ -91,9 +91,9 @@ public:
void ReFillRender();
//-----<implement LAYER_WIDGET abstract callback functions>-----------
void OnLayerColorChange( LAYER_NUM aLayer, EDA_COLOR_T aColor );
bool OnLayerSelect( LAYER_NUM aLayer );
void OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal );
void OnLayerColorChange( int aLayer, EDA_COLOR_T aColor );
bool OnLayerSelect( int aLayer );
void OnLayerVisible( int aLayer, bool isVisible, bool isFinal );
void OnRenderColorChange( int aId, EDA_COLOR_T aColor );
void OnRenderEnable( int aId, bool isEnabled );
/**

View File

@ -63,7 +63,7 @@ private:
public:
bool IsMirrored() { return m_Print_Mirror->IsChecked(); }
bool PrintUsingSinglePage() { return true; }
int SetLayerMaskFromListSelection();
int SetLayerSetFromListSelection();
};
@ -136,7 +136,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
// Create layer list
for( LAYER_NUM ii = FIRST_LAYER; ii < layer_max; ++ii )
{
LAYER_MSK mask = GetLayerMask( ii );
LSET mask = GetLayerSet( ii );
msg = _( "Layer" );
msg << wxT( " " ) << ii + 1;
m_BoxSelectLayer[ii] = new wxCheckBox( this, -1, msg );
@ -183,7 +183,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
{
m_BoxSelectLayer[layer]->SetValue( option );
if( option )
s_SelectedLayers |= GetLayerMask( layer );
s_SelectedLayers |= GetLayerSet( layer );
}
}
}
@ -215,7 +215,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
}
/**************************************************************/
int DIALOG_PRINT_USING_PRINTER::SetLayerMaskFromListSelection()
int DIALOG_PRINT_USING_PRINTER::SetLayerSetFromListSelection()
/**************************************************************/
{
int page_count = 0;
@ -225,7 +225,7 @@ int DIALOG_PRINT_USING_PRINTER::SetLayerMaskFromListSelection()
if( m_BoxSelectLayer[ii]->IsChecked() )
{
page_count++;
s_Parameters.m_PrintMaskLayer |= GetLayerMask( ii );
s_Parameters.m_PrintMaskLayer |= GetLayerSet( ii );
}
}
@ -271,7 +271,7 @@ void DIALOG_PRINT_USING_PRINTER::SetPrintParameters( )
// because these objects create artefact when they are printed on an existing image.
s_Parameters.m_OptionPrintPage = false;
SetLayerMaskFromListSelection();
SetLayerSetFromListSelection();
int idx = m_ScaleOption->GetSelection();
s_Parameters.m_PrintScale = s_ScaleList[idx];
@ -342,7 +342,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
return;
}
SetLayerMaskFromListSelection();
SetLayerSetFromListSelection();
// If no layer selected, we have no plot. prompt user if it happens
// because he could think there is a bug in Pcbnew:

View File

@ -189,7 +189,7 @@ const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber )
// Use a switch to explicitly show the mapping more clearly
switch( aLayerNumber )
{
case LAYER_N_FRONT: txt = wxT( "F.Cu" ); break;
case F_Cu: txt = wxT( "F.Cu" ); break;
case LAYER_N_2: txt = wxT( "Inner1.Cu" ); break;
case LAYER_N_3: txt = wxT( "Inner2.Cu" ); break;
case LAYER_N_4: txt = wxT( "Inner3.Cu" ); break;
@ -204,20 +204,20 @@ const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber )
case LAYER_N_13: txt = wxT( "Inner12.Cu" ); break;
case LAYER_N_14: txt = wxT( "Inner13.Cu" ); break;
case LAYER_N_15: txt = wxT( "Inner14.Cu" ); break;
case LAYER_N_BACK: txt = wxT( "B.Cu" ); break;
case ADHESIVE_N_BACK: txt = wxT( "B.Adhes" ); break;
case ADHESIVE_N_FRONT: txt = wxT( "F.Adhes" ); break;
case SOLDERPASTE_N_BACK: txt = wxT( "B.Paste" ); break;
case SOLDERPASTE_N_FRONT: txt = wxT( "F.Paste" ); break;
case SILKSCREEN_N_BACK: txt = wxT( "B.SilkS" ); break;
case SILKSCREEN_N_FRONT: txt = wxT( "F.SilkS" ); break;
case SOLDERMASK_N_BACK: txt = wxT( "B.Mask" ); break;
case SOLDERMASK_N_FRONT: txt = wxT( "F.Mask" ); break;
case DRAW_N: txt = wxT( "Dwgs.User" ); break;
case COMMENT_N: txt = wxT( "Cmts.User" ); break;
case ECO1_N: txt = wxT( "Eco1.User" ); break;
case ECO2_N: txt = wxT( "Eco2.User" ); break;
case EDGE_N: txt = wxT( "Edge.Cuts" ); break;
case B_Cu: txt = wxT( "B.Cu" ); break;
case B_Adhes: txt = wxT( "B.Adhes" ); break;
case F_Adhes: txt = wxT( "F.Adhes" ); break;
case B_Paste: txt = wxT( "B.Paste" ); break;
case F_Paste: txt = wxT( "F.Paste" ); break;
case B_SilkS: txt = wxT( "B.SilkS" ); break;
case F_SilkS: txt = wxT( "F.SilkS" ); break;
case B_Mask: txt = wxT( "B.Mask" ); break;
case F_Mask: txt = wxT( "F.Mask" ); break;
case Dwgs_User: txt = wxT( "Dwgs.User" ); break;
case Cmts_User: txt = wxT( "Cmts.User" ); break;
case Eco1_User: txt = wxT( "Eco1.User" ); break;
case Eco2_User: txt = wxT( "Eco2.User" ); break;
case Edge_Cuts: txt = wxT( "Edge.Cuts" ); break;
default: txt = wxT( "BAD_INDEX" ); break;
}

View File

@ -42,11 +42,11 @@
#include <printout_controler.h>
void GERBVIEW_FRAME::PrintPage( wxDC* aDC, LAYER_MSK aPrintMasklayer,
void GERBVIEW_FRAME::PrintPage( wxDC* aDC, LSET aPrintMasklayer,
bool aPrintMirrorMode, void* aData )
{
// Save current draw options, because print mode has specific options:
LAYER_MSK visiblemask = GetVisibleLayers();
LSET visiblemask = GetVisibleLayers();
GBR_DISPLAY_OPTIONS imgDisplayOptions = m_DisplayOptions;
// Set draw options for printing:

View File

@ -551,7 +551,7 @@ void GERBVIEW_FRAME::SetVisibleAlls()
* Returns a bit-mask of all the layers that are visible
* @return int - the visible layers in bit-mapped form.
*/
LAYER_MSK GERBVIEW_FRAME::GetVisibleLayers() const
LSET GERBVIEW_FRAME::GetVisibleLayers() const
{
return FULL_LAYERS; // TODO
}
@ -563,7 +563,7 @@ LAYER_MSK GERBVIEW_FRAME::GetVisibleLayers() const
* changes the bit-mask of visible layers
* @param aLayerMask = The new bit-mask of visible layers
*/
void GERBVIEW_FRAME::SetVisibleLayers( LAYER_MSK aLayerMask )
void GERBVIEW_FRAME::SetVisibleLayers( LSET aLayerMask )
{
GetGerberLayout()->SetVisibleLayers( aLayerMask );
}

View File

@ -308,7 +308,7 @@ public:
* Returns a bit-mask of all the layers that are visible
* @return int - the visible layers in bit-mapped form.
*/
LAYER_MSK GetVisibleLayers() const;
LSET GetVisibleLayers() const;
/**
* Function SetVisibleLayers
@ -316,7 +316,7 @@ public:
* changes the bit-mask of visible layers
* @param aLayerMask = The new bit-mask of visible layers
*/
void SetVisibleLayers( LAYER_MSK aLayerMask );
void SetVisibleLayers( LSET aLayerMask );
/**
* Function IsLayerVisible
@ -667,7 +667,7 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMasklayer, bool aPrintMirrorMode,
virtual void PrintPage( wxDC* aDC, LSET aPrintMasklayer, bool aPrintMirrorMode,
void* aData = NULL );
/**

View File

@ -128,7 +128,7 @@ void LAYERS_MAP_DIALOG::initDialog()
if( (pcb_layer_num == m_exportBoardCopperLayersCount - 1)
&& (m_exportBoardCopperLayersCount > 1) )
pcb_layer_num = LAYER_N_FRONT;
pcb_layer_num = F_Cu;
m_buttonTable[m_itemsCount] = ii;
m_layersLookUpTable[ii] = pcb_layer_num;
@ -288,7 +288,7 @@ void LAYERS_MAP_DIALOG::OnResetClick( wxCommandEvent& event )
{
if( (layer == m_exportBoardCopperLayersCount - 1)
&& (m_exportBoardCopperLayersCount > 1) )
layer = LAYER_N_FRONT;
layer = F_Cu;
m_layersLookUpTable[ii] = layer;
msg = GetPCBDefaultLayerName( layer );
m_layersList[ii]->SetLabel( msg );
@ -362,7 +362,7 @@ void LAYERS_MAP_DIALOG::OnSelectLayer( wxCommandEvent& event )
LAYER_NUM jj = m_layersLookUpTable[m_buttonTable[ii]];
if( !IsValidLayer( jj ) )
jj = LAYER_N_BACK; // (Defaults to "Copper" layer.)
jj = B_Cu; // (Defaults to "Copper" layer.)
jj = m_Parent->SelectPCBLayer( jj, m_exportBoardCopperLayersCount, true );
@ -408,7 +408,7 @@ void LAYERS_MAP_DIALOG::OnOkClick( wxCommandEvent& event )
int inner_layer_max = 0;
for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii )
{
if( m_layersLookUpTable[ii] < LAYER_N_FRONT )
if( m_layersLookUpTable[ii] < F_Cu )
{
if( m_layersLookUpTable[ii ] > inner_layer_max )
inner_layer_max = m_layersLookUpTable[ii];

View File

@ -47,6 +47,7 @@ struct VIA_DIMENSION
}
};
/**
* Class BOARD_DESIGN_SETTINGS
* contains design settings for a BOARD object.
@ -326,7 +327,7 @@ public:
* returns a bit-mask of all the layers that are visible
* @return int - the visible layers in bit-mapped form.
*/
inline LAYER_MSK GetVisibleLayers() const
inline LSET GetVisibleLayers() const
{
return m_visibleLayers;
}
@ -343,30 +344,30 @@ public:
* changes the bit-mask of visible layers
* @param aMask = The new bit-mask of visible layers
*/
inline void SetVisibleLayers( LAYER_MSK aMask )
inline void SetVisibleLayers( LSET aMask )
{
m_visibleLayers = aMask & m_enabledLayers & FULL_LAYERS;
m_visibleLayers = aMask & m_enabledLayers;
}
/**
* Function IsLayerVisible
* tests whether a given layer is visible
* @param aLayer = The layer to be tested
* @param aLayerId = The layer to be tested
* @return bool - true if the layer is visible.
*/
inline bool IsLayerVisible( LAYER_NUM aLayer ) const
inline bool IsLayerVisible( LAYER_ID aLayerId ) const
{
// If a layer is disabled, it is automatically invisible
return m_visibleLayers & m_enabledLayers & GetLayerMask( aLayer );
return (m_visibleLayers & m_enabledLayers)[aLayerId];
}
/**
* Function SetLayerVisibility
* changes the visibility of a given layer
* @param aLayer = The layer to be changed
* @param aLayerId = The layer to be changed
* @param aNewState = The new visibility state of the layer
*/
void SetLayerVisibility( LAYER_NUM aLayer, bool aNewState );
void SetLayerVisibility( LAYER_ID aLayerId, bool aNewState );
/**
* Function GetVisibleElements
@ -417,7 +418,7 @@ public:
* returns a bit-mask of all the layers that are enabled
* @return int - the enabled layers in bit-mapped form.
*/
inline LAYER_MSK GetEnabledLayers() const
inline LSET GetEnabledLayers() const
{
return m_enabledLayers;
}
@ -427,17 +428,17 @@ public:
* changes the bit-mask of enabled layers
* @param aMask = The new bit-mask of enabled layers
*/
void SetEnabledLayers( LAYER_MSK aMask );
void SetEnabledLayers( LSET aMask );
/**
* Function IsLayerEnabled
* tests whether a given layer is enabled
* @param aLayer = The of the layer to be tested
* @param aLayerId = The layer to be tested
* @return bool - true if the layer is enabled
*/
inline bool IsLayerEnabled( LAYER_NUM aLayer ) const
inline bool IsLayerEnabled( LAYER_ID aLayerId ) const
{
return m_enabledLayers & GetLayerMask( aLayer );
return m_enabledLayers[aLayerId];
}
/**
@ -486,8 +487,10 @@ private:
VIA_DIMENSION m_customViaSize;
int m_copperLayerCount; ///< Number of copper layers for this design
LAYER_MSK m_enabledLayers; ///< Bit-mask for layer enabling
LAYER_MSK m_visibleLayers; ///< Bit-mask for layer visibility
LSET m_enabledLayers; ///< Bit-mask for layer enabling
LSET m_visibleLayers; ///< Bit-mask for layer visibility
int m_visibleElements; ///< Bit-mask for element category visibility
int m_boardThickness; ///< Board thickness for 3D viewer

View File

@ -76,12 +76,12 @@ class BOARD_ITEM : public EDA_ITEM
void SetBack( EDA_ITEM* aBack ) { Pback = aBack; }
protected:
LAYER_NUM m_Layer;
LAYER_ID m_Layer;
public:
BOARD_ITEM( BOARD_ITEM* aParent, KICAD_T idtype ) :
EDA_ITEM( aParent, idtype ), m_Layer( FIRST_LAYER )
EDA_ITEM( aParent, idtype ), m_Layer( F_Cu )
{
}
@ -114,7 +114,7 @@ public:
* Function GetLayer
* returns the layer this item is on.
*/
LAYER_NUM GetLayer() const { return m_Layer; }
LAYER_ID GetLayer() const { return m_Layer; }
/**
* Function SetLayer
@ -123,7 +123,7 @@ public:
* is virtual because some items (in fact: class DIMENSION)
* have a slightly different initialization
*/
virtual void SetLayer( LAYER_NUM aLayer )
virtual void SetLayer( LAYER_ID aLayer )
{
// trap any invalid layers, then go find the caller and fix it.
// wxASSERT( unsigned( aLayer ) < unsigned( NB_PCB_LAYERS ) );

View File

@ -7,8 +7,6 @@
#define _COLORS_DESIGN_SETTING_H
#include <layers_id_colors_and_visibility.h>
#define LAYERSCOLORSBUFFERSIZE NB_LAYERS
#define ITEMSCOLORSBUFFERSIZE 32
/**
* Class COLORS_DESIGN_SETTINGS
@ -20,10 +18,10 @@ public:
// Color options for screen display of the Printed Board and schematic:
// Common to Eeschema, Pcbnew, GerbView
EDA_COLOR_T m_LayersColors[LAYERSCOLORSBUFFERSIZE]; ///< Layer colors (tracks and graphic items)
EDA_COLOR_T m_LayersColors[LAYER_ID_COUNT]; ///< Layer colors (tracks and graphic items)
// Common to Eeschema, Pcbnew
EDA_COLOR_T m_ItemsColors[ITEMSCOLORSBUFFERSIZE]; ///< All others items but layers
EDA_COLOR_T m_ItemsColors[32]; ///< All others items but layers
public:
COLORS_DESIGN_SETTINGS();

View File

@ -15,7 +15,6 @@ class LAYER_SELECTOR
{
protected:
bool m_layerhotkeys;
bool m_layerorder;
public:
// Hotkey Info
@ -41,9 +40,10 @@ public:
protected:
// Fills the layer bitmap aLayerbmp with the layer color
void SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer );
void SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_ID aLayer );
};
/* class to display a layer list in a wxBitmapComboBox.
*/
class LAYER_BOX_SELECTOR : public wxBitmapComboBox, public LAYER_SELECTOR
@ -79,23 +79,4 @@ public:
void ResyncBitmapOnly();
};
#define DECLARE_LAYERS_HOTKEY(list) int list[NB_LAYERS] = \
{ \
HK_SWITCH_LAYER_TO_COPPER, \
HK_SWITCH_LAYER_TO_INNER1, \
HK_SWITCH_LAYER_TO_INNER2, \
HK_SWITCH_LAYER_TO_INNER3, \
HK_SWITCH_LAYER_TO_INNER4, \
HK_SWITCH_LAYER_TO_INNER5, \
HK_SWITCH_LAYER_TO_INNER6, \
HK_SWITCH_LAYER_TO_INNER7, \
HK_SWITCH_LAYER_TO_INNER8, \
HK_SWITCH_LAYER_TO_INNER9, \
HK_SWITCH_LAYER_TO_INNER10, \
HK_SWITCH_LAYER_TO_INNER11, \
HK_SWITCH_LAYER_TO_INNER12, \
HK_SWITCH_LAYER_TO_INNER13, \
HK_SWITCH_LAYER_TO_INNER14, \
HK_SWITCH_LAYER_TO_COMPONENT \
};
#endif // CLASS_LAYER_BOX_SELECTOR_H

View File

@ -17,9 +17,9 @@ class UNDO_REDO_CONTAINER;
class PCB_SCREEN : public BASE_SCREEN
{
public:
LAYER_NUM m_Active_Layer;
LAYER_NUM m_Route_Layer_TOP;
LAYER_NUM m_Route_Layer_BOTTOM;
LAYER_ID m_Active_Layer;
LAYER_ID m_Route_Layer_TOP;
LAYER_ID m_Route_Layer_BOTTOM;
public:

View File

@ -613,7 +613,7 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMask, bool aPrintMirrorMode, void* aData = NULL );
virtual void PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode, void* aData = NULL );
/**
* Function CoordinateToString

View File

@ -27,190 +27,336 @@
* @brief Board layer functions and definitions.
*/
#ifndef _LAYERS_ID_AND_VISIBILITY_H_
#define _LAYERS_ID_AND_VISIBILITY_H_
#ifndef LAYERS_ID_AND_VISIBILITY_H_
#define LAYERS_ID_AND_VISIBILITY_H_
#include <stdint.h>
#include <vector>
#include <bitset>
#include <wx/string.h>
#include <macros.h>
class BOARD;
/* NOTE: the idea here is to have LAYER_NUM and LAYER_MSK as abstract
* type as possible (even if they're currently implemented as int and
* unsigned int, respectively). In this way it would be reasonably easy
* to overcome the current 32 layer limit. For example switching to a 64
* bit mask or even some kind of bit array */
/* Layer identification (layer number) */
/**
* Type LAYER_NUM
* can be replaced with int and removed. Until then, it is something you can increment,
* and its meaning is only advisory but can extend beyond PCB layers into view layers
* and gerber layers.
*/
typedef int LAYER_NUM;
#define UNDEFINED_LAYER -1
#define FIRST_LAYER 0
#define FIRST_COPPER_LAYER 0
#define LAYER_N_BACK 0
#define LAYER_N_2 1
#define LAYER_N_3 2
#define LAYER_N_4 3
#define LAYER_N_5 4
#define LAYER_N_6 5
#define LAYER_N_7 6
#define LAYER_N_8 7
#define LAYER_N_9 8
#define LAYER_N_10 9
#define LAYER_N_11 10
#define LAYER_N_12 11
#define LAYER_N_13 12
#define LAYER_N_14 13
#define LAYER_N_15 14
#define LAYER_N_FRONT 15
#define LAST_COPPER_LAYER LAYER_N_FRONT
#define NB_COPPER_LAYERS (LAST_COPPER_LAYER - FIRST_COPPER_LAYER + 1)
#define FIRST_NON_COPPER_LAYER 16
#define FIRST_TECHNICAL_LAYER 16
#define FIRST_USER_LAYER 24
#define ADHESIVE_N_BACK 16
#define ADHESIVE_N_FRONT 17
#define SOLDERPASTE_N_BACK 18
#define SOLDERPASTE_N_FRONT 19
#define SILKSCREEN_N_BACK 20
#define SILKSCREEN_N_FRONT 21
#define SOLDERMASK_N_BACK 22
#define SOLDERMASK_N_FRONT 23
#define DRAW_N 24
#define COMMENT_N 25
#define ECO1_N 26
#define ECO2_N 27
#define EDGE_N 28
#define LAST_NON_COPPER_LAYER 28
#define LAST_TECHNICAL_LAYER 23
#define LAST_USER_LAYER 27
#define NB_PCB_LAYERS (LAST_NON_COPPER_LAYER + 1)
#define UNUSED_LAYER_29 29
#define UNUSED_LAYER_30 30
#define UNUSED_LAYER_31 31
#define NB_GERBER_LAYERS 32
#define NB_LAYERS 32
#define UNSELECTED_LAYER 32
// Masks to identify a layer by a bit map
typedef unsigned LAYER_MSK;
#define LAYER_BACK (1 << LAYER_N_BACK) ///< bit mask for copper layer
#define LAYER_2 (1 << LAYER_N_2) ///< bit mask for layer 2
#define LAYER_3 (1 << LAYER_N_3) ///< bit mask for layer 3
#define LAYER_4 (1 << LAYER_N_4) ///< bit mask for layer 4
#define LAYER_5 (1 << LAYER_N_5) ///< bit mask for layer 5
#define LAYER_6 (1 << LAYER_N_6) ///< bit mask for layer 6
#define LAYER_7 (1 << LAYER_N_7) ///< bit mask for layer 7
#define LAYER_8 (1 << LAYER_N_8) ///< bit mask for layer 8
#define LAYER_9 (1 << LAYER_N_9) ///< bit mask for layer 9
#define LAYER_10 (1 << LAYER_N_10) ///< bit mask for layer 10
#define LAYER_11 (1 << LAYER_N_11) ///< bit mask for layer 11
#define LAYER_12 (1 << LAYER_N_12) ///< bit mask for layer 12
#define LAYER_13 (1 << LAYER_N_13) ///< bit mask for layer 13
#define LAYER_14 (1 << LAYER_N_14) ///< bit mask for layer 14
#define LAYER_15 (1 << LAYER_N_15) ///< bit mask for layer 15
#define LAYER_FRONT (1 << LAYER_N_FRONT) ///< bit mask for component layer
#define ADHESIVE_LAYER_BACK (1 << ADHESIVE_N_BACK)
#define ADHESIVE_LAYER_FRONT (1 << ADHESIVE_N_FRONT)
#define SOLDERPASTE_LAYER_BACK (1 << SOLDERPASTE_N_BACK)
#define SOLDERPASTE_LAYER_FRONT (1 << SOLDERPASTE_N_FRONT)
#define SILKSCREEN_LAYER_BACK (1 << SILKSCREEN_N_BACK)
#define SILKSCREEN_LAYER_FRONT (1 << SILKSCREEN_N_FRONT)
#define SOLDERMASK_LAYER_BACK (1 << SOLDERMASK_N_BACK)
#define SOLDERMASK_LAYER_FRONT (1 << SOLDERMASK_N_FRONT)
#define DRAW_LAYER (1 << DRAW_N)
#define COMMENT_LAYER (1 << COMMENT_N)
#define ECO1_LAYER (1 << ECO1_N)
#define ECO2_LAYER (1 << ECO2_N)
#define EDGE_LAYER (1 << EDGE_N)
// extra bits 0xE0000000
// Helpful global layer masks:
// ALL_AUX_LAYERS layers are technical layers, ALL_NO_CU_LAYERS has user
// and edge layers too!
#define ALL_LAYERS 0x1FFFFFFF // Pcbnew used 29 layers
#define FULL_LAYERS 0xFFFFFFFF // Gerbview used 32 layers
#define ALL_NO_CU_LAYERS 0x1FFF0000
#define ALL_CU_LAYERS 0x0000FFFF
#define INTERNAL_CU_LAYERS 0x00007FFE
#define EXTERNAL_CU_LAYERS 0x00008001
#define FRONT_TECH_LAYERS (SILKSCREEN_LAYER_FRONT | SOLDERMASK_LAYER_FRONT \
| ADHESIVE_LAYER_FRONT | SOLDERPASTE_LAYER_FRONT)
#define BACK_TECH_LAYERS (SILKSCREEN_LAYER_BACK | SOLDERMASK_LAYER_BACK \
| ADHESIVE_LAYER_BACK | SOLDERPASTE_LAYER_BACK)
#define ALL_TECH_LAYERS (FRONT_TECH_LAYERS | BACK_TECH_LAYERS)
#define BACK_LAYERS (LAYER_BACK | BACK_TECH_LAYERS)
#define FRONT_LAYERS (LAYER_FRONT | FRONT_TECH_LAYERS)
#define ALL_USER_LAYERS (DRAW_LAYER | COMMENT_LAYER |\
ECO1_LAYER | ECO2_LAYER )
#define NO_LAYERS 0x00000000
/**
* @return a one bit layer mask from a layer number
* @param aLayerNumber = the layer number to convert (0 .. LAYERS-1)
* Enum LAYER_ID
* is the set of PCB layers. It has nothing to do with gerbers or view layers.
* One of these cannot be "incremented".
*/
inline LAYER_MSK GetLayerMask( LAYER_NUM aLayerNumber )
enum LAYER_ID
#if __cplusplus >= 201103L
: unsigned char
#endif
{
F_Cu, // 0
In1_Cu,
In2_Cu,
In3_Cu,
In4_Cu,
In5_Cu,
In6_Cu,
In7_Cu,
In8_Cu,
In9_Cu,
In10_Cu,
In11_Cu,
In12_Cu,
In13_Cu,
In14_Cu,
In15_Cu,
In16_Cu,
In17_Cu,
In18_Cu,
In19_Cu,
In20_Cu,
In21_Cu,
In22_Cu,
In23_Cu,
In24_Cu,
In25_Cu,
In26_Cu,
In27_Cu,
In28_Cu,
In29_Cu,
In30_Cu,
B_Cu, // 31
B_Adhes, // 32
F_Adhes,
B_Paste,
F_Paste,
B_SilkS,
F_SilkS,
B_Mask,
F_Mask,
Dwgs_User,
Cmts_User,
Eco1_User,
Eco2_User,
Edge_Cuts,
Margin,
F_CrtYd, // CrtYd & Body are footprint only
B_CrtYd,
F_Fab,
B_Fab,
LAYER_ID_COUNT
};
#define UNDEFINED_LAYER LAYER_ID(-1)
#define UNSELECTED_LAYER LAYER_ID(-2)
#define MAX_CU_LAYERS (B_Cu - F_Cu + 1)
/* These were moved to legacy_plugin.cpp, please don't ever use them
outside there. Now with the advent of class LSEQ, we don't iterate over
LAYER_ID any more, so therefore FIRST_COPPER_LAYER and LAST_COPPER_LAYER are
dead concepts. They in fact failed to do what they were intended to do because
they implied a particular sequence which in and of itself was subject to change
and actually did when we flipped the pretty and *.kicad_pcb copper layer stack.
LSEQ is the way to go, use it. It gives a level of manipulation between
LAYER_ID and iteration.
#define FIRST_COPPER_LAYER brain dead
#define LAST_COPPER_LAYER brain dead
#define FIRST_LAYER brain dead
#define NB_LAYERS use LAYER_ID_COUNT instead
#define NB_COPPER_LAYERS was always a max, not a number, use MAX_CU_COUNT now.
*/
/// A sequence of layers, a sequence provides a certain order.
typedef std::vector<LAYER_ID> BASE_SEQ;
/**
* Class LSEQ
* is a sequence (and therefore also a set) of LAYER_IDs. A sequence provides
* a certain order.
* <p>
* It can also be used as an iterator:
* <code>
*
* for( LSEQ cu_stack = aSet.CuStack(); cu_stack; ++cu_stack )
* layer_id = *cu_stack;
*
* </code>
*/
class LSEQ : public BASE_SEQ
{
unsigned m_index;
public:
LSEQ() :
m_index( 0 )
{}
template <class InputIterator>
LSEQ( InputIterator start, InputIterator end ) :
BASE_SEQ( start, end ),
m_index( 0 )
{}
void Rewind() { m_index = 0; }
void operator ++ () { ++m_index; } // returns nothing, used in simple statements only.
void operator ++ (int) { ++m_index; }
operator bool () { return m_index < size(); }
LAYER_ID operator * () const
{
return at( m_index ); // throws std::out_of_range
}
};
typedef std::bitset<LAYER_ID_COUNT> BASE_SET;
/**
* Class LSET
* is a set of LAYER_IDs. It can be converted to numerous purpose LSEQs using
* the various member functions, most of which are based on Seq(). The advantage
* of converting to LSEQ using purposeful code, is it removes any dependency
* on order/sequence inherent in this set.
*/
class LSET : public BASE_SET
{
public:
LSET() :
BASE_SET()
{}
LSET( const BASE_SET& aOther ) :
BASE_SET( aOther )
{
return 1 << aLayerNumber;
}
/**
* @return bool if aLayerNumber is a layer contained in aMask
* @param aMask = a layer mask
* @param aLayerNumber is the layer id to test
* Constructor LSET( LAYER_ID )
* takes a LAYER_ID and sets that bit.
*/
inline bool IsLayerInList( LAYER_MSK aMask, LAYER_NUM aLayerNumber )
LSET( int aLayer )
{
return (aMask & GetLayerMask( aLayerNumber )) != 0;
set( aLayer );
}
/**
* Constructor LSET( const LAYER_ID* aArray, unsigned aCount )
* works well with an arry or LSEQ.
*/
LSET( const LAYER_ID* aArray, unsigned aCount );
/**
* Constructor LSET( int, ...)
* takes a variable number of LAYER_IDs in the argument list to construct
* the set.
* @param aIdCount is the number of LAYER_IDs which follow.
*/
LSET( size_t aIdCount, ... );
/**
* Function Name
* returns the fixed name association with aLayerId.
*/
static const wxChar* Name( LAYER_ID aLayerId );
/**
* Function InternalCuMask()
* returns a complete set of internal copper layers, which is all Cu layers
* except F_Cu and B_Cu.
*/
static LSET InternalCuMask();
/**
* Function AllCuMask
* returns a mask holding the requested number of Cu LAYER_IDs.
*/
static LSET AllCuMask( int aCuLayerCount = MAX_CU_LAYERS );
/**
* Function AllNonCuMask
* returns a mask holding all layer minus CU layers.
*/
static LSET AllNonCuMask();
static LSET AllLayersMask();
static LSET FrontTechMask();
static LSET BackTechMask();
static LSET AllTechMask();
static LSET FrontMask();
static LSET BackMask();
static LSET UserMask();
/**
* Function CuStack
* returns a sequence of copper layers in starting from the front/top
* and extending to the back/bottom. This specific sequence is depended upon
* in numerous places.
*/
LSEQ CuStack() const;
/**
* Function Technicals
* returns a sequence of technical layers. A sequence provides a certain
* order.
* @param aSubToOmit is the subset of the techical layers to omit, defaults to none.
*/
LSEQ Technicals( LSET aSubToOmit = LSET() ) const;
/// *_User layers.
LSEQ Users() const;
LSEQ UIOrder() const;
/**
* Function Seq
* returns an LSEQ from the union of this LSET and a desired sequence. The LSEQ
* element will be in the same sequence as aWishListSequence if they are present.
* @param aWishListSequence establishes the order of the returned LSEQ, and the LSEQ will only
* contiain LAYER_IDs which are present in this set.
* @param aCount is the length of aWishListSequence array.
*/
LSEQ Seq( const LAYER_ID* aWishListSequence, unsigned aCount ) const;
/**
* Function Seq
* returns a LSEQ from this LSET in ascending LAYER_ID order. Each LSEQ
* element will be in the same sequence as in LAYER_ID and only present
* in the resultant LSEQ if present in this set. Therefore the sequence is
* subject to change, use it only when enumeration and not order is important.
*/
LSEQ Seq() const;
/**
* Function SVG
* returns the sequence used to output an SVG plot.
LSEQ SVG() const;
put this in the needed source file using Seq() there.
*/
/**
* Function FmtHex
* returns a hex string showing contents of this LSEQ.
*/
std::string FmtHex() const;
/**
* Function ParseHex
* understands the output of FmtHex() and replaces this set's values
* with those given in the input string. Parsing stops at the first
* non hex ASCII byte, except that marker bytes output from FmtHex are
* not terminators.
* @return int - number of bytes consumed
*/
int ParseHex( const char* aStart, int aCount );
/**
* Function FmtBin
* returns a binary string showing contents of this LSEQ.
*/
std::string FmtBin() const;
/**
* Find the first set LAYER_ID. Returns UNDEFINED_LAYER if more
* than one is set or UNSELECTED_LAYER if none is set.
*/
LAYER_ID ExtractLayer();
private:
};
/**
* @return bool if 2 layer masks have a comman layer
* @param aMask1 = a layer mask
* @param aMask2 = an other layer mask
*/
inline bool IsLayerMasksIntersect( LAYER_MSK aMask1, LAYER_MSK aMask2 )
inline bool IsLayerMasksIntersect( LSET aMask1, LSET aMask2 )
{
return (aMask1 & aMask2) != 0;
return (aMask1 & aMask2).any();
}
/**
* Count the number of set layers in the mask
*/
inline int LayerMaskCountSet( LAYER_MSK aMask )
{
int count = 0;
for( LAYER_NUM i = FIRST_LAYER; i < NB_LAYERS; ++i )
{
if( aMask & GetLayerMask( i ) )
++count;
}
return count;
}
// layers order in dialogs (plot, print and toolbars)
// in same order than in setup layers dialog
// (Front or Top to Back or Bottom)
#define DECLARE_LAYERS_ORDER_LIST(list) const LAYER_NUM list[NB_LAYERS] =\
{ LAYER_N_FRONT,\
LAYER_N_15, LAYER_N_14, LAYER_N_13, LAYER_N_12,\
LAYER_N_11, LAYER_N_10, LAYER_N_9, LAYER_N_8,\
LAYER_N_7, LAYER_N_6, LAYER_N_5, LAYER_N_4,\
LAYER_N_3, LAYER_N_2,\
LAYER_N_BACK,\
ADHESIVE_N_FRONT , ADHESIVE_N_BACK,\
SOLDERPASTE_N_FRONT, SOLDERPASTE_N_BACK,\
SILKSCREEN_N_FRONT, SILKSCREEN_N_BACK,\
SOLDERMASK_N_FRONT, SOLDERMASK_N_BACK,\
DRAW_N,\
COMMENT_N,\
ECO1_N, ECO2_N,\
EDGE_N,\
UNUSED_LAYER_29, UNUSED_LAYER_30, UNUSED_LAYER_31\
};
/**
* Enum PCB_VISIBLE
@ -253,12 +399,15 @@ enum PCB_VISIBLE
END_PCB_VISIBLE_LIST // sentinel
};
/**
* Enum NETNAMES_VISIBLE
* is a set of layers specific for displaying net names.
* Their visiblity is not supposed to be saved in a board file,
* they are only to be used by the GAL.
*/
#if 0
// was:
enum NETNAMES_VISIBLE
{
LAYER_1_NETNAMES_VISIBLE, // bottom layer
@ -284,26 +433,37 @@ enum NETNAMES_VISIBLE
END_NETNAMES_VISIBLE_LIST // sentinel
};
#else
enum NETNAMES_VISIBLE
{
PAD_FR_NETNAMES_VISIBLE = B_Cu+1,
PAD_BK_NETNAMES_VISIBLE,
PADS_NETNAMES_VISIBLE,
END_NETNAMES_VISIBLE_LIST // sentinel
};
#endif
/// macro for obtaining layer number for specific item (eg. pad or text)
#define ITEM_GAL_LAYER(layer) (NB_LAYERS + layer)
#define ITEM_GAL_LAYER(layer) (LAYER_ID_COUNT + layer)
#define NETNAMES_GAL_LAYER(layer) (NB_LAYERS + END_PCB_VISIBLE_LIST + layer )
#define NETNAMES_GAL_LAYER(layer) (LAYER_ID_COUNT + END_PCB_VISIBLE_LIST + layer )
/// number of *all* layers including PCB and item layers
#define TOTAL_LAYER_COUNT (NB_LAYERS + END_PCB_VISIBLE_LIST + END_NETNAMES_VISIBLE_LIST)
/// number of *all* GAL layers including PCB and item layers
#define TOTAL_LAYER_COUNT (LAYER_ID_COUNT + END_PCB_VISIBLE_LIST + END_NETNAMES_VISIBLE_LIST)
/**
* Function IsValidLayer
* tests whether a given integer is a valid layer index, i.e. can
* be safely put in a LAYER_NUM
* @param aLayerIndex = Layer index to test. It can be an int, so its
* be safely put in a LAYER_ID
* @param aLayerId = Layer index to test. It can be an int, so its
* useful during I/O
* @return true if aLayerIndex is a valid layer index
*/
inline bool IsValidLayer( int aLayerIndex )
inline bool IsValidLayer( LAYER_NUM aLayerId )
{
return aLayerIndex >= FIRST_LAYER && aLayerIndex < NB_LAYERS;
return unsigned( aLayerId ) < LAYER_ID_COUNT;
}
/**
@ -314,41 +474,40 @@ inline bool IsValidLayer( int aLayerIndex )
*/
inline bool IsPcbLayer( LAYER_NUM aLayer )
{
return aLayer >= FIRST_LAYER && aLayer < NB_PCB_LAYERS;
return aLayer >= F_Cu && aLayer < LAYER_ID_COUNT;
}
/**
* Function IsCopperLayer
* tests whether a layer is a copper layer
* @param aLayer = Layer to test
* @param aLayerId = Layer to test
* @return true if aLayer is a valid copper layer
*/
inline bool IsCopperLayer( LAYER_NUM aLayer )
inline bool IsCopperLayer( LAYER_NUM aLayerId )
{
return aLayer >= FIRST_COPPER_LAYER
&& aLayer <= LAST_COPPER_LAYER;
return aLayerId >= F_Cu && aLayerId <= B_Cu;
}
/**
* Function IsNonCopperLayer
* tests whether a layer is a non copper layer
* @param aLayer = Layer to test
* @param aLayerId = Layer to test
* @return true if aLayer is a non copper layer
*/
inline bool IsNonCopperLayer( LAYER_NUM aLayer )
inline bool IsNonCopperLayer( LAYER_NUM aLayerId )
{
return aLayer >= FIRST_NON_COPPER_LAYER && aLayer <= LAST_NON_COPPER_LAYER;
return aLayerId > B_Cu && aLayerId <= LAYER_ID_COUNT;
}
/**
* Function IsUserLayer
* tests whether a layer is a non copper and a non tech layer
* @param aLayer = Layer to test
* @param aLayerId = Layer to test
* @return true if aLayer is a user layer
*/
inline bool IsUserLayer( LAYER_NUM aLayer )
inline bool IsUserLayer( LAYER_ID aLayerId )
{
return aLayer >= FIRST_USER_LAYER && aLayer <= LAST_USER_LAYER;
return aLayerId >= Dwgs_User && aLayerId <= Eco2_User;
}
/* IMPORTANT: If a layer is not a front layer not necessarily is true
@ -364,58 +523,74 @@ inline bool IsUserLayer( LAYER_NUM aLayer )
/**
* Layer classification: check if it's a front layer
*/
inline bool IsFrontLayer( LAYER_NUM aLayer )
inline bool IsFrontLayer( LAYER_ID aLayerId )
{
return ( aLayer == LAYER_N_FRONT ||
aLayer == ADHESIVE_N_FRONT ||
aLayer == SOLDERPASTE_N_FRONT ||
aLayer == SILKSCREEN_N_FRONT ||
aLayer == SOLDERPASTE_N_FRONT );
switch( aLayerId )
{
case F_Cu:
case F_Adhes:
case F_Paste:
case F_SilkS:
case F_Mask:
case F_CrtYd:
case F_Fab:
return true;
default:
;
}
return false;
}
/**
* Layer classification: check if it's a back layer
*/
inline bool IsBackLayer( LAYER_NUM aLayer )
inline bool IsBackLayer( LAYER_ID aLayerId )
{
return ( aLayer == LAYER_N_BACK ||
aLayer == ADHESIVE_N_BACK ||
aLayer == SOLDERPASTE_N_BACK ||
aLayer == SILKSCREEN_N_BACK ||
aLayer == SOLDERPASTE_N_BACK );
switch( aLayerId )
{
case B_Cu:
case B_Adhes:
case B_Paste:
case B_SilkS:
case B_Mask:
case B_CrtYd:
case B_Fab:
return true;
default:
;
}
return false;
}
/**
* Function FlippedLayerNumber
* @return the layer number after flipping an item
* some (not all) layers: external copper, Mask, Paste, and solder
* are swapped between front and back sides
*/
LAYER_NUM FlipLayer( LAYER_NUM oldlayer );
LAYER_ID FlipLayer( LAYER_ID oldlayer );
/**
* Calculate the mask layer when flipping a footprint
* BACK and FRONT copper layers, mask, paste, solder layers are swapped
*/
LAYER_MSK FlipLayerMask( LAYER_MSK aMask );
/**
* Extract the set layer from a mask. Returns UNDEFINED_LAYER if more
* than one is set or UNSELECTED_LAYER if none is
*/
LAYER_NUM ExtractLayer( LAYER_MSK aMask );
LSET FlipLayerMask( LSET aMask );
/**
* Return a string (to be shown to the user) describing a layer mask.
* Useful for showing where is a pad, track, entity, etc.
* The BOARD is needed because layer names are (somewhat) customizable
*/
wxString LayerMaskDescribe( const BOARD *aBoard, LAYER_MSK aMask );
wxString LayerMaskDescribe( const BOARD* aBoard, LSET aMask );
/**
* Returns a netname layer corresponding to the given layer.
*/
inline LAYER_NUM GetNetnameLayer( LAYER_NUM aLayer )
inline int GetNetnameLayer( int aLayer )
{
if( IsCopperLayer( aLayer ) )
return NETNAMES_GAL_LAYER( aLayer );
@ -427,7 +602,7 @@ inline LAYER_NUM GetNetnameLayer( LAYER_NUM aLayer )
return NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE );
// Fallback
return COMMENT_N;
return Cmts_User;
}
/**
@ -438,8 +613,8 @@ inline LAYER_NUM GetNetnameLayer( LAYER_NUM aLayer )
*/
inline bool IsNetnameLayer( LAYER_NUM aLayer )
{
return aLayer >= NETNAMES_GAL_LAYER( LAYER_1_NETNAMES_VISIBLE ) &&
return aLayer >= NETNAMES_GAL_LAYER( F_Cu ) &&
aLayer < NETNAMES_GAL_LAYER( END_NETNAMES_VISIBLE_LIST );
}
#endif // _LAYERS_ID_AND_VISIBILITY_H_
#endif // LAYERS_ID_AND_VISIBILITY_H_

View File

@ -18,9 +18,6 @@ class TRACK;
class BOARD;
class DISPLAY_OPTIONS;
/// Look up Table for conversion copper layer count -> general copper layer mask:
extern LAYER_MSK g_TabAllCopperLayerMask[NB_COPPER_LAYERS];
extern DISPLAY_OPTIONS DisplayOpt;
extern int g_CurrentVersionPCB;

View File

@ -606,8 +606,8 @@ public:
* @param aDlgPosition = position of dialog ( defualt = centered)
* @return the selected layer id
*/
LAYER_NUM SelectLayer( LAYER_NUM aDefaultLayer,
LAYER_MSK aNotAllowedLayersMask = 0,
LAYER_ID SelectLayer( LAYER_ID aDefaultLayer,
LSET aNotAllowedLayersMask = 0,
wxPoint aDlgPosition = wxDefaultPosition );
/* Display a list of two copper layers to choose a pair of copper layers
@ -615,7 +615,7 @@ public:
*/
void SelectCopperLayerPair();
virtual void SwitchLayer( wxDC* DC, LAYER_NUM layer );
virtual void SwitchLayer( wxDC* DC, LAYER_ID layer );
void LoadSettings( wxConfigBase* aCfg ); // override virtual
void SaveSettings( wxConfigBase* aCfg ); // override virtual

View File

@ -1257,7 +1257,7 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMask,
virtual void PrintPage( wxDC* aDC, LSET aPrintMask,
bool aPrintMirrorMode, void* aData = NULL );
void SetSimulatorCommand( const wxString& aCommand ) { m_simulatorCommand = aCommand; }

View File

@ -283,7 +283,7 @@ public:
* @param aPrintMirrorMode = true to plot mirrored
* @param aData = a pointer on an auxiliary data (NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMaskLayer, bool aPrintMirrorMode,
virtual void PrintPage( wxDC* aDC, LSET aPrintMaskLayer, bool aPrintMirrorMode,
void* aData = NULL );
void GetKicadAbout( wxCommandEvent& event );
@ -535,26 +535,26 @@ public:
* Function SetHighContrastLayer
* takes care of display settings for the given layer to be displayed in high contrast mode.
*/
void SetHighContrastLayer( LAYER_NUM aLayer );
void SetHighContrastLayer( LAYER_ID aLayer );
/**
* Function SetTopLayer
* moves the selected layer to the top, so it is displayed above all others.
*/
void SetTopLayer( LAYER_NUM aLayer );
void SetTopLayer( LAYER_ID aLayer );
/**
* Function SetActiveLayer
* will change the currently active layer to \a aLayer and also
* update the PCB_LAYER_WIDGET.
*/
void SetActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate = true );
void SetActiveLayer( LAYER_ID aLayer, bool doLayerWidgetUpdate = true );
/**
* Function GetActiveLayer
* returns the active layer
*/
LAYER_NUM GetActiveLayer() const
LAYER_ID GetActiveLayer() const
{
return ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer;
}
@ -784,8 +784,6 @@ public:
void InstallDisplayOptionsDialog( wxCommandEvent& aEvent );
void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
void InstallDialogLayerSetup();
/**
* Function GenFootprintsPositionFile
* Calls DoGenFootprintsPositionFile to create a footprint position file
@ -1263,7 +1261,7 @@ public:
bool MergeCollinearTracks( TRACK* track, wxDC* DC, int end );
void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC );
void SwitchLayer( wxDC* DC, LAYER_NUM layer );
void SwitchLayer( wxDC* DC, LAYER_ID layer );
/**
* Function Add45DegreeSegment
@ -1463,7 +1461,7 @@ public:
DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, STROKE_T shape, wxDC* DC );
void End_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Delete_Drawings_All_Layer( LAYER_NUM aLayer );
void Delete_Drawings_All_Layer( LAYER_ID aLayer );
// Dimension handling:
void ShowDimensionPropertyDialog( DIMENSION* aDimension, wxDC* aDC );

View File

@ -496,7 +496,7 @@ void PL_EDITOR_FRAME::UpdateStatusBar()
// Display units
}
void PL_EDITOR_FRAME::PrintPage( wxDC* aDC, LAYER_MSK aPrintMasklayer,
void PL_EDITOR_FRAME::PrintPage( wxDC* aDC, LSET aPrintMasklayer,
bool aPrintMirrorMode, void * aData )
{
GetScreen()-> m_ScreenNumber = GetPageNumberOption() ? 1 : 2;

View File

@ -263,7 +263,7 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMasklayer,
virtual void PrintPage( wxDC* aDC, LSET aPrintMasklayer,
bool aPrintMirrorMode, void * aData );
void OnFileHistory( wxCommandEvent& event );

View File

@ -122,7 +122,7 @@ static void drawPlacementRoutingMatrix( BOARD* aBrd, wxDC* DC );
static int TstModuleOnBoard( BOARD* Pcb, MODULE* Module, bool TstOtherSide );
static void CreateKeepOutRectangle( int ux0, int uy0, int ux1, int uy1,
int marge, int aKeepOut, int aLayerMask );
int marge, int aKeepOut, LSET aLayerMask );
static MODULE* PickModule( PCB_EDIT_FRAME* pcbframe, wxDC* DC );
static int propagate();
@ -133,7 +133,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
wxPoint PosOK;
wxPoint memopos;
int error;
LAYER_NUM lay_tmp_TOP, lay_tmp_BOTTOM;
LAYER_ID lay_tmp_TOP, lay_tmp_BOTTOM;
// Undo: init list
PICKED_ITEMS_LIST newList;
@ -488,12 +488,12 @@ int genPlacementRoutingMatrix( BOARD* aBrd, EDA_MSG_PANEL* messagePanel )
msg.Printf( wxT( "%d" ), RoutingMatrix.m_MemSize / 1024 );
messagePanel->SetMessage( 24, wxT( "Mem(Kb)" ), msg, CYAN );
g_Route_Layer_BOTTOM = LAYER_N_FRONT;
g_Route_Layer_BOTTOM = F_Cu;
if( RoutingMatrix.m_RoutingLayersCount > 1 )
g_Route_Layer_BOTTOM = LAYER_N_BACK;
g_Route_Layer_BOTTOM = B_Cu;
g_Route_Layer_TOP = LAYER_N_FRONT;
g_Route_Layer_TOP = F_Cu;
// Place the edge layer segments
TRACK TmpSegm( NULL );
@ -513,7 +513,7 @@ int genPlacementRoutingMatrix( BOARD* aBrd, EDA_MSG_PANEL* messagePanel )
case PCB_LINE_T:
DrawSegm = (DRAWSEGMENT*) PtStruct;
if( DrawSegm->GetLayer() != EDGE_N )
if( DrawSegm->GetLayer() != Edge_Cuts )
break;
TraceSegmentPcb( DrawSegm, HOLE | CELL_is_EDGE,
@ -550,7 +550,7 @@ int genPlacementRoutingMatrix( BOARD* aBrd, EDA_MSG_PANEL* messagePanel )
void genModuleOnRoutingMatrix( MODULE* Module )
{
int ox, oy, fx, fy;
int layerMask;
LSET layerMask;
D_PAD* Pad;
EDA_RECT fpBBox = Module->GetBoundingBox();
@ -585,13 +585,11 @@ void genModuleOnRoutingMatrix( MODULE* Module )
if( fy > RoutingMatrix.m_BrdBox.GetBottom() )
fy = RoutingMatrix.m_BrdBox.GetBottom();
layerMask = 0;
if( Module->GetLayer() == F_Cu )
layerMask.set( F_Cu );
if( Module->GetLayer() == LAYER_N_FRONT )
layerMask = LAYER_FRONT;
if( Module->GetLayer() == LAYER_N_BACK )
layerMask = LAYER_BACK;
if( Module->GetLayer() == B_Cu )
layerMask.set( B_Cu );
TraceFilledRectangle( ox, oy, fx, fy, layerMask,
CELL_is_MODULE, WRITE_OR_CELL );
@ -666,15 +664,11 @@ int getOptimalModulePlacement( PCB_EDIT_FRAME* aFrame, MODULE* aModule, wxDC* aD
if( RoutingMatrix.m_RoutingLayersCount > 1 )
{
D_PAD* Pad;
int otherLayerMask = LAYER_BACK;
LSET other( aModule->GetLayer() == B_Cu ? F_Cu : B_Cu );
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;
TstOtherSide = true;
@ -875,7 +869,7 @@ int TstModuleOnBoard( BOARD* Pcb, MODULE* aModule, bool TstOtherSide )
int side = TOP;
int otherside = BOTTOM;
if( aModule->GetLayer() == LAYER_N_BACK )
if( aModule->GetLayer() == B_Cu )
{
side = BOTTOM; otherside = TOP;
}
@ -966,7 +960,7 @@ double compute_Ratsnest_PlaceModule( BOARD* aBrd )
* Therefore the cost is high in rect x0,y0 to x1,y1, and decrease outside this rectangle
*/
void CreateKeepOutRectangle( int ux0, int uy0, int ux1, int uy1,
int marge, int aKeepOut, int aLayerMask )
int marge, int aKeepOut, LSET aLayerMask )
{
int row, col;
int row_min, row_max, col_min, col_max, pmarge;
@ -974,10 +968,10 @@ void CreateKeepOutRectangle( int ux0, int uy0, int ux1, int uy1,
DIST_CELL data, LocalKeepOut;
int lgain, cgain;
if( aLayerMask & GetLayerMask( g_Route_Layer_BOTTOM ) )
if( aLayerMask[g_Route_Layer_BOTTOM] )
trace = 1; // Trace on bottom layer.
if( ( aLayerMask & GetLayerMask( g_Route_Layer_TOP ) ) && RoutingMatrix.m_RoutingLayersCount )
if( aLayerMask[g_Route_Layer_TOP] && RoutingMatrix.m_RoutingLayersCount )
trace |= 2; // Trace on top layer.
if( trace == 0 )

View File

@ -66,7 +66,7 @@ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode )
}
else
{
g_Route_Layer_TOP = g_Route_Layer_BOTTOM = LAYER_N_BACK;
g_Route_Layer_TOP = g_Route_Layer_BOTTOM = B_Cu;
}
switch( mode )

View File

@ -206,12 +206,12 @@ void TraceSegmentPcb( DRAWSEGMENT* pt_segm, int type, int marge, int op_logic );
* op_logic = WRITE_CELL, WRITE_OR_CELL, WRITE_XOR_CELL, WRITE_AND_CELL
*/
void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1,
int side, int color, int op_logic);
LSET side, int color, int op_logic);
/* Same as above, but the rectangle is inclined angle angle. */
void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1,
double angle, LAYER_MSK masque_layer,
double angle, LSET masque_layer,
int color, int op_logic );
/* QUEUE.CPP */

View File

@ -59,7 +59,7 @@ static void DrawSegmentQcq( int ux0, int uy0,
int op_logic );
static void TraceFilledCircle( int cx, int cy, int radius,
LAYER_MSK aLayerMask,
LSET aLayerMask,
int color,
int op_logic );
@ -96,7 +96,7 @@ void PlacePad( D_PAD* aPad, int color, int marge, int op_logic )
if( aPad->GetShape() == PAD_CIRCLE )
{
TraceFilledCircle( shape_pos.x, shape_pos.y, dx,
aPad->GetLayerMask(), color, op_logic );
aPad->GetLayerSet(), color, op_logic );
return;
}
@ -120,14 +120,14 @@ void PlacePad( D_PAD* aPad, int color, int marge, int op_logic )
TraceFilledRectangle( shape_pos.x - dx, shape_pos.y - dy,
shape_pos.x + dx, shape_pos.y + dy,
aPad->GetLayerMask(), color, op_logic );
aPad->GetLayerSet(), color, op_logic );
}
else
{
TraceFilledRectangle( shape_pos.x - dx, shape_pos.y - dy,
shape_pos.x + dx, shape_pos.y + dy,
aPad->GetOrientation(),
aPad->GetLayerMask(), color, op_logic );
aPad->GetLayerSet(), color, op_logic );
}
}
@ -141,9 +141,7 @@ void PlacePad( D_PAD* aPad, int color, int marge, int op_logic )
* op_logic: type of writing in the cell (WRITE, OR)
*/
void TraceFilledCircle( int cx, int cy, int radius,
LAYER_MSK aLayerMask,
int color,
int op_logic )
LSET aLayerMask, int color, int op_logic )
{
int row, col;
int ux0, uy0, ux1, uy1;
@ -153,10 +151,10 @@ void TraceFilledCircle( int cx, int cy, int radius,
int tstwrite = 0;
int distmin;
if( aLayerMask & GetLayerMask( g_Route_Layer_BOTTOM ) )
if( aLayerMask[g_Route_Layer_BOTTOM] )
trace = 1; // Trace on BOTTOM
if( aLayerMask & GetLayerMask( g_Route_Layer_TOP ) )
if( aLayerMask[g_Route_Layer_TOP] )
if( RoutingMatrix.m_RoutingLayersCount > 1 )
trace |= 2; // Trace on TOP
@ -297,23 +295,23 @@ void TraceSegmentPcb( TRACK* aTrack, int color, int marge, int op_logic )
// Test if VIA (filled circle need to be drawn)
if( aTrack->Type() == PCB_VIA_T )
{
LAYER_MSK layer_mask = NO_LAYERS;
LSET layer_mask;
if( aTrack->IsOnLayer( g_Route_Layer_BOTTOM ) )
layer_mask = GetLayerMask( g_Route_Layer_BOTTOM );
layer_mask.set( g_Route_Layer_BOTTOM );
if( aTrack->IsOnLayer( g_Route_Layer_TOP ) )
{
if( layer_mask == 0 )
layer_mask = GetLayerMask( g_Route_Layer_TOP );
if( !layer_mask.any() )
layer_mask = LSET( g_Route_Layer_TOP );
else
layer_mask = FULL_LAYERS;
layer_mask.set();
}
if( color == VIA_IMPOSSIBLE )
layer_mask = FULL_LAYERS;
layer_mask.set();
if( layer_mask )
if( layer_mask.any() )
TraceFilledCircle( aTrack->GetStart().x, aTrack->GetStart().y,
half_width, layer_mask, color, op_logic );
}
@ -326,7 +324,7 @@ void TraceSegmentPcb( TRACK* aTrack, int color, int marge, int op_logic )
int uy1 = aTrack->GetEnd().y - RoutingMatrix.GetBrdCoordOrigin().y;
// Ordinary track
LAYER_NUM layer = aTrack->GetLayer();
LAYER_ID layer = aTrack->GetLayer();
if( color == VIA_IMPOSSIBLE )
layer = UNDEFINED_LAYER;
@ -478,17 +476,16 @@ void TracePcbLine( int x0, int y0, int x1, int y1, LAYER_NUM layer, int color, i
void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1,
int aLayerMask, int color, int op_logic )
LSET aLayerMask, int color, int op_logic )
{
int row, col;
int row_min, row_max, col_min, col_max;
int trace = 0;
if( ( aLayerMask & GetLayerMask( g_Route_Layer_BOTTOM ) ) )
if( aLayerMask[g_Route_Layer_BOTTOM] )
trace = 1; // Trace on BOTTOM
if( ( aLayerMask & GetLayerMask( g_Route_Layer_TOP ) ) &&
RoutingMatrix.m_RoutingLayersCount > 1 )
if( aLayerMask[g_Route_Layer_TOP] && RoutingMatrix.m_RoutingLayersCount > 1 )
trace |= 2; // Trace on TOP
if( trace == 0 )
@ -541,7 +538,7 @@ void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1,
void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1,
double angle, LAYER_MSK aLayerMask, int color, int op_logic )
double angle, LSET aLayerMask, int color, int op_logic )
{
int row, col;
int cx, cy; // Center of rectangle
@ -550,10 +547,10 @@ void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1,
int rotrow, rotcol;
int trace = 0;
if( aLayerMask & GetLayerMask( g_Route_Layer_BOTTOM ) )
if( aLayerMask[g_Route_Layer_BOTTOM] )
trace = 1; // Trace on BOTTOM
if( aLayerMask & GetLayerMask( g_Route_Layer_TOP ) )
if( aLayerMask[g_Route_Layer_TOP] )
{
if( RoutingMatrix.m_RoutingLayersCount > 1 )
trace |= 2; // Trace on TOP

View File

@ -115,7 +115,7 @@ int MATRIX_ROUTING_HEAD::InitRoutingMatrix()
m_DistSide[side] = NULL;
m_DirSide[side] = NULL;
/* allocate matrix & initialize everything to empty */
// allocate matrix & initialize everything to empty
m_BoardSide[side] = (MATRIX_CELL*) operator new( ii * sizeof(MATRIX_CELL) );
memset( m_BoardSide[side], 0, ii * sizeof(MATRIX_CELL) );
@ -198,7 +198,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
{
int ux0 = 0, uy0 = 0, ux1, uy1, dx, dy;
int marge, via_marge;
LAYER_MSK layerMask;
LSET layerMask;
// use the default NETCLASS?
NETCLASSPTR nc = aPcb->GetDesignSettings().GetDefault();
@ -237,7 +237,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
EDGE_MODULE* edge = (EDGE_MODULE*) item;
EDGE_MODULE tmpEdge( *edge );
if( tmpEdge.GetLayer() == EDGE_N )
if( tmpEdge.GetLayer() == Edge_Cuts )
tmpEdge.SetLayer( UNDEFINED_LAYER );
TraceSegmentPcb( &tmpEdge, HOLE, marge, WRITE_CELL );
@ -264,7 +264,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
DrawSegm = (DRAWSEGMENT*) item;
DRAWSEGMENT tmpSegm( DrawSegm );
if( DrawSegm->GetLayer() == EDGE_N )
if( DrawSegm->GetLayer() == Edge_Cuts )
{
tmpSegm.SetLayer( UNDEFINED_LAYER );
type_cell |= CELL_is_EDGE;
@ -276,8 +276,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
case PCB_TEXT_T:
{
TEXTE_PCB* PtText;
PtText = (TEXTE_PCB*) item;
TEXTE_PCB* PtText = (TEXTE_PCB*) item;
if( PtText->GetText().Length() == 0 )
break;
@ -288,7 +287,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
dx = textbox.GetWidth();
dy = textbox.GetHeight();
/* Put bounding box (rectangle) on matrix */
// Put bounding box (rectangle) on matrix
dx /= 2;
dy /= 2;
@ -298,7 +297,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
ux0 -= dx;
uy0 -= dy;
layerMask = GetLayerMask( PtText->GetLayer() );
layerMask = LSET( PtText->GetLayer() );
TraceFilledRectangle( ux0 - marge, uy0 - marge, ux1 + marge,
uy1 + marge, PtText->GetOrientation(),
@ -316,7 +315,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
}
}
/* Put tracks and vias on matrix */
// Put tracks and vias on matrix
for( TRACK* track = aPcb->m_Track; track; track = track->Next() )
{
if( net_code == track->GetNetCode() )
@ -337,7 +336,7 @@ int Build_Work( BOARD* Pcb )
int demi_pas = RoutingMatrix.m_GridRouting / 2;
wxString msg;
InitWork(); /* clear work list */
InitWork(); // clear work list
int cellCount = 0;
for( unsigned ii = 0; ii < Pcb->GetRatsnestsCount(); ii++ )
@ -509,8 +508,8 @@ void MATRIX_ROUTING_HEAD::AddCell( int aRow, int aCol, int aSide, MATRIX_CELL x
}
/* fetch distance cell */
DIST_CELL MATRIX_ROUTING_HEAD::GetDist( int aRow, int aCol, int aSide ) /* fetch distance cell */
// fetch distance cell
DIST_CELL MATRIX_ROUTING_HEAD::GetDist( int aRow, int aCol, int aSide ) // fetch distance cell
{
DIST_CELL* p;
@ -519,7 +518,7 @@ DIST_CELL MATRIX_ROUTING_HEAD::GetDist( int aRow, int aCol, int aSide ) /* fetch
}
/* store distance cell */
// store distance cell
void MATRIX_ROUTING_HEAD::SetDist( int aRow, int aCol, int aSide, DIST_CELL x )
{
DIST_CELL* p;
@ -529,7 +528,7 @@ void MATRIX_ROUTING_HEAD::SetDist( int aRow, int aCol, int aSide, DIST_CELL x )
}
/* fetch direction cell */
// fetch direction cell
int MATRIX_ROUTING_HEAD::GetDir( int aRow, int aCol, int aSide )
{
DIR_CELL* p;
@ -539,7 +538,7 @@ int MATRIX_ROUTING_HEAD::GetDir( int aRow, int aCol, int aSide )
}
/* store direction cell */
// store direction cell
void MATRIX_ROUTING_HEAD::SetDir( int aRow, int aCol, int aSide, int x )
{
DIR_CELL* p;

View File

@ -86,10 +86,10 @@ static int s_Clearance; // Clearance value used in autorouter
static PICKED_ITEMS_LIST s_ItemsListPicker;
int OpenNodes; /* total number of nodes opened */
int ClosNodes; /* total number of nodes closed */
int MoveNodes; /* total number of nodes moved */
int MaxNodes; /* maximum number of nodes opened at one time */
int OpenNodes; // total number of nodes opened
int ClosNodes; // total number of nodes closed
int MoveNodes; // total number of nodes moved
int MaxNodes; // maximum number of nodes opened at one time
#define NOSUCCESS 0
#define STOP_FROM_ESC -1
@ -115,25 +115,25 @@ int MaxNodes; /* maximum number of nodes opened at one time */
*/
static const int delta[8][2] =
{
{ 1, -1 }, /* northwest */
{ 1, 0 }, /* north */
{ 1, 1 }, /* northeast */
{ 0, -1 }, /* west */
{ 0, 1 }, /* east */
{ -1, -1 }, /* southwest */
{ -1, 0 }, /* south */
{ -1, 1 } /* southeast */
{ 1, -1 }, // northwest
{ 1, 0 }, // north
{ 1, 1 }, // northeast
{ 0, -1 }, // west
{ 0, 1 }, // east
{ -1, -1 }, // southwest
{ -1, 0 }, // south
{ -1, 1 } // southeast
};
static const int ndir[8] =
{
/* for building paths back to source */
// for building paths back to source
FROM_SOUTHEAST, FROM_SOUTH, FROM_SOUTHWEST,
FROM_EAST, FROM_WEST,
FROM_NORTHEAST, FROM_NORTH, FROM_NORTHWEST
};
/* blocking masks for neighboring cells */
// blocking masks for neighboring cells
#define BLOCK_NORTHEAST ( DIAG_NEtoSW | BENT_StoNE | BENT_WtoNE \
| ANGLE_NEtoSE | ANGLE_NWtoNE \
| SHARP_NtoNE | SHARP_EtoNE | HOLE )
@ -187,7 +187,7 @@ struct block
long b2;
};
/* blocking masks for diagonal traces */
// blocking masks for diagonal traces
static struct block blocking[8] =
{ {
0, -1,
@ -230,7 +230,7 @@ static struct block blocking[8] =
BLOCK_SOUTHWEST
} };
/* mask for hole-related blocking effects */
// mask for hole-related blocking effects
static struct
{
long trace;
@ -249,7 +249,7 @@ static struct
static long newmask[8] =
{
/* patterns to mask out in neighbor cells */
// patterns to mask out in neighbor cells
0,
CORNER_NORTHWEST | CORNER_NORTHEAST,
0,
@ -285,7 +285,7 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int aLayersCount )
// Prepare the undo command info
s_ItemsListPicker.ClearListAndDeleteItems(); // Should not be necessary, but...
/* go until no more work to do */
// go until no more work to do
GetWork( &row_source, &col_source, &current_net_code,
&row_target, &col_target, &pt_cur_ch ); // First net to route.
@ -294,7 +294,7 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int aLayersCount )
&col_target,
&pt_cur_ch ) )
{
/* Test to stop routing ( escape key pressed ) */
// Test to stop routing ( escape key pressed )
wxYield();
if( m_canvas->GetAbortRequest() )
@ -329,7 +329,7 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int aLayersCount )
segm_fX = GetBoard()->GetBoundingBox().GetX() + (RoutingMatrix.m_GridRouting * col_target);
segm_fY = GetBoard()->GetBoundingBox().GetY() + (RoutingMatrix.m_GridRouting * row_target);
/* Draw segment. */
// Draw segment.
GRLine( m_canvas->GetClipBox(), DC,
segm_oX, segm_oY, segm_fX, segm_fY,
0, WHITE );
@ -367,7 +367,7 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int aLayersCount )
msg.Printf( wxT( " %d" ), GetBoard()->GetUnconnectedNetCount() );
AppendMsgPanel( wxT( "Not Connected" ), msg, CYAN );
/* Delete routing from display. */
// Delete routing from display.
pt_cur_ch->m_PadStart->Draw( m_canvas, DC, GR_AND );
pt_cur_ch->m_PadEnd->Draw( m_canvas, DC, GR_AND );
@ -413,16 +413,23 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
int newdist, olddir, _self;
int current_net_code;
int marge;
int padLayerMaskStart; /* Mask layers belonging to the starting pad. */
int padLayerMaskEnd; /* Mask layers belonging to the ending pad. */
int topLayerMask = GetLayerMask( g_Route_Layer_TOP );
int bottomLayerMask = GetLayerMask( g_Route_Layer_BOTTOM );
int routeLayerMask; /* Mask two layers for routing. */
int tab_mask[2]; /* Enables the calculation of the mask layer being
* tested. (side = TOP or BOTTOM) */
LSET padLayerMaskStart; // Mask layers belonging to the starting pad.
LSET padLayerMaskEnd; // Mask layers belonging to the ending pad.
LSET topLayerMask( g_Route_Layer_TOP );
LSET bottomLayerMask( g_Route_Layer_BOTTOM );
LSET routeLayerMask; // Mask two layers for routing.
LSET tab_mask[2]; // Enables the calculation of the mask layer being
// tested. (side = TOP or BOTTOM)
int start_mask_layer = 0;
wxString msg;
// @todo this could be a bottle neck
LSET all_cu = LSET::AllCuMask( pcbframe->GetBoard()->GetCopperLayerCount() );
wxBusyCursor dummy_cursor; // Set an hourglass cursor while routing a
// track
@ -430,7 +437,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
marge = s_Clearance + ( pcbframe->GetDesignSettings().GetCurrentTrackWidth() / 2 );
/* clear direction flags */
// clear direction flags
i = RoutingMatrix.m_Nrows * RoutingMatrix.m_Ncols * sizeof(DIR_CELL);
if( two_sides )
@ -439,20 +446,20 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
lastopen = lastclos = lastmove = 0;
/* Set tab_masque[side] for final test of routing. */
// Set tab_masque[side] for final test of routing.
if( two_sides )
tab_mask[TOP] = topLayerMask;
tab_mask[BOTTOM] = bottomLayerMask;
/* Set active layers mask. */
// Set active layers mask.
routeLayerMask = topLayerMask | bottomLayerMask;
pt_cur_ch = pt_rat;
current_net_code = pt_rat->GetNet();
padLayerMaskStart = pt_cur_ch->m_PadStart->GetLayerMask();
padLayerMaskStart = pt_cur_ch->m_PadStart->GetLayerSet();
padLayerMaskEnd = pt_cur_ch->m_PadEnd->GetLayerMask();
padLayerMaskEnd = pt_cur_ch->m_PadEnd->GetLayerSet();
/* First Test if routing possible ie if the pads are accessible
@ -499,23 +506,22 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
goto end_of_route;
}
/* Test the trivial case: direct connection overlay pads. */
if( ( row_source == row_target ) && ( col_source == col_target )
&& ( padLayerMaskEnd & padLayerMaskStart &
g_TabAllCopperLayerMask[pcbframe->GetBoard()->GetCopperLayerCount() - 1] ) )
// Test the trivial case: direct connection overlay pads.
if( row_source == row_target && col_source == col_target &&
( padLayerMaskEnd & padLayerMaskStart & all_cu ).any() )
{
result = TRIVIAL_SUCCESS;
goto end_of_route;
}
/* Placing the bit to remove obstacles on 2 pads to a link. */
// Placing the bit to remove obstacles on 2 pads to a link.
pcbframe->SetStatusText( wxT( "Gen Cells" ) );
PlacePad( pt_cur_ch->m_PadStart, CURRENT_PAD, marge, WRITE_OR_CELL );
PlacePad( pt_cur_ch->m_PadEnd, CURRENT_PAD, marge, WRITE_OR_CELL );
/* Regenerates the remaining barriers (which may encroach on the placement bits precedent)
*/
// Regenerates the remaining barriers (which may encroach on the
// placement bits precedent)
i = pcbframe->GetBoard()->GetPadCount();
for( unsigned ii = 0; ii < pcbframe->GetBoard()->GetPadCount(); ii++ )
@ -528,15 +534,15 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
}
}
InitQueue(); /* initialize the search queue */
InitQueue(); // initialize the search queue
apx_dist = RoutingMatrix.GetApxDist( row_source, col_source, row_target, col_target );
/* Initialize first search. */
if( two_sides ) /* Preferred orientation. */
// Initialize first search.
if( two_sides ) // Preferred orientation.
{
if( abs( row_target - row_source ) > abs( col_target - col_source ) )
{
if( padLayerMaskStart & topLayerMask )
if( ( padLayerMaskStart & topLayerMask ).any() )
{
start_mask_layer = 2;
@ -547,7 +553,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
}
}
if( padLayerMaskStart & bottomLayerMask )
if( ( padLayerMaskStart & bottomLayerMask ).any() )
{
start_mask_layer |= 1;
@ -560,7 +566,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
}
else
{
if( padLayerMaskStart & bottomLayerMask )
if( ( padLayerMaskStart & bottomLayerMask ).any() )
{
start_mask_layer = 1;
@ -571,7 +577,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
}
}
if( padLayerMaskStart & topLayerMask )
if( ( padLayerMaskStart & topLayerMask ).any() )
{
start_mask_layer |= 2;
@ -583,7 +589,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
}
}
}
else if( padLayerMaskStart & bottomLayerMask )
else if( ( padLayerMaskStart & bottomLayerMask ).any() )
{
start_mask_layer = 1;
@ -593,7 +599,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
}
}
/* search until success or we exhaust all possibilities */
// search until success or we exhaust all possibilities
GetQueue( &r, &c, &side, &d, &apx_dist );
for( ; r != ILLEGAL; GetQueue( &r, &c, &side, &d, &apx_dist ) )
@ -603,10 +609,10 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
if( curcell & CURRENT_PAD )
curcell &= ~HOLE;
if( (r == row_target) && (c == col_target) /* success if layer OK */
&& ( tab_mask[side] & padLayerMaskEnd) )
if( (r == row_target) && (c == col_target) // success if layer OK
&& (tab_mask[side] & padLayerMaskEnd).any() )
{
/* Remove link. */
// Remove link.
GRSetDrawMode( DC, GR_XOR );
GRLine( pcbframe->GetCanvas()->GetClipBox(),
DC,
@ -617,14 +623,14 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
0,
WHITE );
/* Generate trace. */
// Generate trace.
if( Retrace( pcbframe, DC, row_source, col_source,
row_target, col_target, side, current_net_code ) )
{
result = SUCCESS; /* Success : Route OK */
result = SUCCESS; // Success : Route OK
}
break; /* Routing complete. */
break; // Routing complete.
}
if( pcbframe->GetCanvas()->GetAbortRequest() )
@ -633,7 +639,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
break;
}
/* report every COUNT new nodes or so */
// report every COUNT new nodes or so
#define COUNT 20000
if( ( OpenNodes - lastopen > COUNT )
@ -654,7 +660,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
{
_self = 5;
/* set 'present' bits */
// set 'present' bits
for( i = 0; i < 8; i++ )
{
selfok2[i].present = 0;
@ -664,15 +670,15 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
}
}
for( i = 0; i < 8; i++ ) /* consider neighbors */
for( i = 0; i < 8; i++ ) // consider neighbors
{
nr = r + delta[i][0];
nc = c + delta[i][1];
/* off the edge? */
// off the edge?
if( nr < 0 || nr >= RoutingMatrix.m_Nrows ||
nc < 0 || nc >= RoutingMatrix.m_Ncols )
continue; /* off the edge */
continue; // off the edge
if( _self == 5 && selfok2[i].present )
continue;
@ -682,22 +688,22 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
if( newcell & CURRENT_PAD )
newcell &= ~HOLE;
/* check for non-target hole */
// check for non-target hole
if( newcell & HOLE )
{
if( nr != row_target || nc != col_target )
continue;
}
/* check for traces */
// check for traces
else if( newcell & HOLE & ~(newmask[i]) )
{
continue;
}
/* check blocking on corner neighbors */
// check blocking on corner neighbors
if( delta[i][0] && delta[i][1] )
{
/* check first buddy */
// check first buddy
buddy = RoutingMatrix.GetCell( r + blocking[i].r1, c + blocking[i].c1, side );
if( buddy & CURRENT_PAD )
@ -707,7 +713,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
continue;
// if (buddy & (blocking[i].b1)) continue;
/* check second buddy */
// check second buddy
buddy = RoutingMatrix.GetCell( r + blocking[i].r2, c + blocking[i].c2, side );
if( buddy & CURRENT_PAD )
@ -724,8 +730,8 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
( olddir == FROM_OTHERSIDE ) ?
RoutingMatrix.GetDir( r, c, 1 - side ) : 0, side );
/* if (a) not visited yet, or (b) we have */
/* found a better path, add it to queue */
// if (a) not visited yet, or (b) we have
// found a better path, add it to queue
if( !RoutingMatrix.GetDir( nr, nc, side ) )
{
RoutingMatrix.SetDir( nr, nc, side, ndir[i] );
@ -748,45 +754,45 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
}
}
/** Test the other layer. **/
//* Test the other layer. *
if( two_sides )
{
olddir = RoutingMatrix.GetDir( r, c, side );
if( olddir == FROM_OTHERSIDE )
continue; /* useless move, so don't bother */
continue; // useless move, so don't bother
if( curcell ) /* can't drill via if anything here */
if( curcell ) // can't drill via if anything here
continue;
/* check for holes or traces on other side */
// check for holes or traces on other side
if( ( newcell = RoutingMatrix.GetCell( r, c, 1 - side ) ) != 0 )
continue;
/* check for nearby holes or traces on both sides */
// check for nearby holes or traces on both sides
for( skip = 0, i = 0; i < 8; i++ )
{
nr = r + delta[i][0]; nc = c + delta[i][1];
if( nr < 0 || nr >= RoutingMatrix.m_Nrows ||
nc < 0 || nc >= RoutingMatrix.m_Ncols )
continue; /* off the edge !! */
continue; // off the edge !!
if( RoutingMatrix.GetCell( nr, nc, side ) /* & blocking2[i] */ )
{
skip = 1; /* can't drill via here */
skip = 1; // can't drill via here
break;
}
if( RoutingMatrix.GetCell( nr, nc, 1 - side ) /* & blocking2[i] */ )
{
skip = 1; /* can't drill via here */
skip = 1; // can't drill via here
break;
}
}
if( skip ) /* neighboring hole or trace? */
continue; /* yes, can't drill via here */
if( skip ) // neighboring hole or trace?
continue; // yes, can't drill via here
newdist = d + RoutingMatrix.CalcDist( FROM_OTHERSIDE, olddir, 0, side );
@ -814,7 +820,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
row_target,
col_target );
}
} /* Finished attempt to route on other layer. */
} // Finished attempt to route on other layer.
}
end_of_route:
@ -831,9 +837,9 @@ end_of_route:
static long bit[8][9] =
{
/* OT=Otherside */
/* N, NE, E, SE, S, SW, W, NW, OT */
/* N */
// OT=Otherside
// N, NE, E, SE, S, SW, W, NW, OT
// N
{ LINE_VERTICAL,
BENT_StoNE,
CORNER_SOUTHEAST,
@ -844,7 +850,7 @@ static long bit[8][9] =
BENT_StoNW,
( HOLE | HOLE_SOUTH )
},
/* NE */
// NE
{
BENT_NtoSW,
DIAG_NEtoSW,
@ -856,7 +862,7 @@ static long bit[8][9] =
ANGLE_SWtoNW,
( HOLE | HOLE_SOUTHWEST )
},
/* E */
// E
{
CORNER_NORTHWEST,
BENT_WtoNE,
@ -868,7 +874,7 @@ static long bit[8][9] =
SHARP_WtoNW,
( HOLE | HOLE_WEST )
},
/* SE */
// SE
{
SHARP_NtoNW,
ANGLE_NWtoNE,
@ -880,7 +886,7 @@ static long bit[8][9] =
0,
( HOLE | HOLE_NORTHWEST )
},
/* S */
// S
{
0,
SHARP_NtoNE,
@ -892,7 +898,7 @@ static long bit[8][9] =
SHARP_NtoNW,
( HOLE | HOLE_NORTH )
},
/* SW */
// SW
{
SHARP_NtoNE,
0,
@ -904,7 +910,7 @@ static long bit[8][9] =
ANGLE_NWtoNE,
( HOLE | HOLE_NORTHEAST )
},
/* W */
// W
{
CORNER_NORTHEAST,
SHARP_EtoNE,
@ -916,7 +922,7 @@ static long bit[8][9] =
BENT_EtoNW,
( HOLE | HOLE_EAST )
},
/* NW */
// NW
{
BENT_NtoSE,
ANGLE_NEtoSE,
@ -952,13 +958,13 @@ static int Retrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC,
int current_net_code )
{
int r0, c0, s0;
int r1, c1, s1; /* row, col, starting side. */
int r2, c2, s2; /* row, col, ending side. */
int r1, c1, s1; // row, col, starting side.
int r2, c2, s2; // row, col, ending side.
int x, y = -1;
long b;
r1 = row_target;
c1 = col_target; /* start point is target ( end point is source )*/
c1 = col_target; // start point is target ( end point is source )
s1 = target_side;
r0 = c0 = s0 = ILLEGAL;
@ -966,7 +972,7 @@ static int Retrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC,
do
{
/* find where we came from to get here */
// find where we came from to get here
r2 = r1; c2 = c1; s2 = s1;
x = RoutingMatrix.GetDir( r1, c1, s1 );
@ -1020,7 +1026,7 @@ static int Retrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC,
if( r0 != ILLEGAL )
y = RoutingMatrix.GetDir( r0, c0, s0 );
/* see if target or hole */
// see if target or hole
if( ( ( r1 == row_target ) && ( c1 == col_target ) ) || ( s1 != s0 ) )
{
int p_dir;
@ -1092,7 +1098,7 @@ static int Retrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC,
}
}
if( ( r2 == row_source ) && ( c2 == col_source ) ) /* see if source */
if( ( r2 == row_source ) && ( c2 == col_source ) ) // see if source
{
int p_dir;
@ -1139,7 +1145,7 @@ static int Retrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC,
OrCell_Trace( pcbframe->GetBoard(), r2, c2, s2, p_dir, current_net_code );
}
/* move to next cell */
// move to next cell
r0 = r1;
c0 = c1;
s0 = s1;
@ -1166,7 +1172,7 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
g_CurrentTrackList.PushBack( newVia );
g_CurrentTrackSegment->SetState( TRACK_AR, true );
g_CurrentTrackSegment->SetLayer( 0x0F );
g_CurrentTrackSegment->SetLayer( F_Cu );
g_CurrentTrackSegment->SetStart(wxPoint( pcb->GetBoundingBox().GetX() +
( RoutingMatrix.m_GridRouting * row ),
@ -1199,18 +1205,18 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
( RoutingMatrix.m_GridRouting * col )));
g_CurrentTrackSegment->SetNetCode( current_net_code );
if( g_CurrentTrackSegment->Back() == NULL ) /* Start trace. */
if( g_CurrentTrackSegment->Back() == NULL ) // Start trace.
{
g_CurrentTrackSegment->SetStart( wxPoint( segm_fX, segm_fY ) );
/* Placement on the center of the pad if outside grid. */
// Placement on the center of the pad if outside grid.
dx1 = g_CurrentTrackSegment->GetEnd().x - g_CurrentTrackSegment->GetStart().x;
dy1 = g_CurrentTrackSegment->GetEnd().y - g_CurrentTrackSegment->GetStart().y;
dx0 = pt_cur_ch->m_PadEnd->GetPosition().x - g_CurrentTrackSegment->GetStart().x;
dy0 = pt_cur_ch->m_PadEnd->GetPosition().y - g_CurrentTrackSegment->GetStart().y;
/* If aligned, change the origin point. */
// If aligned, change the origin point.
if( abs( dx0 * dy1 ) == abs( dx1 * dy0 ) )
{
g_CurrentTrackSegment->SetStart( pt_cur_ch->m_PadEnd->GetPosition() );
@ -1237,7 +1243,7 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
if( g_CurrentTrackSegment->GetStart() != g_CurrentTrackSegment->GetEnd() )
{
/* Reduce aligned segments by one. */
// Reduce aligned segments by one.
TRACK* oldTrack = g_CurrentTrackSegment->Back();
if( oldTrack && oldTrack->Type() != PCB_VIA_T )
@ -1281,11 +1287,11 @@ static void AddNewTrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
dx1 = g_CurrentTrackSegment->GetEnd().x - g_CurrentTrackSegment->GetStart().x;
dy1 = g_CurrentTrackSegment->GetEnd().y - g_CurrentTrackSegment->GetStart().y;
/* Place on center of pad if off grid. */
// Place on center of pad if off grid.
dx0 = pt_cur_ch->m_PadStart->GetPosition().x - g_CurrentTrackSegment->GetStart().x;
dy0 = pt_cur_ch->m_PadStart->GetPosition().y - g_CurrentTrackSegment->GetStart().y;
/* If aligned, change the origin point. */
// If aligned, change the origin point.
if( abs( dx0 * dy1 ) == abs( dx1 * dy0 ) )
{
g_CurrentTrackSegment->SetEnd( pt_cur_ch->m_PadStart->GetPosition() );
@ -1312,7 +1318,7 @@ static void AddNewTrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
if( g_CurrentTrackSegment->end )
g_CurrentTrackSegment->SetState( END_ONPAD, true );
/* Out the new track on the matrix board */
// Out the new track on the matrix board
for( TRACK* track = g_FirstTrackSegment; track; track = track->Next() )
{
TraceSegmentPcb( track, HOLE, marge, WRITE_CELL );

View File

@ -64,24 +64,26 @@
#include <tool/tool_dispatcher.h>
// Configuration entry names.
static const wxString UserGridSizeXEntry( wxT( "PcbUserGrid_X" ) );
static const wxString UserGridSizeYEntry( wxT( "PcbUserGrid_Y" ) );
static const wxString UserGridUnitsEntry( wxT( "PcbUserGrid_Unit" ) );
static const wxString DisplayPadFillEntry( wxT( "DiPadFi" ) );
static const wxString DisplayViaFillEntry( wxT( "DiViaFi" ) );
static const wxString DisplayPadNumberEntry( wxT( "DiPadNu" ) );
static const wxString DisplayModuleEdgeEntry( wxT( "DiModEd" ) );
static const wxString DisplayModuleTextEntry( wxT( "DiModTx" ) );
static const wxString FastGrid1Entry( wxT( "FastGrid1" ) );
static const wxString FastGrid2Entry( wxT( "FastGrid2" ) );
static const wxChar UserGridSizeXEntry[] = wxT( "PcbUserGrid_X" );
static const wxChar UserGridSizeYEntry[] = wxT( "PcbUserGrid_Y" );
static const wxChar UserGridUnitsEntry[] = wxT( "PcbUserGrid_Unit" );
static const wxChar DisplayPadFillEntry[] = wxT( "DiPadFi" );
static const wxChar DisplayViaFillEntry[] = wxT( "DiViaFi" );
static const wxChar DisplayPadNumberEntry[] = wxT( "DiPadNu" );
static const wxChar DisplayModuleEdgeEntry[] = wxT( "DiModEd" );
static const wxChar DisplayModuleTextEntry[] = wxT( "DiModTx" );
static const wxChar FastGrid1Entry[] = wxT( "FastGrid1" );
static const wxChar FastGrid2Entry[] = wxT( "FastGrid2" );
const LAYER_NUM PCB_BASE_FRAME::GAL_LAYER_ORDER[] =
{
ITEM_GAL_LAYER( GP_OVERLAY ),
ITEM_GAL_LAYER( DRC_VISIBLE ),
NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ),
DRAW_N, COMMENT_N, ECO1_N, ECO2_N, EDGE_N,
UNUSED_LAYER_29, UNUSED_LAYER_30, UNUSED_LAYER_31,
Dwgs_User, Cmts_User, Eco1_User, Eco2_User, Edge_Cuts,
// UNUSED_LAYER_29, UNUSED_LAYER_30, UNUSED_LAYER_31,
ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE ),
ITEM_GAL_LAYER( MOD_REFERENCES_VISIBLE), ITEM_GAL_LAYER( MOD_VALUES_VISIBLE ),
@ -89,9 +91,11 @@ const LAYER_NUM PCB_BASE_FRAME::GAL_LAYER_ORDER[] =
ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ),
ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ),
NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ), SOLDERMASK_N_FRONT,
NETNAMES_GAL_LAYER( LAYER_16_NETNAMES_VISIBLE ), LAYER_N_FRONT,
SILKSCREEN_N_FRONT, SOLDERPASTE_N_FRONT, ADHESIVE_N_FRONT,
NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ), F_Mask,
NETNAMES_GAL_LAYER( F_Cu ), F_Cu,
F_SilkS, F_Paste, F_Adhes,
#if 0 // was:
NETNAMES_GAL_LAYER( LAYER_15_NETNAMES_VISIBLE ), LAYER_N_15,
NETNAMES_GAL_LAYER( LAYER_14_NETNAMES_VISIBLE ), LAYER_N_14,
NETNAMES_GAL_LAYER( LAYER_13_NETNAMES_VISIBLE ), LAYER_N_13,
@ -106,14 +110,48 @@ const LAYER_NUM PCB_BASE_FRAME::GAL_LAYER_ORDER[] =
NETNAMES_GAL_LAYER( LAYER_4_NETNAMES_VISIBLE ), LAYER_N_4,
NETNAMES_GAL_LAYER( LAYER_3_NETNAMES_VISIBLE ), LAYER_N_3,
NETNAMES_GAL_LAYER( LAYER_2_NETNAMES_VISIBLE ), LAYER_N_2,
NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_BK_VISIBLE ), SOLDERMASK_N_BACK,
NETNAMES_GAL_LAYER( LAYER_1_NETNAMES_VISIBLE ), LAYER_N_BACK,
#else
ADHESIVE_N_BACK, SOLDERPASTE_N_BACK, SILKSCREEN_N_BACK,
NETNAMES_GAL_LAYER( In1_Cu ), In1_Cu,
NETNAMES_GAL_LAYER( In2_Cu ), In2_Cu,
NETNAMES_GAL_LAYER( In3_Cu ), In3_Cu,
NETNAMES_GAL_LAYER( In4_Cu ), In4_Cu,
NETNAMES_GAL_LAYER( In5_Cu ), In5_Cu,
NETNAMES_GAL_LAYER( In6_Cu ), In6_Cu,
NETNAMES_GAL_LAYER( In7_Cu ), In7_Cu,
NETNAMES_GAL_LAYER( In8_Cu ), In8_Cu,
NETNAMES_GAL_LAYER( In9_Cu ), In9_Cu,
NETNAMES_GAL_LAYER( In10_Cu ), In10_Cu,
NETNAMES_GAL_LAYER( In11_Cu ), In11_Cu,
NETNAMES_GAL_LAYER( In12_Cu ), In12_Cu,
NETNAMES_GAL_LAYER( In13_Cu ), In13_Cu,
NETNAMES_GAL_LAYER( In14_Cu ), In14_Cu,
NETNAMES_GAL_LAYER( In15_Cu ), In15_Cu,
NETNAMES_GAL_LAYER( In16_Cu ), In16_Cu,
NETNAMES_GAL_LAYER( In17_Cu ), In17_Cu,
NETNAMES_GAL_LAYER( In18_Cu ), In18_Cu,
NETNAMES_GAL_LAYER( In19_Cu ), In19_Cu,
NETNAMES_GAL_LAYER( In20_Cu ), In20_Cu,
NETNAMES_GAL_LAYER( In21_Cu ), In21_Cu,
NETNAMES_GAL_LAYER( In22_Cu ), In22_Cu,
NETNAMES_GAL_LAYER( In23_Cu ), In23_Cu,
NETNAMES_GAL_LAYER( In24_Cu ), In24_Cu,
NETNAMES_GAL_LAYER( In25_Cu ), In25_Cu,
NETNAMES_GAL_LAYER( In26_Cu ), In26_Cu,
NETNAMES_GAL_LAYER( In27_Cu ), In27_Cu,
NETNAMES_GAL_LAYER( In28_Cu ), In28_Cu,
NETNAMES_GAL_LAYER( In29_Cu ), In29_Cu,
NETNAMES_GAL_LAYER( In30_Cu ), In30_Cu,
#endif
NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_BK_VISIBLE ), B_Mask,
NETNAMES_GAL_LAYER( B_Cu ), B_Cu,
B_Adhes, B_Paste, B_SilkS,
ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE ),
ITEM_GAL_LAYER( WORKSHEET )
};
BEGIN_EVENT_TABLE( PCB_BASE_FRAME, EDA_DRAW_FRAME )
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START, ID_POPUP_PCB_ITEM_SELECTION_END,
PCB_BASE_FRAME::ProcessItemSelection )
@ -417,9 +455,9 @@ void PCB_BASE_FRAME::Show3D_Frame( wxCommandEvent& event )
// Note: virtual, overridden in PCB_EDIT_FRAME;
void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, LAYER_NUM layer )
void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, LAYER_ID layer )
{
LAYER_NUM preslayer = ((PCB_SCREEN*)GetScreen())->m_Active_Layer;
LAYER_ID preslayer = ((PCB_SCREEN*)GetScreen())->m_Active_Layer;
// Check if the specified layer matches the present layer
if( layer == preslayer )
@ -434,7 +472,7 @@ void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, LAYER_NUM layer )
// selection of any other copper layer is disregarded).
if( m_Pcb->GetCopperLayerCount() < 2 )
{
if( layer != LAYER_N_BACK )
if( layer != B_Cu )
{
return;
}
@ -446,7 +484,7 @@ void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, LAYER_NUM layer )
// layers are also capable of being selected.
else
{
if( ( layer != LAYER_N_BACK ) && ( layer != LAYER_N_FRONT )
if( ( layer != B_Cu ) && ( layer != F_Cu )
&& ( layer >= m_Pcb->GetCopperLayerCount() - 1 ) )
{
return;
@ -813,7 +851,7 @@ void PCB_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
KIGFX::VIEW* view = GetGalCanvas()->GetView();
// Set rendering order and properties of layers
for( LAYER_NUM i = 0; (unsigned) i < sizeof(GAL_LAYER_ORDER) / sizeof(LAYER_NUM); ++i )
for( LAYER_NUM i = 0; i < (int) DIM(GAL_LAYER_ORDER); ++i )
{
LAYER_NUM layer = GAL_LAYER_ORDER[i];
wxASSERT( layer < KIGFX::VIEW::VIEW_MAX_LAYERS );
@ -840,14 +878,14 @@ void PCB_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
view->SetRequired( NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) );
view->SetRequired( NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
view->SetRequired( ADHESIVE_N_FRONT, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
view->SetRequired( SOLDERPASTE_N_FRONT, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
view->SetRequired( SOLDERMASK_N_FRONT, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
view->SetRequired( F_Adhes, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
view->SetRequired( F_Paste, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
view->SetRequired( F_Mask, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
view->SetRequired( NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
view->SetRequired( ADHESIVE_N_BACK, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
view->SetRequired( SOLDERPASTE_N_BACK, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
view->SetRequired( SOLDERMASK_N_BACK, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
view->SetRequired( B_Adhes, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
view->SetRequired( B_Paste, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
view->SetRequired( B_Mask, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
view->SetRequired( ITEM_GAL_LAYER( PAD_FR_VISIBLE ), ITEM_GAL_LAYER( MOD_FR_VISIBLE ) );
view->SetRequired( ITEM_GAL_LAYER( PAD_BK_VISIBLE ), ITEM_GAL_LAYER( MOD_BK_VISIBLE ) );

View File

@ -381,7 +381,7 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
void PCB_EDIT_FRAME::Block_SelectItems()
{
LAYER_MSK layerMask;
LSET layerMask;
bool selectOnlyComplete = GetScreen()->m_BlockLocate.GetWidth() > 0 ;
GetScreen()->m_BlockLocate.Normalize();
@ -392,9 +392,9 @@ void PCB_EDIT_FRAME::Block_SelectItems()
// Add modules
if( blockIncludeModules )
{
for( MODULE* module = m_Pcb->m_Modules; module != NULL; module = module->Next() )
for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
{
LAYER_NUM layer = module->GetLayer();
LAYER_ID layer = module->GetLayer();
if( module->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete )
&& ( !module->IsLocked() || blockIncludeLockedModules ) )
@ -426,13 +426,13 @@ void PCB_EDIT_FRAME::Block_SelectItems()
}
// Add graphic items
layerMask = EDGE_LAYER;
layerMask = LSET( Edge_Cuts );
if( blockIncludeItemsOnTechLayers )
layerMask = ALL_LAYERS;
layerMask.set();
if( !blockIncludeBoardOutlineLayer )
layerMask &= ~EDGE_LAYER;
layerMask.set( Edge_Cuts, false );
for( BOARD_ITEM* PtStruct = m_Pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
{
@ -444,7 +444,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
switch( PtStruct->Type() )
{
case PCB_LINE_T:
if( (GetLayerMask( PtStruct->GetLayer() ) & layerMask) == 0 )
if( !layerMask[PtStruct->GetLayer()] )
break;
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) )
@ -464,7 +464,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
break;
case PCB_TARGET_T:
if( ( GetLayerMask( PtStruct->GetLayer() ) & layerMask ) == 0 )
if( !layerMask[PtStruct->GetLayer()] )
break;
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) )
@ -474,7 +474,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
break;
case PCB_DIMENSION_T:
if( ( GetLayerMask( PtStruct->GetLayer() ) & layerMask ) == 0 )
if( !layerMask[PtStruct->GetLayer()] )
break;
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) )

View File

@ -39,19 +39,8 @@ static void addTextSegmToPoly( int x0, int y0, int xf, int yf )
s_textCircle2SegmentCount, s_textWidth );
}
/**
* Function ConvertBrdLayerToPolygonalContours
* Build a set of polygons which are the outlines of copper items
* (pads, tracks, texts, zones)
* the holes in vias or pads are ignored
* Usefull to export the shape of copper layers to dxf polygons
* or 3D viewer
* the polygons are not merged.
* @param aLayer = A layer, like LAYER_N_BACK, etc.
* @param aOutlines The CPOLYGONS_LIST to fill in with main outlines.
* @return true if success, false if a contour is not valid
*/
void BOARD::ConvertBrdLayerToPolygonalContours( LAYER_NUM aLayer, CPOLYGONS_LIST& aOutlines )
void BOARD::ConvertBrdLayerToPolygonalContours( LAYER_ID aLayer, CPOLYGONS_LIST& aOutlines )
{
// Number of segments to convert a circle to a polygon
const int segcountforcircle = 18;
@ -82,7 +71,7 @@ void BOARD::ConvertBrdLayerToPolygonalContours( LAYER_NUM aLayer, CPOLYGONS_LIST
for( int ii = 0; ii < GetAreaCount(); ii++ )
{
ZONE_CONTAINER* zone = GetArea( ii );
LAYER_NUM zonelayer = zone->GetLayer();
LAYER_ID zonelayer = zone->GetLayer();
if( zonelayer == aLayer )
zone->TransformSolidAreasShapesToPolygonSet(
@ -113,18 +102,8 @@ void BOARD::ConvertBrdLayerToPolygonalContours( LAYER_NUM aLayer, CPOLYGONS_LIST
}
}
/* generate pads shapes on layer aLayer as polygons,
* and adds these polygons to aCornerBuffer
* aCornerBuffer = the buffer to store polygons
* aInflateValue = an additionnal size to add to pad shapes
* aCircleToSegmentsCount = number of segments to approximate a circle
* aCorrectionFactor = the correction to apply to a circle radius
* to generate the polygon.
* if aCorrectionFactor = 1.0, the polygon is inside the circle
* the radius of circle approximated by segments is
* initial radius * aCorrectionFactor
*/
void MODULE::TransformPadsShapesWithClearanceToPolygon( LAYER_NUM aLayer,
void MODULE::TransformPadsShapesWithClearanceToPolygon( LAYER_ID aLayer,
CPOLYGONS_LIST& aCornerBuffer,
int aInflateValue,
int aCircleToSegmentsCount,
@ -141,13 +120,13 @@ void MODULE::TransformPadsShapesWithClearanceToPolygon( LAYER_NUM aLayer,
switch( aLayer )
{
case SOLDERMASK_N_FRONT:
case SOLDERMASK_N_BACK:
case F_Mask:
case B_Mask:
margin.x = margin.y = pad->GetSolderMaskMargin() + aInflateValue;
break;
case SOLDERPASTE_N_FRONT:
case SOLDERPASTE_N_BACK:
case F_Paste:
case B_Paste:
margin = pad->GetSolderPasteMargin();
margin.x += aInflateValue;
margin.y += aInflateValue;
@ -175,7 +154,7 @@ void MODULE::TransformPadsShapesWithClearanceToPolygon( LAYER_NUM aLayer,
* initial radius * aCorrectionFactor
*/
void MODULE::TransformGraphicShapesWithClearanceToPolygonSet(
LAYER_NUM aLayer,
LAYER_ID aLayer,
CPOLYGONS_LIST& aCornerBuffer,
int aInflateValue,
int aCircleToSegmentsCount,

View File

@ -81,14 +81,14 @@ BOARD::BOARD() :
BuildListOfNets(); // prepare pad and netlist containers.
for( LAYER_NUM layer = FIRST_LAYER; layer < NB_LAYERS; ++layer )
for( LAYER_NUM layer = 0; layer < LAYER_ID_COUNT; ++layer )
{
m_Layer[layer].m_Name = GetStandardLayerName( layer );
m_Layer[layer].m_name = GetStandardLayerName( LAYER_ID( layer ) );
if( layer <= LAST_COPPER_LAYER )
m_Layer[layer].m_Type = LT_SIGNAL;
if( IsCopperLayer( layer ) )
m_Layer[layer].m_type = LT_SIGNAL;
else
m_Layer[layer].m_Type = LT_UNDEFINED;
m_Layer[layer].m_type = LT_UNDEFINED;
}
NETCLASSPTR defaultClass = m_designSettings.GetDefault();
@ -188,14 +188,14 @@ void BOARD::Move( const wxPoint& aMoveVector ) // overload
}
void BOARD::chainMarkedSegments( wxPoint aPosition, LAYER_MSK aLayerMask, TRACK_PTRS* aList )
void BOARD::chainMarkedSegments( wxPoint aPosition, LSET aLayerMask, TRACK_PTRS* aList )
{
TRACK* segment; // The current segment being analyzed.
TRACK* via; // The via identified, eventually destroy
TRACK* candidate; // The end segment to destroy (or NULL = segment)
int NbSegm;
if( m_Track == NULL )
if( !m_Track )
return;
/* Set the BUSY flag of all connected segments, first search starting at
@ -227,7 +227,7 @@ void BOARD::chainMarkedSegments( wxPoint aPosition, LAYER_MSK aLayerMask, TRACK_
if( via )
{
aLayerMask = via->GetLayerMask();
aLayerMask = via->GetLayerSet();
aList->push_back( via );
}
@ -273,7 +273,7 @@ void BOARD::chainMarkedSegments( wxPoint aPosition, LAYER_MSK aLayerMask, TRACK_
* candidate:
* we must analyze connections to its other end
*/
aLayerMask = candidate->GetLayerMask();
aLayerMask = candidate->GetLayerSet();
if( aPosition == candidate->GetStart() )
{
@ -311,9 +311,9 @@ void BOARD::PopHighLight()
}
bool BOARD::SetLayer( LAYER_NUM aIndex, const LAYER& aLayer )
bool BOARD::SetLayer( LAYER_ID aIndex, const LAYER& aLayer )
{
if( aIndex < NB_COPPER_LAYERS )
if( unsigned( aIndex ) < DIM( m_Layer ) )
{
m_Layer[ aIndex ] = aLayer;
return true;
@ -323,7 +323,7 @@ bool BOARD::SetLayer( LAYER_NUM aIndex, const LAYER& aLayer )
}
wxString BOARD::GetLayerName( LAYER_NUM aLayer ) const
wxString BOARD::GetLayerName( LAYER_ID aLayer ) const
{
if( !IsPcbLayer( aLayer ) )
return wxEmptyString;
@ -336,60 +336,14 @@ wxString BOARD::GetLayerName( LAYER_NUM aLayer ) const
// For copper layers, return the actual copper layer name,
// otherwise return the Standard English layer name.
if( IsCopperLayer( aLayer ) )
return m_Layer[aLayer].m_Name;
return m_Layer[aLayer].m_name;
}
return GetStandardLayerName( aLayer );
}
wxString BOARD::GetStandardLayerName( LAYER_NUM aLayerNumber )
{
const wxChar* txt;
// These are only default layer names. For Pcbnew the copper names
// may be over-ridden in the BOARD (*.brd) file.
// Use a switch to explicitly show the mapping more clearly
switch( aLayerNumber )
{
case LAYER_N_FRONT: txt = wxT( "F.Cu" ); break;
case LAYER_N_2: txt = wxT( "Inner1.Cu" ); break;
case LAYER_N_3: txt = wxT( "Inner2.Cu" ); break;
case LAYER_N_4: txt = wxT( "Inner3.Cu" ); break;
case LAYER_N_5: txt = wxT( "Inner4.Cu" ); break;
case LAYER_N_6: txt = wxT( "Inner5.Cu" ); break;
case LAYER_N_7: txt = wxT( "Inner6.Cu" ); break;
case LAYER_N_8: txt = wxT( "Inner7.Cu" ); break;
case LAYER_N_9: txt = wxT( "Inner8.Cu" ); break;
case LAYER_N_10: txt = wxT( "Inner9.Cu" ); break;
case LAYER_N_11: txt = wxT( "Inner10.Cu" ); break;
case LAYER_N_12: txt = wxT( "Inner11.Cu" ); break;
case LAYER_N_13: txt = wxT( "Inner12.Cu" ); break;
case LAYER_N_14: txt = wxT( "Inner13.Cu" ); break;
case LAYER_N_15: txt = wxT( "Inner14.Cu" ); break;
case LAYER_N_BACK: txt = wxT( "B.Cu" ); break;
case ADHESIVE_N_BACK: txt = wxT( "B.Adhes" ); break;
case ADHESIVE_N_FRONT: txt = wxT( "F.Adhes" ); break;
case SOLDERPASTE_N_BACK: txt = wxT( "B.Paste" ); break;
case SOLDERPASTE_N_FRONT: txt = wxT( "F.Paste" ); break;
case SILKSCREEN_N_BACK: txt = wxT( "B.SilkS" ); break;
case SILKSCREEN_N_FRONT: txt = wxT( "F.SilkS" ); break;
case SOLDERMASK_N_BACK: txt = wxT( "B.Mask" ); break;
case SOLDERMASK_N_FRONT: txt = wxT( "F.Mask" ); break;
case DRAW_N: txt = wxT( "Dwgs.User" ); break;
case COMMENT_N: txt = wxT( "Cmts.User" ); break;
case ECO1_N: txt = wxT( "Eco1.User" ); break;
case ECO2_N: txt = wxT( "Eco2.User" ); break;
case EDGE_N: txt = wxT( "Edge.Cuts" ); break;
default: txt = wxT( "BAD_INDEX" ); break;
}
return txt; // wxString constructed once here
}
bool BOARD::SetLayerName( LAYER_NUM aLayer, const wxString& aLayerName )
bool BOARD::SetLayerName( LAYER_ID aLayer, const wxString& aLayerName )
{
if( !IsCopperLayer( aLayer ) )
return false;
@ -401,20 +355,31 @@ bool BOARD::SetLayerName( LAYER_NUM aLayer, const wxString& aLayerName )
if( aLayerName.Find( wxChar( '"' ) ) != wxNOT_FOUND )
return false;
wxString NameTemp = aLayerName;
wxString nameTemp = aLayerName;
// replace any spaces with underscores before we do any comparing
NameTemp.Replace( wxT( " " ), wxT( "_" ) );
nameTemp.Replace( wxT( " " ), wxT( "_" ) );
if( IsLayerEnabled( aLayer ) )
{
#if 0
for( LAYER_NUM i = FIRST_COPPER_LAYER; i < NB_COPPER_LAYERS; ++i )
{
if( i != aLayer && IsLayerEnabled( i ) && NameTemp == m_Layer[i].m_Name )
if( i != aLayer && IsLayerEnabled( i ) && nameTemp == m_Layer[i].m_Name )
return false;
}
#else
for( LSEQ cu = GetEnabledLayers().CuStack(); cu; ++cu )
{
LAYER_ID id = *cu;
m_Layer[aLayer].m_Name = NameTemp;
// veto changing the name if it exists elsewhere.
if( id != aLayer && nameTemp == m_Layer[id].m_name )
return false;
}
#endif
m_Layer[aLayer].m_name = nameTemp;
return true;
}
@ -423,7 +388,7 @@ bool BOARD::SetLayerName( LAYER_NUM aLayer, const wxString& aLayerName )
}
LAYER_T BOARD::GetLayerType( LAYER_NUM aLayer ) const
LAYER_T BOARD::GetLayerType( LAYER_ID aLayer ) const
{
if( !IsCopperLayer( aLayer ) )
return LT_SIGNAL;
@ -431,13 +396,13 @@ LAYER_T BOARD::GetLayerType( LAYER_NUM aLayer ) const
//@@IMB: The original test was broken due to the discontinuity
// in the layer sequence.
if( IsLayerEnabled( aLayer ) )
return m_Layer[aLayer].m_Type;
return m_Layer[aLayer].m_type;
return LT_SIGNAL;
}
bool BOARD::SetLayerType( LAYER_NUM aLayer, LAYER_T aLayerType )
bool BOARD::SetLayerType( LAYER_ID aLayer, LAYER_T aLayerType )
{
if( !IsCopperLayer( aLayer ) )
return false;
@ -446,7 +411,7 @@ bool BOARD::SetLayerType( LAYER_NUM aLayer, LAYER_T aLayerType )
// in the layer sequence.
if( IsLayerEnabled( aLayer ) )
{
m_Layer[aLayer].m_Type = aLayerType;
m_Layer[aLayer].m_type = aLayerType;
return true;
}
@ -509,25 +474,25 @@ void BOARD::SetCopperLayerCount( int aCount )
}
LAYER_MSK BOARD::GetEnabledLayers() const
LSET BOARD::GetEnabledLayers() const
{
return m_designSettings.GetEnabledLayers();
}
LAYER_MSK BOARD::GetVisibleLayers() const
LSET BOARD::GetVisibleLayers() const
{
return m_designSettings.GetVisibleLayers();
}
void BOARD::SetEnabledLayers( LAYER_MSK aLayerMask )
void BOARD::SetEnabledLayers( LSET aLayerMask )
{
m_designSettings.SetEnabledLayers( aLayerMask );
}
void BOARD::SetVisibleLayers( LAYER_MSK aLayerMask )
void BOARD::SetVisibleLayers( LSET aLayerMask )
{
m_designSettings.SetVisibleLayers( aLayerMask );
}
@ -548,7 +513,7 @@ void BOARD::SetVisibleElements( int aMask )
void BOARD::SetVisibleAlls()
{
SetVisibleLayers( FULL_LAYERS );
SetVisibleLayers( LSET().set() );
// Call SetElementVisibility for each item,
// to ensure specific calculations that can be needed by some items
@ -652,26 +617,26 @@ void BOARD::SetVisibleElementColor( int aPCB_VISIBLE, EDA_COLOR_T aColor )
}
void BOARD::SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor )
void BOARD::SetLayerColor( LAYER_ID aLayer, EDA_COLOR_T aColor )
{
GetColorsSettings()->SetLayerColor( aLayer, aColor );
}
EDA_COLOR_T BOARD::GetLayerColor( LAYER_NUM aLayer ) const
EDA_COLOR_T BOARD::GetLayerColor( LAYER_ID aLayer ) const
{
return GetColorsSettings()->GetLayerColor( aLayer );
}
bool BOARD::IsModuleLayerVisible( LAYER_NUM layer )
bool BOARD::IsModuleLayerVisible( LAYER_ID layer )
{
switch( layer )
{
case LAYER_N_FRONT:
case F_Cu:
return IsElementVisible( PCB_VISIBLE(MOD_FR_VISIBLE) );
case LAYER_N_BACK:
case B_Cu:
return IsElementVisible( PCB_VISIBLE(MOD_BK_VISIBLE) );
default:
@ -873,7 +838,7 @@ EDA_RECT BOARD::ComputeBoundingBox( bool aBoardEdgesOnly )
// Check segments, dimensions, texts, and fiducials
for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
{
if( aBoardEdgesOnly && (item->Type() != PCB_LINE_T || item->GetLayer() != EDGE_N ) )
if( aBoardEdgesOnly && (item->Type() != PCB_LINE_T || item->GetLayer() != Edge_Cuts ) )
continue;
if( !hasItems )
@ -1198,7 +1163,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
* D_PAD* pad = (D_PAD*) item;
* if( pad->HitTest( refPos ) )
* {
* if( layer_mask & pad->GetLayerMask() )
* if( layer_mask & pad->GetLayerSet() )
* {
* found = item;
* return SEARCH_QUIT;
@ -1367,7 +1332,7 @@ int BOARD::SortedNetnamesList( wxArrayString& aNames, bool aSortbyPadsCount )
}
void BOARD::RedrawAreasOutlines( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, LAYER_NUM aLayer )
void BOARD::RedrawAreasOutlines( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, LAYER_ID aLayer )
{
if( !aDC )
return;
@ -1382,7 +1347,7 @@ void BOARD::RedrawAreasOutlines( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE a
}
void BOARD::RedrawFilledAreas( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, LAYER_NUM aLayer )
void BOARD::RedrawFilledAreas( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, LAYER_ID aLayer )
{
if( !aDC )
return;
@ -1398,9 +1363,7 @@ void BOARD::RedrawFilledAreas( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDr
ZONE_CONTAINER* BOARD::HitTestForAnyFilledArea( const wxPoint& aRefPos,
LAYER_NUM aStartLayer,
LAYER_NUM aEndLayer,
int aNetCode )
LAYER_ID aStartLayer, LAYER_ID aEndLayer, int aNetCode )
{
if( aEndLayer < 0 )
aEndLayer = aStartLayer;
@ -1413,7 +1376,7 @@ ZONE_CONTAINER* BOARD::HitTestForAnyFilledArea( const wxPoint& aRefPos,
ZONE_CONTAINER* area = m_ZoneDescriptorList[ia];
LAYER_NUM layer = area->GetLayer();
if( (layer < aStartLayer) || (layer > aEndLayer) )
if( layer < aStartLayer || layer > aEndLayer )
continue;
// In locate functions we must skip tagged items with BUSY flag set.
@ -1431,7 +1394,7 @@ ZONE_CONTAINER* BOARD::HitTestForAnyFilledArea( const wxPoint& aRefPos,
}
int BOARD::SetAreasNetCodesFromNetNames( void )
int BOARD::SetAreasNetCodesFromNetNames()
{
int error_count = 0;
@ -1465,7 +1428,7 @@ int BOARD::SetAreasNetCodesFromNetNames( void )
}
VIA* BOARD::GetViaByPosition( const wxPoint& aPosition, LAYER_NUM aLayer) const
VIA* BOARD::GetViaByPosition( const wxPoint& aPosition, LAYER_ID aLayer) const
{
for( VIA *via = GetFirstVia( m_Track); via; via = GetFirstVia( via->Next() ) )
{
@ -1479,42 +1442,42 @@ VIA* BOARD::GetViaByPosition( const wxPoint& aPosition, LAYER_NUM aLayer) const
}
D_PAD* BOARD::GetPad( const wxPoint& aPosition, LAYER_MSK aLayerMask )
D_PAD* BOARD::GetPad( const wxPoint& aPosition, LSET aLayerMask )
{
D_PAD* pad = NULL;
if( !aLayerMask.any() )
aLayerMask = LSET::AllCuMask();
for( MODULE* module = m_Modules; module && ( pad == NULL ); module = module->Next() )
for( MODULE* module = m_Modules; module; module = module->Next() )
{
if( aLayerMask )
pad = module->GetPad( aPosition, aLayerMask );
else
pad = module->GetPad( aPosition, ALL_LAYERS );
D_PAD* pad = module->GetPad( aPosition, aLayerMask );
if( pad )
return pad;
}
return pad;
return NULL;
}
D_PAD* BOARD::GetPad( TRACK* aTrace, ENDPOINT_T aEndPoint )
{
D_PAD* pad = NULL;
const wxPoint& aPosition = aTrace->GetEndPoint( aEndPoint );
LAYER_MSK aLayerMask = GetLayerMask( aTrace->GetLayer() );
LSET aLayerMask( aTrace->GetLayer() );
for( MODULE* module = m_Modules; module; module = module->Next() )
{
pad = module->GetPad( aPosition, aLayerMask );
if( pad != NULL )
break;
}
D_PAD* pad = module->GetPad( aPosition, aLayerMask );
if( pad )
return pad;
}
return NULL;
}
D_PAD* BOARD::GetPadFast( const wxPoint& aPosition, LAYER_MSK aLayerMask )
D_PAD* BOARD::GetPadFast( const wxPoint& aPosition, LSET aLayerMask )
{
for( unsigned i=0; i<GetPadCount(); ++i )
{
@ -1523,8 +1486,8 @@ D_PAD* BOARD::GetPadFast( const wxPoint& aPosition, LAYER_MSK aLayerMask )
if( pad->GetPosition() != aPosition )
continue;
/* Pad found, it must be on the correct layer */
if( pad->GetLayerMask() & aLayerMask )
// Pad found, it must be on the correct layer
if( ( pad->GetLayerSet() & aLayerMask ).any() )
return pad;
}
@ -1532,7 +1495,7 @@ D_PAD* BOARD::GetPadFast( const wxPoint& aPosition, LAYER_MSK aLayerMask )
}
D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, LAYER_MSK aLayerMask )
D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, LSET aLayerMask )
{
// Search the aPoint coordinates in aPadList
// aPadList is sorted by X then Y values, and a fast binary search is used
@ -1556,7 +1519,7 @@ D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, L
if( pad->GetPosition() == aPosition ) // candidate found
{
// The pad must match the layer mask:
if( aLayerMask & pad->GetLayerMask())
if( ( aLayerMask & pad->GetLayerSet() ).any() )
return pad;
// More than one pad can be at aPosition
@ -1570,7 +1533,7 @@ D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, L
if( pad->GetPosition() != aPosition )
break;
if( (aLayerMask & pad->GetLayerMask()) != 0 )
if( (aLayerMask & pad->GetLayerSet()) != 0 )
return pad;
}
// search previous
@ -1581,7 +1544,7 @@ D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, L
if( pad->GetPosition() != aPosition )
break;
if( (aLayerMask & pad->GetLayerMask()) != 0 )
if( (aLayerMask & pad->GetLayerSet()) != 0 )
return pad;
}
@ -1661,11 +1624,11 @@ void BOARD::GetSortedPadListByXthenYCoord( std::vector<D_PAD*>& aVector, int aNe
TRACK* BOARD::GetTrack( TRACK* aTrace, const wxPoint& aPosition,
LAYER_MSK aLayerMask ) const
LSET aLayerMask ) const
{
for( TRACK* track = aTrace; track; track = track->Next() )
{
LAYER_NUM layer = track->GetLayer();
LAYER_ID layer = track->GetLayer();
if( track->GetState( BUSY | IS_DELETED ) )
continue;
@ -1680,8 +1643,8 @@ TRACK* BOARD::GetTrack( TRACK* aTrace, const wxPoint& aPosition,
}
else
{
if( (GetLayerMask( layer ) & aLayerMask) == 0 )
continue; /* Segments on different layers. */
if( !aLayerMask[layer] )
continue; // Segments on different layers.
if( track->HitTest( aPosition ) )
return track;
@ -1714,9 +1677,9 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount,
for( TRACK* track = m_Track; track; track = track->Next() )
track->SetState( BUSY, false );
/* Set flags of the initial track segment */
// Set flags of the initial track segment
aTrace->SetState( BUSY, true );
LAYER_MSK layerMask = aTrace->GetLayerMask();
LSET layerMask = aTrace->GetLayerSet();
trackList.push_back( aTrace );
@ -1752,13 +1715,13 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount,
if( Segm1 ) // search for others segments connected to the initial segment start point
{
layerMask = Segm1->GetLayerMask();
layerMask = Segm1->GetLayerSet();
chainMarkedSegments( aTrace->GetStart(), layerMask, &trackList );
}
if( Segm2 ) // search for others segments connected to the initial segment end point
{
layerMask = Segm2->GetLayerMask();
layerMask = Segm2->GetLayerSet();
chainMarkedSegments( aTrace->GetStart(), layerMask, &trackList );
}
}
@ -1785,7 +1748,7 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount,
via->SetState( BUSY, true ); // Try to flag it. the flag will be cleared later if needed
layerMask = via->GetLayerMask();
layerMask = via->GetLayerSet();
TRACK* track = ::GetTrack( m_Track, NULL, via->GetStart(), layerMask );
@ -1932,7 +1895,7 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount,
}
MODULE* BOARD::GetFootprint( const wxPoint& aPosition, LAYER_NUM aActiveLayer,
MODULE* BOARD::GetFootprint( const wxPoint& aPosition, LAYER_ID aActiveLayer,
bool aVisibleOnly, bool aIgnoreLocked )
{
MODULE* pt_module;
@ -1952,12 +1915,13 @@ MODULE* BOARD::GetFootprint( const wxPoint& aPosition, LAYER_NUM aActiveLayer,
if( aIgnoreLocked && pt_module->IsLocked() )
continue;
LAYER_NUM layer = pt_module->GetLayer();
LAYER_ID layer = pt_module->GetLayer();
// Filter non visible modules if requested
if( (!aVisibleOnly) || IsModuleLayerVisible( layer ) )
if( !aVisibleOnly || IsModuleLayerVisible( layer ) )
{
EDA_RECT bb = pt_module->GetFootprintRect();
int offx = bb.GetX() + bb.GetWidth() / 2;
int offy = bb.GetY() + bb.GetHeight() / 2;
@ -2000,7 +1964,7 @@ MODULE* BOARD::GetFootprint( const wxPoint& aPosition, LAYER_NUM aActiveLayer,
}
BOARD_CONNECTED_ITEM* BOARD::GetLockPoint( const wxPoint& aPosition, LAYER_MSK aLayerMask )
BOARD_CONNECTED_ITEM* BOARD::GetLockPoint( const wxPoint& aPosition, LSET aLayerMask )
{
for( MODULE* module = m_Modules; module; module = module->Next() )
{
@ -2010,7 +1974,7 @@ BOARD_CONNECTED_ITEM* BOARD::GetLockPoint( const wxPoint& aPosition, LAYER_MSK a
return pad;
}
/* No pad has been located so check for a segment of the trace. */
// No pad has been located so check for a segment of the trace.
TRACK* segment = ::GetTrack( m_Track, NULL, aPosition, aLayerMask );
if( segment == NULL )
@ -2030,7 +1994,7 @@ TRACK* BOARD::CreateLockPoint( wxPoint& aPosition, TRACK* aSegment, PICKED_ITEMS
if( aSegment->GetStart() == aPosition || aSegment->GetEnd() == aPosition )
return NULL;
/* A via is a good lock point */
// A via is a good lock point
if( aSegment->Type() == PCB_VIA_T )
{
aPosition = aSegment->GetStart();
@ -2046,7 +2010,7 @@ TRACK* BOARD::CreateLockPoint( wxPoint& aPosition, TRACK* aSegment, PICKED_ITEMS
// lockPoint must be on aSegment:
// Ensure lockPoint.y/lockPoint.y = delta.y/delta.x
if( delta.x == 0 )
lockPoint.x = 0; /* horizontal segment*/
lockPoint.x = 0; // horizontal segment
else
lockPoint.y = KiROUND( ( (double)lockPoint.x * delta.y ) / delta.x );
@ -2099,7 +2063,7 @@ TRACK* BOARD::CreateLockPoint( wxPoint& aPosition, TRACK* aSegment, PICKED_ITEMS
ZONE_CONTAINER* BOARD::AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode,
LAYER_NUM aLayer, wxPoint aStartPointPosition, int aHatch )
LAYER_ID aLayer, wxPoint aStartPointPosition, int aHatch )
{
ZONE_CONTAINER* new_area = InsertArea( aNetcode,
m_ZoneDescriptorList.size( ) - 1,
@ -2134,7 +2098,7 @@ void BOARD::RemoveArea( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_to
}
ZONE_CONTAINER* BOARD::InsertArea( int netcode, int iarea, LAYER_NUM layer, int x, int y, int hatch )
ZONE_CONTAINER* BOARD::InsertArea( int netcode, int iarea, LAYER_ID layer, int x, int y, int hatch )
{
ZONE_CONTAINER* new_area = new ZONE_CONTAINER( this );

View File

@ -87,29 +87,34 @@ enum LAYER_T
* Class LAYER
* holds information pertinent to a layer of a BOARD.
*/
class LAYER
struct LAYER
{
public:
LAYER( const wxString& aName = wxEmptyString, LAYER_T aType = LT_SIGNAL,
bool aVisible = true ) :
m_Name( aName ),
m_Type( aType ),
LAYER() :
m_type( LT_SIGNAL ),
m_visible( true ),
m_number( 0 )
{}
/*
LAYER( const wxString& aName = wxEmptyString,
LAYER_T aType = LT_SIGNAL, bool aVisible = true, int aNumber = -1 ) :
m_name( aName ),
m_type( aType ),
m_visible( aVisible ),
m_fixedListIndex( UNDEFINED_LAYER )
m_number( aNumber )
{
}
void SetVisible( bool aEnable ) { m_visible = aEnable; }
bool IsVisible() const { return m_visible; }
void SetFixedListIndex( int aIndex ) { m_fixedListIndex = aIndex; }
int GetFixedListIndex() const { return m_fixedListIndex; }
*/
/** The name of the layer, there should be no spaces in this name. */
wxString m_Name;
UTF8 m_name;
/** The type of the layer */
LAYER_T m_Type;
LAYER_T m_type;
bool m_visible;
int m_number;
/**
* Function ShowType
@ -127,10 +132,6 @@ public:
* LAYER_T(-1) if the string is invalid
*/
static LAYER_T ParseType( const char* aType );
private:
bool m_visible;
int m_fixedListIndex;
};
@ -180,7 +181,7 @@ private:
/// edge zone descriptors, owned by pointer.
ZONE_CONTAINERS m_ZoneDescriptorList;
LAYER m_Layer[NB_LAYERS];
LAYER m_Layer[LAYER_ID_COUNT];
wxPoint m_grid_origin;
// if true m_highLight_NetCode is used
@ -217,7 +218,7 @@ private:
* @param aLayerMask The allowed layers for segments to search.
* @param aList The track list to fill with points of flagged segments.
*/
void chainMarkedSegments( wxPoint aPosition, LAYER_MSK aLayerMask, TRACK_PTRS* aList );
void chainMarkedSegments( wxPoint aPosition, LSET aLayerMask, TRACK_PTRS* aList );
public:
static inline bool ClassOf( const EDA_ITEM* aItem )
@ -440,11 +441,11 @@ public:
/**
* Function GetEnabledLayers
* is a proxy function that calls the correspondent function in m_BoardSettings
* is a proxy function that calls the corresponding function in m_BoardSettings
* Returns a bit-mask of all the layers that are enabled
* @return int - the enabled layers in bit-mapped form.
*/
LAYER_MSK GetEnabledLayers() const;
LSET GetEnabledLayers() const;
/**
* Function SetEnabledLayers
@ -452,7 +453,7 @@ public:
* Changes the bit-mask of enabled layers
* @param aLayerMask = The new bit-mask of enabled layers
*/
void SetEnabledLayers( LAYER_MSK aLayerMask );
void SetEnabledLayers( LSET aLayerMask );
/**
* Function IsLayerEnabled
@ -461,7 +462,7 @@ public:
* @param aLayer = The layer to be tested
* @return bool - true if the layer is visible.
*/
bool IsLayerEnabled( LAYER_NUM aLayer ) const
bool IsLayerEnabled( LAYER_ID aLayer ) const
{
return m_designSettings.IsLayerEnabled( aLayer );
}
@ -473,7 +474,7 @@ public:
* @param aLayer = The layer to be tested
* @return bool - true if the layer is visible.
*/
bool IsLayerVisible( LAYER_NUM aLayer ) const
bool IsLayerVisible( LAYER_ID aLayer ) const
{
return m_designSettings.IsLayerVisible( aLayer );
}
@ -484,7 +485,7 @@ public:
* Returns a bit-mask of all the layers that are visible
* @return int - the visible layers in bit-mapped form.
*/
LAYER_MSK GetVisibleLayers() const;
LSET GetVisibleLayers() const;
/**
* Function SetVisibleLayers
@ -492,7 +493,7 @@ public:
* changes the bit-mask of visible layers
* @param aLayerMask = The new bit-mask of visible layers
*/
void SetVisibleLayers( LAYER_MSK aLayerMask );
void SetVisibleLayers( LSET aLayerMask );
// these 2 functions are not tidy at this time, since there are PCB_VISIBLEs that
// are not stored in the bitmap.
@ -545,10 +546,10 @@ public:
* Function IsModuleLayerVisible
* expects either of the two layers on which a module can reside, and returns
* whether that layer is visible.
* @param layer One of the two allowed layers for modules: LAYER_N_FRONT or LAYER_N_BACK
* @param layer One of the two allowed layers for modules: F_Cu or B_Cu
* @return bool - true if the layer is visible, else false.
*/
bool IsModuleLayerVisible( LAYER_NUM layer );
bool IsModuleLayerVisible( LAYER_ID layer );
/**
* Function GetVisibleElementColor
@ -630,33 +631,33 @@ public:
* Usefull to export the shape of copper layers to dxf polygons
* or 3D viewer
* the polygons are not merged.
* @param aLayer = A copper layer, like LAYER_N_BACK, etc.
* @param aLayer = A copper layer, like B_Cu, etc.
* @param aOutlines The CPOLYGONS_LIST to fill in with items outline.
*/
void ConvertBrdLayerToPolygonalContours( LAYER_NUM aLayer, CPOLYGONS_LIST& aOutlines );
void ConvertBrdLayerToPolygonalContours( LAYER_ID aLayer, CPOLYGONS_LIST& aOutlines );
/**
* Function GetLayerName
* returns the name of a layer given by aLayer. Copper layers may
* have custom names.
*
* @param aLayer = A layer, like LAYER_N_BACK, etc.
* @param aLayer = A layer, like B_Cu, etc.
*
* @return wxString - the layer name, which for copper layers may
* be custom, else standard.
*/
wxString GetLayerName( LAYER_NUM aLayer ) const;
wxString GetLayerName( LAYER_ID aLayer ) const;
/**
* Function SetLayerName
* changes the name of the layer given by aLayer.
*
* @param aLayer A layer, like LAYER_N_BACK, etc.
* @param aLayer A layer, like B_Cu, etc.
* @param aLayerName The new layer name
* @return bool - true if aLayerName was legal and unique among other
* layer names at other layer indices and aLayer was within range, else false.
*/
bool SetLayerName( LAYER_NUM aLayer, const wxString& aLayerName );
bool SetLayerName( LAYER_ID aLayer, const wxString& aLayerName );
/**
* Function GetStandardLayerName
@ -666,44 +667,48 @@ public:
* be different than the default if the user has renamed any copper layers.
*
* @param aLayerNumber is the layer number to fetch
* @return wxString - containing the layer name or "BAD INDEX" if aLayerNumber
* @return const wxString - containing the layer name or "BAD INDEX" if aLayerNumber
* is not legal
*/
static wxString GetStandardLayerName( LAYER_NUM aLayerNumber );
static const wxString GetStandardLayerName( LAYER_ID aLayerId )
{
// a BOARD's standard layer name is the LAYER_ID fixed name
return LSET::Name( aLayerId );
}
bool SetLayer( LAYER_NUM aIndex, const LAYER& aLayer );
bool SetLayer( LAYER_ID aIndex, const LAYER& aLayer );
/**
* Function GetLayerType
* returns the type of the copper layer given by aLayer.
*
* @param aLayer A layer index, like LAYER_N_BACK, etc.
* @param aLayer A layer index, like B_Cu, etc.
* @return LAYER_T - the layer type, or LAYER_T(-1) if the
* index was out of range.
*/
LAYER_T GetLayerType( LAYER_NUM aLayer ) const;
LAYER_T GetLayerType( LAYER_ID aLayer ) const;
/**
* Function SetLayerType
* changes the type of the layer given by aLayer.
*
* @param aLayer A layer index, like LAYER_N_BACK, etc.
* @param aLayer A layer index, like B_Cu, etc.
* @param aLayerType The new layer type.
* @return bool - true if aLayerType was legal and aLayer was within range, else false.
*/
bool SetLayerType( LAYER_NUM aLayer, LAYER_T aLayerType );
bool SetLayerType( LAYER_ID aLayer, LAYER_T aLayerType );
/**
* Function SetLayerColor
* changes a layer color for any valid layer, including non-copper ones.
*/
void SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor );
void SetLayerColor( LAYER_ID aLayer, EDA_COLOR_T aColor );
/**
* Function GetLayerColor
* gets a layer color for any valid layer, including non-copper ones.
*/
EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const;
EDA_COLOR_T GetLayerColor( LAYER_ID aLayer ) const;
/** Functions to get some items count */
int GetNumSegmTrack() const;
@ -998,8 +1003,8 @@ public:
* @return ZONE_CONTAINER* return a pointer to the ZONE_CONTAINER found, else NULL
*/
ZONE_CONTAINER* HitTestForAnyFilledArea( const wxPoint& aRefPos,
LAYER_NUM aStartLayer,
LAYER_NUM aEndLayer,
LAYER_ID aStartLayer,
LAYER_ID aEndLayer,
int aNetCode );
/**
@ -1009,14 +1014,14 @@ public:
void RedrawAreasOutlines( EDA_DRAW_PANEL* aPanel,
wxDC* aDC,
GR_DRAWMODE aDrawMode,
LAYER_NUM aLayer );
LAYER_ID aLayer );
/**
* Function RedrawFilledAreas
* Redraw all filled areas on layer aLayer ( redraw all if aLayer < 0 )
*/
void RedrawFilledAreas( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
LAYER_NUM aLayer );
LAYER_ID aLayer );
/**
* Function SetAreasNetCodesFromNetNames
@ -1084,14 +1089,14 @@ public:
* @return a reference to the new area
*/
ZONE_CONTAINER* AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode,
LAYER_NUM aLayer, wxPoint aStartPointPosition, int aHatch );
LAYER_ID aLayer, wxPoint aStartPointPosition, int aHatch );
/**
* Function InsertArea
* add empty copper area to net, inserting after m_ZoneDescriptorList[iarea]
* @return pointer to the new area
*/
ZONE_CONTAINER* InsertArea( int netcode, int iarea, LAYER_NUM layer, int x, int y, int hatch );
ZONE_CONTAINER* InsertArea( int netcode, int iarea, LAYER_ID layer, int x, int y, int hatch );
/**
* Function NormalizeAreaPolygon
@ -1207,7 +1212,7 @@ public:
* @param aLayer The layer to search. Use -1 for a don't care.
* @return VIA* A point a to the VIA object if found, else NULL.
*/
VIA* GetViaByPosition( const wxPoint& aPosition, LAYER_NUM aLayer = UNDEFINED_LAYER ) const;
VIA* GetViaByPosition( const wxPoint& aPosition, LAYER_ID aLayer = UNDEFINED_LAYER ) const;
/**
* Function GetPad
@ -1217,7 +1222,7 @@ public:
* @param aLayerMask A layer or layers to mask the hit test.
* @return A pointer to a D_PAD object if found or NULL if not found.
*/
D_PAD* GetPad( const wxPoint& aPosition, LAYER_MSK aLayerMask = ALL_LAYERS );
D_PAD* GetPad( const wxPoint& aPosition, LSET aLayerMask = LSET().set() );
/**
* Function GetPad
@ -1239,7 +1244,7 @@ public:
* @param aLayerMask A layer or layers to mask the hit test.
* @return A pointer to a D_PAD object if found or NULL if not found.
*/
D_PAD* GetPadFast( const wxPoint& aPosition, LAYER_MSK aLayerMask );
D_PAD* GetPadFast( const wxPoint& aPosition, LSET aLayerMask );
/**
* Function GetPad
@ -1256,7 +1261,7 @@ public:
* @param aLayerMask A layer or layers to mask the hit test.
* @return a D_PAD object pointer to the connected pad.
*/
D_PAD* GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, LAYER_MSK aLayerMask );
D_PAD* GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, LSET aLayerMask );
/**
* Function GetSortedPadListByXthenYCoord
@ -1283,7 +1288,7 @@ public:
* layer mask.
* @return A TRACK object pointer if found otherwise NULL.
*/
TRACK* GetTrack( TRACK* aTrace, const wxPoint& aPosition, LAYER_MSK aLayerMask ) const;
TRACK* GetTrack( TRACK* aTrace, const wxPoint& aPosition, LSET aLayerMask ) const;
/**
* Function MarkTrace
@ -1326,7 +1331,7 @@ public:
* @param aIgnoreLocked Ignore locked modules when true.
* @return MODULE* The best module or NULL if none.
*/
MODULE* GetFootprint( const wxPoint& aPosition, LAYER_NUM aActiveLayer,
MODULE* GetFootprint( const wxPoint& aPosition, LAYER_ID aActiveLayer,
bool aVisibleOnly, bool aIgnoreLocked = false );
/**
@ -1342,7 +1347,7 @@ public:
* layer mask.
* @return A pointer to a BOARD_ITEM object if found otherwise NULL.
*/
BOARD_CONNECTED_ITEM* GetLockPoint( const wxPoint& aPosition, LAYER_MSK aLayerMask );
BOARD_CONNECTED_ITEM* GetLockPoint( const wxPoint& aPosition, LSET aLayerMask );
/**
* Function CreateLockPoint

View File

@ -54,10 +54,11 @@
BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
m_Pad_Master( NULL )
{
m_enabledLayers = ALL_LAYERS; // All layers enabled at first.
// SetCopperLayerCount() will adjust this.
LSET all_set = LSET().set();
SetVisibleLayers( FULL_LAYERS );
m_enabledLayers = all_set; // All layers enabled at first.
// SetCopperLayerCount() will adjust this.
SetVisibleLayers( all_set );
// set all but hidden text as visible.
m_visibleElements = ~( 1 << MOD_TEXT_INVISIBLE );
@ -305,17 +306,17 @@ void BOARD_DESIGN_SETTINGS::SetTrackWidthIndex( unsigned aIndex )
void BOARD_DESIGN_SETTINGS::SetVisibleAlls()
{
SetVisibleLayers( FULL_LAYERS );
SetVisibleLayers( LSET().set() );
m_visibleElements = -1;
}
void BOARD_DESIGN_SETTINGS::SetLayerVisibility( LAYER_NUM aLayer, bool aNewState )
void BOARD_DESIGN_SETTINGS::SetLayerVisibility( LAYER_ID aLayer, bool aNewState )
{
if( aNewState && IsLayerEnabled( aLayer ) )
m_visibleLayers |= GetLayerMask( aLayer );
m_visibleLayers.set( aLayer, true );
else
m_visibleLayers &= ~GetLayerMask( aLayer );
m_visibleLayers.set( aLayer, false );
}
@ -338,6 +339,8 @@ void BOARD_DESIGN_SETTINGS::SetCopperLayerCount( int aNewLayerCount )
m_copperLayerCount = aNewLayerCount;
// ensure consistency with the m_EnabledLayers member
#if 0
// was:
m_enabledLayers &= ~ALL_CU_LAYERS;
m_enabledLayers |= LAYER_BACK;
@ -345,14 +348,17 @@ void BOARD_DESIGN_SETTINGS::SetCopperLayerCount( int aNewLayerCount )
m_enabledLayers |= LAYER_FRONT;
for( LAYER_NUM ii = LAYER_N_2; ii < aNewLayerCount - 1; ++ii )
m_enabledLayers |= GetLayerMask( ii );
m_enabledLayers |= GetLayerSet( ii );
#else
m_enabledLayers = LSET::AllCuMask( aNewLayerCount );
#endif
}
void BOARD_DESIGN_SETTINGS::SetEnabledLayers( LAYER_MSK aMask )
void BOARD_DESIGN_SETTINGS::SetEnabledLayers( LSET aMask )
{
// Back and front layers are always enabled.
aMask |= LAYER_BACK | LAYER_FRONT;
aMask.set( B_Cu ).set( F_Cu );
m_enabledLayers = aMask;
@ -360,7 +366,7 @@ void BOARD_DESIGN_SETTINGS::SetEnabledLayers( LAYER_MSK aMask )
m_visibleLayers &= aMask;
// update m_CopperLayerCount to ensure its consistency with m_EnabledLayers
m_copperLayerCount = LayerMaskCountSet( aMask & ALL_CU_LAYERS);
m_copperLayerCount = ( aMask & LSET::AllCuMask() ).count();
}

View File

@ -49,7 +49,7 @@ DIMENSION::DIMENSION( BOARD_ITEM* aParent ) :
BOARD_ITEM( aParent, PCB_DIMENSION_T ),
m_Width( Millimeter2iu( 0.2 ) ), m_Unit( INCHES ), m_Value( 0 ), m_Height( 0 ), m_Text( this )
{
m_Layer = DRAW_N;
m_Layer = Dwgs_User;
}
@ -82,7 +82,7 @@ const wxString DIMENSION::GetText() const
}
void DIMENSION::SetLayer( LAYER_NUM aLayer )
void DIMENSION::SetLayer( LAYER_ID aLayer )
{
m_Layer = aLayer;
m_Text.SetLayer( aLayer );

View File

@ -95,7 +95,7 @@ public:
m_Text.SetSize( aTextSize );
}
void SetLayer( LAYER_NUM aLayer );
void SetLayer( LAYER_ID aLayer );
void SetShape( int aShape ) { m_Shape = aShape; }
int GetShape() const { return m_Shape; }

View File

@ -185,7 +185,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
if( ( draw_mode & GR_ALLOW_HIGHCONTRAST ) && DisplayOpt.ContrastModeDisplay )
{
if( !IsOnLayer( curr_layer ) && !IsOnLayer( EDGE_N ) )
if( !IsOnLayer( curr_layer ) && !IsOnLayer( Edge_Cuts ) )
ColorTurnToDarkDarkGray( &color );
}

View File

@ -57,7 +57,7 @@ EDGE_MODULE::EDGE_MODULE( MODULE* parent, STROKE_T aShape ) :
{
m_Shape = aShape;
m_Angle = 0;
m_Layer = SILKSCREEN_N_FRONT;
m_Layer = F_SilkS;
}
@ -149,7 +149,7 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
GRSetDrawMode( DC, draw_mode );
typeaff = frame->m_DisplayModEdge;
if( m_Layer <= LAST_COPPER_LAYER )
if( IsCopperLayer( m_Layer ) )
{
typeaff = frame->m_DisplayPcbTrackFill;

View File

@ -51,10 +51,10 @@ PCB_TARGET::PCB_TARGET( BOARD_ITEM* aParent ) :
m_Shape = 0;
m_Size = Millimeter2iu( 5 ); // Gives a decent size
m_Width = Millimeter2iu( 0.15 ); // Gives a decent width
m_Layer = EDGE_N; // a target is on all layers
m_Layer = Edge_Cuts; // a target is on all layers
}
PCB_TARGET::PCB_TARGET( BOARD_ITEM* aParent, int aShape, LAYER_NUM aLayer,
PCB_TARGET::PCB_TARGET( BOARD_ITEM* aParent, int aShape, LAYER_ID aLayer,
const wxPoint& aPos, int aSize, int aWidth ) :
BOARD_ITEM( aParent, PCB_TARGET_T )
{

View File

@ -51,7 +51,7 @@ public:
// Do not create a copy constructor. The one generated by the compiler is adequate.
PCB_TARGET( BOARD_ITEM* aParent, int aShape, LAYER_NUM aLayer,
PCB_TARGET( BOARD_ITEM* aParent, int aShape, LAYER_ID aLayer,
const wxPoint& aPos, int aSize, int aWidth );
~PCB_TARGET();

View File

@ -57,7 +57,7 @@ MODULE::MODULE( BOARD* parent ) :
m_initial_comments( 0 )
{
m_Attributs = MOD_DEFAULT;
m_Layer = LAYER_N_FRONT;
m_Layer = F_Cu;
m_Orient = 0;
m_ModuleStatus = 0;
flag = 0;
@ -590,12 +590,12 @@ D_PAD* MODULE::FindPadByName( const wxString& aPadName ) const
}
D_PAD* MODULE::GetPad( const wxPoint& aPosition, LAYER_MSK aLayerMask )
D_PAD* MODULE::GetPad( const wxPoint& aPosition, LSET aLayerMask )
{
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
{
// ... and on the correct layer.
if( ( pad->GetLayerMask() & aLayerMask ) == 0 )
if( ( pad->GetLayerSet() & aLayerMask ) == 0 )
continue;
if( pad->HitTest( aPosition ) )

View File

@ -189,7 +189,7 @@ public:
* function IsFlipped
* @return true if the module is flipped, i.e. on the back side of the board
*/
bool IsFlipped() const {return GetLayer() == LAYER_N_BACK; }
bool IsFlipped() const {return GetLayer() == B_Cu; }
// m_ModuleStatus bits:
#define MODULE_is_LOCKED 0x01 ///< module LOCKED: no autoplace allowed
@ -282,7 +282,7 @@ public:
* the radius of circle approximated by segments is
* initial radius * aCorrectionFactor
*/
void TransformPadsShapesWithClearanceToPolygon( LAYER_NUM aLayer,
void TransformPadsShapesWithClearanceToPolygon( LAYER_ID aLayer,
CPOLYGONS_LIST& aCornerBuffer,
int aInflateValue,
int aCircleToSegmentsCount,
@ -306,13 +306,12 @@ public:
* initial radius * aCorrectionFactor
*/
void TransformGraphicShapesWithClearanceToPolygonSet(
LAYER_NUM aLayer,
LAYER_ID aLayer,
CPOLYGONS_LIST& aCornerBuffer,
int aInflateValue,
int aCircleToSegmentsCount,
double aCorrectionFactor );
/**
* Function DrawEdgesOnly
* Draws the footprint edges only to the current Device Context
@ -400,7 +399,7 @@ public:
* @param aLayerMask A layer or layers to mask the hit test.
* @return A pointer to a D_PAD object if found otherwise NULL.
*/
D_PAD* GetPad( const wxPoint& aPosition, LAYER_MSK aLayerMask = ALL_LAYERS );
D_PAD* GetPad( const wxPoint& aPosition, LSET aLayerMask = LSET::AllLayersMask() );
enum INCLUDE_NPTH_T
{

View File

@ -78,7 +78,7 @@ D_PAD::D_PAD( MODULE* parent ) :
m_ThermalGap = 0; // Use parent setting by default
// Set layers mask to default for a standard thru hole pad.
m_layerMask = PAD_STANDARD_DEFAULT_LAYERS;
m_layerMask = StandardMask();
SetSubRatsnest( 0 ); // used in ratsnest calculations
@ -86,6 +86,38 @@ D_PAD::D_PAD( MODULE* parent ) :
}
LSET D_PAD::StandardMask()
{
static LSET saved = LSET::AllCuMask() | LSET( 3, F_SilkS, B_Mask, F_Mask );
return saved;
}
LSET D_PAD::ConnMask()
{
// was: #define PAD_CONN_DEFAULT_LAYERS LAYER_FRONT | SOLDERPASTE_LAYER_FRONT | SOLDERMASK_LAYER_FRONT
static LSET saved( 3, F_Cu, F_Paste, F_Mask );
return saved;
}
LSET D_PAD::SMDMask()
{
// was: #define PAD_SMD_DEFAULT_LAYERS LAYER_FRONT | SOLDERMASK_LAYER_FRONT
static LSET saved( 2, F_Cu, F_Mask );
return saved;
}
LSET D_PAD::UnplatedHoleMask()
{
// was #define PAD_HOLE_NOT_PLATED_DEFAULT_LAYERS ALL_CU_LAYERS |
// SILKSCREEN_LAYER_FRONT | SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT
static LSET saved = LSET::AllCuMask() | LSET( 3, F_SilkS, B_Mask, F_Mask );
return saved;
}
int D_PAD::boundingRadius() const
{
int x, y;
@ -231,7 +263,7 @@ void D_PAD::Flip( const wxPoint& aCentre )
SetOrientation( -GetOrientation() );
// flip pads layers
SetLayerMask( FlipLayerMask( m_layerMask ) );
SetLayerSet( FlipLayerMask( m_layerMask ) );
// m_boundingRadius = -1; the shape has not been changed
}
@ -630,13 +662,6 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList )
}
// see class_pad.h
bool D_PAD::IsOnLayer( LAYER_NUM aLayer ) const
{
return ::GetLayerMask( aLayer ) & m_layerMask;
}
void D_PAD::GetOblongDrillGeometry( wxPoint& aStartPoint,
wxPoint& aEndPoint, int& aWidth ) const
{
@ -773,10 +798,21 @@ int D_PAD::Compare( const D_PAD* padref, const D_PAD* padcmp )
// Dick: specctra_export needs this
// Lorenzo: gencad also needs it to implement padstacks!
if( ( diff = padref->m_layerMask - padcmp->m_layerMask ) != 0 )
return diff;
#if __cplusplus >= 201103L
long long d = padref->m_layerMask.to_ullong() - padcmp->m_layerMask.to_ullong();
if( d < 0 )
return -1;
else if( d > 0 )
return 1;
return 0;
#else
// these strings are not typically constructed, since we don't get here often.
std::string s1 = padref->m_layerMask.to_string();
std::string s2 = padcmp->m_layerMask.to_string();
return s1.compare( s2 );
#endif
}
@ -861,40 +897,40 @@ void D_PAD::ViewGetLayers( int aLayers[], int& aCount ) const
if( m_Attribute == PAD_STANDARD || m_Attribute == PAD_HOLE_NOT_PLATED )
aLayers[aCount++] = ITEM_GAL_LAYER( PADS_HOLES_VISIBLE );
if( IsOnLayer( LAYER_N_FRONT ) && IsOnLayer( LAYER_N_BACK ) )
if( IsOnLayer( F_Cu ) && IsOnLayer( B_Cu ) )
{
// Multi layer pad
aLayers[aCount++] = ITEM_GAL_LAYER( PADS_VISIBLE );
aLayers[aCount++] = NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE );
}
else if( IsOnLayer( LAYER_N_FRONT ) )
else if( IsOnLayer( F_Cu ) )
{
aLayers[aCount++] = ITEM_GAL_LAYER( PAD_FR_VISIBLE );
aLayers[aCount++] = NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE );
}
else if( IsOnLayer( LAYER_N_BACK ) )
else if( IsOnLayer( B_Cu ) )
{
aLayers[aCount++] = ITEM_GAL_LAYER( PAD_BK_VISIBLE );
aLayers[aCount++] = NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE );
}
if( IsOnLayer( SOLDERMASK_N_FRONT ) )
aLayers[aCount++] = SOLDERMASK_N_FRONT;
if( IsOnLayer( F_Mask ) )
aLayers[aCount++] = F_Mask;
if( IsOnLayer( SOLDERMASK_N_BACK ) )
aLayers[aCount++] = SOLDERMASK_N_BACK;
if( IsOnLayer( B_Mask ) )
aLayers[aCount++] = B_Mask;
if( IsOnLayer( SOLDERPASTE_N_FRONT ) )
aLayers[aCount++] = SOLDERPASTE_N_FRONT;
if( IsOnLayer( F_Paste ) )
aLayers[aCount++] = F_Paste;
if( IsOnLayer( SOLDERPASTE_N_BACK ) )
aLayers[aCount++] = SOLDERPASTE_N_BACK;
if( IsOnLayer( B_Paste ) )
aLayers[aCount++] = B_Paste;
if( IsOnLayer( ADHESIVE_N_BACK ) )
aLayers[aCount++] = ADHESIVE_N_BACK;
if( IsOnLayer( B_Adhes ) )
aLayers[aCount++] = B_Adhes;
if( IsOnLayer( ADHESIVE_N_FRONT ) )
aLayers[aCount++] = ADHESIVE_N_FRONT;
if( IsOnLayer( F_Adhes ) )
aLayers[aCount++] = F_Adhes;
#ifdef __WXDEBUG__
if( aCount == 0 ) // Should not occur

View File

@ -47,25 +47,6 @@ class TRACK;
class MSG_PANEL_INFO;
/* Default layers used for pads, according to the pad type.
* this is default values only, they can be changed for a given pad
*/
// PAD_STANDARD:
#define PAD_STANDARD_DEFAULT_LAYERS ALL_CU_LAYERS | SILKSCREEN_LAYER_FRONT | \
SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT
// PAD_CONN:
#define PAD_CONN_DEFAULT_LAYERS LAYER_FRONT | SOLDERPASTE_LAYER_FRONT | SOLDERMASK_LAYER_FRONT
// PAD_SMD:
#define PAD_SMD_DEFAULT_LAYERS LAYER_FRONT | SOLDERMASK_LAYER_FRONT
//PAD_HOLE_NOT_PLATED:
#define PAD_HOLE_NOT_PLATED_DEFAULT_LAYERS ALL_CU_LAYERS | SILKSCREEN_LAYER_FRONT | \
SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT
// Helper class to store parameters used to draw a pad
class PAD_DRAWINFO
{
@ -104,6 +85,14 @@ public:
// Do not create a copy constructor. The one generated by the compiler is adequate.
// D_PAD( const D_PAD& o );
/* Default layers used for pads, according to the pad type.
* this is default values only, they can be changed for a given pad
*/
static LSET StandardMask();
static LSET ConnMask();
static LSET SMDMask();
static LSET UnplatedHoleMask();
void Copy( D_PAD* source );
D_PAD* Next() const { return static_cast<D_PAD*>( Pnext ); }
@ -180,8 +169,8 @@ public:
*/
void GetOblongDrillGeometry( wxPoint& aStartPoint, wxPoint& aEndPoint, int& aWidth ) const;
void SetLayerMask( LAYER_MSK aLayerMask ) { m_layerMask = aLayerMask; }
LAYER_MSK GetLayerMask() const { return m_layerMask; }
void SetLayerSet( LSET aLayerMask ) { m_layerMask = aLayerMask; }
LSET GetLayerSet() const { return m_layerMask; }
void SetAttribute( PAD_ATTR_T aAttribute );
PAD_ATTR_T GetAttribute() const { return m_Attribute; }
@ -377,7 +366,10 @@ public:
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList );
bool IsOnLayer( LAYER_NUM aLayer ) const;
bool IsOnLayer( LAYER_ID aLayer ) const
{
return m_layerMask[aLayer];
}
bool HitTest( const wxPoint& aPosition ) const;
@ -506,7 +498,7 @@ private:
*/
wxPoint m_Offset;
LAYER_MSK m_layerMask; ///< Bitwise layer :1= copper layer, 15= cmp,
LSET m_layerMask; ///< Bitwise layer :1= copper layer, 15= cmp,
///< 2..14 = internal layers
///< 16 .. 31 = technical layers

View File

@ -107,19 +107,16 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
if( !frontVisible && !backVisible )
return;
/* If pad are only on front side (no layer on back side)
* and if hide front side pads is enabled, do not draw
*/
if( !frontVisible && ( (m_layerMask & BACK_LAYERS) == 0 ) )
// If pad is only on front side (no layer on back side)
// and if hide front side pads is enabled, do not draw
if( !frontVisible && !( m_layerMask & LSET::BackMask() ).any() )
return;
/* If pad are only on back side (no layer on front side)
* and if hide back side pads is enabled, do not draw
*/
if( !backVisible && ( (m_layerMask & FRONT_LAYERS) == 0 ) )
// If pad is only on back side (no layer on front side)
// and if hide back side pads is enabled, do not draw
if( !backVisible && !( m_layerMask & LSET::FrontMask() ).any() )
return;
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) aPanel->GetParent();
PCB_SCREEN* screen = frame->GetScreen();
@ -129,12 +126,12 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
drawInfo.m_ShowPadFilled = false;
EDA_COLOR_T color = BLACK;
if( m_layerMask & LAYER_FRONT )
if( ( m_layerMask & LSET::FrontMask() ).any() )
{
color = brd->GetVisibleElementColor( PAD_FR_VISIBLE );
}
if( m_layerMask & LAYER_BACK )
if( ( m_layerMask & LSET::BackMask() ).any() )
{
color = ColorMix( color, brd->GetVisibleElementColor( PAD_BK_VISIBLE ) );
}
@ -142,12 +139,14 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
if( color == BLACK ) // Not on a visible copper layer (i.e. still nothing to show)
{
// If the pad is on only one tech layer, use the layer color else use DARKGRAY
LAYER_MSK mask_non_copper_layers = m_layerMask & ~ALL_CU_LAYERS;
LSET mask_non_copper_layers = m_layerMask & ~LSET::AllCuMask();
#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR
mask_non_copper_layers &= brd->GetVisibleLayers();
#endif
LAYER_NUM pad_layer = ExtractLayer( mask_non_copper_layers );
switch( pad_layer )
LAYER_ID pad_layer = mask_non_copper_layers.ExtractLayer();
switch( (int) pad_layer )
{
case UNDEFINED_LAYER: // More than one layer
color = DARKGRAY;
@ -172,14 +171,16 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
// when routing tracks
if( frame && frame->GetToolId() == ID_TRACK_BUTT )
{
LAYER_NUM routeTop = screen->m_Route_Layer_TOP;
LAYER_NUM routeBot = screen->m_Route_Layer_BOTTOM;
LAYER_ID routeTop = screen->m_Route_Layer_TOP;
LAYER_ID routeBot = screen->m_Route_Layer_BOTTOM;
// if routing between copper and component layers,
// or the current layer is one of said 2 external copper layers,
// then highlight only the current layer.
if( ( ::GetLayerMask( routeTop ) | ::GetLayerMask( routeBot ) ) == ( LAYER_BACK | LAYER_FRONT )
|| ( ::GetLayerMask( screen->m_Active_Layer ) & ( LAYER_BACK | LAYER_FRONT ) ) )
if( ( screen->m_Active_Layer == F_Cu || screen->m_Active_Layer == B_Cu ) ||
( routeTop==F_Cu && routeBot==B_Cu ) ||
( routeTop==B_Cu && routeBot==F_Cu )
)
{
if( !IsOnLayer( screen->m_Active_Layer ) )
ColorTurnToDarkDarkGray( &color );
@ -208,13 +209,13 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
{
switch( showActualMaskSize )
{
case SOLDERMASK_N_BACK:
case SOLDERMASK_N_FRONT:
case B_Mask:
case F_Mask:
mask_margin.x = mask_margin.y = GetSolderMaskMargin();
break;
case SOLDERPASTE_N_BACK:
case SOLDERPASTE_N_FRONT:
case B_Paste:
case F_Paste:
mask_margin = GetSolderPasteMargin();
break;
@ -239,13 +240,13 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
// layer shows the pad size with the mask clearance
switch( screen->m_Active_Layer )
{
case SOLDERMASK_N_BACK:
case SOLDERMASK_N_FRONT:
case B_Mask:
case F_Mask:
mask_margin.x = mask_margin.y = GetSolderMaskMargin();
break;
case SOLDERPASTE_N_BACK:
case SOLDERPASTE_N_FRONT:
case B_Paste:
case F_Paste:
mask_margin = GetSolderPasteMargin();
break;
@ -265,7 +266,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
bool DisplayIsol = DisplayOpt.DisplayPadIsol;
if( ( m_layerMask & ALL_CU_LAYERS ) == 0 )
if( !( m_layerMask & LSET::AllCuMask() ).any() )
DisplayIsol = false;
if( ( GetAttribute() == PAD_HOLE_NOT_PLATED ) &&
@ -462,11 +463,11 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
int dx0 = std::min( halfsize.x, halfsize.y );
EDA_COLOR_T nc_color = BLUE;
if( m_layerMask & LAYER_FRONT ) /* Draw \ */
if( m_layerMask[F_Cu] ) /* Draw \ */
GRLine( aClipBox, aDC, holepos.x - dx0, holepos.y - dx0,
holepos.x + dx0, holepos.y + dx0, 0, nc_color );
if( m_layerMask & LAYER_BACK ) // Draw /
if( m_layerMask[B_Cu] ) // Draw /
GRLine( aClipBox, aDC, holepos.x + dx0, holepos.y - dx0,
holepos.x - dx0, holepos.y + dx0, 0, nc_color );
}

View File

@ -40,6 +40,28 @@
#include <class_pcb_layer_box_selector.h>
#define DECLARE_LAYERS_HOTKEY(list) int list[] = \
{ \
HK_SWITCH_LAYER_TO_COPPER, \
HK_SWITCH_LAYER_TO_INNER1, \
HK_SWITCH_LAYER_TO_INNER2, \
HK_SWITCH_LAYER_TO_INNER3, \
HK_SWITCH_LAYER_TO_INNER4, \
HK_SWITCH_LAYER_TO_INNER5, \
HK_SWITCH_LAYER_TO_INNER6, \
HK_SWITCH_LAYER_TO_INNER7, \
HK_SWITCH_LAYER_TO_INNER8, \
HK_SWITCH_LAYER_TO_INNER9, \
HK_SWITCH_LAYER_TO_INNER10, \
HK_SWITCH_LAYER_TO_INNER11, \
HK_SWITCH_LAYER_TO_INNER12, \
HK_SWITCH_LAYER_TO_INNER13, \
HK_SWITCH_LAYER_TO_INNER14, \
HK_SWITCH_LAYER_TO_COMPONENT \
};
// class to display a layer list in a wxBitmapComboBox.
// Reload the Layers
@ -47,38 +69,35 @@ void PCB_LAYER_BOX_SELECTOR::Resync()
{
Clear();
static DECLARE_LAYERS_ORDER_LIST( layertranscode );
static DECLARE_LAYERS_HOTKEY( layerhk );
static const DECLARE_LAYERS_HOTKEY( layerhk );
// Tray to fix a minimum width fot the BitmapComboBox
int minwidth = 80, h;
wxClientDC dc( GetParent() ); // The DC for "this" is not always initialized
#define BM_SIZE 14
for( LAYER_NUM i = FIRST_LAYER; i < NB_LAYERS; ++i )
LSET show = getEnabledLayers() & ~m_layerMaskDisable;
for( LSEQ seq = show.UIOrder(); seq; ++seq )
{
LAYER_ID layerid = *seq;
wxBitmap layerbmp( BM_SIZE, BM_SIZE );
wxString layername;
LAYER_NUM layerid = i;
if( m_layerorder )
layerid = layertranscode[i];
if( ! IsLayerEnabled( layerid ) )
continue;
if( ( m_layerMaskDisable & GetLayerMask( layerid ) ) )
continue;
SetBitmapLayer( layerbmp, layerid );
layername = GetLayerName( layerid );
wxString layername = GetLayerName( layerid );
if( m_layerhotkeys && m_hotkeys != NULL )
if( m_layerhotkeys && m_hotkeys && layerid < DIM(layerhk) )
{
layername = AddHotkeyName( layername, m_hotkeys,
layerhk[layerid], IS_COMMENT );
}
Append( layername, layerbmp, (void*)(intptr_t) layerid );
int w;
dc.GetTextExtent ( layername, &w, &h );
minwidth = std::max( minwidth, w );
@ -96,27 +115,38 @@ bool PCB_LAYER_BOX_SELECTOR::IsLayerEnabled( LAYER_NUM aLayer ) const
BOARD* board = m_boardFrame->GetBoard();
wxASSERT( board != NULL );
return board->IsLayerEnabled( aLayer );
return board->IsLayerEnabled( (LAYER_ID) aLayer );
}
LSET PCB_LAYER_BOX_SELECTOR::getEnabledLayers() const
{
wxASSERT( m_boardFrame != NULL );
BOARD* board = m_boardFrame->GetBoard();
wxASSERT( board != NULL );
return board->GetEnabledLayers();
}
// Returns a color index from the layer id
EDA_COLOR_T PCB_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayer ) const
{
wxASSERT( m_boardFrame != NULL );
wxASSERT( m_boardFrame );
BOARD* board = m_boardFrame->GetBoard();
wxASSERT( board != NULL );
wxASSERT( board );
return board->GetLayerColor( aLayer );
return board->GetLayerColor( (LAYER_ID) aLayer );
}
// Returns the name of the layer id
wxString PCB_LAYER_BOX_SELECTOR::GetLayerName( LAYER_NUM aLayer ) const
{
wxASSERT( m_boardFrame != NULL );
wxASSERT( m_boardFrame );
BOARD* board = m_boardFrame->GetBoard();
wxASSERT( board != NULL );
wxASSERT( board );
return board->GetLayerName( aLayer );
return board->GetLayerName( (LAYER_ID) aLayer );
}

View File

@ -5,17 +5,18 @@
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
{
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:
// Hotkey Info
struct EDA_HOTKEY_CONFIG* m_hotkeys;
EDA_HOTKEY_CONFIG* m_hotkeys;
public:
// If you are thinking the constructor is a bit curious,
@ -27,8 +28,8 @@ public:
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL, int style = 0 )
:LAYER_BOX_SELECTOR( parent, id, pos, size, n, choices )
int n = 0, const wxString choices[] = NULL, int style = 0 ) :
LAYER_BOX_SELECTOR( parent, id, pos, size, n, choices )
{
m_boardFrame = NULL;
m_layerMaskDisable = 0;
@ -41,9 +42,9 @@ public:
// we should use a constructor compatible with a wxBitmapComboBox
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;
void SetLayerMask( LAYER_MSK aMask ) { m_layerMaskDisable = aMask; }
void SetLayerSet( LSET aMask ) { m_layerMaskDisable = aMask; }
// Reload the Layers names and bitmaps
// Virtual function
@ -61,6 +62,8 @@ private:
// Returns the name of the layer id
// Virtual function
wxString GetLayerName( LAYER_NUM aLayer ) const;
LSET getEnabledLayers() const;
};
#endif // CLASS_PCB_PCB_LAYER_BOX_SELECTOR_H

View File

@ -168,7 +168,8 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
for( int row = rowCount-1; row>=0; --row )
{
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 );
LAYER_NUM layer = getDecodedId( cb->GetId() );
LAYER_ID layer = (LAYER_ID) getDecodedId( cb->GetId() );
if( IsCopperLayer( layer ) )
{
lastCu = row;
@ -180,11 +181,12 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
for( int row=0; row<rowCount; ++row )
{
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 );
LAYER_NUM layer = getDecodedId( cb->GetId() );
LAYER_ID layer = (LAYER_ID) getDecodedId( cb->GetId() );
if( IsCopperLayer( layer ) )
{
bool loc_visible = visible;
if( force_active_layer_visible && (layer == myframe->GetActiveLayer() ) )
loc_visible = true;
@ -221,6 +223,7 @@ void PCB_LAYER_WIDGET::ReFillRender()
for( unsigned row=0; row<DIM(s_render_rows); ++row )
{
LAYER_WIDGET::ROW renderRow = s_render_rows[row];
renderRow.tooltip = wxGetTranslation( s_render_rows[row].tooltip );
renderRow.rowName = wxGetTranslation( s_render_rows[row].rowName );
@ -229,6 +232,7 @@ void PCB_LAYER_WIDGET::ReFillRender()
// this window frame must have an established BOARD, i.e. after SetBoard()
renderRow.color = board->GetVisibleElementColor( renderRow.id );
}
renderRow.state = board->IsElementVisible( renderRow.id );
AppendRenderRow( renderRow );
@ -262,7 +266,7 @@ void PCB_LAYER_WIDGET::SyncLayerVisibilities()
wxWindow* w = getLayerComp( row, 0 );
LAYER_NUM layerId = getDecodedId( w->GetId() );
LAYER_ID layerId = (LAYER_ID) getDecodedId( w->GetId() );
// this does not fire a UI event
SetLayerVisible( layerId, board->IsLayerVisible( layerId ) );
@ -273,23 +277,24 @@ void PCB_LAYER_WIDGET::SyncLayerVisibilities()
void PCB_LAYER_WIDGET::ReFill()
{
BOARD* brd = myframe->GetBoard();
int enabledLayers = brd->GetEnabledLayers();
LSET enabled = brd->GetEnabledLayers();
ClearLayerRows();
// show all coppers first, with front on top, back on bottom, then technical layers
for( LAYER_NUM layer = LAYER_N_FRONT; layer >= FIRST_LAYER; --layer )
{
if( enabledLayers & GetLayerMask( layer ) )
{
wxString dsc;
// show all coppers first, with front on top, back on bottom, then technical layers
for( LSEQ cu_stack = enabled.CuStack(); cu_stack; ++cu_stack )
{
LAYER_ID layer = *cu_stack;
switch( layer )
{
case LAYER_N_FRONT:
case F_Cu:
dsc = _("Front copper layer");
break;
case LAYER_N_BACK:
case B_Cu:
dsc = _("Back copper layer");
break;
@ -302,41 +307,41 @@ void PCB_LAYER_WIDGET::ReFill()
brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ),
dsc, true ) );
}
}
// technical layers are shown in this order:
// Because they are static, wxGetTranslation must be explicitely
// called for tooltips.
static const struct {
LAYER_NUM layerId;
LAYER_ID layerId;
wxString tooltip;
} techLayerSeq[] = {
{ ADHESIVE_N_FRONT, _( "Adhesive on board's front" ) },
{ ADHESIVE_N_BACK, _( "Adhesive on board's back" ) },
{ SOLDERPASTE_N_FRONT, _( "Solder paste on board's front" )},
{ SOLDERPASTE_N_BACK, _( "Solder paste on board's back" ) },
{ SILKSCREEN_N_FRONT, _( "Silkscreen on board's front" ) },
{ SILKSCREEN_N_BACK, _( "Silkscreen on board's back" ) },
{ SOLDERMASK_N_FRONT, _( "Solder mask on board's front" ) },
{ SOLDERMASK_N_BACK, _( "Solder mask on board's back" ) },
{ DRAW_N, _( "Explanatory drawings" ) },
{ COMMENT_N, _( "Explanatory comments" ) },
{ ECO1_N, _( "User defined meaning" ) },
{ ECO2_N, _( "User defined meaning" ) },
{ EDGE_N, _( "Board's perimeter definition" ) },
} non_cu_seq[] = {
{ F_Adhes, _( "Adhesive on board's front" ) },
{ B_Adhes, _( "Adhesive on board's back" ) },
{ F_Paste, _( "Solder paste on board's front" ) },
{ B_Paste, _( "Solder paste on board's back" ) },
{ F_SilkS, _( "Silkscreen on board's front" ) },
{ B_SilkS, _( "Silkscreen on board's back" ) },
{ F_Mask, _( "Solder mask on board's front" ) },
{ B_Mask, _( "Solder mask on board's back" ) },
{ Dwgs_User, _( "Explanatory drawings" ) },
{ Cmts_User, _( "Explanatory comments" ) },
{ Eco1_User, _( "User defined meaning" ) },
{ Eco2_User, _( "User defined meaning" ) },
{ Edge_Cuts, _( "Board's perimeter definition" ) },
{ Margin, _( "Board's edge setback outline" ) },
};
for( unsigned i=0; i<DIM(techLayerSeq); ++i )
for( unsigned i=0; i<DIM(non_cu_seq); ++i )
{
LAYER_NUM layer = techLayerSeq[i].layerId;
LAYER_ID layer = non_cu_seq[i].layerId;
if( !(enabledLayers & GetLayerMask( layer )) )
if( !enabled[layer] )
continue;
AppendLayerRow( LAYER_WIDGET::ROW(
brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ),
wxGetTranslation( techLayerSeq[i].tooltip ), true ) );
wxGetTranslation( non_cu_seq[i].tooltip ), true ) );
}
installRightLayerClickHandler();
@ -344,9 +349,9 @@ void PCB_LAYER_WIDGET::ReFill()
//-----<LAYER_WIDGET callbacks>-------------------------------------------
void PCB_LAYER_WIDGET::OnLayerColorChange( LAYER_NUM aLayer, EDA_COLOR_T aColor )
void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, EDA_COLOR_T aColor )
{
myframe->GetBoard()->SetLayerColor( aLayer, aColor );
myframe->GetBoard()->SetLayerColor( (LAYER_ID) aLayer, aColor );
myframe->ReCreateLayerBox( false );
if( myframe->IsGalCanvasActive() )
@ -360,11 +365,11 @@ void PCB_LAYER_WIDGET::OnLayerColorChange( LAYER_NUM aLayer, EDA_COLOR_T aColor
}
bool PCB_LAYER_WIDGET::OnLayerSelect( LAYER_NUM aLayer )
bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer )
{
// the layer change from the PCB_LAYER_WIDGET can be denied by returning
// false from this function.
myframe->SetActiveLayer( aLayer, false );
myframe->SetActiveLayer( (LAYER_ID) aLayer, false );
if( m_alwaysShowActiveCopperLayer )
OnLayerSelected();
@ -390,16 +395,13 @@ bool PCB_LAYER_WIDGET::OnLayerSelected()
}
void PCB_LAYER_WIDGET::OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal )
void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal )
{
BOARD* brd = myframe->GetBoard();
LAYER_MSK visibleLayers = brd->GetVisibleLayers();
LSET visibleLayers = brd->GetVisibleLayers();
if( isVisible )
visibleLayers |= GetLayerMask( aLayer );
else
visibleLayers &= ~GetLayerMask( aLayer );
visibleLayers.set( aLayer, isVisible );
brd->SetVisibleLayers( visibleLayers );
@ -425,9 +427,11 @@ void PCB_LAYER_WIDGET::OnRenderColorChange( int aId, EDA_COLOR_T aColor )
void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
{
BOARD* brd = myframe->GetBoard();
brd->SetElementVisibility( aId, isEnabled );
EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas();
if( galCanvas )
{
if( aId == GRID_VISIBLE )

View File

@ -82,9 +82,9 @@ public:
void SetLayersManagerTabsText();
//-----<implement LAYER_WIDGET abstract callback functions>-----------
void OnLayerColorChange( LAYER_NUM aLayer, EDA_COLOR_T aColor );
bool OnLayerSelect( LAYER_NUM aLayer );
void OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal );
void OnLayerColorChange( int aLayer, EDA_COLOR_T aColor );
bool OnLayerSelect( int aLayer );
void OnLayerVisible( int aLayer, bool isVisible, bool isFinal );
void OnRenderColorChange( int aId, EDA_COLOR_T aColor );
void OnRenderEnable( int aId, bool isEnabled );
//-----</implement LAYER_WIDGET abstract callback functions>----------

View File

@ -62,7 +62,7 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, TEXT_TYPE text_type ) :
// Set text tickness to a default value
m_Thickness = Millimeter2iu( 0.15 );
SetLayer( SILKSCREEN_N_FRONT );
SetLayer( F_SilkS );
if( module && ( module->Type() == PCB_MODULE_T ) )
{
@ -70,12 +70,12 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, TEXT_TYPE text_type ) :
if( IsBackLayer( module->GetLayer() ) )
{
SetLayer( SILKSCREEN_N_BACK );
SetLayer( B_SilkS );
m_Mirror = true;
}
else
{
SetLayer( SILKSCREEN_N_FRONT );
SetLayer( F_SilkS );
m_Mirror = false;
}
}
@ -224,13 +224,13 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
// Determine the element color or suppress it element if hidden
switch( module->GetLayer() )
{
case LAYER_N_BACK:
case B_Cu:
if( !brd->IsElementVisible( MOD_TEXT_BK_VISIBLE ) )
return;
color = brd->GetVisibleElementColor( MOD_TEXT_BK_VISIBLE );
break;
case LAYER_N_FRONT:
case F_Cu:
if( !brd->IsElementVisible( MOD_TEXT_FR_VISIBLE ) )
return;
color = brd->GetVisibleElementColor( MOD_TEXT_FR_VISIBLE );
@ -448,12 +448,12 @@ void TEXTE_MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
default:
switch( GetParent()->GetLayer() )
{
case LAYER_N_BACK:
aLayers[0] = ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE ); // how about SILKSCREEN_N_BACK?
case B_Cu:
aLayers[0] = ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE ); // how about B_SilkS?
break;
case LAYER_N_FRONT:
aLayers[0] = ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE ); // how about SILKSCREEN_N_FRONT?
case F_Cu:
aLayers[0] = ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE ); // how about F_SilkS?
break;
default:

View File

@ -67,7 +67,7 @@ static bool ShowClearance( const TRACK* aTrack )
TRACK* GetTrack( TRACK* aStartTrace, const TRACK* aEndTrace,
const wxPoint& aPosition, LAYER_MSK aLayerMask )
const wxPoint& aPosition, LSET aLayerMask )
{
for( TRACK *PtSegm = aStartTrace; PtSegm != NULL; PtSegm = PtSegm->Next() )
{
@ -75,13 +75,13 @@ TRACK* GetTrack( TRACK* aStartTrace, const TRACK* aEndTrace,
{
if( aPosition == PtSegm->GetStart() )
{
if( aLayerMask & PtSegm->GetLayerMask() )
if( ( aLayerMask & PtSegm->GetLayerSet() ).any() )
return PtSegm;
}
if( aPosition == PtSegm->GetEnd() )
{
if( aLayerMask & PtSegm->GetLayerMask() )
if( ( aLayerMask & PtSegm->GetLayerSet() ).any() )
return PtSegm;
}
}
@ -154,7 +154,7 @@ VIA::VIA( BOARD_ITEM* aParent ) :
TRACK( aParent, PCB_VIA_T )
{
SetViaType( VIA_THROUGH );
m_BottomLayer = LAYER_N_BACK;
m_BottomLayer = B_Cu;
SetDrillDefault();
}
@ -191,8 +191,8 @@ wxString VIA::GetSelectMenuText() const
wxString netname = GetNetname();
// say which layers, only two for now
LAYER_NUM topLayer;
LAYER_NUM botLayer;
LAYER_ID topLayer;
LAYER_ID botLayer;
LayerPair( &topLayer, &botLayer );
text.Printf( format.GetData(), GetChars( ShowWidth() ),
GetChars( netname ), GetNetCode(),
@ -371,9 +371,9 @@ SEARCH_RESULT TRACK::Visit( INSPECTOR* inspector, const void* testData,
}
bool VIA::IsOnLayer( LAYER_NUM layer_number ) const
bool VIA::IsOnLayer( LAYER_ID layer_number ) const
{
LAYER_NUM bottom_layer, top_layer;
LAYER_ID bottom_layer, top_layer;
LayerPair( &top_layer, &bottom_layer );
@ -383,41 +383,43 @@ bool VIA::IsOnLayer( LAYER_NUM layer_number ) const
return false;
}
LAYER_MSK VIA::GetLayerMask() const
LSET VIA::GetLayerSet() const
{
if( GetViaType() == VIA_THROUGH )
return ALL_CU_LAYERS;
return LSET::AllCuMask();
// VIA_BLIND_BURIED or VIA_MICRVIA:
LAYER_NUM bottom_layer, top_layer;
LAYER_ID bottom_layer, top_layer;
// LayerPair() knows how layers are stored
LayerPair( &top_layer, &bottom_layer );
LAYER_MSK layermask = NO_LAYERS;
LSET layermask;
while( bottom_layer <= top_layer )
// LAYER_IDs are numbered from front to back, this is top to bottom.
for( LAYER_NUM id = top_layer; id <= bottom_layer; ++id )
{
layermask |= ::GetLayerMask( bottom_layer );
++bottom_layer;
layermask.set( id );
}
return layermask;
}
LAYER_MSK TRACK::GetLayerMask() const
LSET TRACK::GetLayerSet() const
{
return ::GetLayerMask( m_Layer );
return LSET( m_Layer );
}
void VIA::SetLayerPair( LAYER_NUM aTopLayer, LAYER_NUM aBottomLayer )
void VIA::SetLayerPair( LAYER_ID aTopLayer, LAYER_ID aBottomLayer )
{
if( GetViaType() == VIA_THROUGH )
{
aTopLayer = LAYER_N_FRONT;
aBottomLayer = LAYER_N_BACK;
aTopLayer = F_Cu;
aBottomLayer = B_Cu;
}
if( aBottomLayer > aTopLayer )
@ -428,10 +430,10 @@ void VIA::SetLayerPair( LAYER_NUM aTopLayer, LAYER_NUM aBottomLayer )
}
void VIA::LayerPair( LAYER_NUM* top_layer, LAYER_NUM* bottom_layer ) const
void VIA::LayerPair( LAYER_ID* top_layer, LAYER_ID* bottom_layer ) const
{
LAYER_NUM b_layer = LAYER_N_BACK;
LAYER_NUM t_layer = LAYER_N_FRONT;
LAYER_ID b_layer = B_Cu;
LAYER_ID t_layer = F_Cu;
if( GetViaType() != VIA_THROUGH )
{
@ -594,7 +596,7 @@ void TRACK::DrawShortNetname( EDA_DRAW_PANEL* panel,
}
}
LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
if( ( aDC->LogicalToDeviceXRel( tsize ) >= MIN_TEXT_SIZE )
&& ( !(!IsOnLayer( curr_layer )&& DisplayOpt.ContrastModeDisplay) ) )
{
@ -630,7 +632,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
if( ( aDrawMode & GR_ALLOW_HIGHCONTRAST ) && DisplayOpt.ContrastModeDisplay )
{
LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
if( !IsOnLayer( curr_layer ) )
ColorTurnToDarkDarkGray( &color );
@ -697,7 +699,7 @@ void SEGZONE::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
if( ( aDrawMode & GR_ALLOW_HIGHCONTRAST ) && DisplayOpt.ContrastModeDisplay )
{
LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
if( !IsOnLayer( curr_layer ) )
ColorTurnToDarkDarkGray( &color );
@ -761,7 +763,7 @@ void VIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
const wxPoint& aOffset )
{
int radius;
LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
int fillvia = 0;
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) panel->GetParent();
@ -876,7 +878,7 @@ void VIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
{
int ax, ay, bx, by;
if( IsOnLayer( LAYER_N_BACK ) )
if( IsOnLayer( B_Cu ) )
{
ax = radius; ay = 0;
bx = drill_radius; by = 0;
@ -887,7 +889,7 @@ void VIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
bx = by = (drill_radius * 707) / 1000;
}
/* lines | or \ */
// lines '|' or '\'
GRLine( panel->GetClipBox(), aDC, m_Start.x + aOffset.x - ax,
m_Start.y + aOffset.y - ay,
m_Start.x + aOffset.x - bx,
@ -897,7 +899,7 @@ void VIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
m_Start.x + aOffset.x + ax,
m_Start.y + aOffset.y + ay, 0, color );
// lines - or /
// lines - or '/'
GRLine( panel->GetClipBox(), aDC, m_Start.x + aOffset.x + ay,
m_Start.y + aOffset.y - ax,
m_Start.x + aOffset.x + by,
@ -913,7 +915,7 @@ void VIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
if( GetViaType() == VIA_BLIND_BURIED )
{
int ax = 0, ay = radius, bx = 0, by = drill_radius;
LAYER_NUM layer_top, layer_bottom;
LAYER_ID layer_top, layer_bottom;
( (VIA*) this )->LayerPair( &layer_top, &layer_bottom );
@ -1175,7 +1177,7 @@ void VIA::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
// Display layer pair
LAYER_NUM top_layer, bottom_layer;
LAYER_ID top_layer, bottom_layer;
LayerPair( &top_layer, &bottom_layer );
if( board )
@ -1253,7 +1255,8 @@ bool VIA::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
return arect.Intersects( box );
}
VIA* TRACK::GetVia( const wxPoint& aPosition, LAYER_NUM aLayer)
VIA* TRACK::GetVia( const wxPoint& aPosition, LAYER_ID aLayer)
{
for( VIA* via = GetFirstVia( this ); via; via = GetFirstVia( via->Next() ) )
{
@ -1267,15 +1270,18 @@ VIA* TRACK::GetVia( const wxPoint& aPosition, LAYER_NUM aLayer)
}
VIA* TRACK::GetVia( TRACK* aEndTrace, const wxPoint& aPosition, LAYER_MSK aLayerMask )
VIA* TRACK::GetVia( TRACK* aEndTrace, const wxPoint& aPosition, LSET aLayerMask )
{
for( VIA* via = GetFirstVia( this, aEndTrace ); via; via = GetFirstVia( via->Next() ) )
{
if( via->HitTest( aPosition ) &&
!via->GetState( BUSY | IS_DELETED ) &&
(aLayerMask & via->GetLayerMask()) )
( aLayerMask & via->GetLayerSet() ).any()
)
{
return via;
}
}
return NULL;
}
@ -1285,7 +1291,7 @@ TRACK* TRACK::GetTrack( TRACK* aStartTrace, TRACK* aEndTrace, ENDPOINT_T aEndPoi
bool aSameNetOnly, bool aSequential )
{
const wxPoint& position = GetEndPoint( aEndPoint );
LAYER_MSK refLayers = GetLayerMask();
LSET refLayers = GetLayerSet();
TRACK* previousSegment;
TRACK* nextSegment;
@ -1321,7 +1327,7 @@ TRACK* TRACK::GetTrack( TRACK* aStartTrace, TRACK* aEndTrace, ENDPOINT_T aEndPoi
{
if ( (nextSegment != this) &&
!nextSegment->GetState( BUSY | IS_DELETED ) &&
(refLayers & nextSegment->GetLayerMask()) )
( refLayers & nextSegment->GetLayerSet() ).any() )
{
if( (position == nextSegment->m_Start) ||
(position == nextSegment->m_End) )
@ -1340,7 +1346,8 @@ TRACK* TRACK::GetTrack( TRACK* aStartTrace, TRACK* aEndTrace, ENDPOINT_T aEndPoi
{
if( (previousSegment != this) &&
!previousSegment->GetState( BUSY | IS_DELETED ) &&
(refLayers & previousSegment->GetLayerMask()) )
( refLayers & previousSegment->GetLayerSet() ).any()
)
{
if( (position == previousSegment->m_Start) ||
(position == previousSegment->m_End) )
@ -1362,7 +1369,7 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace )
{
TRACK* Track, * via, * segm, * TrackListEnd;
int NbEnds, ii, ok = 0;
LAYER_MSK layerMask;
LSET layerMask;
if( aCount <= 1 )
{
@ -1370,7 +1377,7 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace )
return 1;
}
/* Calculation of the limit analysis. */
// Calculation of the limit analysis.
*aStartTrace = *aEndTrace = NULL;
TrackListEnd = Track = this;
ii = 0;
@ -1381,7 +1388,7 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace )
Track->m_Param = 0;
}
/* Calculate the extremes. */
// Calculate the extremes.
NbEnds = 0;
Track = this;
ii = 0;
@ -1391,12 +1398,12 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace )
if( Track->Type() == PCB_VIA_T )
continue;
layerMask = Track->GetLayerMask();
layerMask = Track->GetLayerSet();
via = GetVia( TrackListEnd, Track->m_Start, layerMask );
if( via )
{
layerMask |= via->GetLayerMask();
layerMask |= via->GetLayerSet();
via->SetState( BUSY, true );
}
@ -1419,7 +1426,7 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace )
int BeginPad, EndPad;
*aEndTrace = Track;
/* Swap ox, oy with fx, fy */
// Swap ox, oy with fx, fy
BeginPad = Track->GetState( BEGIN_ONPAD );
EndPad = Track->GetState( END_ONPAD );
@ -1438,12 +1445,12 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace )
}
}
layerMask = Track->GetLayerMask();
layerMask = Track->GetLayerSet();
via = GetVia( TrackListEnd, Track->m_End, layerMask );
if( via )
{
layerMask |= via->GetLayerMask();
layerMask |= via->GetLayerSet();
via->SetState( BUSY, true );
}
@ -1463,7 +1470,7 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace )
*aStartTrace = Track;
NbEnds++;
/* Swap ox, oy with fx, fy */
// Swap ox, oy with fx, fy
BeginPad = Track->GetState( BEGIN_ONPAD );
EndPad = Track->GetState( END_ONPAD );

View File

@ -74,8 +74,8 @@ enum VIATYPE_T
* layer mask.
* @return A TRACK object pointer if found otherwise NULL.
*/
extern TRACK* GetTrack( TRACK* aStartTrace, const TRACK* aEndTrace,
const wxPoint& aPosition, LAYER_MSK aLayerMask );
TRACK* GetTrack( TRACK* aStartTrace, const TRACK* aEndTrace,
const wxPoint& aPosition, LSET aLayerMask );
class TRACK : public BOARD_CONNECTED_ITEM
{
@ -188,7 +188,7 @@ public:
* TRACK segment or VIA physically resides.
* @return int - a layer mask, see pcbstruct.h's LAYER_BACK, etc.
*/
virtual LAYER_MSK GetLayerMask() const;
virtual LSET GetLayerSet() const;
/**
* Function IsPointOnEnds
@ -232,7 +232,7 @@ public:
* @param aLayer The layer to match, pass -1 for a don't care.
* @return A pointer to a VIA object if found, else NULL.
*/
VIA* GetVia( const wxPoint& aPosition, LAYER_NUM aLayer = UNDEFINED_LAYER );
VIA* GetVia( const wxPoint& aPosition, LAYER_ID aLayer = UNDEFINED_LAYER );
/**
* Function GetVia
@ -244,7 +244,7 @@ public:
* @param aLayerMask The layers to match, pass -1 for a don't care.
* @return A pointer to a VIA object if found, else NULL.
*/
VIA* GetVia( TRACK* aEndTrace, const wxPoint& aPosition, LAYER_MSK aLayerMask );
VIA* GetVia( TRACK* aEndTrace, const wxPoint& aPosition, LSET aLayerMask );
/**
* Function GetTrack
@ -390,9 +390,9 @@ public:
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
GR_DRAWMODE aDrawMode, const wxPoint& aOffset = ZeroOffset );
bool IsOnLayer( LAYER_NUM aLayer ) const;
bool IsOnLayer( LAYER_ID aLayer ) const;
virtual LAYER_MSK GetLayerMask() const;
virtual LSET GetLayerSet() const;
/**
* Function SetLayerPair
@ -401,7 +401,7 @@ public:
* @param top_layer = first layer connected by the via
* @param bottom_layer = last layer connected by the via
*/
void SetLayerPair( LAYER_NUM aTopLayer, LAYER_NUM aBottomLayer );
void SetLayerPair( LAYER_ID aTopLayer, LAYER_ID aBottomLayer );
/**
* Function LayerPair
@ -410,7 +410,7 @@ public:
* @param top_layer = pointer to the first layer (can be null)
* @param bottom_layer = pointer to the last layer (can be null)
*/
void LayerPair( LAYER_NUM* top_layer, LAYER_NUM* bottom_layer ) const;
void LayerPair( LAYER_ID* top_layer, LAYER_ID* bottom_layer ) const;
const wxPoint& GetPosition() const { return m_Start; } // was overload
void SetPosition( const wxPoint& aPoint ) { m_Start = aPoint; m_End = aPoint; } // was overload
@ -481,13 +481,14 @@ protected:
private:
/// The bottom layer of the via (the top layer is in m_Layer)
LAYER_NUM m_BottomLayer;
LAYER_ID m_BottomLayer;
VIATYPE_T m_ViaType; // Type of via
int m_Drill; // for vias: via drill (- 1 for default value)
};
/// Scan a track list for the first VIA o NULL if not found (or NULL passed)
inline VIA* GetFirstVia( TRACK* aTrk, const TRACK* aStopPoint = NULL )
{
@ -501,4 +502,4 @@ inline VIA *GetFirstVia( TRACK *aTrk, const TRACK *aStopPoint = NULL )
return NULL;
}
#endif /* CLASS_TRACK_H */
#endif // CLASS_TRACK_H

View File

@ -181,9 +181,9 @@ public:
* Function IsOnCopperLayer
* @return true if this zone is on a copper layer, false if on a technical layer
*/
bool IsOnCopperLayer( void ) const
bool IsOnCopperLayer() const
{
return ( GetLayer() < FIRST_NON_COPPER_LAYER ) ? true : false;
return LSET::AllNonCuMask()[GetLayer()];
}
/// How to fill areas: 0 = use filled polygons, 1 => fill with segments.

View File

@ -44,7 +44,7 @@ ZONE_SETTINGS::ZONE_SETTINGS()
// Min thickness value in filled areas (this is the minimum width of copper to fill solid areas) :
m_ZoneMinThickness = Mils2iu( ZONE_THICKNESS_MIL );
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_ArcToSegmentsCount = ARC_APPROX_SEGMENTS_COUNT_LOW_DEF; // Option to select number of segments to approximate a circle

View File

@ -39,7 +39,8 @@ public:
int m_ZoneClearance; ///< Clearance value
int m_ZoneMinThickness; ///< Min thickness value in filled areas
int m_NetcodeSelection; ///< Net code selection for the current zone
LAYER_NUM m_CurrentZone_Layer; ///< Layer used to create the current zone
LAYER_ID m_CurrentZone_Layer; ///< Layer used to create the current zone
/// Option to show the zone area (outlines only, short hatches or full hatches
int m_Zone_HatchingStyle;

View File

@ -175,9 +175,9 @@ PCB_SCREEN::PCB_SCREEN( const wxSize& aPageSizeIU ) :
// Set the working grid size to a reasonable value (in 1/10000 inch)
SetGrid( DMIL_GRID( 500 ) );
m_Active_Layer = LAYER_N_BACK; // default active layer = bottom layer
m_Route_Layer_TOP = LAYER_N_FRONT; // default layers pair for vias (bottom to top)
m_Route_Layer_BOTTOM = LAYER_N_BACK;
m_Active_Layer = B_Cu; // default active layer = bottom layer
m_Route_Layer_TOP = F_Cu; // default layers pair for vias (bottom to top)
m_Route_Layer_BOTTOM = B_Cu;
SetZoom( ZOOM_FACTOR( 120 ) ); // a default value for zoom

View File

@ -262,7 +262,9 @@ bool TRACKS_CLEANER::clean_vias()
{
const D_PAD *pad = via->m_PadsConnected[ii];
if( (pad->GetLayerMask() & ALL_CU_LAYERS) == ALL_CU_LAYERS )
const LSET all_cu = LSET::AllCuMask();
if( (pad->GetLayerSet() & all_cu) == all_cu )
{
// redundant: delete the via
m_Brd->GetRatsnest()->Remove( via );
@ -283,7 +285,7 @@ const ZONE_CONTAINER* TRACKS_CLEANER::zoneForTrackEndpoint( const TRACK *aTrack,
ENDPOINT_T aEndPoint )
{
// Vias are special cased, since they get a layer range, not a single one
LAYER_NUM top_layer, bottom_layer;
LAYER_ID top_layer, bottom_layer;
const VIA* via = dyn_cast<const VIA*>( aTrack );
if( via )

View File

@ -284,10 +284,10 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
if( module )
{
if( m_Guide->IgnoreMTextsOnCopper() && module->GetLayer()==LAYER_N_BACK )
if( m_Guide->IgnoreMTextsOnCopper() && module->GetLayer()==B_Cu )
goto exit;
if( m_Guide->IgnoreMTextsOnCmp() && module->GetLayer()==LAYER_N_FRONT )
if( m_Guide->IgnoreMTextsOnCmp() && module->GetLayer()==F_Cu )
goto exit;
if( m_Guide->IgnoreModulesVals() && item == &module->Value() )
@ -314,10 +314,10 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
if( module ) // true from case PCB_PAD_T, PCB_MODULE_TEXT_T, or PCB_MODULE_T
{
if( m_Guide->IgnoreModulesOnCu() && module->GetLayer()==LAYER_N_BACK )
if( m_Guide->IgnoreModulesOnCu() && module->GetLayer()==B_Cu )
goto exit;
if( m_Guide->IgnoreModulesOnCmp() && module->GetLayer()==LAYER_N_FRONT )
if( m_Guide->IgnoreModulesOnCmp() && module->GetLayer()==F_Cu )
goto exit;
}
@ -331,10 +331,10 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
if( ! pad_through )
{
if( m_Guide->IgnorePadsOnFront() && pad->IsOnLayer(LAYER_N_FRONT ) )
if( m_Guide->IgnorePadsOnFront() && pad->IsOnLayer(F_Cu ) )
goto exit;
if( m_Guide->IgnorePadsOnBack() && pad->IsOnLayer(LAYER_N_BACK ) )
if( m_Guide->IgnorePadsOnBack() && pad->IsOnLayer(B_Cu ) )
goto exit;
}
}
@ -350,7 +350,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
if( item->IsOnLayer( m_Guide->GetPreferredLayer() ) || m_Guide->IgnorePreferredLayer() )
{
LAYER_NUM layer = item->GetLayer();
LAYER_ID layer = item->GetLayer();
// Modules and their subcomponents: text and pads are not sensitive to the layer
// visibility controls. They all have their own separate visibility controls
@ -378,7 +378,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
// no effect on other criteria, since there is a separate "ignore" control for
// those in the COLLECTORS_GUIDE
LAYER_NUM layer = item->GetLayer();
LAYER_ID layer = item->GetLayer();
// Modules and their subcomponents: text and pads are not sensitive to the layer
// visibility controls. They all have their own separate visibility controls

View File

@ -71,13 +71,13 @@ public:
* Function IsLayerLocked
* @return bool - true if the given layer is locked, else false.
*/
virtual bool IsLayerLocked( LAYER_NUM layer ) const = 0;
virtual bool IsLayerLocked( LAYER_ID layer ) const = 0;
/**
* Function IsLayerVisible
* @return bool - true if the given layer is visible, else false.
*/
virtual bool IsLayerVisible( LAYER_NUM layer ) const = 0;
virtual bool IsLayerVisible( LAYER_ID layer ) const = 0;
/**
* Function IgnoreLockedLayers
@ -95,7 +95,7 @@ public:
* Function GetPreferredLayer
* @return int - the preferred layer for HitTest()ing.
*/
virtual LAYER_NUM GetPreferredLayer() const = 0;
virtual LAYER_ID GetPreferredLayer() const = 0;
/**
* Function IgnorePreferredLayer
@ -206,7 +206,7 @@ public:
* Philosophy: this class knows nothing of the context in which a BOARD is used
* and that means it knows nothing about which layers are visible or current,
* but can handle those concerns by the SetPreferredLayer() function and the
* SetLayerMask() function.
* SetLayerSet() function.
*/
class GENERAL_COLLECTOR : public COLLECTOR
{
@ -376,13 +376,13 @@ private:
// the storage architecture here is not important, since this is only
// a carrier object and its functions are what is used, and data only indirectly.
LAYER_NUM m_PreferredLayer;
LAYER_ID m_PreferredLayer;
bool m_IgnorePreferredLayer;
LAYER_MSK m_LayerLocked; ///< bit-mapped layer locked bits
LSET m_LayerLocked; ///< bit-mapped layer locked bits
bool m_IgnoreLockedLayers;
LAYER_MSK m_LayerVisible; ///< bit-mapped layer visible bits
LSET m_LayerVisible; ///< bit-mapped layer visible bits
bool m_IgnoreNonVisibleLayers;
bool m_IgnoreLockedItems;
@ -407,11 +407,10 @@ public:
* @param aVisibleLayerMask = current visible layers (bit mask)
* @param aPreferredLayer = the layer to search first
*/
GENERAL_COLLECTORS_GUIDE( LAYER_MSK aVisibleLayerMask, LAYER_NUM aPreferredLayer )
GENERAL_COLLECTORS_GUIDE( LSET aVisibleLayerMask, LAYER_ID aPreferredLayer )
{
m_PreferredLayer = LAYER_N_FRONT;
m_PreferredLayer = aPreferredLayer;
m_IgnorePreferredLayer = false;
m_LayerLocked = NO_LAYERS;
m_LayerVisible = aVisibleLayerMask;
m_IgnoreLockedLayers = true;
m_IgnoreNonVisibleLayers = true;
@ -423,8 +422,6 @@ public:
m_IncludeSecondary = true;
#endif
m_PreferredLayer = aPreferredLayer;
m_IgnoreMTextsMarkedNoShow = true; // g_ModuleTextNOVColor;
m_IgnoreMTextsOnCopper = true;
m_IgnoreMTextsOnCmp = false;
@ -443,36 +440,29 @@ public:
* Function IsLayerLocked
* @return bool - true if the given layer is locked, else false.
*/
bool IsLayerLocked( LAYER_NUM aLayer ) const
bool IsLayerLocked( LAYER_ID aLayerId ) const
{
return GetLayerMask( aLayer ) & m_LayerLocked;
}
void SetLayerLocked( LAYER_NUM aLayer, bool isLocked )
{
if( isLocked )
m_LayerLocked |= GetLayerMask( aLayer );
else
m_LayerLocked &= ~GetLayerMask( aLayer );
return m_LayerLocked[aLayerId];
}
void SetLayerLocked( LAYER_ID aLayerId, bool isLocked )
{
m_LayerLocked.set( aLayerId, isLocked );
}
/**
* Function IsLayerVisible
* @return bool - true if the given layer is visible, else false.
*/
bool IsLayerVisible( LAYER_NUM aLayer ) const
bool IsLayerVisible( LAYER_ID aLayerId ) const
{
return GetLayerMask( aLayer ) & m_LayerVisible;
return m_LayerVisible[aLayerId];
}
void SetLayerVisible( LAYER_NUM aLayer, bool isVisible )
void SetLayerVisible( LAYER_ID aLayerId, bool isVisible )
{
if( isVisible )
m_LayerVisible |= GetLayerMask( aLayer );
else
m_LayerVisible &= ~GetLayerMask( aLayer );
m_LayerVisible.set( aLayerId, isVisible );
}
void SetLayerVisibleBits( LAYER_MSK aLayerBits ) { m_LayerVisible = aLayerBits; }
void SetLayerVisibleBits( LSET aLayerBits ) { m_LayerVisible = aLayerBits; }
/**
* Function IgnoreLockedLayers
@ -494,8 +484,8 @@ public:
* Function GetPreferredLayer
* @return int - the preferred layer for HitTest()ing.
*/
LAYER_NUM GetPreferredLayer() const { return m_PreferredLayer; }
void SetPreferredLayer( LAYER_NUM aLayer ) { m_PreferredLayer = aLayer; }
LAYER_ID GetPreferredLayer() const { return m_PreferredLayer; }
void SetPreferredLayer( LAYER_ID aLayer ) { m_PreferredLayer = aLayer; }
/**

View File

@ -89,7 +89,7 @@ void CONNECTIONS::SearchConnectionsPadsToIntersectingPads()
if( pad == candidate_pad )
continue;
if( (pad->GetLayerMask() & candidate_pad->GetLayerMask()) == 0 )
if( (pad->GetLayerSet() & candidate_pad->GetLayerSet()) == 0 )
continue;
if( pad->HitTest( item->GetPoint() ) )
{
@ -122,7 +122,7 @@ void CONNECTIONS::SearchTracksConnectedToPads( bool add_to_padlist, bool add_to_
{
CONNECTED_POINT* cp_item = candidates[jj];
if( (pad->GetLayerMask() & cp_item->GetTrack()->GetLayerMask()) == 0 )
if( (pad->GetLayerSet() & cp_item->GetTrack()->GetLayerSet()) == 0 )
continue;
if( pad->HitTest( cp_item->GetPoint() ) )
@ -296,7 +296,7 @@ int CONNECTIONS::SearchConnectedTracks( const TRACK * aTrack )
int count = 0;
m_connected.clear();
LAYER_MSK layerMask = aTrack->GetLayerMask();
LSET layerMask = aTrack->GetLayerSet();
// Search for connections to starting point:
#define USE_EXTENDED_SEARCH
@ -318,7 +318,7 @@ int CONNECTIONS::SearchConnectedTracks( const TRACK * aTrack )
continue;
if( m_candidates[ii].GetPoint() != position )
break;
if( m_candidates[ii].GetTrack()->GetLayerMask() & layerMask )
if( m_candidates[ii].GetTrack()->GetLayerSet() & layerMask )
m_connected.push_back( m_candidates[ii].GetTrack() );
}
// search before:
@ -328,7 +328,7 @@ int CONNECTIONS::SearchConnectedTracks( const TRACK * aTrack )
continue;
if( m_candidates[ii].GetPoint() != position )
break;
if( m_candidates[ii].GetTrack()->GetLayerMask() & layerMask )
if( m_candidates[ii].GetTrack()->GetLayerSet() & layerMask )
m_connected.push_back( m_candidates[ii].GetTrack() );
}
}
@ -339,7 +339,7 @@ int CONNECTIONS::SearchConnectedTracks( const TRACK * aTrack )
{
TRACK * ctrack = tracks_candidates[ii]->GetTrack();
if( ( ctrack->GetLayerMask() & layerMask ) == 0 )
if( ( ctrack->GetLayerSet() & layerMask ) == 0 )
continue;
if( ctrack == aTrack )

View File

@ -54,7 +54,7 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack )
{
if( g_CurrentTrackList.GetCount() > 0 )
{
LAYER_NUM previous_layer = GetActiveLayer();
LAYER_ID previous_layer = GetActiveLayer();
DBG( g_CurrentTrackList.VerifyListIntegrity(); )

View File

@ -28,7 +28,6 @@
#include <fctsys.h>
//#include <pgm_base.h>
#include <kiface_i.h>
#include <common.h>
#include <class_drawpanel.h>
@ -45,7 +44,56 @@
#include <pcbplot.h>
#include <printout_controler.h>
#include <class_board.h>
#include <dialog_SVG_print.h>
#include <dialog_SVG_print_base.h>
#include <invoke_pcb_dialog.h>
class DIALOG_SVG_PRINT : public DIALOG_SVG_PRINT_base
{
public:
DIALOG_SVG_PRINT( wxTopLevelWindow* aParent, BOARD* aBoard, PCB_PLOT_PARAMS* aSettings );
private:
bool m_did_print;
BOARD* m_board;
PCB_PLOT_PARAMS* m_callers_params;
wxConfigBase* m_config;
LSET m_printMaskLayer;
wxCheckBox* m_boxSelectLayer[LAYER_ID_COUNT];
bool m_printBW;
wxString m_outputDirectory;
// Static member to store options
static bool m_printMirror;
static bool m_oneFileOnly;
void initDialog();
void OnCloseWindow( wxCloseEvent& event );
void OnButtonPlot( wxCommandEvent& event );
void OnButtonCloseClick( wxCommandEvent& event );
void OnOutputDirectoryBrowseClicked( wxCommandEvent& event );
void SetPenWidth();
void ExportSVGFile( bool aOnlyOneFile );
bool PageIsBoardBoundarySize()
{
return m_rbSvgPageSizeOpt->GetSelection() == 2;
}
bool PrintPageRef()
{
return m_rbSvgPageSizeOpt->GetSelection() == 0;
}
bool CreateSVGFile( const wxString& FullFileName );
LSET getCheckBoxSelectedLayers() const;
};
// Keys for configuration
#define PLOTSVGMODECOLOR_KEY wxT( "PlotSVGModeColor" )
@ -57,29 +105,32 @@
#define WIDTH_MIN_VALUE (0.05 * IU_PER_MM)
// Local variables:
static long s_SelectedLayers = LAYER_BACK | LAYER_FRONT |
SILKSCREEN_LAYER_FRONT | SILKSCREEN_LAYER_BACK;
static LSET s_SelectedLayers( 4, B_Cu, F_Cu, F_SilkS, B_SilkS );
/*
* DIALOG_SVG_PRINT functions
*/
DIALOG_SVG_PRINT::DIALOG_SVG_PRINT( EDA_DRAW_FRAME* parent ) :
DIALOG_SVG_PRINT_base( parent )
DIALOG_SVG_PRINT::DIALOG_SVG_PRINT( wxTopLevelWindow* aParent, BOARD* aBoard, PCB_PLOT_PARAMS* aSettings ) :
DIALOG_SVG_PRINT_base( aParent ),
m_did_print( false ),
m_callers_params( aSettings )
{
m_parent = (PCB_BASE_FRAME*) parent;
m_board = aBoard;
m_config = Kiface().KifaceSettings();
memset( m_boxSelectLayer, 0, sizeof( m_boxSelectLayer ) );
initDialog();
GetSizer()->SetSizeHints( this );
Centre();
}
bool DIALOG_SVG_PRINT::m_printMirror = false;
bool DIALOG_SVG_PRINT::m_oneFileOnly = false;
void DIALOG_SVG_PRINT::initDialog()
{
m_board = m_parent->GetBoard();
if( m_config )
{
m_config->Read( PLOTSVGMODECOLOR_KEY, &m_printBW, false );
@ -90,7 +141,7 @@ void DIALOG_SVG_PRINT::initDialog()
m_PrintBoardEdgesCtrl->SetValue( ltmp );
}
m_outputDirectory = m_parent->GetPlotSettings().GetOutputDirectory();
m_outputDirectory = m_callers_params->GetOutputDirectory();
m_outputDirectoryName->SetValue( m_outputDirectory );
if( m_printBW )
@ -101,63 +152,38 @@ void DIALOG_SVG_PRINT::initDialog()
m_printMirrorOpt->SetValue( m_printMirror );
m_rbFileOpt->SetSelection( m_oneFileOnly ? 1 : 0 );
AddUnitSymbol( *m_TextPenWidth, g_UserUnit );
m_DialogDefaultPenSize->SetValue(
StringFromValue( g_UserUnit, g_DrawDefaultLineThickness ) );
// Create layers list
LAYER_NUM layer;
for( layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer )
m_DialogDefaultPenSize->SetValue( StringFromValue( g_UserUnit, g_DrawDefaultLineThickness ) );
LSEQ seq = m_board->GetEnabledLayers().UIOrder();
for( ; seq; ++seq )
{
if( !m_board->IsLayerEnabled( layer ) )
m_boxSelectLayer[layer] = NULL;
else
m_boxSelectLayer[layer] =
new wxCheckBox( this, -1, m_board->GetLayerName( layer ) );
}
LAYER_ID layer = *seq;
// Add wxCheckBoxes in layers lists dialog
// List layers in same order than in setup layers dialog
// (Front or Top to Back or Bottom)
DECLARE_LAYERS_ORDER_LIST( layersOrder );
// The layers in m_boxSelectLayer[] are in LAYER_ID order. This may be
// different than the order on screen.
m_boxSelectLayer[layer] = new wxCheckBox( this, -1, m_board->GetLayerName( layer ) );
for( LAYER_NUM layer_idx = FIRST_LAYER; layer_idx < NB_PCB_LAYERS; ++layer_idx )
{
layer = layersOrder[layer_idx];
wxASSERT( layer < NB_PCB_LAYERS );
if( m_boxSelectLayer[layer] == NULL )
continue;
LAYER_MSK mask = GetLayerMask( layer );
if( mask & s_SelectedLayers )
if( s_SelectedLayers[layer] )
m_boxSelectLayer[layer]->SetValue( true );
if( layer <= LAST_COPPER_LAYER )
m_CopperLayersBoxSizer->Add( m_boxSelectLayer[layer],
0,
wxGROW | wxALL,
1 );
if( IsCopperLayer( layer ) )
m_CopperLayersBoxSizer->Add( m_boxSelectLayer[layer], 0, wxGROW | wxALL, 1 );
else
m_TechnicalBoxSizer->Add( m_boxSelectLayer[layer],
0,
wxGROW | wxALL,
1 );
m_TechnicalBoxSizer->Add( m_boxSelectLayer[layer], 0, wxGROW | wxALL, 1 );
}
if( m_config )
{
wxString layerKey;
for( LAYER_NUM layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer )
for( seq.Rewind(); seq; ++seq )
{
bool option;
if( m_boxSelectLayer[layer] == NULL )
continue;
LAYER_NUM layer = *seq;
layerKey.Printf( OPTKEY_LAYERBASE, layer );
@ -168,6 +194,21 @@ void DIALOG_SVG_PRINT::initDialog()
}
LSET DIALOG_SVG_PRINT::getCheckBoxSelectedLayers() const
{
LSET ret;
// the layers in m_boxSelectLayer[] are in LAYER_ID order.
for( unsigned layer=0; layer<DIM(m_boxSelectLayer); ++layer )
{
if( m_boxSelectLayer[layer] && m_boxSelectLayer[layer]->GetValue() )
ret.set( layer );
}
return ret;
}
void DIALOG_SVG_PRINT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
{
// Build the absolute path of current output plot directory
@ -232,13 +273,15 @@ void DIALOG_SVG_PRINT::ExportSVGFile( bool aOnlyOneFile )
// absolute form). Bail if it fails
wxFileName outputDir = wxFileName::DirName( m_outputDirectory );
wxString boardFilename = m_board->GetFileName();
WX_TEXT_CTRL_REPORTER reporter( m_messagesBox );
if( !EnsureOutputDirectory( &outputDir, boardFilename, &reporter ) )
{
wxString msg;
msg.Printf( _( "Could not write plot files to folder \"%s\"." ),
GetChars( outputDir.GetPath() ) );
wxString msg = wxString::Format(
_( "Could not write plot files to folder \"%s\"." ),
GetChars( outputDir.GetPath() )
);
DisplayError( this, msg );
return;
}
@ -247,48 +290,35 @@ void DIALOG_SVG_PRINT::ExportSVGFile( bool aOnlyOneFile )
m_printBW = m_ModeColorOption->GetSelection();
SetPenWidth();
// Build layers mask
LAYER_MSK printMaskLayer = NO_LAYERS;
LSET all_selected = getCheckBoxSelectedLayers();
for( LAYER_NUM layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer )
for( LSEQ seq = all_selected.Seq(); seq; ++seq )
{
if( m_boxSelectLayer[layer] && m_boxSelectLayer[layer]->GetValue() )
printMaskLayer |= GetLayerMask( layer );
}
wxString msg;
for( LAYER_NUM layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer )
{
LAYER_MSK currlayer_mask = GetLayerMask( layer );
if( (printMaskLayer & currlayer_mask ) == 0 )
continue;
wxString suffix = m_board->GetStandardLayerName( layer );
if( aOnlyOneFile )
{
m_printMaskLayer = printMaskLayer;
suffix = wxT( "brd" );
}
else
{
m_printMaskLayer = currlayer_mask;
suffix = m_board->GetStandardLayerName( layer );
}
LAYER_ID layer = *seq;
wxFileName fn( boardFilename );
wxString suffix = aOnlyOneFile ? wxT( "brd" ) : m_board->GetStandardLayerName( layer );
BuildPlotFileName( &fn, outputDir.GetPath(), suffix, SVGFileExtension );
m_printMaskLayer = aOnlyOneFile ? LSET( layer ) : all_selected;
if( m_PrintBoardEdgesCtrl->IsChecked() )
m_printMaskLayer |= EDGE_LAYER;
m_printMaskLayer.set( Edge_Cuts );
if( CreateSVGFile( fn.GetFullPath() ) )
msg.Printf( _( "Plot: %s OK\n" ), GetChars( fn.GetFullPath() ) );
{
m_messagesBox->AppendText(
wxString::Format( _( "Plot: %s OK\n" ), GetChars( fn.GetFullPath() ) )
);
}
else // Error
msg.Printf( _( "** Unable to create %s **\n" ), GetChars( fn.GetFullPath() ) );
m_messagesBox->AppendText( msg );
{
m_messagesBox->AppendText(
wxString::Format( _( "** Unable to create %s **\n" ), GetChars( fn.GetFullPath() ) )
);
}
if( aOnlyOneFile )
break;
@ -299,23 +329,25 @@ void DIALOG_SVG_PRINT::ExportSVGFile( bool aOnlyOneFile )
// Actual SVG file export function.
bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName )
{
PCB_PLOT_PARAMS m_plotOpts;
PCB_PLOT_PARAMS plot_opts;
m_plotOpts.SetPlotFrameRef( PrintPageRef() );
plot_opts.SetPlotFrameRef( PrintPageRef() );
// Adding drill marks, for copper layers
if( (m_printMaskLayer & ALL_CU_LAYERS) )
m_plotOpts.SetDrillMarksType( PCB_PLOT_PARAMS::FULL_DRILL_SHAPE );
if( ( m_printMaskLayer & LSET::AllCuMask() ).any() )
plot_opts.SetDrillMarksType( PCB_PLOT_PARAMS::FULL_DRILL_SHAPE );
else
m_plotOpts.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE );
plot_opts.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE );
m_plotOpts.SetSkipPlotNPTH_Pads( false );
plot_opts.SetSkipPlotNPTH_Pads( false );
plot_opts.SetMirror( m_printMirror );
plot_opts.SetFormat( PLOT_FORMAT_SVG );
m_plotOpts.SetMirror( m_printMirror );
m_plotOpts.SetFormat( PLOT_FORMAT_SVG );
EDA_COLOR_T color = UNSPECIFIED_COLOR; // Used layer color to plot ref and value
m_plotOpts.SetReferenceColor( color );
m_plotOpts.SetValueColor( color );
plot_opts.SetReferenceColor( color );
plot_opts.SetValueColor( color );
PAGE_INFO pageInfo = m_board->GetPageSettings();
wxPoint axisorigin = m_board->GetAuxOrigin();
@ -324,52 +356,70 @@ bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName )
{
EDA_RECT bbox = m_board->ComputeBoundingBox();
PAGE_INFO currpageInfo = m_board->GetPageSettings();
currpageInfo.SetWidthMils( bbox.GetWidth() / IU_PER_MILS );
currpageInfo.SetHeightMils( bbox.GetHeight() / IU_PER_MILS );
m_board->SetPageSettings( currpageInfo );
m_plotOpts.SetUseAuxOrigin( true );
plot_opts.SetUseAuxOrigin( true );
wxPoint origin = bbox.GetOrigin();
m_board->SetAuxOrigin( origin );
}
LOCALE_IO toggle;
SVG_PLOTTER* plotter = (SVG_PLOTTER*) StartPlotBoard( m_board,
&m_plotOpts, aFullFileName,
&plot_opts, aFullFileName,
wxEmptyString );
if( plotter )
{
plotter->SetColorMode( m_ModeColorOption->GetSelection() == 0 );
PlotStandardLayer( m_board, plotter, m_printMaskLayer, m_plotOpts );
PlotStandardLayer( m_board, plotter, m_printMaskLayer, plot_opts );
plotter->EndPlot();
}
delete plotter;
m_board->SetAuxOrigin( axisorigin );
m_board->SetAuxOrigin( axisorigin ); // really, without a message saying so?
m_board->SetPageSettings( pageInfo );
return true;
}
void DIALOG_SVG_PRINT::OnButtonPlot( wxCommandEvent& event )
{
m_oneFileOnly = m_rbFileOpt->GetSelection() == 1;
ExportSVGFile( m_oneFileOnly );
m_did_print = true;
}
void DIALOG_SVG_PRINT::OnButtonCancelClick( wxCommandEvent& event )
void DIALOG_SVG_PRINT::OnButtonCloseClick( wxCommandEvent& event )
{
Close();
}
void DIALOG_SVG_PRINT::OnCloseWindow( wxCloseEvent& event )
{
if( m_did_print ) // unless output was created, this is tantamount to a cancel.
{
SetPenWidth();
m_printBW = m_ModeColorOption->GetSelection();
m_oneFileOnly = m_rbFileOpt->GetSelection() == 1;
// 1) Why is configuration data saved in two places: m_config and PCB_PLOT_OPTIONS?
// 2) Why are SVG layer choices co-mingled with other plot layer choices in the config file?
// The string OPTKEY_LAYERBASE is used in multiple places.
// fix these.
wxString dirStr = m_outputDirectoryName->GetValue();
dirStr.Replace( wxT( "\\" ), wxT( "/" ) );
m_callers_params->SetOutputDirectory( dirStr );
if( m_config )
{
m_config->Write( PLOTSVGMODECOLOR_KEY, m_printBW );
@ -378,28 +428,24 @@ void DIALOG_SVG_PRINT::OnCloseWindow( wxCloseEvent& event )
wxString layerKey;
for( LAYER_NUM layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer )
for( unsigned layer = 0; layer < DIM(m_boxSelectLayer); ++layer )
{
if( m_boxSelectLayer[layer] == NULL )
if( !m_boxSelectLayer[layer] )
continue;
layerKey.Printf( OPTKEY_LAYERBASE, layer );
m_config->Write( layerKey, m_boxSelectLayer[layer]->IsChecked() );
}
}
}
// Set output directory and replace backslashes with forward ones
wxString dirStr;
dirStr = m_outputDirectoryName->GetValue();
dirStr.Replace( wxT( "\\" ), wxT( "/" ) );
EndModal( m_did_print ? wxID_OK : wxID_CANCEL );
}
if( dirStr != m_parent->GetPlotSettings().GetOutputDirectory() )
bool InvokeSVGPrint( wxTopLevelWindow* aCaller, BOARD* aBoard, PCB_PLOT_PARAMS* aSettings )
{
PCB_PLOT_PARAMS tempOptions( m_parent->GetPlotSettings() );
tempOptions.SetOutputDirectory( dirStr );
m_parent->SetPlotSettings( tempOptions );
m_parent->OnModify();
}
DIALOG_SVG_PRINT dlg( aCaller, aBoard, aSettings );
EndModal( 0 );
return dlg.ShowModal() == wxID_OK;
}

View File

@ -1,53 +0,0 @@
#ifndef _DIALOG_SVG_PRINT_H_
#define _DIALOG_SVG_PRINT_H_
#include <dialog_SVG_print_base.h>
class BASE_SCREEN;
class PCB_BASE_FRAME;
class wxConfig;
class DIALOG_SVG_PRINT : public DIALOG_SVG_PRINT_base
{
private:
PCB_BASE_FRAME* m_parent;
BOARD* m_board;
wxConfigBase* m_config;
LAYER_MSK m_printMaskLayer;
wxCheckBox* m_boxSelectLayer[32];
bool m_printBW;
wxString m_outputDirectory;
// Static member to store options
static bool m_printMirror;
static bool m_oneFileOnly;
public:
DIALOG_SVG_PRINT( EDA_DRAW_FRAME* parent );
~DIALOG_SVG_PRINT() {}
private:
void OnCloseWindow( wxCloseEvent& event );
void initDialog( );
void OnButtonPlot( wxCommandEvent& event );
void OnButtonCancelClick( wxCommandEvent& event );
void OnOutputDirectoryBrowseClicked( wxCommandEvent& event );
void SetPenWidth();
void ExportSVGFile( bool aOnlyOneFile );
bool PageIsBoardBoundarySize()
{
return m_rbSvgPageSizeOpt->GetSelection() == 2;
}
bool PrintPageRef()
{
return m_rbSvgPageSizeOpt->GetSelection() == 0;
}
bool CreateSVGFile( const wxString& FullFileName );
};
#endif // _DIALOG_SVG_PRINT_H_

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// C++ code generated with wxFormBuilder (version Jun 6 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -130,18 +130,16 @@ DIALOG_SVG_PRINT_base::DIALOG_SVG_PRINT_base( wxWindow* parent, wxWindowID id, c
this->Layout();
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_SVG_PRINT_base::OnCloseWindow ) );
m_browseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnOutputDirectoryBrowseClicked ), NULL, this );
m_buttonCreateFile->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnButtonPlot ), NULL, this );
m_buttonQuit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnButtonCancelClick ), NULL, this );
m_buttonQuit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnButtonCloseClick ), NULL, this );
}
DIALOG_SVG_PRINT_base::~DIALOG_SVG_PRINT_base()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_SVG_PRINT_base::OnCloseWindow ) );
m_browseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnOutputDirectoryBrowseClicked ), NULL, this );
m_buttonCreateFile->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnButtonPlot ), NULL, this );
m_buttonQuit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnButtonCancelClick ), NULL, this );
m_buttonQuit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnButtonCloseClick ), NULL, this );
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="11" />
<FileVersion major="1" minor="13" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
@ -20,8 +20,10 @@
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
@ -59,7 +61,7 @@
<event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event>
<event name="OnChar"></event>
<event name="OnClose">OnCloseWindow</event>
<event name="OnClose"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnHibernate"></event>
@ -1208,7 +1210,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnButtonCancelClick</event>
<event name="OnButtonClick">OnButtonCloseClick</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// C++ code generated with wxFormBuilder (version Jun 6 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -61,10 +61,9 @@ class DIALOG_SVG_PRINT_base : public DIALOG_SHIM
wxTextCtrl* m_messagesBox;
// Virtual event handlers, overide them in your derived class
virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); }
virtual void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void OnButtonPlot( wxCommandEvent& event ) { event.Skip(); }
virtual void OnButtonCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnButtonCloseClick( wxCommandEvent& event ) { event.Skip(); }
public:

View File

@ -71,7 +71,8 @@ private:
///< true = pad count sort.
long m_NetFiltering;
std::vector<LAYER_NUM> m_LayerId; ///< Handle the real layer number from layer
std::vector<LAYER_ID> m_LayerId; ///< Handle the real layer number from layer
///< name position in m_LayerSelectionCtrl
static wxString m_netNameShowFilter; ///< the filter to show nets (default * "*").
@ -247,28 +248,29 @@ void DIALOG_COPPER_ZONE::initDialog()
wxListItem column0;
column0.SetId( 0 );
m_LayerSelectionCtrl->InsertColumn( 0, column0 );
// Build copper layer list and append to layer widget
int layerCount = board->GetCopperLayerCount();
wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL );
int ctrlWidth = 0; // Min width for m_LayerSelectionCtrl to show the layers names
for( LAYER_NUM ii = FIRST_LAYER; ii < layerCount; ++ii )
LSET cu_set = LSET::AllCuMask( board->GetCopperLayerCount() );
for( LSEQ cu_stack = cu_set.UIOrder(); cu_stack; ++cu_stack )
{
LAYER_NUM layerNumber = LAYER_N_BACK;
LAYER_ID layer = *cu_stack;
if( layerCount <= 1 || ii < layerCount - 1 )
layerNumber = ii;
else if( ii == layerCount - 1 )
layerNumber = LAYER_N_FRONT;
m_LayerId.push_back( layer );
m_LayerId.insert( m_LayerId.begin(), layerNumber );
msg = board->GetLayerName( layer ).Trim();
EDA_COLOR_T layerColor = board->GetLayerColor( layer );
msg = board->GetLayerName( layerNumber ).Trim();
EDA_COLOR_T layerColor = board->GetLayerColor( layerNumber );
imageList->Add( makeLayerBitmap( layerColor ) );
int itemIndex = m_LayerSelectionCtrl->InsertItem( 0, msg, ii );
if( m_settings.m_CurrentZone_Layer == layerNumber )
int itemIndex = m_LayerSelectionCtrl->InsertItem( 0, msg, layer );
if( m_settings.m_CurrentZone_Layer == layer )
m_LayerSelectionCtrl->Select( itemIndex );
wxSize tsize( GetTextSize( msg, m_LayerSelectionCtrl ) );
@ -281,7 +283,9 @@ void DIALOG_COPPER_ZONE::initDialog()
// wxWidgets 2.9 ( column witdth too large)
ctrlWidth += LAYER_BITMAP_SIZE_X + 16; // Add bitmap width + margin between bitmap and text
m_LayerSelectionCtrl->SetColumnWidth( 0, ctrlWidth );
ctrlWidth += 4; // add small margin between text and window borders
m_LayerSelectionCtrl->SetMinSize( wxSize( ctrlWidth, -1 ) );
wxString netNameDoNotShowFilter = wxT( "Net-*" );
@ -464,7 +468,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab
return false;
}
m_settings.m_CurrentZone_Layer = m_LayerId[ii];
m_settings.m_CurrentZone_Layer = (LAYER_ID) m_LayerId[ii];
// Get the net name selection for this zone
ii = m_ListNetNameSelection->GetSelection();

View File

@ -96,7 +96,7 @@ void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties()
m_YPosUnit->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
m_LayerCtrl->SetSelection(
(m_CurrentModule->GetLayer() == LAYER_N_BACK) ? 1 : 0 );
(m_CurrentModule->GetLayer() == B_Cu) ? 1 : 0 );
bool select = false;
switch( int( m_CurrentModule->GetOrientation() ) )
@ -619,10 +619,10 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
bool change_layer = false;
if( m_LayerCtrl->GetSelection() == 0 ) // layer req = COMPONENT
{
if( m_CurrentModule->GetLayer() == LAYER_N_BACK )
if( m_CurrentModule->GetLayer() == B_Cu )
change_layer = true;
}
else if( m_CurrentModule->GetLayer() == LAYER_N_FRONT )
else if( m_CurrentModule->GetLayer() == F_Cu )
change_layer = true;
if( change_layer )

View File

@ -361,8 +361,8 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles(bool aGenDrill, bool aGenMap)
bool hasBuriedVias = false; /* If true, drill files are created
* layer pair by layer pair for
* buried vias */
int layer1 = LAYER_N_BACK;
int layer2 = LAYER_N_FRONT;
int layer1 = B_Cu;
int layer2 = F_Cu;
bool gen_through_holes = true;
bool gen_NPTH_holes = false;
@ -400,12 +400,12 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles(bool aGenDrill, bool aGenMap)
}
else if( !gen_through_holes )
{
if( layer1 == LAYER_N_BACK )
if( layer1 == B_Cu )
layer_extend << wxT( "-back" );
else
layer_extend << wxT( "-inner" ) << layer1;
if( layer2 == LAYER_N_FRONT )
if( layer2 == F_Cu )
layer_extend << wxT( "-front" );
else
layer_extend << wxT( "-inner" ) << layer2;
@ -472,10 +472,10 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles(bool aGenDrill, bool aGenMap)
layer2 = layer1 + 1; // prepare generation of first layer pair
else
{
if( layer2 >= LAYER_N_FRONT ) // no more layer pair to consider
if( layer2 >= F_Cu ) // no more layer pair to consider
{
layer1 = LAYER_N_BACK;
layer2 = LAYER_N_FRONT;
layer1 = B_Cu;
layer2 = F_Cu;
gen_NPTH_holes = true;
continue;
}
@ -484,7 +484,7 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles(bool aGenDrill, bool aGenMap)
layer2++; // use next layer pair
if( layer2 == m_parent->GetBoard()->GetCopperLayerCount() - 1 )
layer2 = LAYER_N_FRONT; // the last layer is always the
layer2 = F_Cu; // the last layer is always the
// Front layer
}

View File

@ -39,11 +39,11 @@
#include <dialog_global_deletion.h>
DIALOG_GLOBAL_DELETION::DIALOG_GLOBAL_DELETION( PCB_EDIT_FRAME* parent )
: DIALOG_GLOBAL_DELETION_BASE( parent )
DIALOG_GLOBAL_DELETION::DIALOG_GLOBAL_DELETION( PCB_EDIT_FRAME* parent ) :
DIALOG_GLOBAL_DELETION_BASE( parent )
{
m_Parent = parent;
m_currentLayer = FIRST_LAYER;
m_currentLayer = F_Cu;
m_TrackFilterAR->Enable( m_DelTracks->GetValue() );
m_TrackFilterLocked->Enable( m_DelTracks->GetValue() );
m_TrackFilterNormal->Enable( m_DelTracks->GetValue() );
@ -69,7 +69,7 @@ void PCB_EDIT_FRAME::InstallPcbGlobalDeleteFrame( const wxPoint& pos )
void DIALOG_GLOBAL_DELETION::SetCurrentLayer( LAYER_NUM aLayer )
{
m_currentLayer = aLayer;
m_textCtrlCurrLayer->SetValue( m_Parent->GetBoard()->GetLayerName( aLayer ) );
m_textCtrlCurrLayer->SetValue( m_Parent->GetBoard()->GetLayerName( LAYER_ID( aLayer ) ) );
}
@ -111,19 +111,19 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( )
BOARD_ITEM* nextitem;
RN_DATA* ratsnest = pcb->GetRatsnest();
LAYER_MSK layers_filter = ALL_LAYERS;
LSET layers_filter = LSET().set();
if( m_rbLayersOption->GetSelection() != 0 ) // Use current layer only
layers_filter = GetLayerMask( m_currentLayer );
layers_filter = LSET( m_currentLayer );
if( m_DelZones->GetValue() )
{
int area_index = 0;
item = pcb->GetArea( area_index );
while( item != NULL )
while( item )
{
if( GetLayerMask( item->GetLayer() ) & layers_filter )
if( layers_filter[item->GetLayer()] )
{
itemPicker.SetItem( item );
pickersList.PushItem( itemPicker );
@ -143,21 +143,21 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( )
if( m_DelDrawings->GetValue() || m_DelBoardEdges->GetValue() )
{
LAYER_MSK masque_layer = NO_LAYERS;
LSET masque_layer;
if( m_DelDrawings->GetValue() )
masque_layer = (~EDGE_LAYER) & ALL_NO_CU_LAYERS;
masque_layer = LSET::AllNonCuMask().set( Edge_Cuts, false );
if( m_DelBoardEdges->GetValue() )
masque_layer |= EDGE_LAYER;
masque_layer.set( Edge_Cuts );
masque_layer &= layers_filter;
for( item = pcb->m_Drawings; item != NULL; item = nextitem )
for( item = pcb->m_Drawings; item; item = nextitem )
{
nextitem = item->Next();
if( ( item->Type() == PCB_LINE_T ) && ( GetLayerMask( item->GetLayer() ) & masque_layer) )
if( item->Type() == PCB_LINE_T && masque_layer[item->GetLayer()] )
{
itemPicker.SetItem( item );
pickersList.PushItem( itemPicker );
@ -169,13 +169,13 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( )
if( m_DelTexts->GetValue() )
{
LAYER_MSK del_text_layers = ALL_LAYERS & layers_filter;
LSET del_text_layers = layers_filter;
for( item = pcb->m_Drawings; item != NULL; item = nextitem )
for( item = pcb->m_Drawings; item; item = nextitem )
{
nextitem = item->Next();
if( ( item->Type() == PCB_TEXT_T ) && ( GetLayerMask( item->GetLayer() ) & del_text_layers ) )
if( item->Type() == PCB_TEXT_T && del_text_layers[item->GetLayer()] )
{
itemPicker.SetItem( item );
pickersList.PushItem( itemPicker );
@ -191,7 +191,7 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( )
{
nextitem = item->Next();
if( ( GetLayerMask( item->GetLayer() ) & layers_filter ) &&
if( layers_filter[item->GetLayer()] &&
( ( m_ModuleFilterNormal->GetValue() && !item->IsLocked() ) ||
( m_ModuleFilterLocked->GetValue() && item->IsLocked() ) ) )
{
@ -219,7 +219,7 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( )
TRACK* nexttrack;
for( TRACK *track = pcb->m_Track; track != NULL; track = nexttrack )
for( TRACK *track = pcb->m_Track; track; track = nexttrack )
{
nexttrack = track->Next();
@ -233,7 +233,7 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( )
if( ( track->Type() == PCB_VIA_T ) && !m_TrackFilterVias->GetValue() )
continue;
if( ( track->GetLayerMask() & layers_filter ) == 0 )
if( ( track->GetLayerSet() & layers_filter ) == 0 )
continue;
itemPicker.SetItem( track );

View File

@ -170,7 +170,7 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::initDlg( )
int thickness;
if( m_Item->GetLayer() == EDGE_N )
if( m_Item->GetLayer() == Edge_Cuts )
thickness = m_brdSettings.m_EdgeSegmentWidth;
else
thickness = m_brdSettings.m_DrawSegmentWidth;
@ -179,7 +179,7 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::initDlg( )
// Configure the layers list selector
m_LayerSelectionCtrl->SetLayersHotkeys( false );
m_LayerSelectionCtrl->SetLayerMask( ALL_CU_LAYERS );
m_LayerSelectionCtrl->SetLayerSet( LSET::AllCuMask() );
m_LayerSelectionCtrl->SetBoardFrame( m_parent );
m_LayerSelectionCtrl->Resync();
@ -187,7 +187,7 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::initDlg( )
{
wxMessageBox( _( "This item has an illegal layer id.\n"
"Now, forced on the drawings layer. Please, fix it" ) );
m_LayerSelectionCtrl->SetLayerSelection( DRAW_N );
m_LayerSelectionCtrl->SetLayerSelection( Dwgs_User );
}
}
@ -196,7 +196,7 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::OnLayerChoice( wxCommandEvent& event )
{
int thickness;
if( m_LayerSelectionCtrl->GetLayerSelection() == EDGE_N )
if( m_LayerSelectionCtrl->GetLayerSelection() == Edge_Cuts )
thickness = m_brdSettings.m_EdgeSegmentWidth;
else
thickness = m_brdSettings.m_DrawSegmentWidth;
@ -232,9 +232,9 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event )
msg = m_DefaultThicknessCtrl->GetValue();
int thickness = ValueFromString( g_UserUnit, msg );
m_Item->SetLayer( m_LayerSelectionCtrl->GetLayerSelection() );
m_Item->SetLayer( (LAYER_ID) m_LayerSelectionCtrl->GetLayerSelection() );
if( m_Item->GetLayer() == EDGE_N )
if( m_Item->GetLayer() == Edge_Cuts )
m_brdSettings.m_EdgeSegmentWidth = thickness;
else
m_brdSettings.m_DrawSegmentWidth = thickness;

View File

@ -81,10 +81,8 @@ void FOOTPRINT_EDIT_FRAME::InstallFootprintBodyItemPropertiesDlg(EDGE_MODULE * a
m_canvas->SetIgnoreMouseEvents( false );
}
void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::initDlg()
/* Initialize messages and values in text control,
* according to the item parameters values
*/
{
SetFocus();
m_StandardButtonsSizerOK->SetDefault();
@ -105,6 +103,7 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::initDlg()
{
if( texts_unit[ii] == NULL )
break;
texts_unit[ii]->SetLabel( GetAbbreviatedUnitsLabel() );
}
@ -156,14 +155,15 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::initDlg()
// Configure the layers list selector
m_LayerSelectionCtrl->SetLayersHotkeys( false );
m_LayerSelectionCtrl->SetLayerMask( INTERNAL_CU_LAYERS|EDGE_LAYER );
m_LayerSelectionCtrl->SetLayerSet( LSET::InternalCuMask().set( Edge_Cuts ) );
m_LayerSelectionCtrl->SetBoardFrame( m_parent );
m_LayerSelectionCtrl->Resync();
if( m_LayerSelectionCtrl->SetLayerSelection( m_item->GetLayer() ) < 0 )
{
wxMessageBox( _( "This item has an illegal layer id.\n"
"Now, forced on the front silk screen layer. Please, fix it" ) );
m_LayerSelectionCtrl->SetLayerSelection( SILKSCREEN_N_FRONT );
m_LayerSelectionCtrl->SetLayerSelection( F_SilkS );
}
}
@ -220,7 +220,7 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event )
m_brdSettings.m_ModuleSegmentWidth = thickness;
m_parent->SetDesignSettings( m_brdSettings );
m_item->SetLayer( layer );
m_item->SetLayer( LAYER_ID( layer ) );
if( m_item->GetShape() == S_ARC )
{

View File

@ -148,27 +148,28 @@ void DIALOG_KEEPOUT_AREA_PROPERTIES::initDialog()
wxListItem column0;
column0.SetId( 0 );
m_LayerSelectionCtrl->InsertColumn( 0, column0 );
// Build copper layer list and append to layer widget
int layerCount = board->GetCopperLayerCount();
wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL );
for( int ii = 0; ii < layerCount; ii++ )
// Build copper layer list and append to layer widget
LSET show = LSET::AllCuMask( board->GetCopperLayerCount() );
for( LSEQ cu_stack = show.UIOrder(); cu_stack; ++cu_stack )
{
LAYER_NUM layerNumber = LAYER_N_BACK;
LAYER_ID layer = *cu_stack;
if( layerCount <= 1 || ii < layerCount - 1 )
layerNumber = ii;
else if( ii == layerCount - 1 )
layerNumber = LAYER_N_FRONT;
m_layerId.push_back( layer );
m_layerId.insert( m_layerId.begin(), layerNumber );
msg = board->GetLayerName( layer );
EDA_COLOR_T layerColor = board->GetLayerColor( layer );
msg = board->GetLayerName( layerNumber );
EDA_COLOR_T layerColor = board->GetLayerColor( layerNumber );
imageList->Add( makeLayerBitmap( layerColor ) );
int itemIndex = m_LayerSelectionCtrl->InsertItem( 0, msg, ii );
if( m_zonesettings.m_CurrentZone_Layer == layerNumber )
int itemIndex = m_LayerSelectionCtrl->InsertItem( 0, msg, layer );
if( m_zonesettings.m_CurrentZone_Layer == layer )
m_LayerSelectionCtrl->Select( itemIndex );
}
@ -221,7 +222,7 @@ bool DIALOG_KEEPOUT_AREA_PROPERTIES::AcceptOptionsForKeepOut()
return false;
}
m_zonesettings.m_CurrentZone_Layer = m_layerId[ii];
m_zonesettings.m_CurrentZone_Layer = (LAYER_ID) m_layerId[ii];
switch( m_OutlineAppearanceCtrl->GetSelection() )
{
case 0:

View File

@ -25,12 +25,11 @@
#include <fctsys.h>
#include <class_drawpanel.h>
#include <macros.h>
#include <confirm.h>
#include <pcbnew.h>
#include <wxPcbStruct.h>
#include <invoke_pcb_dialog.h>
#include <class_board.h>
@ -70,13 +69,74 @@ struct CTLs
};
static LSEQ dlg_layers()
{
// layers that are put out into the dialog UI, coordinate with wxformbuilder and
// getCTLs( LAYER_NUM aLayerNumber )
static const LAYER_ID layers[] = {
F_Adhes,
F_Paste,
F_SilkS,
F_Mask,
F_Cu,
In2_Cu,
In3_Cu,
In4_Cu,
In5_Cu,
In6_Cu,
In7_Cu,
In8_Cu,
In9_Cu,
In10_Cu,
In11_Cu,
In12_Cu,
In13_Cu,
In14_Cu,
In15_Cu,
In16_Cu,
In17_Cu,
In18_Cu,
In19_Cu,
In20_Cu,
In21_Cu,
In22_Cu,
In23_Cu,
In24_Cu,
In25_Cu,
In26_Cu,
In27_Cu,
In28_Cu,
In29_Cu,
In30_Cu,
B_Cu,
B_Mask,
B_SilkS,
B_Paste,
B_Adhes,
Edge_Cuts,
Margin,
Eco2_User,
Eco1_User,
Cmts_User,
Dwgs_User,
};
return LSEQ( layers, layers + DIM( layers ) );
}
class DIALOG_LAYERS_SETUP : public DIALOG_LAYERS_SETUP_BASE
{
private:
PCB_EDIT_FRAME* m_Parent;
public:
DIALOG_LAYERS_SETUP( wxTopLevelWindow* aCaller, BOARD* aBoard );
protected:
int m_CopperLayerCount;
LAYER_MSK m_EnabledLayers;
LSET m_EnabledLayers;
BOARD* m_Pcb;
@ -84,18 +144,17 @@ private:
wxStaticText* m_EnabledStaticText;
wxStaticText* m_TypeStaticText;
void setLayerCheckBox( LAYER_NUM layer, bool isChecked );
void setCopperLayerCheckBoxes( int copperCount );
void showCopperChoice( int copperCount );
void showBoardLayerNames();
void showSelectedLayerCheckBoxes( LAYER_MSK enableLayerMask );
void showSelectedLayerCheckBoxes( LSET enableLayerMask );
void showLayerTypes();
void showPresets( LAYER_MSK enabledLayerMask );
void showPresets( LSET enabledLayerMask );
/** return the selected layer mask within the UI checkboxes */
LAYER_MSK getUILayerMask();
LSET getUILayerMask();
wxString getLayerName( LAYER_NUM layer );
int getLayerTypeIndex( LAYER_NUM layer );
@ -150,11 +209,6 @@ private:
m_TypeStaticText->Move( offset + (widths[2] - txtz.x)/2, 5 );
}
public:
DIALOG_LAYERS_SETUP( PCB_EDIT_FRAME* parent );
~DIALOG_LAYERS_SETUP( ) { };
/**
* Function Layout
* overrides the standard Layout() function so that the column titles can
@ -171,27 +225,27 @@ public:
// Layer bit masks for each defined "Preset Layer Grouping"
static const LAYER_MSK presets[] =
static const LSET presets[] =
{
NO_LAYERS, // shift the array index up by one, matches with "Custom".
LSET(), // shift the array index up by one, matches with "Custom".
// "Two layers, parts on Front only"
EDGE_LAYER | LAYER_FRONT | LAYER_BACK | FRONT_TECH_LAYERS,
LSET( 2, F_Cu, B_Cu ) | LSET::FrontTechMask() | LSET::UserMask(),
// "Two layers, parts on Back only",
EDGE_LAYER | LAYER_FRONT | LAYER_BACK | BACK_TECH_LAYERS,
LSET( 2, F_Cu, B_Cu ) | LSET::BackTechMask() | LSET::UserMask(),
// "Two layers, parts on Front and Back",
EDGE_LAYER | LAYER_FRONT | LAYER_BACK | ALL_TECH_LAYERS,
LSET( 2, F_Cu, B_Cu ) | LSET::FrontTechMask() | LSET::BackTechMask() | LSET::UserMask(),
// "Four layers, parts on Front only"
EDGE_LAYER | LAYER_FRONT | LAYER_BACK | LAYER_2 | LAYER_3 | FRONT_TECH_LAYERS,
LSET( 4, F_Cu, B_Cu, In1_Cu, In2_Cu ) | LSET::FrontTechMask() | LSET::UserMask(),
// "Four layers, parts on Front and Back"
EDGE_LAYER | LAYER_FRONT | LAYER_BACK | LAYER_2 | LAYER_3 | ALL_TECH_LAYERS,
LSET( 4, F_Cu, B_Cu, In1_Cu, In2_Cu ) | LSET::FrontTechMask() | LSET::BackTechMask() | LSET::UserMask(),
// "All layers on",
ALL_LAYERS,
LSET().set(),
};
@ -202,54 +256,58 @@ CTLs DIALOG_LAYERS_SETUP::getCTLs( LAYER_NUM aLayerNumber )
switch( aLayerNumber )
{
case ADHESIVE_N_FRONT: RETAUX( m_AdhesFront );
case SOLDERPASTE_N_FRONT: RETAUX( m_SoldPFront );
case SILKSCREEN_N_FRONT: RETAUX( m_SilkSFront );
case SOLDERMASK_N_FRONT: RETAUX( m_MaskFront );
case LAYER_N_FRONT: RETCOP( m_Front );
#ifdef USE_LAYER_MANAGER_COPPER_LAYERS_ORDER
case LAYER_N_15: RETCOP( m_Inner2 );
case LAYER_N_14: RETCOP( m_Inner3 );
case LAYER_N_13: RETCOP( m_Inner4 );
case LAYER_N_12: RETCOP( m_Inner5 );
case LAYER_N_11: RETCOP( m_Inner6 );
case LAYER_N_10: RETCOP( m_Inner7 );
case LAYER_N_9: RETCOP( m_Inner8 );
case LAYER_N_8: RETCOP( m_Inner9 );
case LAYER_N_7: RETCOP( m_Inner10 );
case LAYER_N_6: RETCOP( m_Inner11 );
case LAYER_N_5: RETCOP( m_Inner12 );
case LAYER_N_4: RETCOP( m_Inner13 );
case LAYER_N_3: RETCOP( m_Inner14 );
case LAYER_N_2: RETCOP( m_Inner15 );
#else
case LAYER_N_2: RETCOP( m_Inner2 );
case LAYER_N_3: RETCOP( m_Inner3 );
case LAYER_N_4: RETCOP( m_Inner4 );
case LAYER_N_5: RETCOP( m_Inner5 );
case LAYER_N_6: RETCOP( m_Inner6 );
case LAYER_N_7: RETCOP( m_Inner7 );
case LAYER_N_8: RETCOP( m_Inner8 );
case LAYER_N_9: RETCOP( m_Inner9 );
case LAYER_N_10: RETCOP( m_Inner10 );
case LAYER_N_11: RETCOP( m_Inner11 );
case LAYER_N_12: RETCOP( m_Inner12 );
case LAYER_N_13: RETCOP( m_Inner13 );
case LAYER_N_14: RETCOP( m_Inner14 );
case LAYER_N_15: RETCOP( m_Inner15 );
#endif
case LAYER_N_BACK: RETCOP( m_Back );
case SOLDERMASK_N_BACK: RETAUX( m_MaskBack );
case SILKSCREEN_N_BACK: RETAUX( m_SilkSBack );
case SOLDERPASTE_N_BACK: RETAUX( m_SoldPBack );
case ADHESIVE_N_BACK: RETAUX( m_AdhesBack );
case EDGE_N: RETAUX( m_PCBEdges );
case ECO2_N: RETAUX( m_Eco2 );
case ECO1_N: RETAUX( m_Eco1 );
case COMMENT_N: RETAUX( m_Comments );
case DRAW_N: RETAUX( m_Drawings );
case F_Adhes: RETAUX( m_AdhesFront );
case F_Paste: RETAUX( m_SoldPFront );
case F_SilkS: RETAUX( m_SilkSFront );
case F_Mask: RETAUX( m_MaskFront );
case F_Cu: RETCOP( m_Front );
case In1_Cu: RETCOP( m_In1 );
case In2_Cu: RETCOP( m_In2 );
case In3_Cu: RETCOP( m_In3 );
case In4_Cu: RETCOP( m_In4 );
case In5_Cu: RETCOP( m_In5 );
case In6_Cu: RETCOP( m_In6 );
case In7_Cu: RETCOP( m_In7 );
case In8_Cu: RETCOP( m_In8 );
case In9_Cu: RETCOP( m_In9 );
case In10_Cu: RETCOP( m_In10 );
case In11_Cu: RETCOP( m_In11 );
case In12_Cu: RETCOP( m_In12 );
case In13_Cu: RETCOP( m_In13 );
case In14_Cu: RETCOP( m_In14 );
case In15_Cu: RETCOP( m_In15 );
case In16_Cu: RETCOP( m_In16 );
case In17_Cu: RETCOP( m_In17 );
case In18_Cu: RETCOP( m_In18 );
case In19_Cu: RETCOP( m_In19 );
case In20_Cu: RETCOP( m_In20 );
case In21_Cu: RETCOP( m_In21 );
case In22_Cu: RETCOP( m_In22 );
case In23_Cu: RETCOP( m_In23 );
case In24_Cu: RETCOP( m_In24 );
case In25_Cu: RETCOP( m_In25 );
case In26_Cu: RETCOP( m_In26 );
case In27_Cu: RETCOP( m_In27 );
case In28_Cu: RETCOP( m_In28 );
case In29_Cu: RETCOP( m_In29 );
case In30_Cu: RETCOP( m_In30 );
case B_Cu: RETCOP( m_Back );
case B_Mask: RETAUX( m_MaskBack );
case B_SilkS: RETAUX( m_SilkSBack );
case B_Paste: RETAUX( m_SoldPBack );
case B_Adhes: RETAUX( m_AdhesBack );
case Edge_Cuts: RETAUX( m_PCBEdges );
case Margin: RETAUX( m_Margin );
case Eco2_User: RETAUX( m_Eco2 );
case Eco1_User: RETAUX( m_Eco1 );
case Cmts_User: RETAUX( m_Comments );
case Dwgs_User: RETAUX( m_Drawings );
default:
// wxDEBUGMSG( "bad layer id" );
wxASSERT_MSG( 0, wxT( "bad layer id" ) );
return CTLs( 0, 0, 0 );
}
@ -258,13 +316,10 @@ CTLs DIALOG_LAYERS_SETUP::getCTLs( LAYER_NUM aLayerNumber )
}
/***********************************************************************************/
DIALOG_LAYERS_SETUP::DIALOG_LAYERS_SETUP( PCB_EDIT_FRAME* parent ) :
DIALOG_LAYERS_SETUP_BASE( parent )
/***********************************************************************************/
DIALOG_LAYERS_SETUP::DIALOG_LAYERS_SETUP( wxTopLevelWindow* aParent, BOARD* aBoard ) :
DIALOG_LAYERS_SETUP_BASE( aParent )
{
m_Parent = parent;
m_Pcb = m_Parent->GetBoard();
m_Pcb = aBoard;
m_CopperLayerCount = m_Pcb->GetCopperLayerCount();
showCopperChoice( m_CopperLayerCount );
@ -325,8 +380,10 @@ void DIALOG_LAYERS_SETUP::showBoardLayerNames()
// obtaining them from BOARD::GetLayerName() which calls
// BOARD::GetStandardLayerName() for non-coppers.
for( LAYER_NUM layer=FIRST_LAYER; layer<NB_PCB_LAYERS; ++layer )
for( LSEQ seq = dlg_layers(); seq; ++seq )
{
LAYER_ID layer = *seq;
wxControl* ctl = getName( layer );
wxASSERT( ctl );
@ -346,16 +403,19 @@ void DIALOG_LAYERS_SETUP::showBoardLayerNames()
}
void DIALOG_LAYERS_SETUP::showSelectedLayerCheckBoxes( LAYER_MSK enabledLayers )
void DIALOG_LAYERS_SETUP::showSelectedLayerCheckBoxes( LSET enabledLayers )
{
for( LAYER_NUM layer=FIRST_LAYER; layer<NB_PCB_LAYERS; ++layer )
// the check boxes
for( LSEQ seq = dlg_layers(); seq; ++seq )
{
setLayerCheckBox( layer, GetLayerMask( layer ) & enabledLayers );
LAYER_ID layer = *seq;
setLayerCheckBox( layer, enabledLayers[layer] );
}
}
void DIALOG_LAYERS_SETUP::showPresets( LAYER_MSK enabledLayers )
void DIALOG_LAYERS_SETUP::showPresets( LSET enabledLayers )
{
int presetsNdx = 0; // the "Custom" setting, matches nothing
@ -374,25 +434,28 @@ void DIALOG_LAYERS_SETUP::showPresets( LAYER_MSK enabledLayers )
void DIALOG_LAYERS_SETUP::showLayerTypes()
{
for( LAYER_NUM copperLayer = FIRST_COPPER_LAYER;
copperLayer <= LAST_COPPER_LAYER; ++copperLayer )
for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq )
{
wxChoice* ctl = getChoice( copperLayer );
ctl->SetSelection( m_Pcb->GetLayerType( copperLayer ) );
LAYER_ID cu_layer = *seq;
wxChoice* ctl = getChoice( cu_layer );
ctl->SetSelection( m_Pcb->GetLayerType( cu_layer ) );
}
}
LAYER_MSK DIALOG_LAYERS_SETUP::getUILayerMask()
LSET DIALOG_LAYERS_SETUP::getUILayerMask()
{
LAYER_MSK layerMaskResult = NO_LAYERS;
LSET layerMaskResult;
for( LAYER_NUM layer=FIRST_LAYER; layer<NB_PCB_LAYERS; ++layer )
for( LSEQ seq = dlg_layers(); seq; ++seq )
{
LAYER_ID layer = *seq;
wxCheckBox* ctl = getCheckBox( layer );
if( ctl->GetValue() )
{
layerMaskResult |= GetLayerMask( layer );
layerMaskResult.set( layer );
}
}
@ -411,22 +474,19 @@ void DIALOG_LAYERS_SETUP::setCopperLayerCheckBoxes( int copperCount )
{
if( copperCount > 0 )
{
setLayerCheckBox( LAYER_N_BACK, true );
setLayerCheckBox( F_Cu, true );
--copperCount;
}
if( copperCount > 0 )
{
setLayerCheckBox( LAYER_N_FRONT, true );
setLayerCheckBox( B_Cu, true );
--copperCount;
}
else
{
setLayerCheckBox( LAYER_N_FRONT, false );
}
for( LAYER_NUM layer=LAYER_N_2; layer < NB_COPPER_LAYERS-1; ++layer, --copperCount )
for( LSEQ seq = LSET::InternalCuMask().Seq(); seq; ++seq, --copperCount )
{
LAYER_ID layer = *seq;
bool state = copperCount > 0;
#ifdef HIDE_INACTIVE_LAYERS
@ -451,7 +511,6 @@ void DIALOG_LAYERS_SETUP::setCopperLayerCheckBoxes( int copperCount )
wxSizeEvent evt_size( m_LayersListPanel->GetSize() );
m_LayersListPanel->GetEventHandler()->ProcessEvent( evt_size );
#endif
}
@ -486,16 +545,9 @@ void DIALOG_LAYERS_SETUP::OnPresetsChoice( wxCommandEvent& event )
{
m_EnabledLayers = presets[ presetNdx ];
int coppersMask = m_EnabledLayers & ALL_CU_LAYERS;
LSET copperSet = m_EnabledLayers & LSET::AllCuMask();
int copperCount = 0;
while( coppersMask )
{
if( coppersMask & 1 )
++copperCount;
coppersMask >>= 1;
}
int copperCount = copperSet.count();
m_CopperLayerCount = copperCount;
@ -520,17 +572,13 @@ void DIALOG_LAYERS_SETUP::OnCopperLayersChoice( wxCommandEvent& event )
}
/*****************************************************************/
void DIALOG_LAYERS_SETUP::OnCancelButtonClick( wxCommandEvent& event )
/*****************************************************************/
{
EndModal( wxID_CANCEL );
}
/**************************************************************************/
void DIALOG_LAYERS_SETUP::OnOkButtonClick( wxCommandEvent& event )
/**************************************************************************/
{
if( testLayerNames() )
{
@ -545,10 +593,11 @@ void DIALOG_LAYERS_SETUP::OnOkButtonClick( wxCommandEvent& event )
*/
m_Pcb->SetVisibleLayers( m_EnabledLayers );
for( LAYER_NUM layer = FIRST_COPPER_LAYER;
layer <= LAST_COPPER_LAYER; ++layer )
for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq )
{
if( GetLayerMask( layer ) & m_EnabledLayers )
LAYER_ID layer = *seq;
if( m_EnabledLayers[layer] )
{
name = getLayerName( layer );
@ -560,14 +609,11 @@ void DIALOG_LAYERS_SETUP::OnOkButtonClick( wxCommandEvent& event )
}
}
m_Parent->OnModify();
m_Parent->ReCreateLayerBox();
m_Parent->ReFillLayerWidget();
EndModal( wxID_OK );
}
}
int DIALOG_LAYERS_SETUP::getLayerTypeIndex( LAYER_NUM aLayer )
{
wxChoice* ctl = getChoice( aLayer );
@ -577,6 +623,7 @@ int DIALOG_LAYERS_SETUP::getLayerTypeIndex( LAYER_NUM aLayer )
return ret;
}
wxString DIALOG_LAYERS_SETUP::getLayerName( LAYER_NUM aLayer )
{
wxString ret;
@ -590,6 +637,7 @@ wxString DIALOG_LAYERS_SETUP::getLayerName( LAYER_NUM aLayer )
return ret;
}
static bool hasOneOf( const wxString& str, const wxString& chars )
{
for( unsigned i=0; i<chars.Len(); ++i )
@ -598,16 +646,19 @@ static bool hasOneOf( const wxString& str, const wxString& chars )
return false;
}
bool DIALOG_LAYERS_SETUP::testLayerNames()
{
std::vector<wxString> names;
wxTextCtrl* ctl;
for( LAYER_NUM layer=FIRST_LAYER; layer<=LAST_COPPER_LAYER; ++layer )
for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq )
{
LAYER_ID layer = *seq;
// we _can_ rely on m_EnabledLayers being current here:
if( !(m_EnabledLayers & GetLayerMask( layer )) )
if( !m_EnabledLayers[layer] )
continue;
wxString name = getLayerName( layer );
@ -625,7 +676,7 @@ bool DIALOG_LAYERS_SETUP::testLayerNames()
// 6) cannot have illegal chars in filenames ( some filenames are built from layer names )
static const wxString badchars( wxT("%$\" /\\") );
if( name == wxEmptyString )
if( !name )
{
DisplayError( this, _("Layer name may not be empty" ) );
ctl->SetFocus(); // on the bad name
@ -663,36 +714,9 @@ bool DIALOG_LAYERS_SETUP::testLayerNames()
}
void PCB_EDIT_FRAME::InstallDialogLayerSetup()
bool InvokeLayerSetup( wxTopLevelWindow* aCaller, BOARD* aBoard )
{
DIALOG_LAYERS_SETUP dlg( this );
DIALOG_LAYERS_SETUP dlg( aCaller, aBoard );
if( dlg.ShowModal() == wxID_CANCEL )
return;
wxLogDebug( wxT( "Current layer selected %d." ), GetActiveLayer() );
// If the current active layer was removed, find the next avaiable layer to set as the
// active layer.
if( !( GetLayerMask( GetActiveLayer() ) & GetBoard()->GetEnabledLayers() ) )
{
for( LAYER_NUM i = FIRST_LAYER; i < NB_LAYERS; ++i )
{
LAYER_NUM tmp = i;
if( i >= NB_LAYERS )
tmp = i - NB_LAYERS;
if( GetLayerMask( tmp ) & GetBoard()->GetEnabledLayers() )
{
wxLogDebug( wxT( "Setting current layer to %d." ), GetActiveLayer() );
SetActiveLayer( tmp, true );
break;
}
}
}
else
{
SetActiveLayer( GetActiveLayer(), true );
}
return dlg.ShowModal() == wxID_OK;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// C++ code generated with wxFormBuilder (version Jun 6 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -46,78 +46,127 @@ class DIALOG_SHIM;
#define ID_FRONTNAME 1012
#define ID_FRONTCHECKBOX 1013
#define ID_FRONTCHOICE 1014
#define ID_INNER2NAME 1015
#define ID_INNER2CHECKBOX 1016
#define ID_INNER2CHOICE 1017
#define ID_INNER3NAME 1018
#define ID_INNER3CHECKBOX 1019
#define ID_INNER3CHOICE 1020
#define ID_INNER4NAME 1021
#define ID_INNER4CHECKBOX 1022
#define ID_INNER4CHOICE 1023
#define ID_INNER5NAME 1024
#define ID_INNER5CHECKBOX 1025
#define ID_INNER5CHOICE 1026
#define ID_INNER6NAME 1027
#define ID_INNER6CHECKBOX 1028
#define ID_INNER6CHOICE 1029
#define ID_INNER7NAME 1030
#define ID_INNER7CHECKBOX 1031
#define ID_INNER7CHOICE 1032
#define ID_INNER8NAME 1033
#define ID_INNER8CHECKBOX 1034
#define ID_INNER8CHOICE 1035
#define ID_INNER9NAME 1036
#define ID_INNER9CHECKBOX 1037
#define ID_INNER9CHOICE 1038
#define ID_INNER10NAME 1039
#define ID_INNER10CHECKBOX 1040
#define ID_INNER10CHOICE 1041
#define ID_INNER11NAME 1042
#define ID_INNER11CHECKBOX 1043
#define ID_INNER11CHOICE 1044
#define ID_INNER12NAME 1045
#define ID_INNER12CHECKBOX 1046
#define ID_INNER12CHOICE 1047
#define ID_INNER13NAME 1048
#define ID_INNER13CHECKBOX 1049
#define ID_INNER13CHOICE 1050
#define ID_INNER14NAME 1051
#define ID_INNER14CHECKBOX 1052
#define ID_INNER14CHOICE 1053
#define ID_INNER15NAME 1054
#define ID_INNER15CHECKBOX 1055
#define ID_INNER15CHOICE 1056
#define ID_BACKNAME 1057
#define ID_BACKCHECKBOX 1058
#define ID_BACKCHOICE 1059
#define ID_MASKBACKNAME 1060
#define ID_MASKBACKCHECKBOX 1061
#define ID_MASKBACKCHOICE 1062
#define ID_SILKSBACKNAME 1063
#define ID_SILKSBACKCHECKBOX 1064
#define ID_SILKSBACKCHOICE 1065
#define ID_SOLDPBACKNAME 1066
#define ID_SOLDPBACKCHECKBOX 1067
#define ID_SOLDPBACKCHOICE 1068
#define ID_ADHESBACKNAME 1069
#define ID_ADHESBACKCHECKBOX 1070
#define ID_ADHESBACKCHOICE 1071
#define ID_PCBEDGESNAME 1072
#define ID_PCBEDGESCHECKBOX 1073
#define ID_PCBEDGESCHOICE 1074
#define ID_ECO2NAME 1075
#define ID_ECO2CHECKBOX 1076
#define ID_ECO2CHOICE 1077
#define ID_ECO1NAME 1078
#define ID_ECO1CHECKBOX 1079
#define ID_ECO1CHOICE 1080
#define ID_COMMENTSNAME 1081
#define ID_COMMENTSCHECKBOX 1082
#define ID_COMMENTSCHOICE 1083
#define ID_DRAWINGSNAME 1084
#define ID_DRAWINGSCHECKBOX 1085
#define ID_DRAWINGSCHOICE 1086
#define ID_IN1NAME 1015
#define ID_IN1CHECKBOX 1016
#define ID_IN1CHOICE 1017
#define ID_IN2NAME 1018
#define ID_IN2CHECKBOX 1019
#define ID_IN2CHOICE 1020
#define ID_IN3NAME 1021
#define ID_IN3CHECKBOX 1022
#define ID_IN3CHOICE 1023
#define ID_IN4NAME 1024
#define ID_IN4CHECKBOX 1025
#define ID_IN4CHOICE 1026
#define ID_IN5NAME 1027
#define ID_IN5CHECKBOX 1028
#define ID_IN5CHOICE 1029
#define ID_IN6NAME 1030
#define ID_IN6CHECKBOX 1031
#define ID_IN6CHOICE 1032
#define ID_IN7NAME 1033
#define ID_IN7CHECKBOX 1034
#define ID_IN7CHOICE 1035
#define ID_IN8NAME 1036
#define ID_IN8CHECKBOX 1037
#define ID_IN8CHOICE 1038
#define ID_IN9NAME 1039
#define ID_IN9CHECKBOX 1040
#define ID_IN9CHOICE 1041
#define ID_IN10NAME 1042
#define ID_IN10CHECKBOX 1043
#define ID_IN10CHOICE 1044
#define ID_IN11NAME 1045
#define ID_IN11CHECKBOX 1046
#define ID_IN11CHOICE 1047
#define ID_IN12NAME 1048
#define ID_IN12CHECKBOX 1049
#define ID_IN12CHOICE 1050
#define ID_IN13NAME 1051
#define ID_IN13CHECKBOX 1052
#define ID_IN13CHOICE 1053
#define ID_IN14NAME 1054
#define ID_IN14CHECKBOX 1055
#define ID_IN14CHOICE 1056
#define ID_IN15NAME 1057
#define ID_IN15CHECKBOX 1058
#define ID_IN15CHOICE 1059
#define ID_IN16NAME 1060
#define ID_IN16CHECKBOX 1061
#define ID_IN16CHOICE 1062
#define ID_IN17NAME 1063
#define ID_IN17CHECKBOX 1064
#define ID_IN17CHOICE 1065
#define ID_IN18NAME 1066
#define ID_IN18CHECKBOX 1067
#define ID_IN18CHOICE 1068
#define ID_IN19NAME 1069
#define ID_IN19CHECKBOX 1070
#define ID_IN19CHOICE 1071
#define ID_IN20NAME 1072
#define ID_IN20CHECKBOX 1073
#define ID_IN20CHOICE 1074
#define ID_IN21NAME 1075
#define ID_IN21CHECKBOX 1076
#define ID_IN21CHOICE 1077
#define ID_IN22NAME 1078
#define ID_IN22CHECKBOX 1079
#define ID_IN22CHOICE 1080
#define ID_IN23NAME 1081
#define ID_IN23CHECKBOX 1082
#define ID_IN24NAME 1083
#define ID_IN24CHECKBOX 1084
#define ID_IN24CHOICE 1085
#define ID_IN25NAME 1086
#define ID_IN25CHECKBOX 1087
#define ID_IN25CHOICE 1088
#define ID_IN26NAME 1089
#define ID_IN26CHECKBOX 1090
#define ID_IN26CHOICE 1091
#define ID_IN27NAME 1092
#define ID_IN27CHECKBOX 1093
#define ID_IN27CHOICE 1094
#define ID_IN28NAME 1095
#define ID_IN28CHECKBOX 1096
#define ID_IN28CHOICE 1097
#define ID_IN29NAME 1098
#define ID_IN29CHECKBOX 1099
#define ID_IN29CHOICE 1100
#define ID_IN30NAME 1101
#define ID_IN30CHECKBOX 1102
#define ID_IN30CHOICE 1103
#define ID_BACKNAME 1104
#define ID_BACKCHECKBOX 1105
#define ID_BACKCHOICE 1106
#define ID_MASKBACKNAME 1107
#define ID_MASKBACKCHECKBOX 1108
#define ID_MASKBACKCHOICE 1109
#define ID_SILKSBACKNAME 1110
#define ID_SILKSBACKCHECKBOX 1111
#define ID_SILKSBACKCHOICE 1112
#define ID_SOLDPBACKNAME 1113
#define ID_SOLDPBACKCHECKBOX 1114
#define ID_SOLDPBACKCHOICE 1115
#define ID_ADHESBACKNAME 1116
#define ID_ADHESBACKCHECKBOX 1117
#define ID_ADHESBACKCHOICE 1118
#define ID_PCBEDGESNAME 1119
#define ID_PCBEDGESCHECKBOX 1120
#define ID_PCBEDGESCHOICE 1121
#define ID_MARGINNAME 1122
#define ID_MARGINCHECKBOX 1123
#define ID_ECO2CHOICE 1124
#define ID_ECO2NAME 1125
#define ID_ECO2CHECKBOX 1126
#define ID_ECO1NAME 1127
#define ID_ECO1CHECKBOX 1128
#define ID_ECO1CHOICE 1129
#define ID_COMMENTSNAME 1130
#define ID_COMMENTSCHECKBOX 1131
#define ID_COMMENTSCHOICE 1132
#define ID_DRAWINGSNAME 1133
#define ID_DRAWINGSCHECKBOX 1134
#define ID_DRAWINGSCHOICE 1135
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_LAYERS_SETUP_BASE
@ -155,62 +204,126 @@ class DIALOG_LAYERS_SETUP_BASE : public DIALOG_SHIM
wxPanel* m_FrontPanel;
wxCheckBox* m_FrontCheckBox;
wxChoice* m_FrontChoice;
wxTextCtrl* m_Inner2Name;
wxPanel* m_Inner2Panel;
wxCheckBox* m_Inner2CheckBox;
wxChoice* m_Inner2Choice;
wxTextCtrl* m_Inner3Name;
wxPanel* m_Inner3Panel;
wxCheckBox* m_Inner3CheckBox;
wxChoice* m_Inner3Choice;
wxTextCtrl* m_Inner4Name;
wxPanel* m_Inner4Panel;
wxCheckBox* m_Inner4CheckBox;
wxChoice* m_Inner4Choice;
wxTextCtrl* m_Inner5Name;
wxPanel* m_Inner5Panel;
wxCheckBox* m_Inner5CheckBox;
wxChoice* m_Inner5Choice;
wxTextCtrl* m_Inner6Name;
wxPanel* m_Inner6Panel;
wxCheckBox* m_Inner6CheckBox;
wxChoice* m_Inner6Choice;
wxTextCtrl* m_Inner7Name;
wxPanel* m_Inner7Panel;
wxCheckBox* m_Inner7CheckBox;
wxChoice* m_Inner7Choice;
wxTextCtrl* m_Inner8Name;
wxPanel* m_Inner8Panel;
wxCheckBox* m_Inner8CheckBox;
wxChoice* m_Inner8Choice;
wxTextCtrl* m_Inner9Name;
wxPanel* m_Inner9Panel;
wxCheckBox* m_Inner9CheckBox;
wxChoice* m_Inner9Choice;
wxTextCtrl* m_Inner10Name;
wxPanel* m_Inner10Panel;
wxCheckBox* m_Inner10CheckBox;
wxChoice* m_Inner10Choice;
wxTextCtrl* m_Inner11Name;
wxPanel* m_Inner11Panel;
wxCheckBox* m_Inner11CheckBox;
wxChoice* m_Inner11Choice;
wxTextCtrl* m_Inner12Name;
wxPanel* m_Inner12Panel;
wxCheckBox* m_Inner12CheckBox;
wxChoice* m_Inner12Choice;
wxTextCtrl* m_Inner13Name;
wxPanel* m_Inner13Panel;
wxCheckBox* m_Inner13CheckBox;
wxChoice* m_Inner13Choice;
wxTextCtrl* m_Inner14Name;
wxPanel* m_Inner14Panel;
wxCheckBox* m_Inner14CheckBox;
wxChoice* m_Inner14Choice;
wxTextCtrl* m_Inner15Name;
wxPanel* m_Inner15Panel;
wxCheckBox* m_Inner15CheckBox;
wxChoice* m_Inner15Choice;
wxTextCtrl* m_In1Name;
wxPanel* m_In1Panel;
wxCheckBox* m_In1CheckBox;
wxChoice* m_In1Choice;
wxTextCtrl* m_In2Name;
wxPanel* m_In2Panel;
wxCheckBox* m_In2CheckBox;
wxChoice* m_In2Choice;
wxTextCtrl* m_In3Name;
wxPanel* m_In3Panel;
wxCheckBox* m_In3CheckBox;
wxChoice* m_In3Choice;
wxTextCtrl* m_In4Name;
wxPanel* m_In4Panel;
wxCheckBox* m_In4CheckBox;
wxChoice* m_In4Choice;
wxTextCtrl* m_In5Name;
wxPanel* m_In5Panel;
wxCheckBox* m_In5CheckBox;
wxChoice* m_In5Choice;
wxTextCtrl* m_In6Name;
wxPanel* m_In6Panel;
wxCheckBox* m_In6CheckBox;
wxChoice* m_In6Choice;
wxTextCtrl* m_In7Name;
wxPanel* m_In7Panel;
wxCheckBox* m_In7CheckBox;
wxChoice* m_In7Choice;
wxTextCtrl* m_In8Name;
wxPanel* m_In8Panel;
wxCheckBox* m_In8CheckBox;
wxChoice* m_In8Choice;
wxTextCtrl* m_In9Name;
wxPanel* m_In9Panel;
wxCheckBox* m_In9CheckBox;
wxChoice* m_In9Choice;
wxTextCtrl* m_In10Name;
wxPanel* m_In10Panel;
wxCheckBox* m_In10CheckBox;
wxChoice* m_In10Choice;
wxTextCtrl* m_In11Name;
wxPanel* m_In11Panel;
wxCheckBox* m_In11CheckBox;
wxChoice* m_In11Choice;
wxTextCtrl* m_In12Name;
wxPanel* m_In12Panel;
wxCheckBox* m_In12CheckBox;
wxChoice* m_In12Choice;
wxTextCtrl* m_In13Name;
wxPanel* m_In13Panel;
wxCheckBox* m_In13CheckBox;
wxChoice* m_In13Choice;
wxTextCtrl* m_In14Name;
wxPanel* m_In14Panel;
wxCheckBox* m_In14CheckBox;
wxChoice* m_In14Choice;
wxTextCtrl* m_In15Name;
wxPanel* m_In15Panel;
wxCheckBox* m_In15CheckBox;
wxChoice* m_In15Choice;
wxTextCtrl* m_In16Name;
wxPanel* m_In16Panel;
wxCheckBox* m_In16CheckBox;
wxChoice* m_In16Choice;
wxTextCtrl* m_In17Name;
wxPanel* m_In17Panel;
wxCheckBox* m_In17CheckBox;
wxChoice* m_In17Choice;
wxTextCtrl* m_In18Name;
wxPanel* m_In18Panel;
wxCheckBox* m_In18CheckBox;
wxChoice* m_In18Choice;
wxTextCtrl* m_In19Name;
wxPanel* m_In19Panel;
wxCheckBox* m_In19CheckBox;
wxChoice* m_In19Choice;
wxTextCtrl* m_In20Name;
wxPanel* m_In20Panel;
wxCheckBox* m_In20CheckBox;
wxChoice* m_In20Choice;
wxTextCtrl* m_In21Name;
wxPanel* m_In21Panel;
wxCheckBox* m_In21CheckBox;
wxChoice* m_In21Choice;
wxTextCtrl* m_In22Name;
wxPanel* m_In22Panel;
wxCheckBox* m_In22CheckBox;
wxChoice* m_In22Choice;
wxTextCtrl* m_In23Name;
wxPanel* m_In23Panel;
wxCheckBox* m_In23CheckBox;
wxChoice* m_In23Choice;
wxTextCtrl* m_In24Name;
wxPanel* m_In24Panel;
wxCheckBox* m_In24CheckBox;
wxChoice* m_In24Choice;
wxTextCtrl* m_In25Name;
wxPanel* m_In25Panel;
wxCheckBox* m_In25CheckBox;
wxChoice* m_In25Choice;
wxTextCtrl* m_In26Name;
wxPanel* m_In26Panel;
wxCheckBox* m_In26CheckBox;
wxChoice* m_In26Choice;
wxTextCtrl* m_In27Name;
wxPanel* m_In27Panel;
wxCheckBox* m_In27CheckBox;
wxChoice* m_In27Choice;
wxTextCtrl* m_In28Name;
wxPanel* m_In28Panel;
wxCheckBox* m_In28CheckBox;
wxChoice* m_In28Choice;
wxTextCtrl* m_In29Name;
wxPanel* m_In29Panel;
wxCheckBox* m_In29CheckBox;
wxChoice* m_In29Choice;
wxTextCtrl* m_In30Name;
wxPanel* m_In30Panel;
wxCheckBox* m_In30CheckBox;
wxChoice* m_In30Choice;
wxTextCtrl* m_BackName;
wxPanel* m_BackPanel;
wxCheckBox* m_BackCheckBox;
@ -235,6 +348,10 @@ class DIALOG_LAYERS_SETUP_BASE : public DIALOG_SHIM
wxPanel* m_PCBEdgesPanel;
wxCheckBox* m_PCBEdgesCheckBox;
wxStaticText* m_PCBEdgesStaticText;
wxStaticText* m_MarginName;
wxPanel* m_MarginPanel;
wxCheckBox* m_MarginCheckBox;
wxStaticText* m_MarginStaticText;
wxStaticText* m_Eco1Name;
wxPanel* m_Eco1Panel;
wxCheckBox* m_Eco1CheckBox;

View File

@ -51,32 +51,35 @@
// list of pad shapes.
static PAD_SHAPE_T CodeShape[] = {
PAD_CIRCLE, PAD_OVAL, PAD_RECT, PAD_TRAPEZOID
static PAD_SHAPE_T code_shape[] = {
PAD_CIRCLE,
PAD_OVAL,
PAD_RECT,
PAD_TRAPEZOID
};
static PAD_ATTR_T CodeType[] = {
PAD_STANDARD, PAD_SMD, PAD_CONN, PAD_HOLE_NOT_PLATED
static PAD_ATTR_T code_type[] = {
PAD_STANDARD,
PAD_SMD,
PAD_CONN,
PAD_HOLE_NOT_PLATED
};
#define NBTYPES DIM(CodeType)
// Default mask layers setup for pads according to the pad type
static const LAYER_MSK Std_Pad_Layers[] = {
static const LSET std_pad_layers[] = {
// PAD_STANDARD:
PAD_STANDARD_DEFAULT_LAYERS,
D_PAD::StandardMask(),
// PAD_CONN:
PAD_CONN_DEFAULT_LAYERS,
D_PAD::ConnMask(),
// PAD_SMD:
PAD_SMD_DEFAULT_LAYERS,
D_PAD::SMDMask(),
// PAD_HOLE_NOT_PLATED:
PAD_HOLE_NOT_PLATED_DEFAULT_LAYERS
D_PAD::UnplatedHoleMask()
};
@ -119,7 +122,7 @@ private:
* updates the CheckBox states in pad layers list,
* @param layer_mask = pad layer mask (ORed layers bit mask)
*/
void setPadLayersList( LAYER_MSK layer_mask );
void setPadLayersList( LSET layer_mask );
/// Copy values from dialog field to aPad's members
bool transferDataToPad( D_PAD* aPad );
@ -188,12 +191,12 @@ void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
EDA_COLOR_T color = BLACK;
if( m_dummyPad->GetLayerMask() & LAYER_FRONT )
if( m_dummyPad->GetLayerSet()[F_Cu] )
{
color = m_board->GetVisibleElementColor( PAD_FR_VISIBLE );
}
if( m_dummyPad->GetLayerMask() & LAYER_BACK )
if( m_dummyPad->GetLayerSet()[B_Cu] )
{
color = ColorMix( color, m_board->GetVisibleElementColor( PAD_BK_VISIBLE ) );
}
@ -262,20 +265,20 @@ void DIALOG_PAD_PROPERTIES::initValues()
// Setup layers names from board
// Should be made first, before calling m_rbCopperLayersSel->SetSelection()
m_rbCopperLayersSel->SetString( 0, m_board->GetLayerName( LAYER_N_FRONT ) );
m_rbCopperLayersSel->SetString( 1, m_board->GetLayerName( LAYER_N_BACK ) );
m_rbCopperLayersSel->SetString( 0, m_board->GetLayerName( F_Cu ) );
m_rbCopperLayersSel->SetString( 1, m_board->GetLayerName( B_Cu ) );
m_PadLayerAdhCmp->SetLabel( m_board->GetLayerName( ADHESIVE_N_FRONT ) );
m_PadLayerAdhCu->SetLabel( m_board->GetLayerName( ADHESIVE_N_BACK ) );
m_PadLayerPateCmp->SetLabel( m_board->GetLayerName( SOLDERPASTE_N_FRONT ) );
m_PadLayerPateCu->SetLabel( m_board->GetLayerName( SOLDERPASTE_N_BACK ) );
m_PadLayerSilkCmp->SetLabel( m_board->GetLayerName( SILKSCREEN_N_FRONT ) );
m_PadLayerSilkCu->SetLabel( m_board->GetLayerName( SILKSCREEN_N_BACK ) );
m_PadLayerMaskCmp->SetLabel( m_board->GetLayerName( SOLDERMASK_N_FRONT ) );
m_PadLayerMaskCu->SetLabel( m_board->GetLayerName( SOLDERMASK_N_BACK ) );
m_PadLayerECO1->SetLabel( m_board->GetLayerName( ECO1_N ) );
m_PadLayerECO2->SetLabel( m_board->GetLayerName( ECO2_N ) );
m_PadLayerDraft->SetLabel( m_board->GetLayerName( DRAW_N ) );
m_PadLayerAdhCmp->SetLabel( m_board->GetLayerName( F_Adhes ) );
m_PadLayerAdhCu->SetLabel( m_board->GetLayerName( B_Adhes ) );
m_PadLayerPateCmp->SetLabel( m_board->GetLayerName( F_Paste ) );
m_PadLayerPateCu->SetLabel( m_board->GetLayerName( B_Paste ) );
m_PadLayerSilkCmp->SetLabel( m_board->GetLayerName( F_SilkS ) );
m_PadLayerSilkCu->SetLabel( m_board->GetLayerName( B_SilkS ) );
m_PadLayerMaskCmp->SetLabel( m_board->GetLayerName( F_Mask ) );
m_PadLayerMaskCu->SetLabel( m_board->GetLayerName( B_Mask ) );
m_PadLayerECO1->SetLabel( m_board->GetLayerName( Eco1_User ) );
m_PadLayerECO2->SetLabel( m_board->GetLayerName( Eco2_User ) );
m_PadLayerDraft->SetLabel( m_board->GetLayerName( Dwgs_User ) );
m_isFlipped = false;
@ -283,7 +286,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
{
MODULE* module = m_currentPad->GetParent();
if( module->GetLayer() == LAYER_N_BACK )
if( module->GetLayer() == B_Cu )
{
m_isFlipped = true;
m_staticModuleSideValue->SetLabel( _( "Back side (footprint is mirrored)" ) );
@ -304,7 +307,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
m_dummyPad->SetDelta( sz );
// flip pad's layers
m_dummyPad->SetLayerMask( FlipLayerMask( m_dummyPad->GetLayerMask() ) );
m_dummyPad->SetLayerSet( FlipLayerMask( m_dummyPad->GetLayerSet() ) );
}
m_staticTextWarningPadFlipped->Show(m_isFlipped);
@ -413,7 +416,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
NORMALIZE_ANGLE_180( angle ); // ? normalizing is in D_PAD::SetOrientation()
// Set layers used by this pad: :
setPadLayersList( m_dummyPad->GetLayerMask() );
setPadLayersList( m_dummyPad->GetLayerSet() );
// Pad Orient
switch( int( angle ) )
@ -466,9 +469,9 @@ void DIALOG_PAD_PROPERTIES::initValues()
// Type of pad selection
m_PadType->SetSelection( 0 );
for( unsigned ii = 0; ii < NBTYPES; ii++ )
for( unsigned ii = 0; ii < DIM( code_type ); ii++ )
{
if( CodeType[ii] == m_dummyPad->GetAttribute() )
if( code_type[ii] == m_dummyPad->GetAttribute() )
{
m_PadType->SetSelection( ii );
break;
@ -490,7 +493,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
// Update some dialog widgets state (Enable/disable options):
wxCommandEvent cmd_event;
setPadLayersList( m_dummyPad->GetLayerMask() );
setPadLayersList( m_dummyPad->GetLayerSet() );
OnDrillShapeSelected( cmd_event );
OnPadShapeSelection( cmd_event );
}
@ -604,17 +607,17 @@ void DIALOG_PAD_PROPERTIES::PadTypeSelected( wxCommandEvent& event )
{
unsigned ii = m_PadType->GetSelection();
if( ii >= NBTYPES ) // catches < 0 also
if( ii >= DIM( code_type ) ) // catches < 0 also
ii = 0;
LAYER_MSK layer_mask = Std_Pad_Layers[ii];
LSET layer_mask = std_pad_layers[ii];
setPadLayersList( layer_mask );
// Enable/disable drill dialog items:
event.SetId( m_DrillShapeCtrl->GetSelection() );
OnDrillShapeSelected( event );
if( ii == 0 || ii == NBTYPES-1 )
if( ii == 0 || ii == DIM( code_type )-1 )
m_DrillShapeCtrl->Enable( true );
else
m_DrillShapeCtrl->Enable( false );
@ -628,33 +631,35 @@ void DIALOG_PAD_PROPERTIES::PadTypeSelected( wxCommandEvent& event )
}
void DIALOG_PAD_PROPERTIES::setPadLayersList( LAYER_MSK layer_mask )
void DIALOG_PAD_PROPERTIES::setPadLayersList( LSET layer_mask )
{
if( ( layer_mask & ALL_CU_LAYERS ) == LAYER_FRONT )
LSET cu_set = layer_mask & LSET::AllCuMask();
if( cu_set == LSET( F_Cu ) )
m_rbCopperLayersSel->SetSelection(0);
else if( ( layer_mask & ALL_CU_LAYERS ) == LAYER_BACK)
else if( cu_set == LSET( B_Cu ) )
m_rbCopperLayersSel->SetSelection(1);
else if( ( layer_mask & ALL_CU_LAYERS ) != 0 )
else if( cu_set.any() )
m_rbCopperLayersSel->SetSelection(2);
else
m_rbCopperLayersSel->SetSelection(3);
m_PadLayerAdhCmp->SetValue( bool( layer_mask & ADHESIVE_LAYER_FRONT ) );
m_PadLayerAdhCu->SetValue( bool( layer_mask & ADHESIVE_LAYER_BACK ) );
m_PadLayerAdhCmp->SetValue( layer_mask[F_Adhes] );
m_PadLayerAdhCu->SetValue( layer_mask[B_Adhes] );
m_PadLayerPateCmp->SetValue( bool( layer_mask & SOLDERPASTE_LAYER_FRONT ) );
m_PadLayerPateCu->SetValue( bool( layer_mask & SOLDERPASTE_LAYER_BACK ) );
m_PadLayerPateCmp->SetValue( layer_mask[F_Paste] );
m_PadLayerPateCu->SetValue( layer_mask[B_Paste] );
m_PadLayerSilkCmp->SetValue( bool( layer_mask & SILKSCREEN_LAYER_FRONT ) );
m_PadLayerSilkCu->SetValue( bool( layer_mask & SILKSCREEN_LAYER_BACK ) );
m_PadLayerSilkCmp->SetValue( layer_mask[F_SilkS] );
m_PadLayerSilkCu->SetValue( layer_mask[B_SilkS] );
m_PadLayerMaskCmp->SetValue( bool( layer_mask & SOLDERMASK_LAYER_FRONT ) );
m_PadLayerMaskCu->SetValue( bool( layer_mask & SOLDERMASK_LAYER_BACK ) );
m_PadLayerMaskCmp->SetValue( layer_mask[F_Mask] );
m_PadLayerMaskCu->SetValue( layer_mask[B_Mask] );
m_PadLayerECO1->SetValue( bool( layer_mask & ECO1_LAYER ) );
m_PadLayerECO2->SetValue( bool( layer_mask & ECO2_LAYER ) );
m_PadLayerECO1->SetValue( layer_mask[Eco1_User] );
m_PadLayerECO2->SetValue( layer_mask[Eco2_User] );
m_PadLayerDraft->SetValue( bool( layer_mask & DRAW_LAYER ) );
m_PadLayerDraft->SetValue( layer_mask[Dwgs_User] );
}
@ -681,12 +686,12 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK()
error_msgs.Add( _( "Incorrect value for pad drill: pad drill bigger than pad size" ) );
}
LAYER_MSK padlayers_mask = m_dummyPad->GetLayerMask();
LSET padlayers_mask = m_dummyPad->GetLayerSet();
if( padlayers_mask == 0 )
error_msgs.Add( _( "Error: pad has no layer" ) );
if( ( padlayers_mask & (LAYER_BACK | LAYER_FRONT) ) == 0 )
if( !padlayers_mask[F_Cu] && !padlayers_mask[B_Cu] )
{
if( m_dummyPad->GetDrillSize().x || m_dummyPad->GetDrillSize().y )
{
@ -731,13 +736,13 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK()
break;
case PAD_CONN: // Connector pads are smd pads, just they do not have solder paste.
if( (padlayers_mask & SOLDERPASTE_LAYER_BACK) ||
(padlayers_mask & SOLDERPASTE_LAYER_FRONT) )
if( padlayers_mask[B_Paste] || padlayers_mask[F_Paste] )
error_msgs.Add( _( "Error: Connector pads are not on the solder paste layer\n"
"Use SMD pads instead" ) );
// Fall trough
case PAD_SMD: // SMD and Connector pads (One external copper layer only)
if( (padlayers_mask & LAYER_BACK) && (padlayers_mask & LAYER_FRONT) )
if( padlayers_mask[B_Cu] && padlayers_mask[F_Cu] )
error_msgs.Add( _( "Error: only one copper layer allowed for SMD or Connector pads" ) );
break;
}
@ -813,14 +818,14 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
m_currentPad->SetPadToDieLength( m_padMaster->GetPadToDieLength() );
if( m_currentPad->GetLayerMask() != m_padMaster->GetLayerMask() )
if( m_currentPad->GetLayerSet() != m_padMaster->GetLayerSet() )
{
rastnestIsChanged = true;
m_currentPad->SetLayerMask( m_padMaster->GetLayerMask() );
m_currentPad->SetLayerSet( m_padMaster->GetLayerSet() );
}
if( m_isFlipped )
m_currentPad->SetLayerMask( FlipLayerMask( m_currentPad->GetLayerMask() ) );
m_currentPad->SetLayerSet( FlipLayerMask( m_currentPad->GetLayerSet() ) );
m_currentPad->SetPadName( m_padMaster->GetPadName() );
@ -873,8 +878,8 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad )
wxString msg;
int x, y;
aPad->SetAttribute( CodeType[m_PadType->GetSelection()] );
aPad->SetShape( CodeShape[m_PadShape->GetSelection()] );
aPad->SetAttribute( code_type[m_PadType->GetSelection()] );
aPad->SetShape( code_shape[m_PadShape->GetSelection()] );
// Read pad clearances values:
aPad->SetLocalClearance( ValueFromTextCtrl( *m_NetClearanceValueCtrl ) );
@ -1063,20 +1068,20 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad )
break;
}
LAYER_MSK padLayerMask = NO_LAYERS;
LSET padLayerMask;
switch( m_rbCopperLayersSel->GetSelection() )
{
case 0:
padLayerMask |= LAYER_FRONT;
padLayerMask.set( F_Cu );
break;
case 1:
padLayerMask |= LAYER_BACK;
padLayerMask.set( B_Cu );
break;
case 2:
padLayerMask |= ALL_CU_LAYERS;
padLayerMask |= LSET::AllCuMask();
break;
case 3: // No copper layers
@ -1084,29 +1089,39 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad )
}
if( m_PadLayerAdhCmp->GetValue() )
padLayerMask |= ADHESIVE_LAYER_FRONT;
if( m_PadLayerAdhCu->GetValue() )
padLayerMask |= ADHESIVE_LAYER_BACK;
if( m_PadLayerPateCmp->GetValue() )
padLayerMask |= SOLDERPASTE_LAYER_FRONT;
if( m_PadLayerPateCu->GetValue() )
padLayerMask |= SOLDERPASTE_LAYER_BACK;
if( m_PadLayerSilkCmp->GetValue() )
padLayerMask |= SILKSCREEN_LAYER_FRONT;
if( m_PadLayerSilkCu->GetValue() )
padLayerMask |= SILKSCREEN_LAYER_BACK;
if( m_PadLayerMaskCmp->GetValue() )
padLayerMask |= SOLDERMASK_LAYER_FRONT;
if( m_PadLayerMaskCu->GetValue() )
padLayerMask |= SOLDERMASK_LAYER_BACK;
if( m_PadLayerECO1->GetValue() )
padLayerMask |= ECO1_LAYER;
if( m_PadLayerECO2->GetValue() )
padLayerMask |= ECO2_LAYER;
if( m_PadLayerDraft->GetValue() )
padLayerMask |= DRAW_LAYER;
padLayerMask.set( F_Adhes );
aPad->SetLayerMask( padLayerMask );
if( m_PadLayerAdhCu->GetValue() )
padLayerMask.set( B_Adhes );
if( m_PadLayerPateCmp->GetValue() )
padLayerMask.set( F_Paste );
if( m_PadLayerPateCu->GetValue() )
padLayerMask.set( B_Paste );
if( m_PadLayerSilkCmp->GetValue() )
padLayerMask.set( F_SilkS );
if( m_PadLayerSilkCu->GetValue() )
padLayerMask.set( B_SilkS );
if( m_PadLayerMaskCmp->GetValue() )
padLayerMask.set( F_Mask );
if( m_PadLayerMaskCu->GetValue() )
padLayerMask.set( B_Mask );
if( m_PadLayerECO1->GetValue() )
padLayerMask.set( Eco1_User );
if( m_PadLayerECO2->GetValue() )
padLayerMask.set( Eco2_User );
if( m_PadLayerDraft->GetValue() )
padLayerMask.set( Dwgs_User );
aPad->SetLayerSet( padLayerMask );
return error;
}

View File

@ -128,8 +128,9 @@ void DIALOG_PCB_TEXT_PROPERTIES::MyInit()
// Configure the layers list selector
m_LayerSelectionCtrl->SetLayersHotkeys( false );
// A text has no sense on edge cut layer
m_LayerSelectionCtrl->SetLayerMask( EDGE_LAYER );
m_LayerSelectionCtrl->SetLayerSet( Edge_Cuts );
m_LayerSelectionCtrl->SetBoardFrame( m_Parent );
m_LayerSelectionCtrl->Resync();
m_LayerSelectionCtrl->SetLayerSelection( m_SelectedPCBText->GetLayer() );
@ -249,7 +250,7 @@ void DIALOG_PCB_TEXT_PROPERTIES::OnOkClick( wxCommandEvent& event )
}
// Set the layer on which the PCB text is laying
m_SelectedPCBText->SetLayer( m_LayerSelectionCtrl->GetLayerSelection() );
m_SelectedPCBText->SetLayer( (LAYER_ID) m_LayerSelectionCtrl->GetLayerSelection() );
// Set whether the PCB text is mirrored (faced down from layer face perspective)
m_SelectedPCBText->SetMirrored( m_DisplayCtrl->GetSelection() == 1 );

View File

@ -146,25 +146,18 @@ void DIALOG_PLOT::Init_Dialog()
m_plotPSNegativeOpt->SetValue( m_plotOpts.GetNegative() );
m_forcePSA4OutputOpt->SetValue( m_plotOpts.GetA4Output() );
// List layers in same order than in setup layers dialog
// (Front or Top to Back or Bottom)
DECLARE_LAYERS_ORDER_LIST( layersOrder );
int layerIndex, checkIndex;
LAYER_NUM layer;
// Could devote a PlotOrder() function in place of UIOrder().
m_layerList = m_board->GetEnabledLayers().UIOrder();
for( layerIndex = 0; layerIndex < NB_LAYERS; layerIndex++ )
for( LSEQ seq = m_layerList; seq; ++seq )
{
layer = layersOrder[layerIndex];
wxASSERT( layer < NB_LAYERS );
if( !m_board->IsLayerEnabled( layer ) )
continue;
LAYER_ID layer = *seq;
m_layerList.push_back( layer );
checkIndex = m_layerCheckListBox->Append( m_board->GetLayerName( layer ) );
if( m_plotOpts.GetLayerSelection() & GetLayerMask( layer ) )
int checkIndex = m_layerCheckListBox->Append( m_board->GetLayerName( layer ) );
if( m_plotOpts.GetLayerSelection()[layer] )
m_layerCheckListBox->Check( checkIndex );
}
@ -243,30 +236,28 @@ void DIALOG_PLOT::OnPopUpLayers( wxCommandEvent& event )
case ID_LAYER_FAB: // Select layers usually needed to build a board
for( i = 0; i < m_layerList.size(); i++ )
{
LAYER_MSK layermask = GetLayerMask( m_layerList[ i ] );
if( layermask & ( ALL_CU_LAYERS | ALL_TECH_LAYERS ) )
LSET layermask( m_layerList[ i ] );
if( ( layermask & ( LSET::AllCuMask() | LSET::AllTechMask() ) ).any() )
m_layerCheckListBox->Check( i, true );
else
m_layerCheckListBox->Check( i, false );
}
break;
case ID_SELECT_COPPER_LAYERS:
for( i = 0; i < m_layerList.size(); i++ )
{
if( m_layerList[i] <= LAST_COPPER_LAYER )
if( IsCopperLayer( m_layerList[i] ) )
m_layerCheckListBox->Check( i, true );
}
break;
case ID_DESELECT_COPPER_LAYERS:
for( i = 0; i < m_layerList.size(); i++ )
{
if( m_layerList[i] <= LAST_COPPER_LAYER )
if( IsCopperLayer( m_layerList[i] ) )
m_layerCheckListBox->Check( i, false );
}
break;
@ -669,13 +660,12 @@ void DIALOG_PLOT::applyPlotSettings()
tempOptions.SetFormat( GetPlotFormat() );
long selectedLayers = 0;
unsigned int i;
LSET selectedLayers;
for( i = 0; i < m_layerList.size(); i++ )
for( unsigned i = 0; i < m_layerList.size(); i++ )
{
if( m_layerCheckListBox->IsChecked( i ) )
selectedLayers |= GetLayerMask( m_layerList[i] );
selectedLayers.set( m_layerList[i] );
}
tempOptions.SetLayerSelection( selectedLayers );
@ -773,17 +763,16 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
wxBusyCursor dummy;
for( LAYER_NUM layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer )
{
if( m_plotOpts.GetLayerSelection() & GetLayerMask( layer ) )
for( LSEQ seq = m_plotOpts.GetLayerSelection().UIOrder(); seq; ++seq )
{
LAYER_ID layer = *seq;
// Pick the basename from the board file
wxFileName fn( boardFilename );
// Use Gerber Extensions based on layer number
// (See http://en.wikipedia.org/wiki/Gerber_File)
if( ( m_plotOpts.GetFormat() == PLOT_FORMAT_GERBER )
&& m_useGerberExtensions->GetValue() )
if( m_plotOpts.GetFormat() == PLOT_FORMAT_GERBER && m_useGerberExtensions->GetValue() )
file_ext = GetGerberExtension( layer );
// Create file name (from the English layer name for non copper layers).
@ -792,10 +781,9 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
file_ext );
LOCALE_IO toggle;
BOARD* board = m_parent->GetBoard();
PLOTTER *plotter = StartPlotBoard( board, &m_plotOpts,
fn.GetFullPath(),
wxEmptyString );
PLOTTER* plotter = StartPlotBoard( board, &m_plotOpts, fn.GetFullPath(), wxEmptyString );
// Print diags in messages box:
wxString msg;
@ -814,10 +802,10 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
msg << wxT( "\n" );
m_messagesBox->AppendText( msg );
}
}
// If no layer selected, we have nothing plotted.
// Prompt user if it happens because he could think there is a bug in Pcbnew.
if( !m_plotOpts.GetLayerSelection() )
if( !m_plotOpts.GetLayerSelection().any() )
DisplayError( this, _( "No layer selected" ) );
}

View File

@ -42,7 +42,7 @@ private:
PCB_EDIT_FRAME* m_parent;
BOARD* m_board;
wxConfigBase* m_config;
std::vector<LAYER_NUM> m_layerList; // List to hold CheckListBox layer numbers
LSEQ m_layerList; // List to hold CheckListBox layer numbers
double m_XScaleAdjust; // X scale factor adjust to compensate
// plotter X scaling error
double m_YScaleAdjust; // X scale factor adjust to compensate

View File

@ -29,7 +29,7 @@
extern int g_DrawDefaultLineThickness;
// Local variables
static LAYER_MSK s_SelectedLayers;
static LSET s_SelectedLayers;
static double s_ScaleList[] =
{ 0, 0.5, 0.7, 0.999, 1.0, 1.4, 2.0, 3.0, 4.0 };
@ -56,14 +56,14 @@ public:
bool IsMirrored() { return m_Print_Mirror->IsChecked(); }
bool ExcludeEdges() { return m_Exclude_Edges_Pcb->IsChecked(); }
bool PrintUsingSinglePage() { return m_PagesOption->GetSelection(); }
int SetLayerMaskFromListSelection();
int SetLayerSetFromListSelection();
private:
PCB_EDIT_FRAME* m_parent;
wxConfigBase* m_config;
wxCheckBox* m_BoxSelectLayer[32];
wxCheckBox* m_BoxSelectLayer[LAYER_ID_COUNT];
static bool m_ExcludeEdgeLayer;
void OnCloseWindow( wxCloseEvent& event );
@ -75,7 +75,7 @@ private:
void OnButtonCancelClick( wxCommandEvent& event ) { Close(); }
void SetPrintParameters( );
void SetPenWidth();
void InitValues( );
void initValues( );
};
@ -127,7 +127,9 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( PCB_EDIT_FRAME* parent )
m_parent = parent;
m_config = Kiface().KifaceSettings();
InitValues( );
memset( m_BoxSelectLayer, 0, sizeof( m_BoxSelectLayer ) );
initValues( );
if( GetSizer() )
{
@ -143,7 +145,7 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( PCB_EDIT_FRAME* parent )
}
void DIALOG_PRINT_USING_PRINTER::InitValues( )
void DIALOG_PRINT_USING_PRINTER::initValues( )
{
wxString msg;
BOARD* board = m_parent->GetBoard();
@ -151,46 +153,32 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
s_Parameters.m_PageSetupData = s_pageSetupData;
// Create layer list.
LAYER_NUM layer;
wxString layerKey;
for( layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer )
LSEQ seq = board->GetEnabledLayers().UIOrder();
for( ; seq; ++seq )
{
if( !board->IsLayerEnabled( layer ) )
m_BoxSelectLayer[layer] = NULL;
else
m_BoxSelectLayer[layer] =
new wxCheckBox( this, -1, board->GetLayerName( layer ) );
}
LAYER_ID layer = *seq;
// Add wxCheckBoxes in layers lists dialog
// List layers in same order than in setup layers dialog
// (Front or Top to Back or Bottom)
DECLARE_LAYERS_ORDER_LIST(layersOrder);
for( LAYER_NUM layer_idx = FIRST_LAYER; layer_idx < NB_PCB_LAYERS; ++layer_idx )
{
layer = layersOrder[layer_idx];
m_BoxSelectLayer[layer] = new wxCheckBox( this, -1, board->GetLayerName( layer ) );
wxASSERT(layer < NB_PCB_LAYERS);
if( m_BoxSelectLayer[layer] == NULL )
continue;
if( layer <= LAST_COPPER_LAYER )
if( IsCopperLayer( layer ) )
m_CopperLayersBoxSizer->Add( m_BoxSelectLayer[layer],
0, wxGROW | wxALL, 1 );
else
m_TechnicalLayersBoxSizer->Add( m_BoxSelectLayer[layer],
0, wxGROW | wxALL, 1 );
layerKey.Printf( OPTKEY_LAYERBASE, layer );
bool option;
if( m_config->Read( layerKey, &option ) )
m_BoxSelectLayer[layer]->SetValue( option );
else
{
LAYER_MSK mask = GetLayerMask( layer );
if( mask & s_SelectedLayers )
if( s_SelectedLayers[layer] )
m_BoxSelectLayer[layer]->SetValue( true );
}
}
@ -220,11 +208,11 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
s_Parameters.m_YScaleAdjust > MAX_SCALE )
s_Parameters.m_XScaleAdjust = s_Parameters.m_YScaleAdjust = 1.0;
s_SelectedLayers = NO_LAYERS;
for( LAYER_NUM layer = FIRST_LAYER; layer< NB_PCB_LAYERS; ++layer )
s_SelectedLayers = LSET();
for( seq.Rewind(); seq; ++seq )
{
if( m_BoxSelectLayer[layer] == NULL )
continue;
LAYER_ID layer = *seq;
wxString layerKey;
bool option;
@ -236,7 +224,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
{
m_BoxSelectLayer[layer]->SetValue( option );
if( option )
s_SelectedLayers |= GetLayerMask( layer );
s_SelectedLayers.set( layer );
}
}
}
@ -277,20 +265,21 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
}
int DIALOG_PRINT_USING_PRINTER::SetLayerMaskFromListSelection()
int DIALOG_PRINT_USING_PRINTER::SetLayerSetFromListSelection()
{
int page_count;
int page_count = 0;
s_Parameters.m_PrintMaskLayer = NO_LAYERS;
LAYER_NUM ii;
for( ii = FIRST_LAYER, page_count = 0; ii < NB_PCB_LAYERS; ++ii )
s_Parameters.m_PrintMaskLayer = LSET();
for( unsigned ii = 0; ii < DIM(m_BoxSelectLayer); ++ii )
{
if( m_BoxSelectLayer[ii] == NULL )
if( !m_BoxSelectLayer[ii] )
continue;
if( m_BoxSelectLayer[ii]->IsChecked() )
{
page_count++;
s_Parameters.m_PrintMaskLayer |= GetLayerMask( ii );
s_Parameters.m_PrintMaskLayer.set( ii );
}
}
@ -323,10 +312,12 @@ void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event )
m_config->Write( OPTKEY_PRINT_PAGE_PER_LAYER, s_Parameters.m_OptionPrintPage );
m_config->Write( OPTKEY_PRINT_PADS_DRILL, (long) s_Parameters.m_DrillShapeOpt );
wxString layerKey;
for( LAYER_NUM layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer )
for( unsigned layer = 0; layer < DIM(m_BoxSelectLayer); ++layer )
{
if( m_BoxSelectLayer[layer] == NULL )
if( !m_BoxSelectLayer[layer] )
continue;
layerKey.Printf( OPTKEY_LAYERBASE, layer );
m_config->Write( layerKey, m_BoxSelectLayer[layer]->IsChecked() );
}
@ -350,7 +341,7 @@ void DIALOG_PRINT_USING_PRINTER::SetPrintParameters( )
if( m_PagesOption )
s_Parameters.m_OptionPrintPage = m_PagesOption->GetSelection() != 0;
SetLayerMaskFromListSelection();
SetLayerSetFromListSelection();
int idx = m_ScaleOption->GetSelection();
s_Parameters.m_PrintScale = s_ScaleList[idx];

View File

@ -135,7 +135,7 @@ DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR( PCB_EDIT_FRAME* aParent,
// Configure the layers list selector
m_SelLayerBox->SetLayersHotkeys( false );
m_SelLayerBox->SetLayerMask( ALL_CU_LAYERS | EDGE_LAYER );
m_SelLayerBox->SetLayerSet( LSET::AllCuMask().set( Edge_Cuts ) );
m_SelLayerBox->SetBoardFrame( m_Parent );
m_SelLayerBox->Resync();
@ -143,7 +143,7 @@ DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR( PCB_EDIT_FRAME* aParent,
{
wxMessageBox( _("This item has an illegal layer id.\n"
"Now, forced on the drawings layer. Please, fix it") );
m_SelLayerBox->SetLayerSelection( DRAW_N );
m_SelLayerBox->SetLayerSelection( Dwgs_User );
}
GetSizer()->Fit( this );
@ -208,7 +208,7 @@ void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event )
CurrentDimension->Text().SetMirrored( ( m_rbMirror->GetSelection() == 1 ) ? true : false );
CurrentDimension->SetLayer( m_SelLayerBox->GetLayerSelection() );
CurrentDimension->SetLayer( (LAYER_ID) m_SelLayerBox->GetLayerSelection() );
#ifndef USE_WX_OVERLAY
if( m_DC ) // Display new text
{

View File

@ -183,7 +183,7 @@ void EraseDragList();
* @param aNetCode = the net code to consider
* @param aMaxDist = max distance from aRefPos to a track end candidate to collect the track
*/
void Collect_TrackSegmentsToDrag( BOARD* aPcb, const wxPoint& aRefPos, LAYER_MSK aLayerMask,
void Collect_TrackSegmentsToDrag( BOARD* aPcb, const wxPoint& aRefPos, LSET aLayerMask,
int aNetCode, int aMaxDist );
/* Add aTrack to the drag list

View File

@ -335,7 +335,7 @@ void AddSegmentToDragList( int flag, TRACK* aTrack )
}
void Collect_TrackSegmentsToDrag( BOARD* aPcb, const wxPoint& aRefPos, LAYER_MSK aLayerMask,
void Collect_TrackSegmentsToDrag( BOARD* aPcb, const wxPoint& aRefPos, LSET aLayerMask,
int aNetCode, int aMaxDist )
{
TRACK* track = aPcb->m_Track->GetStartNetCode( aNetCode );
@ -345,7 +345,7 @@ void Collect_TrackSegmentsToDrag( BOARD* aPcb, const wxPoint& aRefPos, LAYER_MSK
if( track->GetNetCode() != aNetCode ) // not the same netcode: all candidates tested
break;
if( ( aLayerMask & track->GetLayerMask() ) == 0 )
if( ( aLayerMask & track->GetLayerSet() ) == 0 )
continue; // Cannot be connected, not on the same layer
if( track->IsDragging() )
@ -394,7 +394,7 @@ void Collect_TrackSegmentsToDrag( BOARD* aPcb, const wxPoint& aRefPos, LAYER_MSK
// If a connected via is found at location aRefPos,
// collect also tracks connected by this via.
if( track->Type() == PCB_VIA_T )
Collect_TrackSegmentsToDrag( aPcb, aRefPos, track->GetLayerMask(),
Collect_TrackSegmentsToDrag( aPcb, aRefPos, track->GetLayerSet(),
aNetCode, track->GetWidth() / 2 );
}
}

Some files were not shown because too many files have changed in this diff Show More