diff --git a/3d-viewer/3d_draw.cpp b/3d-viewer/3d_draw.cpp index f653ad27da..93f88ebd16 100644 --- a/3d-viewer/3d_draw.cpp +++ b/3d-viewer/3d_draw.cpp @@ -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= 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(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() @@ -713,13 +738,25 @@ void EDA_3D_CANVAS::BuildBoard3DAuxLayers() { const int segcountforcircle = 16; double correctionFactor = 1.0 / cos( M_PI / (segcountforcircle * 2) ); - BOARD* pcb = GetBoard(); + 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; diff --git a/3d-viewer/info3d_visu.cpp b/3d-viewer/info3d_visu.cpp index 3e0afc43c1..aeb245f193 100644 --- a/3d-viewer/info3d_visu.cpp +++ b/3d-viewer/info3d_visu.cpp @@ -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 ); } diff --git a/3d-viewer/info3d_visu.h b/3d-viewer/info3d_visu.h index 7c7fe02918..10149d2ed8 100644 --- a/3d-viewer/info3d_visu.h +++ b/3d-viewer/info3d_visu.h @@ -95,7 +95,7 @@ public: double m_CurrentZpos; // temporary storage of current value of Z position, // used in some calculation private: - double m_LayerZcoord[NB_LAYERS]; // Z position of each layer (normalized) + double m_LayerZcoord[LAYER_ID_COUNT]; // Z position of each layer (normalized) double m_CopperThickness; // Copper thickness (normalized) double m_EpoxyThickness; // Epoxy thickness (normalized) double m_NonCopperLayerThickness; // Non copper layers thickness @@ -188,11 +188,12 @@ public: INFO3D_VISU(); * * Note: if m_drawFlags[FL_USE_COPPER_THICKNESS] is not set, returns 0 */ - int GetLayerObjectThicknessBIU( int aLayerId) const + int GetLayerObjectThicknessBIU( int aLayerId ) const { - return aLayerId >= FIRST_NON_COPPER_LAYER ? - GetNonCopperLayerThicknessBIU() : - GetCopperThicknessBIU(); + return IsCopperLayer( aLayerId ) ? + GetCopperThicknessBIU() : + GetNonCopperLayerThicknessBIU() + ; } bool IsRealisticMode() { return GetFlag( FL_USE_REALISTIC_MODE ); } diff --git a/bitmap2component/bitmap2component.cpp b/bitmap2component/bitmap2component.cpp index 83014cfa93..e0c22fbf20 100644 --- a/bitmap2component/bitmap2component.cpp +++ b/bitmap2component/bitmap2component.cpp @@ -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, diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index d24c37bdfe..88db67da3b 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -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 diff --git a/common/class_colors_design_settings.cpp b/common/class_colors_design_settings.cpp index ffa6c45577..42d8e79a71 100644 --- a/common/class_colors_design_settings.cpp +++ b/common/class_colors_design_settings.cpp @@ -15,8 +15,7 @@ /* Initial colors values: optimized for Pcbnew, but are also Ok for Eeschema * these values are superseded by config reading */ -static const EDA_COLOR_T default_layer_color[LAYERSCOLORSBUFFERSIZE] = -{ +static const EDA_COLOR_T default_layer_color[] = { GREEN, BLUE, LIGHTGRAY, BROWN, RED, MAGENTA, LIGHTGRAY, MAGENTA, DARKGRAY, BLUE, GREEN, CYAN, @@ -34,8 +33,8 @@ static const EDA_COLOR_T default_layer_color[LAYERSCOLORSBUFFERSIZE] = DARKGRAY }; -static const EDA_COLOR_T default_items_color[LAYERSCOLORSBUFFERSIZE] = -{ + +static const EDA_COLOR_T default_items_color[] = { LIGHTGRAY, // unused CYAN, // VIA_MICROVIA_VISIBLE BROWN, // VIA_BBLIND_VISIBLE @@ -56,13 +55,24 @@ static const EDA_COLOR_T default_items_color[LAYERSCOLORSBUFFERSIZE] = LIGHTGRAY, LIGHTGRAY, LIGHTGRAY }; + COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS() { - for( unsigned ii = 0; ii < DIM(m_LayersColors); ii++ ) - m_LayersColors[ii] = default_layer_color[ii]; + for( unsigned src = 0, dst = 0; dst < DIM(m_LayersColors); ++dst ) + { + m_LayersColors[dst] = default_layer_color[src++]; - for( unsigned ii = 0; ii < DIM(m_ItemsColors); ii++ ) - m_ItemsColors[ii] = default_items_color[ii]; + if( src >= DIM( default_layer_color ) ) + src = 0; // wrap the source. + } + + for( unsigned src = 0, dst = 0; dst < DIM(m_ItemsColors); ++dst ) + { + m_ItemsColors[dst] = default_items_color[src++]; + + if( src >= DIM( default_items_color ) ) + src = 0; + } } diff --git a/common/class_layer_box_selector.cpp b/common/class_layer_box_selector.cpp index 12f88f8b6a..aca58e6228 100644 --- a/common/class_layer_box_selector.cpp +++ b/common/class_layer_box_selector.cpp @@ -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 ) ); } } + diff --git a/common/common_plotSVG_functions.cpp b/common/common_plotSVG_functions.cpp index b90481eea9..857d93f67b 100644 --- a/common/common_plotSVG_functions.cpp +++ b/common/common_plotSVG_functions.cpp @@ -420,14 +420,14 @@ void SVG_PLOTTER::PlotPoly( const std::vector& aCornerList, switch( aFill ) { - case NO_FILL: - fprintf( outputFile, " 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 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 & INTERNAL_CU_LAYERS ) + if( aMask[F_Cu] ) + AccumulateDescription( layerInfo, aBoard->GetLayerName( F_Cu ) ); + + 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; -} diff --git a/eeschema/libedit_plot_component.cpp b/eeschema/libedit_plot_component.cpp index 39d3dbafcb..45cc109de1 100644 --- a/eeschema/libedit_plot_component.cpp +++ b/eeschema/libedit_plot_component.cpp @@ -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; diff --git a/eeschema/libeditframe.h b/eeschema/libeditframe.h index 106ef8830b..b328785980 100644 --- a/eeschema/libeditframe.h +++ b/eeschema/libeditframe.h @@ -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 ); /** diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index 4a46f3047a..1ed61a476e 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -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 ); diff --git a/gerbview/class_gbr_layer_box_selector.h b/gerbview/class_gbr_layer_box_selector.h index dc78cf93b7..ff7878ae09 100644 --- a/gerbview/class_gbr_layer_box_selector.h +++ b/gerbview/class_gbr_layer_box_selector.h @@ -9,14 +9,12 @@ 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 ) - { - m_layerhotkeys = false; - m_layerorder = false; - } + 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; + } // Reload the Layers names and bitmaps // Virtual function diff --git a/gerbview/class_gbr_layout.h b/gerbview/class_gbr_layout.h index da0c511604..62397de9c7 100644 --- a/gerbview/class_gbr_layout.h +++ b/gerbview/class_gbr_layout.h @@ -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 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; } diff --git a/gerbview/class_gbr_screen.cpp b/gerbview/class_gbr_screen.cpp index aaf96275ff..efa06d4365 100644 --- a/gerbview/class_gbr_screen.cpp +++ b/gerbview/class_gbr_screen.cpp @@ -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 diff --git a/gerbview/class_gerber_draw_item.h b/gerbview/class_gerber_draw_item.h index c7a0b695cc..13d15e62e6 100644 --- a/gerbview/class_gerber_draw_item.h +++ b/gerbview/class_gerber_draw_item.h @@ -134,7 +134,7 @@ public: */ void SetLayer( LAYER_NUM aLayer ) { m_Layer = aLayer; } - LAYER_MSK GetLayerMask() + LSET GetLayerMask() { return ::GetLayerMask( m_Layer ); } diff --git a/gerbview/class_gerbview_layer_widget.cpp b/gerbview/class_gerbview_layer_widget.cpp index 911f2594f3..533232fd41 100644 --- a/gerbview/class_gerbview_layer_widget.cpp +++ b/gerbview/class_gerbview_layer_widget.cpp @@ -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() //------------------------------------------------ -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 ); diff --git a/gerbview/class_gerbview_layer_widget.h b/gerbview/class_gerbview_layer_widget.h index 4d343ce121..ebb4eb16b5 100644 --- a/gerbview/class_gerbview_layer_widget.h +++ b/gerbview/class_gerbview_layer_widget.h @@ -91,9 +91,9 @@ public: void ReFillRender(); //---------------- - 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 ); /** diff --git a/gerbview/dialogs/dialog_print_using_printer.cpp b/gerbview/dialogs/dialog_print_using_printer.cpp index 3f9f338416..1bd58a195e 100644 --- a/gerbview/dialogs/dialog_print_using_printer.cpp +++ b/gerbview/dialogs/dialog_print_using_printer.cpp @@ -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: diff --git a/gerbview/dialogs/dialog_select_one_pcb_layer.cpp b/gerbview/dialogs/dialog_select_one_pcb_layer.cpp index 80dd1b46cc..cfadefe3ea 100644 --- a/gerbview/dialogs/dialog_select_one_pcb_layer.cpp +++ b/gerbview/dialogs/dialog_select_one_pcb_layer.cpp @@ -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; } diff --git a/gerbview/draw_gerber_screen.cpp b/gerbview/draw_gerber_screen.cpp index b2dc3640a8..da9e793679 100644 --- a/gerbview/draw_gerber_screen.cpp +++ b/gerbview/draw_gerber_screen.cpp @@ -42,11 +42,11 @@ #include -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: diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 0674be6c1e..632ce929c6 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -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 ); } diff --git a/gerbview/gerbview_frame.h b/gerbview/gerbview_frame.h index df14fdaa4b..81a076e361 100644 --- a/gerbview/gerbview_frame.h +++ b/gerbview/gerbview_frame.h @@ -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 ); /** diff --git a/gerbview/select_layers_to_pcb.cpp b/gerbview/select_layers_to_pcb.cpp index 058dfd5d54..b6f1cf8f15 100644 --- a/gerbview/select_layers_to_pcb.cpp +++ b/gerbview/select_layers_to_pcb.cpp @@ -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]; diff --git a/include/class_board_design_settings.h b/include/class_board_design_settings.h index 4e81ff0652..4f3c34ee77 100644 --- a/include/class_board_design_settings.h +++ b/include/class_board_design_settings.h @@ -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]; } /** @@ -485,11 +486,13 @@ private: ///> Custom via size (used after UseCustomTrackViaSize( true ) was called). 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 - int m_visibleElements; ///< Bit-mask for element category visibility - int m_boardThickness; ///< Board thickness for 3D viewer + int m_copperLayerCount; ///< Number of copper layers for this design + + 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 /// Current net class name used to display netclass info. /// This is also the last used netclass after starting a track. diff --git a/include/class_board_item.h b/include/class_board_item.h index 0527a33c91..1aa224e412 100644 --- a/include/class_board_item.h +++ b/include/class_board_item.h @@ -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 ) ); diff --git a/include/class_colors_design_settings.h b/include/class_colors_design_settings.h index e0523b9564..e1900baff3 100644 --- a/include/class_colors_design_settings.h +++ b/include/class_colors_design_settings.h @@ -7,8 +7,6 @@ #define _COLORS_DESIGN_SETTING_H #include -#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(); diff --git a/include/class_layer_box_selector.h b/include/class_layer_box_selector.h index 4a130c8654..e61301ea98 100644 --- a/include/class_layer_box_selector.h +++ b/include/class_layer_box_selector.h @@ -15,7 +15,6 @@ class LAYER_SELECTOR { protected: bool m_layerhotkeys; - bool m_layerorder; public: // Hotkey Info @@ -41,12 +40,13 @@ public: protected: // Fills the layer bitmap aLayerbmp with the layer color - void SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer ); + void SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_ID aLayer ); }; + /* class to display a layer list in a wxBitmapComboBox. */ -class LAYER_BOX_SELECTOR :public wxBitmapComboBox, public LAYER_SELECTOR +class LAYER_BOX_SELECTOR : public wxBitmapComboBox, public LAYER_SELECTOR { public: // Hotkey Info @@ -69,7 +69,7 @@ public: LAYER_NUM GetLayerSelection() const; // Set Layer # - int SetLayerSelection(LAYER_NUM layer); + int SetLayerSelection( LAYER_NUM layer ); // Reload the Layers // Virtual pure function because GerbView uses its own functions in a derived class @@ -79,23 +79,4 @@ public: void ResyncBitmapOnly(); }; -#define DECLARE_LAYERS_HOTKEY(list) int list[NB_LAYERS] = \ - { \ - HK_SWITCH_LAYER_TO_COPPER, \ - HK_SWITCH_LAYER_TO_INNER1, \ - HK_SWITCH_LAYER_TO_INNER2, \ - HK_SWITCH_LAYER_TO_INNER3, \ - HK_SWITCH_LAYER_TO_INNER4, \ - HK_SWITCH_LAYER_TO_INNER5, \ - HK_SWITCH_LAYER_TO_INNER6, \ - HK_SWITCH_LAYER_TO_INNER7, \ - HK_SWITCH_LAYER_TO_INNER8, \ - HK_SWITCH_LAYER_TO_INNER9, \ - HK_SWITCH_LAYER_TO_INNER10, \ - HK_SWITCH_LAYER_TO_INNER11, \ - HK_SWITCH_LAYER_TO_INNER12, \ - HK_SWITCH_LAYER_TO_INNER13, \ - HK_SWITCH_LAYER_TO_INNER14, \ - HK_SWITCH_LAYER_TO_COMPONENT \ - }; -#endif //CLASS_LAYER_BOX_SELECTOR_H +#endif // CLASS_LAYER_BOX_SELECTOR_H diff --git a/include/class_pcb_screen.h b/include/class_pcb_screen.h index 59f3f3d592..e445a53ca0 100644 --- a/include/class_pcb_screen.h +++ b/include/class_pcb_screen.h @@ -17,9 +17,9 @@ class UNDO_REDO_CONTAINER; class PCB_SCREEN : public BASE_SCREEN { public: - LAYER_NUM m_Active_Layer; - LAYER_NUM m_Route_Layer_TOP; - LAYER_NUM m_Route_Layer_BOTTOM; + LAYER_ID m_Active_Layer; + LAYER_ID m_Route_Layer_TOP; + LAYER_ID m_Route_Layer_BOTTOM; public: diff --git a/include/draw_frame.h b/include/draw_frame.h index a76e1f4cc6..6b77593801 100644 --- a/include/draw_frame.h +++ b/include/draw_frame.h @@ -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 diff --git a/include/layers_id_colors_and_visibility.h b/include/layers_id_colors_and_visibility.h index 5b73d4f266..0886481da8 100644 --- a/include/layers_id_colors_and_visibility.h +++ b/include/layers_id_colors_and_visibility.h @@ -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 +#include +#include +#include +#include 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) */ -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) + * 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. */ -inline LAYER_MSK GetLayerMask( LAYER_NUM aLayerNumber ) -{ - return 1 << aLayerNumber; -} +typedef int LAYER_NUM; + /** - * @return bool if aLayerNumber is a layer contained in aMask - * @param aMask = a layer mask - * @param aLayerNumber is the layer id to test + * 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 bool IsLayerInList( LAYER_MSK aMask, LAYER_NUM aLayerNumber ) +enum LAYER_ID +#if __cplusplus >= 201103L + : unsigned char +#endif { - return (aMask & GetLayerMask( aLayerNumber )) != 0; -} + 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 BASE_SEQ; + + +/** + * Class LSEQ + * is a sequence (and therefore also a set) of LAYER_IDs. A sequence provides + * a certain order. + *

+ * It can also be used as an iterator: + * + * + * for( LSEQ cu_stack = aSet.CuStack(); cu_stack; ++cu_stack ) + * layer_id = *cu_stack; + * + * + */ +class LSEQ : public BASE_SEQ +{ + unsigned m_index; + +public: + + LSEQ() : + m_index( 0 ) + {} + + template + 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 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 ) + { + } + + /** + * Constructor LSET( LAYER_ID ) + * takes a LAYER_ID and sets that bit. + */ + LSET( int aLayer ) + { + 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_ diff --git a/include/pcbcommon.h b/include/pcbcommon.h index cdec3783b5..2e18cc6bff 100644 --- a/include/pcbcommon.h +++ b/include/pcbcommon.h @@ -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; diff --git a/include/view/view.h b/include/view/view.h index 2930af1844..1857664af9 100644 --- a/include/view/view.h +++ b/include/view/view.h @@ -507,7 +507,7 @@ public: */ void UpdateItems(); - const BOX2I CalculateExtents() ; + const BOX2I CalculateExtents() ; static const int VIEW_MAX_LAYERS = 128; ///< maximum number of layers that may be shown diff --git a/include/wxBasePcbFrame.h b/include/wxBasePcbFrame.h index 19d66214ac..908de4f4b4 100644 --- a/include/wxBasePcbFrame.h +++ b/include/wxBasePcbFrame.h @@ -606,16 +606,16 @@ public: * @param aDlgPosition = position of dialog ( defualt = centered) * @return the selected layer id */ - LAYER_NUM SelectLayer( LAYER_NUM aDefaultLayer, - LAYER_MSK aNotAllowedLayersMask = 0, - wxPoint aDlgPosition = wxDefaultPosition ); + 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 * the layer pair is used to fast switch between copper layers when placing vias */ 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 diff --git a/include/wxEeschemaStruct.h b/include/wxEeschemaStruct.h index 34d8dc8555..c8961f697b 100644 --- a/include/wxEeschemaStruct.h +++ b/include/wxEeschemaStruct.h @@ -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; } diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index b9321922a8..6acdb810cc 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -283,8 +283,8 @@ public: * @param aPrintMirrorMode = true to plot mirrored * @param aData = a pointer on an auxiliary data (NULL if not used) */ - virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMaskLayer, bool aPrintMirrorMode, - void * aData = NULL ); + virtual void PrintPage( wxDC* aDC, LSET aPrintMaskLayer, bool aPrintMirrorMode, + void* aData = NULL ); void GetKicadAbout( wxCommandEvent& event ); @@ -535,26 +535,26 @@ public: * Function SetHighContrastLayer * takes care of display settings for the given layer to be displayed in high contrast mode. */ - void SetHighContrastLayer( LAYER_NUM aLayer ); + void SetHighContrastLayer( LAYER_ID aLayer ); /** * Function SetTopLayer * moves the selected layer to the top, so it is displayed above all others. */ - void SetTopLayer( LAYER_NUM aLayer ); + void SetTopLayer( LAYER_ID aLayer ); /** * Function SetActiveLayer * will change the currently active layer to \a aLayer and also * update the PCB_LAYER_WIDGET. */ - void SetActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate = true ); + void SetActiveLayer( LAYER_ID aLayer, bool doLayerWidgetUpdate = true ); /** * Function GetActiveLayer * returns the active layer */ - LAYER_NUM GetActiveLayer() const + LAYER_ID GetActiveLayer() const { return ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer; } @@ -784,8 +784,6 @@ public: void InstallDisplayOptionsDialog( wxCommandEvent& aEvent ); void InstallPcbGlobalDeleteFrame( const wxPoint& pos ); - void InstallDialogLayerSetup(); - /** * Function GenFootprintsPositionFile * Calls DoGenFootprintsPositionFile to create a footprint position file @@ -1263,7 +1261,7 @@ public: bool MergeCollinearTracks( TRACK* track, wxDC* DC, int end ); void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC ); - void SwitchLayer( wxDC* DC, LAYER_NUM layer ); + void SwitchLayer( wxDC* DC, LAYER_ID layer ); /** * Function Add45DegreeSegment @@ -1463,7 +1461,7 @@ public: DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, STROKE_T shape, wxDC* DC ); void End_Edge( DRAWSEGMENT* Segment, wxDC* DC ); void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ); - void Delete_Drawings_All_Layer( LAYER_NUM aLayer ); + void Delete_Drawings_All_Layer( LAYER_ID aLayer ); // Dimension handling: void ShowDimensionPropertyDialog( DIMENSION* aDimension, wxDC* aDC ); diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp index ab91849c82..de63f4097d 100644 --- a/pagelayout_editor/pl_editor_frame.cpp +++ b/pagelayout_editor/pl_editor_frame.cpp @@ -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; diff --git a/pagelayout_editor/pl_editor_frame.h b/pagelayout_editor/pl_editor_frame.h index e675cb9c9b..b2c86792e0 100644 --- a/pagelayout_editor/pl_editor_frame.h +++ b/pagelayout_editor/pl_editor_frame.h @@ -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 ); diff --git a/pcbnew/autorouter/auto_place_footprints.cpp b/pcbnew/autorouter/auto_place_footprints.cpp index a49ccd1b2c..f14a2385f9 100644 --- a/pcbnew/autorouter/auto_place_footprints.cpp +++ b/pcbnew/autorouter/auto_place_footprints.cpp @@ -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 ) diff --git a/pcbnew/autorouter/autorout.cpp b/pcbnew/autorouter/autorout.cpp index 88f2e12e6e..cc3c4720d2 100644 --- a/pcbnew/autorouter/autorout.cpp +++ b/pcbnew/autorouter/autorout.cpp @@ -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 ) diff --git a/pcbnew/autorouter/autorout.h b/pcbnew/autorouter/autorout.h index b284b63ab8..02d004c4ab 100644 --- a/pcbnew/autorouter/autorout.h +++ b/pcbnew/autorouter/autorout.h @@ -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 */ diff --git a/pcbnew/autorouter/graphpcb.cpp b/pcbnew/autorouter/graphpcb.cpp index 54b94a01f7..15e9d2f94a 100644 --- a/pcbnew/autorouter/graphpcb.cpp +++ b/pcbnew/autorouter/graphpcb.cpp @@ -59,7 +59,7 @@ static void DrawSegmentQcq( int ux0, int uy0, int op_logic ); static void TraceFilledCircle( int cx, int cy, int radius, - LAYER_MSK aLayerMask, + LSET aLayerMask, int color, int op_logic ); @@ -96,7 +96,7 @@ void PlacePad( D_PAD* aPad, int color, int marge, int op_logic ) if( aPad->GetShape() == PAD_CIRCLE ) { TraceFilledCircle( shape_pos.x, shape_pos.y, dx, - aPad->GetLayerMask(), color, op_logic ); + aPad->GetLayerSet(), color, op_logic ); return; } @@ -120,14 +120,14 @@ void PlacePad( D_PAD* aPad, int color, int marge, int op_logic ) TraceFilledRectangle( shape_pos.x - dx, shape_pos.y - dy, shape_pos.x + dx, shape_pos.y + dy, - aPad->GetLayerMask(), color, op_logic ); + aPad->GetLayerSet(), color, op_logic ); } else { TraceFilledRectangle( shape_pos.x - dx, shape_pos.y - dy, shape_pos.x + dx, shape_pos.y + dy, aPad->GetOrientation(), - aPad->GetLayerMask(), color, op_logic ); + aPad->GetLayerSet(), color, op_logic ); } } @@ -140,10 +140,8 @@ void PlacePad( D_PAD* aPad, int color, int marge, int op_logic ) * color: mask write in cells * 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 ) +void TraceFilledCircle( int cx, int cy, int radius, + 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 diff --git a/pcbnew/autorouter/routing_matrix.cpp b/pcbnew/autorouter/routing_matrix.cpp index 8c9e3b2cbd..7875afb13c 100644 --- a/pcbnew/autorouter/routing_matrix.cpp +++ b/pcbnew/autorouter/routing_matrix.cpp @@ -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) ); @@ -196,16 +196,16 @@ void MATRIX_ROUTING_HEAD::UnInitRoutingMatrix() */ 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; + int ux0 = 0, uy0 = 0, ux1, uy1, dx, dy; + int marge, via_marge; + LSET layerMask; // use the default NETCLASS? NETCLASSPTR nc = aPcb->GetDesignSettings().GetDefault(); - int trackWidth = nc->GetTrackWidth(); - int clearance = nc->GetClearance(); - int viaSize = nc->GetViaDiameter(); + int trackWidth = nc->GetTrackWidth(); + int clearance = nc->GetClearance(); + int viaSize = nc->GetViaDiameter(); marge = clearance + (trackWidth / 2); via_marge = clearance + (viaSize / 2); @@ -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 ); @@ -257,66 +257,65 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag ) switch( item->Type() ) { case PCB_LINE_T: - { - DRAWSEGMENT* DrawSegm; - - int type_cell = HOLE; - DrawSegm = (DRAWSEGMENT*) item; - DRAWSEGMENT tmpSegm( DrawSegm ); - - if( DrawSegm->GetLayer() == EDGE_N ) { - tmpSegm.SetLayer( UNDEFINED_LAYER ); - type_cell |= CELL_is_EDGE; - } + DRAWSEGMENT* DrawSegm; - TraceSegmentPcb( &tmpSegm, type_cell, marge, WRITE_CELL ); - } - break; + int type_cell = HOLE; + DrawSegm = (DRAWSEGMENT*) item; + DRAWSEGMENT tmpSegm( DrawSegm ); + + if( DrawSegm->GetLayer() == Edge_Cuts ) + { + tmpSegm.SetLayer( UNDEFINED_LAYER ); + type_cell |= CELL_is_EDGE; + } + + TraceSegmentPcb( &tmpSegm, type_cell, marge, WRITE_CELL ); + } + break; case PCB_TEXT_T: - { - TEXTE_PCB* PtText; - PtText = (TEXTE_PCB*) item; + { + TEXTE_PCB* PtText = (TEXTE_PCB*) item; - if( PtText->GetText().Length() == 0 ) - break; + if( PtText->GetText().Length() == 0 ) + break; - EDA_RECT textbox = PtText->GetTextBox( -1 ); - ux0 = textbox.GetX(); - uy0 = textbox.GetY(); - dx = textbox.GetWidth(); - dy = textbox.GetHeight(); + EDA_RECT textbox = PtText->GetTextBox( -1 ); + ux0 = textbox.GetX(); + uy0 = textbox.GetY(); + dx = textbox.GetWidth(); + dy = textbox.GetHeight(); - /* Put bounding box (rectangle) on matrix */ - dx /= 2; - dy /= 2; + // Put bounding box (rectangle) on matrix + dx /= 2; + dy /= 2; - ux1 = ux0 + dx; - uy1 = uy0 + dy; + ux1 = ux0 + dx; + uy1 = uy0 + dy; - ux0 -= dx; - uy0 -= dy; + ux0 -= dx; + uy0 -= dy; - layerMask = GetLayerMask( PtText->GetLayer() ); + layerMask = LSET( PtText->GetLayer() ); - TraceFilledRectangle( ux0 - marge, uy0 - marge, ux1 + marge, - uy1 + marge, PtText->GetOrientation(), - layerMask, HOLE, WRITE_CELL ); + TraceFilledRectangle( ux0 - marge, uy0 - marge, ux1 + marge, + uy1 + marge, PtText->GetOrientation(), + layerMask, HOLE, WRITE_CELL ); - TraceFilledRectangle( ux0 - via_marge, uy0 - via_marge, - ux1 + via_marge, uy1 + via_marge, - PtText->GetOrientation(), - layerMask, VIA_IMPOSSIBLE, WRITE_OR_CELL ); - } - break; + TraceFilledRectangle( ux0 - via_marge, uy0 - via_marge, + ux1 + via_marge, uy1 + via_marge, + PtText->GetOrientation(), + layerMask, VIA_IMPOSSIBLE, WRITE_OR_CELL ); + } + break; default: break; } } - /* 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; diff --git a/pcbnew/autorouter/solve.cpp b/pcbnew/autorouter/solve.cpp index 0e0120c458..a88395e189 100644 --- a/pcbnew/autorouter/solve.cpp +++ b/pcbnew/autorouter/solve.cpp @@ -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, ¤t_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[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]*/ ) + 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]*/ ) + 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 ); diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index fafecf16f4..f45df75edb 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -64,24 +64,26 @@ #include // 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 ) ); diff --git a/pcbnew/block.cpp b/pcbnew/block.cpp index b2924676b9..33254ac942 100644 --- a/pcbnew/block.cpp +++ b/pcbnew/block.cpp @@ -381,7 +381,7 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) void PCB_EDIT_FRAME::Block_SelectItems() { - LAYER_MSK layerMask; + LSET layerMask; bool selectOnlyComplete = GetScreen()->m_BlockLocate.GetWidth() > 0 ; GetScreen()->m_BlockLocate.Normalize(); @@ -392,9 +392,9 @@ void PCB_EDIT_FRAME::Block_SelectItems() // Add modules if( blockIncludeModules ) { - for( MODULE* module = m_Pcb->m_Modules; module != NULL; module = module->Next() ) + for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() ) { - LAYER_NUM layer = module->GetLayer(); + LAYER_ID layer = module->GetLayer(); if( module->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) && ( !module->IsLocked() || blockIncludeLockedModules ) ) @@ -418,7 +418,7 @@ void PCB_EDIT_FRAME::Block_SelectItems() if( blockIncludeItemsOnInvisibleLayers || m_Pcb->IsLayerVisible( track->GetLayer() ) ) { - picker.SetItem ( track ); + picker.SetItem( track ); itemsList->PushItem( picker ); } } @@ -426,13 +426,13 @@ void PCB_EDIT_FRAME::Block_SelectItems() } // Add graphic items - layerMask = EDGE_LAYER; + layerMask = LSET( Edge_Cuts ); if( blockIncludeItemsOnTechLayers ) - layerMask = ALL_LAYERS; + layerMask.set(); if( !blockIncludeBoardOutlineLayer ) - layerMask &= ~EDGE_LAYER; + layerMask.set( Edge_Cuts, false ); for( BOARD_ITEM* PtStruct = m_Pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() ) { @@ -444,7 +444,7 @@ void PCB_EDIT_FRAME::Block_SelectItems() switch( PtStruct->Type() ) { case PCB_LINE_T: - if( (GetLayerMask( PtStruct->GetLayer() ) & layerMask) == 0 ) + if( !layerMask[PtStruct->GetLayer()] ) break; if( !PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) ) @@ -464,7 +464,7 @@ void PCB_EDIT_FRAME::Block_SelectItems() break; case PCB_TARGET_T: - if( ( GetLayerMask( PtStruct->GetLayer() ) & layerMask ) == 0 ) + if( !layerMask[PtStruct->GetLayer()] ) break; if( !PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) ) @@ -474,7 +474,7 @@ void PCB_EDIT_FRAME::Block_SelectItems() break; case PCB_DIMENSION_T: - if( ( GetLayerMask( PtStruct->GetLayer() ) & layerMask ) == 0 ) + if( !layerMask[PtStruct->GetLayer()] ) break; if( !PtStruct->HitTest( GetScreen()->m_BlockLocate, selectOnlyComplete ) ) diff --git a/pcbnew/board_items_to_polygon_shape_transform.cpp b/pcbnew/board_items_to_polygon_shape_transform.cpp index 0651f00efe..caba91ca6c 100644 --- a/pcbnew/board_items_to_polygon_shape_transform.cpp +++ b/pcbnew/board_items_to_polygon_shape_transform.cpp @@ -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, diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 9a1456a7b0..cb34bb3ce6 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -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; + 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 ); + 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 ); + D_PAD* pad = module->GetPad( aPosition, aLayerMask ); - if( pad != NULL ) - break; + if( pad ) + return 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; iGetPosition() != 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& aPadList, const wxPoint& aPosition, LAYER_MSK aLayerMask ) +D_PAD* BOARD::GetPad( std::vector& 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& 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& 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& 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& 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 ); diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index b8cdc49950..981450c070 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -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& aPadList, const wxPoint& aPosition, LAYER_MSK aLayerMask ); + D_PAD* GetPad( std::vector& 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 diff --git a/pcbnew/class_board_design_settings.cpp b/pcbnew/class_board_design_settings.cpp index 975972b1aa..f3596ced4b 100644 --- a/pcbnew/class_board_design_settings.cpp +++ b/pcbnew/class_board_design_settings.cpp @@ -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(); } diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp index 2d554fc737..07a984b3d6 100644 --- a/pcbnew/class_dimension.cpp +++ b/pcbnew/class_dimension.cpp @@ -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 ); diff --git a/pcbnew/class_dimension.h b/pcbnew/class_dimension.h index 440199353d..d12a597741 100644 --- a/pcbnew/class_dimension.h +++ b/pcbnew/class_dimension.h @@ -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; } diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp index 2c976e90ee..0d22b34b85 100644 --- a/pcbnew/class_drawsegment.cpp +++ b/pcbnew/class_drawsegment.cpp @@ -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 ); } diff --git a/pcbnew/class_edge_mod.cpp b/pcbnew/class_edge_mod.cpp index ede9d43564..5f14f0e1a7 100644 --- a/pcbnew/class_edge_mod.cpp +++ b/pcbnew/class_edge_mod.cpp @@ -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; diff --git a/pcbnew/class_mire.cpp b/pcbnew/class_mire.cpp index 3abeaf95d0..ba59dda554 100644 --- a/pcbnew/class_mire.cpp +++ b/pcbnew/class_mire.cpp @@ -51,11 +51,11 @@ 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, - const wxPoint& aPos, int aSize, int aWidth ) : +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 ) { m_Shape = aShape; diff --git a/pcbnew/class_mire.h b/pcbnew/class_mire.h index 9f12ac7d73..01bbf40302 100644 --- a/pcbnew/class_mire.h +++ b/pcbnew/class_mire.h @@ -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(); diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index e755745f24..50fbc9d086 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -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; @@ -424,7 +424,7 @@ EDA_RECT MODULE::GetFootprintRect() const for( const BOARD_ITEM* item = m_Drawings.GetFirst(); item; item = item->Next() ) { - const EDGE_MODULE* edge = dyn_cast( item ); + const EDGE_MODULE* edge = dyn_cast( item ); if( edge ) area.Merge( edge->GetBoundingBox() ); @@ -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 ) ) diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h index 5a37ca992c..8eac8a87d8 100644 --- a/pcbnew/class_module.h +++ b/pcbnew/class_module.h @@ -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 { diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index 2d2342d4e8..c47f5844ce 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -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 diff --git a/pcbnew/class_pad.h b/pcbnew/class_pad.h index 61a8c73575..4b10040241 100644 --- a/pcbnew/class_pad.h +++ b/pcbnew/class_pad.h @@ -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( 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; } @@ -189,7 +178,7 @@ public: void SetPadToDieLength( int aLength ) { m_LengthPadToDie = aLength; } int GetPadToDieLength() const { return m_LengthPadToDie; } - int GetLocalSolderMaskMargin() const { return m_LocalSolderMaskMargin; } + int GetLocalSolderMaskMargin() const { return m_LocalSolderMaskMargin; } void SetLocalSolderMaskMargin( int aMargin ) { m_LocalSolderMaskMargin = aMargin; } int GetLocalClearance() const { return m_LocalClearance; } @@ -371,13 +360,16 @@ public: * Function GetSubRatsnest * @return int - the netcode */ - int GetSubRatsnest() const { return m_SubRatsnest; } - void SetSubRatsnest( int aSubRatsnest ) { m_SubRatsnest = aSubRatsnest; } + int GetSubRatsnest() const { return m_SubRatsnest; } + void SetSubRatsnest( int aSubRatsnest ) { m_SubRatsnest = aSubRatsnest; } 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 diff --git a/pcbnew/class_pad_draw_functions.cpp b/pcbnew/class_pad_draw_functions.cpp index 24113ea52a..82ae51ccc9 100644 --- a/pcbnew/class_pad_draw_functions.cpp +++ b/pcbnew/class_pad_draw_functions.cpp @@ -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 ); } diff --git a/pcbnew/class_pcb_layer_box_selector.cpp b/pcbnew/class_pcb_layer_box_selector.cpp index fb68ddbdb7..7b56b7d27e 100644 --- a/pcbnew/class_pcb_layer_box_selector.cpp +++ b/pcbnew/class_pcb_layer_box_selector.cpp @@ -40,6 +40,28 @@ #include + +#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 ); } + diff --git a/pcbnew/class_pcb_layer_box_selector.h b/pcbnew/class_pcb_layer_box_selector.h index 5ac87e5da4..7dbad7000f 100644 --- a/pcbnew/class_pcb_layer_box_selector.h +++ b/pcbnew/class_pcb_layer_box_selector.h @@ -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 + PCB_BASE_FRAME* m_boardFrame; + + 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; @@ -39,11 +40,11 @@ public: // SetBoardFrame should be called after creating a PCB_LAYER_BOX_SELECTOR // It is not passed through the constructor because when using wxFormBuilder // we should use a constructor compatible with a wxBitmapComboBox - void SetBoardFrame( PCB_BASE_FRAME * aFrame ) { m_boardFrame = aFrame; }; + void SetBoardFrame( PCB_BASE_FRAME* aFrame ) { m_boardFrame = aFrame; }; - // SetLayerMask allows disableing some layers, whiech are not + // SetLayerSet allows disableing some layers, which are not // shown in list; - 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 +#endif // CLASS_PCB_PCB_LAYER_BOX_SELECTOR_H diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp index 944019e286..3e70199ae7 100644 --- a/pcbnew/class_pcb_layer_widget.cpp +++ b/pcbnew/class_pcb_layer_widget.cpp @@ -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; rowGetId() ); + 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,14 +223,16 @@ void PCB_LAYER_WIDGET::ReFillRender() for( unsigned row=0; rowGetVisibleElementColor( 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,35 +277,35 @@ void PCB_LAYER_WIDGET::SyncLayerVisibilities() void PCB_LAYER_WIDGET::ReFill() { BOARD* brd = myframe->GetBoard(); - int enabledLayers = brd->GetEnabledLayers(); + LSET enabled = brd->GetEnabledLayers(); ClearLayerRows(); + wxString dsc; + // 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 ) + for( LSEQ cu_stack = enabled.CuStack(); cu_stack; ++cu_stack ) { - if( enabledLayers & GetLayerMask( layer ) ) + LAYER_ID layer = *cu_stack; + + switch( layer ) { - wxString dsc; - switch( layer ) - { - case LAYER_N_FRONT: - dsc = _("Front copper layer"); - break; + case F_Cu: + dsc = _("Front copper layer"); + break; - case LAYER_N_BACK: - dsc = _("Back copper layer"); - break; + case B_Cu: + dsc = _("Back copper layer"); + break; - default: - dsc = _("Inner copper layer"); - break; - } - - AppendLayerRow( LAYER_WIDGET::ROW( - brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), - dsc, true ) ); + default: + dsc = _("Inner copper layer"); + break; } + + AppendLayerRow( LAYER_WIDGET::ROW( + brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), + dsc, true ) ); } @@ -309,34 +313,35 @@ void PCB_LAYER_WIDGET::ReFill() // 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; iGetLayerName( 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() //------------------------------------------------ -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 ) diff --git a/pcbnew/class_pcb_layer_widget.h b/pcbnew/class_pcb_layer_widget.h index b825875291..4f7d715367 100644 --- a/pcbnew/class_pcb_layer_widget.h +++ b/pcbnew/class_pcb_layer_widget.h @@ -82,9 +82,9 @@ public: void SetLayersManagerTabsText(); //---------------- - 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 ); //--------------- diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index b103869775..5eda7cba6e 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -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: diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index 183cad4241..d449c614fd 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -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,9 +1255,10 @@ 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() ) ) + for( VIA* via = GetFirstVia( this ); via; via = GetFirstVia( via->Next() ) ) { if( via->HitTest( aPosition ) && !via->GetState( BUSY | IS_DELETED ) && @@ -1267,14 +1270,17 @@ 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() ) ) + for( VIA* via = GetFirstVia( this, aEndTrace ); via; via = GetFirstVia( via->Next() ) ) { if( via->HitTest( aPosition ) && - !via->GetState( BUSY | IS_DELETED ) && - (aLayerMask & via->GetLayerMask()) ) + !via->GetState( BUSY | IS_DELETED ) && + ( aLayerMask & via->GetLayerSet() ).any() + ) + { return via; + } } return NULL; @@ -1284,10 +1290,10 @@ VIA* TRACK::GetVia( TRACK* aEndTrace, const wxPoint& aPosition, LAYER_MSK aLayer TRACK* TRACK::GetTrack( TRACK* aStartTrace, TRACK* aEndTrace, ENDPOINT_T aEndPoint, bool aSameNetOnly, bool aSequential ) { - const wxPoint &position = GetEndPoint( aEndPoint ); - LAYER_MSK refLayers = GetLayerMask(); - TRACK *previousSegment; - TRACK *nextSegment; + const wxPoint& position = GetEndPoint( aEndPoint ); + LSET refLayers = GetLayerSet(); + TRACK* previousSegment; + TRACK* nextSegment; if( aSequential ) { @@ -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) ) @@ -1338,9 +1344,10 @@ TRACK* TRACK::GetTrack( TRACK* aStartTrace, TRACK* aEndTrace, ENDPOINT_T aEndPoi // Same as above, looking back. During sequential search this branch is inactive if( previousSegment ) { - if ( (previousSegment != this) && - !previousSegment->GetState( BUSY | IS_DELETED ) && - (refLayers & previousSegment->GetLayerMask()) ) + if( (previousSegment != this) && + !previousSegment->GetState( BUSY | IS_DELETED ) && + ( 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 ); diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h index 258586d3f7..32f61295cb 100644 --- a/pcbnew/class_track.h +++ b/pcbnew/class_track.h @@ -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,15 +481,16 @@ 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 ) +inline VIA* GetFirstVia( TRACK* aTrk, const TRACK* aStopPoint = NULL ) { while( aTrk && (aTrk != aStopPoint) && (aTrk->Type() != PCB_VIA_T) ) aTrk = aTrk->Next(); @@ -501,4 +502,4 @@ inline VIA *GetFirstVia( TRACK *aTrk, const TRACK *aStopPoint = NULL ) return NULL; } -#endif /* CLASS_TRACK_H */ +#endif // CLASS_TRACK_H diff --git a/pcbnew/class_zone.h b/pcbnew/class_zone.h index 332fc84144..9203b0757b 100644 --- a/pcbnew/class_zone.h +++ b/pcbnew/class_zone.h @@ -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. diff --git a/pcbnew/class_zone_settings.cpp b/pcbnew/class_zone_settings.cpp index b17968123f..5615c6740e 100644 --- a/pcbnew/class_zone_settings.cpp +++ b/pcbnew/class_zone_settings.cpp @@ -38,18 +38,18 @@ ZONE_SETTINGS::ZONE_SETTINGS() { m_ZonePriority = 0; - m_FillMode = 0; // Mode for filling zone : 1 use segments, 0 use polygons + m_FillMode = 0; // Mode for filling zone : 1 use segments, 0 use polygons // Clearance value m_ZoneClearance = Mils2iu( ZONE_CLEARANCE_MIL ); // 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_Zone_HatchingStyle = CPolyLine::DIAGONAL_EDGE; // Option to show the zone area (outlines only, short hatches or full hatches + m_NetcodeSelection = 0; // Net code selection for 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 - // ARC_APPROX_SEGMENTS_COUNT_LOW_DEF - // or ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF segments + m_ArcToSegmentsCount = ARC_APPROX_SEGMENTS_COUNT_LOW_DEF; // Option to select number of segments to approximate a circle + // ARC_APPROX_SEGMENTS_COUNT_LOW_DEF + // or ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF segments // thickness of the gap in thermal reliefs: m_ThermalReliefGap = Mils2iu( ZONE_THERMAL_RELIEF_GAP_MIL ); diff --git a/pcbnew/class_zone_settings.h b/pcbnew/class_zone_settings.h index 0ec12f32df..a99d6b274e 100644 --- a/pcbnew/class_zone_settings.h +++ b/pcbnew/class_zone_settings.h @@ -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; diff --git a/pcbnew/classpcb.cpp b/pcbnew/classpcb.cpp index 1bba2e67dd..a697a33292 100644 --- a/pcbnew/classpcb.cpp +++ b/pcbnew/classpcb.cpp @@ -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 diff --git a/pcbnew/clean.cpp b/pcbnew/clean.cpp index d350b5f3f0..fbb1b79da0 100644 --- a/pcbnew/clean.cpp +++ b/pcbnew/clean.cpp @@ -226,7 +226,7 @@ bool TRACKS_CLEANER::remove_duplicates_of_via( const VIA *aVia ) (alt_via->GetStart() == aVia->GetStart()) ) { // delete via - m_Brd->GetRatsnest()->Remove( alt_via ); + m_Brd->GetRatsnest()->Remove( alt_via ); alt_via->ViewRelease(); alt_via->DeleteStructure(); modified = true; @@ -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,8 +285,8 @@ 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; - const VIA* via = dyn_cast( aTrack ); + LAYER_ID top_layer, bottom_layer; + const VIA* via = dyn_cast( aTrack ); if( via ) via->LayerPair( &top_layer, &bottom_layer ); @@ -318,7 +320,7 @@ bool TRACKS_CLEANER::testTrackEndpointDangling( TRACK *aTrack, ENDPOINT_T aEndPo /* If a via is connected to this end, test if this via has a second item connected. * If not, remove the current segment (the via would then become * unconnected and remove on the following pass) */ - VIA* via = dyn_cast( other ); + VIA* via = dyn_cast( other ); if( via ) { @@ -436,10 +438,10 @@ bool TRACKS_CLEANER::remove_duplicates_of_track( const TRACK *aTrack ) if( ((aTrack->GetStart() == other->GetStart()) && (aTrack->GetEnd() == other->GetEnd())) || ((aTrack->GetStart() == other->GetEnd()) && - (aTrack->GetEnd() == other->GetStart()))) + (aTrack->GetEnd() == other->GetStart()))) { - m_Brd->GetRatsnest()->Remove( other ); - other->ViewRelease(); + m_Brd->GetRatsnest()->Remove( other ); + other->ViewRelease(); other->DeleteStructure(); modified = true; } @@ -466,7 +468,7 @@ bool TRACKS_CLEANER::merge_collinear_of_track( TRACK *aSegment ) { // the two segments must have the same width and the other // cannot be a via - if( (aSegment->GetWidth() == other->GetWidth()) && + if( (aSegment->GetWidth() == other->GetWidth()) && (other->Type() == PCB_TRACE_T) ) { // There can be only one segment connected @@ -551,7 +553,7 @@ static bool parallelism_test( int dx1, int dy1, int dx2, int dy2 ) if( dy2 == 0 ) return dy1 == 0; - /* test for alignment in other cases: Do the usual cross product test + /* test for alignment in other cases: Do the usual cross product test * (the same as testing the slope, but without a division) */ return ((double)dy1 * dx2 == (double)dx1 * dy2); } diff --git a/pcbnew/collectors.cpp b/pcbnew/collectors.cpp index 2470684c6d..a2e1d845f8 100644 --- a/pcbnew/collectors.cpp +++ b/pcbnew/collectors.cpp @@ -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 diff --git a/pcbnew/collectors.h b/pcbnew/collectors.h index 8eef56af40..267ec20034 100644 --- a/pcbnew/collectors.h +++ b/pcbnew/collectors.h @@ -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,59 +440,52 @@ public: * Function IsLayerLocked * @return bool - true if the given layer is locked, else false. */ - bool IsLayerLocked( LAYER_NUM aLayer ) const - { - return GetLayerMask( aLayer ) & m_LayerLocked; - } - void SetLayerLocked( LAYER_NUM aLayer, bool isLocked ) + bool IsLayerLocked( LAYER_ID aLayerId ) const { - 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 - { - return GetLayerMask( aLayer ) & m_LayerVisible; - } - void SetLayerVisible( LAYER_NUM aLayer, bool isVisible ) + bool IsLayerVisible( LAYER_ID aLayerId ) const { - if( isVisible ) - m_LayerVisible |= GetLayerMask( aLayer ); - else - m_LayerVisible &= ~GetLayerMask( aLayer ); + return m_LayerVisible[aLayerId]; } - void SetLayerVisibleBits( LAYER_MSK aLayerBits ) { m_LayerVisible = aLayerBits; } - + void SetLayerVisible( LAYER_ID aLayerId, bool isVisible ) + { + m_LayerVisible.set( aLayerId, isVisible ); + } + void SetLayerVisibleBits( LSET aLayerBits ) { m_LayerVisible = aLayerBits; } /** * Function IgnoreLockedLayers * @return bool - true if should ignore locked layers, else false. */ - bool IgnoreLockedLayers() const { return m_IgnoreLockedLayers; } - void SetIgnoreLockedLayers( bool ignore ) { m_IgnoreLockedLayers = ignore; } + bool IgnoreLockedLayers() const { return m_IgnoreLockedLayers; } + void SetIgnoreLockedLayers( bool ignore ) { m_IgnoreLockedLayers = ignore; } /** * Function IgnoredNonVisibleLayers * @return bool - true if should ignore non-visible layers, else false. */ - bool IgnoreNonVisibleLayers() const { return m_IgnoreNonVisibleLayers; } - void SetIgnoreNonVisibleLayers( bool ignore ) { m_IgnoreLockedLayers = ignore; } + bool IgnoreNonVisibleLayers() const { return m_IgnoreNonVisibleLayers; } + void SetIgnoreNonVisibleLayers( bool ignore ) { m_IgnoreLockedLayers = ignore; } /** * 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; } /** @@ -503,16 +493,16 @@ public: * provides wildcard behavior regarding the preferred layer. * @return bool - true if should ignore preferred layer, else false. */ - bool IgnorePreferredLayer() const { return m_IgnorePreferredLayer; } - void SetIgnorePreferredLayer( bool ignore ) { m_IgnorePreferredLayer = ignore; } + bool IgnorePreferredLayer() const { return m_IgnorePreferredLayer; } + void SetIgnorePreferredLayer( bool ignore ) { m_IgnorePreferredLayer = ignore; } /** * Function IgnoreLockedItems * @return bool - true if should ignore locked items, else false. */ - bool IgnoreLockedItems() const { return m_IgnoreLockedItems; } - void SetIgnoreLockedItems( bool ignore ) { m_IgnoreLockedItems = ignore; } + bool IgnoreLockedItems() const { return m_IgnoreLockedItems; } + void SetIgnoreLockedItems( bool ignore ) { m_IgnoreLockedItems = ignore; } /** diff --git a/pcbnew/connect.cpp b/pcbnew/connect.cpp index 4623c5e932..f03d19c6f1 100644 --- a/pcbnew/connect.cpp +++ b/pcbnew/connect.cpp @@ -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 ) diff --git a/pcbnew/deltrack.cpp b/pcbnew/deltrack.cpp index 42c98cd605..ed514b3f7c 100644 --- a/pcbnew/deltrack.cpp +++ b/pcbnew/deltrack.cpp @@ -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(); ) diff --git a/pcbnew/dialogs/dialog_SVG_print.cpp b/pcbnew/dialogs/dialog_SVG_print.cpp index 5fb3757479..0d6bd1c804 100644 --- a/pcbnew/dialogs/dialog_SVG_print.cpp +++ b/pcbnew/dialogs/dialog_SVG_print.cpp @@ -28,7 +28,6 @@ #include -//#include #include #include #include @@ -45,7 +44,56 @@ #include #include #include -#include +#include +#include + + +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" ) @@ -53,33 +101,36 @@ #define PLOTSVGPLOT_BRD_EDGE_KEY wxT( "PlotSVGBrdEdge" ) // reasonable values for default pen width -#define WIDTH_MAX_VALUE (2 * IU_PER_MM) -#define WIDTH_MIN_VALUE (0.05 * IU_PER_MM) +#define WIDTH_MAX_VALUE (2 * IU_PER_MM) +#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_config = Kiface().KifaceSettings(); + 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; layerGetValue() ) + 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 ); - } + LAYER_ID layer = *seq; - wxString msg; + wxFileName fn( boardFilename ); - for( LAYER_NUM layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer ) - { - LAYER_MSK currlayer_mask = GetLayerMask( layer ); + wxString suffix = aOnlyOneFile ? wxT( "brd" ) : m_board->GetStandardLayerName( 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 ); - } - - wxFileName fn(boardFilename); 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,66 +329,74 @@ 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 ); - PAGE_INFO pageInfo = m_board->GetPageSettings(); - wxPoint axisorigin = m_board->GetAuxOrigin(); + plot_opts.SetReferenceColor( color ); + plot_opts.SetValueColor( color ); + + PAGE_INFO pageInfo = m_board->GetPageSettings(); + wxPoint axisorigin = m_board->GetAuxOrigin(); if( PageIsBoardBoundarySize() ) { - EDA_RECT bbox = m_board->ComputeBoundingBox(); - PAGE_INFO currpageInfo = m_board->GetPageSettings(); + 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(); } @@ -366,40 +404,48 @@ void DIALOG_SVG_PRINT::OnButtonCancelClick( wxCommandEvent& event ) void DIALOG_SVG_PRINT::OnCloseWindow( wxCloseEvent& event ) { - SetPenWidth(); - m_printBW = m_ModeColorOption->GetSelection(); - m_oneFileOnly = m_rbFileOpt->GetSelection() == 1; - - if( m_config ) + if( m_did_print ) // unless output was created, this is tantamount to a cancel. { - m_config->Write( PLOTSVGMODECOLOR_KEY, m_printBW ); - m_config->Write( PLOTSVGPAGESIZEOPT_KEY, m_rbSvgPageSizeOpt->GetSelection() ); - m_config->Write( PLOTSVGPLOT_BRD_EDGE_KEY, m_PrintBoardEdgesCtrl->GetValue() ); + SetPenWidth(); + m_printBW = m_ModeColorOption->GetSelection(); + m_oneFileOnly = m_rbFileOpt->GetSelection() == 1; - wxString layerKey; + // 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. - for( LAYER_NUM layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer ) + wxString dirStr = m_outputDirectoryName->GetValue(); + dirStr.Replace( wxT( "\\" ), wxT( "/" ) ); + + m_callers_params->SetOutputDirectory( dirStr ); + + if( m_config ) { - if( m_boxSelectLayer[layer] == NULL ) - continue; + m_config->Write( PLOTSVGMODECOLOR_KEY, m_printBW ); + m_config->Write( PLOTSVGPAGESIZEOPT_KEY, m_rbSvgPageSizeOpt->GetSelection() ); + m_config->Write( PLOTSVGPLOT_BRD_EDGE_KEY, m_PrintBoardEdgesCtrl->GetValue() ); - layerKey.Printf( OPTKEY_LAYERBASE, layer ); - m_config->Write( layerKey, m_boxSelectLayer[layer]->IsChecked() ); + wxString layerKey; + + for( unsigned layer = 0; layer < DIM(m_boxSelectLayer); ++layer ) + { + 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( "/" ) ); - - if( dirStr != m_parent->GetPlotSettings().GetOutputDirectory() ) - { - PCB_PLOT_PARAMS tempOptions( m_parent->GetPlotSettings() ); - tempOptions.SetOutputDirectory( dirStr ); - m_parent->SetPlotSettings( tempOptions ); - m_parent->OnModify(); - } - - EndModal( 0 ); + EndModal( m_did_print ? wxID_OK : wxID_CANCEL ); +} + + +bool InvokeSVGPrint( wxTopLevelWindow* aCaller, BOARD* aBoard, PCB_PLOT_PARAMS* aSettings ) +{ + DIALOG_SVG_PRINT dlg( aCaller, aBoard, aSettings ); + + return dlg.ShowModal() == wxID_OK; } diff --git a/pcbnew/dialogs/dialog_SVG_print.h b/pcbnew/dialogs/dialog_SVG_print.h deleted file mode 100644 index bf7309c409..0000000000 --- a/pcbnew/dialogs/dialog_SVG_print.h +++ /dev/null @@ -1,53 +0,0 @@ - -#ifndef _DIALOG_SVG_PRINT_H_ -#define _DIALOG_SVG_PRINT_H_ - - -#include - - -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_ diff --git a/pcbnew/dialogs/dialog_SVG_print_base.cpp b/pcbnew/dialogs/dialog_SVG_print_base.cpp index 015b9d8282..f3dabf6d3a 100644 --- a/pcbnew/dialogs/dialog_SVG_print_base.cpp +++ b/pcbnew/dialogs/dialog_SVG_print_base.cpp @@ -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 ); } diff --git a/pcbnew/dialogs/dialog_SVG_print_base.fbp b/pcbnew/dialogs/dialog_SVG_print_base.fbp index 8b942ffdcc..cb65010311 100644 --- a/pcbnew/dialogs/dialog_SVG_print_base.fbp +++ b/pcbnew/dialogs/dialog_SVG_print_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -20,8 +20,10 @@ . 1 + 1 1 1 + UI 1 0 @@ -59,7 +61,7 @@ - OnCloseWindow + @@ -1208,7 +1210,7 @@ - OnButtonCancelClick + OnButtonCloseClick diff --git a/pcbnew/dialogs/dialog_SVG_print_base.h b/pcbnew/dialogs/dialog_SVG_print_base.h index e82ea7e389..d0667f655c 100644 --- a/pcbnew/dialogs/dialog_SVG_print_base.h +++ b/pcbnew/dialogs/dialog_SVG_print_base.h @@ -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: diff --git a/pcbnew/dialogs/dialog_copper_zones.cpp b/pcbnew/dialogs/dialog_copper_zones.cpp index a343c60198..eadc3fa26b 100644 --- a/pcbnew/dialogs/dialog_copper_zones.cpp +++ b/pcbnew/dialogs/dialog_copper_zones.cpp @@ -71,7 +71,8 @@ private: ///< true = pad count sort. long m_NetFiltering; - std::vector m_LayerId; ///< Handle the real layer number from layer + + std::vector 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,8 +283,10 @@ 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)); + + m_LayerSelectionCtrl->SetMinSize( wxSize( ctrlWidth, -1 ) ); wxString netNameDoNotShowFilter = wxT( "Net-*" ); if( m_Config ) @@ -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(); diff --git a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp index 8f9f822e47..96915ab88d 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp @@ -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 ) diff --git a/pcbnew/dialogs/dialog_gendrill.cpp b/pcbnew/dialogs/dialog_gendrill.cpp index 6daa73471e..7567d3d2c1 100644 --- a/pcbnew/dialogs/dialog_gendrill.cpp +++ b/pcbnew/dialogs/dialog_gendrill.cpp @@ -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 } diff --git a/pcbnew/dialogs/dialog_global_deletion.cpp b/pcbnew/dialogs/dialog_global_deletion.cpp index 318da30d64..f3fed257e7 100644 --- a/pcbnew/dialogs/dialog_global_deletion.cpp +++ b/pcbnew/dialogs/dialog_global_deletion.cpp @@ -39,11 +39,11 @@ #include -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 ); diff --git a/pcbnew/dialogs/dialog_graphic_item_properties.cpp b/pcbnew/dialogs/dialog_graphic_item_properties.cpp index ea133794b8..d9cb7818c9 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties.cpp @@ -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; diff --git a/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp b/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp index c04fb03acd..25c4328580 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp @@ -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 ); + wxMessageBox( _( "This item has an illegal layer id.\n" + "Now, forced on the front silk screen layer. Please, fix it" ) ); + 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 ) { diff --git a/pcbnew/dialogs/dialog_keepout_area_properties.cpp b/pcbnew/dialogs/dialog_keepout_area_properties.cpp index af5ba6ff24..ac2c8d08db 100644 --- a/pcbnew/dialogs/dialog_keepout_area_properties.cpp +++ b/pcbnew/dialogs/dialog_keepout_area_properties.cpp @@ -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: diff --git a/pcbnew/dialogs/dialog_layers_setup.cpp b/pcbnew/dialogs/dialog_layers_setup.cpp index 636cea9687..5b57412ee5 100644 --- a/pcbnew/dialogs/dialog_layers_setup.cpp +++ b/pcbnew/dialogs/dialog_layers_setup.cpp @@ -25,12 +25,11 @@ #include -#include #include #include #include -#include +#include #include @@ -70,32 +69,92 @@ 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 ); - int m_CopperLayerCount; - LAYER_MSK m_EnabledLayers; +protected: + int m_CopperLayerCount; + LSET m_EnabledLayers; - BOARD* m_Pcb; - - wxStaticText* m_NameStaticText; - wxStaticText* m_EnabledStaticText; - wxStaticText* m_TypeStaticText; + BOARD* m_Pcb; + wxStaticText* m_NameStaticText; + 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; layerSetSelection( 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; layerGetValue() ) { - layerMaskResult |= GetLayerMask( layer ); + layerMaskResult.set( layer ); } } @@ -411,23 +474,20 @@ 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 ) { - bool state = copperCount > 0; + LAYER_ID layer = *seq; + bool state = copperCount > 0; #ifdef HIDE_INACTIVE_LAYERS // This code hides non-active copper layers, or redisplays hidden @@ -448,10 +508,9 @@ void DIALOG_LAYERS_SETUP::setCopperLayerCheckBoxes( int copperCount ) #ifdef HIDE_INACTIVE_LAYERS // Send an size event to force sizers to be updated, // because the number of copper layers can have changed. - wxSizeEvent evt_size(m_LayersListPanel->GetSize() ); + 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,29 +593,27 @@ 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 ); m_Pcb->SetLayerName( layer, name ); - LAYER_T t = (LAYER_T) getLayerTypeIndex(layer); + LAYER_T t = (LAYER_T) getLayerTypeIndex( layer ); m_Pcb->SetLayerType( layer, t ); } } - 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 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; } diff --git a/pcbnew/dialogs/dialog_layers_setup_base.cpp b/pcbnew/dialogs/dialog_layers_setup_base.cpp index f4cccb0019..f0e5978dba 100644 --- a/pcbnew/dialogs/dialog_layers_setup_base.cpp +++ b/pcbnew/dialogs/dialog_layers_setup_base.cpp @@ -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! @@ -42,10 +42,10 @@ DIALOG_LAYERS_SETUP_BASE::DIALOG_LAYERS_SETUP_BASE( wxWindow* parent, wxWindowID m_staticTextCopperLayers->Wrap( -1 ); bCopperLayersSizer->Add( m_staticTextCopperLayers, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - wxString m_CopperLayersChoiceChoices[] = { _("2"), _("4"), _("6"), _("8"), _("10"), _("12"), _("14"), _("16") }; + wxString m_CopperLayersChoiceChoices[] = { _("2"), _("4"), _("6"), _("8"), _("10"), _("12"), _("14"), _("16"), _("18"), _("20"), _("22"), _("24"), _("26"), _("27"), _("28"), _("30"), _("32") }; int m_CopperLayersChoiceNChoices = sizeof( m_CopperLayersChoiceChoices ) / sizeof( wxString ); m_CopperLayersChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_CopperLayersChoiceNChoices, m_CopperLayersChoiceChoices, 0 ); - m_CopperLayersChoice->SetSelection( 0 ); + m_CopperLayersChoice->SetSelection( 3 ); bCopperLayersSizer->Add( m_CopperLayersChoice, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); @@ -212,383 +212,815 @@ DIALOG_LAYERS_SETUP_BASE::DIALOG_LAYERS_SETUP_BASE( wxWindow* parent, wxWindowID m_LayerListFlexGridSizer->Add( m_FrontChoice, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - m_Inner2Name = new wxTextCtrl( m_LayersListPanel, ID_INNER2NAME, _("Inner2"), wxDefaultPosition, wxDefaultSize, 0 ); - m_Inner2Name->SetMaxLength( 20 ); - m_LayerListFlexGridSizer->Add( m_Inner2Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + m_In1Name = new wxTextCtrl( m_LayersListPanel, ID_IN1NAME, _("In1"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In1Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In1Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); - m_Inner2Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - m_Inner2Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + m_In1Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In1Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); - wxBoxSizer* bInner2Sizer; - bInner2Sizer = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bIn1Sizer; + bIn1Sizer = new wxBoxSizer( wxVERTICAL ); - m_Inner2CheckBox = new wxCheckBox( m_Inner2Panel, ID_INNER2CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bInner2Sizer->Add( m_Inner2CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_In1CheckBox = new wxCheckBox( m_In1Panel, ID_IN1CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn1Sizer->Add( m_In1CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_Inner2Panel->SetSizer( bInner2Sizer ); - m_Inner2Panel->Layout(); - bInner2Sizer->Fit( m_Inner2Panel ); - m_LayerListFlexGridSizer->Add( m_Inner2Panel, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + m_In1Panel->SetSizer( bIn1Sizer ); + m_In1Panel->Layout(); + bIn1Sizer->Fit( m_In1Panel ); + m_LayerListFlexGridSizer->Add( m_In1Panel, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - wxString m_Inner2ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; - int m_Inner2ChoiceNChoices = sizeof( m_Inner2ChoiceChoices ) / sizeof( wxString ); - m_Inner2Choice = new wxChoice( m_LayersListPanel, ID_INNER2CHOICE, wxDefaultPosition, wxDefaultSize, m_Inner2ChoiceNChoices, m_Inner2ChoiceChoices, 0 ); - m_Inner2Choice->SetSelection( 0 ); - m_Inner2Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + wxString m_In1ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In1ChoiceNChoices = sizeof( m_In1ChoiceChoices ) / sizeof( wxString ); + m_In1Choice = new wxChoice( m_LayersListPanel, ID_IN1CHOICE, wxDefaultPosition, wxDefaultSize, m_In1ChoiceNChoices, m_In1ChoiceChoices, 0 ); + m_In1Choice->SetSelection( 0 ); + m_In1Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); - m_LayerListFlexGridSizer->Add( m_Inner2Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + m_LayerListFlexGridSizer->Add( m_In1Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); - m_Inner3Name = new wxTextCtrl( m_LayersListPanel, ID_INNER3NAME, _("Inner3"), wxDefaultPosition, wxDefaultSize, 0 ); - m_Inner3Name->SetMaxLength( 20 ); - m_LayerListFlexGridSizer->Add( m_Inner3Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + m_In2Name = new wxTextCtrl( m_LayersListPanel, ID_IN2NAME, _("In2"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In2Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In2Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); - m_Inner3Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - m_Inner3Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + m_In2Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In2Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); - wxBoxSizer* bInner3Sizer; - bInner3Sizer = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bIn2Sizer; + bIn2Sizer = new wxBoxSizer( wxVERTICAL ); - m_Inner3CheckBox = new wxCheckBox( m_Inner3Panel, ID_INNER3CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bInner3Sizer->Add( m_Inner3CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_In2CheckBox = new wxCheckBox( m_In2Panel, ID_IN2CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn2Sizer->Add( m_In2CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_Inner3Panel->SetSizer( bInner3Sizer ); - m_Inner3Panel->Layout(); - bInner3Sizer->Fit( m_Inner3Panel ); - m_LayerListFlexGridSizer->Add( m_Inner3Panel, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + m_In2Panel->SetSizer( bIn2Sizer ); + m_In2Panel->Layout(); + bIn2Sizer->Fit( m_In2Panel ); + m_LayerListFlexGridSizer->Add( m_In2Panel, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - wxString m_Inner3ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; - int m_Inner3ChoiceNChoices = sizeof( m_Inner3ChoiceChoices ) / sizeof( wxString ); - m_Inner3Choice = new wxChoice( m_LayersListPanel, ID_INNER3CHOICE, wxDefaultPosition, wxDefaultSize, m_Inner3ChoiceNChoices, m_Inner3ChoiceChoices, 0 ); - m_Inner3Choice->SetSelection( 0 ); - m_Inner3Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + wxString m_In2ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In2ChoiceNChoices = sizeof( m_In2ChoiceChoices ) / sizeof( wxString ); + m_In2Choice = new wxChoice( m_LayersListPanel, ID_IN2CHOICE, wxDefaultPosition, wxDefaultSize, m_In2ChoiceNChoices, m_In2ChoiceChoices, 0 ); + m_In2Choice->SetSelection( 0 ); + m_In2Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); - m_LayerListFlexGridSizer->Add( m_Inner3Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + m_LayerListFlexGridSizer->Add( m_In2Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); - m_Inner4Name = new wxTextCtrl( m_LayersListPanel, ID_INNER4NAME, _("Inner4"), wxDefaultPosition, wxDefaultSize, 0 ); - m_Inner4Name->SetMaxLength( 20 ); - m_LayerListFlexGridSizer->Add( m_Inner4Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + m_In3Name = new wxTextCtrl( m_LayersListPanel, ID_IN3NAME, _("In3"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In3Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In3Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); - m_Inner4Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - m_Inner4Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + m_In3Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In3Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); - wxBoxSizer* bInner4Sizer; - bInner4Sizer = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bIn3Sizer; + bIn3Sizer = new wxBoxSizer( wxVERTICAL ); - m_Inner4CheckBox = new wxCheckBox( m_Inner4Panel, ID_INNER4CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bInner4Sizer->Add( m_Inner4CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_In3CheckBox = new wxCheckBox( m_In3Panel, ID_IN3CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn3Sizer->Add( m_In3CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_Inner4Panel->SetSizer( bInner4Sizer ); - m_Inner4Panel->Layout(); - bInner4Sizer->Fit( m_Inner4Panel ); - m_LayerListFlexGridSizer->Add( m_Inner4Panel, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + m_In3Panel->SetSizer( bIn3Sizer ); + m_In3Panel->Layout(); + bIn3Sizer->Fit( m_In3Panel ); + m_LayerListFlexGridSizer->Add( m_In3Panel, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - wxString m_Inner4ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; - int m_Inner4ChoiceNChoices = sizeof( m_Inner4ChoiceChoices ) / sizeof( wxString ); - m_Inner4Choice = new wxChoice( m_LayersListPanel, ID_INNER4CHOICE, wxDefaultPosition, wxDefaultSize, m_Inner4ChoiceNChoices, m_Inner4ChoiceChoices, 0 ); - m_Inner4Choice->SetSelection( 0 ); - m_Inner4Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + wxString m_In3ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In3ChoiceNChoices = sizeof( m_In3ChoiceChoices ) / sizeof( wxString ); + m_In3Choice = new wxChoice( m_LayersListPanel, ID_IN3CHOICE, wxDefaultPosition, wxDefaultSize, m_In3ChoiceNChoices, m_In3ChoiceChoices, 0 ); + m_In3Choice->SetSelection( 0 ); + m_In3Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); - m_LayerListFlexGridSizer->Add( m_Inner4Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + m_LayerListFlexGridSizer->Add( m_In3Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); - m_Inner5Name = new wxTextCtrl( m_LayersListPanel, ID_INNER5NAME, _("Inner5"), wxDefaultPosition, wxDefaultSize, 0 ); - m_Inner5Name->SetMaxLength( 20 ); - m_LayerListFlexGridSizer->Add( m_Inner5Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + m_In4Name = new wxTextCtrl( m_LayersListPanel, ID_IN4NAME, _("In4"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In4Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In4Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); - m_Inner5Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - m_Inner5Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + m_In4Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In4Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); - wxBoxSizer* bInner5Sizer; - bInner5Sizer = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bIn4Sizer; + bIn4Sizer = new wxBoxSizer( wxVERTICAL ); - m_Inner5CheckBox = new wxCheckBox( m_Inner5Panel, ID_INNER5CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bInner5Sizer->Add( m_Inner5CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_In4CheckBox = new wxCheckBox( m_In4Panel, ID_IN4CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn4Sizer->Add( m_In4CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_Inner5Panel->SetSizer( bInner5Sizer ); - m_Inner5Panel->Layout(); - bInner5Sizer->Fit( m_Inner5Panel ); - m_LayerListFlexGridSizer->Add( m_Inner5Panel, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + m_In4Panel->SetSizer( bIn4Sizer ); + m_In4Panel->Layout(); + bIn4Sizer->Fit( m_In4Panel ); + m_LayerListFlexGridSizer->Add( m_In4Panel, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - wxString m_Inner5ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; - int m_Inner5ChoiceNChoices = sizeof( m_Inner5ChoiceChoices ) / sizeof( wxString ); - m_Inner5Choice = new wxChoice( m_LayersListPanel, ID_INNER5CHOICE, wxDefaultPosition, wxDefaultSize, m_Inner5ChoiceNChoices, m_Inner5ChoiceChoices, 0 ); - m_Inner5Choice->SetSelection( 0 ); - m_Inner5Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + wxString m_In4ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In4ChoiceNChoices = sizeof( m_In4ChoiceChoices ) / sizeof( wxString ); + m_In4Choice = new wxChoice( m_LayersListPanel, ID_IN4CHOICE, wxDefaultPosition, wxDefaultSize, m_In4ChoiceNChoices, m_In4ChoiceChoices, 0 ); + m_In4Choice->SetSelection( 0 ); + m_In4Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); - m_LayerListFlexGridSizer->Add( m_Inner5Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + m_LayerListFlexGridSizer->Add( m_In4Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); - m_Inner6Name = new wxTextCtrl( m_LayersListPanel, ID_INNER6NAME, _("Inner6"), wxDefaultPosition, wxDefaultSize, 0 ); - m_Inner6Name->SetMaxLength( 20 ); - m_LayerListFlexGridSizer->Add( m_Inner6Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + m_In5Name = new wxTextCtrl( m_LayersListPanel, ID_IN5NAME, _("In5"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In5Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In5Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); - m_Inner6Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - m_Inner6Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + m_In5Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In5Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); - wxBoxSizer* bInner6Sizer; - bInner6Sizer = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bIn5Sizer; + bIn5Sizer = new wxBoxSizer( wxVERTICAL ); - m_Inner6CheckBox = new wxCheckBox( m_Inner6Panel, ID_INNER6CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bInner6Sizer->Add( m_Inner6CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_In5CheckBox = new wxCheckBox( m_In5Panel, ID_IN5CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn5Sizer->Add( m_In5CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_Inner6Panel->SetSizer( bInner6Sizer ); - m_Inner6Panel->Layout(); - bInner6Sizer->Fit( m_Inner6Panel ); - m_LayerListFlexGridSizer->Add( m_Inner6Panel, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + m_In5Panel->SetSizer( bIn5Sizer ); + m_In5Panel->Layout(); + bIn5Sizer->Fit( m_In5Panel ); + m_LayerListFlexGridSizer->Add( m_In5Panel, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - wxString m_Inner6ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; - int m_Inner6ChoiceNChoices = sizeof( m_Inner6ChoiceChoices ) / sizeof( wxString ); - m_Inner6Choice = new wxChoice( m_LayersListPanel, ID_INNER6CHOICE, wxDefaultPosition, wxDefaultSize, m_Inner6ChoiceNChoices, m_Inner6ChoiceChoices, 0 ); - m_Inner6Choice->SetSelection( 0 ); - m_Inner6Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + wxString m_In5ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In5ChoiceNChoices = sizeof( m_In5ChoiceChoices ) / sizeof( wxString ); + m_In5Choice = new wxChoice( m_LayersListPanel, ID_IN5CHOICE, wxDefaultPosition, wxDefaultSize, m_In5ChoiceNChoices, m_In5ChoiceChoices, 0 ); + m_In5Choice->SetSelection( 0 ); + m_In5Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); - m_LayerListFlexGridSizer->Add( m_Inner6Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + m_LayerListFlexGridSizer->Add( m_In5Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); - m_Inner7Name = new wxTextCtrl( m_LayersListPanel, ID_INNER7NAME, _("Inner7"), wxDefaultPosition, wxDefaultSize, 0 ); - m_Inner7Name->SetMaxLength( 20 ); - m_LayerListFlexGridSizer->Add( m_Inner7Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + m_In6Name = new wxTextCtrl( m_LayersListPanel, ID_IN6NAME, _("In6"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In6Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In6Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); - m_Inner7Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - m_Inner7Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + m_In6Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In6Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); - wxBoxSizer* bInner7Sizer; - bInner7Sizer = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bIn6Sizer; + bIn6Sizer = new wxBoxSizer( wxVERTICAL ); - m_Inner7CheckBox = new wxCheckBox( m_Inner7Panel, ID_INNER7CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bInner7Sizer->Add( m_Inner7CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_In6CheckBox = new wxCheckBox( m_In6Panel, ID_IN6CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn6Sizer->Add( m_In6CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_Inner7Panel->SetSizer( bInner7Sizer ); - m_Inner7Panel->Layout(); - bInner7Sizer->Fit( m_Inner7Panel ); - m_LayerListFlexGridSizer->Add( m_Inner7Panel, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + m_In6Panel->SetSizer( bIn6Sizer ); + m_In6Panel->Layout(); + bIn6Sizer->Fit( m_In6Panel ); + m_LayerListFlexGridSizer->Add( m_In6Panel, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - wxString m_Inner7ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; - int m_Inner7ChoiceNChoices = sizeof( m_Inner7ChoiceChoices ) / sizeof( wxString ); - m_Inner7Choice = new wxChoice( m_LayersListPanel, ID_INNER7CHOICE, wxDefaultPosition, wxDefaultSize, m_Inner7ChoiceNChoices, m_Inner7ChoiceChoices, 0 ); - m_Inner7Choice->SetSelection( 0 ); - m_Inner7Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + wxString m_In6ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In6ChoiceNChoices = sizeof( m_In6ChoiceChoices ) / sizeof( wxString ); + m_In6Choice = new wxChoice( m_LayersListPanel, ID_IN6CHOICE, wxDefaultPosition, wxDefaultSize, m_In6ChoiceNChoices, m_In6ChoiceChoices, 0 ); + m_In6Choice->SetSelection( 0 ); + m_In6Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); - m_LayerListFlexGridSizer->Add( m_Inner7Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + m_LayerListFlexGridSizer->Add( m_In6Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); - m_Inner8Name = new wxTextCtrl( m_LayersListPanel, ID_INNER8NAME, _("Inner8"), wxDefaultPosition, wxDefaultSize, 0 ); - m_Inner8Name->SetMaxLength( 20 ); - m_LayerListFlexGridSizer->Add( m_Inner8Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + m_In7Name = new wxTextCtrl( m_LayersListPanel, ID_IN7NAME, _("In7"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In7Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In7Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); - m_Inner8Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - m_Inner8Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + m_In7Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In7Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); - wxBoxSizer* bInner8Sizer; - bInner8Sizer = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bIn7Sizer; + bIn7Sizer = new wxBoxSizer( wxVERTICAL ); - m_Inner8CheckBox = new wxCheckBox( m_Inner8Panel, ID_INNER8CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bInner8Sizer->Add( m_Inner8CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_In7CheckBox = new wxCheckBox( m_In7Panel, ID_IN7CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn7Sizer->Add( m_In7CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_Inner8Panel->SetSizer( bInner8Sizer ); - m_Inner8Panel->Layout(); - bInner8Sizer->Fit( m_Inner8Panel ); - m_LayerListFlexGridSizer->Add( m_Inner8Panel, 1, wxEXPAND, 5 ); + m_In7Panel->SetSizer( bIn7Sizer ); + m_In7Panel->Layout(); + bIn7Sizer->Fit( m_In7Panel ); + m_LayerListFlexGridSizer->Add( m_In7Panel, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - wxString m_Inner8ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; - int m_Inner8ChoiceNChoices = sizeof( m_Inner8ChoiceChoices ) / sizeof( wxString ); - m_Inner8Choice = new wxChoice( m_LayersListPanel, ID_INNER8CHOICE, wxDefaultPosition, wxDefaultSize, m_Inner8ChoiceNChoices, m_Inner8ChoiceChoices, 0 ); - m_Inner8Choice->SetSelection( 0 ); - m_Inner8Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + wxString m_In7ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In7ChoiceNChoices = sizeof( m_In7ChoiceChoices ) / sizeof( wxString ); + m_In7Choice = new wxChoice( m_LayersListPanel, ID_IN7CHOICE, wxDefaultPosition, wxDefaultSize, m_In7ChoiceNChoices, m_In7ChoiceChoices, 0 ); + m_In7Choice->SetSelection( 0 ); + m_In7Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); - m_LayerListFlexGridSizer->Add( m_Inner8Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + m_LayerListFlexGridSizer->Add( m_In7Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); - m_Inner9Name = new wxTextCtrl( m_LayersListPanel, ID_INNER9NAME, _("Inner9"), wxDefaultPosition, wxDefaultSize, 0 ); - m_Inner9Name->SetMaxLength( 20 ); - m_LayerListFlexGridSizer->Add( m_Inner9Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + m_In8Name = new wxTextCtrl( m_LayersListPanel, ID_IN8NAME, _("In8"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In8Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In8Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); - m_Inner9Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - m_Inner9Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + m_In8Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In8Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); - wxBoxSizer* bInner9Sizer; - bInner9Sizer = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bIn8Sizer; + bIn8Sizer = new wxBoxSizer( wxVERTICAL ); - m_Inner9CheckBox = new wxCheckBox( m_Inner9Panel, ID_INNER9CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bInner9Sizer->Add( m_Inner9CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_In8CheckBox = new wxCheckBox( m_In8Panel, ID_IN8CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn8Sizer->Add( m_In8CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_Inner9Panel->SetSizer( bInner9Sizer ); - m_Inner9Panel->Layout(); - bInner9Sizer->Fit( m_Inner9Panel ); - m_LayerListFlexGridSizer->Add( m_Inner9Panel, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + m_In8Panel->SetSizer( bIn8Sizer ); + m_In8Panel->Layout(); + bIn8Sizer->Fit( m_In8Panel ); + m_LayerListFlexGridSizer->Add( m_In8Panel, 1, wxEXPAND, 5 ); - wxString m_Inner9ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; - int m_Inner9ChoiceNChoices = sizeof( m_Inner9ChoiceChoices ) / sizeof( wxString ); - m_Inner9Choice = new wxChoice( m_LayersListPanel, ID_INNER9CHOICE, wxDefaultPosition, wxDefaultSize, m_Inner9ChoiceNChoices, m_Inner9ChoiceChoices, 0 ); - m_Inner9Choice->SetSelection( 0 ); - m_Inner9Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + wxString m_In8ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In8ChoiceNChoices = sizeof( m_In8ChoiceChoices ) / sizeof( wxString ); + m_In8Choice = new wxChoice( m_LayersListPanel, ID_IN8CHOICE, wxDefaultPosition, wxDefaultSize, m_In8ChoiceNChoices, m_In8ChoiceChoices, 0 ); + m_In8Choice->SetSelection( 0 ); + m_In8Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); - m_LayerListFlexGridSizer->Add( m_Inner9Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + m_LayerListFlexGridSizer->Add( m_In8Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); - m_Inner10Name = new wxTextCtrl( m_LayersListPanel, ID_INNER10NAME, _("Inner10"), wxDefaultPosition, wxDefaultSize, 0 ); - m_Inner10Name->SetMaxLength( 20 ); - m_LayerListFlexGridSizer->Add( m_Inner10Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + m_In9Name = new wxTextCtrl( m_LayersListPanel, ID_IN9NAME, _("In9"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In9Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In9Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); - m_Inner10Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - m_Inner10Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + m_In9Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In9Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); - wxBoxSizer* bInner10Sizer; - bInner10Sizer = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bIn9Sizer; + bIn9Sizer = new wxBoxSizer( wxVERTICAL ); - m_Inner10CheckBox = new wxCheckBox( m_Inner10Panel, ID_INNER10CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bInner10Sizer->Add( m_Inner10CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_In9CheckBox = new wxCheckBox( m_In9Panel, ID_IN9CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn9Sizer->Add( m_In9CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_Inner10Panel->SetSizer( bInner10Sizer ); - m_Inner10Panel->Layout(); - bInner10Sizer->Fit( m_Inner10Panel ); - m_LayerListFlexGridSizer->Add( m_Inner10Panel, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + m_In9Panel->SetSizer( bIn9Sizer ); + m_In9Panel->Layout(); + bIn9Sizer->Fit( m_In9Panel ); + m_LayerListFlexGridSizer->Add( m_In9Panel, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - wxString m_Inner10ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; - int m_Inner10ChoiceNChoices = sizeof( m_Inner10ChoiceChoices ) / sizeof( wxString ); - m_Inner10Choice = new wxChoice( m_LayersListPanel, ID_INNER10CHOICE, wxDefaultPosition, wxDefaultSize, m_Inner10ChoiceNChoices, m_Inner10ChoiceChoices, 0 ); - m_Inner10Choice->SetSelection( 0 ); - m_Inner10Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + wxString m_In9ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In9ChoiceNChoices = sizeof( m_In9ChoiceChoices ) / sizeof( wxString ); + m_In9Choice = new wxChoice( m_LayersListPanel, ID_IN9CHOICE, wxDefaultPosition, wxDefaultSize, m_In9ChoiceNChoices, m_In9ChoiceChoices, 0 ); + m_In9Choice->SetSelection( 0 ); + m_In9Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); - m_LayerListFlexGridSizer->Add( m_Inner10Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + m_LayerListFlexGridSizer->Add( m_In9Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); - m_Inner11Name = new wxTextCtrl( m_LayersListPanel, ID_INNER11NAME, _("Inner11"), wxDefaultPosition, wxDefaultSize, 0 ); - m_Inner11Name->SetMaxLength( 20 ); - m_LayerListFlexGridSizer->Add( m_Inner11Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + m_In10Name = new wxTextCtrl( m_LayersListPanel, ID_IN10NAME, _("In10"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In10Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In10Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); - m_Inner11Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - m_Inner11Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + m_In10Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In10Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); - wxBoxSizer* bInner11Sizer; - bInner11Sizer = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bIn10Sizer; + bIn10Sizer = new wxBoxSizer( wxVERTICAL ); - m_Inner11CheckBox = new wxCheckBox( m_Inner11Panel, ID_INNER11CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bInner11Sizer->Add( m_Inner11CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_In10CheckBox = new wxCheckBox( m_In10Panel, ID_IN10CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn10Sizer->Add( m_In10CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_Inner11Panel->SetSizer( bInner11Sizer ); - m_Inner11Panel->Layout(); - bInner11Sizer->Fit( m_Inner11Panel ); - m_LayerListFlexGridSizer->Add( m_Inner11Panel, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + m_In10Panel->SetSizer( bIn10Sizer ); + m_In10Panel->Layout(); + bIn10Sizer->Fit( m_In10Panel ); + m_LayerListFlexGridSizer->Add( m_In10Panel, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - wxString m_Inner11ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; - int m_Inner11ChoiceNChoices = sizeof( m_Inner11ChoiceChoices ) / sizeof( wxString ); - m_Inner11Choice = new wxChoice( m_LayersListPanel, ID_INNER11CHOICE, wxDefaultPosition, wxDefaultSize, m_Inner11ChoiceNChoices, m_Inner11ChoiceChoices, 0 ); - m_Inner11Choice->SetSelection( 0 ); - m_Inner11Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + wxString m_In10ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In10ChoiceNChoices = sizeof( m_In10ChoiceChoices ) / sizeof( wxString ); + m_In10Choice = new wxChoice( m_LayersListPanel, ID_IN10CHOICE, wxDefaultPosition, wxDefaultSize, m_In10ChoiceNChoices, m_In10ChoiceChoices, 0 ); + m_In10Choice->SetSelection( 0 ); + m_In10Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); - m_LayerListFlexGridSizer->Add( m_Inner11Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + m_LayerListFlexGridSizer->Add( m_In10Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); - m_Inner12Name = new wxTextCtrl( m_LayersListPanel, ID_INNER12NAME, _("Inner12"), wxDefaultPosition, wxDefaultSize, 0 ); - m_Inner12Name->SetMaxLength( 20 ); - m_LayerListFlexGridSizer->Add( m_Inner12Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + m_In11Name = new wxTextCtrl( m_LayersListPanel, ID_IN11NAME, _("In11"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In11Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In11Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); - m_Inner12Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - m_Inner12Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + m_In11Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In11Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); - wxBoxSizer* bInner12Sizer; - bInner12Sizer = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bIn11Sizer; + bIn11Sizer = new wxBoxSizer( wxVERTICAL ); - m_Inner12CheckBox = new wxCheckBox( m_Inner12Panel, ID_INNER12CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bInner12Sizer->Add( m_Inner12CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_In11CheckBox = new wxCheckBox( m_In11Panel, ID_IN11CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn11Sizer->Add( m_In11CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_Inner12Panel->SetSizer( bInner12Sizer ); - m_Inner12Panel->Layout(); - bInner12Sizer->Fit( m_Inner12Panel ); - m_LayerListFlexGridSizer->Add( m_Inner12Panel, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + m_In11Panel->SetSizer( bIn11Sizer ); + m_In11Panel->Layout(); + bIn11Sizer->Fit( m_In11Panel ); + m_LayerListFlexGridSizer->Add( m_In11Panel, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - wxString m_Inner12ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; - int m_Inner12ChoiceNChoices = sizeof( m_Inner12ChoiceChoices ) / sizeof( wxString ); - m_Inner12Choice = new wxChoice( m_LayersListPanel, ID_INNER12CHOICE, wxDefaultPosition, wxDefaultSize, m_Inner12ChoiceNChoices, m_Inner12ChoiceChoices, 0 ); - m_Inner12Choice->SetSelection( 0 ); - m_Inner12Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + wxString m_In11ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In11ChoiceNChoices = sizeof( m_In11ChoiceChoices ) / sizeof( wxString ); + m_In11Choice = new wxChoice( m_LayersListPanel, ID_IN11CHOICE, wxDefaultPosition, wxDefaultSize, m_In11ChoiceNChoices, m_In11ChoiceChoices, 0 ); + m_In11Choice->SetSelection( 0 ); + m_In11Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); - m_LayerListFlexGridSizer->Add( m_Inner12Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + m_LayerListFlexGridSizer->Add( m_In11Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); - m_Inner13Name = new wxTextCtrl( m_LayersListPanel, ID_INNER13NAME, _("Inner13"), wxDefaultPosition, wxDefaultSize, 0 ); - m_Inner13Name->SetMaxLength( 20 ); - m_LayerListFlexGridSizer->Add( m_Inner13Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + m_In12Name = new wxTextCtrl( m_LayersListPanel, ID_IN12NAME, _("In12"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In12Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In12Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); - m_Inner13Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - m_Inner13Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + m_In12Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In12Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); - wxBoxSizer* bInner13Sizer; - bInner13Sizer = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bIn12Sizer; + bIn12Sizer = new wxBoxSizer( wxVERTICAL ); - m_Inner13CheckBox = new wxCheckBox( m_Inner13Panel, ID_INNER13CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bInner13Sizer->Add( m_Inner13CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_In12CheckBox = new wxCheckBox( m_In12Panel, ID_IN12CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn12Sizer->Add( m_In12CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_Inner13Panel->SetSizer( bInner13Sizer ); - m_Inner13Panel->Layout(); - bInner13Sizer->Fit( m_Inner13Panel ); - m_LayerListFlexGridSizer->Add( m_Inner13Panel, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + m_In12Panel->SetSizer( bIn12Sizer ); + m_In12Panel->Layout(); + bIn12Sizer->Fit( m_In12Panel ); + m_LayerListFlexGridSizer->Add( m_In12Panel, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - wxString m_Inner13ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; - int m_Inner13ChoiceNChoices = sizeof( m_Inner13ChoiceChoices ) / sizeof( wxString ); - m_Inner13Choice = new wxChoice( m_LayersListPanel, ID_INNER13CHOICE, wxDefaultPosition, wxDefaultSize, m_Inner13ChoiceNChoices, m_Inner13ChoiceChoices, 0 ); - m_Inner13Choice->SetSelection( 0 ); - m_Inner13Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + wxString m_In12ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In12ChoiceNChoices = sizeof( m_In12ChoiceChoices ) / sizeof( wxString ); + m_In12Choice = new wxChoice( m_LayersListPanel, ID_IN12CHOICE, wxDefaultPosition, wxDefaultSize, m_In12ChoiceNChoices, m_In12ChoiceChoices, 0 ); + m_In12Choice->SetSelection( 0 ); + m_In12Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); - m_LayerListFlexGridSizer->Add( m_Inner13Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + m_LayerListFlexGridSizer->Add( m_In12Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); - m_Inner14Name = new wxTextCtrl( m_LayersListPanel, ID_INNER14NAME, _("Inner14"), wxDefaultPosition, wxDefaultSize, 0 ); - m_Inner14Name->SetMaxLength( 20 ); - m_LayerListFlexGridSizer->Add( m_Inner14Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + m_In13Name = new wxTextCtrl( m_LayersListPanel, ID_IN13NAME, _("In13"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In13Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In13Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); - m_Inner14Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - m_Inner14Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + m_In13Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In13Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); - wxBoxSizer* bInner14Sizer; - bInner14Sizer = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bIn13Sizer; + bIn13Sizer = new wxBoxSizer( wxVERTICAL ); - m_Inner14CheckBox = new wxCheckBox( m_Inner14Panel, ID_INNER14CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bInner14Sizer->Add( m_Inner14CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_In13CheckBox = new wxCheckBox( m_In13Panel, ID_IN13CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn13Sizer->Add( m_In13CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_Inner14Panel->SetSizer( bInner14Sizer ); - m_Inner14Panel->Layout(); - bInner14Sizer->Fit( m_Inner14Panel ); - m_LayerListFlexGridSizer->Add( m_Inner14Panel, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + m_In13Panel->SetSizer( bIn13Sizer ); + m_In13Panel->Layout(); + bIn13Sizer->Fit( m_In13Panel ); + m_LayerListFlexGridSizer->Add( m_In13Panel, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - wxString m_Inner14ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; - int m_Inner14ChoiceNChoices = sizeof( m_Inner14ChoiceChoices ) / sizeof( wxString ); - m_Inner14Choice = new wxChoice( m_LayersListPanel, ID_INNER14CHOICE, wxDefaultPosition, wxDefaultSize, m_Inner14ChoiceNChoices, m_Inner14ChoiceChoices, 0 ); - m_Inner14Choice->SetSelection( 0 ); - m_Inner14Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + wxString m_In13ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In13ChoiceNChoices = sizeof( m_In13ChoiceChoices ) / sizeof( wxString ); + m_In13Choice = new wxChoice( m_LayersListPanel, ID_IN13CHOICE, wxDefaultPosition, wxDefaultSize, m_In13ChoiceNChoices, m_In13ChoiceChoices, 0 ); + m_In13Choice->SetSelection( 0 ); + m_In13Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); - m_LayerListFlexGridSizer->Add( m_Inner14Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + m_LayerListFlexGridSizer->Add( m_In13Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); - m_Inner15Name = new wxTextCtrl( m_LayersListPanel, ID_INNER15NAME, _("Inner15"), wxDefaultPosition, wxDefaultSize, 0 ); - m_Inner15Name->SetMaxLength( 20 ); - m_LayerListFlexGridSizer->Add( m_Inner15Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + m_In14Name = new wxTextCtrl( m_LayersListPanel, ID_IN14NAME, _("In14"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In14Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In14Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); - m_Inner15Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - m_Inner15Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + m_In14Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In14Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); - wxBoxSizer* bInner15Sizer; - bInner15Sizer = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bIn14Sizer; + bIn14Sizer = new wxBoxSizer( wxVERTICAL ); - m_Inner15CheckBox = new wxCheckBox( m_Inner15Panel, ID_INNER15CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bInner15Sizer->Add( m_Inner15CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_In14CheckBox = new wxCheckBox( m_In14Panel, ID_IN14CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn14Sizer->Add( m_In14CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_Inner15Panel->SetSizer( bInner15Sizer ); - m_Inner15Panel->Layout(); - bInner15Sizer->Fit( m_Inner15Panel ); - m_LayerListFlexGridSizer->Add( m_Inner15Panel, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + m_In14Panel->SetSizer( bIn14Sizer ); + m_In14Panel->Layout(); + bIn14Sizer->Fit( m_In14Panel ); + m_LayerListFlexGridSizer->Add( m_In14Panel, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - wxString m_Inner15ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; - int m_Inner15ChoiceNChoices = sizeof( m_Inner15ChoiceChoices ) / sizeof( wxString ); - m_Inner15Choice = new wxChoice( m_LayersListPanel, ID_INNER15CHOICE, wxDefaultPosition, wxDefaultSize, m_Inner15ChoiceNChoices, m_Inner15ChoiceChoices, 0 ); - m_Inner15Choice->SetSelection( 0 ); - m_Inner15Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + wxString m_In14ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In14ChoiceNChoices = sizeof( m_In14ChoiceChoices ) / sizeof( wxString ); + m_In14Choice = new wxChoice( m_LayersListPanel, ID_IN14CHOICE, wxDefaultPosition, wxDefaultSize, m_In14ChoiceNChoices, m_In14ChoiceChoices, 0 ); + m_In14Choice->SetSelection( 0 ); + m_In14Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); - m_LayerListFlexGridSizer->Add( m_Inner15Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + m_LayerListFlexGridSizer->Add( m_In14Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In15Name = new wxTextCtrl( m_LayersListPanel, ID_IN15NAME, _("In15"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In15Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In15Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In15Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In15Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + + wxBoxSizer* bIn15Sizer; + bIn15Sizer = new wxBoxSizer( wxVERTICAL ); + + m_In15CheckBox = new wxCheckBox( m_In15Panel, ID_IN15CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn15Sizer->Add( m_In15CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + m_In15Panel->SetSizer( bIn15Sizer ); + m_In15Panel->Layout(); + bIn15Sizer->Fit( m_In15Panel ); + m_LayerListFlexGridSizer->Add( m_In15Panel, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + wxString m_In15ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In15ChoiceNChoices = sizeof( m_In15ChoiceChoices ) / sizeof( wxString ); + m_In15Choice = new wxChoice( m_LayersListPanel, ID_IN15CHOICE, wxDefaultPosition, wxDefaultSize, m_In15ChoiceNChoices, m_In15ChoiceChoices, 0 ); + m_In15Choice->SetSelection( 0 ); + m_In15Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + + m_LayerListFlexGridSizer->Add( m_In15Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In16Name = new wxTextCtrl( m_LayersListPanel, ID_IN16NAME, _("In16"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In16Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In16Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In16Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In16Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + + wxBoxSizer* bIn16Sizer; + bIn16Sizer = new wxBoxSizer( wxVERTICAL ); + + m_In16CheckBox = new wxCheckBox( m_In16Panel, ID_IN16CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn16Sizer->Add( m_In16CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + m_In16Panel->SetSizer( bIn16Sizer ); + m_In16Panel->Layout(); + bIn16Sizer->Fit( m_In16Panel ); + m_LayerListFlexGridSizer->Add( m_In16Panel, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + wxString m_In16ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In16ChoiceNChoices = sizeof( m_In16ChoiceChoices ) / sizeof( wxString ); + m_In16Choice = new wxChoice( m_LayersListPanel, ID_IN16CHOICE, wxDefaultPosition, wxDefaultSize, m_In16ChoiceNChoices, m_In16ChoiceChoices, 0 ); + m_In16Choice->SetSelection( 0 ); + m_In16Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + + m_LayerListFlexGridSizer->Add( m_In16Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In17Name = new wxTextCtrl( m_LayersListPanel, ID_IN17NAME, _("In17"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In17Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In17Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In17Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In17Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + + wxBoxSizer* bIn17Sizer; + bIn17Sizer = new wxBoxSizer( wxVERTICAL ); + + m_In17CheckBox = new wxCheckBox( m_In17Panel, ID_IN17CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn17Sizer->Add( m_In17CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + m_In17Panel->SetSizer( bIn17Sizer ); + m_In17Panel->Layout(); + bIn17Sizer->Fit( m_In17Panel ); + m_LayerListFlexGridSizer->Add( m_In17Panel, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + wxString m_In17ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In17ChoiceNChoices = sizeof( m_In17ChoiceChoices ) / sizeof( wxString ); + m_In17Choice = new wxChoice( m_LayersListPanel, ID_IN17CHOICE, wxDefaultPosition, wxDefaultSize, m_In17ChoiceNChoices, m_In17ChoiceChoices, 0 ); + m_In17Choice->SetSelection( 0 ); + m_In17Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + + m_LayerListFlexGridSizer->Add( m_In17Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In18Name = new wxTextCtrl( m_LayersListPanel, ID_IN18NAME, _("In18"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In18Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In18Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In18Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In18Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + + wxBoxSizer* bIn18Sizer; + bIn18Sizer = new wxBoxSizer( wxVERTICAL ); + + m_In18CheckBox = new wxCheckBox( m_In18Panel, ID_IN18CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn18Sizer->Add( m_In18CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + m_In18Panel->SetSizer( bIn18Sizer ); + m_In18Panel->Layout(); + bIn18Sizer->Fit( m_In18Panel ); + m_LayerListFlexGridSizer->Add( m_In18Panel, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + wxString m_In18ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In18ChoiceNChoices = sizeof( m_In18ChoiceChoices ) / sizeof( wxString ); + m_In18Choice = new wxChoice( m_LayersListPanel, ID_IN18CHOICE, wxDefaultPosition, wxDefaultSize, m_In18ChoiceNChoices, m_In18ChoiceChoices, 0 ); + m_In18Choice->SetSelection( 0 ); + m_In18Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + + m_LayerListFlexGridSizer->Add( m_In18Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In19Name = new wxTextCtrl( m_LayersListPanel, ID_IN19NAME, _("In19"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In19Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In19Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In19Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In19Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + + wxBoxSizer* bIn19Sizer; + bIn19Sizer = new wxBoxSizer( wxVERTICAL ); + + m_In19CheckBox = new wxCheckBox( m_In19Panel, ID_IN19CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn19Sizer->Add( m_In19CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + m_In19Panel->SetSizer( bIn19Sizer ); + m_In19Panel->Layout(); + bIn19Sizer->Fit( m_In19Panel ); + m_LayerListFlexGridSizer->Add( m_In19Panel, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + wxString m_In19ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In19ChoiceNChoices = sizeof( m_In19ChoiceChoices ) / sizeof( wxString ); + m_In19Choice = new wxChoice( m_LayersListPanel, ID_IN19CHOICE, wxDefaultPosition, wxDefaultSize, m_In19ChoiceNChoices, m_In19ChoiceChoices, 0 ); + m_In19Choice->SetSelection( 0 ); + m_In19Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + + m_LayerListFlexGridSizer->Add( m_In19Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In20Name = new wxTextCtrl( m_LayersListPanel, ID_IN20NAME, _("In20"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In20Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In20Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In20Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In20Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + + wxBoxSizer* bIn20Sizer; + bIn20Sizer = new wxBoxSizer( wxVERTICAL ); + + m_In20CheckBox = new wxCheckBox( m_In20Panel, ID_IN20CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn20Sizer->Add( m_In20CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + m_In20Panel->SetSizer( bIn20Sizer ); + m_In20Panel->Layout(); + bIn20Sizer->Fit( m_In20Panel ); + m_LayerListFlexGridSizer->Add( m_In20Panel, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + wxString m_In20ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In20ChoiceNChoices = sizeof( m_In20ChoiceChoices ) / sizeof( wxString ); + m_In20Choice = new wxChoice( m_LayersListPanel, ID_IN20CHOICE, wxDefaultPosition, wxDefaultSize, m_In20ChoiceNChoices, m_In20ChoiceChoices, 0 ); + m_In20Choice->SetSelection( 0 ); + m_In20Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + + m_LayerListFlexGridSizer->Add( m_In20Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In21Name = new wxTextCtrl( m_LayersListPanel, ID_IN21NAME, _("In21"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In21Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In21Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In21Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In21Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + + wxBoxSizer* bIn21Sizer; + bIn21Sizer = new wxBoxSizer( wxVERTICAL ); + + m_In21CheckBox = new wxCheckBox( m_In21Panel, ID_IN21CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn21Sizer->Add( m_In21CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + m_In21Panel->SetSizer( bIn21Sizer ); + m_In21Panel->Layout(); + bIn21Sizer->Fit( m_In21Panel ); + m_LayerListFlexGridSizer->Add( m_In21Panel, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + wxString m_In21ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In21ChoiceNChoices = sizeof( m_In21ChoiceChoices ) / sizeof( wxString ); + m_In21Choice = new wxChoice( m_LayersListPanel, ID_IN21CHOICE, wxDefaultPosition, wxDefaultSize, m_In21ChoiceNChoices, m_In21ChoiceChoices, 0 ); + m_In21Choice->SetSelection( 0 ); + m_In21Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + + m_LayerListFlexGridSizer->Add( m_In21Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In22Name = new wxTextCtrl( m_LayersListPanel, ID_IN22NAME, _("In22"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In22Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In22Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In22Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In22Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + + wxBoxSizer* bIn22Sizer; + bIn22Sizer = new wxBoxSizer( wxVERTICAL ); + + m_In22CheckBox = new wxCheckBox( m_In22Panel, ID_IN22CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn22Sizer->Add( m_In22CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + m_In22Panel->SetSizer( bIn22Sizer ); + m_In22Panel->Layout(); + bIn22Sizer->Fit( m_In22Panel ); + m_LayerListFlexGridSizer->Add( m_In22Panel, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + wxString m_In22ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In22ChoiceNChoices = sizeof( m_In22ChoiceChoices ) / sizeof( wxString ); + m_In22Choice = new wxChoice( m_LayersListPanel, ID_IN22CHOICE, wxDefaultPosition, wxDefaultSize, m_In22ChoiceNChoices, m_In22ChoiceChoices, 0 ); + m_In22Choice->SetSelection( 0 ); + m_In22Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + + m_LayerListFlexGridSizer->Add( m_In22Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In23Name = new wxTextCtrl( m_LayersListPanel, ID_IN23NAME, _("In23"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In23Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In23Name, 0, wxALL|wxEXPAND, 5 ); + + m_In23Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In23Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + + wxBoxSizer* bIn23Sizer; + bIn23Sizer = new wxBoxSizer( wxVERTICAL ); + + m_In23CheckBox = new wxCheckBox( m_In23Panel, ID_IN23CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn23Sizer->Add( m_In23CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + m_In23Panel->SetSizer( bIn23Sizer ); + m_In23Panel->Layout(); + bIn23Sizer->Fit( m_In23Panel ); + m_LayerListFlexGridSizer->Add( m_In23Panel, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + wxString m_In23ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In23ChoiceNChoices = sizeof( m_In23ChoiceChoices ) / sizeof( wxString ); + m_In23Choice = new wxChoice( m_LayersListPanel, ID_IN22CHOICE, wxDefaultPosition, wxDefaultSize, m_In23ChoiceNChoices, m_In23ChoiceChoices, 0 ); + m_In23Choice->SetSelection( 0 ); + m_In23Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + + m_LayerListFlexGridSizer->Add( m_In23Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In24Name = new wxTextCtrl( m_LayersListPanel, ID_IN24NAME, _("In24"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In24Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In24Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In24Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In24Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + + wxBoxSizer* bIn24Sizer; + bIn24Sizer = new wxBoxSizer( wxVERTICAL ); + + m_In24CheckBox = new wxCheckBox( m_In24Panel, ID_IN24CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn24Sizer->Add( m_In24CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + m_In24Panel->SetSizer( bIn24Sizer ); + m_In24Panel->Layout(); + bIn24Sizer->Fit( m_In24Panel ); + m_LayerListFlexGridSizer->Add( m_In24Panel, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + wxString m_In24ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In24ChoiceNChoices = sizeof( m_In24ChoiceChoices ) / sizeof( wxString ); + m_In24Choice = new wxChoice( m_LayersListPanel, ID_IN24CHOICE, wxDefaultPosition, wxDefaultSize, m_In24ChoiceNChoices, m_In24ChoiceChoices, 0 ); + m_In24Choice->SetSelection( 0 ); + m_In24Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + + m_LayerListFlexGridSizer->Add( m_In24Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In25Name = new wxTextCtrl( m_LayersListPanel, ID_IN25NAME, _("In25"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In25Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In25Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In25Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In25Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + + wxBoxSizer* bIn25Sizer; + bIn25Sizer = new wxBoxSizer( wxVERTICAL ); + + m_In25CheckBox = new wxCheckBox( m_In25Panel, ID_IN25CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn25Sizer->Add( m_In25CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + m_In25Panel->SetSizer( bIn25Sizer ); + m_In25Panel->Layout(); + bIn25Sizer->Fit( m_In25Panel ); + m_LayerListFlexGridSizer->Add( m_In25Panel, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + wxString m_In25ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In25ChoiceNChoices = sizeof( m_In25ChoiceChoices ) / sizeof( wxString ); + m_In25Choice = new wxChoice( m_LayersListPanel, ID_IN25CHOICE, wxDefaultPosition, wxDefaultSize, m_In25ChoiceNChoices, m_In25ChoiceChoices, 0 ); + m_In25Choice->SetSelection( 0 ); + m_In25Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + + m_LayerListFlexGridSizer->Add( m_In25Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In26Name = new wxTextCtrl( m_LayersListPanel, ID_IN26NAME, _("In26"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In26Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In26Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In26Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In26Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + + wxBoxSizer* bIn26Sizer; + bIn26Sizer = new wxBoxSizer( wxVERTICAL ); + + m_In26CheckBox = new wxCheckBox( m_In26Panel, ID_IN26CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn26Sizer->Add( m_In26CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + m_In26Panel->SetSizer( bIn26Sizer ); + m_In26Panel->Layout(); + bIn26Sizer->Fit( m_In26Panel ); + m_LayerListFlexGridSizer->Add( m_In26Panel, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + wxString m_In26ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In26ChoiceNChoices = sizeof( m_In26ChoiceChoices ) / sizeof( wxString ); + m_In26Choice = new wxChoice( m_LayersListPanel, ID_IN26CHOICE, wxDefaultPosition, wxDefaultSize, m_In26ChoiceNChoices, m_In26ChoiceChoices, 0 ); + m_In26Choice->SetSelection( 0 ); + m_In26Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + + m_LayerListFlexGridSizer->Add( m_In26Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In27Name = new wxTextCtrl( m_LayersListPanel, ID_IN27NAME, _("In27"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In27Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In27Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In27Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In27Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + + wxBoxSizer* bIn27Sizer; + bIn27Sizer = new wxBoxSizer( wxVERTICAL ); + + m_In27CheckBox = new wxCheckBox( m_In27Panel, ID_IN27CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn27Sizer->Add( m_In27CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + m_In27Panel->SetSizer( bIn27Sizer ); + m_In27Panel->Layout(); + bIn27Sizer->Fit( m_In27Panel ); + m_LayerListFlexGridSizer->Add( m_In27Panel, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + wxString m_In27ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In27ChoiceNChoices = sizeof( m_In27ChoiceChoices ) / sizeof( wxString ); + m_In27Choice = new wxChoice( m_LayersListPanel, ID_IN27CHOICE, wxDefaultPosition, wxDefaultSize, m_In27ChoiceNChoices, m_In27ChoiceChoices, 0 ); + m_In27Choice->SetSelection( 0 ); + m_In27Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + + m_LayerListFlexGridSizer->Add( m_In27Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In28Name = new wxTextCtrl( m_LayersListPanel, ID_IN28NAME, _("In28"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In28Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In28Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In28Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In28Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + + wxBoxSizer* bIn28Sizer; + bIn28Sizer = new wxBoxSizer( wxVERTICAL ); + + m_In28CheckBox = new wxCheckBox( m_In28Panel, ID_IN28CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn28Sizer->Add( m_In28CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + m_In28Panel->SetSizer( bIn28Sizer ); + m_In28Panel->Layout(); + bIn28Sizer->Fit( m_In28Panel ); + m_LayerListFlexGridSizer->Add( m_In28Panel, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + wxString m_In28ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In28ChoiceNChoices = sizeof( m_In28ChoiceChoices ) / sizeof( wxString ); + m_In28Choice = new wxChoice( m_LayersListPanel, ID_IN28CHOICE, wxDefaultPosition, wxDefaultSize, m_In28ChoiceNChoices, m_In28ChoiceChoices, 0 ); + m_In28Choice->SetSelection( 0 ); + m_In28Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + + m_LayerListFlexGridSizer->Add( m_In28Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In29Name = new wxTextCtrl( m_LayersListPanel, ID_IN29NAME, _("In29"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In29Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In29Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In29Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In29Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + + wxBoxSizer* bIn29Sizer; + bIn29Sizer = new wxBoxSizer( wxVERTICAL ); + + m_In29CheckBox = new wxCheckBox( m_In29Panel, ID_IN29CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn29Sizer->Add( m_In29CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + m_In29Panel->SetSizer( bIn29Sizer ); + m_In29Panel->Layout(); + bIn29Sizer->Fit( m_In29Panel ); + m_LayerListFlexGridSizer->Add( m_In29Panel, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + wxString m_In29ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In29ChoiceNChoices = sizeof( m_In29ChoiceChoices ) / sizeof( wxString ); + m_In29Choice = new wxChoice( m_LayersListPanel, ID_IN29CHOICE, wxDefaultPosition, wxDefaultSize, m_In29ChoiceNChoices, m_In29ChoiceChoices, 0 ); + m_In29Choice->SetSelection( 0 ); + m_In29Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + + m_LayerListFlexGridSizer->Add( m_In29Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In30Name = new wxTextCtrl( m_LayersListPanel, ID_IN30NAME, _("In30"), wxDefaultPosition, wxDefaultSize, 0 ); + m_In30Name->SetMaxLength( 20 ); + m_LayerListFlexGridSizer->Add( m_In30Name, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); + + m_In30Panel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_In30Panel->SetBackgroundColour( wxColour( 236, 253, 216 ) ); + + wxBoxSizer* bIn30Sizer; + bIn30Sizer = new wxBoxSizer( wxVERTICAL ); + + m_In30CheckBox = new wxCheckBox( m_In30Panel, ID_IN30CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bIn30Sizer->Add( m_In30CheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + m_In30Panel->SetSizer( bIn30Sizer ); + m_In30Panel->Layout(); + bIn30Sizer->Fit( m_In30Panel ); + m_LayerListFlexGridSizer->Add( m_In30Panel, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + wxString m_In30ChoiceChoices[] = { _("signal"), _("power"), _("mixed"), _("jumper") }; + int m_In30ChoiceNChoices = sizeof( m_In30ChoiceChoices ) / sizeof( wxString ); + m_In30Choice = new wxChoice( m_LayersListPanel, ID_IN30CHOICE, wxDefaultPosition, wxDefaultSize, m_In30ChoiceNChoices, m_In30ChoiceChoices, 0 ); + m_In30Choice->SetSelection( 0 ); + m_In30Choice->SetToolTip( _("Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus.") ); + + m_LayerListFlexGridSizer->Add( m_In30Choice, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 ); m_BackName = new wxTextCtrl( m_LayersListPanel, ID_BACKNAME, _("Back"), wxDefaultPosition, wxDefaultSize, 0 ); m_BackName->SetMaxLength( 20 ); @@ -746,6 +1178,29 @@ DIALOG_LAYERS_SETUP_BASE::DIALOG_LAYERS_SETUP_BASE( wxWindow* parent, wxWindowID m_PCBEdgesStaticText->Wrap( -1 ); m_LayerListFlexGridSizer->Add( m_PCBEdgesStaticText, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); + m_MarginName = new wxStaticText( m_LayersListPanel, ID_MARGINNAME, _("Margin_later"), wxDefaultPosition, wxDefaultSize, 0 ); + m_MarginName->Wrap( -1 ); + m_LayerListFlexGridSizer->Add( m_MarginName, 0, wxALL, 5 ); + + m_MarginPanel = new wxPanel( m_LayersListPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_MarginPanel->SetBackgroundColour( wxColour( 236, 233, 255 ) ); + + wxBoxSizer* bSizer291; + bSizer291 = new wxBoxSizer( wxVERTICAL ); + + m_MarginCheckBox = new wxCheckBox( m_MarginPanel, ID_MARGINCHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bSizer291->Add( m_MarginCheckBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + m_MarginPanel->SetSizer( bSizer291 ); + m_MarginPanel->Layout(); + bSizer291->Fit( m_MarginPanel ); + m_LayerListFlexGridSizer->Add( m_MarginPanel, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + m_MarginStaticText = new wxStaticText( m_LayersListPanel, ID_ECO2CHOICE, _("Edge_Cuts setback"), wxDefaultPosition, wxDefaultSize, 0 ); + m_MarginStaticText->Wrap( -1 ); + m_LayerListFlexGridSizer->Add( m_MarginStaticText, 0, wxALL, 5 ); + m_Eco1Name = new wxStaticText( m_LayersListPanel, ID_ECO2NAME, _("Eco1_later"), wxDefaultPosition, wxDefaultSize, 0 ); m_Eco1Name->Wrap( -1 ); m_LayerListFlexGridSizer->Add( m_Eco1Name, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); @@ -873,26 +1328,43 @@ DIALOG_LAYERS_SETUP_BASE::DIALOG_LAYERS_SETUP_BASE( wxWindow* parent, wxWindowID m_SilkSFrontCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this ); m_MaskFrontCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this ); m_FrontCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); - m_Inner2CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); - m_Inner3CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); - m_Inner4CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); - m_Inner5CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); - m_Inner6CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); - m_Inner7CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); - m_Inner8CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); - m_Inner9CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); - m_Inner10CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); - m_Inner11CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); - m_Inner12CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); - m_Inner13CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); - m_Inner14CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); - m_Inner15CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In1CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In2CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In3CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In4CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In5CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In6CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In7CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In8CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In9CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In10CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In11CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In12CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In13CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In14CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In15CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In16CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In17CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In18CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In19CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In20CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In21CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In22CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In23CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In24CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In25CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In26CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In27CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In28CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In29CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In30CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); m_BackCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); m_MaskBackCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this ); m_SilkSBackCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this ); m_SoldPBackCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this ); m_AdhesBackCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this ); m_PCBEdgesCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this ); + m_MarginCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this ); m_Eco1CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this ); m_Eco2CheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this ); m_CommentsCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this ); @@ -911,26 +1383,43 @@ DIALOG_LAYERS_SETUP_BASE::~DIALOG_LAYERS_SETUP_BASE() m_SilkSFrontCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this ); m_MaskFrontCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this ); m_FrontCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); - m_Inner2CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); - m_Inner3CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); - m_Inner4CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); - m_Inner5CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); - m_Inner6CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); - m_Inner7CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); - m_Inner8CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); - m_Inner9CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); - m_Inner10CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); - m_Inner11CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); - m_Inner12CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); - m_Inner13CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); - m_Inner14CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); - m_Inner15CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In1CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In2CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In3CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In4CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In5CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In6CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In7CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In8CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In9CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In10CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In11CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In12CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In13CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In14CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In15CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In16CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In17CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In18CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In19CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In20CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In21CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In22CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In23CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In24CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In25CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In26CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In27CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In28CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In29CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); + m_In30CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); m_BackCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::DenyChangeCheckBox ), NULL, this ); m_MaskBackCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this ); m_SilkSBackCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this ); m_SoldPBackCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this ); m_AdhesBackCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this ); m_PCBEdgesCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this ); + m_MarginCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this ); m_Eco1CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this ); m_Eco2CheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this ); m_CommentsCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LAYERS_SETUP_BASE::OnCheckBox ), NULL, this ); diff --git a/pcbnew/dialogs/dialog_layers_setup_base.fbp b/pcbnew/dialogs/dialog_layers_setup_base.fbp index ec98facb32..6fc6a4d396 100644 --- a/pcbnew/dialogs/dialog_layers_setup_base.fbp +++ b/pcbnew/dialogs/dialog_layers_setup_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -20,8 +20,10 @@ . 1 + 1 1 1 + UI 0 0 @@ -392,7 +394,7 @@ 1 0 - "2" "4" "6" "8" "10" "12" "14" "16" + "2" "4" "6" "8" "10" "12" "14" "16" "18" "20" "22" "24" "26" "27" "28" "30" "32" 1 1 @@ -422,7 +424,7 @@ 1 Resizable - 0 + 3 1 @@ -2485,7 +2487,7 @@ 0 0 - ID_INNER2NAME + ID_IN1NAME 0 @@ -2494,7 +2496,7 @@ 0 1 - m_Inner2Name + m_In1Name 1 @@ -2512,7 +2514,7 @@ wxFILTER_NONE wxDefaultValidator - Inner2 + In1 @@ -2584,7 +2586,7 @@ 0 1 - m_Inner2Panel + m_In1Panel 1 @@ -2625,7 +2627,7 @@ - bInner2Sizer + bIn1Sizer wxVERTICAL none @@ -2660,7 +2662,7 @@ 0 0 - ID_INNER2CHECKBOX + ID_IN1CHECKBOX 0 @@ -2669,7 +2671,7 @@ 0 1 - m_Inner2CheckBox + m_In1CheckBox 1 @@ -2751,7 +2753,7 @@ 0 0 - ID_INNER2CHOICE + ID_IN1CHOICE 0 @@ -2759,7 +2761,7 @@ 0 1 - m_Inner2Choice + m_In1Choice 1 @@ -2838,7 +2840,7 @@ 0 0 - ID_INNER3NAME + ID_IN2NAME 0 @@ -2847,7 +2849,7 @@ 0 1 - m_Inner3Name + m_In2Name 1 @@ -2865,1419 +2867,7 @@ wxFILTER_NONE wxDefaultValidator - Inner3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL - 1 - - 1 - 1 - 1 - 1 - - - - - - 236,253,216 - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_Inner3Panel - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - - - - wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - bInner3Sizer - wxVERTICAL - none - - 5 - wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_INNER3CHECKBOX - - - 0 - - - 0 - - 1 - m_Inner3CheckBox - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - DenyChangeCheckBox - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "signal" "power" "mixed" "jumper" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_INNER3CHOICE - - 0 - - - 0 - - 1 - m_Inner3Choice - 1 - - - protected - 1 - - Resizable - 0 - 1 - - - - 0 - Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_INNER4NAME - - 0 - - 20 - - 0 - - 1 - m_Inner4Name - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - Inner4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL - 1 - - 1 - 1 - 1 - 1 - - - - - - 236,253,216 - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_Inner4Panel - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - - - - wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - bInner4Sizer - wxVERTICAL - none - - 5 - wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_INNER4CHECKBOX - - - 0 - - - 0 - - 1 - m_Inner4CheckBox - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - DenyChangeCheckBox - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "signal" "power" "mixed" "jumper" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_INNER4CHOICE - - 0 - - - 0 - - 1 - m_Inner4Choice - 1 - - - protected - 1 - - Resizable - 0 - 1 - - - - 0 - Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_INNER5NAME - - 0 - - 20 - - 0 - - 1 - m_Inner5Name - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - Inner5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL - 1 - - 1 - 1 - 1 - 1 - - - - - - 236,253,216 - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_Inner5Panel - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - - - - wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - bInner5Sizer - wxVERTICAL - none - - 5 - wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_INNER5CHECKBOX - - - 0 - - - 0 - - 1 - m_Inner5CheckBox - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - DenyChangeCheckBox - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "signal" "power" "mixed" "jumper" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_INNER5CHOICE - - 0 - - - 0 - - 1 - m_Inner5Choice - 1 - - - protected - 1 - - Resizable - 0 - 1 - - - - 0 - Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_INNER6NAME - - 0 - - 20 - - 0 - - 1 - m_Inner6Name - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - Inner6 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL - 1 - - 1 - 1 - 1 - 1 - - - - - - 236,253,216 - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_Inner6Panel - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - - - - wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - bInner6Sizer - wxVERTICAL - none - - 5 - wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_INNER6CHECKBOX - - - 0 - - - 0 - - 1 - m_Inner6CheckBox - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - DenyChangeCheckBox - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "signal" "power" "mixed" "jumper" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_INNER6CHOICE - - 0 - - - 0 - - 1 - m_Inner6Choice - 1 - - - protected - 1 - - Resizable - 0 - 1 - - - - 0 - Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_INNER7NAME - - 0 - - 20 - - 0 - - 1 - m_Inner7Name - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - Inner7 + In2 @@ -4349,7 +2939,7 @@ 0 1 - m_Inner7Panel + m_In2Panel 1 @@ -4390,7 +2980,7 @@ - bInner7Sizer + bIn2Sizer wxVERTICAL none @@ -4425,7 +3015,7 @@ 0 0 - ID_INNER7CHECKBOX + ID_IN2CHECKBOX 0 @@ -4434,7 +3024,7 @@ 0 1 - m_Inner7CheckBox + m_In2CheckBox 1 @@ -4516,7 +3106,7 @@ 0 0 - ID_INNER7CHOICE + ID_IN2CHOICE 0 @@ -4524,7 +3114,7 @@ 0 1 - m_Inner7Choice + m_In2Choice 1 @@ -4603,7 +3193,7 @@ 0 0 - ID_INNER8NAME + ID_IN3NAME 0 @@ -4612,7 +3202,7 @@ 0 1 - m_Inner8Name + m_In3Name 1 @@ -4630,7 +3220,1772 @@ wxFILTER_NONE wxDefaultValidator - Inner8 + In3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL + 1 + + 1 + 1 + 1 + 1 + + + + + + 236,253,216 + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_In3Panel + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bIn3Sizer + wxVERTICAL + none + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN3CHECKBOX + + + 0 + + + 0 + + 1 + m_In3CheckBox + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + DenyChangeCheckBox + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "signal" "power" "mixed" "jumper" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN3CHOICE + + 0 + + + 0 + + 1 + m_In3Choice + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN4NAME + + 0 + + 20 + + 0 + + 1 + m_In4Name + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + In4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL + 1 + + 1 + 1 + 1 + 1 + + + + + + 236,253,216 + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_In4Panel + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bIn4Sizer + wxVERTICAL + none + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN4CHECKBOX + + + 0 + + + 0 + + 1 + m_In4CheckBox + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + DenyChangeCheckBox + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "signal" "power" "mixed" "jumper" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN4CHOICE + + 0 + + + 0 + + 1 + m_In4Choice + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN5NAME + + 0 + + 20 + + 0 + + 1 + m_In5Name + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + In5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL + 1 + + 1 + 1 + 1 + 1 + + + + + + 236,253,216 + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_In5Panel + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bIn5Sizer + wxVERTICAL + none + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN5CHECKBOX + + + 0 + + + 0 + + 1 + m_In5CheckBox + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + DenyChangeCheckBox + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "signal" "power" "mixed" "jumper" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN5CHOICE + + 0 + + + 0 + + 1 + m_In5Choice + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN6NAME + + 0 + + 20 + + 0 + + 1 + m_In6Name + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + In6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL + 1 + + 1 + 1 + 1 + 1 + + + + + + 236,253,216 + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_In6Panel + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bIn6Sizer + wxVERTICAL + none + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN6CHECKBOX + + + 0 + + + 0 + + 1 + m_In6CheckBox + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + DenyChangeCheckBox + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "signal" "power" "mixed" "jumper" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN6CHOICE + + 0 + + + 0 + + 1 + m_In6Choice + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN7NAME + + 0 + + 20 + + 0 + + 1 + m_In7Name + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + In7 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL + 1 + + 1 + 1 + 1 + 1 + + + + + + 236,253,216 + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_In7Panel + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bIn7Sizer + wxVERTICAL + none + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN7CHECKBOX + + + 0 + + + 0 + + 1 + m_In7CheckBox + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + DenyChangeCheckBox + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "signal" "power" "mixed" "jumper" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN7CHOICE + + 0 + + + 0 + + 1 + m_In7Choice + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN8NAME + + 0 + + 20 + + 0 + + 1 + m_In8Name + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + In8 @@ -4702,7 +5057,7 @@ 0 1 - m_Inner8Panel + m_In8Panel 1 @@ -4743,7 +5098,7 @@ - bInner8Sizer + bIn8Sizer wxVERTICAL none @@ -4778,7 +5133,7 @@ 0 0 - ID_INNER8CHECKBOX + ID_IN8CHECKBOX 0 @@ -4787,7 +5142,7 @@ 0 1 - m_Inner8CheckBox + m_In8CheckBox 1 @@ -4869,7 +5224,7 @@ 0 0 - ID_INNER8CHOICE + ID_IN8CHOICE 0 @@ -4877,7 +5232,7 @@ 0 1 - m_Inner8Choice + m_In8Choice 1 @@ -4956,7 +5311,7 @@ 0 0 - ID_INNER9NAME + ID_IN9NAME 0 @@ -4965,7 +5320,7 @@ 0 1 - m_Inner9Name + m_In9Name 1 @@ -4983,7 +5338,7 @@ wxFILTER_NONE wxDefaultValidator - Inner9 + In9 @@ -5055,7 +5410,7 @@ 0 1 - m_Inner9Panel + m_In9Panel 1 @@ -5096,7 +5451,7 @@ - bInner9Sizer + bIn9Sizer wxVERTICAL none @@ -5131,7 +5486,7 @@ 0 0 - ID_INNER9CHECKBOX + ID_IN9CHECKBOX 0 @@ -5140,7 +5495,7 @@ 0 1 - m_Inner9CheckBox + m_In9CheckBox 1 @@ -5222,7 +5577,7 @@ 0 0 - ID_INNER9CHOICE + ID_IN9CHOICE 0 @@ -5230,7 +5585,7 @@ 0 1 - m_Inner9Choice + m_In9Choice 1 @@ -5309,7 +5664,7 @@ 0 0 - ID_INNER10NAME + ID_IN10NAME 0 @@ -5318,7 +5673,7 @@ 0 1 - m_Inner10Name + m_In10Name 1 @@ -5336,7 +5691,7 @@ wxFILTER_NONE wxDefaultValidator - Inner10 + In10 @@ -5408,7 +5763,7 @@ 0 1 - m_Inner10Panel + m_In10Panel 1 @@ -5449,7 +5804,7 @@ - bInner10Sizer + bIn10Sizer wxVERTICAL none @@ -5484,7 +5839,7 @@ 0 0 - ID_INNER10CHECKBOX + ID_IN10CHECKBOX 0 @@ -5493,7 +5848,7 @@ 0 1 - m_Inner10CheckBox + m_In10CheckBox 1 @@ -5575,7 +5930,7 @@ 0 0 - ID_INNER10CHOICE + ID_IN10CHOICE 0 @@ -5583,7 +5938,7 @@ 0 1 - m_Inner10Choice + m_In10Choice 1 @@ -5662,7 +6017,7 @@ 0 0 - ID_INNER11NAME + ID_IN11NAME 0 @@ -5671,7 +6026,7 @@ 0 1 - m_Inner11Name + m_In11Name 1 @@ -5689,7 +6044,7 @@ wxFILTER_NONE wxDefaultValidator - Inner11 + In11 @@ -5761,7 +6116,7 @@ 0 1 - m_Inner11Panel + m_In11Panel 1 @@ -5802,7 +6157,7 @@ - bInner11Sizer + bIn11Sizer wxVERTICAL none @@ -5837,7 +6192,7 @@ 0 0 - ID_INNER11CHECKBOX + ID_IN11CHECKBOX 0 @@ -5846,7 +6201,7 @@ 0 1 - m_Inner11CheckBox + m_In11CheckBox 1 @@ -5928,7 +6283,7 @@ 0 0 - ID_INNER11CHOICE + ID_IN11CHOICE 0 @@ -5936,7 +6291,7 @@ 0 1 - m_Inner11Choice + m_In11Choice 1 @@ -6015,7 +6370,7 @@ 0 0 - ID_INNER12NAME + ID_IN12NAME 0 @@ -6024,7 +6379,7 @@ 0 1 - m_Inner12Name + m_In12Name 1 @@ -6042,7 +6397,7 @@ wxFILTER_NONE wxDefaultValidator - Inner12 + In12 @@ -6114,7 +6469,7 @@ 0 1 - m_Inner12Panel + m_In12Panel 1 @@ -6155,7 +6510,7 @@ - bInner12Sizer + bIn12Sizer wxVERTICAL none @@ -6190,7 +6545,7 @@ 0 0 - ID_INNER12CHECKBOX + ID_IN12CHECKBOX 0 @@ -6199,7 +6554,7 @@ 0 1 - m_Inner12CheckBox + m_In12CheckBox 1 @@ -6281,7 +6636,7 @@ 0 0 - ID_INNER12CHOICE + ID_IN12CHOICE 0 @@ -6289,7 +6644,7 @@ 0 1 - m_Inner12Choice + m_In12Choice 1 @@ -6368,7 +6723,7 @@ 0 0 - ID_INNER13NAME + ID_IN13NAME 0 @@ -6377,7 +6732,7 @@ 0 1 - m_Inner13Name + m_In13Name 1 @@ -6395,7 +6750,7 @@ wxFILTER_NONE wxDefaultValidator - Inner13 + In13 @@ -6467,7 +6822,7 @@ 0 1 - m_Inner13Panel + m_In13Panel 1 @@ -6508,7 +6863,7 @@ - bInner13Sizer + bIn13Sizer wxVERTICAL none @@ -6543,7 +6898,7 @@ 0 0 - ID_INNER13CHECKBOX + ID_IN13CHECKBOX 0 @@ -6552,7 +6907,7 @@ 0 1 - m_Inner13CheckBox + m_In13CheckBox 1 @@ -6634,7 +6989,7 @@ 0 0 - ID_INNER13CHOICE + ID_IN13CHOICE 0 @@ -6642,7 +6997,7 @@ 0 1 - m_Inner13Choice + m_In13Choice 1 @@ -6721,7 +7076,7 @@ 0 0 - ID_INNER14NAME + ID_IN14NAME 0 @@ -6730,7 +7085,7 @@ 0 1 - m_Inner14Name + m_In14Name 1 @@ -6748,7 +7103,7 @@ wxFILTER_NONE wxDefaultValidator - Inner14 + In14 @@ -6820,7 +7175,7 @@ 0 1 - m_Inner14Panel + m_In14Panel 1 @@ -6861,7 +7216,7 @@ - bInner14Sizer + bIn14Sizer wxVERTICAL none @@ -6896,7 +7251,7 @@ 0 0 - ID_INNER14CHECKBOX + ID_IN14CHECKBOX 0 @@ -6905,7 +7260,7 @@ 0 1 - m_Inner14CheckBox + m_In14CheckBox 1 @@ -6987,7 +7342,7 @@ 0 0 - ID_INNER14CHOICE + ID_IN14CHOICE 0 @@ -6995,7 +7350,7 @@ 0 1 - m_Inner14Choice + m_In14Choice 1 @@ -7074,7 +7429,7 @@ 0 0 - ID_INNER15NAME + ID_IN15NAME 0 @@ -7083,7 +7438,7 @@ 0 1 - m_Inner15Name + m_In15Name 1 @@ -7101,7 +7456,7 @@ wxFILTER_NONE wxDefaultValidator - Inner15 + In15 @@ -7173,7 +7528,7 @@ 0 1 - m_Inner15Panel + m_In15Panel 1 @@ -7214,7 +7569,7 @@ - bInner15Sizer + bIn15Sizer wxVERTICAL none @@ -7249,7 +7604,7 @@ 0 0 - ID_INNER15CHECKBOX + ID_IN15CHECKBOX 0 @@ -7258,7 +7613,7 @@ 0 1 - m_Inner15CheckBox + m_In15CheckBox 1 @@ -7340,7 +7695,7 @@ 0 0 - ID_INNER15CHOICE + ID_IN15CHOICE 0 @@ -7348,7 +7703,5302 @@ 0 1 - m_Inner15Choice + m_In15Choice + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN16NAME + + 0 + + 20 + + 0 + + 1 + m_In16Name + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + In16 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL + 1 + + 1 + 1 + 1 + 1 + + + + + + 236,253,216 + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_In16Panel + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bIn16Sizer + wxVERTICAL + none + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN16CHECKBOX + + + 0 + + + 0 + + 1 + m_In16CheckBox + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + DenyChangeCheckBox + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "signal" "power" "mixed" "jumper" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN16CHOICE + + 0 + + + 0 + + 1 + m_In16Choice + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN17NAME + + 0 + + 20 + + 0 + + 1 + m_In17Name + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + In17 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL + 1 + + 1 + 1 + 1 + 1 + + + + + + 236,253,216 + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_In17Panel + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bIn17Sizer + wxVERTICAL + none + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN17CHECKBOX + + + 0 + + + 0 + + 1 + m_In17CheckBox + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + DenyChangeCheckBox + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "signal" "power" "mixed" "jumper" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN17CHOICE + + 0 + + + 0 + + 1 + m_In17Choice + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN18NAME + + 0 + + 20 + + 0 + + 1 + m_In18Name + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + In18 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL + 1 + + 1 + 1 + 1 + 1 + + + + + + 236,253,216 + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_In18Panel + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bIn18Sizer + wxVERTICAL + none + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN18CHECKBOX + + + 0 + + + 0 + + 1 + m_In18CheckBox + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + DenyChangeCheckBox + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "signal" "power" "mixed" "jumper" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN18CHOICE + + 0 + + + 0 + + 1 + m_In18Choice + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN19NAME + + 0 + + 20 + + 0 + + 1 + m_In19Name + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + In19 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL + 1 + + 1 + 1 + 1 + 1 + + + + + + 236,253,216 + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_In19Panel + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bIn19Sizer + wxVERTICAL + none + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN19CHECKBOX + + + 0 + + + 0 + + 1 + m_In19CheckBox + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + DenyChangeCheckBox + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "signal" "power" "mixed" "jumper" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN19CHOICE + + 0 + + + 0 + + 1 + m_In19Choice + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN20NAME + + 0 + + 20 + + 0 + + 1 + m_In20Name + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + In20 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL + 1 + + 1 + 1 + 1 + 1 + + + + + + 236,253,216 + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_In20Panel + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bIn20Sizer + wxVERTICAL + none + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN20CHECKBOX + + + 0 + + + 0 + + 1 + m_In20CheckBox + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + DenyChangeCheckBox + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "signal" "power" "mixed" "jumper" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN20CHOICE + + 0 + + + 0 + + 1 + m_In20Choice + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN21NAME + + 0 + + 20 + + 0 + + 1 + m_In21Name + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + In21 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL + 1 + + 1 + 1 + 1 + 1 + + + + + + 236,253,216 + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_In21Panel + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bIn21Sizer + wxVERTICAL + none + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN21CHECKBOX + + + 0 + + + 0 + + 1 + m_In21CheckBox + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + DenyChangeCheckBox + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "signal" "power" "mixed" "jumper" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN21CHOICE + + 0 + + + 0 + + 1 + m_In21Choice + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN22NAME + + 0 + + 20 + + 0 + + 1 + m_In22Name + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + In22 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL + 1 + + 1 + 1 + 1 + 1 + + + + + + 236,253,216 + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_In22Panel + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bIn22Sizer + wxVERTICAL + none + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN22CHECKBOX + + + 0 + + + 0 + + 1 + m_In22CheckBox + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + DenyChangeCheckBox + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "signal" "power" "mixed" "jumper" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN22CHOICE + + 0 + + + 0 + + 1 + m_In22Choice + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN23NAME + + 0 + + 20 + + 0 + + 1 + m_In23Name + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + In23 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL + 1 + + 1 + 1 + 1 + 1 + + + + + + 236,253,216 + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_In23Panel + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bIn23Sizer + wxVERTICAL + none + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN23CHECKBOX + + + 0 + + + 0 + + 1 + m_In23CheckBox + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + DenyChangeCheckBox + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "signal" "power" "mixed" "jumper" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN22CHOICE + + 0 + + + 0 + + 1 + m_In23Choice + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN24NAME + + 0 + + 20 + + 0 + + 1 + m_In24Name + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + In24 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL + 1 + + 1 + 1 + 1 + 1 + + + + + + 236,253,216 + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_In24Panel + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bIn24Sizer + wxVERTICAL + none + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN24CHECKBOX + + + 0 + + + 0 + + 1 + m_In24CheckBox + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + DenyChangeCheckBox + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "signal" "power" "mixed" "jumper" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN24CHOICE + + 0 + + + 0 + + 1 + m_In24Choice + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN25NAME + + 0 + + 20 + + 0 + + 1 + m_In25Name + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + In25 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL + 1 + + 1 + 1 + 1 + 1 + + + + + + 236,253,216 + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_In25Panel + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bIn25Sizer + wxVERTICAL + none + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN25CHECKBOX + + + 0 + + + 0 + + 1 + m_In25CheckBox + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + DenyChangeCheckBox + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "signal" "power" "mixed" "jumper" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN25CHOICE + + 0 + + + 0 + + 1 + m_In25Choice + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN26NAME + + 0 + + 20 + + 0 + + 1 + m_In26Name + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + In26 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL + 1 + + 1 + 1 + 1 + 1 + + + + + + 236,253,216 + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_In26Panel + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bIn26Sizer + wxVERTICAL + none + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN26CHECKBOX + + + 0 + + + 0 + + 1 + m_In26CheckBox + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + DenyChangeCheckBox + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "signal" "power" "mixed" "jumper" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN26CHOICE + + 0 + + + 0 + + 1 + m_In26Choice + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN27NAME + + 0 + + 20 + + 0 + + 1 + m_In27Name + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + In27 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL + 1 + + 1 + 1 + 1 + 1 + + + + + + 236,253,216 + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_In27Panel + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bIn27Sizer + wxVERTICAL + none + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN27CHECKBOX + + + 0 + + + 0 + + 1 + m_In27CheckBox + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + DenyChangeCheckBox + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "signal" "power" "mixed" "jumper" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN27CHOICE + + 0 + + + 0 + + 1 + m_In27Choice + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN28NAME + + 0 + + 20 + + 0 + + 1 + m_In28Name + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + In28 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL + 1 + + 1 + 1 + 1 + 1 + + + + + + 236,253,216 + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_In28Panel + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bIn28Sizer + wxVERTICAL + none + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN28CHECKBOX + + + 0 + + + 0 + + 1 + m_In28CheckBox + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + DenyChangeCheckBox + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "signal" "power" "mixed" "jumper" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN28CHOICE + + 0 + + + 0 + + 1 + m_In28Choice + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN29NAME + + 0 + + 20 + + 0 + + 1 + m_In29Name + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + In29 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL + 1 + + 1 + 1 + 1 + 1 + + + + + + 236,253,216 + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_In29Panel + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bIn29Sizer + wxVERTICAL + none + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN29CHECKBOX + + + 0 + + + 0 + + 1 + m_In29CheckBox + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + DenyChangeCheckBox + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "signal" "power" "mixed" "jumper" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN29CHOICE + + 0 + + + 0 + + 1 + m_In29Choice + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + Copper layer type for Freerouter. Power layers are removed from Freerouter's layer menus. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN30NAME + + 0 + + 20 + + 0 + + 1 + m_In30Name + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + In30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL + 1 + + 1 + 1 + 1 + 1 + + + + + + 236,253,216 + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_In30Panel + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bIn30Sizer + wxVERTICAL + none + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN30CHECKBOX + + + 0 + + + 0 + + 1 + m_In30CheckBox + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + DenyChangeCheckBox + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "signal" "power" "mixed" "jumper" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_IN30CHOICE + + 0 + + + 0 + + 1 + m_In30Choice 1 @@ -9449,6 +15099,346 @@ + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_MARGINNAME + Margin_later + + 0 + + + 0 + + 1 + m_MarginName + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_HORIZONTAL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + + 236,233,255 + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_MarginPanel + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer291 + wxVERTICAL + none + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_MARGINCHECKBOX + + + 0 + + + 0 + + 1 + m_MarginCheckBox + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + OnCheckBox + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_ECO2CHOICE + Edge_Cuts setback + + 0 + + + 0 + + 1 + m_MarginStaticText + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + 5 wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT diff --git a/pcbnew/dialogs/dialog_layers_setup_base.h b/pcbnew/dialogs/dialog_layers_setup_base.h index df94eace1f..acd1bb95a0 100644 --- a/pcbnew/dialogs/dialog_layers_setup_base.h +++ b/pcbnew/dialogs/dialog_layers_setup_base.h @@ -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; diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index fe5faeba66..f1db6bf28c 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -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 + // PAD_HOLE_NOT_PLATED: + 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; } diff --git a/pcbnew/dialogs/dialog_pcb_text_properties.cpp b/pcbnew/dialogs/dialog_pcb_text_properties.cpp index 9f58be5e1d..bb0d207555 100644 --- a/pcbnew/dialogs/dialog_pcb_text_properties.cpp +++ b/pcbnew/dialogs/dialog_pcb_text_properties.cpp @@ -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 ); diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp index 230f170b65..6e6234ea9a 100644 --- a/pcbnew/dialogs/dialog_plot.cpp +++ b/pcbnew/dialogs/dialog_plot.cpp @@ -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 ); } @@ -240,48 +233,46 @@ void DIALOG_PLOT::OnPopUpLayers( wxCommandEvent& event ) switch( event.GetId() ) { - 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 ) ) - m_layerCheckListBox->Check( i, true ); - else - m_layerCheckListBox->Check( i, false ); + case ID_LAYER_FAB: // Select layers usually needed to build a board + for( i = 0; i < m_layerList.size(); i++ ) + { + LSET layermask( m_layerList[ i ] ); - } - break; - - case ID_SELECT_COPPER_LAYERS: - for( i = 0; i < m_layerList.size(); i++ ) - { - if( m_layerList[i] <= LAST_COPPER_LAYER ) - 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 ) - m_layerCheckListBox->Check( i, false ); - - } - break; - - case ID_SELECT_ALL_LAYERS: - for( i = 0; i < m_layerList.size(); i++ ) + if( ( layermask & ( LSET::AllCuMask() | LSET::AllTechMask() ) ).any() ) m_layerCheckListBox->Check( i, true ); - break; - - case ID_DESELECT_ALL_LAYERS: - for( i = 0; i < m_layerList.size(); i++ ) + else m_layerCheckListBox->Check( i, false ); - break; + } + break; - default: - break; + case ID_SELECT_COPPER_LAYERS: + for( i = 0; i < m_layerList.size(); i++ ) + { + 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( IsCopperLayer( m_layerList[i] ) ) + m_layerCheckListBox->Check( i, false ); + } + break; + + case ID_SELECT_ALL_LAYERS: + for( i = 0; i < m_layerList.size(); i++ ) + m_layerCheckListBox->Check( i, true ); + break; + + case ID_DESELECT_ALL_LAYERS: + for( i = 0; i < m_layerList.size(); i++ ) + m_layerCheckListBox->Check( i, false ); + break; + + default: + 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,51 +763,49 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) wxBusyCursor dummy; - for( LAYER_NUM layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer ) + for( LSEQ seq = m_plotOpts.GetLayerSelection().UIOrder(); seq; ++seq ) { - if( m_plotOpts.GetLayerSelection() & GetLayerMask( layer ) ) + 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() ) + file_ext = GetGerberExtension( layer ); + + // Create file name (from the English layer name for non copper layers). + BuildPlotFileName( &fn, outputDir.GetPath(), + m_board->GetStandardLayerName( layer ), + file_ext ); + + LOCALE_IO toggle; + + BOARD* board = m_parent->GetBoard(); + PLOTTER* plotter = StartPlotBoard( board, &m_plotOpts, fn.GetFullPath(), wxEmptyString ); + + // Print diags in messages box: + wxString msg; + + if( plotter ) { - // Pick the basename from the board file - wxFileName fn( boardFilename ); + PlotOneBoardLayer( board, plotter, layer, m_plotOpts ); + plotter->EndPlot(); + delete plotter; - // 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() ) - file_ext = GetGerberExtension( layer ); - - // Create file name (from the English layer name for non copper layers). - BuildPlotFileName( &fn, outputDir.GetPath(), - m_board->GetStandardLayerName( layer ), - file_ext ); - - LOCALE_IO toggle; - BOARD *board = m_parent->GetBoard(); - PLOTTER *plotter = StartPlotBoard( board, &m_plotOpts, - fn.GetFullPath(), - wxEmptyString ); - - // Print diags in messages box: - wxString msg; - - if( plotter ) - { - PlotOneBoardLayer( board, plotter, layer, m_plotOpts ); - plotter->EndPlot(); - delete plotter; - - msg.Printf( _( "Plot file <%s> created" ), GetChars( fn.GetFullPath() ) ); - } - else - msg.Printf( _( "Unable to create <%s>" ), GetChars( fn.GetFullPath() ) ); - - msg << wxT( "\n" ); - m_messagesBox->AppendText( msg ); + msg.Printf( _( "Plot file <%s> created" ), GetChars( fn.GetFullPath() ) ); } + else + msg.Printf( _( "Unable to create <%s>" ), GetChars( fn.GetFullPath() ) ); + + 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" ) ); } + diff --git a/pcbnew/dialogs/dialog_plot.h b/pcbnew/dialogs/dialog_plot.h index b5cd562590..b041ba7a55 100644 --- a/pcbnew/dialogs/dialog_plot.h +++ b/pcbnew/dialogs/dialog_plot.h @@ -42,7 +42,7 @@ private: PCB_EDIT_FRAME* m_parent; BOARD* m_board; wxConfigBase* m_config; - std::vector 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 diff --git a/pcbnew/dialogs/dialog_print_using_printer.cpp b/pcbnew/dialogs/dialog_print_using_printer.cpp index fae82d0625..4b4312c975 100644 --- a/pcbnew/dialogs/dialog_print_using_printer.cpp +++ b/pcbnew/dialogs/dialog_print_using_printer.cpp @@ -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]; + wxConfigBase* m_config; + 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,54 +145,40 @@ 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(); s_Parameters.m_PageSetupData = s_pageSetupData; - // Create layer list. - LAYER_NUM layer; + // Create layer list. 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]; diff --git a/pcbnew/dimension.cpp b/pcbnew/dimension.cpp index fc1f828a89..1058804938 100644 --- a/pcbnew/dimension.cpp +++ b/pcbnew/dimension.cpp @@ -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 ); @@ -165,7 +165,7 @@ void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event ) { CurrentDimension->Draw( m_Parent->GetCanvas(), m_DC, GR_XOR ); } -#endif +#endif m_Parent->SaveCopyInUndoList(CurrentDimension, UR_CHANGED); @@ -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 { diff --git a/pcbnew/drag.h b/pcbnew/drag.h index beb87b62c5..72a27ac34a 100644 --- a/pcbnew/drag.h +++ b/pcbnew/drag.h @@ -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 diff --git a/pcbnew/dragsegm.cpp b/pcbnew/dragsegm.cpp index 122d1ea110..8964f6c783 100644 --- a/pcbnew/dragsegm.cpp +++ b/pcbnew/dragsegm.cpp @@ -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 ); } } diff --git a/pcbnew/drc.cpp b/pcbnew/drc.cpp index 62ffcf4153..9f01fb1f13 100644 --- a/pcbnew/drc.cpp +++ b/pcbnew/drc.cpp @@ -676,7 +676,9 @@ bool DRC::doTrackKeepoutDrc( TRACK* aRefSeg ) bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_limit ) { - LAYER_MSK layerMask = aRefPad->GetLayerMask() & ALL_CU_LAYERS; + const static LSET all_cu = LSET::AllCuMask(); + + LSET layerMask = aRefPad->GetLayerSet() & all_cu; /* used to test DRC pad to holes: this dummy pad has the size and shape of the hole * to test pad to pad hole DRC, using the pad to pad DRC test function. @@ -684,11 +686,11 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li * A pad must have a parent because some functions expect a non null parent * to find the parent board, and some other data */ - MODULE dummymodule( m_pcb ); // Creates a dummy parent - D_PAD dummypad( &dummymodule ); + MODULE dummymodule( m_pcb ); // Creates a dummy parent + D_PAD dummypad( &dummymodule ); // Ensure the hole is on all copper layers - dummypad.SetLayerMask( ALL_CU_LAYERS | dummypad.GetLayerMask() ); + dummypad.SetLayerSet( all_cu | dummypad.GetLayerSet() ); // Use the minimal local clearance value for the dummy pad. // The clearance of the active pad will be used as minimum distance to a hole @@ -710,7 +712,7 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li // No problem if pads are on different copper layers, // but their hole (if any ) can create DRC error because they are on all // copper layers, so we test them - if( ( pad->GetLayerMask() & layerMask ) == 0 ) + if( ( pad->GetLayerSet() & layerMask ) == 0 ) { // if holes are in the same location and have the same size and shape, // this can be accepted diff --git a/pcbnew/drc_clearance_test_functions.cpp b/pcbnew/drc_clearance_test_functions.cpp index 31df052a2a..3578045d91 100644 --- a/pcbnew/drc_clearance_test_functions.cpp +++ b/pcbnew/drc_clearance_test_functions.cpp @@ -145,11 +145,12 @@ bool trapezoid2pointDRC( wxPoint aTref[4], wxPoint aPcompare, int aDist ) return true; } + bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads ) { TRACK* track; wxPoint delta; // lenght on X and Y axis of segments - LAYER_MSK layerMask; + LSET layerMask; int net_code_ref; wxPoint shape_pos; @@ -164,7 +165,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads ) m_segmEnd = delta = aRefSeg->GetEnd() - origin; m_segmAngle = 0; - layerMask = aRefSeg->GetLayerMask(); + layerMask = aRefSeg->GetLayerSet(); net_code_ref = aRefSeg->GetNetCode(); // Phase 0 : Test vias @@ -206,21 +207,29 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads ) // and **only one layer** can be drilled if( refvia->GetViaType() == VIA_MICROVIA ) { - LAYER_NUM layer1, layer2; - bool err = true; + LAYER_ID layer1, layer2; + bool err = true; refvia->LayerPair( &layer1, &layer2 ); if( layer1 > layer2 ) EXCHG( layer1, layer2 ); +#if 0 // was: // test: - if( layer1 == LAYER_N_BACK && layer2 == LAYER_N_2 ) + if( layer1 == B_Cu && layer2 == LAYER_N_2 ) err = false; if( layer1 == (m_pcb->GetDesignSettings().GetCopperLayerCount() - 2 ) - && layer2 == LAYER_N_FRONT ) + && layer2 == F_Cu ) err = false; +#else + if( layer2 == B_Cu && layer1 == m_pcb->GetDesignSettings().GetCopperLayerCount() - 2 ) + err = false; + + else if( layer1 == F_Cu && layer2 == In1_Cu ) + err = false; +#endif if( err ) { @@ -266,10 +275,10 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads ) * A pad must have a parent because some functions expect a non null parent * to find the parent board, and some other data */ - MODULE dummymodule( m_pcb ); // Creates a dummy parent - D_PAD dummypad( &dummymodule ); + MODULE dummymodule( m_pcb ); // Creates a dummy parent + D_PAD dummypad( &dummymodule ); - dummypad.SetLayerMask( ALL_CU_LAYERS ); // Ensure the hole is on all layers + dummypad.SetLayerSet( LSET::AllCuMask() ); // Ensure the hole is on all layers // Compute the min distance to pads if( testPads ) @@ -282,7 +291,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads ) * But if a drill hole exists (a pad on a single layer can have a hole!) * we must test the hole */ - if( (pad->GetLayerMask() & layerMask ) == 0 ) + if( !( pad->GetLayerSet() & layerMask ).any() ) { /* We must test the pad hole. In order to use the function * checkClearanceSegmToPad(),a pseudo pad is used, with a shape and a @@ -345,7 +354,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads ) continue; // No problem if segment are on different layers : - if( ( layerMask & track->GetLayerMask() ) == 0 ) + if( ( layerMask & track->GetLayerSet() ) == 0 ) continue; // the minimum distance = clearance plus half the reference track diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index 4e48b04098..1d307e9ede 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -1293,12 +1293,19 @@ void EAGLE_PLUGIN::loadLayerDefs( CPTREE& aLayers ) for( EITER it = cu.begin(); it != cu.end(); ++it, ++ki_layer_count ) { if( ki_layer_count == 0 ) - m_cu_map[it->number] = LAYER_N_FRONT; + m_cu_map[it->number] = F_Cu; else if( ki_layer_count == int( cu.size()-1 ) ) - m_cu_map[it->number] = LAYER_N_BACK; + m_cu_map[it->number] = B_Cu; else + { // some eagle boards do not have contiguous layer number sequences. + +#if 0 // pre LAYER_ID & LSET: m_cu_map[it->number] = cu.size() - 1 - ki_layer_count; +#else + m_cu_map[it->number] = ki_layer_count; +#endif + } } #if 0 && defined(DEBUG) @@ -1316,7 +1323,7 @@ void EAGLE_PLUGIN::loadLayerDefs( CPTREE& aLayers ) for( EITER it = cu.begin(); it != cu.end(); ++it ) { - LAYER_NUM layer = kicad_layer( it->number ); + LAYER_ID layer = kicad_layer( it->number ); // these function provide their own protection against UNDEFINED_LAYER: m_board->SetLayerName( layer, FROM_UTF8( it->name.c_str() ) ); @@ -1340,7 +1347,7 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics ) m_xpath->push( "wire" ); EWIRE w( gr->second ); - LAYER_NUM layer = kicad_layer( w.layer ); + LAYER_ID layer = kicad_layer( w.layer ); if( layer != UNDEFINED_LAYER ) { @@ -1368,7 +1375,7 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics ) m_xpath->push( "text" ); ETEXT t( gr->second ); - LAYER_NUM layer = kicad_layer( t.layer ); + LAYER_ID layer = kicad_layer( t.layer ); if( layer != UNDEFINED_LAYER ) { @@ -1459,7 +1466,7 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics ) m_xpath->push( "circle" ); ECIRCLE c( gr->second ); - LAYER_NUM layer = kicad_layer( c.layer ); + LAYER_ID layer = kicad_layer( c.layer ); if( layer != UNDEFINED_LAYER ) // unsupported layer { @@ -1483,7 +1490,7 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics ) m_xpath->push( "rectangle" ); ERECT r( gr->second ); - LAYER_NUM layer = kicad_layer( r.layer ); + LAYER_ID layer = kicad_layer( r.layer ); if( IsCopperLayer( layer ) ) { @@ -1550,7 +1557,7 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics ) pad->SetDrillSize( sz ); pad->SetSize( sz ); - pad->SetLayerMask( ALL_CU_LAYERS /* | SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT */ ); + pad->SetLayerSet( LSET::AllCuMask() ); m_xpath->pop(); } @@ -1923,7 +1930,7 @@ MODULE* EAGLE_PLUGIN::makeModule( CPTREE& aPackage, const string& aPkgName ) con void EAGLE_PLUGIN::packageWire( MODULE* aModule, CPTREE& aTree ) const { EWIRE w( aTree ); - LAYER_NUM layer = kicad_layer( w.layer ); + LAYER_ID layer = kicad_layer( w.layer ); if( IsNonCopperLayer( layer ) ) // only valid non-copper wires, skip copper package wires { @@ -1966,7 +1973,7 @@ void EAGLE_PLUGIN::packagePad( MODULE* aModule, CPTREE& aTree ) const pad->SetDrillSize( wxSize( kicad( e.drill ), kicad( e.drill ) ) ); - pad->SetLayerMask( ALL_CU_LAYERS | SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT ); + pad->SetLayerSet( LSET::AllCuMask().set( B_Mask ).set( F_Mask ) ); if( e.shape ) { @@ -2030,11 +2037,11 @@ void EAGLE_PLUGIN::packagePad( MODULE* aModule, CPTREE& aTree ) const void EAGLE_PLUGIN::packageText( MODULE* aModule, CPTREE& aTree ) const { ETEXT t( aTree ); - LAYER_NUM layer = kicad_layer( t.layer ); + LAYER_ID layer = kicad_layer( t.layer ); if( layer == UNDEFINED_LAYER ) { - layer = COMMENT_N; + layer = Cmts_User; } TEXTE_MODULE* txt; @@ -2138,7 +2145,7 @@ void EAGLE_PLUGIN::packageText( MODULE* aModule, CPTREE& aTree ) const void EAGLE_PLUGIN::packageRectangle( MODULE* aModule, CPTREE& aTree ) const { ERECT r( aTree ); - LAYER_NUM layer = kicad_layer( r.layer ); + LAYER_ID layer = kicad_layer( r.layer ); if( IsNonCopperLayer( layer ) ) // skip copper "package.rectangle"s { @@ -2171,7 +2178,7 @@ void EAGLE_PLUGIN::packageRectangle( MODULE* aModule, CPTREE& aTree ) const void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, CPTREE& aTree ) const { EPOLYGON p( aTree ); - LAYER_NUM layer = kicad_layer( p.layer ); + LAYER_ID layer = kicad_layer( p.layer ); if( IsNonCopperLayer( layer ) ) // skip copper "package.rectangle"s { @@ -2183,12 +2190,12 @@ void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, CPTREE& aTree ) const /* switch( layer ) { - case ECO1_N: layer = SILKSCREEN_N_FRONT; break; - case ECO2_N: layer = SILKSCREEN_N_BACK; break; + case Eco1_User: layer = F_SilkS; break; + case Eco2_User: layer = B_SilkS; break; // all MODULE templates (created from eagle packages) are on front layer // until cloned. - case COMMENT_N: layer = SILKSCREEN_N_FRONT; break; + case Cmts_User: layer = F_SilkS; break; } */ @@ -2220,19 +2227,19 @@ void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, CPTREE& aTree ) const void EAGLE_PLUGIN::packageCircle( MODULE* aModule, CPTREE& aTree ) const { ECIRCLE e( aTree ); - LAYER_NUM layer = kicad_layer( e.layer ); + LAYER_ID layer = kicad_layer( e.layer ); EDGE_MODULE* gr = new EDGE_MODULE( aModule, S_CIRCLE ); aModule->GraphicalItems().PushBack( gr ); gr->SetWidth( kicad( e.width ) ); - switch( layer ) + switch( (int) layer ) { - case UNDEFINED_LAYER: layer = COMMENT_N; break; + case UNDEFINED_LAYER: layer = Cmts_User; break; /* - case ECO1_N: layer = SILKSCREEN_N_FRONT; break; - case ECO2_N: layer = SILKSCREEN_N_BACK; break; + case Eco1_User: layer = F_SilkS; break; + case Eco2_User: layer = B_SilkS; break; */ default: break; @@ -2272,14 +2279,14 @@ void EAGLE_PLUGIN::packageHole( MODULE* aModule, CPTREE& aTree ) const pad->SetDrillSize( sz ); pad->SetSize( sz ); - pad->SetLayerMask( ALL_CU_LAYERS /* | SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT */ ); + pad->SetLayerSet( LSET::AllCuMask() /* | SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT */ ); } void EAGLE_PLUGIN::packageSMD( MODULE* aModule, CPTREE& aTree ) const { ESMD e( aTree ); - LAYER_NUM layer = kicad_layer( e.layer ); + LAYER_ID layer = kicad_layer( e.layer ); if( !IsCopperLayer( layer ) ) { @@ -2308,10 +2315,13 @@ void EAGLE_PLUGIN::packageSMD( MODULE* aModule, CPTREE& aTree ) const pad->SetLayer( layer ); - if( layer == LAYER_N_FRONT ) - pad->SetLayerMask( LAYER_FRONT | SOLDERPASTE_LAYER_FRONT | SOLDERMASK_LAYER_FRONT ); - else if( layer == LAYER_N_BACK ) - pad->SetLayerMask( LAYER_BACK | SOLDERPASTE_LAYER_BACK | SOLDERMASK_LAYER_BACK ); + static const LSET front( 3, F_Cu, F_Paste, F_Mask ); + static const LSET back( 3, B_Cu, B_Paste, B_Mask ); + + if( layer == F_Cu ) + pad->SetLayerSet( front ); + else if( layer == B_Cu ) + pad->SetLayerSet( back ); // Optional according to DTD if( e.roundness ) // set set shape to PAD_RECT above, in case roundness is not present @@ -2372,7 +2382,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals ) { m_xpath->push( "wire" ); EWIRE w( it->second ); - LAYER_NUM layer = kicad_layer( w.layer ); + LAYER_ID layer = kicad_layer( w.layer ); if( IsCopperLayer( layer ) ) { @@ -2406,8 +2416,8 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals ) m_xpath->push( "via" ); EVIA v( it->second ); - LAYER_NUM layer_front_most = kicad_layer( v.layer_front_most ); - LAYER_NUM layer_back_most = kicad_layer( v.layer_back_most ); + LAYER_ID layer_front_most = kicad_layer( v.layer_front_most ); + LAYER_ID layer_back_most = kicad_layer( v.layer_back_most ); if( IsCopperLayer( layer_front_most ) && IsCopperLayer( layer_back_most ) ) @@ -2440,9 +2450,9 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals ) if( drillz < m_min_via_hole ) m_min_via_hole = drillz; - if( layer_front_most == LAYER_N_FRONT && layer_back_most == LAYER_N_BACK ) + if( layer_front_most == F_Cu && layer_back_most == B_Cu ) via->SetViaType( VIA_THROUGH ); - else if( layer_front_most == LAYER_N_FRONT || layer_back_most == LAYER_N_BACK ) + else if( layer_front_most == F_Cu || layer_back_most == B_Cu ) via->SetViaType( VIA_MICROVIA ); else via->SetViaType( VIA_BLIND_BURIED ); @@ -2484,7 +2494,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals ) m_xpath->push( "polygon" ); EPOLYGON p( it->second ); - LAYER_NUM layer = kicad_layer( p.layer ); + LAYER_ID layer = kicad_layer( p.layer ); if( IsCopperLayer( layer ) ) { @@ -2563,7 +2573,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals ) } -int EAGLE_PLUGIN::kicad_layer( int aEagleLayer ) const +LAYER_ID EAGLE_PLUGIN::kicad_layer( int aEagleLayer ) const { /* will assume this is a valid mapping for all eagle boards until I get paid more: @@ -2637,26 +2647,26 @@ int EAGLE_PLUGIN::kicad_layer( int aEagleLayer ) const // eagle copper layer: if( aEagleLayer >= 1 && aEagleLayer < int( DIM( m_cu_map ) ) ) { - return m_cu_map[aEagleLayer]; + kiLayer = m_cu_map[aEagleLayer]; } else { /* #define FIRST_NON_COPPER_LAYER 16 -#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 B_Adhes 16 +#define F_Adhes 17 +#define B_Paste 18 +#define F_Paste 19 +#define B_SilkS 20 +#define F_SilkS 21 +#define B_Mask 22 +#define F_Mask 23 +#define Dwgs_User 24 +#define Cmts_User 25 +#define Eco1_User 26 +#define Eco2_User 27 +#define Edge_Cuts 28 #define LAST_NON_COPPER_LAYER 28 #define UNUSED_LAYER_29 29 #define UNUSED_LAYER_30 30 @@ -2665,40 +2675,40 @@ int EAGLE_PLUGIN::kicad_layer( int aEagleLayer ) const // translate non-copper eagle layer to pcbnew layer switch( aEagleLayer ) { - case 20: kiLayer = EDGE_N; break; // eagle says "Dimension" layer, but it's for board perimeter - case 21: kiLayer = SILKSCREEN_N_FRONT; break; - case 22: kiLayer = SILKSCREEN_N_BACK; break; - case 25: kiLayer = SILKSCREEN_N_FRONT; break; - case 26: kiLayer = SILKSCREEN_N_BACK; break; - case 27: kiLayer = SILKSCREEN_N_FRONT; break; - case 28: kiLayer = SILKSCREEN_N_BACK; break; - case 29: kiLayer = SOLDERMASK_N_FRONT; break; - case 30: kiLayer = SOLDERMASK_N_BACK; break; - case 31: kiLayer = SOLDERPASTE_N_FRONT; break; - case 32: kiLayer = SOLDERPASTE_N_BACK; break; - case 33: kiLayer = SOLDERMASK_N_FRONT; break; - case 34: kiLayer = SOLDERMASK_N_BACK; break; - case 35: kiLayer = ADHESIVE_N_FRONT; break; - case 36: kiLayer = ADHESIVE_N_BACK; break; - case 49: kiLayer = COMMENT_N; break; - case 50: kiLayer = COMMENT_N; break; + case 20: kiLayer = Edge_Cuts; break; // eagle says "Dimension" layer, but it's for board perimeter + case 21: kiLayer = F_SilkS; break; + case 22: kiLayer = B_SilkS; break; + case 25: kiLayer = F_SilkS; break; + case 26: kiLayer = B_SilkS; break; + case 27: kiLayer = F_SilkS; break; + case 28: kiLayer = B_SilkS; break; + case 29: kiLayer = F_Mask; break; + case 30: kiLayer = B_Mask; break; + case 31: kiLayer = F_Paste; break; + case 32: kiLayer = B_Paste; break; + case 33: kiLayer = F_Mask; break; + case 34: kiLayer = B_Mask; break; + case 35: kiLayer = F_Adhes; break; + case 36: kiLayer = B_Adhes; break; + case 49: kiLayer = Cmts_User; break; + case 50: kiLayer = Cmts_User; break; // Packages show the future chip pins on SMD parts using layer 51. // This is an area slightly smaller than the PAD/SMD copper area. // Carry those visual aids into the MODULE on the drawing layer, not silkscreen. - case 51: kiLayer = DRAW_N; break; - case 52: kiLayer = DRAW_N; break; + case 51: kiLayer = Dwgs_User; break; + case 52: kiLayer = Dwgs_User; break; - case 95: kiLayer = ECO1_N; break; - case 96: kiLayer = ECO2_N; break; + case 95: kiLayer = Eco1_User; break; + case 96: kiLayer = Eco2_User; break; default: // some layers do not map to KiCad // DBG( printf( "unsupported eagle layer: %d\n", aEagleLayer );) - kiLayer = UNDEFINED_LAYER; break; + kiLayer = UNDEFINED_LAYER; break; } } - return kiLayer; + return LAYER_ID( kiLayer ); } diff --git a/pcbnew/eagle_plugin.h b/pcbnew/eagle_plugin.h index 1dde4a94e5..4966ccb433 100644 --- a/pcbnew/eagle_plugin.h +++ b/pcbnew/eagle_plugin.h @@ -160,7 +160,7 @@ private: wxSize kicad_fontz( double d ) const; /// Convert an Eagle layer to a KiCad layer. - LAYER_NUM kicad_layer( int aLayer ) const; + LAYER_ID kicad_layer( int aLayer ) const; /// Convert a KiCad distance to an Eagle distance. double eagle( BIU d ) const { return mm_per_biu * d; } diff --git a/pcbnew/edgemod.cpp b/pcbnew/edgemod.cpp index d9dc16fe44..3c1e901f5f 100644 --- a/pcbnew/edgemod.cpp +++ b/pcbnew/edgemod.cpp @@ -192,15 +192,15 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* aEdge ) { // note: if aEdge == NULL, all outline segments will be modified - MODULE* module = GetBoard()->m_Modules; - LAYER_NUM layer = SILKSCREEN_N_FRONT; - bool modified = false; + MODULE* module = GetBoard()->m_Modules; + LAYER_ID layer = F_SilkS; + bool modified = false; if( aEdge ) layer = aEdge->GetLayer(); // Ask for the new layer - LAYER_NUM new_layer = SelectLayer(layer, EDGE_LAYER ); + LAYER_ID new_layer = SelectLayer( layer, Edge_Cuts ); if( layer < 0 ) return; @@ -214,7 +214,7 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* aEdge ) return; } - if( aEdge == NULL ) + if( !aEdge ) { for( BOARD_ITEM *item = module->GraphicalItems() ; item != NULL; item = item->Next() ) @@ -350,9 +350,9 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* aEdge, // The default layer for an edge is the corresponding silk layer if( module->IsFlipped() ) - aEdge->SetLayer( SILKSCREEN_N_BACK ); + aEdge->SetLayer( B_SilkS ); else - aEdge->SetLayer( SILKSCREEN_N_FRONT ); + aEdge->SetLayer( F_SilkS ); // Initialize the starting point of the new segment or arc aEdge->SetStart( GetCrossHairPosition() ); diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 7c2a02804f..9606618a0f 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -62,7 +62,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) { int id = event.GetId(); - LAYER_NUM itmp; + INSTALL_UNBUFFERED_DC( dc, m_canvas ); MODULE* module; @@ -420,10 +420,13 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) id == ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_BLIND_BURIED_VIA ) { m_canvas->SetIgnoreMouseEvents( true ); + wxPoint dlgPosition; + wxGetMousePosition( &dlgPosition.x, &dlgPosition.y ); - LAYER_NUM layer = SelectLayer( GetActiveLayer(), ALL_NO_CU_LAYERS, - dlgPosition ); + + LAYER_ID layer = SelectLayer( GetActiveLayer(), LSET::AllNonCuMask(), dlgPosition ); + m_canvas->SetIgnoreMouseEvents( false ); m_canvas->MoveCursorToCrossHair(); @@ -956,20 +959,22 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_PCB_SELECT_LAYER: - itmp = SelectLayer( GetActiveLayer() ); - - if( itmp >= 0 ) { - // if user changed colors and we are in high contrast mode, then redraw - // because the PAD_SMD pads may change color. - if( DisplayOpt.ContrastModeDisplay && GetActiveLayer() != itmp ) - { - m_canvas->Refresh(); - } - SetActiveLayer( itmp ); - } + LAYER_ID itmp = SelectLayer( GetActiveLayer() ); - m_canvas->MoveCursorToCrossHair(); + if( itmp >= 0 ) + { + // if user changed colors and we are in high contrast mode, then redraw + // because the PAD_SMD pads may change color. + if( DisplayOpt.ContrastModeDisplay && GetActiveLayer() != itmp ) + { + m_canvas->Refresh(); + } + SetActiveLayer( itmp ); + } + + m_canvas->MoveCursorToCrossHair(); + } break; case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR: @@ -977,20 +982,23 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_PCB_SELECT_NO_CU_LAYER: - itmp = SelectLayer( GetActiveLayer(), ALL_CU_LAYERS ); + { + LAYER_ID itmp = SelectLayer( GetActiveLayer(), LSET::AllCuMask() ); - if( itmp >= 0 ) - SetActiveLayer( itmp ); + if( itmp >= 0 ) + SetActiveLayer( itmp ); - m_canvas->MoveCursorToCrossHair(); + m_canvas->MoveCursorToCrossHair(); + } break; case ID_POPUP_PCB_SELECT_CU_LAYER: - itmp = SelectLayer( GetActiveLayer(), ALL_NO_CU_LAYERS ); - - if( itmp >= 0 ) - SetActiveLayer( itmp ); + { + LAYER_ID itmp = SelectLayer( GetActiveLayer(), LSET::AllNonCuMask() ); + if( itmp >= 0 ) + SetActiveLayer( itmp ); + } break; case ID_POPUP_PCB_SELECT_LAYER_PAIR: @@ -999,11 +1007,10 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_TOOLBARH_PCB_SELECT_LAYER: - SetActiveLayer( m_SelLayerBox->GetLayerSelection() ); + SetActiveLayer( (LAYER_ID) m_SelLayerBox->GetLayerSelection() ); if( DisplayOpt.ContrastModeDisplay ) m_canvas->Refresh( true ); - break; case ID_POPUP_PCB_EDIT_TEXTEPCB: @@ -1300,9 +1307,9 @@ void PCB_EDIT_FRAME::RemoveStruct( BOARD_ITEM* Item, wxDC* DC ) } -void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, LAYER_NUM layer ) +void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, LAYER_ID layer ) { - LAYER_NUM curLayer = GetActiveLayer(); + LAYER_ID curLayer = GetActiveLayer(); // Check if the specified layer matches the present layer if( layer == curLayer ) @@ -1317,7 +1324,7 @@ void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, LAYER_NUM layer ) // selection of any other copper layer is disregarded). if( GetBoard()->GetCopperLayerCount() < 2 ) { - if( layer != LAYER_N_BACK ) + if( layer != B_Cu ) return; } // If more than one copper layer is enabled, the "Copper" @@ -1326,17 +1333,16 @@ void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, LAYER_NUM layer ) // layers are also capable of being selected. else { - if( ( layer != LAYER_N_BACK ) && ( layer != LAYER_N_FRONT ) - && ( layer >= GetBoard()->GetCopperLayerCount() - 1 ) ) + if( layer != B_Cu && layer != F_Cu && layer >= GetBoard()->GetCopperLayerCount() - 1 ) return; } EDA_ITEM* current = GetScreen()->GetCurItem(); // See if we are drawing a segment; if so, add a via? - if( GetToolId() == ID_TRACK_BUTT && current != NULL ) + if( GetToolId() == ID_TRACK_BUTT && current ) { - if( current->Type() == PCB_TRACE_T && ( current->IsNew() ) ) + if( current->Type() == PCB_TRACE_T && current->IsNew() ) { // Want to set the routing layers so that it switches properly - // see the implementation of Other_Layer_Route - the working diff --git a/pcbnew/edit_pcb_text.cpp b/pcbnew/edit_pcb_text.cpp index 277159a5ee..8c6e257dc8 100644 --- a/pcbnew/edit_pcb_text.cpp +++ b/pcbnew/edit_pcb_text.cpp @@ -202,13 +202,15 @@ TEXTE_PCB* PCB_EDIT_FRAME::CreateTextePcb( wxDC* aDC, TEXTE_PCB* aText ) { GetBoard()->Add( textePcb ); textePcb->SetFlags( IS_NEW ); - LAYER_NUM layer = ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer; + + LAYER_ID layer = ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer; + textePcb->SetLayer( layer ); // Set the mirrored option for layers on the BACK side of the board - if( layer == LAYER_N_BACK || layer == SILKSCREEN_N_BACK || - layer == SOLDERPASTE_N_BACK || layer == SOLDERMASK_N_BACK || - layer == ADHESIVE_N_BACK + if( layer == B_Cu || layer == B_SilkS || + layer == B_Paste || layer == B_Mask || + layer == B_Adhes ) textePcb->SetMirrored( true ); diff --git a/pcbnew/editedge.cpp b/pcbnew/editedge.cpp index 207b515e66..ee6af0fd1a 100644 --- a/pcbnew/editedge.cpp +++ b/pcbnew/editedge.cpp @@ -145,9 +145,9 @@ void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ) } -void PCB_EDIT_FRAME::Delete_Drawings_All_Layer( LAYER_NUM aLayer ) +void PCB_EDIT_FRAME::Delete_Drawings_All_Layer( LAYER_ID aLayer ) { - if( aLayer <= LAST_COPPER_LAYER ) + if( IsCopperLayer( aLayer ) ) { DisplayError( this, _( "Copper layer global delete not allowed!" ) ); return; @@ -246,7 +246,7 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, STROKE_T s s_large = GetDesignSettings().m_DrawSegmentWidth; - if( GetActiveLayer() == EDGE_N ) + if( GetActiveLayer() == Edge_Cuts ) { s_large = GetDesignSettings().m_EdgeSegmentWidth; } diff --git a/pcbnew/editrack-part2.cpp b/pcbnew/editrack-part2.cpp index 07967de9c9..a9475c5c78 100644 --- a/pcbnew/editrack-part2.cpp +++ b/pcbnew/editrack-part2.cpp @@ -104,12 +104,12 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) via->SetStart( g_CurrentTrackSegment->GetEnd() ); // Usual via is from copper to component. - // layer pair is LAYER_N_BACK and LAYER_N_FRONT. - via->SetLayerPair( LAYER_N_BACK, LAYER_N_FRONT ); + // layer pair is B_Cu and F_Cu. + via->SetLayerPair( B_Cu, F_Cu ); via->SetDrill( GetDesignSettings().GetCurrentViaDrill() ); - LAYER_NUM first_layer = GetActiveLayer(); - LAYER_NUM last_layer; + LAYER_ID first_layer = GetActiveLayer(); + LAYER_ID last_layer; // prepare switch to new active layer: if( first_layer != GetScreen()->m_Route_Layer_TOP ) @@ -118,31 +118,32 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) last_layer = GetScreen()->m_Route_Layer_BOTTOM; // Adjust the actual via layer pair - switch ( via->GetViaType() ) + switch( via->GetViaType() ) { case VIA_BLIND_BURIED: via->SetLayerPair( first_layer, last_layer ); break; case VIA_MICROVIA: // from external to the near neighbor inner layer - { - LAYER_NUM last_inner_layer = FIRST_LAYER + (GetBoard()->GetCopperLayerCount() - 2); - if ( first_layer == LAYER_N_BACK ) - last_layer = LAYER_N_2; - else if ( first_layer == LAYER_N_FRONT ) - last_layer = last_inner_layer; - else if ( first_layer == LAYER_N_2 ) - last_layer = LAYER_N_BACK; - else if ( first_layer == last_inner_layer ) - last_layer = LAYER_N_FRONT; - - // else error: will be removed later - via->SetLayerPair( first_layer, last_layer ); { - NETINFO_ITEM* net = via->GetNet(); - via->SetWidth( net->GetMicroViaSize() ); + LAYER_ID last_inner_layer = (LAYER_ID) ( GetBoard()->GetCopperLayerCount() - 2 ); + + if( first_layer == B_Cu ) + last_layer = last_inner_layer; + else if( first_layer == F_Cu ) + last_layer = In1_Cu; + else if( first_layer == last_inner_layer ) + last_layer = B_Cu; + else if( first_layer == In1_Cu ) + last_layer = F_Cu; + + // else error: will be removed later + via->SetLayerPair( first_layer, last_layer ); + { + NETINFO_ITEM* net = via->GetNet(); + via->SetWidth( net->GetMicroViaSize() ); + } } - } break; default: diff --git a/pcbnew/editrack.cpp b/pcbnew/editrack.cpp index 5842a921ce..ade0736df6 100644 --- a/pcbnew/editrack.cpp +++ b/pcbnew/editrack.cpp @@ -62,7 +62,7 @@ static void Abort_Create_Track( EDA_DRAW_PANEL* Panel, wxDC* DC ) { PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Panel->GetParent(); BOARD* pcb = frame->GetBoard(); - TRACK* track = dyn_cast( frame->GetCurItem() ); + TRACK* track = dyn_cast( frame->GetCurItem() ); if( track ) { @@ -98,10 +98,11 @@ static void Abort_Create_Track( EDA_DRAW_PANEL* Panel, wxDC* DC ) */ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) { - TRACK* TrackOnStartPoint = NULL; - LAYER_MSK layerMask = GetLayerMask( GetScreen()->m_Active_Layer ); - BOARD_CONNECTED_ITEM* LockPoint; - wxPoint pos = GetCrossHairPosition(); + TRACK* trackOnStartPoint = NULL; + LSET layerMask( GetScreen()->m_Active_Layer ); + wxPoint pos = GetCrossHairPosition(); + + BOARD_CONNECTED_ITEM* lockPoint; if( aTrack == NULL ) // Starting a new track segment { @@ -122,14 +123,14 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) GetBoard()->SetHighLightNet( 0 ); // Search for a starting point of the new track, a track or pad - LockPoint = GetBoard()->GetLockPoint( pos, layerMask ); + lockPoint = GetBoard()->GetLockPoint( pos, layerMask ); D_PAD* pad = NULL; - if( LockPoint ) // An item (pad or track) is found + if( lockPoint ) // An item (pad or track) is found { - if( LockPoint->Type() == PCB_PAD_T ) + if( lockPoint->Type() == PCB_PAD_T ) { - pad = (D_PAD*) LockPoint; + pad = (D_PAD*) lockPoint; // A pad is found: put the starting point on pad center pos = pad->GetPosition(); @@ -137,9 +138,9 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) } else // A track segment is found { - TrackOnStartPoint = (TRACK*) LockPoint; - GetBoard()->SetHighLightNet( TrackOnStartPoint->GetNetCode() ); - GetBoard()->CreateLockPoint( pos, TrackOnStartPoint, &s_ItemsListPicker ); + trackOnStartPoint = (TRACK*) lockPoint; + GetBoard()->SetHighLightNet( trackOnStartPoint->GetNetCode() ); + GetBoard()->CreateLockPoint( pos, trackOnStartPoint, &s_ItemsListPicker ); } } else @@ -158,7 +159,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) DBG( g_CurrentTrackList.VerifyListIntegrity() ); - BuildAirWiresTargetsList( LockPoint, wxPoint( 0, 0 ), true ); + BuildAirWiresTargetsList( lockPoint, wxPoint( 0, 0 ), true ); DBG( g_CurrentTrackList.VerifyListIntegrity() ); @@ -174,8 +175,8 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) if( GetDesignSettings().m_UseConnectedTrackWidth ) { - if( TrackOnStartPoint && TrackOnStartPoint->Type() == PCB_TRACE_T ) - g_CurrentTrackSegment->SetWidth( TrackOnStartPoint->GetWidth()); + if( trackOnStartPoint && trackOnStartPoint->Type() == PCB_TRACE_T ) + g_CurrentTrackSegment->SetWidth( trackOnStartPoint->GetWidth()); } g_CurrentTrackSegment->SetStart( pos ); @@ -414,7 +415,7 @@ bool PCB_EDIT_FRAME::Add45DegreeSegment( wxDC* aDC ) bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* aDC ) { - LAYER_MSK layerMask = GetLayerMask( GetScreen()->m_Active_Layer ); + LSET layerMask( GetScreen()->m_Active_Layer ); if( aTrack == NULL ) return false; @@ -451,20 +452,20 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* aDC ) * This helps to reduce the computing time */ // Attaching the end point of the new track to a pad or a track - BOARD_CONNECTED_ITEM* LockPoint = GetBoard()->GetLockPoint( pos, layerMask ); + BOARD_CONNECTED_ITEM* lockPoint = GetBoard()->GetLockPoint( pos, layerMask ); - if( LockPoint ) + if( lockPoint ) { - if( LockPoint->Type() == PCB_PAD_T ) // End of track is on a pad. + if( lockPoint->Type() == PCB_PAD_T ) // End of track is on a pad. { - EnsureEndTrackOnPad( (D_PAD*) LockPoint ); + EnsureEndTrackOnPad( (D_PAD*) lockPoint ); } else // If end point of is on a different track, // creates a lock point if not exists { // Creates a lock point, if not already exists: wxPoint hp = g_CurrentTrackSegment->GetEnd(); - LockPoint = GetBoard()->CreateLockPoint( hp, (TRACK*) LockPoint, &s_ItemsListPicker ); + lockPoint = GetBoard()->CreateLockPoint( hp, (TRACK*) lockPoint, &s_ItemsListPicker ); g_CurrentTrackSegment->SetEnd(hp); } } @@ -1009,7 +1010,7 @@ void DeleteNullTrackSegments( BOARD* pcb, DLIST& aTrackList ) TRACK* firsttrack = track; TRACK* oldtrack; - BOARD_CONNECTED_ITEM* LockPoint = track->start; + BOARD_CONNECTED_ITEM* lockPoint = track->start; while( track != NULL ) { @@ -1047,9 +1048,9 @@ void DeleteNullTrackSegments( BOARD* pcb, DLIST& aTrackList ) oldtrack->SetStatus( 0 ); } - firsttrack->start = LockPoint; + firsttrack->start = lockPoint; - if( LockPoint && LockPoint->Type()==PCB_PAD_T ) + if( lockPoint && lockPoint->Type()==PCB_PAD_T ) firsttrack->SetState( BEGIN_ONPAD, true ); track = firsttrack; @@ -1057,16 +1058,16 @@ void DeleteNullTrackSegments( BOARD* pcb, DLIST& aTrackList ) while( track != NULL ) { TRACK* next_track = track->Next(); - LockPoint = pcb->GetPad( track, ENDPOINT_END ); + lockPoint = pcb->GetPad( track, ENDPOINT_END ); - if( LockPoint ) + if( lockPoint ) { - track->end = LockPoint; + track->end = lockPoint; track->SetState( END_ONPAD, true ); if( next_track ) { - next_track->start = LockPoint; + next_track->start = lockPoint; next_track->SetState( BEGIN_ONPAD, true ); } } diff --git a/pcbnew/exporters/export_d356.cpp b/pcbnew/exporters/export_d356.cpp index f75dfbdeba..2c3d433873 100644 --- a/pcbnew/exporters/export_d356.cpp +++ b/pcbnew/exporters/export_d356.cpp @@ -69,34 +69,32 @@ struct D356_RECORD }; // Compute the access code for a pad. Returns -1 if there is no copper -static int compute_pad_access_code( BOARD *aPcb, LAYER_MSK aLayerMask ) +static int compute_pad_access_code( BOARD *aPcb, LSET aLayerMask ) { // Non-copper is not interesting here - aLayerMask &= ALL_CU_LAYERS; - if( aLayerMask == 0 ) + aLayerMask &= LSET::AllCuMask(); + if( !aLayerMask.any() ) return -1; // Traditional TH pad - if( (aLayerMask & LAYER_FRONT) && (aLayerMask & LAYER_BACK) ) + if( aLayerMask[F_Cu] && aLayerMask[B_Cu] ) return 0; // Front SMD pad - if( (aLayerMask & LAYER_FRONT) ) + if( aLayerMask[F_Cu] ) return 1; // Back SMD pad - if( (aLayerMask & LAYER_BACK) ) + if( aLayerMask[B_Cu] ) return aPcb->GetCopperLayerCount(); // OK, we have an inner-layer only pad (and I have no idea about // what could be used for); anyway, find the first copper layer // it's on - for (LAYER_NUM scan_layer = LAYER_N_2; - scan_layer < LAYER_N_BACK; - ++scan_layer) + for( LAYER_NUM layer = In1_Cu; layer < B_Cu; ++layer ) { - if( GetLayerMask( scan_layer ) & aLayerMask ) - return scan_layer + 1; + if( aLayerMask[layer] ) + return layer + 1; } // This shouldn't happen @@ -119,12 +117,12 @@ static void build_pad_testpoints( BOARD *aPcb, wxPoint origin = aPcb->GetAuxOrigin(); for( MODULE *module = aPcb->m_Modules; - module != NULL; module = module->Next() ) + 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() ) { D356_RECORD rk; - rk.access = compute_pad_access_code( aPcb, pad->GetLayerMask() ); + rk.access = compute_pad_access_code( aPcb, pad->GetLayerSet() ); // It could be a mask only pad, we only handle pads with copper here if( rk.access != -1 ) @@ -153,9 +151,9 @@ static void build_pad_testpoints( BOARD *aPcb, // the value indicates which sides are *not* accessible rk.soldermask = 3; - if( pad->GetLayerMask() & SOLDERMASK_LAYER_FRONT) + if( pad->GetLayerSet()[F_Mask] ) rk.soldermask &= ~1; - if( pad->GetLayerMask() & SOLDERMASK_LAYER_BACK) + if( pad->GetLayerSet()[B_Mask] ) rk.soldermask &= ~2; aRecords.push_back( rk ); @@ -171,15 +169,15 @@ static int via_access_code( BOARD *aPcb, int top_layer, int bottom_layer ) { // Easy case for through vias: top_layer is component, bottom_layer is // solder, access code is 0 - if( (top_layer == LAYER_N_FRONT) && (bottom_layer == LAYER_N_BACK) ) + if( (top_layer == F_Cu) && (bottom_layer == B_Cu) ) return 0; // Blind via, reachable from front - if( top_layer == LAYER_N_FRONT ) + if( top_layer == F_Cu ) return 1; // Blind via, reachable from bottom - if( bottom_layer == LAYER_N_BACK ) + if( bottom_layer == B_Cu ) return aPcb->GetCopperLayerCount(); // It's a buried via, accessible from some inner layer @@ -194,7 +192,7 @@ static void build_via_testpoints( BOARD *aPcb, wxPoint origin = aPcb->GetAuxOrigin(); // Enumerate all the track segments and keep the vias - for( TRACK *track = aPcb->m_Track; track != NULL; track = track->Next() ) + for( TRACK *track = aPcb->m_Track; track; track = track->Next() ) { if( track->Type() == PCB_VIA_T ) { @@ -213,8 +211,11 @@ static void build_via_testpoints( BOARD *aPcb, rk.midpoint = true; // Vias are always midpoints rk.drill = via->GetDrillValue(); rk.mechanical = false; - LAYER_NUM top_layer, bottom_layer; + + LAYER_ID top_layer, bottom_layer; + via->LayerPair( &top_layer, &bottom_layer ); + rk.access = via_access_code( aPcb, top_layer, bottom_layer ); rk.x_location = via->GetPosition().x - origin.x; rk.y_location = origin.y - via->GetPosition().y; diff --git a/pcbnew/exporters/export_gencad.cpp b/pcbnew/exporters/export_gencad.cpp index c1895cbc7b..4f54a9d587 100644 --- a/pcbnew/exporters/export_gencad.cpp +++ b/pcbnew/exporters/export_gencad.cpp @@ -59,8 +59,10 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb ); static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ); static void FootprintWriteShape( FILE* File, MODULE* module ); -// layer name for Gencad export -static const wxString GenCADLayerName[32] = +// layer names for Gencad export + +#if 0 // was: +static const wxString GenCADLayerName[] = { wxT( "BOTTOM" ), wxT( "INNER1" ), wxT( "INNER2" ), wxT( "INNER3" ), wxT( "INNER4" ), wxT( "INNER5" ), @@ -93,6 +95,140 @@ static const wxString GenCADLayerNameFlipped[32] = wxT( "LAYER32" ) }; +#else + +static std::string GenCADLayerName( int aCuCount, LAYER_ID aId ) +{ + char tmp[60]; + + if( IsCopperLayer( aId ) ) + { + if( aId == F_Cu ) + return "TOP"; + else if( aId == B_Cu ) + return "BOTTON"; + + else if( aId <= 14 ) + { + int len = sprintf( tmp, "INNER%d", aCuCount - aId ); + return std::string( tmp, len ); + } + else + { + int len = sprintf( tmp, "LAYER%d", aId ); + return std::string( tmp, len ); + } + } + + else + { + const char* txt; + + // using a switch to clearly show mapping & catch out of bounds index. + switch( aId ) + { + // Technicals + case B_Adhes: txt = "B.Adhes"; break; + case F_Adhes: txt = "F.Adhes"; break; + case B_Paste: txt = "SOLDERPASTE_BOTTOM"; break; + case F_Paste: txt = "SOLDERPASTE_TOP"; break; + case B_SilkS: txt = "SILKSCREEN_BOTTOM"; break; + case F_SilkS: txt = "SILKSCREEN_TOP"; break; + case B_Mask: txt = "SOLDERMASK_BOTTOM"; break; + case F_Mask: txt = "SOLDERMASK_TOP"; break; + + // Users + case Dwgs_User: txt = "Dwgs.User"; break; + case Cmts_User: txt = "Cmts.User"; break; + case Eco1_User: txt = "Eco1.User"; break; + case Eco2_User: txt = "Eco2.User"; break; + case Edge_Cuts: txt = "Edge.Cuts"; break; + case Margin: txt = "Margin"; break; + + // Footprint + case F_CrtYd: txt = "F_CrtYd"; break; + case B_CrtYd: txt = "B_CrtYd"; break; + case F_Fab: txt = "F_Fab"; break; + case B_Fab: txt = "B_Fab"; break; + + default: + wxASSERT_MSG( 0, wxT( "aId UNEXPECTED" ) ); + txt = "BAD-INDEX!"; break; + } + + return txt; + } +}; + + +// flipped layer name for Gencad export (to make CAM350 imports correct) +static std::string GenCADLayerNameFlipped( int aCuCount, LAYER_ID aId ) +{ + char tmp[60]; + + if( IsCopperLayer( aId ) ) + { + if( aId == F_Cu ) + return "BOTTOM"; + else if( aId == B_Cu ) + return "TOP"; + + else if( aId <= 14 ) + { + int len = sprintf( tmp, "INNER%d", aId ); + return std::string( tmp, len ); + } + else + { + int len = sprintf( tmp, "LAYER%d", aId ); // this is probably wrong, need help. + return std::string( tmp, len ); + } + } + + else + { + const char* txt; + + // using a switch to clearly show mapping & catch out of bounds index. + switch( aId ) + { + // Technicals + case F_Adhes: txt = "B.Adhes"; break; + case B_Adhes: txt = "F.Adhes"; break; + case F_Paste: txt = "SOLDERPASTE_BOTTOM"; break; + case B_Paste: txt = "SOLDERPASTE_TOP"; break; + case F_SilkS: txt = "SILKSCREEN_BOTTOM"; break; + case B_SilkS: txt = "SILKSCREEN_TOP"; break; + case F_Mask: txt = "SOLDERMASK_BOTTOM"; break; + case B_Mask: txt = "SOLDERMASK_TOP"; break; + + // Users + case Dwgs_User: txt = "Dwgs.User"; break; + case Cmts_User: txt = "Cmts.User"; break; + case Eco1_User: txt = "Eco1.User"; break; + case Eco2_User: txt = "Eco2.User"; break; + case Edge_Cuts: txt = "Edge.Cuts"; break; + case Margin: txt = "Margin"; break; + + // Footprint + case B_CrtYd: txt = "F_CrtYd"; break; + case F_CrtYd: txt = "B_CrtYd"; break; + case B_Fab: txt = "F_Fab"; break; + case F_Fab: txt = "B_Fab"; break; + + default: + wxASSERT_MSG( 0, wxT( "aId UNEXPECTED" ) ); + txt = "BAD-INDEX!"; break; + } + + return txt; + } +}; + + +#endif + + // These are the export origin (the auxiliary axis) static int GencadOffsetX, GencadOffsetY; @@ -119,12 +255,12 @@ static double MapYTo( int aY ) /* Driver function: processing starts here */ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent ) { - wxFileName fn = GetBoard()->GetFileName(); - wxString msg, ext, wildcard; - FILE* file; + wxFileName fn = GetBoard()->GetFileName(); + FILE* file; + + wxString ext = wxT( "cad" ); + wxString wildcard = _( "GenCAD 1.4 board files (.cad)|*.cad" ); - ext = wxT( "cad" ); - wildcard = _( "GenCAD 1.4 board files (.cad)|*.cad" ); fn.SetExt( ext ); wxFileDialog dlg( this, _( "Save GenCAD Board File" ), wxGetCwd(), @@ -136,6 +272,8 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent ) if( ( file = wxFopen( dlg.GetPath(), wxT( "wt" ) ) ) == NULL ) { + wxString msg; + msg.Printf( _( "Unable to create <%s>" ), GetChars( dlg.GetPath() ) ); DisplayError( this, msg ); return; } @@ -161,11 +299,11 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent ) BOARD* pcb = GetBoard(); MODULE* module; - for( module = pcb->m_Modules; module != NULL; module = module->Next() ) + for( module = pcb->m_Modules; module; module = module->Next() ) { module->SetFlag( 0 ); - if( module->GetLayer() == LAYER_N_BACK ) + if( module->GetLayer() == B_Cu ) { module->Flip( module->GetPosition() ); module->SetFlag( 1 ); @@ -198,7 +336,7 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent ) SetLocaleTo_Default(); // revert to the current locale // Undo the footprints modifications (flipped footprints) - for( module = pcb->m_Modules; module != NULL; module = module->Next() ) + for( module = pcb->m_Modules; module; module = module->Next() ) { if( module->GetFlag() ) { @@ -231,8 +369,8 @@ static int ViaSort( const void* aRefptr, const void* aObjptr ) if( padref->GetDrillValue() != padcmp->GetDrillValue() ) return padref->GetDrillValue() - padcmp->GetDrillValue(); - if( padref->GetLayerMask() != padcmp->GetLayerMask() ) - return padref->GetLayerMask() - padcmp->GetLayerMask(); + if( padref->GetLayerSet() != padcmp->GetLayerSet() ) + return padref->GetLayerSet().FmtBin().compare( padcmp->GetLayerSet().FmtBin() ); return 0; } @@ -253,12 +391,14 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) { std::vector pads; std::vector padstacks; - std::vector vias; - std::vector viastacks; + std::vector vias; + std::vector viastacks; + padstacks.resize( 1 ); // We count pads from 1 // The master layermask (i.e. the enabled layers) for padstack generation - LAYER_MSK master_layermask = aPcb->GetDesignSettings().GetEnabledLayers(); + LSET master_layermask = aPcb->GetDesignSettings().GetEnabledLayers(); + int cu_count = aPcb->GetCopperLayerCount(); fputs( "$PADS\n", aFile ); @@ -271,7 +411,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) } // The same for vias - for( VIA* via = GetFirstVia( aPcb->m_Track ); via != NULL; + for( VIA* via = GetFirstVia( aPcb->m_Track ); via; via = GetFirstVia( via->Next() ) ) { vias.push_back( via ); @@ -289,9 +429,9 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) old_via = via; viastacks.push_back( via ); - fprintf( aFile, "PAD V%d.%d.%X ROUND %g\nCIRCLE 0 0 %g\n", + fprintf( aFile, "PAD V%d.%d.%s ROUND %g\nCIRCLE 0 0 %g\n", via->GetWidth(), via->GetDrillValue(), - via->GetLayerMask(), + via->GetLayerSet().FmtHex().c_str(), via->GetDrillValue() / SCALE_FACTOR, via->GetWidth() / (SCALE_FACTOR * 2) ); } @@ -299,6 +439,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) // Emit component pads D_PAD* old_pad = 0; int pad_name_number = 0; + for( unsigned i = 0; iGetLayerMask() & master_layermask; - fprintf( aFile, "PADSTACK VIA%d.%d.%X %g\n", - via->GetWidth(), via->GetDrillValue(), mask, + + LSET mask = via->GetLayerSet() & master_layermask; + + fprintf( aFile, "PADSTACK VIA%d.%d.%s %g\n", + via->GetWidth(), via->GetDrillValue(), + mask.FmtHex().c_str(), via->GetDrillValue() / SCALE_FACTOR ); - for( LAYER_NUM layer = FIRST_LAYER; layer < NB_LAYERS; ++layer ) + for( LSEQ seq = mask.Seq(); seq; ++seq ) { - if( mask & GetLayerMask( layer ) ) - { - fprintf( aFile, "PAD V%d.%d.%X %s 0 0\n", - via->GetWidth(), via->GetDrillValue(), - mask, - TO_UTF8( GenCADLayerName[layer] ) ); - } + LAYER_ID layer = *seq; + + fprintf( aFile, "PAD V%d.%d.%s %s 0 0\n", + via->GetWidth(), via->GetDrillValue(), + mask.FmtHex().c_str(), + GenCADLayerName( cu_count, layer ).c_str() + ); } } @@ -459,27 +603,25 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) D_PAD* pad = padstacks[i]; // Straight padstack - fprintf( aFile, "PADSTACK PAD%d %g\n", i, - pad->GetDrillSize().x / SCALE_FACTOR ); - for( LAYER_NUM layer = FIRST_LAYER; layer < NB_LAYERS; ++layer ) + fprintf( aFile, "PADSTACK PAD%d %g\n", i, pad->GetDrillSize().x / SCALE_FACTOR ); + + LSET pad_set = pad->GetLayerSet() & master_layermask; + + for( LSEQ seq = pad_set.Seq(); seq; ++seq ) { - if( pad->GetLayerMask() & GetLayerMask( layer ) & master_layermask ) - { - fprintf( aFile, "PAD P%d %s 0 0\n", i, - TO_UTF8( GenCADLayerName[layer] ) ); - } + LAYER_ID layer = *seq; + + fprintf( aFile, "PAD P%d %s 0 0\n", i, GenCADLayerName( cu_count, layer ).c_str() ); } // Flipped padstack - fprintf( aFile, "PADSTACK PAD%dF %g\n", i, - pad->GetDrillSize().x / SCALE_FACTOR ); - for( LAYER_NUM layer = FIRST_LAYER; layer < NB_LAYERS; ++layer ) + fprintf( aFile, "PADSTACK PAD%dF %g\n", i, pad->GetDrillSize().x / SCALE_FACTOR ); + + for( LSEQ seq = pad_set.Seq(); seq; ++seq ) { - if( pad->GetLayerMask() & GetLayerMask( layer ) & master_layermask ) - { - fprintf( aFile, "PAD P%d %s 0 0\n", i, - TO_UTF8( GenCADLayerNameFlipped[layer] ) ); - } + LAYER_ID layer = *seq; + + fprintf( aFile, "PAD P%d %s 0 0\n", i, GenCADLayerNameFlipped( cu_count, layer ).c_str() ); } } @@ -501,11 +643,13 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb ) fputs( "$SHAPES\n", aFile ); - for( module = aPcb->m_Modules; module != NULL; module = module->Next() ) + const LSET all_cu = LSET::AllCuMask(); + + for( module = aPcb->m_Modules; module; module = module->Next() ) { FootprintWriteShape( aFile, module ); - for( pad = module->Pads(); pad != NULL; pad = pad->Next() ) + for( pad = module->Pads(); pad; pad = pad->Next() ) { /* Funny thing: GenCAD requires the pad side even if you use * padstacks (which are theorically optional but gerbtools @@ -514,13 +658,13 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb ) * if the spec explicitly says it's not... */ layer = "ALL"; - if( ( pad->GetLayerMask() & ALL_CU_LAYERS ) == LAYER_BACK ) + if( ( pad->GetLayerSet() & all_cu ) == LSET( B_Cu ) ) { - layer = ( module->GetFlag() ) ? "TOP" : "BOTTOM"; + layer = module->GetFlag() ? "TOP" : "BOTTOM"; } - else if( ( pad->GetLayerMask() & ALL_CU_LAYERS ) == LAYER_FRONT ) + else if( ( pad->GetLayerSet() & all_cu ) == LSET( F_Cu ) ) { - layer = ( module->GetFlag() ) ? "BOTTOM" : "TOP"; + layer = module->GetFlag() ? "BOTTOM" : "TOP"; } pad->StringPadName( pinname ); @@ -555,7 +699,9 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb ) { fputs( "$COMPONENTS\n", aFile ); - for( MODULE* module = aPcb->m_Modules; module != NULL; module = module->Next() ) + int cu_count = aPcb->GetCopperLayerCount(); + + for( MODULE* module = aPcb->m_Modules; module; module = module->Next() ) { TEXTE_MODULE* textmod; const char* mirror; @@ -595,9 +741,8 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb ) for( int ii = 0; ii < 2; ii++ ) { - double orient = textmod->GetOrientation(); - wxString layer = GenCADLayerName[(module->GetFlag()) ? - SILKSCREEN_N_BACK : SILKSCREEN_N_FRONT]; + double orient = textmod->GetOrientation(); + std::string layer = GenCADLayerName( cu_count, module->GetFlag() ? B_SilkS : F_SilkS ); fprintf( aFile, "TEXT %g %g %g %g %s %s \"%s\"", textmod->GetPos0().x / SCALE_FACTOR, @@ -605,7 +750,7 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb ) textmod->GetSize().x / SCALE_FACTOR, orient / 10.0, mirror, - TO_UTF8( layer ), + layer.c_str(), TO_UTF8( textmod->GetText() ) ); // Please note, the width is approx @@ -655,9 +800,9 @@ static void CreateSignalsSection( FILE* aFile, BOARD* aPcb ) fputs( TO_UTF8( msg ), aFile ); fputs( "\n", aFile ); - for( module = aPcb->m_Modules; module != NULL; module = module->Next() ) + for( module = aPcb->m_Modules; module; module = module->Next() ) { - for( pad = module->Pads(); pad != NULL; pad = pad->Next() ) + for( pad = module->Pads(); pad; pad = pad->Next() ) { wxString padname; @@ -752,19 +897,21 @@ static int TrackListSortByNetcode( const void* refptr, const void* objptr ) */ static void CreateRoutesSection( FILE* aFile, BOARD* aPcb ) { - TRACK* track, ** tracklist; - int vianum = 1; - int old_netcode, old_width, old_layer; - int nbitems, ii; - LAYER_MSK master_layermask = aPcb->GetDesignSettings().GetEnabledLayers(); + TRACK* track, ** tracklist; + int vianum = 1; + int old_netcode, old_width, old_layer; + int nbitems, ii; + LSET master_layermask = aPcb->GetDesignSettings().GetEnabledLayers(); + + int cu_count = aPcb->GetCopperLayerCount(); // Count items nbitems = 0; - for( track = aPcb->m_Track; track != NULL; track = track->Next() ) + for( track = aPcb->m_Track; track; track = track->Next() ) nbitems++; - for( track = aPcb->m_Zone; track != NULL; track = track->Next() ) + for( track = aPcb->m_Zone; track; track = track->Next() ) { if( track->Type() == PCB_ZONE_T ) nbitems++; @@ -774,10 +921,10 @@ static void CreateRoutesSection( FILE* aFile, BOARD* aPcb ) nbitems = 0; - for( track = aPcb->m_Track; track != NULL; track = track->Next() ) + for( track = aPcb->m_Track; track; track = track->Next() ) tracklist[nbitems++] = track; - for( track = aPcb->m_Zone; track != NULL; track = track->Next() ) + for( track = aPcb->m_Zone; track; track = track->Next() ) { if( track->Type() == PCB_ZONE_T ) tracklist[nbitems++] = track; @@ -821,19 +968,24 @@ static void CreateRoutesSection( FILE* aFile, BOARD* aPcb ) { old_layer = track->GetLayer(); fprintf( aFile, "LAYER %s\n", - TO_UTF8( GenCADLayerName[track->GetLayer() & 0x1F] ) ); + GenCADLayerName( cu_count, track->GetLayer() ).c_str() + ); } fprintf( aFile, "LINE %g %g %g %g\n", MapXTo( track->GetStart().x ), MapYTo( track->GetStart().y ), MapXTo( track->GetEnd().x ), MapYTo( track->GetEnd().y ) ); } + if( track->Type() == PCB_VIA_T ) { - const VIA *via = static_cast(track); - fprintf( aFile, "VIA VIA%d.%d.%X %g %g ALL %g via%d\n", + const VIA* via = static_cast(track); + + LSET vset = via->GetLayerSet() & master_layermask; + + fprintf( aFile, "VIA VIA%d.%d.%s %g %g ALL %g via%d\n", via->GetWidth(), via->GetDrillValue(), - via->GetLayerMask() & master_layermask, + vset.FmtHex().c_str(), MapXTo( via->GetStart().x ), MapYTo( via->GetStart().y ), via->GetDrillValue() / SCALE_FACTOR, vianum++ ); } @@ -855,7 +1007,7 @@ static void CreateDevicesSection( FILE* aFile, BOARD* aPcb ) fputs( "$DEVICES\n", aFile ); - for( module = aPcb->m_Modules; module != NULL; module = module->Next() ) + for( module = aPcb->m_Modules; module; module = module->Next() ) { fprintf( aFile, "DEVICE \"%s\"\n", TO_UTF8( module->GetReference() ) ); fprintf( aFile, "PART \"%s\"\n", TO_UTF8( module->GetValue() ) ); @@ -892,7 +1044,7 @@ static void CreateBoardSection( FILE* aFile, BOARD* aPcb ) if( drawing->Type() == PCB_LINE_T ) { DRAWSEGMENT* drawseg = dynamic_cast( drawing ); - if( drawseg->GetLayer() == EDGE_N ) + if( drawseg->GetLayer() == Edge_Cuts ) { // XXX GenCAD supports arc boundaries but I've seen nothing that reads them fprintf( aFile, "LINE %g %g %g %g\n", @@ -928,7 +1080,7 @@ static void CreateTracksInfoData( FILE* aFile, BOARD* aPcb ) unsigned ii; - for( track = aPcb->m_Track; track != NULL; track = track->Next() ) + for( track = aPcb->m_Track; track; track = track->Next() ) { if( last_width != track->GetWidth() ) // Find a thickness already used. { @@ -945,7 +1097,7 @@ static void CreateTracksInfoData( FILE* aFile, BOARD* aPcb ) } } - for( track = aPcb->m_Zone; track != NULL; track = track->Next() ) + for( track = aPcb->m_Zone; track; track = track->Next() ) { if( last_width != track->GetWidth() ) // Find a thickness already used. { @@ -1032,7 +1184,7 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module ) // CAM350 read it right but only closed shapes // ProntoPlace double-flip it (at least the pads are correct) // GerberTool usually get it right... - for( PtStruct = module->GraphicalItems(); PtStruct != NULL; PtStruct = PtStruct->Next() ) + for( PtStruct = module->GraphicalItems(); PtStruct; PtStruct = PtStruct->Next() ) { switch( PtStruct->Type() ) { @@ -1043,8 +1195,8 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module ) case PCB_MODULE_EDGE_T: PtEdge = (EDGE_MODULE*) PtStruct; - if( PtEdge->GetLayer() == SILKSCREEN_N_FRONT - || PtEdge->GetLayer() == SILKSCREEN_N_BACK ) + if( PtEdge->GetLayer() == F_SilkS + || PtEdge->GetLayer() == B_SilkS ) { switch( PtEdge->GetShape() ) { diff --git a/pcbnew/exporters/export_idf.cpp b/pcbnew/exporters/export_idf.cpp index 64242e77d4..d77e20d573 100644 --- a/pcbnew/exporters/export_idf.cpp +++ b/pcbnew/exporters/export_idf.cpp @@ -67,7 +67,7 @@ static void idf_export_outline( BOARD* aPcb, IDF3_BOARD& aIDFBoard ) // Retrieve segments and arcs from the board for( BOARD_ITEM* item = aPcb->m_Drawings; item; item = item->Next() ) { - if( item->Type() != PCB_LINE_T || item->GetLayer() != EDGE_N ) + if( item->Type() != PCB_LINE_T || item->GetLayer() != Edge_Cuts ) continue; graphic = (DRAWSEGMENT*) item; @@ -250,7 +250,7 @@ static void idf_export_module( BOARD* aPcb, MODULE* aModule, // for( EDA_ITEM* item = aModule->GraphicalItems(); item != NULL; item = item->Next() ) // { // if( ( item->Type() != PCB_MODULE_EDGE_T ) - // || (item->GetLayer() != EDGE_N ) ) continue; + // || (item->GetLayer() != Edge_Cuts ) ) continue; // code to export cutouts // } @@ -378,7 +378,7 @@ static void idf_export_module( BOARD* aPcb, MODULE* aModule, double locz = modfile->m_MatPosition.z; double lrot = modfile->m_MatRotation.z; - bool top = ( aModule->GetLayer() == LAYER_N_BACK ) ? false : true; + bool top = ( aModule->GetLayer() == B_Cu ) ? false : true; if( top ) { @@ -481,7 +481,7 @@ static void idf_export_module( BOARD* aPcb, MODULE* aModule, ostr << "TOP"; else ostr << "BOTTOM"; - + throw( std::runtime_error( ostr.str() ) ); } } diff --git a/pcbnew/exporters/export_vrml.cpp b/pcbnew/exporters/export_vrml.cpp index 5b8de962d1..faedd362b6 100644 --- a/pcbnew/exporters/export_vrml.cpp +++ b/pcbnew/exporters/export_vrml.cpp @@ -166,12 +166,11 @@ enum VRML_COLOR_INDEX class MODEL_VRML { private: + double layer_z[LAYER_ID_COUNT]; + VRML_COLOR colors[VRML_COLOR_LAST]; - double layer_z[NB_LAYERS]; - VRML_COLOR colors[VRML_COLOR_LAST]; - - int iMaxSeg; // max. sides to a small circle - double arcMinLen, arcMaxLen; // min and max lengths of an arc chord + int iMaxSeg; // max. sides to a small circle + double arcMinLen, arcMaxLen; // min and max lengths of an arc chord public: @@ -198,7 +197,7 @@ public: MODEL_VRML() { - for( int i = 0; i < NB_LAYERS; ++i ) + for( unsigned i = 0; i < DIM( layer_z ); ++i ) layer_z[i] = 0; holes.GetArcParams( iMaxSeg, arcMinLen, arcMaxLen ); @@ -235,7 +234,7 @@ public: double GetLayerZ( LAYER_NUM aLayer ) { - if( aLayer >= NB_LAYERS ) + if( unsigned( aLayer ) >= DIM( layer_z ) ) return 0; return layer_z[ aLayer ]; @@ -294,19 +293,19 @@ static bool GetLayer( MODEL_VRML& aModel, LAYER_NUM layer, VRML_LAYER** vlayer ) { switch( layer ) { - case FIRST_COPPER_LAYER: + case B_Cu: *vlayer = &aModel.bot_copper; break; - case LAST_COPPER_LAYER: + case F_Cu: *vlayer = &aModel.top_copper; break; - case SILKSCREEN_N_BACK: + case B_SilkS: *vlayer = &aModel.bot_silk; break; - case SILKSCREEN_N_FRONT: + case F_SilkS: *vlayer = &aModel.top_silk; break; @@ -431,13 +430,13 @@ static void write_layers( MODEL_VRML& aModel, std::ofstream& output_file, BOARD* aModel.top_copper.Tesselate( &aModel.holes ); write_triangle_bag( output_file, aModel.GetColor( VRML_COLOR_TRACK ), &aModel.top_copper, true, true, - aModel.GetLayerZ( LAST_COPPER_LAYER ), 0, aModel.precision ); + aModel.GetLayerZ( F_Cu ), 0, aModel.precision ); // VRML_LAYER top_tin; aModel.top_tin.Tesselate( &aModel.holes ); write_triangle_bag( output_file, aModel.GetColor( VRML_COLOR_TIN ), &aModel.top_tin, true, true, - aModel.GetLayerZ( LAST_COPPER_LAYER ) + aModel.GetLayerZ( F_Cu ) + Millimeter2iu( ART_OFFSET / 2.0 ) * aModel.scale, 0, aModel.precision ); @@ -445,13 +444,13 @@ static void write_layers( MODEL_VRML& aModel, std::ofstream& output_file, BOARD* aModel.bot_copper.Tesselate( &aModel.holes ); write_triangle_bag( output_file, aModel.GetColor( VRML_COLOR_TRACK ), &aModel.bot_copper, true, false, - aModel.GetLayerZ( FIRST_COPPER_LAYER ), 0, aModel.precision ); + aModel.GetLayerZ( B_Cu ), 0, aModel.precision ); // VRML_LAYER bot_tin; aModel.bot_tin.Tesselate( &aModel.holes ); write_triangle_bag( output_file, aModel.GetColor( VRML_COLOR_TIN ), &aModel.bot_tin, true, false, - aModel.GetLayerZ( FIRST_COPPER_LAYER ) + aModel.GetLayerZ( B_Cu ) - Millimeter2iu( ART_OFFSET / 2.0 ) * aModel.scale, 0, aModel.precision ); @@ -459,13 +458,13 @@ static void write_layers( MODEL_VRML& aModel, std::ofstream& output_file, BOARD* aModel.top_silk.Tesselate( &aModel.holes ); write_triangle_bag( output_file, aModel.GetColor( VRML_COLOR_SILK ), &aModel.top_silk, true, true, - aModel.GetLayerZ( SILKSCREEN_N_FRONT ), 0, aModel.precision ); + aModel.GetLayerZ( F_SilkS ), 0, aModel.precision ); // VRML_LAYER bot_silk; aModel.bot_silk.Tesselate( &aModel.holes ); write_triangle_bag( output_file, aModel.GetColor( VRML_COLOR_SILK ), &aModel.bot_silk, true, false, - aModel.GetLayerZ( SILKSCREEN_N_BACK ), 0, aModel.precision ); + aModel.GetLayerZ( B_SilkS ), 0, aModel.precision ); } @@ -478,8 +477,10 @@ static void compute_layer_Zs( MODEL_VRML& aModel, BOARD* pcb ) double half_thickness = aModel.board_thickness / 2; // Compute each layer's Z value, more or less like the 3d view - for( LAYER_NUM i = FIRST_LAYER; i <= LAYER_N_FRONT; ++i ) + for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq ) { + LAYER_ID i = *seq; + if( i < copper_layers ) aModel.SetLayerZ( i, aModel.board_thickness * i / (copper_layers - 1) - half_thickness ); else @@ -489,19 +490,19 @@ static void compute_layer_Zs( MODEL_VRML& aModel, BOARD* pcb ) /* To avoid rounding interference, we apply an epsilon to each * successive layer */ double epsilon_z = Millimeter2iu( ART_OFFSET ) * aModel.scale; - aModel.SetLayerZ( SOLDERPASTE_N_BACK, -half_thickness - epsilon_z * 4 ); - aModel.SetLayerZ( ADHESIVE_N_BACK, -half_thickness - epsilon_z * 3 ); - aModel.SetLayerZ( SILKSCREEN_N_BACK, -half_thickness - epsilon_z * 2 ); - aModel.SetLayerZ( SOLDERMASK_N_BACK, -half_thickness - epsilon_z ); - aModel.SetLayerZ( SOLDERMASK_N_FRONT, half_thickness + epsilon_z ); - aModel.SetLayerZ( SILKSCREEN_N_FRONT, half_thickness + epsilon_z * 2 ); - aModel.SetLayerZ( ADHESIVE_N_FRONT, half_thickness + epsilon_z * 3 ); - aModel.SetLayerZ( SOLDERPASTE_N_FRONT, half_thickness + epsilon_z * 4 ); - aModel.SetLayerZ( DRAW_N, half_thickness + epsilon_z * 5 ); - aModel.SetLayerZ( COMMENT_N, half_thickness + epsilon_z * 6 ); - aModel.SetLayerZ( ECO1_N, half_thickness + epsilon_z * 7 ); - aModel.SetLayerZ( ECO2_N, half_thickness + epsilon_z * 8 ); - aModel.SetLayerZ( EDGE_N, 0 ); + aModel.SetLayerZ( B_Paste, -half_thickness - epsilon_z * 4 ); + aModel.SetLayerZ( B_Adhes, -half_thickness - epsilon_z * 3 ); + aModel.SetLayerZ( B_SilkS, -half_thickness - epsilon_z * 2 ); + aModel.SetLayerZ( B_Mask, -half_thickness - epsilon_z ); + aModel.SetLayerZ( F_Mask, half_thickness + epsilon_z ); + aModel.SetLayerZ( F_SilkS, half_thickness + epsilon_z * 2 ); + aModel.SetLayerZ( F_Adhes, half_thickness + epsilon_z * 3 ); + aModel.SetLayerZ( F_Paste, half_thickness + epsilon_z * 4 ); + aModel.SetLayerZ( Dwgs_User, half_thickness + epsilon_z * 5 ); + aModel.SetLayerZ( Cmts_User, half_thickness + epsilon_z * 6 ); + aModel.SetLayerZ( Eco1_User, half_thickness + epsilon_z * 7 ); + aModel.SetLayerZ( Eco2_User, half_thickness + epsilon_z * 8 ); + aModel.SetLayerZ( Edge_Cuts, 0 ); } @@ -594,7 +595,7 @@ static void export_vrml_drawsegment( MODEL_VRML& aModel, DRAWSEGMENT* drawseg ) double yf = drawseg->GetEnd().y * aModel.scale + aModel.ty; // Items on the edge layer are handled elsewhere; just return - if( layer == EDGE_N ) + if( layer == Edge_Cuts ) return; switch( drawseg->GetShape() ) @@ -685,10 +686,9 @@ static void export_vrml_drawings( MODEL_VRML& aModel, BOARD* pcb ) // draw graphic items for( EDA_ITEM* drawing = pcb->m_Drawings; drawing != 0; drawing = drawing->Next() ) { - LAYER_NUM layer = ( (DRAWSEGMENT*) drawing )->GetLayer(); + LAYER_ID layer = ( (DRAWSEGMENT*) drawing )->GetLayer(); - if( layer != FIRST_COPPER_LAYER && layer != LAST_COPPER_LAYER - && layer != SILKSCREEN_N_BACK && layer != SILKSCREEN_N_FRONT ) + if( layer != F_Cu && layer != B_Cu && layer != B_SilkS && layer != F_SilkS ) continue; switch( drawing->Type() ) @@ -805,11 +805,11 @@ static void export_round_padstack( MODEL_VRML& aModel, BOARD* pcb, LAYER_NUM bottom_layer, LAYER_NUM top_layer, double hole ) { - LAYER_NUM layer = top_layer; - bool thru = true; + LAYER_NUM layer = top_layer; + bool thru = true; // if not a thru hole do not put a hole in the board - if( top_layer != LAST_COPPER_LAYER || bottom_layer != FIRST_COPPER_LAYER ) + if( top_layer != F_Cu || bottom_layer != B_Cu ) thru = false; if( thru && hole > 0 ) @@ -817,7 +817,7 @@ static void export_round_padstack( MODEL_VRML& aModel, BOARD* pcb, while( 1 ) { - if( layer == FIRST_COPPER_LAYER ) + if( layer == B_Cu ) { aModel.bot_copper.AddCircle( x, -y, r ); @@ -825,7 +825,7 @@ static void export_round_padstack( MODEL_VRML& aModel, BOARD* pcb, aModel.bot_copper.AddCircle( x, -y, hole, true ); } - else if( layer == LAST_COPPER_LAYER ) + else if( layer == F_Cu ) { aModel.top_copper.AddCircle( x, -y, r ); @@ -844,8 +844,8 @@ static void export_round_padstack( MODEL_VRML& aModel, BOARD* pcb, static void export_vrml_via( MODEL_VRML& aModel, BOARD* pcb, const VIA* via ) { - double x, y, r, hole; - LAYER_NUM top_layer, bottom_layer; + double x, y, r, hole; + LAYER_ID top_layer, bottom_layer; hole = via->GetDrillValue() * aModel.scale / 2.0; r = via->GetWidth() * aModel.scale / 2.0; @@ -854,7 +854,7 @@ static void export_vrml_via( MODEL_VRML& aModel, BOARD* pcb, const VIA* via ) via->LayerPair( &top_layer, &bottom_layer ); // do not render a buried via - if( top_layer != LAST_COPPER_LAYER && bottom_layer != FIRST_COPPER_LAYER ) + if( top_layer != F_Cu && bottom_layer != B_Cu ) return; // Export the via padstack @@ -864,14 +864,13 @@ static void export_vrml_via( MODEL_VRML& aModel, BOARD* pcb, const VIA* via ) static void export_vrml_tracks( MODEL_VRML& aModel, BOARD* pcb ) { - for( TRACK* track = pcb->m_Track; track != NULL; track = track->Next() ) + for( TRACK* track = pcb->m_Track; track; track = track->Next() ) { if( track->Type() == PCB_VIA_T ) { export_vrml_via( aModel, pcb, (const VIA*) track ); } - else if( track->GetLayer() == FIRST_COPPER_LAYER - || track->GetLayer() == LAST_COPPER_LAYER ) + else if( track->GetLayer() == B_Cu || track->GetLayer() == F_Cu ) export_vrml_line( aModel, track->GetLayer(), track->GetStart().x * aModel.scale + aModel.tx, track->GetStart().y * aModel.scale + aModel.ty, @@ -1141,14 +1140,14 @@ static void export_vrml_pad( MODEL_VRML& aModel, BOARD* pcb, D_PAD* aPad ) } // The pad proper, on the selected layers - LAYER_MSK layer_mask = aPad->GetLayerMask(); + LSET layer_mask = aPad->GetLayerSet(); - if( layer_mask & LAYER_BACK ) + if( layer_mask[B_Cu] ) { export_vrml_padshape( aModel, &aModel.bot_tin, aPad ); } - if( layer_mask & LAYER_FRONT ) + if( layer_mask[F_Cu] ) { export_vrml_padshape( aModel, &aModel.top_tin, aPad ); } @@ -1209,7 +1208,7 @@ static void export_vrml_module( MODEL_VRML& aModel, BOARD* aPcb, MODULE* aModule export_vrml_text_module( &aModule->Value() ); // Export module edges - for( EDA_ITEM* item = aModule->GraphicalItems(); item != NULL; item = item->Next() ) + for( EDA_ITEM* item = aModule->GraphicalItems(); item; item = item->Next() ) { switch( item->Type() ) { @@ -1231,7 +1230,7 @@ static void export_vrml_module( MODEL_VRML& aModel, BOARD* aPcb, MODULE* aModule for( D_PAD* pad = aModule->Pads(); pad; pad = pad->Next() ) export_vrml_pad( aModel, aPcb, pad ); - bool isFlipped = aModule->GetLayer() == LAYER_N_BACK; + bool isFlipped = aModule->GetLayer() == B_Cu; // Export the object VRML model(s) for( S3D_MASTER* vrmlm = aModule->Models(); vrmlm; vrmlm = vrmlm->Next() ) diff --git a/pcbnew/exporters/gen_drill_report_files.cpp b/pcbnew/exporters/gen_drill_report_files.cpp index c378353e11..6c5ddb9dc9 100644 --- a/pcbnew/exporters/gen_drill_report_files.cpp +++ b/pcbnew/exporters/gen_drill_report_files.cpp @@ -168,7 +168,7 @@ bool EXCELLON_WRITER::GenDrillMapFile( const wxString& aFullFileName, // Draw items on edge layer (not all, only items useful for drill map BRDITEMS_PLOTTER itemplotter( plotter, m_pcb, plot_opts ); - itemplotter.SetLayerMask( EDGE_LAYER ); + itemplotter.SetLayerSet( Edge_Cuts ); for( EDA_ITEM* PtStruct = m_pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() ) { @@ -283,8 +283,8 @@ bool EXCELLON_WRITER::GenDrillReportFile( const wxString& aFullFileName ) { unsigned totalHoleCount; char line[1024]; - LAYER_NUM layer1 = LAYER_N_BACK; - LAYER_NUM layer2 = LAYER_N_FRONT; + LAYER_NUM layer1 = B_Cu; + LAYER_NUM layer2 = F_Cu; bool gen_through_holes = true; bool gen_NPTH_holes = false; @@ -317,12 +317,12 @@ bool EXCELLON_WRITER::GenDrillReportFile( const wxString& aFullFileName ) else { // If this is the first partial hole list: print a title - if( layer1 == LAYER_N_BACK ) + if( layer1 == B_Cu ) fputs( "Drill report for buried and blind vias :\n\n", m_file ); sprintf( line, "Drill report for holes from layer %s to layer %s :\n", - TO_UTF8( m_pcb->GetLayerName( layer1 ) ), - TO_UTF8( m_pcb->GetLayerName( layer2 ) ) ); + TO_UTF8( m_pcb->GetLayerName( (LAYER_ID) layer1 ) ), + TO_UTF8( m_pcb->GetLayerName( (LAYER_ID) layer2 ) ) ); } fputs( line, m_file ); @@ -378,22 +378,23 @@ bool EXCELLON_WRITER::GenDrillReportFile( const wxString& aFullFileName ) continue; } - if( gen_through_holes ) + if( gen_through_holes ) { layer2 = layer1 + 1; } else { - if( layer2 >= LAYER_N_FRONT ) // no more layer pair to consider + if( layer2 >= F_Cu ) // no more layer pair to consider { gen_NPTH_holes = true; continue; } - ++layer1; ++layer2; // use next layer pair + ++layer1; + ++layer2; // use next layer pair if( layer2 == m_pcb->GetCopperLayerCount() - 1 ) - layer2 = LAYER_N_FRONT; // the last layer is always the + layer2 = F_Cu; // the last layer is always the // component layer } diff --git a/pcbnew/exporters/gen_modules_placefile.cpp b/pcbnew/exporters/gen_modules_placefile.cpp index 4507d65394..fd9cdebab3 100644 --- a/pcbnew/exporters/gen_modules_placefile.cpp +++ b/pcbnew/exporters/gen_modules_placefile.cpp @@ -57,7 +57,7 @@ public: MODULE* m_Module; // Link to the actual footprint wxString m_Reference; // Its schematic reference wxString m_Value; // Its schematic value - LAYER_NUM m_Layer; // its side (LAYER_N_BACK, or LAYER_N_FRONT) + LAYER_NUM m_Layer; // its side (B_Cu, or F_Cu) }; @@ -211,8 +211,8 @@ bool DIALOG_GEN_MODULE_POSITION::CreateFiles() fn = m_parent->GetBoard()->GetFileName(); fn.SetPath( GetOutputDirectory() ); - frontLayerName = brd->GetLayerName( LAYER_N_FRONT ); - backLayerName = brd->GetLayerName( LAYER_N_BACK ); + frontLayerName = brd->GetLayerName( F_Cu ); + backLayerName = brd->GetLayerName( B_Cu ); // Create the the Front or Top side placement file, // or the single file @@ -374,9 +374,9 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName, { if( aSide < 2 ) { - if( module->GetLayer() == LAYER_N_BACK && aSide == 1) + if( module->GetLayer() == B_Cu && aSide == 1) continue; - if( module->GetLayer() == LAYER_N_FRONT && aSide == 0) + if( module->GetLayer() == F_Cu && aSide == 0) continue; } @@ -429,9 +429,9 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName, { if( aSide < 2 ) { - if( module->GetLayer() == LAYER_N_BACK && aSide == 1) + if( module->GetLayer() == B_Cu && aSide == 1) continue; - if( module->GetLayer() == LAYER_N_FRONT && aSide == 0) + if( module->GetLayer() == F_Cu && aSide == 0) continue; } @@ -452,8 +452,8 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName, if( list.size() > 1 ) sort( list.begin(), list.end(), sortFPlist ); - wxString frontLayerName = GetBoard()->GetLayerName( LAYER_N_FRONT ); - wxString backLayerName = GetBoard()->GetLayerName( LAYER_N_BACK ); + wxString frontLayerName = GetBoard()->GetLayerName( F_Cu ); + wxString backLayerName = GetBoard()->GetLayerName( B_Cu ); // Switch the locale to standard C (needed to print floating point numbers) LOCALE_IO toggle; @@ -500,15 +500,15 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName, LAYER_NUM layer = list[ii].m_Module->GetLayer(); - wxASSERT( layer==LAYER_N_FRONT || layer==LAYER_N_BACK ); + wxASSERT( layer==F_Cu || layer==B_Cu ); - if( layer == LAYER_N_FRONT ) + if( layer == F_Cu ) { strcat( line, TO_UTF8( frontLayerName ) ); strcat( line, "\n" ); fputs( line, file ); } - else if( layer == LAYER_N_BACK ) + else if( layer == B_Cu ) { strcat( line, TO_UTF8( backLayerName ) ); strcat( line, "\n" ); @@ -654,9 +654,9 @@ bool PCB_EDIT_FRAME::DoGenFootprintsReport( const wxString& aFullFilename, bool sprintf( line, "orientation %.2f\n", Module->GetOrientation() / 10.0 ); - if( Module->GetLayer() == LAYER_N_FRONT ) + if( Module->GetLayer() == F_Cu ) strcat( line, "layer component\n" ); - else if( Module->GetLayer() == LAYER_N_BACK ) + else if( Module->GetLayer() == B_Cu ) strcat( line, "layer copper\n" ); else strcat( line, "layer other\n" ); @@ -697,10 +697,10 @@ bool PCB_EDIT_FRAME::DoGenFootprintsReport( const wxString& aFullFilename, bool int layer = 0; - if( pad->GetLayerMask() & LAYER_BACK ) + if( pad->GetLayerSet()[B_Cu] ) layer = 1; - if( pad->GetLayerMask() & LAYER_FRONT ) + if( pad->GetLayerSet()[F_Cu] ) layer |= 2; static const char* layer_name[4] = { "none", "back", "front", "both" }; @@ -726,7 +726,7 @@ bool PCB_EDIT_FRAME::DoGenFootprintsReport( const wxString& aFullFilename, bool if( PtStruct->Type() != PCB_LINE_T ) continue; - if( ( (DRAWSEGMENT*) PtStruct )->GetLayer() != EDGE_N ) + if( ( (DRAWSEGMENT*) PtStruct )->GetLayer() != Edge_Cuts ) continue; WriteDrawSegmentPcb( (DRAWSEGMENT*) PtStruct, rptfile, conv_unit ); diff --git a/pcbnew/exporters/gendrill_Excellon_writer.cpp b/pcbnew/exporters/gendrill_Excellon_writer.cpp index 679df5bed1..2e73c915b8 100644 --- a/pcbnew/exporters/gendrill_Excellon_writer.cpp +++ b/pcbnew/exporters/gendrill_Excellon_writer.cpp @@ -453,8 +453,7 @@ void EXCELLON_WRITER::BuildHolesList( int aFirstLayer, // build hole list for vias if( ! aGenerateNPTH_list ) // vias are always plated ! { - for( VIA* via = GetFirstVia( m_pcb->m_Track ); via; - via = GetFirstVia( via->Next() ) ) + for( VIA* via = GetFirstVia( m_pcb->m_Track ); via; via = GetFirstVia( via->Next() ) ) { hole_value = via->GetDrillValue(); @@ -468,6 +467,7 @@ void EXCELLON_WRITER::BuildHolesList( int aFirstLayer, new_hole.m_Hole_Shape = 0; // hole shape: round new_hole.m_Hole_Pos = via->GetStart(); + via->LayerPair( &new_hole.m_Hole_Top_Layer, &new_hole.m_Hole_Bottom_Layer ); // LayerPair return params with m_Hole_Bottom_Layer < m_Hole_Top_Layer @@ -477,8 +477,8 @@ void EXCELLON_WRITER::BuildHolesList( int aFirstLayer, if( (new_hole.m_Hole_Top_Layer < aLastLayer) && (aLastLayer >= 0) ) continue; - if( aExcludeThroughHoles && (new_hole.m_Hole_Bottom_Layer == LAYER_N_BACK) - && (new_hole.m_Hole_Top_Layer == LAYER_N_FRONT) ) + if( aExcludeThroughHoles && (new_hole.m_Hole_Bottom_Layer == B_Cu) + && (new_hole.m_Hole_Top_Layer == F_Cu) ) continue; m_holeListBuffer.push_back( new_hole ); @@ -514,8 +514,8 @@ void EXCELLON_WRITER::BuildHolesList( int aFirstLayer, new_hole.m_Hole_Size = pad->GetDrillSize(); new_hole.m_Hole_Pos = pad->GetPosition(); // hole position - new_hole.m_Hole_Bottom_Layer = LAYER_N_BACK; - new_hole.m_Hole_Top_Layer = LAYER_N_FRONT;// pad holes are through holes + new_hole.m_Hole_Bottom_Layer = B_Cu; + new_hole.m_Hole_Top_Layer = F_Cu;// pad holes are through holes m_holeListBuffer.push_back( new_hole ); } } diff --git a/pcbnew/exporters/gendrill_Excellon_writer.h b/pcbnew/exporters/gendrill_Excellon_writer.h index d198187711..ff2901975f 100644 --- a/pcbnew/exporters/gendrill_Excellon_writer.h +++ b/pcbnew/exporters/gendrill_Excellon_writer.h @@ -64,16 +64,16 @@ public: class HOLE_INFO { public: - int m_Hole_Diameter; // hole value, and for oblong: min(hole size x, hole size y) - int m_Tool_Reference; // Tool reference for this hole = 1 ... n (values <=0 must not be used) - wxSize m_Hole_Size; // hole size for oblong holes - double m_Hole_Orient; // Hole rotation (= pad rotation) for oblong holes - int m_Hole_Shape; // hole shape: round (0) or oval (1) - wxPoint m_Hole_Pos; // hole position - LAYER_NUM m_Hole_Bottom_Layer; // hole starting layer (usually back layer) - LAYER_NUM m_Hole_Top_Layer; // hole ending layer (usually front layer): - // m_Hole_First_Layer < m_Hole_Last_Layer - bool m_Hole_NotPlated; // hole not plated. Must be in a specific drill file + int m_Hole_Diameter; // hole value, and for oblong: min(hole size x, hole size y) + int m_Tool_Reference; // Tool reference for this hole = 1 ... n (values <=0 must not be used) + wxSize m_Hole_Size; // hole size for oblong holes + double m_Hole_Orient; // Hole rotation (= pad rotation) for oblong holes + int m_Hole_Shape; // hole shape: round (0) or oval (1) + wxPoint m_Hole_Pos; // hole position + LAYER_ID m_Hole_Bottom_Layer; // hole starting layer (usually back layer) + LAYER_ID m_Hole_Top_Layer; // hole ending layer (usually front layer): + // m_Hole_First_Layer < m_Hole_Last_Layer + bool m_Hole_NotPlated; // hole not plated. Must be in a specific drill file public: HOLE_INFO() diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index 4677983e31..b5693e0e6b 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -556,8 +556,9 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF if( aFileName == wxEmptyString ) { wxString wildcard; - wildcard << wxGetTranslation( PcbFileWildcard ) << wxChar( '|' ) << - wxGetTranslation( LegacyPcbFileWildcard ); + wildcard << wxGetTranslation( PcbFileWildcard ) + // << wxChar( '|' ) << wxGetTranslation( LegacyPcbFileWildcard ) + ; isSaveAs = true; pcbFileName = GetBoard()->GetFileName(); @@ -583,9 +584,13 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF if( dlg.ShowModal() != wxID_OK ) return false; +#if 0 // no more LEGACY_PLUGIN::Save() int filterNdx = dlg.GetFilterIndex(); pluginType = ( filterNdx == 1 ) ? IO_MGR::LEGACY : IO_MGR::KICAD; +#else + pluginType = IO_MGR::KICAD; +#endif // Note: on Linux wxFileDialog is not reliable for noticing a changed filename. // We probably need to file a bug report or implement our own derivation. diff --git a/pcbnew/globaleditpad.cpp b/pcbnew/globaleditpad.cpp index 01719f9ff4..7e0b895135 100644 --- a/pcbnew/globaleditpad.cpp +++ b/pcbnew/globaleditpad.cpp @@ -257,7 +257,7 @@ void PCB_BASE_FRAME::GlobalChange_PadSettings( D_PAD* aPad, if( aPadOrientFilter && ( currpad_orient != pad_orient ) ) continue; - if( aPadLayerFilter && pad->GetLayerMask() != aPad->GetLayerMask() ) + if( aPadLayerFilter && pad->GetLayerSet() != aPad->GetLayerSet() ) continue; saveMe = true; @@ -302,7 +302,7 @@ void PCB_BASE_FRAME::GlobalChange_PadSettings( D_PAD* aPad, if( aPadLayerFilter ) { - if( pad->GetLayerMask() != aPad->GetLayerMask() ) + if( pad->GetLayerSet() != aPad->GetLayerSet() ) continue; else m_Pcb->m_Status_Pcb &= ~( LISTE_RATSNEST_ITEM_OK | CONNEXION_OK); @@ -312,7 +312,7 @@ void PCB_BASE_FRAME::GlobalChange_PadSettings( D_PAD* aPad, pad->SetAttribute( aPad->GetAttribute() ); pad->SetShape( aPad->GetShape() ); - pad->SetLayerMask( aPad->GetLayerMask() ); + pad->SetLayerSet( aPad->GetLayerSet() ); pad->SetSize( aPad->GetSize() ); pad->SetDelta( aPad->GetDelta() ); diff --git a/pcbnew/gpcb_plugin.cpp b/pcbnew/gpcb_plugin.cpp index 1f207eaaa6..def86f32ff 100644 --- a/pcbnew/gpcb_plugin.cpp +++ b/pcbnew/gpcb_plugin.cpp @@ -505,7 +505,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader ) throw( IO_ERROR, } EDGE_MODULE* drawSeg = new EDGE_MODULE( module.get() ); - drawSeg->SetLayer( SILKSCREEN_N_FRONT ); + drawSeg->SetLayer( F_SilkS ); drawSeg->SetShape( S_SEGMENT ); drawSeg->SetStart0( wxPoint( parseInt( parameters[2], conv_unit ), parseInt( parameters[3], conv_unit ) ) ); @@ -529,7 +529,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader ) throw( IO_ERROR, // Pcbnew does know ellipse so we must have Width = Height EDGE_MODULE* drawSeg = new EDGE_MODULE( module.get() ); - drawSeg->SetLayer( SILKSCREEN_N_FRONT ); + drawSeg->SetLayer( F_SilkS ); drawSeg->SetShape( S_ARC ); module->GraphicalItems().PushBack( drawSeg ); @@ -580,12 +580,16 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader ) throw( IO_ERROR, } D_PAD* pad = new D_PAD( module.get() ); + + static const LSET pad_front( 3, F_Cu, F_Mask, F_Paste ); + static const LSET pad_back( 3, B_Cu, B_Mask, B_Paste ); + pad->SetShape( PAD_RECT ); pad->SetAttribute( PAD_SMD ); - pad->SetLayerMask( LAYER_FRONT | SOLDERMASK_LAYER_FRONT | SOLDERPASTE_LAYER_FRONT ); + pad->SetLayerSet( pad_front ); if( testFlags( parameters[paramCnt-2], 0x0080, wxT( "onsolder" ) ) ) - pad->SetLayerMask( LAYER_BACK | SOLDERMASK_LAYER_BACK | SOLDERPASTE_LAYER_BACK ); + pad->SetLayerSet( pad_back ); // Read pad number: if( paramCnt > 10 ) @@ -653,11 +657,12 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader ) throw( IO_ERROR, } D_PAD* pad = new D_PAD( module.get() ); + pad->SetShape( PAD_ROUND ); - pad->SetLayerMask( ALL_CU_LAYERS | - SILKSCREEN_LAYER_FRONT | - SOLDERMASK_LAYER_FRONT | - SOLDERMASK_LAYER_BACK ); + + static const LSET pad_set = LSET::AllCuMask() | LSET( 3, F_SilkS, F_Mask, B_Mask ); + + pad->SetLayerSet( pad_set ); if( testFlags( parameters[paramCnt-2], 0x0100, wxT( "square" ) ) ) pad->SetShape( PAD_RECT ); diff --git a/pcbnew/hotkeys_board_editor.cpp b/pcbnew/hotkeys_board_editor.cpp index 1cffe09577..cde7e7820e 100644 --- a/pcbnew/hotkeys_board_editor.cpp +++ b/pcbnew/hotkeys_board_editor.cpp @@ -151,7 +151,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); cmd.SetEventObject( this ); - LAYER_NUM ll; + LAYER_NUM ll; switch( hk_id ) { @@ -242,65 +242,63 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit case HK_SWITCH_LAYER_TO_PREVIOUS: ll = GetActiveLayer(); - if( (ll <= LAYER_N_BACK) || (ll > LAYER_N_FRONT) ) + if( !IsCopperLayer( ll ) ) break; - if( GetBoard()->GetCopperLayerCount() < 2 ) // Single layer - ll = LAYER_N_BACK; - else if( ll == LAYER_N_FRONT ) - ll = std::max( LAYER_N_BACK, FIRST_COPPER_LAYER + GetBoard()->GetCopperLayerCount() - 2 ); + if( ll == F_Cu ) + ll = B_Cu; + else if( ll == B_Cu ) + ll = (LAYER_ID) GetBoard()->GetCopperLayerCount() - 2; else - --ll; + ll = ll - 1; - SwitchLayer( aDC, ll ); + SwitchLayer( aDC, (LAYER_ID) ll ); break; case HK_SWITCH_LAYER_TO_NEXT: ll = GetActiveLayer(); - if( (ll < LAYER_N_BACK) || (ll >= LAYER_N_FRONT) ) + if( !IsCopperLayer( ll ) ) break; - if( GetBoard()->GetCopperLayerCount() < 2 ) // Single layer - ll = LAYER_N_BACK; - else if( ll >= GetBoard()->GetCopperLayerCount() - 2 ) - ll = LAYER_N_FRONT; - else - ++ll; + if( ll == B_Cu ) + ll = F_Cu; + else if( ++ll >= GetBoard()->GetCopperLayerCount() - 1 ) + ll = B_Cu; - SwitchLayer( aDC, ll ); + SwitchLayer( aDC, (LAYER_ID) ll ); break; case HK_SWITCH_LAYER_TO_COMPONENT: - SwitchLayer( aDC, LAYER_N_FRONT ); + SwitchLayer( aDC, F_Cu ); break; case HK_SWITCH_LAYER_TO_COPPER: - SwitchLayer( aDC, LAYER_N_BACK ); + SwitchLayer( aDC, B_Cu ); break; case HK_SWITCH_LAYER_TO_INNER1: - SwitchLayer( aDC, LAYER_N_2 ); + SwitchLayer( aDC, In1_Cu ); break; case HK_SWITCH_LAYER_TO_INNER2: - SwitchLayer( aDC, LAYER_N_3 ); + SwitchLayer( aDC, In2_Cu ); break; case HK_SWITCH_LAYER_TO_INNER3: - SwitchLayer( aDC, LAYER_N_4 ); + SwitchLayer( aDC, In3_Cu ); break; case HK_SWITCH_LAYER_TO_INNER4: - SwitchLayer( aDC, LAYER_N_5 ); + SwitchLayer( aDC, In4_Cu ); break; case HK_SWITCH_LAYER_TO_INNER5: - SwitchLayer( aDC, LAYER_N_6 ); + SwitchLayer( aDC, In5_Cu ); break; case HK_SWITCH_LAYER_TO_INNER6: - SwitchLayer( aDC, LAYER_N_7 ); + SwitchLayer( aDC, In6_Cu ); break; case HK_HELP: // Display Current hotkey list @@ -588,7 +586,7 @@ bool PCB_EDIT_FRAME::OnHotkeyDeleteItem( wxDC* aDC ) switch( GetToolId() ) { case ID_TRACK_BUTT: - if( GetActiveLayer() > LAYER_N_FRONT ) + if( GetActiveLayer() > F_Cu ) return false; if( ItemFree ) @@ -949,7 +947,7 @@ bool PCB_EDIT_FRAME::OnHotkeyPlaceItem( wxDC* aDC ) TRACK * PCB_EDIT_FRAME::OnHotkeyBeginRoute( wxDC* aDC ) { - if( GetActiveLayer() > LAYER_N_FRONT ) + if( GetActiveLayer() > F_Cu ) return NULL; bool itemCurrentlyEdited = (GetCurItem() && GetCurItem()->GetFlags()); diff --git a/pcbnew/import_dxf/dialog_dxf_import.cpp b/pcbnew/import_dxf/dialog_dxf_import.cpp index aaeeba403a..f442b9a352 100644 --- a/pcbnew/import_dxf/dialog_dxf_import.cpp +++ b/pcbnew/import_dxf/dialog_dxf_import.cpp @@ -67,18 +67,18 @@ private: // the user's choices during the session wxString DIALOG_DXF_IMPORT::m_dxfFilename; int DIALOG_DXF_IMPORT::m_offsetSelection = 4; -LAYER_NUM DIALOG_DXF_IMPORT::m_layer = DRAW_N; +LAYER_NUM DIALOG_DXF_IMPORT::m_layer = Dwgs_User; -DIALOG_DXF_IMPORT::DIALOG_DXF_IMPORT( PCB_EDIT_FRAME* aParent ) - : DIALOG_DXF_IMPORT_BASE( aParent ) +DIALOG_DXF_IMPORT::DIALOG_DXF_IMPORT( PCB_EDIT_FRAME* aParent ) : + DIALOG_DXF_IMPORT_BASE( aParent ) { m_parent = aParent; m_config = Kiface().KifaceSettings(); if( m_config ) { - m_layer = m_config->Read( DXF_IMPORT_LAYER_OPTION_KEY, (long)DRAW_N ); + m_layer = m_config->Read( DXF_IMPORT_LAYER_OPTION_KEY, (long)Dwgs_User ); m_offsetSelection = m_config->Read( DXF_IMPORT_COORD_ORIGIN_KEY, 3 ); m_dxfFilename = m_config->Read( DXF_IMPORT_LAST_FILE_KEY, wxEmptyString ); } @@ -87,14 +87,14 @@ DIALOG_DXF_IMPORT::DIALOG_DXF_IMPORT( PCB_EDIT_FRAME* aParent ) m_rbOffsetOption->SetSelection( m_offsetSelection ); // Configure the layers list selector - m_SelLayerBox->SetLayersHotkeys( false ); // Do not display hotkeys - m_SelLayerBox->SetLayerMask( ALL_CU_LAYERS ); // Do not use copper layers + m_SelLayerBox->SetLayersHotkeys( false ); // Do not display hotkeys + m_SelLayerBox->SetLayerSet( LSET::AllCuMask() ); // Do not use copper layers m_SelLayerBox->SetBoardFrame( m_parent ); m_SelLayerBox->Resync(); if( m_SelLayerBox->SetLayerSelection( m_layer ) < 0 ) { - m_layer = DRAW_N; + m_layer = Dwgs_User; m_SelLayerBox->SetLayerSelection( m_layer ); } diff --git a/pcbnew/import_dxf/dxf2brd_items.cpp b/pcbnew/import_dxf/dxf2brd_items.cpp index e143830ee3..0f484fca53 100644 --- a/pcbnew/import_dxf/dxf2brd_items.cpp +++ b/pcbnew/import_dxf/dxf2brd_items.cpp @@ -55,7 +55,7 @@ DXF2BRD_CONVERTER::DXF2BRD_CONVERTER() : DRW_Interface() m_brd = NULL; m_version = 0; m_defaultThickness = 0.1; - m_brdLayer = DRAW_N; + m_brdLayer = Dwgs_User; } @@ -124,13 +124,17 @@ void DXF2BRD_CONVERTER::addLine( const DRW_Line& data ) { DRAWSEGMENT* segm = new DRAWSEGMENT( m_brd ); - segm->SetLayer( m_brdLayer ); + segm->SetLayer( (LAYER_ID) m_brdLayer ); + wxPoint start( mapX( data.basePoint.x ), mapY( data.basePoint.y ) ); + segm->SetStart( start ); + wxPoint end( mapX( data.secPoint.x ), mapY( data.secPoint.y ) ); + segm->SetEnd( end ); - segm->SetWidth( mapDim( data.thickness == 0 ? m_defaultThickness - : data.thickness ) ); + + segm->SetWidth( mapDim( data.thickness == 0 ? m_defaultThickness : data.thickness ) ); appendToBoard( segm ); } @@ -142,7 +146,7 @@ void DXF2BRD_CONVERTER::addCircle( const DRW_Circle& data ) { DRAWSEGMENT* segm = new DRAWSEGMENT( m_brd ); - segm->SetLayer( m_brdLayer ); + segm->SetLayer( (LAYER_ID) m_brdLayer ); segm->SetShape( S_CIRCLE ); wxPoint center( mapX( data.basePoint.x ), mapY( data.basePoint.y ) ); segm->SetCenter( center ); @@ -162,7 +166,7 @@ void DXF2BRD_CONVERTER::addArc( const DRW_Arc& data ) { DRAWSEGMENT* segm = new DRAWSEGMENT( m_brd ); - segm->SetLayer( m_brdLayer ); + segm->SetLayer( (LAYER_ID) m_brdLayer ); segm->SetShape( S_ARC ); // Init arc centre: @@ -199,7 +203,7 @@ void DXF2BRD_CONVERTER::addArc( const DRW_Arc& data ) void DXF2BRD_CONVERTER::addText(const DRW_Text& data) { TEXTE_PCB* pcb_text = new TEXTE_PCB( m_brd ); - pcb_text->SetLayer( m_brdLayer ); + pcb_text->SetLayer( (LAYER_ID) m_brdLayer ); wxPoint refPoint( mapX(data.basePoint.x), mapY(data.basePoint.y) ); wxPoint secPoint( mapX(data.secPoint.x), mapY(data.secPoint.y) ); @@ -327,7 +331,8 @@ void DXF2BRD_CONVERTER::addMText( const DRW_MText& data ) } TEXTE_PCB* pcb_text = new TEXTE_PCB( m_brd ); - pcb_text->SetLayer( m_brdLayer ); + pcb_text->SetLayer( (LAYER_ID) m_brdLayer ); + wxPoint textpos( mapX( data.basePoint.x ), mapY( data.basePoint.y ) ); pcb_text->SetTextPosition( textpos ); pcb_text->SetOrientation( data.angle * 10 ); diff --git a/pcbnew/initpcb.cpp b/pcbnew/initpcb.cpp index f20737ff7d..05ac3198f4 100644 --- a/pcbnew/initpcb.cpp +++ b/pcbnew/initpcb.cpp @@ -53,13 +53,13 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery ) GetBoard()->ResetHighLight(); // Enable all layers (SetCopperLayerCount() will adjust the copper layers enabled) - GetBoard()->SetEnabledLayers( ALL_LAYERS ); + GetBoard()->SetEnabledLayers( LSET().set() ); // Default copper layers count set to 2: double layer board GetBoard()->SetCopperLayerCount( 2 ); // Update display - GetBoard()->SetVisibleLayers( ALL_LAYERS ); + GetBoard()->SetVisibleLayers( LSET().set() ); // Set currently selected layer to be shown in high contrast mode, when enabled` SetHighContrastLayer( GetScreen()->m_Active_Layer ); diff --git a/pcbnew/invoke_pcb_dialog.h b/pcbnew/invoke_pcb_dialog.h index e45724a380..ff9e89e40a 100644 --- a/pcbnew/invoke_pcb_dialog.h +++ b/pcbnew/invoke_pcb_dialog.h @@ -54,6 +54,8 @@ class wxString; // represent maximum information hiding. class PCB_EDIT_FRAME; class FP_LIB_TABLE; +class BOARD; +class PCB_PLOT_PARAMS; /** @@ -87,5 +89,13 @@ void InvokePluginOptionsEditor( wxTopLevelWindow* aCaller, const wxString& aNick */ bool InvokeDXFDialogImport( PCB_EDIT_FRAME* aCaller ); +/** + * Function InvokeLayerSetup + * shows the layer setup dialog + * @return bool - true if user pressed OK (did not abort), else false. + */ +bool InvokeLayerSetup( wxTopLevelWindow* aCaller, BOARD* aBoard ); + +bool InvokeSVGPrint( wxTopLevelWindow* aCaller, BOARD* aBoard, PCB_PLOT_PARAMS* aSettings ); #endif // INVOKE_A_DIALOG_H_ diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index d3b0422d32..50d6fd121e 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -481,7 +481,7 @@ void PCB_IO::formatLayer( const BOARD_ITEM* aItem ) const { if( m_ctl & CTL_STD_LAYER_NAMES ) { - LAYER_NUM layer = aItem->GetLayer(); + LAYER_ID layer = aItem->GetLayer(); // English layer names should never need quoting. m_out->Print( 0, " (layer %s)", TO_UTF8( BOARD::GetStandardLayerName( layer ) ) ); @@ -525,9 +525,10 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const m_out->Print( aNestLevel, "(layers\n" ); // Save only the used copper layers from front to back. +#if 0 // was: for( LAYER_NUM layer = LAST_COPPER_LAYER; layer >= FIRST_COPPER_LAYER; --layer) { - LAYER_MSK mask = GetLayerMask( layer ); + LSET mask = GetLayerSet( layer ); if( mask & aBoard->GetEnabledLayers() ) { m_out->Print( aNestLevel+1, "(%d %s %s", layer, @@ -540,8 +541,27 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const m_out->Print( 0, ")\n" ); } } +#else + LSET visible_layers = aBoard->GetVisibleLayers(); + + for( LSEQ cu = aBoard->GetEnabledLayers().CuStack(); cu; ++cu ) + { + LAYER_ID layer = *cu; + + m_out->Print( aNestLevel+1, "(%d %s %s", layer, + m_out->Quotew( aBoard->GetLayerName( layer ) ).c_str(), + LAYER::ShowType( aBoard->GetLayerType( layer ) ) ); + + if( !visible_layers[layer] ) + m_out->Print( 0, " hide" ); + + m_out->Print( 0, ")\n" ); + } +#endif + // Save used non-copper layers in the order they are defined. +#if 0 // was: for( LAYER_NUM layer = FIRST_NON_COPPER_LAYER; layer <= LAST_NON_COPPER_LAYER; ++layer) { LAYER_MSK mask = GetLayerMask( layer ); @@ -556,6 +576,38 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const m_out->Print( 0, ")\n" ); } } +#else + // desired sequence for non Cu BOARD layers. + static const LAYER_ID non_cu[] = { + 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, + }; + + for( LSEQ seq = aBoard->GetEnabledLayers().Seq( non_cu, DIM( non_cu ) ); seq; ++seq ) + { + LAYER_ID layer = *seq; + + m_out->Print( aNestLevel+1, "(%d %s user", layer, + m_out->Quotew( aBoard->GetLayerName( layer ) ).c_str() ); + + if( !visible_layers[layer] ) + m_out->Print( 0, " hide" ); + + m_out->Print( 0, ")\n" ); + } +#endif m_out->Print( aNestLevel, ")\n\n" ); @@ -1098,7 +1150,7 @@ void PCB_IO::format( MODULE* aModule, int aNestLevel ) const } -void PCB_IO::formatLayers( LAYER_MSK aLayerMask, int aNestLevel ) const +void PCB_IO::formatLayers( LSET aLayerMask, int aNestLevel ) const throw( IO_ERROR ) { std::string output; @@ -1108,46 +1160,67 @@ void PCB_IO::formatLayers( LAYER_MSK aLayerMask, int aNestLevel ) const output += "(layers"; - LAYER_MSK cuMask = ALL_CU_LAYERS; + static const LSET cu_all( LSET::AllCuMask() ); + static const LSET fr_bk( 2, B_Cu, F_Cu ); + static const LSET adhes( 2, B_Adhes, F_Adhes ); + static const LSET paste( 2, B_Paste, F_Paste ); + static const LSET silks( 2, B_SilkS, F_SilkS ); + static const LSET mask( 2, B_Mask, F_Mask ); + static const LSET crt_yd(2, B_CrtYd, F_CrtYd ); + static const LSET fab( 2, B_Fab, F_Fab ); + + LSET cu_mask = cu_all; if( m_board ) - cuMask &= m_board->GetEnabledLayers(); + cu_mask &= m_board->GetEnabledLayers(); // output copper layers first, then non copper - if( ( aLayerMask & cuMask ) == cuMask ) + if( ( aLayerMask & cu_mask ) == cu_mask ) { output += " *.Cu"; - aLayerMask &= ~ALL_CU_LAYERS; // clear bits, so they are not output again below + aLayerMask &= ~cu_all; // clear bits, so they are not output again below } - else if( ( aLayerMask & cuMask ) == (LAYER_BACK | LAYER_FRONT) ) + else if( ( aLayerMask & cu_mask ) == fr_bk ) { output += " F&B.Cu"; - aLayerMask &= ~(LAYER_BACK | LAYER_FRONT); + aLayerMask &= ~fr_bk; } - if( ( aLayerMask & (ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT)) == (ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT) ) + if( ( aLayerMask & adhes ) == adhes ) { output += " *.Adhes"; - aLayerMask &= ~(ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT); + aLayerMask &= ~adhes; } - if( ( aLayerMask & (SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT)) == (SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT) ) + if( ( aLayerMask & paste ) == paste ) { output += " *.Paste"; - aLayerMask &= ~(SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT); + aLayerMask &= ~paste; } - if( ( aLayerMask & (SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT)) == (SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT) ) + if( ( aLayerMask & silks ) == silks ) { output += " *.SilkS"; - aLayerMask &= ~(SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT); + aLayerMask &= ~silks; } - if( ( aLayerMask & (SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT)) == (SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT) ) + if( ( aLayerMask & mask ) == mask ) { output += " *.Mask"; - aLayerMask &= ~(SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT); + aLayerMask &= ~mask; + } + + if( ( aLayerMask & crt_yd ) == crt_yd ) + { + output += " *.CrtYd"; + aLayerMask &= ~crt_yd; + } + + if( ( aLayerMask & fab ) == fab ) + { + output += " *.Fab"; + aLayerMask &= ~fab; } // output any individual layers not handled in wildcard combos above @@ -1157,15 +1230,15 @@ void PCB_IO::formatLayers( LAYER_MSK aLayerMask, int aNestLevel ) const wxString layerName; - for( LAYER_NUM layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer ) + for( LAYER_NUM layer = 0; layer < LAYER_ID_COUNT; ++layer ) { - if( aLayerMask & GetLayerMask( layer ) ) + if( aLayerMask[layer] ) { if( m_board && !( m_ctl & CTL_STD_LAYER_NAMES ) ) - layerName = m_board->GetLayerName( layer ); + layerName = m_board->GetLayerName( LAYER_ID( layer ) ); else // I am being called from FootprintSave() - layerName = BOARD::GetStandardLayerName( layer ); + layerName = BOARD::GetStandardLayerName( LAYER_ID( layer ) ); output += ' '; output += m_out->Quotew( layerName ); @@ -1243,7 +1316,7 @@ void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const m_out->Print( 0, ")" ); } - formatLayers( aPad->GetLayerMask(), 0 ); + formatLayers( aPad->GetLayerSet(), 0 ); std::string output; @@ -1358,10 +1431,10 @@ void PCB_IO::format( TRACK* aTrack, int aNestLevel ) const { if( aTrack->Type() == PCB_VIA_T ) { - LAYER_NUM layer1, layer2; + LAYER_ID layer1, layer2; - const VIA* via = static_cast(aTrack); - BOARD* board = (BOARD*) via->GetParent(); + const VIA* via = static_cast(aTrack); + BOARD* board = (BOARD*) via->GetParent(); wxCHECK_RET( board != 0, wxT( "Via " ) + via->GetSelectMenuText() + wxT( " has no parent." ) ); @@ -1828,7 +1901,7 @@ void PCB_IO::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootpri module->SetParent( 0 ); module->SetOrientation( 0 ); - if( module->GetLayer() != LAYER_N_FRONT ) + if( module->GetLayer() != F_Cu ) module->Flip( module->GetPosition() ); wxLogTrace( traceFootprintLibrary, wxT( "Creating s-expression footprint file: %s." ), diff --git a/pcbnew/kicad_plugin.h b/pcbnew/kicad_plugin.h index e16129203b..1655293617 100644 --- a/pcbnew/kicad_plugin.h +++ b/pcbnew/kicad_plugin.h @@ -36,8 +36,10 @@ class NETINFO_MAPPING; /// Current s-expression file format version. 2 was the last legacy format version. -#define SEXPR_BOARD_FILE_VERSION 3 +//#define SEXPR_BOARD_FILE_VERSION 3 // first s-expression format, used legacy cu stack +#define SEXPR_BOARD_FILE_VERSION 4 // reversed cu stack, changed Inner* to In* in reverse order + // went to 32 Cu layers from 16. #define CTL_STD_LAYER_NAMES (1 << 0) ///< Use English Standard layer names #define CTL_OMIT_NETS (1 << 1) ///< Omit pads net names (useless in library) @@ -215,7 +217,7 @@ private: void formatLayer( const BOARD_ITEM* aItem ) const; - void formatLayers( LAYER_MSK aLayerMask, int aNestLevel = 0 ) const + void formatLayers( LSET aLayerMask, int aNestLevel = 0 ) const throw( IO_ERROR ); }; diff --git a/pcbnew/layer_widget.cpp b/pcbnew/layer_widget.cpp index 92def47cea..9403b4efae 100644 --- a/pcbnew/layer_widget.cpp +++ b/pcbnew/layer_widget.cpp @@ -881,7 +881,7 @@ class MYFRAME : public wxFrame { } - void OnLayerColorChange( LAYER aLayer, EDA_COLOR_T aColor ) + void OnLayerColorChange( int aLayer, EDA_COLOR_T aColor ) { printf( "OnLayerColorChange( aLayer:%d, aColor:%d )\n", aLayer, aColor ); diff --git a/pcbnew/layer_widget.h b/pcbnew/layer_widget.h index 151a1c4127..4f8575f1ec 100644 --- a/pcbnew/layer_widget.h +++ b/pcbnew/layer_widget.h @@ -350,7 +350,6 @@ public: */ bool GetRenderState( int aId ); - void UpdateLayouts(); /* did not help: @@ -378,7 +377,7 @@ public: * @param aLayer is the board layer to change * @param aColor is the new color */ - virtual void OnLayerColorChange( LAYER_NUM aLayer, EDA_COLOR_T aColor ) = 0; + virtual void OnLayerColorChange( int aLayer, EDA_COLOR_T aColor ) = 0; /** * Function OnLayerSelect @@ -387,7 +386,7 @@ public: * the change by returning false. * @param aLayer is the board layer to select */ - virtual bool OnLayerSelect( LAYER_NUM aLayer ) = 0; + virtual bool OnLayerSelect( int aLayer ) = 0; /** * Function OnLayerVisible diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index 64e57d8b17..002313c868 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -98,6 +98,109 @@ typedef LEGACY_PLUGIN::BIU BIU; #define UNKNOWN_PAD_ATTRIBUTE _( "unknown pad attribute: %d" ) +typedef unsigned LAYER_MASK; + +#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 + +// 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 // Old internal units definition (UI = decimil) @@ -112,6 +215,7 @@ static const char delims[] = " \t\r\n"; static bool inline isSpace( int c ) { return strchr( delims, c ) != 0; } +#define MASK(x) (1<<(x)) //-------------------------------------------------------- @@ -149,6 +253,17 @@ static inline char* ReadLine( LINE_READER* rdr, const char* caller ) #endif +/* corrected old junk, element 14 was wrong. can delete. +// Look up Table for conversion copper layer count -> general copper layer mask: +static const LAYER_MASK all_cu_mask[] = { + 0x0001, 0x8001, 0x8003, 0x8007, + 0x800F, 0x801F, 0x803F, 0x807F, + 0x80FF, 0x81FF, 0x83FF, 0x87FF, + 0x8FFF, 0x9FFF, 0xBFFF, 0xFFFF +}; +*/ + + using namespace std; // auto_ptr @@ -197,6 +312,80 @@ static EDA_TEXT_VJUSTIFY_T vertJustify( const char* vertical ) } +/// Count the number of set layers in the mask +inline int layerMaskCountSet( LAYER_MASK aMask ) +{ + int count = 0; + + for( int i = 0; i < NB_PCB_LAYERS && aMask; ++i, aMask >>= 1 ) + { + if( aMask & 1 ) + ++count; + } + + return count; +} + + +LAYER_ID LEGACY_PLUGIN::leg_layer2new( int cu_count, LAYER_NUM aLayerNum ) +{ + int newid; + unsigned old = aLayerNum; + + // this is a speed critical function, be careful. + + if( old <= LAYER_N_FRONT ) + { + if( old == LAYER_N_FRONT ) + newid = F_Cu; + else + { + newid = cu_count - 1 - old; + + wxASSERT( newid >= 0 ); + } + } + else + { + switch( old ) + { + case ADHESIVE_N_BACK: newid = B_Adhes; break; + case ADHESIVE_N_FRONT: newid = F_Adhes; break; + case SOLDERPASTE_N_BACK: newid = B_Paste; break; + case SOLDERPASTE_N_FRONT: newid = F_Paste; break; + case SILKSCREEN_N_BACK: newid = B_SilkS; break; + case SILKSCREEN_N_FRONT: newid = F_SilkS; break; + case SOLDERMASK_N_BACK: newid = B_Mask; break; + case SOLDERMASK_N_FRONT: newid = F_Mask; break; + case DRAW_N: newid = Dwgs_User; break; + case COMMENT_N: newid = Cmts_User; break; + case ECO1_N: newid = Eco1_User; break; + case ECO2_N: newid = Eco2_User; break; + case EDGE_N: newid = Edge_Cuts; break; + default: + wxASSERT( 0 ); + newid = 0; + } + } + + return LAYER_ID( newid ); +} + + +LSET LEGACY_PLUGIN::leg_mask2new( int cu_count, unsigned aMask ) +{ + LSET ret; + + for( int i=0; i>= 1 ) + { + if( aMask & 1 ) + ret.set( leg_layer2new( cu_count, i ) ); + } + + return ret; +} + + /** * Function intParse * parses an ASCII integer string with possible leading whitespace into @@ -292,7 +481,7 @@ void LEGACY_PLUGIN::loadAllSections( bool doAppend ) module->SetFPID( fpid ); - LoadMODULE( module.get() ); + loadMODULE( module.get() ); m_board->Add( module.release(), ADD_APPEND ); } @@ -430,26 +619,33 @@ void LEGACY_PLUGIN::loadGENERAL() else if( TESTLINE( "EnabledLayers" ) ) { - LAYER_MSK enabledLayers = hexParse( line + SZ( "EnabledLayers" ) ); + LAYER_MASK enabledLayers = hexParse( line + SZ( "EnabledLayers" ) ); + + LSET new_mask = leg_mask2new( m_cu_count, enabledLayers ); // layer usage - m_board->SetEnabledLayers( enabledLayers ); + m_board->SetEnabledLayers( new_mask ); // layer visibility equals layer usage, unless overridden later via "VisibleLayers" - m_board->SetVisibleLayers( enabledLayers ); + m_board->SetVisibleLayers( new_mask ); } else if( TESTLINE( "VisibleLayers" ) ) { - LAYER_MSK visibleLayers = hexParse( line + SZ( "VisibleLayers" ) ); - m_board->SetVisibleLayers( visibleLayers ); + LAYER_MASK visibleLayers = hexParse( line + SZ( "VisibleLayers" ) ); + + LSET new_mask = leg_mask2new( m_cu_count, visibleLayers ); + + m_board->SetVisibleLayers( new_mask ); } else if( TESTLINE( "Ly" ) ) // Old format for Layer count { - LAYER_MSK layer_mask = hexParse( line + SZ( "Ly" ) ); + LAYER_MASK layer_mask = hexParse( line + SZ( "Ly" ) ); - m_board->SetCopperLayerCount( LayerMaskCountSet( layer_mask & ALL_CU_LAYERS ) ); + m_cu_count = layerMaskCountSet( layer_mask & ALL_CU_LAYERS ); + + m_board->SetCopperLayerCount( m_cu_count ); } else if( TESTLINE( "BoardThickness" ) ) @@ -681,19 +877,20 @@ void LEGACY_PLUGIN::loadSETUP() { // eg: "Layer[n] " - LAYER_NUM layer = layerParse( line + SZ( "Layer[" ), &data ); + LAYER_NUM layer_num = layerParse( line + SZ( "Layer[" ), &data ); + LAYER_ID layer_id = leg_layer2new( m_cu_count, layer_num ); data = strtok_r( (char*) data+1, delims, &saveptr ); // +1 for ']' if( data ) { wxString layerName = FROM_UTF8( data ); - m_board->SetLayerName( layer, layerName ); + m_board->SetLayerName( layer_id, layerName ); data = strtok_r( NULL, delims, &saveptr ); if( data ) // optional in old board files { LAYER_T type = LAYER::ParseType( data ); - m_board->SetLayerType( layer, type ); + m_board->SetLayerType( layer_id, type ); } } } @@ -941,7 +1138,7 @@ void LEGACY_PLUGIN::loadSETUP() } -void LEGACY_PLUGIN::LoadMODULE( MODULE* aModule ) +void LEGACY_PLUGIN::loadMODULE( MODULE* aModule ) { char* line; char* saveptr; @@ -999,7 +1196,9 @@ void LEGACY_PLUGIN::LoadMODULE( MODULE* aModule ) BIU pos_x = biuParse( line + SZ( "Po" ), &data ); BIU pos_y = biuParse( data, &data ); int orient = intParse( data, &data ); - LAYER_NUM layer = layerParse( data, &data ); + + LAYER_NUM layer_num = layerParse( data, &data ); + LAYER_ID layer_id = leg_layer2new( m_cu_count, layer_num ); long edittime = hexParse( data, &data ); time_t timestamp = hexParse( data, &data ); @@ -1015,7 +1214,7 @@ void LEGACY_PLUGIN::LoadMODULE( MODULE* aModule ) aModule->SetIsPlaced( true ); aModule->SetPosition( wxPoint( pos_x, pos_y ) ); - aModule->SetLayer( layer ); + aModule->SetLayer( layer_id ); aModule->SetOrientation( orient ); aModule->SetTimeStamp( timestamp ); aModule->SetLastEditTime( edittime ); @@ -1297,9 +1496,9 @@ void LEGACY_PLUGIN::loadPAD( MODULE* aModule ) data = strtok_r( NULL, delims, &saveptr ); // skip BufCar data = strtok_r( NULL, delims, &saveptr ); - LAYER_MSK layer_mask = hexParse( data ); + LAYER_MASK layer_mask = hexParse( data ); - pad->SetLayerMask( layer_mask ); + pad->SetLayerSet( leg_mask2new( m_cu_count, layer_mask ) ); pad->SetAttribute( attribute ); } @@ -1428,8 +1627,8 @@ void LEGACY_PLUGIN::loadMODULE_EDGE( MODULE* aModule ) const char* data; // common to all cases, and we have to check their values uniformly at end - BIU width = 1; - LAYER_NUM layer = FIRST_NON_COPPER_LAYER; + BIU width = 1; + LAYER_NUM layer = FIRST_NON_COPPER_LAYER; switch( shape ) { @@ -1537,7 +1736,7 @@ void LEGACY_PLUGIN::loadMODULE_EDGE( MODULE* aModule ) layer = SILKSCREEN_N_FRONT; dwg->SetWidth( width ); - dwg->SetLayer( layer ); + dwg->SetLayer( leg_layer2new( m_cu_count, layer ) ); EDGE_MODULE* em = dwg.release(); @@ -1597,7 +1796,9 @@ void LEGACY_PLUGIN::loadMODULE_TEXT( TEXTE_MODULE* aText ) char* mirror = strtok_r( (char*) data, delims, &saveptr ); char* hide = strtok_r( NULL, delims, &saveptr ); char* tmp = strtok_r( NULL, delims, &saveptr ); - LAYER_NUM layer = tmp ? layerParse( tmp ) : SILKSCREEN_N_FRONT; + + LAYER_NUM layer_num = tmp ? layerParse( tmp ) : SILKSCREEN_N_FRONT; + char* italic = strtok_r( NULL, delims, &saveptr ); char* hjust = strtok_r( (char*) txt_end, delims, &saveptr ); @@ -1639,16 +1840,16 @@ void LEGACY_PLUGIN::loadMODULE_TEXT( TEXTE_MODULE* aText ) if( vjust ) aText->SetVertJustify( vertJustify( vjust ) ); - if( layer < FIRST_LAYER ) - layer = FIRST_LAYER; - else if( layer > LAST_NON_COPPER_LAYER ) - layer = LAST_NON_COPPER_LAYER; - else if( layer == LAYER_N_BACK ) - layer = SILKSCREEN_N_BACK; - else if( layer == LAYER_N_FRONT ) - layer = SILKSCREEN_N_FRONT; + if( layer_num < FIRST_LAYER ) + layer_num = FIRST_LAYER; + else if( layer_num > LAST_NON_COPPER_LAYER ) + layer_num = LAST_NON_COPPER_LAYER; + else if( layer_num == LAYER_N_BACK ) + layer_num = SILKSCREEN_N_BACK; + else if( layer_num == LAYER_N_FRONT ) + layer_num = SILKSCREEN_N_FRONT; - aText->SetLayer( layer ); + aText->SetLayer( leg_layer2new( m_cu_count, layer_num ) ); // Calculate the actual position. aText->SetDrawCoord(); @@ -1767,7 +1968,7 @@ void LEGACY_PLUGIN::loadPCB_LINE() else if( layer > LAST_NON_COPPER_LAYER ) layer = LAST_NON_COPPER_LAYER; - dseg->SetLayer( layer ); + dseg->SetLayer( leg_layer2new( m_cu_count, layer ) ); break; case 1: int mtype; @@ -1962,7 +2163,7 @@ void LEGACY_PLUGIN::loadPCB_TEXT() // e.g. "De 21 1 0 Normal C\r\n" // sscanf( line + 2, " %d %d %lX %s %c\n", &m_Layer, &normal_display, &m_TimeStamp, style, &hJustify ); - LAYER_NUM layer = layerParse( line + SZ( "De" ), &data ); + LAYER_NUM layer_num = layerParse( line + SZ( "De" ), &data ); int notMirrored = intParse( data, &data ); time_t timestamp = hexParse( data, &data ); char* style = strtok_r( (char*) data, delims, &saveptr ); @@ -1984,12 +2185,12 @@ void LEGACY_PLUGIN::loadPCB_TEXT() if( vJustify ) pcbtxt->SetVertJustify( vertJustify( vJustify ) ); - if( layer < FIRST_COPPER_LAYER ) - layer = FIRST_COPPER_LAYER; - else if( layer > LAST_NON_COPPER_LAYER ) - layer = LAST_NON_COPPER_LAYER; + if( layer_num < FIRST_COPPER_LAYER ) + layer_num = FIRST_COPPER_LAYER; + else if( layer_num > LAST_NON_COPPER_LAYER ) + layer_num = LAST_NON_COPPER_LAYER; - pcbtxt->SetLayer( layer ); + pcbtxt->SetLayer( leg_layer2new( m_cu_count, layer_num ) ); } else if( TESTLINE( "$EndTEXTPCB" ) ) @@ -2059,13 +2260,16 @@ void LEGACY_PLUGIN::loadTrackList( int aStructType ) int makeType; time_t timeStamp; - int layer, type, net_code, flags_int; + LAYER_NUM layer_num; + int type, net_code, flags_int; // parse the 2nd line to determine the type of object // e.g. "De 15 1 7 0 0" for a via - sscanf( line + SZ( "De" ), " %d %d %d %lX %X", &layer, &type, &net_code, + sscanf( line + SZ( "De" ), " %d %d %d %lX %X", &layer_num, &type, &net_code, &timeStamp, &flags_int ); + STATUS_FLAGS flags; + flags = static_cast( flags_int ); if( aStructType==PCB_TRACE_T && type==1 ) @@ -2097,7 +2301,7 @@ void LEGACY_PLUGIN::loadTrackList( int aStructType ) newTrack->SetEnd( wxPoint( end_x, end_y ) ); newTrack->SetWidth( width ); - newTrack->SetLayer( layer ); + newTrack->SetLayer( leg_layer2new( m_cu_count, layer_num ) ); if( makeType == PCB_VIA_T ) // Ensure layers are OK when possible: { @@ -2110,7 +2314,7 @@ void LEGACY_PLUGIN::loadTrackList( int aStructType ) via->SetDrill( drill ); if( via->GetViaType() == VIA_THROUGH ) - via->SetLayerPair( LAYER_N_FRONT, LAYER_N_BACK ); + via->SetLayerPair( F_Cu, B_Cu ); } newTrack->SetNetCode( getNetCode( net_code ) ); @@ -2266,8 +2470,8 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() else if( TESTLINE( "ZLayer" ) ) // layer found { - LAYER_NUM layer = layerParse( line + SZ( "ZLayer" ) ); - zc->SetLayer( layer ); + LAYER_NUM layer_num = layerParse( line + SZ( "ZLayer" ) ); + zc->SetLayer( leg_layer2new( m_cu_count, layer_num ) ); } else if( TESTLINE( "ZAux" ) ) // aux info found @@ -2500,7 +2704,7 @@ void LEGACY_PLUGIN::loadDIMENSION() else if( TESTLINE( "Ge" ) ) { - LAYER_NUM layer; + LAYER_NUM layer_num; time_t timestamp; int shape; int ilayer; @@ -2508,12 +2712,13 @@ void LEGACY_PLUGIN::loadDIMENSION() sscanf( line + SZ( "Ge" ), " %d %d %lX", &shape, &ilayer, ×tamp ); if( ilayer < FIRST_NON_COPPER_LAYER ) - layer = FIRST_NON_COPPER_LAYER; + layer_num = FIRST_NON_COPPER_LAYER; else if( ilayer > LAST_NON_COPPER_LAYER ) - layer = LAST_NON_COPPER_LAYER; - else layer = ilayer; + layer_num = LAST_NON_COPPER_LAYER; + else + layer_num = ilayer; - dim->SetLayer( layer ); + dim->SetLayer( leg_layer2new( m_cu_count, layer_num ) ); dim->SetTimeStamp( timestamp ); dim->SetShape( shape ); } @@ -2683,20 +2888,23 @@ void LEGACY_PLUGIN::loadPCB_TARGET() // sscanf( Line + 2, " %X %d %d %d %d %d %lX", &m_Shape, &m_Layer, &m_Pos.x, &m_Pos.y, &m_Size, &m_Width, &m_TimeStamp ); int shape = intParse( line + SZ( "Po" ), &data ); - LAYER_NUM layer = layerParse( data, &data ); + + LAYER_NUM layer_num = layerParse( data, &data ); + BIU pos_x = biuParse( data, &data ); BIU pos_y = biuParse( data, &data ); BIU size = biuParse( data, &data ); BIU width = biuParse( data, &data ); time_t timestamp = hexParse( data ); - if( layer < FIRST_NON_COPPER_LAYER ) - layer = FIRST_NON_COPPER_LAYER; + if( layer_num < FIRST_NON_COPPER_LAYER ) + layer_num = FIRST_NON_COPPER_LAYER; - else if( layer > LAST_NON_COPPER_LAYER ) - layer = LAST_NON_COPPER_LAYER; + else if( layer_num > LAST_NON_COPPER_LAYER ) + layer_num = LAST_NON_COPPER_LAYER; - PCB_TARGET* t = new PCB_TARGET( m_board, shape, layer, wxPoint( pos_x, pos_y ), size, width ); + PCB_TARGET* t = new PCB_TARGET( m_board, shape, leg_layer2new( m_cu_count, layer_num ), + wxPoint( pos_x, pos_y ), size, width ); m_board->Add( t, ADD_APPEND ); t->SetTimeStamp( timestamp ); @@ -2707,77 +2915,6 @@ void LEGACY_PLUGIN::loadPCB_TARGET() } -#define SPBUFZ 50 // wire all usages of this together. - -int LEGACY_PLUGIN::biuSprintf( char* buf, BIU aValue ) const -{ - double engUnits = biuToDisk * aValue; - int len; - - if( engUnits != 0.0 && fabsl( engUnits ) <= 0.0001 ) - { - len = snprintf( buf, SPBUFZ, "%.10f", engUnits ); - - while( --len > 0 && buf[len] == '0' ) - buf[len] = '\0'; - - ++len; - } - else - { - // The %.10g is about optimal since we are dealing with a bounded - // range on aValue, and we can be sure that there will never - // be a reason to have more than 6 digits to the right of the - // decimal point because we are converting from integer - // (signed whole numbers) nanometers to mm. A value of - // 0.000001 is one nanometer, the smallest positive nonzero value - // that we can ever have here. If you ever see a board file with - // more digits to the right of the decimal point than 6, this is a - // possibly a bug in a formatting string nearby. - len = snprintf( buf, SPBUFZ, "%.10g", engUnits ); - } - return len; -} - - -std::string LEGACY_PLUGIN::fmtBIU( BIU aValue ) const -{ - char temp[SPBUFZ]; - - int len = biuSprintf( temp, aValue ); - - return std::string( temp, len ); -} - - -std::string LEGACY_PLUGIN::fmtDEG( double aAngle ) const -{ - char temp[50]; - - // @todo a hook site to convert from tenths degrees to degrees for BOARD_FORMAT_VERSION 2. - - // MINGW: snprintf() comes from gcc folks, sprintf() comes from Microsoft. - int len = snprintf( temp, sizeof( temp ), "%.10g", aAngle ); - - return std::string( temp, len ); -} - - -std::string LEGACY_PLUGIN::fmtBIUPair( BIU first, BIU second ) const -{ - char temp[2*SPBUFZ+2]; - char* cp = temp; - - cp += biuSprintf( cp, first ); - - *cp++ = ' '; - - cp += biuSprintf( cp, second ); - - return std::string( temp, cp - temp ); -} - - BIU LEGACY_PLUGIN::biuParse( const char* aValue, const char** nptrptr ) { char* nptr; @@ -2848,6 +2985,7 @@ double LEGACY_PLUGIN::degParse( const char* aValue, const char** nptrptr ) void LEGACY_PLUGIN::init( const PROPERTIES* aProperties ) { + m_cu_count = 16; m_board = NULL; m_props = aProperties; @@ -2865,8 +3003,128 @@ void LEGACY_PLUGIN::init( const PROPERTIES* aProperties ) } +void LEGACY_PLUGIN::SaveModule3D( const MODULE* me ) const +{ + for( S3D_MASTER* t3D = me->Models(); t3D; t3D = t3D->Next() ) + { + if( !t3D->GetShape3DName().IsEmpty() ) + { + fprintf( m_fp, "$SHAPE3D\n" ); + + fprintf( m_fp, "Na %s\n", EscapedUTF8( t3D->GetShape3DName() ).c_str() ); + + fprintf(m_fp, +#if defined(DEBUG) + // use old formats for testing, just to verify compatibility + // using "diff", then switch to more concise form for release builds. + "Sc %lf %lf %lf\n", +#else + "Sc %.10g %.10g %.10g\n", +#endif + t3D->m_MatScale.x, + t3D->m_MatScale.y, + t3D->m_MatScale.z ); + + fprintf(m_fp, +#if defined(DEBUG) + "Of %lf %lf %lf\n", +#else + "Of %.10g %.10g %.10g\n", +#endif + t3D->m_MatPosition.x, + t3D->m_MatPosition.y, + t3D->m_MatPosition.z ); + + fprintf(m_fp, +#if defined(DEBUG) + "Ro %lf %lf %lf\n", +#else + "Ro %.10g %.10g %.10g\n", +#endif + t3D->m_MatRotation.x, + t3D->m_MatRotation.y, + t3D->m_MatRotation.z ); + + fprintf( m_fp, "$EndSHAPE3D\n" ); + } + } +} + + +#if 0 + //-------------------------------------------------------- +#define SPBUFZ 50 // wire all usages of this together. + +int LEGACY_PLUGIN::biuSprintf( char* buf, BIU aValue ) const +{ + double engUnits = biuToDisk * aValue; + int len; + + if( engUnits != 0.0 && fabsl( engUnits ) <= 0.0001 ) + { + len = snprintf( buf, SPBUFZ, "%.10f", engUnits ); + + while( --len > 0 && buf[len] == '0' ) + buf[len] = '\0'; + + ++len; + } + else + { + // The %.10g is about optimal since we are dealing with a bounded + // range on aValue, and we can be sure that there will never + // be a reason to have more than 6 digits to the right of the + // decimal point because we are converting from integer + // (signed whole numbers) nanometers to mm. A value of + // 0.000001 is one nanometer, the smallest positive nonzero value + // that we can ever have here. If you ever see a board file with + // more digits to the right of the decimal point than 6, this is a + // possibly a bug in a formatting string nearby. + len = snprintf( buf, SPBUFZ, "%.10g", engUnits ); + } + return len; +} + + +std::string LEGACY_PLUGIN::fmtBIU( BIU aValue ) const +{ + char temp[SPBUFZ]; + + int len = biuSprintf( temp, aValue ); + + return std::string( temp, len ); +} + + +std::string LEGACY_PLUGIN::fmtDEG( double aAngle ) const +{ + char temp[50]; + + // @todo a hook site to convert from tenths degrees to degrees for BOARD_FORMAT_VERSION 2. + + // MINGW: snprintf() comes from gcc folks, sprintf() comes from Microsoft. + int len = snprintf( temp, sizeof( temp ), "%.10g", aAngle ); + + return std::string( temp, len ); +} + + +std::string LEGACY_PLUGIN::fmtBIUPair( BIU first, BIU second ) const +{ + char temp[2*SPBUFZ+2]; + char* cp = temp; + + cp += biuSprintf( cp, first ); + + *cp++ = ' '; + + cp += biuSprintf( cp, second ); + + return std::string( temp, cp - temp ); +} + void LEGACY_PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, const PROPERTIES* aProperties ) { LOCALE_IO toggle; // toggles on, then off, the C locale. @@ -2913,6 +3171,9 @@ do { \ } while(0) +// With the advent of the LSET expansion it was agreed to abort the legacy save since +// we'd have to expand the old format in order to suppor the new LAYER_IDs. + void LEGACY_PLUGIN::SaveBOARD( const BOARD* aBoard ) const { m_mapping->SetBoard( aBoard ); @@ -3016,7 +3277,7 @@ void LEGACY_PLUGIN::saveSETUP( const BOARD* aBoard ) const for( LAYER_NUM layer = FIRST_LAYER; layer <= LAST_COPPER_LAYER; ++layer ) { - if( layerMask & GetLayerMask( layer ) ) + if( layerMask & MASK( layer ) ) { fprintf( m_fp, "Layer[%d] %s %s\n", layer, TO_UTF8( aBoard->GetLayerName( layer ) ), @@ -3118,7 +3379,7 @@ void LEGACY_PLUGIN::saveBOARD_ITEMS( const BOARD* aBoard ) const // save the modules for( MODULE* m = aBoard->m_Modules; m; m = (MODULE*) m->Next() ) - SaveMODULE( m ); + saveMODULE( m ); // save the graphics owned by the board (not owned by a module) for( BOARD_ITEM* gr = aBoard->m_Drawings; gr; gr = gr->Next() ) @@ -3385,7 +3646,7 @@ void LEGACY_PLUGIN::savePAD( const D_PAD* me ) const THROW_IO_ERROR( wxString::Format( UNKNOWN_PAD_ATTRIBUTE, me->GetAttribute() ) ); } - fprintf( m_fp, "At %s N %08X\n", texttype, me->GetLayerMask() ); + fprintf( m_fp, "At %s N %08X\n", texttype, me->GetLayerSet() ); fprintf( m_fp, "Ne %d %s\n", m_mapping->Translate( me->GetNetCode() ), EscapedUTF8( me->GetNetname() ).c_str() ); @@ -3423,7 +3684,7 @@ void LEGACY_PLUGIN::savePAD( const D_PAD* me ) const } -void LEGACY_PLUGIN::SaveMODULE( const MODULE* me ) const +void LEGACY_PLUGIN::saveMODULE( const MODULE* me ) const { char statusTxt[3]; double orient = me->GetOrientation(); @@ -3527,54 +3788,6 @@ void LEGACY_PLUGIN::SaveMODULE( const MODULE* me ) const } -void LEGACY_PLUGIN::SaveModule3D( const MODULE* me ) const -{ - for( S3D_MASTER* t3D = me->Models(); t3D; t3D = t3D->Next() ) - { - if( !t3D->GetShape3DName().IsEmpty() ) - { - fprintf( m_fp, "$SHAPE3D\n" ); - - fprintf( m_fp, "Na %s\n", EscapedUTF8( t3D->GetShape3DName() ).c_str() ); - - fprintf(m_fp, -#if defined(DEBUG) - // use old formats for testing, just to verify compatibility - // using "diff", then switch to more concise form for release builds. - "Sc %lf %lf %lf\n", -#else - "Sc %.10g %.10g %.10g\n", -#endif - t3D->m_MatScale.x, - t3D->m_MatScale.y, - t3D->m_MatScale.z ); - - fprintf(m_fp, -#if defined(DEBUG) - "Of %lf %lf %lf\n", -#else - "Of %.10g %.10g %.10g\n", -#endif - t3D->m_MatPosition.x, - t3D->m_MatPosition.y, - t3D->m_MatPosition.z ); - - fprintf(m_fp, -#if defined(DEBUG) - "Ro %lf %lf %lf\n", -#else - "Ro %.10g %.10g %.10g\n", -#endif - t3D->m_MatRotation.x, - t3D->m_MatRotation.y, - t3D->m_MatRotation.z ); - - fprintf( m_fp, "$EndSHAPE3D\n" ); - } - } -} - - void LEGACY_PLUGIN::savePCB_TARGET( const PCB_TARGET* me ) const { fprintf( m_fp, "$PCB_TARGET\n" ); @@ -3891,6 +4104,8 @@ void LEGACY_PLUGIN::savePCB_TEXT( const TEXTE_PCB* me ) const fprintf( m_fp, "$EndTEXTPCB\n" ); } +#endif // NO LEGACY_PLUGIN::Save() + //------------------------------------------------- @@ -3925,7 +4140,7 @@ typedef MODULE_MAP::const_iterator MODULE_CITER; */ struct LP_CACHE { - LEGACY_PLUGIN* m_owner; // my owner, I need its LEGACY_PLUGIN::LoadMODULE() + LEGACY_PLUGIN* m_owner; // my owner, I need its LEGACY_PLUGIN::loadMODULE() wxString m_lib_path; wxDateTime m_mod_time; MODULE_MAP m_modules; // map or tuple of footprint_name vs. MODULE* @@ -4091,7 +4306,7 @@ void LP_CACHE::LoadModules( LINE_READER* aReader ) } #endif - m_owner->LoadMODULE( module.get() ); + m_owner->loadMODULE( module.get() ); MODULE* m = module.release(); // exceptions after this are not expected. @@ -4158,6 +4373,7 @@ void LP_CACHE::LoadModules( LINE_READER* aReader ) } +#if 0 void LP_CACHE::Save() { if( !m_writable ) @@ -4242,10 +4458,10 @@ void LP_CACHE::SaveModules( FILE* aFile ) for( MODULE_CITER it = m_modules.begin(); it != m_modules.end(); ++it ) { - m_owner->SaveMODULE( it->second ); + m_owner->saveMODULE( it->second ); } } - +#endif void LEGACY_PLUGIN::cacheLib( const wxString& aLibraryPath ) { @@ -4310,6 +4526,8 @@ MODULE* LEGACY_PLUGIN::FootprintLoad( const wxString& aLibraryPath, } +#if 0 // omit FootprintSave() + void LEGACY_PLUGIN::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootprint, const PROPERTIES* aProperties ) { @@ -4346,7 +4564,7 @@ void LEGACY_PLUGIN::FootprintSave( const wxString& aLibraryPath, my_module->SetOrientation( 0 ); - if( my_module->GetLayer() != LAYER_N_FRONT ) + if( my_module->GetLayer() != F_Cu ) my_module->Flip( my_module->GetPosition() ); mods.insert( footprintName, my_module ); @@ -4403,6 +4621,8 @@ void LEGACY_PLUGIN::FootprintLibCreate( const wxString& aLibraryPath, const PROP m_cache->Load(); // update m_writable and m_mod_time } +#endif // omit FootprintSave() + bool LEGACY_PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, const PROPERTIES* aProperties ) { @@ -4432,6 +4652,9 @@ bool LEGACY_PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, const PROP bool LEGACY_PLUGIN::IsFootprintLibWritable( const wxString& aLibraryPath ) { +#if 0 // no support for 32 Cu layers in legacy format + return false; +#else LOCALE_IO toggle; init( NULL ); @@ -4439,10 +4662,12 @@ bool LEGACY_PLUGIN::IsFootprintLibWritable( const wxString& aLibraryPath ) cacheLib( aLibraryPath ); return m_cache->m_writable; +#endif } LEGACY_PLUGIN::LEGACY_PLUGIN() : + m_cu_count( 16 ), // for FootprintLoad() m_board( 0 ), m_props( 0 ), m_reader( 0 ), diff --git a/pcbnew/legacy_plugin.h b/pcbnew/legacy_plugin.h index 37f0ef2f45..519eecfa76 100644 --- a/pcbnew/legacy_plugin.h +++ b/pcbnew/legacy_plugin.h @@ -28,7 +28,7 @@ #include #include #include - +#include #define FOOTPRINT_LIBRARY_HEADER "PCBNEW-LibModule-V1" #define FOOTPRINT_LIBRARY_HEADER_CNT 18 @@ -61,8 +61,9 @@ struct LP_CACHE; */ class LEGACY_PLUGIN : public PLUGIN { -public: + friend struct LP_CACHE; +public: //--------------------------------------------------- @@ -78,20 +79,21 @@ public: BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe, const PROPERTIES* aProperties = NULL ); + /* we let go of "save" support when the number of CU layers were expanded from 16 to 32. void Save( const wxString& aFileName, BOARD* aBoard, const PROPERTIES* aProperties = NULL ); + void FootprintSave( const wxString& aLibraryPath, const MODULE* aFootprint, + const PROPERTIES* aProperties = NULL ); + void FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName, const PROPERTIES* aProperties = NULL ); + + void FootprintLibCreate( const wxString& aLibraryPath, const PROPERTIES* aProperties = NULL ); + */ + wxArrayString FootprintEnumerate( const wxString& aLibraryPath, const PROPERTIES* aProperties = NULL); MODULE* FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, const PROPERTIES* aProperties = NULL ); - void FootprintSave( const wxString& aLibraryPath, const MODULE* aFootprint, - const PROPERTIES* aProperties = NULL ); - - void FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName, const PROPERTIES* aProperties = NULL ); - - void FootprintLibCreate( const wxString& aLibraryPath, const PROPERTIES* aProperties = NULL ); - bool FootprintLibDelete( const wxString& aLibraryPath, const PROPERTIES* aProperties = NULL ); bool IsFootprintLibWritable( const wxString& aLibraryPath ); @@ -106,14 +108,15 @@ public: void SetReader( LINE_READER* aReader ) { m_reader = aReader; } void SetFilePtr( FILE* aFile ) { m_fp = aFile; } - void LoadMODULE( MODULE* aModule ); - void SaveMODULE( const MODULE* aModule ) const; void SaveModule3D( const MODULE* aModule ) const; - void SaveBOARD( const BOARD* aBoard ) const; + static LAYER_ID leg_layer2new( int cu_count, LAYER_NUM aLayerNum ); + static LSET leg_mask2new( int cu_count, unsigned aMask ); protected: + int m_cu_count; + wxString m_error; ///< for throwing exceptions BOARD* m_board; ///< which BOARD, no ownership here const PROPERTIES* m_props; ///< passed via Save() or Load(), no ownership, may be NULL. @@ -200,6 +203,7 @@ protected: void loadNETINFO_ITEM(); void loadPCB_TEXT(); void loadNETCLASS(); + void loadMODULE( MODULE* aModule ); /** * Function loadTrackList @@ -218,7 +222,7 @@ protected: //---------------------------------------------------------- - +#if 0 /** * Function writeError * returns an error message wxString containing the filename being @@ -275,6 +279,7 @@ protected: void savePCB_LINE( const DRAWSEGMENT* aStroke ) const; void saveDIMENSION( const DIMENSION* aDimension ) const; void saveTRACK( const TRACK* aTrack ) const; + void saveBOARD( const BOARD* aBoard ) const; /** * Function saveZONE_CONTAINER @@ -283,11 +288,10 @@ protected: void saveZONE_CONTAINER( const ZONE_CONTAINER* aZone ) const; //--------------------------------------------------------- +#endif /// we only cache one footprint library for now, this determines which one. void cacheLib( const wxString& aLibraryPath ); - - friend struct LP_CACHE; }; #endif // LEGACY_PLUGIN_H_ diff --git a/pcbnew/loadcmp.cpp b/pcbnew/loadcmp.cpp index cd3f85d00d..baaf21f3c0 100644 --- a/pcbnew/loadcmp.cpp +++ b/pcbnew/loadcmp.cpp @@ -108,7 +108,7 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule ) // Put it on FRONT layer, // because this is the default in ModEdit, and in libs - if( newModule->GetLayer() != LAYER_N_FRONT ) + if( newModule->GetLayer() != F_Cu ) newModule->Flip( newModule->GetPosition() ); // Put it in orientation 0, diff --git a/pcbnew/magnetic_tracks_functions.cpp b/pcbnew/magnetic_tracks_functions.cpp index 1c901cf760..3400c2b0d8 100644 --- a/pcbnew/magnetic_tracks_functions.cpp +++ b/pcbnew/magnetic_tracks_functions.cpp @@ -156,8 +156,8 @@ bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize, if( doPad ) { - LAYER_MSK layer_mask = GetLayerMask( screen->m_Active_Layer ); - D_PAD* pad = m_Pcb->GetPad( pos, layer_mask ); + LSET layer_mask( screen->m_Active_Layer ); + D_PAD* pad = m_Pcb->GetPad( pos, layer_mask ); if( pad ) { @@ -172,11 +172,11 @@ bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize, // after pads, only track & via tests remain, skip them if not desired if( doTrack ) { - LAYER_NUM layer = screen->m_Active_Layer; + LAYER_ID layer = screen->m_Active_Layer; for( TRACK* via = m_Pcb->m_Track; - via && (via = via->GetVia( *curpos, layer )) != NULL; - via = via->Next() ) + via && (via = via->GetVia( *curpos, layer )) != NULL; + via = via->Next() ) { if( via != currTrack ) // a via cannot influence itself { @@ -191,7 +191,7 @@ bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize, if( !currTrack ) { - LAYER_MSK layer_mask = GetLayerMask( layer ); + LSET layer_mask( layer ); TRACK* track = m_Pcb->GetTrack( m_Pcb->m_Track, pos, layer_mask ); diff --git a/pcbnew/module_editor_frame.h b/pcbnew/module_editor_frame.h index f20c032c12..1e10a01b09 100644 --- a/pcbnew/module_editor_frame.h +++ b/pcbnew/module_editor_frame.h @@ -178,7 +178,7 @@ public: * @param aPrintMirrorMode = not used here (Set when printing in mirror mode) * @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); // BOARD handling diff --git a/pcbnew/modules.cpp b/pcbnew/modules.cpp index 477feacaf6..d6a357e1bc 100644 --- a/pcbnew/modules.cpp +++ b/pcbnew/modules.cpp @@ -296,7 +296,7 @@ void PCB_EDIT_FRAME::Change_Side_Module( MODULE* Module, wxDC* DC ) if( Module == NULL ) return; - if( ( Module->GetLayer() != LAYER_N_FRONT ) && ( Module->GetLayer() != LAYER_N_BACK ) ) + if( ( Module->GetLayer() != F_Cu ) && ( Module->GetLayer() != B_Cu ) ) return; OnModify(); diff --git a/pcbnew/move_or_drag_track.cpp b/pcbnew/move_or_drag_track.cpp index 8156764d9b..6a36f6ade2 100644 --- a/pcbnew/move_or_drag_track.cpp +++ b/pcbnew/move_or_drag_track.cpp @@ -626,7 +626,7 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC if( aCommand != ID_POPUP_PCB_MOVE_TRACK_SEGMENT ) { Collect_TrackSegmentsToDrag( GetBoard(), aTrack->GetStart(), - aTrack->GetLayerMask(), + aTrack->GetLayerSet(), aTrack->GetNetCode(), aTrack->GetWidth() / 2 ); } @@ -646,17 +646,17 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC case ID_POPUP_PCB_DRAG_TRACK_SEGMENT: // drag a segment pos = aTrack->GetStart(); - Collect_TrackSegmentsToDrag( GetBoard(), pos, aTrack->GetLayerMask(), + Collect_TrackSegmentsToDrag( GetBoard(), pos, aTrack->GetLayerSet(), aTrack->GetNetCode(), aTrack->GetWidth() / 2 ); pos = aTrack->GetEnd(); aTrack->SetFlags( IS_DRAGGED | ENDPOINT | STARTPOINT ); - Collect_TrackSegmentsToDrag( GetBoard(), pos, aTrack->GetLayerMask(), + Collect_TrackSegmentsToDrag( GetBoard(), pos, aTrack->GetLayerSet(), aTrack->GetNetCode(), aTrack->GetWidth() / 2 ); break; case ID_POPUP_PCB_MOVE_TRACK_NODE: // Drag via or move node pos = (diag & STARTPOINT) ? aTrack->GetStart() : aTrack->GetEnd(); - Collect_TrackSegmentsToDrag( GetBoard(), pos, aTrack->GetLayerMask(), + Collect_TrackSegmentsToDrag( GetBoard(), pos, aTrack->GetLayerSet(), aTrack->GetNetCode(), aTrack->GetWidth() / 2 ); PosInit = pos; break; @@ -862,7 +862,8 @@ bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC ) /* Test the connections modified by the move * (only pad connection must be tested, track connection will be * tested by TestNetConnection() ) */ - LAYER_MSK layerMask = GetLayerMask( Track->GetLayer() ); + LSET layerMask( Track->GetLayer() ); + Track->start = GetBoard()->GetPadFast( Track->GetStart(), layerMask ); if( Track->start ) diff --git a/pcbnew/muonde.cpp b/pcbnew/muonde.cpp index ba2be9e2b4..3ac2545545 100644 --- a/pcbnew/muonde.cpp +++ b/pcbnew/muonde.cpp @@ -265,7 +265,7 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC ) pad->SetSize( wxSize( Mself.m_Width, Mself.m_Width ) ); - pad->SetLayerMask( GetLayerMask( module->GetLayer() ) ); + pad->SetLayerSet( LSET( module->GetLayer() ) ); pad->SetAttribute( PAD_SMD ); pad->SetShape( PAD_CIRCLE ); @@ -567,7 +567,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveBasicShape( const wxString& name, int pad_c pad->SetPosition( module->GetPosition() ); pad->SetShape( PAD_RECT ); pad->SetAttribute( PAD_SMD ); - pad->SetLayerMask( LAYER_FRONT ); + pad->SetLayerSet( F_Cu ); Line.Printf( wxT( "%d" ), pad_num ); pad->SetPadName( Line ); @@ -692,7 +692,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type ) module->GraphicalItems().PushFront( edge ); edge->SetShape( S_POLYGON ); - edge->SetLayer( LAYER_N_FRONT ); + edge->SetLayer( F_Cu ); int numPoints = angle / 50 + 3; // Note: angles are in 0.1 degrees std::vector polyPoints = edge->GetPolyPoints(); @@ -992,7 +992,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape() module->GraphicalItems().PushFront( edge ); edge->SetShape( S_POLYGON ); - edge->SetLayer( LAYER_N_FRONT ); + edge->SetLayer( F_Cu ); std::vector polyPoints = edge->GetPolyPoints(); polyPoints.reserve( 2 * PolyEdges.size() + 2 ); diff --git a/pcbnew/onleftclick.cpp b/pcbnew/onleftclick.cpp index 922d04e727..f423ff9889 100644 --- a/pcbnew/onleftclick.cpp +++ b/pcbnew/onleftclick.cpp @@ -326,7 +326,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) break; case ID_PCB_ADD_TEXT_BUTT: - if( IsLayerInList( EDGE_LAYER, GetActiveLayer() ) ) + if( Edge_Cuts == GetActiveLayer() ) { DisplayError( this, _( "Texts not allowed on Edge Cut layer" ) ); @@ -376,14 +376,13 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) break; case ID_PCB_DIMENSION_BUTT: - if( IsLayerInList( EDGE_LAYER|ALL_CU_LAYERS, GetActiveLayer() ) ) + if( IsCopperLayer( GetActiveLayer() ) || GetActiveLayer() == Edge_Cuts ) { - DisplayError( this, - _( "Dimension not allowed on Copper or Edge Cut layers" ) ); + DisplayError( this, _( "Dimension not allowed on Copper or Edge Cut layers" ) ); break; } - if( (DrawStruct == NULL) || (DrawStruct->GetFlags() == 0) ) + if( !DrawStruct || !DrawStruct->GetFlags() ) { DrawStruct = (BOARD_ITEM*) EditDimension( NULL, aDC ); SetCurItem( DrawStruct ); diff --git a/pcbnew/pad_edition_functions.cpp b/pcbnew/pad_edition_functions.cpp index 57907ad142..df4fc49c29 100644 --- a/pcbnew/pad_edition_functions.cpp +++ b/pcbnew/pad_edition_functions.cpp @@ -54,7 +54,7 @@ void PCB_BASE_FRAME::Export_Pad_Settings( D_PAD* aPad ) mp.SetShape( aPad->GetShape() ); mp.SetAttribute( aPad->GetAttribute() ); - mp.SetLayerMask( aPad->GetLayerMask() ); + mp.SetLayerSet( aPad->GetLayerSet() ); mp.SetOrientation( aPad->GetOrientation() - aPad->GetParent()->GetOrientation() ); @@ -82,7 +82,7 @@ void PCB_BASE_FRAME::Import_Pad_Settings( D_PAD* aPad, bool aDraw ) D_PAD& mp = GetDesignSettings().m_Pad_Master; aPad->SetShape( mp.GetShape() ); - aPad->SetLayerMask( mp.GetLayerMask() ); + aPad->SetLayerSet( mp.GetLayerSet() ); aPad->SetAttribute( mp.GetAttribute() ); aPad->SetOrientation( mp.GetOrientation() + aPad->GetParent()->GetOrientation() ); aPad->SetSize( mp.GetSize() ); diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb.cpp index 6afde99801..4cfcbe48e4 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb.cpp @@ -48,7 +48,7 @@ namespace PCAD2KICAD { -LAYER_NUM PCB::GetKiCadLayer( int aPCadLayer ) +LAYER_ID PCB::GetKiCadLayer( int aPCadLayer ) { wxASSERT( aPCadLayer >= 0 && aPCadLayer < MAX_PCAD_LAYER_QTY ); return m_layersMap[aPCadLayer].KiCadLayer; @@ -74,23 +74,23 @@ PCB::PCB( BOARD* aBoard ) : PCB_MODULE( this, aBoard ) for( i = 0; i < MAX_PCAD_LAYER_QTY; i++ ) { - m_layersMap[i].KiCadLayer = SOLDERMASK_N_FRONT; // default - m_layersMap[i].layerType = LAYER_TYPE_NONSIGNAL; // default + m_layersMap[i].KiCadLayer = F_Mask; // default + m_layersMap[i].layerType = LAYER_TYPE_NONSIGNAL; // default m_layersMap[i].netNameRef = wxT( "" ); // default } m_sizeX = 0; m_sizeY = 0; - m_layersMap[1].KiCadLayer = LAST_COPPER_LAYER; - m_layersMap[1].layerType = LAYER_TYPE_SIGNAL; + m_layersMap[1].KiCadLayer = F_Cu; + m_layersMap[1].layerType = LAYER_TYPE_SIGNAL; - m_layersMap[2].KiCadLayer = FIRST_COPPER_LAYER; - m_layersMap[2].layerType = LAYER_TYPE_SIGNAL; + m_layersMap[2].KiCadLayer = B_Cu; + m_layersMap[2].layerType = LAYER_TYPE_SIGNAL; - m_layersMap[3].KiCadLayer = ECO2_N; - m_layersMap[6].KiCadLayer = SILKSCREEN_N_FRONT; - m_layersMap[7].KiCadLayer = SILKSCREEN_N_BACK; + m_layersMap[3].KiCadLayer = Eco2_User; + m_layersMap[6].KiCadLayer = F_SilkS; + m_layersMap[7].KiCadLayer = B_SilkS; m_timestamp_cnt = 0x10000000; } @@ -445,9 +445,10 @@ void PCB::ConnectPinToNet( wxString aCompRef, wxString aPinRef, wxString aNetNam } } + int PCB::FindLayer( wxString aLayerName ) { - for ( LAYER_NUM i = FIRST_COPPER_LAYER; i < (int)m_layersStackup.GetCount(); ++i ) + for( LAYER_NUM i = 0; i < (int)m_layersStackup.GetCount(); ++i ) { if( m_layersStackup[i] == aLayerName ) return i; @@ -456,6 +457,7 @@ int PCB::FindLayer( wxString aLayerName ) return -1; } + /* KiCad layers * 0 Copper layer * 1 to 14 Inner layers @@ -477,42 +479,46 @@ int PCB::FindLayer( wxString aLayerName ) void PCB::MapLayer( XNODE* aNode ) { wxString lName, layerType; - LAYER_NUM KiCadLayer; + LAYER_ID KiCadLayer; long num = 0; aNode->GetAttribute( wxT( "Name" ), &lName ); lName = lName.MakeUpper(); if( lName == wxT( "TOP ASSY" ) ) - KiCadLayer = COMMENT_N; + KiCadLayer = Cmts_User; else if( lName == wxT( "TOP SILK" ) ) - KiCadLayer = SILKSCREEN_N_FRONT; + KiCadLayer = F_SilkS; else if( lName == wxT( "TOP PASTE" ) ) - KiCadLayer = SOLDERPASTE_N_FRONT; + KiCadLayer = F_Paste; else if( lName == wxT( "TOP MASK" ) ) - KiCadLayer = SOLDERMASK_N_FRONT; + KiCadLayer = F_Mask; else if( lName == wxT( "TOP" ) ) - KiCadLayer = LAST_COPPER_LAYER; + KiCadLayer = F_Cu; else if( lName == wxT( "BOTTOM" ) ) - KiCadLayer = FIRST_COPPER_LAYER; + KiCadLayer = B_Cu; else if( lName == wxT( "BOT MASK" ) ) - KiCadLayer = SOLDERMASK_N_BACK; + KiCadLayer = B_Mask; else if( lName == wxT( "BOT PASTE" ) ) - KiCadLayer = SOLDERPASTE_N_BACK; + KiCadLayer = B_Paste; else if( lName == wxT( "BOT SILK" ) ) - KiCadLayer = SILKSCREEN_N_BACK; + KiCadLayer = B_SilkS; else if( lName == wxT( "BOT ASSY" ) ) - KiCadLayer = DRAW_N; + KiCadLayer = Dwgs_User; else if( lName == wxT( "BOARD" ) ) - KiCadLayer = EDGE_N; + KiCadLayer = Edge_Cuts; else { int layernum = FindLayer( lName ); if( layernum == -1 ) - KiCadLayer = DRAW_N; // default + KiCadLayer = Dwgs_User; // default else +#if 0 // was: KiCadLayer = FIRST_COPPER_LAYER + m_layersStackup.GetCount() - 1 - layernum; +#else + KiCadLayer = LAYER_ID( layernum ); +#endif } if( FindNode( aNode, wxT( "layerNum" ) ) ) @@ -591,7 +597,7 @@ void PCB::GetBoardOutline( wxXmlDocument* aXmlDoc, wxString aActualConversion ) if( FindNode( iNode, wxT( "layerNumRef" ) ) ) FindNode( iNode, wxT( "layerNumRef" ) )->GetNodeContent().ToLong( &PCadLayer ); - if( GetKiCadLayer( PCadLayer ) == EDGE_N ) + if( GetKiCadLayer( PCadLayer ) == Edge_Cuts ) { lNode = iNode->GetChildren(); while( lNode ) diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb.h b/pcbnew/pcad2kicadpcb_plugin/pcb.h index baedea0e55..5d566ff29c 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb.h +++ b/pcbnew/pcad2kicadpcb_plugin/pcb.h @@ -53,7 +53,7 @@ public: PCB( BOARD* aBoard ); ~PCB(); - LAYER_NUM GetKiCadLayer( int aPCadLayer ); + LAYER_ID GetKiCadLayer( int aPCadLayer ); LAYER_TYPE_T GetLayerType( int aPCadLayer ); wxString GetLayerNetNameRef( int aPCadLayer ); int GetNewTimestamp(); diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_callbacks.h b/pcbnew/pcad2kicadpcb_plugin/pcb_callbacks.h index a12dc70343..2c2b5f8a4b 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_callbacks.h +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_callbacks.h @@ -42,7 +42,7 @@ enum LAYER_TYPE_T typedef struct _TLAYER { - LAYER_NUM KiCadLayer; + LAYER_ID KiCadLayer; LAYER_TYPE_T layerType; wxString netNameRef; } TLAYER; @@ -53,7 +53,7 @@ namespace PCAD2KICAD class PCB_CALLBACKS { public: - virtual LAYER_NUM GetKiCadLayer( int aPCadLayer ) = 0; + virtual LAYER_ID GetKiCadLayer( int aPCadLayer ) = 0; virtual LAYER_TYPE_T GetLayerType( int aPCadLayer ) = 0; virtual wxString GetLayerNetNameRef( int aPCadLayer ) = 0; virtual int GetNewTimestamp() = 0; diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_component.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_component.cpp index f551919ad8..44f5cd9467 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_component.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_component.cpp @@ -43,7 +43,7 @@ PCB_COMPONENT::PCB_COMPONENT( PCB_CALLBACKS* aCallbacks, m_tag = 0; m_objType = wxT( '?' ); m_PCadLayer = 0; - m_KiCadLayer = LAYER_N_FRONT; // It *has* to be somewhere... + m_KiCadLayer = F_Cu; // It *has* to be somewhere... m_timestamp = 0; m_positionX = 0; m_positionY = 0; diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_component.h b/pcbnew/pcad2kicadpcb_plugin/pcb_component.h index 97c769f63e..41c55abf09 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_component.h +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_component.h @@ -51,7 +51,7 @@ public: int m_tag; char m_objType; int m_PCadLayer; - LAYER_NUM m_KiCadLayer; + LAYER_ID m_KiCadLayer; int m_timestamp; int m_positionX; int m_positionY; @@ -70,7 +70,7 @@ public: virtual void AddToModule( MODULE* aModule ); virtual void AddToBoard() = 0; - LAYER_NUM GetKiCadLayer() { return m_callbacks->GetKiCadLayer( m_PCadLayer ); } + LAYER_ID GetKiCadLayer() { return m_callbacks->GetKiCadLayer( m_PCadLayer ); } int GetNewTimestamp() { return m_callbacks->GetNewTimestamp(); } int GetNetCode( wxString aNetName ) { return m_callbacks->GetNetCode( aNetName ); } diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp index a04155d5a2..ce9020babd 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp @@ -51,7 +51,7 @@ PCB_MODULE::PCB_MODULE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) : PCB_COMPONE InitTTextValue( &m_value ); m_mirror = 0; m_objType = wxT( 'M' ); // MODULE - m_KiCadLayer = SILKSCREEN_N_FRONT; // default + m_KiCadLayer = F_SilkS; // default } @@ -506,7 +506,7 @@ void PCB_MODULE::AddToBoard() m_board->Add( module, ADD_APPEND ); module->SetPosition( wxPoint( m_positionX, m_positionY ) ); - module->SetLayer( m_mirror ? LAYER_N_BACK : LAYER_N_FRONT ); + module->SetLayer( m_mirror ? B_Cu : F_Cu ); module->SetOrientation( m_rotation ); module->SetTimeStamp( 0 ); module->SetLastEditTime( 0 ); diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp index c1e7c416b2..ca1346dab6 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp @@ -194,6 +194,7 @@ void PCB_PAD::AddToModule( MODULE* aModule, int aRotation, bool aEncapsulatedPad int height = 0; D_PAD* pad = new D_PAD( aModule ); + aModule->Pads().PushBack( pad ); if( !m_isHolePlated && m_hole ) @@ -206,7 +207,7 @@ void PCB_PAD::AddToModule( MODULE* aModule, int aRotation, bool aEncapsulatedPad pad->SetDrillSize( wxSize( m_hole, m_hole ) ); pad->SetSize( wxSize( m_hole, m_hole ) ); - pad->SetLayerMask( ALL_CU_LAYERS | SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT ); + pad->SetLayerSet( LSET::AllCuMask() | LSET( 3, B_Mask, F_Mask ) ); } else { @@ -219,21 +220,18 @@ void PCB_PAD::AddToModule( MODULE* aModule, int aRotation, bool aEncapsulatedPad if( padShape->m_width > 0 && padShape->m_height > 0 ) { - if( padShape->m_KiCadLayer == LAYER_N_FRONT - || padShape->m_KiCadLayer == LAYER_N_BACK ) + if( padShape->m_KiCadLayer == F_Cu || + padShape->m_KiCadLayer == B_Cu ) { padShapeName = padShape->m_shape; width = padShape->m_width; height = padShape->m_height; // assume this is SMD pad - if( padShape->m_KiCadLayer == LAYER_N_FRONT ) - pad->SetLayerMask( LAYER_FRONT | SOLDERPASTE_LAYER_FRONT | - SOLDERMASK_LAYER_FRONT ); + if( padShape->m_KiCadLayer == F_Cu ) + pad->SetLayerSet( LSET( 3, F_Cu, F_Paste, F_Mask ) ); else - pad->SetLayerMask( LAYER_BACK | SOLDERPASTE_LAYER_BACK | - SOLDERMASK_LAYER_BACK ); - + pad->SetLayerSet( LSET( 3, B_Cu, B_Paste, B_Mask ) ); break; } } @@ -241,7 +239,7 @@ void PCB_PAD::AddToModule( MODULE* aModule, int aRotation, bool aEncapsulatedPad if( padType == PAD_STANDARD ) // actually this is a thru-hole pad - pad->SetLayerMask( ALL_CU_LAYERS | SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT ); + pad->SetLayerSet( LSET::AllCuMask() | LSET( 2, B_Mask, F_Mask ) ); if( width == 0 || height == 0 ) THROW_IO_ERROR( wxT( "pad with zero size" ) ); @@ -313,8 +311,8 @@ void PCB_PAD::AddToBoard() if( padShape->m_width > 0 && padShape->m_height > 0 ) { - if( padShape->m_KiCadLayer == LAYER_N_FRONT - || padShape->m_KiCadLayer == LAYER_N_BACK ) + if( padShape->m_KiCadLayer == F_Cu + || padShape->m_KiCadLayer == B_Cu ) { width = padShape->m_width; height = padShape->m_height; @@ -339,7 +337,7 @@ void PCB_PAD::AddToBoard() via->SetWidth( height ); via->SetViaType( VIA_THROUGH ); - via->SetLayerPair( LAYER_N_FRONT, LAYER_N_BACK ); + via->SetLayerPair( F_Cu, B_Cu ); via->SetDrill( m_hole ); via->SetLayer( m_KiCadLayer ); diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 06eac0cef5..9a9ac26e31 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -61,7 +61,7 @@ PCB_RENDER_SETTINGS::PCB_RENDER_SETTINGS() void PCB_RENDER_SETTINGS::ImportLegacyColors( const COLORS_DESIGN_SETTINGS* aSettings ) { - for( int i = 0; i < NB_LAYERS; i++ ) + for( int i = 0; i < LAYER_ID_COUNT; i++ ) { m_layerColors[i] = m_legacyColorMap[aSettings->GetLayerColor( i )]; } @@ -84,8 +84,10 @@ void PCB_RENDER_SETTINGS::ImportLegacyColors( const COLORS_DESIGN_SETTINGS* aSet m_layerColors[ITEM_GAL_LAYER( DRC_VISIBLE )] = COLOR4D( 1.0, 0.0, 0.0, 0.8 ); // Netnames for copper layers - for( LAYER_NUM layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; ++layer ) + for( LSEQ cu = LSET::AllCuMask().CuStack(); cu; ++cu ) { + LAYER_ID layer = *cu; + m_layerColors[GetNetnameLayer( layer )] = COLOR4D( 0.8, 0.8, 0.8, 0.7 ); } @@ -500,7 +502,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer ) size = VECTOR2D( aPad->GetDrillSize() ) / 2.0; shape = aPad->GetDrillShape() == PAD_DRILL_OBLONG ? PAD_OVAL : PAD_CIRCLE; } - else if( aLayer == SOLDERMASK_N_FRONT || aLayer == SOLDERMASK_N_BACK ) + else if( aLayer == F_Mask || aLayer == B_Mask ) { // Drawing soldermask int soldermaskMargin = aPad->GetSolderMaskMargin(); @@ -510,7 +512,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer ) aPad->GetSize().y / 2.0 + soldermaskMargin ); shape = aPad->GetShape(); } - else if( aLayer == SOLDERPASTE_N_FRONT || aLayer == SOLDERPASTE_N_BACK ) + else if( aLayer == F_Paste || aLayer == B_Paste ) { // Drawing solderpaste int solderpasteMargin = aPad->GetLocalSolderPasteMargin(); diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index 4bf36597af..d6f4b8fd31 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -62,20 +62,35 @@ void PCB_PARSER::init() // Add untranslated default (i.e. english) layernames. // Some may be overridden later if parsing a board rather than a footprint. // The english name will survive if parsing only a footprint. - for( LAYER_NUM layerNdx = FIRST_LAYER; layerNdx < NB_PCB_LAYERS; ++layerNdx ) + for( LAYER_NUM layer = 0; layer < LAYER_ID_COUNT; ++layer ) { - std::string untranslated = TO_UTF8( BOARD::GetStandardLayerName( layerNdx ) ); + std::string untranslated = TO_UTF8( wxString( LSET::Name( LAYER_ID( layer ) ) ) ); - m_layerIndices[ untranslated ] = layerNdx; - m_layerMasks[ untranslated ] = GetLayerMask( layerNdx ); + m_layerIndices[ untranslated ] = LAYER_ID( layer ); + m_layerMasks[ untranslated ] = LSET( layer ); } - m_layerMasks[ "*.Cu" ] = ALL_CU_LAYERS; - m_layerMasks[ "F&B.Cu" ] = LAYER_BACK | LAYER_FRONT; - m_layerMasks[ "*.Adhes" ] = ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT; - m_layerMasks[ "*.Paste" ] = SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT; - m_layerMasks[ "*.Mask" ] = SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT; - m_layerMasks[ "*.SilkS" ] = SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT; + m_layerMasks[ "*.Cu" ] = LSET::AllCuMask(); + m_layerMasks[ "F&B.Cu" ] = LSET( 2, F_Cu, B_Cu ); + m_layerMasks[ "*.Adhes" ] = LSET( 2, B_Adhes, F_Adhes ); + m_layerMasks[ "*.Paste" ] = LSET( 2, B_Paste, F_Paste ); + m_layerMasks[ "*.Mask" ] = LSET( 2, B_Mask, F_Mask ); + m_layerMasks[ "*.SilkS" ] = LSET( 2, B_SilkS, F_SilkS ); + m_layerMasks[ "*.Fab" ] = LSET( 2, B_Fab, F_Fab ); + + // This is for the first pretty format, which had Inner1_Cu-Inner14_Cu with the numbering + // sequence reversed from the In1_Cu-In30_Cu version 2 pretty numbering scheme. + // Version 2 brought in an additional 16 Cu layers and flipped the cu stack but + // kept the gap between one of the outside layers and the last cu internal. + + for( int i=1; i<=14; ++i ) + { + char tmp[60]; + + sprintf( tmp, "Inner%d", i ); + + m_layerMasks[ tmp ] = LSET( In15_Cu - i ); + } } @@ -623,39 +638,38 @@ void PCB_PARSER::parseTITLE_BLOCK() throw( IO_ERROR, PARSE_ERROR ) break; case T_comment: - { - int commentNumber = parseInt( "comment" ); - - switch( commentNumber ) { - case 1: - NextTok(); - titleBlock.SetComment1( FromUTF8() ); - break; + int commentNumber = parseInt( "comment" ); - case 2: - NextTok(); - titleBlock.SetComment2( FromUTF8() ); - break; + switch( commentNumber ) + { + case 1: + NextTok(); + titleBlock.SetComment1( FromUTF8() ); + break; - case 3: - NextTok(); - titleBlock.SetComment3( FromUTF8() ); - break; + case 2: + NextTok(); + titleBlock.SetComment2( FromUTF8() ); + break; - case 4: - NextTok(); - titleBlock.SetComment4( FromUTF8() ); - break; + case 3: + NextTok(); + titleBlock.SetComment3( FromUTF8() ); + break; - default: - wxString err; - err.Printf( wxT( "%d is not a valid title block comment number" ), commentNumber ); - THROW_PARSE_ERROR( err, CurSource(), CurLine(), CurLineNumber(), CurOffset() ); + case 4: + NextTok(); + titleBlock.SetComment4( FromUTF8() ); + break; + + default: + wxString err; + err.Printf( wxT( "%d is not a valid title block comment number" ), commentNumber ); + THROW_PARSE_ERROR( err, CurSource(), CurLine(), CurLineNumber(), CurOffset() ); + } } - break; - } default: Expecting( "title, date, rev, company, or comment" ); @@ -668,72 +682,136 @@ void PCB_PARSER::parseTITLE_BLOCK() throw( IO_ERROR, PARSE_ERROR ) } +void PCB_PARSER::parseLayer( LAYER* aLayer ) throw( IO_ERROR, PARSE_ERROR ) +{ + T token; + + std::string name; + std::string type; + bool isVisible = true; + + if( CurTok() != T_LEFT ) + Expecting( T_LEFT ); + + // this layer_num is not used, we DO depend on LAYER_T however. + LAYER_NUM layer_num = parseInt( "layer index" ); + + NeedSYMBOL(); + name = CurText(); + + NeedSYMBOL(); + type = CurText(); + + token = NextTok(); + + if( token == T_hide ) + { + isVisible = false; + NeedRIGHT(); + } + else if( token != T_RIGHT ) + { + Expecting( "hide or )" ); + } + + aLayer->m_name = FROM_UTF8( name.c_str() ); + aLayer->m_type = LAYER::ParseType( type.c_str() ); + aLayer->m_number = layer_num; + aLayer->m_visible = isVisible; +} + + void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR ) { wxCHECK_RET( CurTok() == T_layers, wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as layers." ) ); - T token; - std::string name; - std::string type; - LAYER_NUM layerIndex; - bool isVisible = true; - LAYER_MSK visibleLayers = NO_LAYERS; - LAYER_MSK enabledLayers = NO_LAYERS; - int copperLayerCount = 0; + T token; + LSET visibleLayers; + LSET enabledLayers; + int copperLayerCount = 0; + + std::vector cu; for( token = NextTok(); token != T_RIGHT; token = NextTok() ) { - if( token != T_LEFT ) - Expecting( T_LEFT ); + LAYER layer; - layerIndex = parseInt( "layer index" ); + parseLayer( &layer ); - NeedSYMBOL(); - name = CurText(); - - NeedSYMBOL(); - type = CurText(); - - token = NextTok(); - - if( token == T_hide ) + if( layer.m_type != LT_UNDEFINED ) // it's a copper layer { - isVisible = false; - NeedRIGHT(); + cu.push_back( layer ); + + DBG( printf( "cop m_visible:%s\n", cu.back().m_visible ? "true" : "false" );) } - else if( token == T_RIGHT ) + else // all non-copper are fixed names, simply look up LAYER_ID. { - isVisible = true; + // This is an edge triggered one shot if( test ) that happens on + // the first non copper layer, which follow all the Cu layers. + // This is the feature that the original *.kicad_pcb file format and + // the inverted Cu stack format had in common and is therefore a trick + // used to handle either. The layer number in the (layers ..) + // s-expression element are ignored. + if( cu.size() ) + { + // Rework the layer numbers, which changed when the Cu stack + // was flipped. So we instead use position in the list. + cu[cu.size()-1].m_number = B_Cu; + + for( unsigned i=0; i < cu.size()-1; ++i ) + { + cu[i].m_number = i; + } + + for( std::vector::const_iterator it = cu.begin(); itm_number ); + + if( it->m_visible ) + visibleLayers.set( it->m_number ); + + m_board->SetLayer( LAYER_ID( it->m_number ), *it ); + + m_layerIndices[ it->m_name ] = LAYER_ID( it->m_number ); + m_layerMasks[ it->m_name ] = LSET( it->m_number ); + } + + copperLayerCount = cu.size(); + + cu.clear(); // this marks the list as "one time processed". + } + + LAYER_ID_MAP::const_iterator it = m_layerIndices.find( layer.m_name ); + + if( it == m_layerIndices.end() ) + { + wxString error = wxString::Format( + _( "Layer '%s' in file <%s> at line %d, is not in fixed layer hash" ), + GetChars( layer.m_name ), + GetChars( CurSource() ), + CurLineNumber(), + CurOffset() + ); + + THROW_IO_ERROR( error ); + } + + layer.m_number = it->second; + + enabledLayers.set( layer.m_number ); + + if( layer.m_visible ) + visibleLayers.set( layer.m_number ); + + DBG( printf( "aux m_visible:%s\n", layer.m_visible ? "true" : "false" );) + + m_board->SetLayer( LAYER_ID( layer.m_number ), layer ); } - else - { - Expecting( "hide or )" ); - } - - enabledLayers |= GetLayerMask( layerIndex ); - - if( isVisible ) - visibleLayers |= GetLayerMask( layerIndex ); - - m_layerIndices[ name ] = layerIndex; - m_layerMasks[ name ] = GetLayerMask(layerIndex); - - wxString wname = FROM_UTF8( name.c_str() ); - enum LAYER_T layerType = LAYER::ParseType( type.c_str() ); - LAYER layer( wname, layerType, isVisible ); - - layer.SetFixedListIndex( layerIndex ); - m_board->SetLayer( layerIndex, layer ); - -// wxLogDebug( wxT( "Mapping layer %s to index %d" ), GetChars( wname ), layerIndex ); - - if( layerType != LT_UNDEFINED ) - copperLayerCount++; } // We need at least 2 copper layers and there must be an even number of them. - if( (copperLayerCount < 2) || ((copperLayerCount % 2) != 0) ) + if( copperLayerCount < 2 || (copperLayerCount % 2) != 0 ) { wxString err = wxString::Format( _( "%d is not a valid layer count" ), copperLayerCount ); @@ -742,8 +820,10 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR ) } m_board->SetCopperLayerCount( copperLayerCount ); - m_board->SetVisibleLayers( visibleLayers ); m_board->SetEnabledLayers( enabledLayers ); + + // call SetEnabledLayers before SetVisibleLayers() + m_board->SetVisibleLayers( visibleLayers ); } @@ -776,14 +856,14 @@ T PCB_PARSER::lookUpLayer( const M& aMap ) throw( PARSE_ERROR, IO_ERROR ) } -LAYER_NUM PCB_PARSER::parseBoardItemLayer() throw( PARSE_ERROR, IO_ERROR ) +LAYER_ID PCB_PARSER::parseBoardItemLayer() throw( PARSE_ERROR, IO_ERROR ) { wxCHECK_MSG( CurTok() == T_layer, UNDEFINED_LAYER, wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as layer." ) ); NextTok(); - LAYER_NUM layerIndex = lookUpLayer( m_layerIndices ); + LAYER_ID layerIndex = lookUpLayer( m_layerIndices ); // Handle closing ) in object parser. @@ -791,17 +871,17 @@ LAYER_NUM PCB_PARSER::parseBoardItemLayer() throw( PARSE_ERROR, IO_ERROR ) } -LAYER_MSK PCB_PARSER::parseBoardItemLayersAsMask() throw( PARSE_ERROR, IO_ERROR ) +LSET PCB_PARSER::parseBoardItemLayersAsMask() throw( PARSE_ERROR, IO_ERROR ) { - wxCHECK_MSG( CurTok() == T_layers, NO_LAYERS, + wxCHECK_MSG( CurTok() == T_layers, LSET(), wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as item layer mask." ) ); - LAYER_MSK layerMask = NO_LAYERS; + LSET layerMask; for( T token = NextTok(); token != T_RIGHT; token = NextTok() ) { - LAYER_MSK mask = lookUpLayer( m_layerMasks ); + LSET mask = lookUpLayer( m_layerMasks ); layerMask |= mask; } @@ -2195,8 +2275,8 @@ D_PAD* PCB_PARSER::parseD_PAD( MODULE* aParent ) throw( IO_ERROR, PARSE_ERROR ) case T_layers: { - LAYER_MSK layerMask = parseBoardItemLayersAsMask(); - pad->SetLayerMask( layerMask ); + LSET layerMask = parseBoardItemLayersAsMask(); + pad->SetLayerSet( layerMask ); } break; @@ -2366,11 +2446,11 @@ VIA* PCB_PARSER::parseVIA() throw( IO_ERROR, PARSE_ERROR ) case T_layers: { - LAYER_NUM layer1, layer2; + LAYER_ID layer1, layer2; NextTok(); - layer1 = lookUpLayer( m_layerIndices ); + layer1 = lookUpLayer( m_layerIndices ); NextTok(); - layer2 = lookUpLayer( m_layerIndices ); + layer2 = lookUpLayer( m_layerIndices ); via->SetLayerPair( layer1, layer2 ); NeedRIGHT(); } @@ -2407,6 +2487,7 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR ) wxT( " as ZONE_CONTAINER." ) ); CPolyLine::HATCH_STYLE hatchStyle = CPolyLine::NO_HATCH; + int hatchPitch = Mils2iu( CPolyLine::GetDefaultHatchPitchMils() ); wxPoint pt; T token; diff --git a/pcbnew/pcb_parser.h b/pcbnew/pcb_parser.h index 2169bf9ed5..4b223fc62c 100644 --- a/pcbnew/pcb_parser.h +++ b/pcbnew/pcb_parser.h @@ -31,7 +31,7 @@ #include #include -#include // LAYER_NUM +#include // LAYER_ID #include // KiROUND using namespace PCB_KEYS_T; @@ -52,6 +52,7 @@ class PCB_TARGET; class VIA; class S3D_MASTER; class ZONE_CONTAINER; +struct LAYER; /** @@ -61,12 +62,12 @@ class ZONE_CONTAINER; */ class PCB_PARSER : public PCB_LEXER { - typedef boost::unordered_map< std::string, LAYER_NUM > LAYER_NUM_MAP; - typedef boost::unordered_map< std::string, LAYER_MSK > LAYER_MSK_MAP; + typedef boost::unordered_map< std::string, LAYER_ID > LAYER_ID_MAP; + typedef boost::unordered_map< std::string, LSET > LSET_MAP; BOARD* m_board; - LAYER_NUM_MAP m_layerIndices; ///< map layer name to it's index - LAYER_MSK_MAP m_layerMasks; ///< map layer names to their masks + LAYER_ID_MAP m_layerIndices; ///< map layer name to it's index + LSET_MAP m_layerMasks; ///< map layer names to their masks std::vector m_netCodes; ///< net codes mapping for boards being loaded ///> Converts net code using the mapping table if available, @@ -91,7 +92,10 @@ class PCB_PARSER : public PCB_LEXER void parseGeneralSection() throw( IO_ERROR, PARSE_ERROR ); void parsePAGE_INFO() throw( IO_ERROR, PARSE_ERROR ); void parseTITLE_BLOCK() throw( IO_ERROR, PARSE_ERROR ); + void parseLayers() throw( IO_ERROR, PARSE_ERROR ); + void parseLayer( LAYER* aLayer ) throw( IO_ERROR, PARSE_ERROR ); + void parseSetup() throw( IO_ERROR, PARSE_ERROR ); void parseNETINFO_ITEM() throw( IO_ERROR, PARSE_ERROR ); void parseNETCLASS() throw( IO_ERROR, PARSE_ERROR ); @@ -138,7 +142,7 @@ class PCB_PARSER : public PCB_LEXER * @throw PARSE_ERROR if the layer syntax is incorrect. * @return The index the parsed #BOARD_ITEM layer. */ - LAYER_NUM parseBoardItemLayer() throw( IO_ERROR, PARSE_ERROR ); + LAYER_ID parseBoardItemLayer() throw( IO_ERROR, PARSE_ERROR ); /** * Function parseBoardItemLayersAsMask @@ -148,7 +152,7 @@ class PCB_PARSER : public PCB_LEXER * @throw PARSE_ERROR if the layers syntax is incorrect. * @return The mask of layers the parsed #BOARD_ITEM is on. */ - LAYER_MSK parseBoardItemLayersAsMask() throw( PARSE_ERROR, IO_ERROR ); + LSET parseBoardItemLayersAsMask() throw( PARSE_ERROR, IO_ERROR ); /** * Function parseXY diff --git a/pcbnew/pcb_plot_params.cpp b/pcbnew/pcb_plot_params.cpp index e8a1d8e3e0..77a15d112c 100644 --- a/pcbnew/pcb_plot_params.cpp +++ b/pcbnew/pcb_plot_params.cpp @@ -74,10 +74,9 @@ static bool setInt( int* aInt, int aValue, int aMin, int aMax ) // PCB_PLOT_PARAMS -PCB_PLOT_PARAMS::PCB_PLOT_PARAMS() +PCB_PLOT_PARAMS::PCB_PLOT_PARAMS() : + m_layerSelection( 4, B_Cu, F_Cu, F_SilkS, B_SilkS ) { - m_layerSelection = LAYER_BACK | LAYER_FRONT - | SILKSCREEN_LAYER_FRONT | SILKSCREEN_LAYER_BACK; m_useGerberExtensions = true; m_excludeEdgeLayer = true; m_lineWidth = g_DrawDefaultLineThickness; @@ -125,8 +124,10 @@ void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter, const char* trueStr = getTokenName( T_true ); aFormatter->Print( aNestLevel, "(%s\n", getTokenName( T_pcbplotparams ) ); - aFormatter->Print( aNestLevel+1, "(%s %ld)\n", getTokenName( T_layerselection ), - long(m_layerSelection) ); + + aFormatter->Print( aNestLevel+1, "(%s 0x%s)\n", getTokenName( T_layerselection ), + m_layerSelection.FmtHex().c_str() ); + aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_usegerberextensions ), m_useGerberExtensions ? trueStr : falseStr ); aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_excludeedgelayer ), @@ -306,7 +307,8 @@ PCB_PLOT_PARAMS_PARSER::PCB_PLOT_PARAMS_PARSER( char* aLine, const wxString& aSo void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) throw( PARSE_ERROR, IO_ERROR ) { - T token; + T token; + while( ( token = NextTok() ) != T_RIGHT ) { if( token == T_EOF) @@ -321,42 +323,75 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) switch( token ) { case T_layerselection: - token = NextTok(); - if( token != T_NUMBER ) - Expecting( T_NUMBER ); - aPcbPlotParams->m_layerSelection = atol( CurText() ); + { + token = NeedSYMBOLorNUMBER(); + + const std::string& cur = CurStr(); + + if( token == T_NUMBER ) // pretty 3 format had legacy Cu stack. + { + // unsigned legacy_mask = atol( cur.c_str() ); + + /* It's not possible to convert a legacy Cu layer number to a new + Cu layer number without knowing the number or total Cu layers + in the legacy board. We do not have that information here. + So simply set all layers ON. User can turn them off in the UI. + This is one of the superiorities of the new Cu sequence. + aPcbPlotParams->m_layerSelection = LEGACY_PLUGIN::leg_mask2new( cu_count, legacy_mask ); + */ + + // sorry, use the UI once to fix: + aPcbPlotParams->m_layerSelection = LSET( 4, B_Cu, F_Cu, F_SilkS, B_SilkS ); + } + else if( cur.find_first_of( "0x" ) == 0 ) // pretty ver. 4. + { + // skip the leading 2 0x bytes. + aPcbPlotParams->m_layerSelection.ParseHex( cur.c_str()+2, cur.size()-2 ); + } + else + Expecting( "integer or hex layerSelection" ); + } break; + case T_usegerberextensions: aPcbPlotParams->m_useGerberExtensions = parseBool(); break; + case T_psa4output: aPcbPlotParams->m_A4Output = parseBool(); break; + case T_excludeedgelayer: aPcbPlotParams->m_excludeEdgeLayer = parseBool(); break; + case T_linewidth: - { - // Due to a bug, this (minor) parameter was saved in biu - // and now is saved in mm - // If the read value is outside bounds, force a default value - double tmp = parseDouble(); - if( !aPcbPlotParams->SetLineWidth( KiROUND( tmp * IU_PER_MM ) ) ) - aPcbPlotParams->SetLineWidth( PLOT_LINEWIDTH_DEFAULT ); - } + { + // Due to a bug, this (minor) parameter was saved in biu + // and now is saved in mm + // If the read value is outside bounds, force a default value + double tmp = parseDouble(); + if( !aPcbPlotParams->SetLineWidth( KiROUND( tmp * IU_PER_MM ) ) ) + aPcbPlotParams->SetLineWidth( PLOT_LINEWIDTH_DEFAULT ); + } break; + case T_plotframeref: aPcbPlotParams->m_plotFrameRef = parseBool(); break; + case T_viasonmask: aPcbPlotParams->m_plotViaOnMaskLayer = parseBool(); break; + case T_mode: aPcbPlotParams->m_mode = static_cast( parseInt( 0, 2 ) ); break; + case T_useauxorigin: aPcbPlotParams->m_useAuxOrigin = parseBool(); break; + case T_hpglpennumber: aPcbPlotParams->m_HPGLPenNum = parseInt( HPGL_PEN_NUMBER_MIN, HPGL_PEN_NUMBER_MAX ); @@ -376,45 +411,58 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) case T_pscolor: NeedSYMBOL(); // This actually was never used... break; + case T_psnegative: aPcbPlotParams->m_negative = parseBool(); break; + case T_plotreference: aPcbPlotParams->m_plotReference = parseBool(); break; + case T_plotvalue: aPcbPlotParams->m_plotValue = parseBool(); break; + case T_plotothertext: // no more in use: keep for compatibility parseBool(); // skip param value break; + case T_plotinvisibletext: aPcbPlotParams->m_plotInvisibleText = parseBool(); break; + case T_padsonsilk: aPcbPlotParams->m_plotPadsOnSilkLayer= parseBool(); break; + case T_subtractmaskfromsilk: aPcbPlotParams->m_subtractMaskFromSilk = parseBool(); break; + case T_outputformat: aPcbPlotParams->m_format = static_cast( parseInt( PLOT_FIRST_FORMAT, PLOT_LAST_FORMAT ) ); break; + case T_mirror: aPcbPlotParams->m_mirror = parseBool(); break; + case T_drillshape: aPcbPlotParams->m_drillMarks = static_cast ( parseInt( 0, 2 ) ); break; + case T_scaleselection: aPcbPlotParams->m_scaleSelection = parseInt( 0, 4 ); break; + case T_outputdirectory: NeedSYMBOL(); aPcbPlotParams->m_outputDirectory = FROM_UTF8( CurText() ); break; + default: Unexpected( CurText() ); break; diff --git a/pcbnew/pcb_plot_params.h b/pcbnew/pcb_plot_params.h index 60f2b137cc..5a96864993 100644 --- a/pcbnew/pcb_plot_params.h +++ b/pcbnew/pcb_plot_params.h @@ -125,7 +125,7 @@ private: bool m_excludeEdgeLayer; /// Set of layers to plot - LAYER_MSK m_layerSelection; + LSET m_layerSelection; /** When plotting gerbers use a conventional set of extensions instead of * appending a suffix to the board name */ @@ -263,9 +263,8 @@ public: void SetSubtractMaskFromSilk( bool aSubtract ) { m_subtractMaskFromSilk = aSubtract; }; bool GetSubtractMaskFromSilk() const { return m_subtractMaskFromSilk; }; - void SetLayerSelection( long aSelection ) - { m_layerSelection = aSelection; }; - long GetLayerSelection() const { return m_layerSelection; }; + void SetLayerSelection( LSET aSelection ) { m_layerSelection = aSelection; }; + LSET GetLayerSelection() const { return m_layerSelection; }; void SetUseAuxOrigin( bool aAux ) { m_useAuxOrigin = aAux; }; bool GetUseAuxOrigin() const { return m_useAuxOrigin; }; diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index d9f4791969..7fd27d8807 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -52,13 +52,13 @@ #include #include #include -#include #include #include #include #include #include #include +#include #include #include @@ -818,7 +818,7 @@ void PCB_EDIT_FRAME::SetGridColor(EDA_COLOR_T aColor) bool PCB_EDIT_FRAME::IsMicroViaAcceptable() { int copperlayercnt = GetBoard()->GetCopperLayerCount( ); - LAYER_NUM currLayer = GetActiveLayer(); + LAYER_ID currLayer = GetActiveLayer(); if( !GetDesignSettings().m_MicroViasAllowed ) return false; // Obvious.. @@ -826,17 +826,17 @@ bool PCB_EDIT_FRAME::IsMicroViaAcceptable() if( copperlayercnt < 4 ) return false; // Only on multilayer boards.. - if( ( currLayer == LAYER_N_BACK ) - || ( currLayer == LAYER_N_FRONT ) + if( ( currLayer == B_Cu ) + || ( currLayer == F_Cu ) || ( currLayer == copperlayercnt - 2 ) - || ( currLayer == LAYER_N_2 ) ) + || ( currLayer == In1_Cu ) ) return true; return false; } -void PCB_EDIT_FRAME::SetHighContrastLayer( LAYER_NUM aLayer ) +void PCB_EDIT_FRAME::SetHighContrastLayer( LAYER_ID aLayer ) { // Set display settings for high contrast mode KIGFX::VIEW* view = GetGalCanvas()->GetView(); @@ -859,16 +859,16 @@ void PCB_EDIT_FRAME::SetHighContrastLayer( LAYER_NUM aLayer ) ITEM_GAL_LAYER( GP_OVERLAY ), ITEM_GAL_LAYER( RATSNEST_VISIBLE ) }; - for( unsigned int i = 0; i < sizeof( layers ) / sizeof( LAYER_NUM ); ++i ) + for( unsigned i = 0; i < DIM( layers ); ++i ) rSettings->SetActiveLayer( layers[i] ); // Pads should be shown too - if( aLayer == FIRST_COPPER_LAYER ) + if( aLayer == B_Cu ) { rSettings->SetActiveLayer( ITEM_GAL_LAYER( PAD_BK_VISIBLE ) ); rSettings->SetActiveLayer( NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ) ); } - else if( aLayer == LAST_COPPER_LAYER ) + else if( aLayer == F_Cu ) { rSettings->SetActiveLayer( ITEM_GAL_LAYER( PAD_FR_VISIBLE ) ); rSettings->SetActiveLayer( NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ) ); @@ -879,7 +879,7 @@ void PCB_EDIT_FRAME::SetHighContrastLayer( LAYER_NUM aLayer ) } -void PCB_EDIT_FRAME::SetTopLayer( LAYER_NUM aLayer ) +void PCB_EDIT_FRAME::SetTopLayer( LAYER_ID aLayer ) { // Set display settings for high contrast mode KIGFX::VIEW* view = GetGalCanvas()->GetView(); @@ -896,22 +896,22 @@ void PCB_EDIT_FRAME::SetTopLayer( LAYER_NUM aLayer ) GetNetnameLayer( aLayer ), ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ), ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ), ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ), - ITEM_GAL_LAYER( GP_OVERLAY ), ITEM_GAL_LAYER( RATSNEST_VISIBLE ), DRAW_N, + ITEM_GAL_LAYER( GP_OVERLAY ), ITEM_GAL_LAYER( RATSNEST_VISIBLE ), Dwgs_User, ITEM_GAL_LAYER( DRC_VISIBLE ) }; - for( unsigned int i = 0; i < sizeof( layers ) / sizeof( LAYER_NUM ); ++i ) + for( unsigned i = 0; i < DIM( layers ); ++i ) { view->SetTopLayer( layers[i] ); } // Pads should be shown too - if( aLayer == FIRST_COPPER_LAYER ) + if( aLayer == B_Cu ) { view->SetTopLayer( ITEM_GAL_LAYER( PAD_BK_VISIBLE ) ); view->SetTopLayer( NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ) ); } - else if( aLayer == LAST_COPPER_LAYER ) + else if( aLayer == F_Cu ) { view->SetTopLayer( ITEM_GAL_LAYER( PAD_FR_VISIBLE ) ); view->SetTopLayer( NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ) ); @@ -922,7 +922,7 @@ void PCB_EDIT_FRAME::SetTopLayer( LAYER_NUM aLayer ) } -void PCB_EDIT_FRAME::SetActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate ) +void PCB_EDIT_FRAME::SetActiveLayer( LAYER_ID aLayer, bool doLayerWidgetUpdate ) { ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = aLayer; @@ -956,18 +956,18 @@ void PCB_EDIT_FRAME::syncLayerVisibilities() KIGFX::VIEW* view = GetGalCanvas()->GetView(); // Load layer & elements visibility settings - for( LAYER_NUM i = 0; i < NB_LAYERS; ++i ) + for( LAYER_NUM i = 0; i < LAYER_ID_COUNT; ++i ) { - view->SetLayerVisible( i, m_Pcb->IsLayerVisible( i ) ); + view->SetLayerVisible( i, m_Pcb->IsLayerVisible( LAYER_ID( i ) ) ); // Synchronize netname layers as well if( IsCopperLayer( i ) ) - view->SetLayerVisible( GetNetnameLayer( i ), m_Pcb->IsLayerVisible( i ) ); + view->SetLayerVisible( GetNetnameLayer( i ), m_Pcb->IsLayerVisible( LAYER_ID( i ) ) ); } for( LAYER_NUM i = 0; i < END_PCB_VISIBLE_LIST; ++i ) { - view->SetLayerVisible( ITEM_GAL_LAYER( i ), m_Pcb->IsElementVisible( i ) ); + view->SetLayerVisible( ITEM_GAL_LAYER( i ), m_Pcb->IsElementVisible( LAYER_ID( i ) ) ); } // Enable some layers that are GAL specific @@ -1064,9 +1064,18 @@ void PCB_EDIT_FRAME::OnModify( ) void PCB_EDIT_FRAME::SVG_Print( wxCommandEvent& event ) { - DIALOG_SVG_PRINT frame( this ); + PCB_PLOT_PARAMS tmp = GetPlotSettings(); - frame.ShowModal(); + // we don't want dialogs knowing about complex wxFrame functions so + // pass everything the dialog needs without reference to *this frame's class. + if( InvokeSVGPrint( this, GetBoard(), &tmp ) ) + { + if( tmp != GetPlotSettings() ) + { + SetPlotSettings( tmp ); + OnModify(); + } + } } diff --git a/pcbnew/pcbnew.cpp b/pcbnew/pcbnew.cpp index 793a537885..52d119f7ad 100644 --- a/pcbnew/pcbnew.cpp +++ b/pcbnew/pcbnew.cpp @@ -75,8 +75,8 @@ bool g_Track_45_Only_Allowed = true; // True to allow horiz, vert. and 4 bool g_Segments_45_Only; // True to allow horiz, vert. and 45deg only graphic segments bool g_TwoSegmentTrackBuild = true; -LAYER_NUM g_Route_Layer_TOP; -LAYER_NUM g_Route_Layer_BOTTOM; +LAYER_ID g_Route_Layer_TOP; +LAYER_ID g_Route_Layer_BOTTOM; int g_MaxLinksShowed; int g_MagneticPadOption = capture_cursor_in_track_tool; int g_MagneticTrackOption = capture_cursor_in_track_tool; diff --git a/pcbnew/pcbnew.h b/pcbnew/pcbnew.h index d2c6427ea6..59bdcbe799 100644 --- a/pcbnew/pcbnew.h +++ b/pcbnew/pcbnew.h @@ -27,7 +27,7 @@ /// Flag used in locate routines (from which endpoint work) enum ENDPOINT_T { - ENDPOINT_START = 0, + ENDPOINT_START = 0, ENDPOINT_END = 1 }; @@ -39,7 +39,7 @@ enum ENDPOINT_T { #define TEXTS_MAX_WIDTH DMils2iu( 5000 ) ///< Maximum text width in Pcbnew units value (0.5 inches) -/* Flag to force the SKETCH mode to display items (.m_Flags member) */ +// Flag to force the SKETCH mode to display items (.m_Flags member) #define FORCE_SKETCH ( IS_DRAGGED | IN_EDIT ) /* Name of the document footprint list @@ -50,26 +50,26 @@ enum ENDPOINT_T { */ extern wxString g_DocModulesFileName; -/* variables */ -extern bool g_Drc_On; -extern bool g_AutoDeleteOldTrack; -extern bool g_Show_Module_Ratsnest; -extern bool g_Raccord_45_Auto; -extern bool g_Track_45_Only_Allowed; -extern bool g_Alternate_Track_Posture; -extern bool g_Segments_45_Only; +// variables +extern bool g_Drc_On; +extern bool g_AutoDeleteOldTrack; +extern bool g_Show_Module_Ratsnest; +extern bool g_Raccord_45_Auto; +extern bool g_Track_45_Only_Allowed; +extern bool g_Alternate_Track_Posture; +extern bool g_Segments_45_Only; -/* Layer pair for auto routing and switch layers by hotkey */ -extern LAYER_NUM g_Route_Layer_TOP; -extern LAYER_NUM g_Route_Layer_BOTTOM; +// Layer pair for auto routing and switch layers by hotkey +extern LAYER_ID g_Route_Layer_TOP; +extern LAYER_ID g_Route_Layer_BOTTOM; -extern int g_MaxLinksShowed; // Max count links showed in routing -extern bool g_TwoSegmentTrackBuild; +extern int g_MaxLinksShowed; // Max count links showed in routing +extern bool g_TwoSegmentTrackBuild; -extern int g_MagneticPadOption; -extern int g_MagneticTrackOption; +extern int g_MagneticPadOption; +extern int g_MagneticTrackOption; -extern wxPoint g_Offset_Module; /* Offset trace when moving footprint. */ +extern wxPoint g_Offset_Module; // Offset trace when moving footprint. enum MagneticPadOptionValues { no_effect, @@ -78,4 +78,4 @@ enum MagneticPadOptionValues { }; -#endif /* PCBNEW_H */ +#endif // PCBNEW_H diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index 45ee46192e..e6c4b9c5e5 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -90,7 +90,21 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event ) case ID_PCB_LAYERS_SETUP: - InstallDialogLayerSetup(); + if( InvokeLayerSetup( this, GetBoard() ) ) + { + LAYER_ID cur_layer = GetActiveLayer(); + + // If after showing the dialog the user removed the active layer, + // then use a sensible alternative layer to set as the active layer. + if( !GetBoard()->GetEnabledLayers()[ cur_layer ] ) + cur_layer = F_Cu; + + SetActiveLayer( cur_layer, true ); + + OnModify(); + ReCreateLayerBox(); + ReFillLayerWidget(); + } break; case ID_PCB_LIB_TABLE_EDIT: @@ -312,151 +326,97 @@ PARAM_CFG_ARRAY PCB_EDIT_FRAME::GetProjectFileParameters() PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings() { - if( !m_configSettings.empty() ) - return m_configSettings; + if( m_configSettings.empty() ) + { + COLORS_DESIGN_SETTINGS cds; // constructor fills this with sensible colors - // Units used in dialogs and toolbars - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ), - (int*)&g_UserUnit, MILLIMETRES ) ); + // Units used in dialogs and toolbars + m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ), + (int*)&g_UserUnit, MILLIMETRES ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "DisplayPolarCoords" ), - &DisplayOpt.DisplayPolarCood, false ) ); - // Display options and modes: - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "ViaHoleDisplayMode" ), - (int*) &DisplayOpt.m_DisplayViaMode, - VIA_SPECIAL_HOLE_SHOW, VIA_HOLE_NOT_SHOW, - OPT_VIA_HOLE_END - 1 ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "ShowNetNamesMode" ), - &DisplayOpt.DisplayNetNamesMode, 3, 0, 3 ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "DisplayTrackFilled" ), - &DisplayOpt.DisplayPcbTrackFill, true ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "TrackDisplayClearance" ), - (int*) &DisplayOpt.ShowTrackClearanceMode, - SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PadFill" ), - &DisplayOpt.DisplayPadFill, true ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "ViaFill" ), - &DisplayOpt.DisplayViaFill, true ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PadAffG" ), - &DisplayOpt.DisplayPadIsol, true ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PadSNum" ), - &DisplayOpt.DisplayPadNum, true ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "ModAffC" ), - &DisplayOpt.DisplayModEdge, FILLED, 0, 2 ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "ModAffT" ), - &DisplayOpt.DisplayModText, FILLED, 0, 2 ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "PcbAffT" ), - &DisplayOpt.DisplayDrawItems, FILLED, 0, 2 ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "PcbShowZonesMode" ), - &DisplayOpt.DisplayZonesMode, 0, 0, 2 ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "DisplayPolarCoords" ), + &DisplayOpt.DisplayPolarCood, false ) ); + // Display options and modes: + m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "ViaHoleDisplayMode" ), + (int*) &DisplayOpt.m_DisplayViaMode, + VIA_SPECIAL_HOLE_SHOW, VIA_HOLE_NOT_SHOW, + OPT_VIA_HOLE_END - 1 ) ); + m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "ShowNetNamesMode" ), + &DisplayOpt.DisplayNetNamesMode, 3, 0, 3 ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "DisplayTrackFilled" ), + &DisplayOpt.DisplayPcbTrackFill, true ) ); + m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "TrackDisplayClearance" ), + (int*) &DisplayOpt.ShowTrackClearanceMode, + SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PadFill" ), + &DisplayOpt.DisplayPadFill, true ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "ViaFill" ), + &DisplayOpt.DisplayViaFill, true ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PadAffG" ), + &DisplayOpt.DisplayPadIsol, true ) ); + m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PadSNum" ), + &DisplayOpt.DisplayPadNum, true ) ); + m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "ModAffC" ), + &DisplayOpt.DisplayModEdge, FILLED, 0, 2 ) ); + m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "ModAffT" ), + &DisplayOpt.DisplayModText, FILLED, 0, 2 ) ); + m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "PcbAffT" ), + &DisplayOpt.DisplayDrawItems, FILLED, 0, 2 ) ); + m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "PcbShowZonesMode" ), + &DisplayOpt.DisplayZonesMode, 0, 0, 2 ) ); - // Colors: - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer0Ex" ), LOC_COLOR( 0 ), - GREEN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer1Ex" ), LOC_COLOR( 1 ), - BLUE ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer2Ex" ), LOC_COLOR( 2 ), - LIGHTGRAY ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer3Ex" ), LOC_COLOR( 3 ), - MAGENTA ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer4Ex" ), LOC_COLOR( 4 ), - RED ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer5Ex" ), LOC_COLOR( 5 ), - MAGENTA ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer6Ex" ), LOC_COLOR( 6 ), - BROWN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer7Ex" ), LOC_COLOR( 7 ), - MAGENTA ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer8Ex" ), LOC_COLOR( 8 ), - LIGHTGRAY ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer9Ex" ), LOC_COLOR( 9 ), - BLUE ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer10Ex" ), LOC_COLOR( 10 ), - GREEN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer11Ex" ), LOC_COLOR( 11 ), - CYAN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer12Ex" ), LOC_COLOR( 12 ), - LIGHTRED ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer13Ex" ), LOC_COLOR( 13 ), - LIGHTMAGENTA ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer14Ex" ), LOC_COLOR( 14 ), - YELLOW ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer15Ex" ), LOC_COLOR( 15 ), - RED ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer16Ex" ), LOC_COLOR( 16 ), - BLUE ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer17Ex" ), LOC_COLOR( 17 ), - MAGENTA ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer18Ex" ), LOC_COLOR( 18 ), - LIGHTCYAN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer19Ex" ), LOC_COLOR( 19 ), - RED ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer20Ex" ), LOC_COLOR( 20 ), - MAGENTA ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer21Ex" ), LOC_COLOR( 21 ), - CYAN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer22Ex" ), LOC_COLOR( 22 ), - BROWN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer23Ex" ), LOC_COLOR( 23 ), - MAGENTA ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer24Ex" ), LOC_COLOR( 24 ), - LIGHTGRAY ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer25Ex" ), LOC_COLOR( 25 ), - BLUE ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer26Ex" ), LOC_COLOR( 26 ), - GREEN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer27Ex" ), LOC_COLOR( 27 ), - YELLOW ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer28Ex" ), LOC_COLOR( 28 ), - YELLOW ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer29Ex" ), LOC_COLOR( 29 ), - LIGHTMAGENTA ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer30Ex" ), LOC_COLOR( 30 ), - YELLOW ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer31Ex" ), LOC_COLOR( 31 ), - LIGHTGRAY ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorTxtFrontEx" ), - ITEM_COLOR( MOD_TEXT_FR_VISIBLE ), - LIGHTGRAY ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorTxtBackEx" ), - ITEM_COLOR( MOD_TEXT_BK_VISIBLE ), - BLUE ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorTxtInvisEx" ), - ITEM_COLOR( MOD_TEXT_INVISIBLE ), - DARKGRAY ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorAnchorEx" ), - ITEM_COLOR( ANCHOR_VISIBLE ), BLUE ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPadBackEx" ), - ITEM_COLOR( PAD_BK_VISIBLE ), GREEN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPadFrontEx" ), - ITEM_COLOR( PAD_FR_VISIBLE ), RED ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorViaThruEx" ), - ITEM_COLOR( VIA_THROUGH_VISIBLE ), - LIGHTGRAY ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorViaBBlindEx" ), - ITEM_COLOR( VIA_BBLIND_VISIBLE ), - BROWN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorViaMicroEx" ), - ITEM_COLOR( VIA_MICROVIA_VISIBLE ), - CYAN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNonPlatedEx" ), - ITEM_COLOR( NON_PLATED_VISIBLE ), - YELLOW ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorRatsEx" ), - ITEM_COLOR( RATSNEST_VISIBLE ), - WHITE ) ); + // layer colors: + for( int i = 0; i -wxString GetGerberExtension( LAYER_NUM layer ) +const wxString GetGerberExtension( LAYER_NUM aLayer ) { - switch( layer ) + if( IsCopperLayer( aLayer ) ) { - case LAYER_N_FRONT: - return wxString( wxT( "gtl" ) ); + if( aLayer == F_Cu ) + return wxT( "gtl" ); + else if( aLayer == B_Cu ) + return wxT( "gbl" ); + else + { + return wxT( "gbr" ); + } + } + else + { + switch( aLayer ) + { + case B_Adhes: return wxT( "gba" ); + case F_Adhes: return wxT( "gta" ); - case LAYER_N_2: - case LAYER_N_3: - case LAYER_N_4: - case LAYER_N_5: - case LAYER_N_6: - case LAYER_N_7: - case LAYER_N_8: - case LAYER_N_9: - case LAYER_N_10: - case LAYER_N_11: - case LAYER_N_12: - case LAYER_N_13: - case LAYER_N_14: - case LAYER_N_15: + case B_Paste: return wxT( "gbp" ); + case F_Paste: return wxT( "gtp" ); - // TODO: see if we use .gbr or a layer identifier (gb1 .. gbnn ?) - // according to the new internal layers designation - // (1 is the first internal layer from the front layer) - return wxString( wxT( "gbr" ) ); + case B_SilkS: return wxT( "gbo" ); + case F_SilkS: return wxT( "gto" ); - case LAYER_N_BACK: - return wxString( wxT( "gbl" ) ); + case B_Mask: return wxT( "gbs" ); + case F_Mask: return wxT( "gts" ); - case ADHESIVE_N_BACK: - return wxString( wxT( "gba" ) ); - - case ADHESIVE_N_FRONT: - return wxString( wxT( "gta" ) ); - - case SOLDERPASTE_N_BACK: - return wxString( wxT( "gbp" ) ); - - case SOLDERPASTE_N_FRONT: - return wxString( wxT( "gtp" ) ); - - case SILKSCREEN_N_BACK: - return wxString( wxT( "gbo" ) ); - - case SILKSCREEN_N_FRONT: - return wxString( wxT( "gto" ) ); - - case SOLDERMASK_N_BACK: - return wxString( wxT( "gbs" ) ); - - case SOLDERMASK_N_FRONT: - return wxString( wxT( "gts" ) ); - - case DRAW_N: - case COMMENT_N: - case ECO1_N: - case ECO2_N: - case EDGE_N: - default: - return wxString( wxT( "gbr" ) ); + case Dwgs_User: + case Cmts_User: + case Eco1_User: + case Eco2_User: + case Edge_Cuts: + default: return wxT( "gbr" ); + } } } diff --git a/pcbnew/pcbplot.h b/pcbnew/pcbplot.h index 50c607e25f..51ef72342f 100644 --- a/pcbnew/pcbplot.h +++ b/pcbnew/pcbplot.h @@ -69,16 +69,15 @@ class REPORTER; // A helper class to plot board items -class BRDITEMS_PLOTTER: public PCB_PLOT_PARAMS +class BRDITEMS_PLOTTER : public PCB_PLOT_PARAMS { - PLOTTER* m_plotter; - BOARD* m_board; - int m_layerMask; - + PLOTTER* m_plotter; + BOARD* m_board; + LSET m_layerMask; public: - BRDITEMS_PLOTTER( PLOTTER* aPlotter, BOARD* aBoard, const PCB_PLOT_PARAMS& aPlotOpts ) - : PCB_PLOT_PARAMS( aPlotOpts ) + BRDITEMS_PLOTTER( PLOTTER* aPlotter, BOARD* aBoard, const PCB_PLOT_PARAMS& aPlotOpts ) : + PCB_PLOT_PARAMS( aPlotOpts ) { m_plotter = aPlotter; m_board = aBoard; @@ -99,7 +98,7 @@ public: } // Basic functions to plot a board item - void SetLayerMask( int aLayerMask ){ m_layerMask = aLayerMask; } + void SetLayerSet( LSET aLayerMask ) { m_layerMask = aLayerMask; } void Plot_Edges_Modules(); void Plot_1_EdgeModule( EDGE_MODULE* aEdge ); void PlotTextModule( TEXTE_MODULE* aTextMod, EDA_COLOR_T aColor ); @@ -201,7 +200,7 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, LAYER_NUM aLayer, * SetDrillMarksType( DrillMarksType aVal ) controle the actual hole: * no hole, small hole, actual hole */ -void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LAYER_MSK aLayerMask, +void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt ); /** @@ -213,7 +212,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LAYER_MSK aLayerMask, * @param aPlotOpt = the plot options. Has meaning for some formats only */ void PlotLayerOutlines( BOARD *aBoard, PLOTTER* aPlotter, - LAYER_MSK aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt ); + LSET aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt ); /** * Function PlotSilkScreen @@ -224,7 +223,7 @@ void PlotLayerOutlines( BOARD *aBoard, PLOTTER* aPlotter, * @param aLayerMask = the mask to define the layers to plot (silkscreen Front and/or Back) * @param aPlotOpt = the plot options (files, sketch). Has meaning for some formats only */ -void PlotSilkScreen( BOARD* aBoard, PLOTTER* aPlotter, LAYER_MSK aLayerMask, +void PlotSilkScreen( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt ); @@ -263,7 +262,7 @@ void BuildPlotFileName( wxFileName* aFilename, * Function GetGerberExtension * @return the appropriate Gerber file extension for \a aLayer */ -extern wxString GetGerberExtension( LAYER_NUM aLayer ); +const wxString GetGerberExtension( LAYER_NUM aLayer ); // PLOTGERB.CPP diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index a0d05647b1..083be5d1b7 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -58,18 +58,18 @@ * unless the minimum thickness is 0. */ static void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, - LAYER_MSK aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt, + LSET aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt, int aMinThickness ); /* Creates the plot for silkscreen layers * Silkscreen layers have specific requirement for pads (not filled) and texts * (with option to remove them from some copper areas (pads...) */ -void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, LAYER_MSK aLayerMask, +void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt ) { BRDITEMS_PLOTTER itemplotter( aPlotter, aBoard, aPlotOpt ); - itemplotter.SetLayerMask( aLayerMask ); + itemplotter.SetLayerSet( aLayerMask ); // Plot edge layer and graphic items itemplotter.PlotBoardGraphicItems(); @@ -78,29 +78,31 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, LAYER_MSK aLayerMask, itemplotter.Plot_Edges_Modules(); // Plot pads (creates pads outlines, for pads on silkscreen layers) - int layersmask_plotpads = aLayerMask; + LSET layersmask_plotpads = aLayerMask; + // Calculate the mask layers of allowed layers for pads if( !aPlotOpt.GetPlotPadsOnSilkLayer() ) // Do not plot pads on silk screen layers - layersmask_plotpads &= ~(SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT ); + layersmask_plotpads.set( B_SilkS, false ).set( F_SilkS, false ); - if( layersmask_plotpads ) + if( layersmask_plotpads.any() ) { for( MODULE* Module = aBoard->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() ) { // See if the pad is on this layer - LAYER_MSK masklayer = pad->GetLayerMask(); - if( (masklayer & layersmask_plotpads) == 0 ) + LSET masklayer = pad->GetLayerSet(); + if( !( masklayer & layersmask_plotpads ).any() ) continue; - EDA_COLOR_T color = ColorFromInt(0); - if( (layersmask_plotpads & SILKSCREEN_LAYER_BACK) ) - color = aBoard->GetLayerColor( SILKSCREEN_N_BACK ); + EDA_COLOR_T color = ColorFromInt( 0 ); - if((layersmask_plotpads & SILKSCREEN_LAYER_FRONT ) ) - color = ColorFromInt( color | aBoard->GetLayerColor( SILKSCREEN_N_FRONT ) ); + if( layersmask_plotpads[B_SilkS] ) + color = aBoard->GetLayerColor( B_SilkS ); + + if( layersmask_plotpads[F_SilkS] ) + color = ColorFromInt( color | aBoard->GetLayerColor( F_SilkS ) ); itemplotter.PlotPad( pad, color, LINE ); } @@ -122,7 +124,7 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, LAYER_MSK aLayerMask, { ZONE_CONTAINER* edge_zone = aBoard->GetArea( ii ); - if( ( GetLayerMask( edge_zone->GetLayer() ) & aLayerMask ) == 0 ) + if( !aLayerMask[ edge_zone->GetLayer() ] ) continue; itemplotter.PlotFilledAreas( edge_zone ); @@ -130,9 +132,9 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, LAYER_MSK aLayerMask, // Plot segments used to fill zone areas (outdated, but here for old boards // compatibility): - for( SEGZONE* seg = aBoard->m_Zone; seg != NULL; seg = seg->Next() ) + for( SEGZONE* seg = aBoard->m_Zone; seg; seg = seg->Next() ) { - if( ( GetLayerMask( seg->GetLayer() ) & aLayerMask ) == 0 ) + if( !aLayerMask[ seg->GetLayer() ] ) continue; aPlotter->ThickSegment( seg->GetStart(), seg->GetEnd(), seg->GetWidth(), @@ -152,29 +154,13 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, LAYER_NUM aLayer, // Specify that the contents of the "Edges Pcb" layer are to be plotted // in addition to the contents of the currently specified layer. - LAYER_MSK layer_mask = GetLayerMask( aLayer ); + LSET layer_mask( aLayer ); if( !aPlotOpt.GetExcludeEdgeLayer() ) - layer_mask |= EDGE_LAYER; + layer_mask.set( Edge_Cuts ); - switch( aLayer ) + if( IsCopperLayer( aLayer ) ) { - case FIRST_COPPER_LAYER: - case LAYER_N_2: - case LAYER_N_3: - case LAYER_N_4: - case LAYER_N_5: - case LAYER_N_6: - case LAYER_N_7: - case LAYER_N_8: - case LAYER_N_9: - case LAYER_N_10: - case LAYER_N_11: - case LAYER_N_12: - case LAYER_N_13: - case LAYER_N_14: - case LAYER_N_15: - case LAST_COPPER_LAYER: // Skip NPTH pads on copper layers ( only if hole size == pad size ): // Drill mark will be plotted, // if drill mark is SMALL_DRILL_SHAPE or FULL_DRILL_SHAPE @@ -188,68 +174,74 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, LAYER_NUM aLayer, plotOpt.SetSkipPlotNPTH_Pads( true ); PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt ); } - break; - - case SOLDERMASK_N_BACK: - case SOLDERMASK_N_FRONT: - plotOpt.SetSkipPlotNPTH_Pads( false ); - // Disable plot pad holes - plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE ); - - // Plot solder mask: - if( soldermask_min_thickness == 0 ) + } + else + { + switch( aLayer ) { + case B_Mask: + case F_Mask: + plotOpt.SetSkipPlotNPTH_Pads( false ); + // Disable plot pad holes + plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE ); + + // Plot solder mask: + if( soldermask_min_thickness == 0 ) + { + if( plotOpt.GetFormat() == PLOT_FORMAT_DXF ) + PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt ); + else + PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt ); + } + else + PlotSolderMaskLayer( aBoard, aPlotter, layer_mask, plotOpt, + soldermask_min_thickness ); + + break; + + case B_Paste: + case F_Paste: + plotOpt.SetSkipPlotNPTH_Pads( false ); + // Disable plot pad holes + plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE ); + if( plotOpt.GetFormat() == PLOT_FORMAT_DXF ) PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt ); else PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt ); - } - else - PlotSolderMaskLayer( aBoard, aPlotter, layer_mask, plotOpt, - soldermask_min_thickness ); + break; - break; - - case SOLDERPASTE_N_BACK: - case SOLDERPASTE_N_FRONT: - plotOpt.SetSkipPlotNPTH_Pads( false ); - // Disable plot pad holes - plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE ); - - if( plotOpt.GetFormat() == PLOT_FORMAT_DXF ) - PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt ); - else - PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt ); - break; - - case SILKSCREEN_N_FRONT: - case SILKSCREEN_N_BACK: - if( plotOpt.GetFormat() == PLOT_FORMAT_DXF ) - PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt ); - else - PlotSilkScreen( aBoard, aPlotter, layer_mask, plotOpt ); - - // Gerber: Subtract soldermask from silkscreen if enabled - if( aPlotter->GetPlotterType() == PLOT_FORMAT_GERBER - && plotOpt.GetSubtractMaskFromSilk() ) - { - if( aLayer == SILKSCREEN_N_FRONT ) - layer_mask = GetLayerMask( SOLDERMASK_N_FRONT ); + case F_SilkS: + case B_SilkS: + if( plotOpt.GetFormat() == PLOT_FORMAT_DXF ) + PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt ); else - layer_mask = GetLayerMask( SOLDERMASK_N_BACK ); + PlotSilkScreen( aBoard, aPlotter, layer_mask, plotOpt ); - // Create the mask to subtract by creating a negative layer polarity - aPlotter->SetLayerPolarity( false ); - // Disable plot pad holes - plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE ); - // Plot the mask - PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt ); + // Gerber: Subtract soldermask from silkscreen if enabled + if( aPlotter->GetPlotterType() == PLOT_FORMAT_GERBER + && plotOpt.GetSubtractMaskFromSilk() ) + { + if( aLayer == F_SilkS ) + layer_mask = LSET( F_Mask ); + else + layer_mask = LSET( B_Mask ); + + // Create the mask to subtract by creating a negative layer polarity + aPlotter->SetLayerPolarity( false ); + + // Disable plot pad holes + plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE ); + + // Plot the mask + PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt ); + } + break; + + default: + PlotSilkScreen( aBoard, aPlotter, layer_mask, plotOpt ); + break; } - break; - - default: - PlotSilkScreen( aBoard, aPlotter, layer_mask, plotOpt ); - break; } } @@ -258,11 +250,11 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, LAYER_NUM aLayer, * Silk screen layers are not plotted here. */ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, - LAYER_MSK aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt ) + LSET aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt ) { - BRDITEMS_PLOTTER itemplotter( aPlotter, aBoard, aPlotOpt ); - itemplotter.SetLayerMask( aLayerMask ); + + itemplotter.SetLayerSet( aLayerMask ); EDA_DRAW_MODE_T plotMode = aPlotOpt.GetMode(); @@ -286,7 +278,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, { for( BOARD_ITEM* item = module->GraphicalItems(); item; item = item->Next() ) { - if( ! (aLayerMask & GetLayerMask( item->GetLayer() ) ) ) + if( !aLayerMask[ item->GetLayer() ] ) continue; switch( item->Type() ) @@ -306,32 +298,45 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, { for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() ) { - if( (pad->GetLayerMask() & aLayerMask) == 0 ) + if( (pad->GetLayerSet() & aLayerMask) == 0 ) continue; wxSize margin; double width_adj = 0; - if( aLayerMask & ALL_CU_LAYERS ) + if( ( aLayerMask & LSET::AllCuMask() ).any() ) width_adj = itemplotter.getFineWidthAdj(); +#if 0 // was: switch( aLayerMask & ( SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT | SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT ) ) { case SOLDERMASK_LAYER_FRONT: case SOLDERMASK_LAYER_BACK: - margin.x = margin.y = pad->GetSolderMaskMargin(); break; case SOLDERPASTE_LAYER_FRONT: case SOLDERPASTE_LAYER_BACK: - margin = pad->GetSolderPasteMargin(); break; default: break; } +#else + static const LSET speed( 4, B_Mask, F_Mask, B_Paste, F_Paste ); + + LSET anded = ( speed & aLayerMask ); + + if( anded == LSET( F_Mask ) || anded == LSET( B_Mask ) ) + { + margin.x = margin.y = pad->GetSolderMaskMargin(); + } + else if( anded == LSET( F_Paste ) || anded == LSET( B_Paste ) ) + { + margin = pad->GetSolderPasteMargin(); + } +#endif wxSize padPlotsSize; padPlotsSize.x = pad->GetSize().x + ( 2 * margin.x ) + width_adj; @@ -343,10 +348,10 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, EDA_COLOR_T color = BLACK; - if( (pad->GetLayerMask() & LAYER_BACK) ) + if( pad->GetLayerSet()[B_Cu] ) color = aBoard->GetVisibleElementColor( PAD_BK_VISIBLE ); - if((pad->GetLayerMask() & LAYER_FRONT ) ) + if( pad->GetLayerSet()[F_Cu] ) color = ColorFromInt( color | aBoard->GetVisibleElementColor( PAD_FR_VISIBLE ) ); // Temporary set the pad size to the required plot size: @@ -385,18 +390,18 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, // vias are not plotted if not on selected layer, but if layer // is SOLDERMASK_LAYER_BACK or SOLDERMASK_LAYER_FRONT,vias are drawn, // only if they are on the corresponding external copper layer - int via_mask_layer = Via->GetLayerMask(); + LSET via_mask_layer = Via->GetLayerSet(); if( aPlotOpt.GetPlotViaOnMaskLayer() ) { - if( via_mask_layer & LAYER_BACK ) - via_mask_layer |= SOLDERMASK_LAYER_BACK; + if( via_mask_layer[B_Cu] ) + via_mask_layer.set( B_Mask ); - if( via_mask_layer & LAYER_FRONT ) - via_mask_layer |= SOLDERMASK_LAYER_FRONT; + if( via_mask_layer[F_Cu] ) + via_mask_layer.set( F_Mask ); } - if( ( via_mask_layer & aLayerMask ) == 0 ) + if( !( via_mask_layer & aLayerMask ).any() ) continue; int via_margin = 0; @@ -404,10 +409,10 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, // If the current layer is a solder mask, use the global mask // clearance for vias - if( ( aLayerMask & ( SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT ) ) ) + if( aLayerMask[B_Mask] || aLayerMask[F_Mask] ) via_margin = aBoard->GetDesignSettings().m_SolderMaskMargin; - if( aLayerMask & ALL_CU_LAYERS ) + if( ( aLayerMask & LSET::AllCuMask() ).any() ) width_adj = itemplotter.getFineWidthAdj(); int diameter = Via->GetWidth() + 2 * via_margin + width_adj; @@ -429,7 +434,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, if( track->Type() == PCB_VIA_T ) continue; - if( (GetLayerMask( track->GetLayer() ) & aLayerMask) == 0 ) + if( !aLayerMask[track->GetLayer()] ) continue; int width = track->GetWidth() + itemplotter.getFineWidthAdj(); @@ -440,7 +445,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, // Plot zones (outdated, for old boards compatibility): for( TRACK* track = aBoard->m_Zone; track; track = track->Next() ) { - if( (GetLayerMask( track->GetLayer() ) & aLayerMask) == 0 ) + if( !aLayerMask[track->GetLayer()] ) continue; int width = track->GetWidth() + itemplotter.getFineWidthAdj(); @@ -453,7 +458,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, { ZONE_CONTAINER* zone = aBoard->GetArea( ii ); - if( ( GetLayerMask(zone->GetLayer() ) & aLayerMask ) == 0 ) + if( !aLayerMask[zone->GetLayer()] ) continue; itemplotter.PlotFilledAreas( zone ); @@ -464,24 +469,81 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, itemplotter.PlotDrillMarks(); } + +// Seems like we want to plot from back to front? +static const LAYER_ID plot_seq[] = { + + B_Adhes, // 32 + F_Adhes, + B_Paste, + F_Paste, + B_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, + + B_Cu, + In30_Cu, + In29_Cu, + In28_Cu, + In27_Cu, + In26_Cu, + In25_Cu, + In24_Cu, + In23_Cu, + In22_Cu, + In21_Cu, + In20_Cu, + In19_Cu, + In18_Cu, + In17_Cu, + In16_Cu, + In15_Cu, + In14_Cu, + In13_Cu, + In12_Cu, + In11_Cu, + In10_Cu, + In9_Cu, + In8_Cu, + In7_Cu, + In6_Cu, + In5_Cu, + In4_Cu, + In3_Cu, + In2_Cu, + In1_Cu, + F_Cu, + + F_SilkS, +}; + + /* Plot outlines of copper, for copper layer */ #include "clipper.hpp" void PlotLayerOutlines( BOARD *aBoard, PLOTTER* aPlotter, - LAYER_MSK aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt ) + LSET aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt ) { BRDITEMS_PLOTTER itemplotter( aPlotter, aBoard, aPlotOpt ); - itemplotter.SetLayerMask( aLayerMask ); + itemplotter.SetLayerSet( aLayerMask ); CPOLYGONS_LIST outlines; - for( LAYER_NUM layer = FIRST_LAYER; layer < NB_PCB_LAYERS; layer++ ) + for( LSEQ seq = aLayerMask.Seq( plot_seq, DIM( plot_seq ) ); seq; ++seq ) { - LAYER_MSK layer_mask = GetLayerMask( layer ); - - if( (aLayerMask & layer_mask ) == 0 ) - continue; + LAYER_ID layer = *seq; outlines.RemoveAllContours(); aBoard->ConvertBrdLayerToPolygonalContours( layer, outlines ); @@ -592,15 +654,14 @@ void PlotLayerOutlines( BOARD *aBoard, PLOTTER* aPlotter, * (shapes will be better, and calculations faster) */ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, - LAYER_MSK aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt, + LSET aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt, int aMinThickness ) { - LAYER_NUM layer = ( aLayerMask & SOLDERMASK_LAYER_BACK ) ? - SOLDERMASK_N_BACK : SOLDERMASK_N_FRONT; - int inflate = aMinThickness/2; + LAYER_ID layer = aLayerMask[B_Mask] ? B_Mask : F_Mask; + int inflate = aMinThickness/2; BRDITEMS_PLOTTER itemplotter( aPlotter, aBoard, aPlotOpt ); - itemplotter.SetLayerMask( aLayerMask ); + itemplotter.SetLayerSet( aLayerMask ); // Plot edge layer and graphic items itemplotter.PlotBoardGraphicItems(); @@ -661,6 +722,7 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, // use the global mask clearance for vias int via_clearance = aBoard->GetDesignSettings().m_SolderMaskMargin; int via_margin = via_clearance + inflate; + for( TRACK* track = aBoard->m_Track; track; track = track->Next() ) { const VIA* via = dyn_cast( track ); @@ -670,15 +732,15 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, // vias are plotted only if they are on the corresponding // external copper layer - LAYER_MSK via_mask_layer = via->GetLayerMask(); + LSET via_set = via->GetLayerSet(); - if( via_mask_layer & LAYER_BACK ) - via_mask_layer |= SOLDERMASK_LAYER_BACK; + if( via_set[B_Cu] ) + via_set.set( B_Mask ); - if( via_mask_layer & LAYER_FRONT ) - via_mask_layer |= SOLDERMASK_LAYER_FRONT; + if( via_set[F_Cu] ) + via_set.set( F_Mask ); - if( ( via_mask_layer & aLayerMask ) == 0 ) + if( !( via_set & aLayerMask ).any() ) continue; via->TransformShapeWithClearanceToPolygon( bufferPolys, via_margin, diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index 41f8574cd9..f806648dd1 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -57,7 +57,7 @@ EDA_COLOR_T BRDITEMS_PLOTTER::getColor( LAYER_NUM aLayer ) { - EDA_COLOR_T color = m_board->GetLayerColor( aLayer ); + EDA_COLOR_T color = m_board->GetLayerColor( (LAYER_ID) aLayer ); if (color == WHITE) color = LIGHTGRAY; return color; @@ -110,10 +110,10 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule ) TEXTE_MODULE* textModule = &aModule->Reference(); LAYER_NUM textLayer = textModule->GetLayer(); - if( textLayer >= NB_LAYERS ) + if( textLayer >= LAYER_ID_COUNT ) // how will this ever be true? return false; - if( ( GetLayerMask( textLayer ) & m_layerMask ) == 0 ) + if( !m_layerMask[textLayer] ) trace_ref = false; if( !textModule->IsVisible() && !GetPlotInvisibleText() ) @@ -122,10 +122,10 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule ) textModule = &aModule->Value(); textLayer = textModule->GetLayer(); - if( textLayer > NB_LAYERS ) + if( textLayer > LAYER_ID_COUNT ) // how will this ever be true? return false; - if( ( GetLayerMask( textLayer ) & m_layerMask ) == 0 ) + if( !m_layerMask[textLayer] ) trace_val = false; if( !textModule->IsVisible() && !GetPlotInvisibleText() ) @@ -148,8 +148,7 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule ) PlotTextModule( &aModule->Value(), GetValueColor() ); } - for( BOARD_ITEM *item = aModule->GraphicalItems().GetFirst(); - item != NULL; item = item->Next() ) + for( BOARD_ITEM *item = aModule->GraphicalItems().GetFirst(); item; item = item->Next() ) { textModule = dyn_cast( item ); @@ -161,10 +160,10 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule ) textLayer = textModule->GetLayer(); - if( textLayer >= NB_LAYERS ) + if( textLayer >= LAYER_ID_COUNT ) return false; - if( !( GetLayerMask( textLayer ) & m_layerMask ) ) + if( !m_layerMask[textLayer] ) continue; PlotTextModule( textModule, getColor( textLayer ) ); @@ -246,7 +245,7 @@ void BRDITEMS_PLOTTER::PlotTextModule( TEXTE_MODULE* pt_texte, EDA_COLOR_T aColo void BRDITEMS_PLOTTER::PlotDimension( DIMENSION* aDim ) { - if( (GetLayerMask( aDim->GetLayer() ) & m_layerMask) == 0 ) + if( !m_layerMask[aDim->GetLayer()] ) return; DRAWSEGMENT draw; @@ -255,6 +254,7 @@ void BRDITEMS_PLOTTER::PlotDimension( DIMENSION* aDim ) draw.SetLayer( aDim->GetLayer() ); EDA_COLOR_T color = aDim->GetBoard()->GetLayerColor( aDim->GetLayer() ); + // Set plot color (change WHITE to LIGHTGRAY because // the white items are not seen on a white paper or screen m_plotter->SetColor( color != WHITE ? color : LIGHTGRAY); @@ -295,7 +295,7 @@ void BRDITEMS_PLOTTER::PlotPcbTarget( PCB_TARGET* aMire ) { int dx1, dx2, dy1, dy2, radius; - if( (GetLayerMask( aMire->GetLayer() ) & m_layerMask) == 0 ) + if( !m_layerMask[aMire->GetLayer()] ) return; m_plotter->SetColor( getColor( aMire->GetLayer() ) ); @@ -353,7 +353,7 @@ void BRDITEMS_PLOTTER::Plot_Edges_Modules() { EDGE_MODULE* edge = dyn_cast( item ); - if( !edge || (( GetLayerMask( edge->GetLayer() ) & m_layerMask ) == 0) ) + if( !edge || !m_layerMask[edge->GetLayer()] ) continue; Plot_1_EdgeModule( edge ); @@ -447,7 +447,7 @@ void BRDITEMS_PLOTTER::PlotTextePcb( TEXTE_PCB* pt_texte ) if( pt_texte->GetText().IsEmpty() ) return; - if( ( GetLayerMask( pt_texte->GetLayer() ) & m_layerMask ) == 0 ) + if( !m_layerMask[pt_texte->GetLayer()] ) return; m_plotter->SetColor( getColor( pt_texte->GetLayer() ) ); @@ -575,13 +575,13 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone ) /* Plot items type DRAWSEGMENT on layers allowed by aLayerMask */ -void BRDITEMS_PLOTTER::PlotDrawSegment( DRAWSEGMENT* aSeg ) +void BRDITEMS_PLOTTER::PlotDrawSegment( DRAWSEGMENT* aSeg ) { int thickness; int radius = 0; double StAngle = 0, EndAngle = 0; - if( (GetLayerMask( aSeg->GetLayer() ) & m_layerMask) == 0 ) + if( !m_layerMask[aSeg->GetLayer()] ) return; if( GetMode() == LINE ) diff --git a/pcbnew/print_board_functions.cpp b/pcbnew/print_board_functions.cpp index 2683e268b5..59ad38945d 100644 --- a/pcbnew/print_board_functions.cpp +++ b/pcbnew/print_board_functions.cpp @@ -44,11 +44,11 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule, - GR_DRAWMODE aDraw_mode, LAYER_MSK aMasklayer, + GR_DRAWMODE aDraw_mode, LSET aMasklayer, PRINT_PARAMETERS::DrillShapeOptT aDrillShapeOpt ); void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC, - LAYER_MSK aPrintMaskLayer, + LSET aPrintMaskLayer, bool aPrintMirrorMode, void * aData) { @@ -120,28 +120,18 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC, } -/** - * Function PrintPage - * is used to print the board (on printer, or when creating SVF files). - * Print the board, but only layers allowed by aPrintMaskLayer - * @param aDC = the print device context - * @param aPrintMaskLayer = a 32 bits mask: bit n = 1 -> layer n is printed - * @param aPrintMirrorMode = true to plot mirrored - * @param aData = a pointer to an optional data (NULL if not used) - */ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, - LAYER_MSK aPrintMaskLayer, + LSET aPrintMask, bool aPrintMirrorMode, void* aData) { - MODULE* Module; GR_DRAWMODE drawmode = GR_COPY; DISPLAY_OPTIONS save_opt; BOARD* Pcb = GetBoard(); int defaultPenSize = Millimeter2iu( 0.2 ); bool onePagePerLayer = false; - PRINT_PARAMETERS * printParameters = (PRINT_PARAMETERS*) aData; // can be null + PRINT_PARAMETERS* printParameters = (PRINT_PARAMETERS*) aData; // can be null if( printParameters && printParameters->m_OptionPrintPage == 0 ) onePagePerLayer = true; @@ -161,32 +151,34 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, DisplayOpt.DisplayPadFill = true; DisplayOpt.DisplayViaFill = true; - if( (aPrintMaskLayer & ALL_CU_LAYERS) == 0 ) + if( !( aPrintMask & LSET::AllCuMask() ).any() ) { if( onePagePerLayer ) - { // We can print mask layers (solder mask and solder paste) with the actual + { + // We can print mask layers (solder mask and solder paste) with the actual // pad sizes. To do that, we must set ContrastModeDisplay to true and set - //the GetScreen()->m_Active_Layer to the current printed layer + // the GetScreen()->m_Active_Layer to the current printed layer DisplayOpt.ContrastModeDisplay = true; DisplayOpt.DisplayPadFill = true; // Calculate the active layer number to print from its mask layer: - GetScreen()->m_Active_Layer = FIRST_LAYER; + GetScreen()->m_Active_Layer = B_Cu; - for( LAYER_NUM kk = FIRST_LAYER; kk < NB_LAYERS; ++kk ) + for( LAYER_NUM id = LAYER_ID_COUNT-1; id >= 0; --id ) { - if( GetLayerMask( kk ) & aPrintMaskLayer ) + if( aPrintMask[id] ) { - GetScreen()->m_Active_Layer = kk; + GetScreen()->m_Active_Layer = LAYER_ID( id ); break; } } // pads on Silkscreen layer are usually plot in sketch mode: - if( (GetScreen()->m_Active_Layer == SILKSCREEN_N_BACK) - || (GetScreen()->m_Active_Layer == SILKSCREEN_N_FRONT) ) + if( GetScreen()->m_Active_Layer == B_SilkS || + GetScreen()->m_Active_Layer == F_SilkS ) + { DisplayOpt.DisplayPadFill = false; - + } } else { @@ -194,14 +186,18 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, } } - m_DisplayPadFill = DisplayOpt.DisplayPadFill; m_DisplayViaFill = DisplayOpt.DisplayViaFill; m_DisplayPadNum = DisplayOpt.DisplayPadNum = false; + bool nctmp = GetBoard()->IsElementVisible( NO_CONNECTS_VISIBLE ); + GetBoard()->SetElementVisibility( NO_CONNECTS_VISIBLE, false ); + bool anchorsTmp = GetBoard()->IsElementVisible( ANCHOR_VISIBLE ); + GetBoard()->SetElementVisibility( ANCHOR_VISIBLE, false ); + DisplayOpt.DisplayPadIsol = false; m_DisplayModEdge = DisplayOpt.DisplayModEdge = FILLED; m_DisplayModText = DisplayOpt.DisplayModText = FILLED; @@ -231,7 +227,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, case PCB_DIMENSION_T: case PCB_TEXT_T: case PCB_TARGET_T: - if( GetLayerMask( item->GetLayer() ) & aPrintMaskLayer ) + if( aPrintMask[item->GetLayer()] ) item->Draw( m_canvas, aDC, drawmode ); break; @@ -242,17 +238,18 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, } // Print tracks - for( TRACK * track = Pcb->m_Track; track; track = track->Next() ) + for( TRACK* track = Pcb->m_Track; track; track = track->Next() ) { - if( !( aPrintMaskLayer & track->GetLayerMask() ) ) + if( !( aPrintMask & track->GetLayerSet() ).any() ) continue; if( track->Type() == PCB_VIA_T ) // VIA encountered. { - int radius = track->GetWidth() / 2; - const VIA *via = static_cast( track ); + int radius = track->GetWidth() / 2; + const VIA* via = static_cast( track ); EDA_COLOR_T color = g_ColorsSettings.GetItemColor( VIAS_VISIBLE + via->GetViaType() ); + GRSetDrawMode( aDC, drawmode ); GRFilledCircle( m_canvas->GetClipBox(), aDC, via->GetStart().x, @@ -267,9 +264,9 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, } // Outdated: only for compatibility to old boards - for( TRACK * track = Pcb->m_Zone; track != NULL; track = track->Next() ) + for( TRACK* track = Pcb->m_Zone; track; track = track->Next() ) { - if( !( aPrintMaskLayer & track->GetLayerMask() ) ) + if( !( aPrintMask & track->GetLayerSet() ).any() ) continue; track->Draw( m_canvas, aDC, drawmode ); @@ -280,19 +277,18 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, { ZONE_CONTAINER* zone = Pcb->GetArea( ii ); - if( aPrintMaskLayer & GetLayerMask( zone->GetLayer() ) ) + if( aPrintMask[zone->GetLayer()] ) zone->DrawFilledArea( m_canvas, aDC, drawmode ); } // Draw footprints, this is done at last in order to print the pad holes in // white (or g_DrawBgColor) after the tracks and zones - Module = (MODULE*) Pcb->m_Modules; int tmp = D_PAD::m_PadSketchModePenSize; D_PAD::m_PadSketchModePenSize = defaultPenSize; - for( ; Module != NULL; Module = Module->Next() ) + for( MODULE* module = (MODULE*) Pcb->m_Modules; module; module = module->Next() ) { - Print_Module( m_canvas, aDC, Module, drawmode, aPrintMaskLayer, drillShapeOpt ); + Print_Module( m_canvas, aDC, module, drawmode, aPrintMask, drillShapeOpt ); } D_PAD::m_PadSketchModePenSize = tmp; @@ -301,15 +297,17 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, * vias */ if( drillShapeOpt != PRINT_PARAMETERS::NO_DRILL_SHAPE ) { - TRACK * track = Pcb->m_Track; + TRACK* track = Pcb->m_Track; EDA_COLOR_T color = g_DrawBgColor; + bool blackpenstate = GetGRForceBlackPenState(); + GRForceBlackPen( false ); GRSetDrawMode( aDC, GR_COPY ); - for( ; track != NULL; track = track->Next() ) + for( ; track; track = track->Next() ) { - if( !( aPrintMaskLayer & track->GetLayerMask() ) ) + if( !( aPrintMask & track->GetLayerSet() ).any() ) continue; if( track->Type() == PCB_VIA_T ) // VIA encountered. @@ -335,7 +333,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, m_canvas->SetPrintMirrored( false ); DisplayOpt = save_opt; - GetScreen()->m_Active_Layer = activeLayer; + GetScreen()->m_Active_Layer = LAYER_ID( activeLayer ); m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill; m_DisplayPadFill = DisplayOpt.DisplayPadFill; m_DisplayViaFill = DisplayOpt.DisplayViaFill; @@ -348,13 +346,13 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule, - GR_DRAWMODE aDraw_mode, LAYER_MSK aMasklayer, + GR_DRAWMODE aDraw_mode, LSET aMask, PRINT_PARAMETERS::DrillShapeOptT aDrillShapeOpt ) { // Print pads for( D_PAD* pad = aModule->Pads(); pad; pad = pad->Next() ) { - if( !(pad->GetLayerMask() & aMasklayer ) ) + if( !( pad->GetLayerSet() & aMask ).any() ) continue; // Manage hole according to the print drill option @@ -385,14 +383,14 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule, } // Print footprint graphic shapes - LAYER_MSK mlayer = GetLayerMask( aModule->GetLayer() ); + LSET mlayer( aModule->GetLayer() ); - if( aModule->GetLayer() == LAYER_N_BACK ) - mlayer = SILKSCREEN_LAYER_BACK; - else if( aModule->GetLayer() == LAYER_N_FRONT ) - mlayer = SILKSCREEN_LAYER_FRONT; + if( aModule->GetLayer() == B_Cu ) + mlayer = LSET( B_SilkS ); + else if( aModule->GetLayer() == F_Cu ) + mlayer = LSET( F_SilkS ); - if( mlayer & aMasklayer ) + if( ( mlayer & aMask ).any() ) { if( aModule->Reference().IsVisible() ) aModule->Reference().Draw( aPanel, aDC, aDraw_mode ); @@ -406,7 +404,7 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule, switch( item->Type() ) { case PCB_MODULE_TEXT_T: - if( ( mlayer & aMasklayer ) == 0 ) + if( !( mlayer & aMask ).any() ) break; TEXTE_MODULE* textMod; @@ -418,7 +416,7 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule, { EDGE_MODULE* edge = (EDGE_MODULE*) item; - if( ( GetLayerMask( edge->GetLayer() ) & aMasklayer ) == 0 ) + if( !aMask[edge->GetLayer()] ) break; edge->Draw( aPanel, aDC, aDraw_mode ); diff --git a/pcbnew/printout_controler.cpp b/pcbnew/printout_controler.cpp index c553cd83ed..b7e503c2c1 100644 --- a/pcbnew/printout_controler.cpp +++ b/pcbnew/printout_controler.cpp @@ -65,7 +65,7 @@ PRINT_PARAMETERS::PRINT_PARAMETERS() m_XScaleAdjust = 1.0; m_YScaleAdjust = 1.0; m_Print_Sheet_Ref = false; - m_PrintMaskLayer = FULL_LAYERS; + m_PrintMaskLayer.set(); m_PrintMirror = false; m_Print_Black_and_White = true; m_OptionPrintPage = 1; @@ -89,46 +89,32 @@ BOARD_PRINTOUT_CONTROLLER::BOARD_PRINTOUT_CONTROLLER( const PRINT_PARAMETERS& aP bool BOARD_PRINTOUT_CONTROLLER::OnPrintPage( int aPage ) { -#ifdef PCBNEW - LAYER_NUM layers_count = NB_PCB_LAYERS; -#else - LAYER_NUM layers_count = NB_LAYERS; -#endif - - LAYER_MSK mask_layer = m_PrintParams.m_PrintMaskLayer; + LSET lset = m_PrintParams.m_PrintMaskLayer; // compute layer mask from page number if we want one page per layer if( m_PrintParams.m_OptionPrintPage == 0 ) // One page per layer { - int jj; - LAYER_NUM ii; + // This sequence is TBD, call a different + // sequencer if needed, such as Seq(). Could not find documentation on + // page order. + LSEQ seq = lset.UIOrder(); - for( ii = FIRST_LAYER, jj = 0; ii < layers_count; ++ii ) - { - LAYER_MSK mask = GetLayerMask( ii ); - if( mask_layer & mask ) - jj++; - - if( jj == aPage ) - { - m_PrintParams.m_PrintMaskLayer = mask; - break; - } - } + if( unsigned( aPage ) < seq.size() ) + m_PrintParams.m_PrintMaskLayer = LSET( seq[aPage] ); } - if( m_PrintParams.m_PrintMaskLayer == 0 ) + if( !m_PrintParams.m_PrintMaskLayer.any() ) return false; #ifdef PCBNEW // In Pcbnew we can want the layer EDGE always printed if( m_PrintParams.m_Flags == 1 ) - m_PrintParams.m_PrintMaskLayer |= EDGE_LAYER; + m_PrintParams.m_PrintMaskLayer.set( Edge_Cuts ); #endif DrawPage(); - m_PrintParams.m_PrintMaskLayer = mask_layer; + m_PrintParams.m_PrintMaskLayer = lset; return true; } diff --git a/pcbnew/printout_controler.h b/pcbnew/printout_controler.h index 83745c70e1..a9cd6c2ece 100644 --- a/pcbnew/printout_controler.h +++ b/pcbnew/printout_controler.h @@ -53,7 +53,7 @@ public: double m_XScaleAdjust; // fine scale adjust for X axis double m_YScaleAdjust; // fine scale adjust for Y axis bool m_Print_Sheet_Ref; // Option: print page references - LAYER_MSK m_PrintMaskLayer; // Layers to print + LSET m_PrintMaskLayer; // Layers to print bool m_PrintMirror; // Option: Print mirrored bool m_Print_Black_and_White; // Option: Print in B&W or Color int m_OptionPrintPage; // Option: 0 = a layer per page, 1 = all layers at once diff --git a/pcbnew/router/pns_index.h b/pcbnew/router/pns_index.h index edb58b33e4..3f4d27794a 100644 --- a/pcbnew/router/pns_index.h +++ b/pcbnew/router/pns_index.h @@ -23,7 +23,7 @@ #include #include - + #include #include @@ -49,14 +49,14 @@ public: PNS_INDEX(); ~PNS_INDEX(); - /** + /** * Function Add() * * Adds item to the spatial index. */ void Add( PNS_ITEM* aItem ); - - /** + + /** * Function Remove() * * Removes an item from the spatial index. @@ -70,7 +70,7 @@ public: */ void Replace( PNS_ITEM* aOldItem, PNS_ITEM* aNewItem ); - /** + /** * Function Query() * * Searches items in the index that are in proximity of aItem. @@ -86,7 +86,7 @@ public: template int Query( const PNS_ITEM* aItem, int aMinDistance, Visitor& aVisitor ); - /** + /** * Function Query() * * Searches items in the index that are in proximity of aShape. @@ -115,7 +115,7 @@ public: * Returns list of all items in a given net. */ NET_ITEMS_LIST* GetItemsForNet( int aNet ); - + /** * Function Contains() * @@ -128,7 +128,7 @@ public: /** * Function Size() - * + * * Returns number of items stored in the index. */ int Size() const { return m_allItems.size(); } @@ -177,13 +177,12 @@ PNS_INDEX::ITEM_SHAPE_INDEX* PNS_INDEX::getSubindex( const PNS_ITEM* aItem ) { if( l.IsMultilayer() ) idx_n = SI_Multilayer; - else if( l.Start() == LAYER_N_BACK) // fixme: use kicad layer codes + else if( l.Start() == B_Cu ) // fixme: use kicad layer codes idx_n = SI_PadsTop; - else if( l.Start() == LAYER_N_FRONT ) + else if( l.Start() == F_Cu ) idx_n = SI_PadsBottom; - - break; } + break; case PNS_ITEM::SEGMENT: case PNS_ITEM::LINE: @@ -271,9 +270,9 @@ int PNS_INDEX::Query( const PNS_ITEM* aItem, int aMinDistance, Visitor& aVisitor { int l = layers.Start(); - if( l == LAYER_N_BACK ) + if( l == B_Cu ) total += querySingle( SI_PadsTop, shape, aMinDistance, aVisitor ); - else if( l == LAYER_N_FRONT ) + else if( l == F_Cu ) total += querySingle( SI_PadsBottom, shape, aMinDistance, aVisitor ); total += querySingle( SI_Traces + 2 * l + SI_SegStraight, shape, aMinDistance, aVisitor ); diff --git a/pcbnew/router/pns_router.cpp b/pcbnew/router/pns_router.cpp index e10ebd9190..32812e760b 100644 --- a/pcbnew/router/pns_router.cpp +++ b/pcbnew/router/pns_router.cpp @@ -126,20 +126,19 @@ PNS_ITEM* PNS_ROUTER::syncPad( D_PAD* aPad ) case PAD_SMD: case PAD_CONN: - { - LAYER_MSK lmsk = aPad->GetLayerMask(); - int i; - - for( i = FIRST_COPPER_LAYER; i <= LAST_COPPER_LAYER; i++ ) { - if( lmsk & ( 1 << i ) ) + LSET lmsk = aPad->GetLayerSet(); + + for( int i = 0; i < MAX_CU_LAYERS; i++ ) { - layers = PNS_LAYERSET( i ); - break; + if( lmsk[i] ) + { + layers = PNS_LAYERSET( i ); + break; + } } } break; - } default: TRACE( 0, "unsupported pad type 0x%x", aPad->GetAttribute() ); @@ -250,20 +249,20 @@ void PNS_ROUTER::SetBoard( BOARD* aBoard ) int PNS_ROUTER::NextCopperLayer( bool aUp ) { - LAYER_MSK mask = m_board->GetEnabledLayers() & m_board->GetVisibleLayers(); - LAYER_NUM l = m_currentLayer; + LSET mask = m_board->GetEnabledLayers() & m_board->GetVisibleLayers(); + LAYER_NUM l = m_currentLayer; do { l += ( aUp ? 1 : -1 ); - if( l > LAST_COPPER_LAYER ) - l = FIRST_COPPER_LAYER; + if( l >= MAX_CU_LAYERS ) + l = 0; - if( l < FIRST_COPPER_LAYER ) - l = LAST_COPPER_LAYER; + if( l < 0 ) + l = MAX_CU_LAYERS-1; - if( mask & GetLayerMask( l ) ) + if( mask[l] ) return l; } while( l != m_currentLayer ); @@ -525,7 +524,7 @@ const VECTOR2I PNS_ROUTER::CurrentEnd() const void PNS_ROUTER::eraseView() { BOOST_FOREACH( BOARD_ITEM* item, m_hiddenItems ) - { + { item->ViewSetVisible( true ); } @@ -600,8 +599,8 @@ void PNS_ROUTER::Move( const VECTOR2I& aP, PNS_ITEM* endItem ) moveDragging( aP, endItem ); break; - default: - break; + default: + break; } } @@ -745,7 +744,7 @@ void PNS_ROUTER::CommitRouting( PNS_NODE* aNode ) track->SetStart( wxPoint( s.A.x, s.A.y ) ); track->SetEnd( wxPoint( s.B.x, s.B.y ) ); track->SetWidth( seg->Width() ); - track->SetLayer( seg->Layers().Start() ); + track->SetLayer( (LAYER_ID) seg->Layers().Start() ); track->SetNetCode( seg->Net() ); newBI = track; break; diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index b1ab9a9abb..fb06dc35a2 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -18,7 +18,7 @@ * with this program. If not, see . */ -#include +#include #include #include @@ -95,10 +95,10 @@ public: void SetBoard( BOARD* aBoard ) { BOARD_DESIGN_SETTINGS& bds = aBoard->GetDesignSettings(); - + wxString msg; m_board = aBoard; - + Append( ID_POPUP_PCB_SELECT_CUSTOM_WIDTH, _( "Custom size" ), wxEmptyString, wxITEM_CHECK ); @@ -111,8 +111,8 @@ public: for( unsigned i = 0; i < bds.m_TrackWidthList.size(); i++ ) { msg = _( "Track "); - msg << StringFromValue( g_UserUnit, bds.m_TrackWidthList[i], true ); - + msg << StringFromValue( g_UserUnit, bds.m_TrackWidthList[i], true ); + if( i == 0 ) msg << _( " (from netclass)" ); @@ -213,7 +213,7 @@ public: Add( ACT_SwitchPosture ); AppendSeparator ( ); - + CONTEXT_TRACK_WIDTH_MENU* trackMenu = new CONTEXT_TRACK_WIDTH_MENU; trackMenu->SetBoard( aBoard ); AppendSubMenu( trackMenu, wxT( "Select Track Width" ) ); @@ -298,7 +298,7 @@ PNS_ITEM* ROUTER_TOOL::pickSingleItem( const VECTOR2I& aWhere, int aNet, int aLa for(int i = 0; i < 4; i++) prioritized[i] = 0; - + PNS_ITEMSET candidates = m_router->QueryHoverItems( aWhere ); BOOST_FOREACH( PNS_ITEM* item, candidates.Items() ) @@ -333,7 +333,7 @@ PNS_ITEM* ROUTER_TOOL::pickSingleItem( const VECTOR2I& aWhere, int aNet, int aLa for( int i = 0; i < 4; i++ ) { PNS_ITEM* item = prioritized[i]; - + if( DisplayOpt.ContrastModeDisplay ) if( item && !item->Layers().Overlaps( tl ) ) item = NULL; @@ -381,7 +381,7 @@ void ROUTER_TOOL::handleCommonEvents( TOOL_EVENT& aEvent ) break; } } - else + else #endif if( aEvent.IsAction( &ACT_RouterOptions ) ) { @@ -444,7 +444,7 @@ void ROUTER_TOOL::updateStartItem( TOOL_EVENT& aEvent ) { bool dummy; VECTOR2I psnap = m_router->SnapToItem( startItem, p, dummy ); - + if( snapEnabled ) { m_startSnapPoint = psnap; @@ -538,7 +538,7 @@ void ROUTER_TOOL::performRouting() m_router->SwitchLayer( m_startLayer ); - frame->SetActiveLayer( m_startLayer ); + frame->SetActiveLayer( (LAYER_ID) m_startLayer ); frame->GetGalCanvas()->SetFocus(); if( m_startItem && m_startItem->Net() >= 0 ) @@ -578,7 +578,7 @@ void ROUTER_TOOL::performRouting() else if( evt->IsAction( &ACT_PlaceThroughVia ) ) { m_router->ToggleViaPlacement(); - frame->SetTopLayer( m_router->GetCurrentLayer() ); + frame->SetTopLayer( (LAYER_ID) m_router->GetCurrentLayer() ); m_router->Move( m_endSnapPoint, m_endItem ); } else if( evt->IsAction( &ACT_SwitchPosture ) ) @@ -590,13 +590,13 @@ void ROUTER_TOOL::performRouting() { m_router->SwitchLayer( m_router->NextCopperLayer( true ) ); updateEndItem( *evt ); - frame->SetActiveLayer( m_router->GetCurrentLayer() ); + frame->SetActiveLayer( (LAYER_ID) m_router->GetCurrentLayer() ); m_router->Move( m_endSnapPoint, m_endItem ); } else if( evt->IsAction( &COMMON_ACTIONS::layerPrev ) ) { m_router->SwitchLayer( m_router->NextCopperLayer( false ) ); - frame->SetActiveLayer( m_router->GetCurrentLayer() ); + frame->SetActiveLayer( (LAYER_ID) m_router->GetCurrentLayer() ); m_router->Move( m_endSnapPoint, m_endItem ); } else if( evt->IsAction( &ACT_EndTrack ) ) @@ -604,7 +604,7 @@ void ROUTER_TOOL::performRouting() if( m_router->FixRoute( m_endSnapPoint, m_endItem ) ) break; } - + handleCommonEvents(*evt); } @@ -652,7 +652,7 @@ int ROUTER_TOOL::Main( TOOL_EVENT& aEvent ) ROUTER_TOOL_MENU *ctxMenu = new ROUTER_TOOL_MENU( board ); SetContextMenu ( ctxMenu ); - + // Main loop: keep receiving events while( OPT_TOOL_EVENT evt = Wait() ) { @@ -703,7 +703,7 @@ void ROUTER_TOOL::performDragging() VIEW_CONTROLS* ctls = getViewControls(); bool dragStarted = m_router->StartDragging( m_startSnapPoint, m_startItem ); - + if( !dragStarted ) return; @@ -712,7 +712,7 @@ void ROUTER_TOOL::performDragging() ctls->ForceCursorPosition( false ); ctls->SetAutoPan( true ); - + while( OPT_TOOL_EVENT evt = Wait() ) { if( evt->IsCancel() ) diff --git a/pcbnew/sel_layer.cpp b/pcbnew/sel_layer.cpp index 4c22c927fa..8444695289 100644 --- a/pcbnew/sel_layer.cpp +++ b/pcbnew/sel_layer.cpp @@ -42,36 +42,37 @@ */ class PCB_LAYER_SELECTOR: public LAYER_SELECTOR { - BOARD * m_brd; - public: - PCB_LAYER_SELECTOR( BOARD* aBrd ):LAYER_SELECTOR() + PCB_LAYER_SELECTOR( BOARD* aBrd ) : + LAYER_SELECTOR() { m_brd = aBrd; } protected: + BOARD* m_brd; + // Returns true if the layer id is enabled (i.e. is it should be displayed) bool IsLayerEnabled( LAYER_NUM aLayer ) const { - return m_brd->IsLayerEnabled( aLayer ); + return m_brd->IsLayerEnabled( LAYER_ID( aLayer ) ); } // Returns a color index from the layer id // Virtual function EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const { - return m_brd->GetLayerColor( aLayer ); + return m_brd->GetLayerColor( LAYER_ID( aLayer ) ); } // Returns the name of the layer id - // Virtual function - wxString GetLayerName( LAYER_NUM aLayer ) const + wxString GetLayerName( LAYER_NUM aLayer ) const // overrides LAYER_SELECTOR { - return m_brd->GetLayerName( aLayer ); + return m_brd->GetLayerName( LAYER_ID( aLayer ) ); } }; + /* * This class display a pcb layers list in a dialog, * to select one layer from this list @@ -79,74 +80,69 @@ protected: class PCB_ONE_LAYER_SELECTOR : public PCB_LAYER_SELECTOR, public DIALOG_LAYER_SELECTION_BASE { - LAYER_NUM m_layerSelected; - LAYER_MSK m_notAllowedLayersMask; - std::vector m_layersIdLeftColumn; - std::vector m_layersIdRightColumn; + LAYER_ID m_layerSelected; + LSET m_notAllowedLayersMask; + + std::vector m_layersIdLeftColumn; + std::vector m_layersIdRightColumn; public: PCB_ONE_LAYER_SELECTOR( wxWindow* aParent, BOARD * aBrd, - LAYER_NUM aDefaultLayer, - LAYER_MSK aNotAllowedLayersMask ); + LAYER_ID aDefaultLayer, + LSET aNotAllowedLayersMask ); - LAYER_NUM GetLayerSelection() { return m_layerSelected; } + LAYER_NUM GetLayerSelection() { return m_layerSelected; } private: // Event handlers void OnLeftGridCellClick( wxGridEvent& event ); void OnRightGridCellClick( wxGridEvent& event ); - void BuildList(); + void buildList(); }; + PCB_ONE_LAYER_SELECTOR::PCB_ONE_LAYER_SELECTOR( wxWindow* aParent, - BOARD * aBrd, - LAYER_NUM aDefaultLayer, - LAYER_MSK aNotAllowedLayersMask ) + BOARD* aBrd, LAYER_ID aDefaultLayer, LSET aNotAllowedLayersMask ) : PCB_LAYER_SELECTOR( aBrd ), DIALOG_LAYER_SELECTION_BASE( aParent ) { - m_layerSelected = (int) aDefaultLayer; + m_layerSelected = aDefaultLayer; m_notAllowedLayersMask = aNotAllowedLayersMask; - BuildList(); + buildList(); Layout(); - GetSizer()->SetSizeHints(this); + GetSizer()->SetSizeHints( this ); SetFocus(); } + // Build the layers list // Column position by function: -#define SELECT_COLNUM 0 -#define COLOR_COLNUM 1 -#define LAYERNAME_COLNUM 2 -static DECLARE_LAYERS_ORDER_LIST( layertranscode ); +#define SELECT_COLNUM 0 +#define COLOR_COLNUM 1 +#define LAYERNAME_COLNUM 2 -void PCB_ONE_LAYER_SELECTOR::BuildList() +void PCB_ONE_LAYER_SELECTOR::buildList() { // Hide layerid column which is used only to know the layer id // not to be shown in dialogs m_leftGridLayers->SetColSize( COLOR_COLNUM, 20 ); m_rightGridLayers->SetColSize( COLOR_COLNUM, 20 ); - int left_row = 0; - int right_row = 0; - wxString layername; - for( LAYER_NUM i = FIRST_LAYER; i < NB_LAYERS; ++i ) + int left_row = 0; + int right_row = 0; + wxString layername; + + for( LSEQ ui_seq = m_brd->GetEnabledLayers().UIOrder(); ui_seq; ++ui_seq ) { - LAYER_NUM layerid = i; + LAYER_ID layerid = *ui_seq; - if( m_layerorder ) - layerid = layertranscode[i]; - - if( ! IsLayerEnabled( layerid ) ) - continue; - - if( (m_notAllowedLayersMask & GetLayerMask( layerid )) != 0 ) + if( m_notAllowedLayersMask[layerid] ) continue; wxColour color = MakeColour( GetLayerColor( layerid ) ); layername = GetLayerName( layerid ); - if( layerid <= LAST_COPPER_LAYER ) + if( IsCopperLayer( layerid ) ) { if( left_row ) m_leftGridLayers->AppendRows( 1 ); @@ -205,6 +201,7 @@ void PCB_ONE_LAYER_SELECTOR::BuildList() m_rightGridLayers->AutoSizeColumn(SELECT_COLNUM); } + void PCB_ONE_LAYER_SELECTOR::OnLeftGridCellClick( wxGridEvent& event ) { m_layerSelected = m_layersIdLeftColumn[ event.GetRow() ]; @@ -212,6 +209,7 @@ void PCB_ONE_LAYER_SELECTOR::OnLeftGridCellClick( wxGridEvent& event ) EndModal( 1 ); } + void PCB_ONE_LAYER_SELECTOR::OnRightGridCellClick( wxGridEvent& event ) { m_layerSelected = m_layersIdRightColumn[ event.GetRow() ]; @@ -219,18 +217,12 @@ void PCB_ONE_LAYER_SELECTOR::OnRightGridCellClick( wxGridEvent& event ) EndModal( 2 ); } -/** Install the dialog box for layer selection - * @param aDefaultLayer = Preselection (NB_PCB_LAYERS for "(Deselect)" layer) - * @param aNotAllowedLayers = a layer mask for not allowed layers - * (= 0 to show all layers in use) - * @return the selected layer id - */ -LAYER_NUM PCB_BASE_FRAME::SelectLayer( LAYER_NUM aDefaultLayer, - LAYER_MSK aNotAllowedLayersMask, - wxPoint aDlgPosition ) + +LAYER_ID PCB_BASE_FRAME::SelectLayer( LAYER_ID aDefaultLayer, + LSET aNotAllowedLayersMask, wxPoint aDlgPosition ) { - PCB_ONE_LAYER_SELECTOR dlg( this, GetBoard(), - aDefaultLayer, aNotAllowedLayersMask ); + PCB_ONE_LAYER_SELECTOR dlg( this, GetBoard(), aDefaultLayer, aNotAllowedLayersMask ); + if( aDlgPosition != wxDefaultPosition ) { wxSize dlgSize = dlg.GetSize(); @@ -238,31 +230,35 @@ LAYER_NUM PCB_BASE_FRAME::SelectLayer( LAYER_NUM aDefaultLayer, aDlgPosition.y -= dlgSize.y/2; dlg.SetPosition( aDlgPosition ); } + dlg.ShowModal(); - LAYER_NUM layer = dlg.GetLayerSelection(); + + LAYER_ID layer = (LAYER_ID) dlg.GetLayerSelection(); return layer; } -/* - * This class display a double pcb copper layers list in a dialog, +/** + * Class SELECT_COPPER_LAYERS_PAIR_DIALOG + * displays a double pcb copper layers list in a dialog, * to select a layer pair from these lists */ class SELECT_COPPER_LAYERS_PAIR_DIALOG: public PCB_LAYER_SELECTOR, public DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE { private: - LAYER_NUM m_frontLayer; - LAYER_NUM m_backLayer; - int m_leftRowSelected; - int m_rightRowSelected; - std::vector m_layersId; + LAYER_ID m_frontLayer; + LAYER_ID m_backLayer; + int m_leftRowSelected; + int m_rightRowSelected; + + std::vector m_layersId; public: - SELECT_COPPER_LAYERS_PAIR_DIALOG( wxWindow* aParent, BOARD * aPcb, - LAYER_NUM aFrontLayer, LAYER_NUM aBackLayer ); + SELECT_COPPER_LAYERS_PAIR_DIALOG( wxWindow* aParent, BOARD* aPcb, + LAYER_ID aFrontLayer, LAYER_ID aBackLayer ); - void GetLayerPair( LAYER_NUM& aFrontLayer, LAYER_NUM& aBackLayer ) + void GetLayerPair( LAYER_ID& aFrontLayer, LAYER_ID& aBackLayer ) { aFrontLayer = m_frontLayer; aBackLayer = m_backLayer; @@ -282,16 +278,15 @@ private: EndModal( wxID_CANCEL ); } - void BuildList(); + void buildList(); void SetGridCursor( wxGrid* aGrid, int aRow, bool aEnable ); }; -/* Display a list of two copper layers to choose a pair of copper layers - * the layer pair is used to fast switch between copper layers when placing vias - */ + void PCB_BASE_FRAME::SelectCopperLayerPair() { PCB_SCREEN* screen = GetScreen(); + SELECT_COPPER_LAYERS_PAIR_DIALOG dlg( this, GetBoard(), screen->m_Route_Layer_TOP, screen->m_Route_Layer_BOTTOM ); @@ -310,9 +305,9 @@ void PCB_BASE_FRAME::SelectCopperLayerPair() m_canvas->MoveCursorToCrossHair(); } -SELECT_COPPER_LAYERS_PAIR_DIALOG:: - SELECT_COPPER_LAYERS_PAIR_DIALOG( wxWindow* aParent, BOARD * aPcb, - LAYER_NUM aFrontLayer, LAYER_NUM aBackLayer) : + +SELECT_COPPER_LAYERS_PAIR_DIALOG::SELECT_COPPER_LAYERS_PAIR_DIALOG( + wxWindow* aParent, BOARD * aPcb, LAYER_ID aFrontLayer, LAYER_ID aBackLayer) : PCB_LAYER_SELECTOR( aPcb ), DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE( aParent ) { @@ -320,45 +315,39 @@ SELECT_COPPER_LAYERS_PAIR_DIALOG:: m_backLayer = aBackLayer; m_leftRowSelected = 0; m_rightRowSelected = 0; - BuildList(); + buildList(); SetFocus(); GetSizer()->SetSizeHints( this ); Center(); } -void SELECT_COPPER_LAYERS_PAIR_DIALOG::BuildList() + +void SELECT_COPPER_LAYERS_PAIR_DIALOG::buildList() { m_leftGridLayers->SetColSize( COLOR_COLNUM, 20 ); m_rightGridLayers->SetColSize( COLOR_COLNUM, 20 ); // Select a not show cell, to avoid a wrong cell selection for user - int row = 0; - wxString layername; + int row = 0; + wxString layername; - for( LAYER_NUM i = FIRST_LAYER; i < NB_LAYERS; ++i ) + for( LSEQ ui_seq = m_brd->GetEnabledLayers().UIOrder(); ui_seq; ++ui_seq ) { - LAYER_NUM layerid = i; + LAYER_ID layerid = *ui_seq; - if( m_layerorder ) - layerid = layertranscode[i]; - - if( ! IsLayerEnabled( layerid ) ) - continue; - - if( layerid > LAST_COPPER_LAYER ) - continue; + if( !IsCopperLayer( layerid ) ) + break; wxColour color = MakeColour( GetLayerColor( layerid ) ); + layername = GetLayerName( layerid ); if( row ) m_leftGridLayers->AppendRows( 1 ); - m_leftGridLayers->SetCellBackgroundColour ( row, COLOR_COLNUM, - color ); - m_leftGridLayers->SetCellValue( row, LAYERNAME_COLNUM, - layername ); + m_leftGridLayers->SetCellBackgroundColour( row, COLOR_COLNUM, color ); + m_leftGridLayers->SetCellValue( row, LAYERNAME_COLNUM, layername ); m_layersId.push_back( layerid ); if( m_frontLayer == layerid ) @@ -389,12 +378,13 @@ void SELECT_COPPER_LAYERS_PAIR_DIALOG::BuildList() m_rightGridLayers->AutoSizeColumn(SELECT_COLNUM); } + void SELECT_COPPER_LAYERS_PAIR_DIALOG::SetGridCursor( wxGrid* aGrid, int aRow, bool aEnable ) { if( aEnable ) { - LAYER_NUM layerid = m_layersId[aRow]; + LAYER_ID layerid = m_layersId[aRow]; wxColour color = MakeColour( GetLayerColor( layerid ) ); aGrid->SetCellValue( aRow, SELECT_COLNUM, wxT("X") ); aGrid->SetCellBackgroundColour( aRow, SELECT_COLNUM, color ); @@ -409,10 +399,11 @@ void SELECT_COPPER_LAYERS_PAIR_DIALOG::SetGridCursor( wxGrid* aGrid, int aRow, } } + void SELECT_COPPER_LAYERS_PAIR_DIALOG::OnLeftGridCellClick( wxGridEvent& event ) { - int row = event.GetRow(); - LAYER_NUM layer = m_layersId[row]; + int row = event.GetRow(); + LAYER_ID layer = m_layersId[row]; if( m_frontLayer == layer ) return; @@ -423,12 +414,13 @@ void SELECT_COPPER_LAYERS_PAIR_DIALOG::OnLeftGridCellClick( wxGridEvent& event ) SetGridCursor( m_leftGridLayers, m_leftRowSelected, true ); } + void SELECT_COPPER_LAYERS_PAIR_DIALOG::OnRightGridCellClick( wxGridEvent& event ) { - int row = event.GetRow(); - LAYER_NUM layer = m_layersId[row]; + int row = event.GetRow(); + LAYER_ID layer = m_layersId[row]; - if( m_backLayer == layer ) + if( m_backLayer == layer ) return; SetGridCursor( m_rightGridLayers, m_rightRowSelected, false ); diff --git a/pcbnew/specctra.cpp b/pcbnew/specctra.cpp index b1018a58a8..4f521ee2a9 100644 --- a/pcbnew/specctra.cpp +++ b/pcbnew/specctra.cpp @@ -75,25 +75,51 @@ void SPECCTRA_DB::buildLayerMaps( BOARD* aBoard ) { // specctra wants top physical layer first, then going down to the // bottom most physical layer in physical sequence. - // @question : why does KiCad not display layers in that order? - int layerCount = aBoard->GetCopperLayerCount(); + // Same as KiCad now except for B_Cu + unsigned layerCount = aBoard->GetCopperLayerCount(); layerIds.clear(); pcbLayer2kicad.resize( layerCount ); - kicadLayer2pcb.resize( LAYER_N_FRONT + 1 ); + kicadLayer2pcb.resize( B_Cu + 1 ); +#if 0 // was: for( LAYER_NUM kiNdx = layerCount - 1, pcbNdx=FIRST_LAYER; kiNdx >= 0; --kiNdx, ++pcbNdx ) { - LAYER_NUM kilayer = (kiNdx>0 && kiNdx==layerCount-1) ? LAYER_N_FRONT : kiNdx; + LAYER_NUM kilayer = (kiNdx>0 && kiNdx==layerCount-1) ? F_Cu : kiNdx; // establish bi-directional mapping between KiCad's BOARD layer and PCB layer pcbLayer2kicad[pcbNdx] = kilayer; kicadLayer2pcb[kilayer] = pcbNdx; // save the specctra layer name in SPECCTRA_DB::layerIds for later. - layerIds.push_back( TO_UTF8( aBoard->GetLayerName( kilayer ) ) ); + layerIds.push_back( TO_UTF8( aBoard->GetLayerName( LAYER_ID( kilayer ) ) ) ); } +#else + + // establish bi-directional mapping between KiCad's BOARD layer and PCB layer + + for( unsigned i = 0; i < kicadLayer2pcb.size(); ++i ) + { + if( i < layerCount-1 ) + kicadLayer2pcb[i] = i; + else + kicadLayer2pcb[i] = layerCount - 1; + } + + for( unsigned i = 0; i < pcbLayer2kicad.size(); ++i ) + { + if( i < layerCount-1 ) + pcbLayer2kicad[i] = LAYER_ID( i ); + else + pcbLayer2kicad[i] = B_Cu; + + // save the specctra layer name in SPECCTRA_DB::layerIds for later. + layerIds.push_back( TO_UTF8( aBoard->GetLayerName( LAYER_ID( i ) ) ) ); + } + + +#endif } diff --git a/pcbnew/specctra.h b/pcbnew/specctra.h index 2a584864bb..94b3154515 100644 --- a/pcbnew/specctra.h +++ b/pcbnew/specctra.h @@ -3620,7 +3620,7 @@ class SPECCTRA_DB : public SPECCTRA_LEXER std::vector kicadLayer2pcb; /// maps PCB layer number to BOARD layer numbers - std::vector pcbLayer2kicad; + std::vector pcbLayer2kicad; /// used during FromSESSION() only, memory for it is not owned here. UNIT_RES* routeResolution; diff --git a/pcbnew/specctra_export.cpp b/pcbnew/specctra_export.cpp index d81d2c66ec..e20b613441 100644 --- a/pcbnew/specctra_export.cpp +++ b/pcbnew/specctra_export.cpp @@ -359,7 +359,7 @@ static bool isRoundKeepout( D_PAD* aPad ) if( aPad->GetDrillSize().x >= aPad->GetSize().x ) return true; - if( (aPad->GetLayerMask() & ALL_CU_LAYERS) == 0 ) + if( !( aPad->GetLayerSet() & LSET::AllCuMask() ).any() ) return true; } @@ -393,11 +393,13 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad ) PADSTACK* padstack = new PADSTACK(); int reportedLayers = 0; // how many in reported padstack - const char* layerName[NB_COPPER_LAYERS]; + const char* layerName[MAX_CU_LAYERS]; uniqifier = '['; - bool onAllCopperLayers = ( (aPad->GetLayerMask() & ALL_CU_LAYERS) == ALL_CU_LAYERS ); + static const LSET all_cu = LSET::AllCuMask(); + + bool onAllCopperLayers = ( (aPad->GetLayerSet() & all_cu) == all_cu ); if( onAllCopperLayers ) uniqifier += 'A'; // A for all layers @@ -405,7 +407,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad ) const int copperCount = aBoard->GetCopperLayerCount(); for( int layer=0; layerIsOnLayer( kilayer ) ) { @@ -836,8 +838,8 @@ PADSTACK* SPECCTRA_DB::makeVia( int aCopperDiameter, int aDrillDiameter, PADSTACK* SPECCTRA_DB::makeVia( const ::VIA* aVia ) { - LAYER_NUM topLayerNum; - LAYER_NUM botLayerNum; + LAYER_ID topLayerNum; + LAYER_ID botLayerNum; aVia->LayerPair( &topLayerNum, &botLayerNum ); @@ -890,7 +892,7 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER const int STEPS = 36; // for a segmentation of an arc of 360 degrees // Get all the DRAWSEGMENTS and module graphics into 'items', - // then keep only those on layer == EDGE_N. + // then keep only those on layer == Edge_Cuts. static const KICAD_T scan_graphics[] = { PCB_LINE_T, PCB_MODULE_EDGE_T, EOT }; @@ -898,11 +900,11 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER for( int i = 0; iGetLayer() != EDGE_N ) + if( items[i]->GetLayer() != Edge_Cuts ) { items.Remove( i ); } - else // remove graphics not on EDGE_N layer + else // remove graphics not on Edge_Cuts layer { DBG( items[i]->Show( 0, std::cout );) ++i; @@ -2133,7 +2135,7 @@ void SPECCTRA_DB::FlipMODULEs( BOARD* aBoard ) for( MODULE* module = aBoard->m_Modules; module; module = module->Next() ) { module->SetFlag( 0 ); - if( module->GetLayer() == LAYER_N_BACK ) + if( module->GetLayer() == B_Cu ) { module->Flip( module->GetPosition() ); module->SetFlag( 1 ); diff --git a/pcbnew/specctra_import.cpp b/pcbnew/specctra_import.cpp index dbe998375c..a7a4d8ff5f 100644 --- a/pcbnew/specctra_import.cpp +++ b/pcbnew/specctra_import.cpp @@ -266,7 +266,7 @@ TRACK* SPECCTRA_DB::makeTRACK( PATH* aPath, int aPointIndex, int aNetcode ) thro via->SetDrill( drillDiam ); via->SetViaType( VIA_THROUGH ); via->SetWidth( viaDiam ); - via->SetLayerPair( LAYER_N_FRONT, LAYER_N_BACK ); + via->SetLayerPair( F_Cu, B_Cu ); } else if( shapeCount == copperLayerCount ) { @@ -284,7 +284,7 @@ TRACK* SPECCTRA_DB::makeTRACK( PATH* aPath, int aPointIndex, int aNetcode ) thro via->SetDrill( drillDiam ); via->SetViaType( VIA_THROUGH ); via->SetWidth( viaDiam ); - via->SetLayerPair( LAYER_N_FRONT, LAYER_N_BACK ); + via->SetLayerPair( F_Cu, B_Cu ); } else // VIA_MICROVIA or VIA_BLIND_BURIED { @@ -333,8 +333,8 @@ TRACK* SPECCTRA_DB::makeTRACK( PATH* aPath, int aPointIndex, int aNetcode ) thro via->SetWidth( viaDiam ); - LAYER_NUM topLayer = pcbLayer2kicad[topLayerNdx]; - LAYER_NUM botLayer = pcbLayer2kicad[botLayerNdx]; + LAYER_ID topLayer = pcbLayer2kicad[topLayerNdx]; + LAYER_ID botLayer = pcbLayer2kicad[botLayerNdx]; via->SetLayerPair( topLayer, botLayer ); } @@ -410,7 +410,7 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IO_ERROR ) // convert from degrees to tenths of degrees used in KiCad. int orientation = KiROUND( place->rotation * 10.0 ); - if( module->GetLayer() != LAYER_N_FRONT ) + if( module->GetLayer() != F_Cu ) { // module is on copper layer (back) module->Flip( module->GetPosition() ); @@ -422,7 +422,7 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IO_ERROR ) { int orientation = KiROUND( (place->rotation + 180.0) * 10.0 ); - if( module->GetLayer() != LAYER_N_BACK ) + if( module->GetLayer() != B_Cu ) { // module is on component layer (front) module->Flip( module->GetPosition() ); diff --git a/pcbnew/swap_layers.cpp b/pcbnew/swap_layers.cpp index e3bf92bc59..32f00e817d 100644 --- a/pcbnew/swap_layers.cpp +++ b/pcbnew/swap_layers.cpp @@ -18,20 +18,22 @@ #include -#define LAYER_NO_CHANGE NB_LAYERS -static LAYER_NUM New_Layer[NB_PCB_LAYERS]; -wxStaticText* layer_list[NB_PCB_LAYERS]; +#define NO_CHANGE LAYER_ID(-3) enum swap_layer_id { ID_WINEDA_SWAPLAYERFRAME = 1800, ID_BUTTON_0, - ID_TEXT_0 = ID_BUTTON_0 + NB_PCB_LAYERS + ID_TEXT_0 = ID_BUTTON_0 + LAYER_ID_COUNT }; class SWAP_LAYERS_DIALOG : public DIALOG_SHIM { +public: + SWAP_LAYERS_DIALOG( PCB_BASE_FRAME* parent, LAYER_ID* aArray ); + // ~SWAP_LAYERS_DIALOG() { }; + private: PCB_BASE_FRAME* m_Parent; wxBoxSizer* OuterBoxSizer; @@ -43,12 +45,9 @@ private: wxStaticLine* Line; wxStdDialogButtonSizer* StdDialogButtonSizer; -public: + LAYER_ID* m_callers_nlayers; // DIM() is LAYER_ID_COUNT + wxStaticText* layer_list[LAYER_ID_COUNT]; - SWAP_LAYERS_DIALOG( PCB_BASE_FRAME* parent ); - ~SWAP_LAYERS_DIALOG() { }; - -private: void Sel_Layer( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event ); @@ -58,18 +57,22 @@ private: BEGIN_EVENT_TABLE( SWAP_LAYERS_DIALOG, wxDialog ) - EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + NB_PCB_LAYERS - 1, - wxEVT_COMMAND_BUTTON_CLICKED, - SWAP_LAYERS_DIALOG::Sel_Layer ) + EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + LAYER_ID_COUNT - 1, + wxEVT_COMMAND_BUTTON_CLICKED, SWAP_LAYERS_DIALOG::Sel_Layer ) + EVT_BUTTON( wxID_OK, SWAP_LAYERS_DIALOG::OnOkClick ) + EVT_BUTTON( wxID_CANCEL, SWAP_LAYERS_DIALOG::OnCancelClick ) END_EVENT_TABLE() -SWAP_LAYERS_DIALOG::SWAP_LAYERS_DIALOG( PCB_BASE_FRAME* parent ) : +SWAP_LAYERS_DIALOG::SWAP_LAYERS_DIALOG( PCB_BASE_FRAME* parent, LAYER_ID* aArray ) : DIALOG_SHIM( parent, -1, _( "Swap Layers:" ), wxPoint( -1, -1 ), - wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ) + wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ), + m_callers_nlayers( aArray ) { + memset( layer_list, 0, sizeof( layer_list ) ); + BOARD* board = parent->GetBoard(); OuterBoxSizer = NULL; @@ -113,10 +116,10 @@ SWAP_LAYERS_DIALOG::SWAP_LAYERS_DIALOG( PCB_BASE_FRAME* parent ) : MainBoxSizer = new wxBoxSizer( wxHORIZONTAL ); OuterBoxSizer->Add( MainBoxSizer, 1, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 ); - for( LAYER_NUM ii = FIRST_LAYER; ii < NB_PCB_LAYERS; ++ii ) + for( unsigned layer = 0; layer < DIM( layer_list ); ++layer ) { // Provide a vertical line to separate the two FlexGrid sizers - if( ii == 16 ) + if( layer == 32 ) { Line = new wxStaticLine( this, -1, @@ -127,7 +130,7 @@ SWAP_LAYERS_DIALOG::SWAP_LAYERS_DIALOG( PCB_BASE_FRAME* parent ) : } // Provide a separate FlexGrid sizer for every sixteen sets of controls - if( ii % 16 == 0 ) + if( layer % 16 == 0 ) { /* Each layer has an associated static text string (to identify * that layer), a button (for invoking a child dialog box to @@ -168,16 +171,17 @@ SWAP_LAYERS_DIALOG::SWAP_LAYERS_DIALOG( PCB_BASE_FRAME* parent ) : /* Provide a text string to identify this layer (with trailing spaces * within that string being purged). */ - label = new wxStaticText( this, wxID_STATIC, board->GetLayerName( ii ), + label = new wxStaticText( this, wxID_STATIC, board->GetLayerName( LAYER_ID( layer ) ), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); + FlexColumnBoxSizer->Add( label, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxLEFT | wxBOTTOM, 5 ); // Provide a button for this layer (which will invoke a child dialog box) - item_ID = ID_BUTTON_0 + ii; + item_ID = ID_BUTTON_0 + layer; Button = new wxButton( this, item_ID, wxT( "..." ), wxDefaultPosition, wxSize( w, h ), 0 ); @@ -191,7 +195,7 @@ SWAP_LAYERS_DIALOG::SWAP_LAYERS_DIALOG( PCB_BASE_FRAME* parent ) : * foreground color of the text to blue (which also indicates that the * layer is currently unmapped to any other layer). */ - item_ID = ID_TEXT_0 + ii; + item_ID = ID_TEXT_0 + layer; /* When the first of these text strings is being added, determine * what size is necessary to to be able to display the longest @@ -200,15 +204,15 @@ SWAP_LAYERS_DIALOG::SWAP_LAYERS_DIALOG( PCB_BASE_FRAME* parent ) : * size is not this size, strings can be truncated after * some other layer is selected.) */ - if( ii == 0 ) + if( layer == 0 ) { - text = new wxStaticText( this, item_ID, board->GetLayerName( FIRST_LAYER ), + text = new wxStaticText( this, item_ID, board->GetLayerName( LAYER_ID( 0 ) ), wxDefaultPosition, wxDefaultSize, 0 ); goodSize = text->GetSize(); - for( LAYER_NUM jj = LAYER_N_2; jj < NB_PCB_LAYERS; ++jj ) + for( unsigned jj = 1; jj < DIM( layer_list ); ++jj ) { - text->SetLabel( board->GetLayerName( jj ) ); + text->SetLabel( board->GetLayerName( LAYER_ID( jj ) ) ); if( goodSize.x < text->GetSize().x ) goodSize.x = text->GetSize().x; @@ -229,19 +233,19 @@ SWAP_LAYERS_DIALOG::SWAP_LAYERS_DIALOG( PCB_BASE_FRAME* parent ) : FlexColumnBoxSizer->Add( text, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); - layer_list[ii] = text; + layer_list[layer] = text; } /* Provide spacers to occupy otherwise blank cells within the second * FlexGrid sizer. (Becuse there are three columns, three spacers * are thus required for each unused row.) - */ for( int ii = 3 * NB_PCB_LAYERS; ii < 96; ii++ ) { FlexColumnBoxSizer->Add( 5, h, 0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); } + */ // Provide a line to separate the controls which have been provided so far // from the OK and Cancel buttons (which will be provided after this line) @@ -279,29 +283,25 @@ void SWAP_LAYERS_DIALOG::Sel_Layer( wxCommandEvent& event ) ii = event.GetId(); - if( ii < ID_BUTTON_0 || ii >= ID_BUTTON_0 + NB_PCB_LAYERS ) + if( ii < ID_BUTTON_0 || ii >= ID_BUTTON_0 + LAYER_ID_COUNT ) return; ii = event.GetId() - ID_BUTTON_0; - LAYER_NUM layer = New_Layer[ii]; + LAYER_ID layer = m_callers_nlayers[ii]; - if( (layer < 0) || (layer > NB_PCB_LAYERS) ) - layer = LAYER_NO_CHANGE; // (Defaults to "No Change".) + LSET notallowed_mask = IsCopperLayer( ii ) ? LSET::AllNonCuMask() : LSET::AllCuMask(); - LAYER_MSK notallowed_mask = ii < NB_COPPER_LAYERS ? - ALL_NO_CU_LAYERS : ALL_CU_LAYERS; - layer = m_Parent->SelectLayer( layer == LAYER_NO_CHANGE ? ii : layer, - notallowed_mask ); + layer = m_Parent->SelectLayer( layer == NO_CHANGE ? LAYER_ID( ii ): layer, notallowed_mask ); if( !IsValidLayer( layer ) ) return; - if( layer != New_Layer[ii] ) + if( layer != m_callers_nlayers[ii] ) { - New_Layer[ii] = layer; + m_callers_nlayers[ii] = layer; - if( layer >= LAYER_NO_CHANGE || layer == ii ) + if( layer == NO_CHANGE || layer == ii ) { layer_list[ii]->SetLabel( _( "No Change" ) ); @@ -335,80 +335,71 @@ void SWAP_LAYERS_DIALOG::OnOkClick( wxCommandEvent& event ) void PCB_EDIT_FRAME::Swap_Layers( wxCommandEvent& event ) { - int ii, jj; - TRACK* pt_segm; - DRAWSEGMENT* pt_drawsegm; - EDA_ITEM* PtStruct; + LAYER_ID new_layer[LAYER_ID_COUNT]; - /* Init default values */ - for( ii = FIRST_LAYER; ii < NB_PCB_LAYERS; ii++ ) - New_Layer[ii] = LAYER_NO_CHANGE; + for( unsigned i = 0; i < DIM( new_layer ); ++i ) + new_layer[i] = NO_CHANGE; - SWAP_LAYERS_DIALOG dlg( this ); + SWAP_LAYERS_DIALOG dlg( this, new_layer ); - ii = dlg.ShowModal(); + if( dlg.ShowModal() != 1 ) + return; // (Canceled dialog box returns -1 instead) - if( ii != 1 ) - return; // (Canceled dialog box returns -1 instead) - - /* Change traces. */ - pt_segm = GetBoard()->m_Track; - - for( ; pt_segm != NULL; pt_segm = pt_segm->Next() ) + // Change traces. + for( TRACK* segm = GetBoard()->m_Track; segm; segm = segm->Next() ) { OnModify(); - if( pt_segm->Type() == PCB_VIA_T ) + if( segm->Type() == PCB_VIA_T ) { - VIA* Via = (VIA*) pt_segm; + VIA* via = (VIA*) segm; - if( Via->GetViaType() == VIA_THROUGH ) + if( via->GetViaType() == VIA_THROUGH ) continue; - LAYER_NUM top_layer, bottom_layer; + LAYER_ID top_layer, bottom_layer; - Via->LayerPair( &top_layer, &bottom_layer ); + via->LayerPair( &top_layer, &bottom_layer ); - if( New_Layer[bottom_layer] >= 0 && New_Layer[bottom_layer] < LAYER_NO_CHANGE ) - bottom_layer = New_Layer[bottom_layer]; + if( new_layer[bottom_layer] != NO_CHANGE ) + bottom_layer = new_layer[bottom_layer]; - if( New_Layer[top_layer] >= 0 && New_Layer[top_layer] < LAYER_NO_CHANGE ) - top_layer = New_Layer[top_layer]; + if( new_layer[top_layer] != NO_CHANGE ) + top_layer = new_layer[top_layer]; - Via->SetLayerPair( top_layer, bottom_layer ); + via->SetLayerPair( top_layer, bottom_layer ); } else { - jj = pt_segm->GetLayer(); + int jj = segm->GetLayer(); - if( New_Layer[jj] >= 0 && New_Layer[jj] < LAYER_NO_CHANGE ) - pt_segm->SetLayer( New_Layer[jj] ); + if( new_layer[jj] != NO_CHANGE ) + segm->SetLayer( new_layer[jj] ); } } - /* Change zones. */ - for( pt_segm = GetBoard()->m_Zone; pt_segm; pt_segm = pt_segm->Next() ) + // Change zones. + for( TRACK* segm = GetBoard()->m_Zone; segm; segm = segm->Next() ) { OnModify(); - jj = pt_segm->GetLayer(); + int jj = segm->GetLayer(); - if( New_Layer[jj] >= 0 && New_Layer[jj] < LAYER_NO_CHANGE ) - pt_segm->SetLayer( New_Layer[jj] ); + if( new_layer[jj] != NO_CHANGE ) + segm->SetLayer( new_layer[jj] ); } - /* Change other segments. */ - PtStruct = GetBoard()->m_Drawings; - - for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) + // Change other segments. + for( EDA_ITEM* item = GetBoard()->m_Drawings; item; item = item->Next() ) { - if( PtStruct->Type() == PCB_LINE_T ) + if( item->Type() == PCB_LINE_T ) { OnModify(); - pt_drawsegm = (DRAWSEGMENT*) PtStruct; - jj = pt_drawsegm->GetLayer(); - if( New_Layer[jj] >= 0 && New_Layer[jj] < LAYER_NO_CHANGE ) - pt_drawsegm->SetLayer( New_Layer[jj] ); + DRAWSEGMENT* drawsegm = (DRAWSEGMENT*) item; + int jj = drawsegm->GetLayer(); + + if( new_layer[jj] != NO_CHANGE ) + drawsegm->SetLayer( new_layer[jj] ); } } diff --git a/pcbnew/target_edit.cpp b/pcbnew/target_edit.cpp index 5a0d860d30..4e2e77bb48 100644 --- a/pcbnew/target_edit.cpp +++ b/pcbnew/target_edit.cpp @@ -209,7 +209,7 @@ PCB_TARGET* PCB_EDIT_FRAME::CreateTarget( wxDC* DC ) GetBoard()->Add( target ); - target->SetLayer( EDGE_N ); + target->SetLayer( Edge_Cuts ); target->SetWidth( GetDesignSettings().m_EdgeSegmentWidth ); target->SetSize( MireDefaultSize ); target->SetPosition( GetCrossHairPosition() ); diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index c1591700e5..db5d6900e8 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -94,7 +94,7 @@ int DRAWING_TOOL::DrawArc( TOOL_EVENT& aEvent ) DRAWSEGMENT* arc = NULL; DRAWSEGMENT helperLine; helperLine.SetShape( S_SEGMENT ); - helperLine.SetLayer( DRAW_N ); + helperLine.SetLayer( Dwgs_User ); helperLine.SetWidth( 1 ); // Add a VIEW_GROUP that serves as a preview for the new item @@ -163,71 +163,71 @@ int DRAWING_TOOL::DrawArc( TOOL_EVENT& aEvent ) switch( step ) { case SET_ORIGIN: - { - LAYER_NUM layer = m_frame->GetScreen()->m_Active_Layer; - - if( IsCopperLayer( layer ) ) { - DisplayInfoMessage( NULL, _( "Graphic not allowed on Copper layers" ) ); - --step; + LAYER_ID layer = m_frame->GetScreen()->m_Active_Layer; + + if( IsCopperLayer( layer ) ) + { + DisplayInfoMessage( NULL, _( "Graphic not allowed on Copper layers" ) ); + --step; + } + else + { + // Init the new item attributes + arc = new DRAWSEGMENT( m_board ); + arc->SetShape( S_ARC ); + arc->SetAngle( 0.0 ); + arc->SetWidth( m_board->GetDesignSettings().m_DrawSegmentWidth ); + arc->SetCenter( wxPoint( cursorPos.x, cursorPos.y ) ); + arc->SetLayer( layer ); + + helperLine.SetStart( arc->GetCenter() ); + helperLine.SetEnd( arc->GetCenter() ); + + preview.Add( arc ); + preview.Add( &helperLine ); + + m_controls->SetAutoPan( true ); + } } - else - { - // Init the new item attributes - arc = new DRAWSEGMENT( m_board ); - arc->SetShape( S_ARC ); - arc->SetAngle( 0.0 ); - arc->SetWidth( m_board->GetDesignSettings().m_DrawSegmentWidth ); - arc->SetCenter( wxPoint( cursorPos.x, cursorPos.y ) ); - arc->SetLayer( layer ); - - helperLine.SetStart( arc->GetCenter() ); - helperLine.SetEnd( arc->GetCenter() ); - - preview.Add( arc ); - preview.Add( &helperLine ); - - m_controls->SetAutoPan( true ); - } - } - break; + break; case SET_END: - { - if( wxPoint( cursorPos.x, cursorPos.y ) != arc->GetCenter() ) { - VECTOR2D startLine( arc->GetArcStart() - arc->GetCenter() ); - startAngle = startLine.Angle(); - arc->SetArcStart( wxPoint( cursorPos.x, cursorPos.y ) ); - } - else - --step; // one another chance to draw a proper arc + if( wxPoint( cursorPos.x, cursorPos.y ) != arc->GetCenter() ) + { + VECTOR2D startLine( arc->GetArcStart() - arc->GetCenter() ); + startAngle = startLine.Angle(); + arc->SetArcStart( wxPoint( cursorPos.x, cursorPos.y ) ); + } + else + --step; // one another chance to draw a proper arc - } - break; + } + break; case SET_ANGLE: - { - if( wxPoint( cursorPos.x, cursorPos.y ) != arc->GetArcStart() ) { - assert( arc->GetAngle() != 0 ); - assert( arc->GetArcStart() != arc->GetArcEnd() ); - assert( arc->GetWidth() > 0 ); + if( wxPoint( cursorPos.x, cursorPos.y ) != arc->GetArcStart() ) + { + assert( arc->GetAngle() != 0 ); + assert( arc->GetArcStart() != arc->GetArcEnd() ); + assert( arc->GetWidth() > 0 ); - m_view->Add( arc ); - m_board->Add( arc ); - arc->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); + m_view->Add( arc ); + m_board->Add( arc ); + arc->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); - m_frame->OnModify(); - m_frame->SaveCopyInUndoList( arc, UR_NEW ); + m_frame->OnModify(); + m_frame->SaveCopyInUndoList( arc, UR_NEW ); - preview.Remove( arc ); - preview.Remove( &helperLine ); + preview.Remove( arc ); + preview.Remove( &helperLine ); + } + else + --step; // one another chance to draw a proper arc } - else - --step; // one another chance to draw a proper arc - } - break; + break; } if( ++step == FINISHED ) @@ -446,39 +446,39 @@ int DRAWING_TOOL::DrawDimension( TOOL_EVENT& aEvent ) switch( step ) { case SET_ORIGIN: - { - LAYER_NUM layer = m_frame->GetScreen()->m_Active_Layer; - - if( IsCopperLayer( layer ) || layer == EDGE_N ) { - DisplayInfoMessage( NULL, _( "Dimension not allowed on Copper or Edge Cut layers" ) ); - --step; + LAYER_ID layer = m_frame->GetScreen()->m_Active_Layer; + + if( IsCopperLayer( layer ) || layer == Edge_Cuts ) + { + DisplayInfoMessage( NULL, _( "Dimension not allowed on Copper or Edge Cut layers" ) ); + --step; + } + else + { + // Init the new item attributes + dimension = new DIMENSION( m_board ); + dimension->SetLayer( layer ); + dimension->SetOrigin( wxPoint( cursorPos.x, cursorPos.y ) ); + dimension->SetEnd( wxPoint( cursorPos.x, cursorPos.y ) ); + dimension->Text().SetSize( m_board->GetDesignSettings().m_PcbTextSize ); + + width = m_board->GetDesignSettings().m_PcbTextWidth; + maxThickness = Clamp_Text_PenSize( width, dimension->Text().GetSize() ); + + if( width > maxThickness ) + width = maxThickness; + + dimension->Text().SetThickness( width ); + dimension->SetWidth( width ); + dimension->AdjustDimensionDetails(); + + preview.Add( dimension ); + + m_controls->SetAutoPan( true ); + } } - else - { - // Init the new item attributes - dimension = new DIMENSION( m_board ); - dimension->SetLayer( layer ); - dimension->SetOrigin( wxPoint( cursorPos.x, cursorPos.y ) ); - dimension->SetEnd( wxPoint( cursorPos.x, cursorPos.y ) ); - dimension->Text().SetSize( m_board->GetDesignSettings().m_PcbTextSize ); - - width = m_board->GetDesignSettings().m_PcbTextWidth; - maxThickness = Clamp_Text_PenSize( width, dimension->Text().GetSize() ); - - if( width > maxThickness ) - width = maxThickness; - - dimension->Text().SetThickness( width ); - dimension->SetWidth( width ); - dimension->AdjustDimensionDetails(); - - preview.Add( dimension ); - - m_controls->SetAutoPan( true ); - } - } - break; + break; case SET_END: dimension->SetEnd( wxPoint( cursorPos.x, cursorPos.y ) ); @@ -489,23 +489,23 @@ int DRAWING_TOOL::DrawDimension( TOOL_EVENT& aEvent ) break; case SET_HEIGHT: - { - if( wxPoint( cursorPos.x, cursorPos.y ) != dimension->GetPosition() ) { - assert( dimension->GetOrigin() != dimension->GetEnd() ); - assert( dimension->GetWidth() > 0 ); + if( wxPoint( cursorPos.x, cursorPos.y ) != dimension->GetPosition() ) + { + assert( dimension->GetOrigin() != dimension->GetEnd() ); + assert( dimension->GetWidth() > 0 ); - m_view->Add( dimension ); - m_board->Add( dimension ); - dimension->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); + m_view->Add( dimension ); + m_board->Add( dimension ); + dimension->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); - m_frame->OnModify(); - m_frame->SaveCopyInUndoList( dimension, UR_NEW ); + m_frame->OnModify(); + m_frame->SaveCopyInUndoList( dimension, UR_NEW ); - preview.Remove( dimension ); + preview.Remove( dimension ); + } } - } - break; + break; } if( ++step == FINISHED ) @@ -577,7 +577,7 @@ int DRAWING_TOOL::PlaceTarget( TOOL_EVENT& aEvent ) PCB_TARGET* target = new PCB_TARGET( m_board ); // Init the new item attributes - target->SetLayer( EDGE_N ); + target->SetLayer( Edge_Cuts ); target->SetWidth( m_board->GetDesignSettings().m_EdgeSegmentWidth ); target->SetSize( Millimeter2iu( 5 ) ); VECTOR2I cursorPos = m_controls->GetCursorPosition(); @@ -840,7 +840,7 @@ int DRAWING_TOOL::drawSegment( int aShape, bool aContinous ) { if( !graphic ) { - LAYER_NUM layer = m_frame->GetScreen()->m_Active_Layer; + LAYER_ID layer = m_frame->GetScreen()->m_Active_Layer; if( IsCopperLayer( layer ) ) { diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp index a01ec83802..745c2be7bc 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -219,7 +219,7 @@ int PCBNEW_CONTROL::HighContrastDec( TOOL_EVENT& aEvent ) // Layer control int PCBNEW_CONTROL::LayerTop( TOOL_EVENT& aEvent ) { - getEditFrame()->SwitchLayer( NULL, LAYER_N_FRONT ); + getEditFrame()->SwitchLayer( NULL, F_Cu ); getEditFrame()->GetGalCanvas()->SetFocus(); setTransitions(); @@ -229,7 +229,7 @@ int PCBNEW_CONTROL::LayerTop( TOOL_EVENT& aEvent ) int PCBNEW_CONTROL::LayerInner1( TOOL_EVENT& aEvent ) { - getEditFrame()->SwitchLayer( NULL, LAYER_N_2 ); + getEditFrame()->SwitchLayer( NULL, In1_Cu ); getEditFrame()->GetGalCanvas()->SetFocus(); setTransitions(); @@ -239,7 +239,7 @@ int PCBNEW_CONTROL::LayerInner1( TOOL_EVENT& aEvent ) int PCBNEW_CONTROL::LayerInner2( TOOL_EVENT& aEvent ) { - getEditFrame()->SwitchLayer( NULL, LAYER_N_3 ); + getEditFrame()->SwitchLayer( NULL, In2_Cu ); getEditFrame()->GetGalCanvas()->SetFocus(); setTransitions(); @@ -249,7 +249,7 @@ int PCBNEW_CONTROL::LayerInner2( TOOL_EVENT& aEvent ) int PCBNEW_CONTROL::LayerInner3( TOOL_EVENT& aEvent ) { - getEditFrame()->SwitchLayer( NULL, LAYER_N_4 ); + getEditFrame()->SwitchLayer( NULL, In3_Cu ); getEditFrame()->GetGalCanvas()->SetFocus(); setTransitions(); @@ -259,7 +259,7 @@ int PCBNEW_CONTROL::LayerInner3( TOOL_EVENT& aEvent ) int PCBNEW_CONTROL::LayerInner4( TOOL_EVENT& aEvent ) { - getEditFrame()->SwitchLayer( NULL, LAYER_N_5 ); + getEditFrame()->SwitchLayer( NULL, In4_Cu ); getEditFrame()->GetGalCanvas()->SetFocus(); setTransitions(); @@ -269,7 +269,7 @@ int PCBNEW_CONTROL::LayerInner4( TOOL_EVENT& aEvent ) int PCBNEW_CONTROL::LayerInner5( TOOL_EVENT& aEvent ) { - getEditFrame()->SwitchLayer( NULL, LAYER_N_6 ); + getEditFrame()->SwitchLayer( NULL, In5_Cu ); getEditFrame()->GetGalCanvas()->SetFocus(); setTransitions(); @@ -279,7 +279,7 @@ int PCBNEW_CONTROL::LayerInner5( TOOL_EVENT& aEvent ) int PCBNEW_CONTROL::LayerInner6( TOOL_EVENT& aEvent ) { - getEditFrame()->SwitchLayer( NULL, LAYER_N_7 ); + getEditFrame()->SwitchLayer( NULL, In6_Cu ); getEditFrame()->GetGalCanvas()->SetFocus(); setTransitions(); @@ -289,7 +289,7 @@ int PCBNEW_CONTROL::LayerInner6( TOOL_EVENT& aEvent ) int PCBNEW_CONTROL::LayerBottom( TOOL_EVENT& aEvent ) { - getEditFrame()->SetActiveLayer( LAYER_N_BACK, true ); + getEditFrame()->SetActiveLayer( B_Cu, true ); getEditFrame()->GetGalCanvas()->SetFocus(); setTransitions(); @@ -300,22 +300,22 @@ int PCBNEW_CONTROL::LayerBottom( TOOL_EVENT& aEvent ) int PCBNEW_CONTROL::LayerNext( TOOL_EVENT& aEvent ) { PCB_EDIT_FRAME* editFrame = getEditFrame(); - LAYER_NUM layer = editFrame->GetActiveLayer(); + LAYER_NUM layer = editFrame->GetActiveLayer(); - if( ( layer < FIRST_COPPER_LAYER ) || ( layer >= LAST_COPPER_LAYER ) ) + if( layer < F_Cu || layer >= B_Cu ) { setTransitions(); return 0; } if( getModel()->GetCopperLayerCount() < 2 ) // Single layer - layer = LAYER_N_BACK; + layer = B_Cu; else if( layer >= getModel()->GetCopperLayerCount() - 2 ) - layer = LAYER_N_FRONT; + layer = B_Cu; else ++layer; - editFrame->SwitchLayer( NULL, layer ); + editFrame->SwitchLayer( NULL, LAYER_ID( layer ) ); editFrame->GetGalCanvas()->SetFocus(); setTransitions(); @@ -326,23 +326,23 @@ int PCBNEW_CONTROL::LayerNext( TOOL_EVENT& aEvent ) int PCBNEW_CONTROL::LayerPrev( TOOL_EVENT& aEvent ) { PCB_EDIT_FRAME* editFrame = getEditFrame(); - LAYER_NUM layer = editFrame->GetActiveLayer(); + LAYER_NUM layer = editFrame->GetActiveLayer(); - if( ( layer <= FIRST_COPPER_LAYER ) || ( layer > LAST_COPPER_LAYER ) ) + if( layer <= F_Cu || layer > B_Cu ) { setTransitions(); return 0; } if( getModel()->GetCopperLayerCount() < 2 ) // Single layer - layer = LAYER_N_BACK; - else if( layer == LAYER_N_FRONT ) - layer = std::max( LAYER_N_BACK, FIRST_COPPER_LAYER + getModel()->GetCopperLayerCount() - 2 ); + layer = B_Cu; + else if( layer == B_Cu ) + layer = std::max( int( F_Cu ), getModel()->GetCopperLayerCount() - 2 ); else --layer; assert( IsCopperLayer( layer ) ); - editFrame->SwitchLayer( NULL, layer ); + editFrame->SwitchLayer( NULL, LAYER_ID( layer ) ); editFrame->GetGalCanvas()->SetFocus(); setTransitions(); diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index ada9f09916..34f8c5b6f9 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -529,20 +529,21 @@ bool SELECTION_TOOL::selectable( const BOARD_ITEM* aItem ) const switch( aItem->Type() ) { case PCB_VIA_T: - { - // For vias it is enough if only one of layers is visible - LAYER_NUM top, bottom; - static_cast( aItem )->LayerPair( &top, &bottom ); + { + // For vias it is enough if only one of layers is visible + LAYER_ID top, bottom; - return board->IsLayerVisible( top ) || board->IsLayerVisible( bottom ); - } - break; + static_cast( aItem )->LayerPair( &top, &bottom ); + + return board->IsLayerVisible( top ) || board->IsLayerVisible( bottom ); + } + break; case PCB_MODULE_T: - if( aItem->IsOnLayer( LAYER_N_FRONT ) && board->IsElementVisible( MOD_FR_VISIBLE ) ) + if( aItem->IsOnLayer( F_Cu ) && board->IsElementVisible( MOD_FR_VISIBLE ) ) return true; - if( aItem->IsOnLayer( LAYER_N_BACK ) && board->IsElementVisible( MOD_BK_VISIBLE ) ) + if( aItem->IsOnLayer( B_Cu ) && board->IsElementVisible( MOD_BK_VISIBLE ) ) return true; return false; diff --git a/pcbnew/tr_modif.cpp b/pcbnew/tr_modif.cpp index 2e929fc9a1..5c5d5e299a 100644 --- a/pcbnew/tr_modif.cpp +++ b/pcbnew/tr_modif.cpp @@ -70,7 +70,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC, int ii, jj, nb_segm, nbconnect; wxPoint start; wxPoint end; - LAYER_MSK startmasklayer, endmasklayer; + LSET startmasklayer, endmasklayer; int netcode = aNewTrack->GetNetCode(); @@ -135,31 +135,31 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC, return 0; // Determine layers interconnected these points. - startmasklayer = StartTrack->GetLayerMask(); - endmasklayer = EndTrack->GetLayerMask(); + startmasklayer = StartTrack->GetLayerSet(); + endmasklayer = EndTrack->GetLayerSet(); // There may be a via or a pad on the end points. pt_segm = m_Pcb->m_Track->GetVia( NULL, start, startmasklayer ); if( pt_segm ) - startmasklayer |= pt_segm->GetLayerMask(); + startmasklayer |= pt_segm->GetLayerSet(); if( StartTrack->start && ( StartTrack->start->Type() == PCB_PAD_T ) ) { // Start on pad. D_PAD* pad = (D_PAD*) StartTrack->start; - startmasklayer |= pad->GetLayerMask(); + startmasklayer |= pad->GetLayerSet(); } pt_segm = m_Pcb->m_Track->GetVia( NULL, end, endmasklayer ); if( pt_segm ) - endmasklayer |= pt_segm->GetLayerMask(); + endmasklayer |= pt_segm->GetLayerSet(); if( EndTrack->end && ( EndTrack->end->Type() == PCB_PAD_T ) ) { D_PAD* pad = (D_PAD*) EndTrack->end; - endmasklayer |= pad->GetLayerMask(); + endmasklayer |= pad->GetLayerSet(); } // Mark as deleted a new track (which is not involved in the search for other connections) diff --git a/pcbnew/tracepcb.cpp b/pcbnew/tracepcb.cpp index 06ffe75859..e4992ba937 100644 --- a/pcbnew/tracepcb.cpp +++ b/pcbnew/tracepcb.cpp @@ -54,7 +54,7 @@ * The pads must appear on the layers selected in LayerMask */ static void Trace_Pads_Only( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* Module, - int ox, int oy, LAYER_MSK LayerMask, GR_DRAWMODE draw_mode ); + int ox, int oy, LSET LayerMask, GR_DRAWMODE draw_mode ); void FOOTPRINT_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) @@ -195,28 +195,30 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC, GR_DRAWMODE aDrawMode, const } } + LSET all_cu = LSET::AllCuMask(); + for( MODULE* module = m_Modules; module; module = module->Next() ) { - bool display = true; - LAYER_MSK layerMask = ALL_CU_LAYERS; + bool display = true; + LSET layerMask = all_cu; if( module->IsMoving() ) continue; if( !IsElementVisible( PCB_VISIBLE( MOD_FR_VISIBLE ) ) ) { - if( module->GetLayer() == LAYER_N_FRONT ) + if( module->GetLayer() == F_Cu ) display = false; - layerMask &= ~LAYER_FRONT; + layerMask.set( F_Cu, false ); } if( !IsElementVisible( PCB_VISIBLE( MOD_BK_VISIBLE ) ) ) { - if( module->GetLayer() == LAYER_N_BACK ) + if( module->GetLayer() == B_Cu ) display = false; - layerMask &= ~LAYER_BACK; + layerMask.set( B_Cu, false ); } if( display ) @@ -285,7 +287,7 @@ void BOARD::DrawHighLight( EDA_DRAW_PANEL* am_canvas, wxDC* DC, int aNetCode ) * The pads must appear on the layers selected in LayerMask */ static void Trace_Pads_Only( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* aModule, - int ox, int oy, LAYER_MSK aLayerMask, GR_DRAWMODE draw_mode ) + int ox, int oy, LSET aLayerMask, GR_DRAWMODE draw_mode ) { PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) panel->GetParent(); @@ -296,7 +298,7 @@ static void Trace_Pads_Only( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* aModule, // Draw pads. for( D_PAD* pad = aModule->Pads(); pad; pad = pad->Next() ) { - if( (pad->GetLayerMask() & aLayerMask) == 0 ) + if( (pad->GetLayerSet() & aLayerMask) == 0 ) continue; pad->Draw( panel, DC, draw_mode, wxPoint( ox, oy ) ); diff --git a/pcbnew/zones_by_polygon.cpp b/pcbnew/zones_by_polygon.cpp index 00492f4334..512141d5fc 100644 --- a/pcbnew/zones_by_polygon.cpp +++ b/pcbnew/zones_by_polygon.cpp @@ -376,7 +376,7 @@ void PCB_EDIT_FRAME::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* aZone ) return; } - LAYER_NUM layer = aZone->GetLayer(); + LAYER_ID layer = aZone->GetLayer(); if( DC ) { @@ -745,7 +745,7 @@ bool PCB_EDIT_FRAME::End_Zone( wxDC* DC ) m_canvas->SetMouseCapture( NULL, NULL ); // Undraw old drawings, because they can have important changes - LAYER_NUM layer = zone->GetLayer(); + LAYER_ID layer = zone->GetLayer(); GetBoard()->RedrawAreasOutlines( m_canvas, DC, GR_XOR, layer ); GetBoard()->RedrawFilledAreas( m_canvas, DC, GR_XOR, layer ); @@ -865,7 +865,7 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* aZone ) zoneInfo << *aZone; edited = InvokeKeepoutAreaEditor( this, &zoneInfo ); } - else if( aZone->GetLayer() < FIRST_NON_COPPER_LAYER ) + else if( IsCopperLayer( aZone->GetLayer() ) ) { // edit a zone on a copper layer diff --git a/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp b/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp index 8b46ad8e8b..13b1203b66 100644 --- a/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp +++ b/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp @@ -323,7 +323,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) // Add graphic items (copper texts) and board edges for( BOARD_ITEM* item = aPcb->m_Drawings; item; item = item->Next() ) { - if( item->GetLayer() != GetLayer() && item->GetLayer() != EDGE_N ) + if( item->GetLayer() != GetLayer() && item->GetLayer() != Edge_Cuts ) continue; switch( item->Type() ) diff --git a/pcbnew/zones_non_copper_type_functions.cpp b/pcbnew/zones_non_copper_type_functions.cpp index a8420eaaa2..8b35156828 100644 --- a/pcbnew/zones_non_copper_type_functions.cpp +++ b/pcbnew/zones_non_copper_type_functions.cpp @@ -99,25 +99,24 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::Init() break; } - int ii; - LAYER_NUM layer_number; - for( layer_number = FIRST_NON_COPPER_LAYER, ii = 0; - layer_number <= LAST_NON_COPPER_LAYER; - ++layer_number, ++ii ) - { - wxString msg; + int ii = 0; + + for( LSEQ seq = LSET::AllNonCuMask().Seq(); seq; ++seq, ++ii ) + { + LAYER_ID layer = *seq; + + wxString msg = m_Parent->GetBoard()->GetLayerName( layer ).Trim(); - msg = m_Parent->GetBoard()->GetLayerName( layer_number ).Trim(); m_LayerSelectionCtrl->InsertItems( 1, &msg, ii ); if( m_zone ) { - if( m_zone->GetLayer() == layer_number ) + if( m_zone->GetLayer() == layer ) m_LayerSelectionCtrl->SetSelection( ii ); } else { - if( ( (PCB_SCREEN*)( m_Parent->GetScreen() ) )->m_Active_Layer == layer_number ) + if( ( (PCB_SCREEN*) m_Parent->GetScreen() )->m_Active_Layer == layer ) m_LayerSelectionCtrl->SetSelection( ii ); } } @@ -126,7 +125,7 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::Init() void DIALOG_NON_COPPER_ZONES_EDITOR::OnOkClick( wxCommandEvent& event ) { - wxString txtvalue = m_ZoneMinThicknessCtrl->GetValue(); + wxString txtvalue = m_ZoneMinThicknessCtrl->GetValue(); m_settings.m_ZoneMinThickness = ValueFromString( g_UserUnit, txtvalue ); @@ -173,7 +172,9 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::OnOkClick( wxCommandEvent& event ) return; } - m_settings.m_CurrentZone_Layer = FIRST_NON_COPPER_LAYER + ii; + LSEQ seq = LSET::AllNonCuMask().Seq(); + + m_settings.m_CurrentZone_Layer = seq[ii]; *m_ptr = m_settings; diff --git a/polygon/PolyLine.cpp b/polygon/PolyLine.cpp index c9ca85356d..1a8b141200 100644 --- a/polygon/PolyLine.cpp +++ b/polygon/PolyLine.cpp @@ -22,7 +22,7 @@ CPolyLine::CPolyLine() { m_hatchStyle = NO_HATCH; m_hatchPitch = 0; - m_layer = LAYER_N_FRONT; + m_layer = F_Cu; m_utility = 0; }