diff --git a/3d-viewer/3d_draw.cpp b/3d-viewer/3d_draw.cpp index f653ad27da..f8ba411577 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/TODO.txt b/TODO.txt index ee0b19e8a1..7cb4d3325d 100644 --- a/TODO.txt +++ b/TODO.txt @@ -60,6 +60,8 @@ PCBNew *) Paste (module ...) from clipboard into module editor. + + Dick's Final TODO List: ====================== *) Get licensing cleaned up. @@ -75,3 +77,5 @@ Dick's Final TODO List: * Clear all/some? retained strings on project change. * Clear the FP_LIB_TABLE when the last KIWAY_PLAYER using it is closed. + +Fix export gencad \ No newline at end of file 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..9bfdd84ac4 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; @@ -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 ); } } + 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, "SetPath( param.m_Group ); else aCfg->SetPath( aGroup ); @@ -57,7 +57,7 @@ void wxConfigSaveParams( wxConfigBase* aCfg, if( param.m_Type == PARAM_COMMAND_ERASE ) // Erase all data { - if( param.m_Ident ) + if( !!param.m_Ident ) aCfg->DeleteGroup( param.m_Ident ); } else @@ -75,7 +75,7 @@ void wxConfigLoadParams( wxConfigBase* aCfg, BOOST_FOREACH( const PARAM_CFG_BASE& param, aList ) { - if( param.m_Group ) + if( !!param.m_Group ) aCfg->SetPath( param.m_Group ); else aCfg->SetPath( aGroup ); @@ -99,7 +99,7 @@ void wxConfigSaveSetups( wxConfigBase* aCfg, const PARAM_CFG_ARRAY& aList ) if( param.m_Type == PARAM_COMMAND_ERASE ) // Erase all data { - if( param.m_Ident ) + if( !!param.m_Ident ) aCfg->DeleteGroup( param.m_Ident ); } else @@ -137,7 +137,7 @@ void ConfigBaseWriteDouble( wxConfigBase* aConfig, const wxString& aKey, double } -PARAM_CFG_BASE::PARAM_CFG_BASE( const wxChar* ident, const paramcfg_id type, +PARAM_CFG_BASE::PARAM_CFG_BASE( const wxString& ident, const paramcfg_id type, const wxChar* group ) { m_Ident = ident; @@ -147,7 +147,7 @@ PARAM_CFG_BASE::PARAM_CFG_BASE( const wxChar* ident, const paramcfg_id type, } -PARAM_CFG_INT::PARAM_CFG_INT( const wxChar* ident, int* ptparam, +PARAM_CFG_INT::PARAM_CFG_INT( const wxString& ident, int* ptparam, int default_val, int min, int max, const wxChar* group ) : PARAM_CFG_BASE( ident, PARAM_INT, group ) @@ -159,7 +159,7 @@ PARAM_CFG_INT::PARAM_CFG_INT( const wxChar* ident, int* ptparam, } -PARAM_CFG_INT::PARAM_CFG_INT( bool Insetup, const wxChar* ident, int* ptparam, +PARAM_CFG_INT::PARAM_CFG_INT( bool Insetup, const wxString& ident, int* ptparam, int default_val, int min, int max, const wxChar* group ) : PARAM_CFG_BASE( ident, PARAM_INT, group ) @@ -195,7 +195,7 @@ void PARAM_CFG_INT::SaveParam( wxConfigBase* aConfig ) const } -PARAM_CFG_INT_WITH_SCALE::PARAM_CFG_INT_WITH_SCALE( const wxChar* ident, int* ptparam, +PARAM_CFG_INT_WITH_SCALE::PARAM_CFG_INT_WITH_SCALE( const wxString& ident, int* ptparam, int default_val, int min, int max, const wxChar* group, double aBiu2cfgunit ) : PARAM_CFG_INT( ident, ptparam, default_val, min, max, group ) @@ -206,7 +206,7 @@ PARAM_CFG_INT_WITH_SCALE::PARAM_CFG_INT_WITH_SCALE( const wxChar* ident, int* pt PARAM_CFG_INT_WITH_SCALE::PARAM_CFG_INT_WITH_SCALE( bool Insetup, - const wxChar* ident, int* ptparam, + const wxString& ident, int* ptparam, int default_val, int min, int max, const wxChar* group, double aBiu2cfgunit ) : PARAM_CFG_INT( Insetup, ident, ptparam, default_val, min, max, group ) @@ -246,7 +246,7 @@ void PARAM_CFG_INT_WITH_SCALE::SaveParam( wxConfigBase* aConfig ) const } -PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( const wxChar* ident, EDA_COLOR_T* ptparam, +PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( const wxString& ident, EDA_COLOR_T* ptparam, EDA_COLOR_T default_val, const wxChar* group ) : PARAM_CFG_BASE( ident, PARAM_SETCOLOR, group ) @@ -257,7 +257,7 @@ PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( const wxChar* ident, EDA_COLOR_T* ptpara PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( bool Insetup, - const wxChar* ident, + const wxString& ident, EDA_COLOR_T* ptparam, EDA_COLOR_T default_val, const wxChar* group ) : @@ -291,7 +291,7 @@ void PARAM_CFG_SETCOLOR::SaveParam( wxConfigBase* aConfig ) const } -PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE( const wxChar* ident, double* ptparam, +PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE( const wxString& ident, double* ptparam, double default_val, double min, double max, const wxChar* group ) : PARAM_CFG_BASE( ident, PARAM_DOUBLE, group ) @@ -304,7 +304,7 @@ PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE( const wxChar* ident, double* ptparam, PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE( bool Insetup, - const wxChar* ident, + const wxString& ident, double* ptparam, double default_val, double min, @@ -348,7 +348,7 @@ void PARAM_CFG_DOUBLE::SaveParam( wxConfigBase* aConfig ) const } -PARAM_CFG_BOOL::PARAM_CFG_BOOL( const wxChar* ident, bool* ptparam, +PARAM_CFG_BOOL::PARAM_CFG_BOOL( const wxString& ident, bool* ptparam, int default_val, const wxChar* group ) : PARAM_CFG_BASE( ident, PARAM_BOOL, group ) { @@ -358,7 +358,7 @@ PARAM_CFG_BOOL::PARAM_CFG_BOOL( const wxChar* ident, bool* ptparam, PARAM_CFG_BOOL::PARAM_CFG_BOOL( bool Insetup, - const wxChar* ident, + const wxString& ident, bool* ptparam, int default_val, const wxChar* group ) : @@ -390,7 +390,7 @@ void PARAM_CFG_BOOL::SaveParam( wxConfigBase* aConfig ) const } -PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( const wxChar* ident, +PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( const wxString& ident, wxString* ptparam, const wxChar* group ) : PARAM_CFG_BASE( ident, PARAM_WXSTRING, group ) @@ -399,7 +399,7 @@ PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( const wxChar* ident, } -PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( bool Insetup, const wxChar* ident, +PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( bool Insetup, const wxString& ident, wxString* ptparam, const wxString& default_val, const wxChar* group ) : @@ -407,7 +407,7 @@ PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( bool Insetup, const wxChar* ident, { m_Pt_param = ptparam; m_Setup = Insetup; - m_default = default_val; + m_default = default_val; } @@ -429,7 +429,7 @@ void PARAM_CFG_WXSTRING::SaveParam( wxConfigBase* aConfig ) const } -PARAM_CFG_FILENAME::PARAM_CFG_FILENAME( const wxChar* ident, +PARAM_CFG_FILENAME::PARAM_CFG_FILENAME( const wxString& ident, wxString* ptparam, const wxChar* group ) : PARAM_CFG_BASE( ident, PARAM_FILENAME, group ) diff --git a/common/copy_to_clipboard.cpp b/common/copy_to_clipboard.cpp index 5e710d81a7..fef6bb90cc 100644 --- a/common/copy_to_clipboard.cpp +++ b/common/copy_to_clipboard.cpp @@ -109,7 +109,8 @@ bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame ) dc.SetClippingRegion( DrawArea ); } - aFrame->PrintPage( &dc, FULL_LAYERS, false ); + const LSET allLayersMask = LSET().set(); + aFrame->PrintPage( &dc, allLayersMask, false ); screen->m_IsPrinting = false; aFrame->GetCanvas()->SetClipBox( tmp ); wxMetafile* mf = dc.Close(); diff --git a/common/draw_frame.cpp b/common/draw_frame.cpp index 82b65f6c99..182e54fb6f 100644 --- a/common/draw_frame.cpp +++ b/common/draw_frame.cpp @@ -331,7 +331,7 @@ void EDA_DRAW_FRAME::ToolOnRightClick( wxCommandEvent& event ) } -void EDA_DRAW_FRAME::PrintPage( wxDC* aDC,LAYER_MSK aPrintMask, bool aPrintMirrorMode, void* aData ) +void EDA_DRAW_FRAME::PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode, void* aData ) { wxMessageBox( wxT("EDA_DRAW_FRAME::PrintPage() error") ); } diff --git a/common/lset.cpp b/common/lset.cpp new file mode 100644 index 0000000000..3ec3607a92 --- /dev/null +++ b/common/lset.cpp @@ -0,0 +1,654 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck + * Copyright (C) 2014 KiCad Developers, see change_log.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + + +#include +#include + +#include +#include + + +LSET::LSET( const LAYER_ID* aArray, unsigned aCount ) : + BASE_SET() +{ + for( unsigned i=0; i=1. + wxASSERT_MSG( aIdCount > 0, wxT( "aIdCount must be >= 1" ) ); + + set( aFirst ); + + if( --aIdCount ) + { + va_list ap; + + va_start( ap, aFirst ); + + for( unsigned i=0; i rend ) + { + int cc = *rstart--; + + if( cc == '_' ) + continue; + + int nibble; + + if( cc >= '0' && cc <= '9' ) + nibble = cc - '0'; + else if( cc >= 'a' && cc <= 'f' ) + nibble = cc - 'a' + 10; + else if( cc >= 'A' && cc <= 'F' ) + nibble = cc - 'A' + 10; + else + break; + + int bit = nibble_ndx * 4; + + for( int ndx=0; bit= bitcount ) + break; + + ++nibble_ndx; + } + + int byte_count = aStart + aCount - 1 - rstart; + + assert( byte_count >= 0 ); + + if( byte_count > 0 ) + *this = tmp; + + return byte_count; +} + + +LSEQ LSET::Seq( const LAYER_ID* aWishListSequence, unsigned aCount ) const +{ + LSEQ ret; + +#if defined(DEBUG) && 0 + LSET dup_detector; + + for( unsigned i=0; i 1 ) + return UNDEFINED_LAYER; + + for( unsigned i=0; i < size(); ++i ) + { + if( test( i ) ) + return LAYER_ID( i ); + } + + wxASSERT( 0 ); // set_count was verified as 1 above, what did you break? + + return UNDEFINED_LAYER; +} + + +LSET LSET::InternalCuMask() +{ + static const LAYER_ID cu_internals[] = { + 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, + }; + + static const LSET saved( cu_internals, DIM( cu_internals ) ); + return saved; +} + + +LSET LSET::AllCuMask( int aCuLayerCount ) +{ + // retain all in static as the full set, which is a common case. + static const LSET all = InternalCuMask().set( F_Cu ).set( B_Cu ); + + if( aCuLayerCount == MAX_CU_LAYERS ) + return all; + + // subtract out some Cu layers not wanted in the mask. + LSET ret = all; + int clear_count = MAX_CU_LAYERS - aCuLayerCount; + + clear_count = Clamp( 0, clear_count, MAX_CU_LAYERS - 2 ); + + for( LAYER_NUM elem=In30_Cu; clear_count; --elem, --clear_count ) + { + ret.set( elem, false ); + } + + return ret; +} + + +LSET LSET::AllNonCuMask() +{ + static const LSET saved = LSET().set() & ~AllCuMask(); + return saved; +} + + +LSET LSET::AllLayersMask() +{ + static const LSET saved = LSET().set(); + return saved; +} + + +LSET LSET::BackTechMask() +{ + // (SILKSCREEN_LAYER_BACK | SOLDERMASK_LAYER_BACK | ADHESIVE_LAYER_BACK | SOLDERPASTE_LAYER_BACK) + static const LSET saved( 6, B_SilkS, B_Mask, B_Adhes, B_Paste, B_CrtYd, B_Fab ); + return saved; +} + + +LSET LSET::FrontTechMask() +{ + // (SILKSCREEN_LAYER_FRONT | SOLDERMASK_LAYER_FRONT | ADHESIVE_LAYER_FRONT | SOLDERPASTE_LAYER_FRONT) + static const LSET saved( 6, F_SilkS, F_Mask, F_Adhes, F_Paste, F_CrtYd, F_Fab ); + return saved; +} + + +LSET LSET::AllTechMask() +{ + static const LSET saved = BackTechMask() | FrontTechMask(); + return saved; +} + + +LSET LSET::UserMask() +{ + static const LSET saved( 6, + Dwgs_User, + Cmts_User, + Eco1_User, + Eco2_User, + Edge_Cuts, + Margin + ); + + return saved; +} + + +LSET LSET::FrontMask() +{ + static const LSET saved = FrontTechMask().set( F_Cu ); + return saved; +} + + +LSET LSET::BackMask() +{ + static const LSET saved = BackTechMask().set( B_Cu ); + return saved; +} + + +LSEQ LSET::UIOrder() const +{ + LAYER_ID order[Margin+1]; + + // Assmuming that the LAYER_ID order is according to preferred UI order, as of + // today this is true. When that becomes not true, its easy to change the order + // in here to compensate. + + for( unsigned i=0; i 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 b0e8c74011..8ad74ebe33 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -934,7 +934,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/block.cpp b/gerbview/block.cpp index 912113538a..1218322b54 100644 --- a/gerbview/block.cpp +++ b/gerbview/block.cpp @@ -35,6 +35,7 @@ #include #include +#include #include #include diff --git a/gerbview/class_DCodeSelectionbox.cpp b/gerbview/class_DCodeSelectionbox.cpp index 84cf9cdc54..fc98ae6b55 100644 --- a/gerbview/class_DCodeSelectionbox.cpp +++ b/gerbview/class_DCodeSelectionbox.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include diff --git a/gerbview/class_GERBER.cpp b/gerbview/class_GERBER.cpp index 5ae04d5083..eeb10ff0e8 100644 --- a/gerbview/class_GERBER.cpp +++ b/gerbview/class_GERBER.cpp @@ -34,6 +34,7 @@ #include #include +#include #include diff --git a/gerbview/class_excellon.h b/gerbview/class_excellon.h index 07d2800b0d..555d2a310e 100644 --- a/gerbview/class_excellon.h +++ b/gerbview/class_excellon.h @@ -76,7 +76,7 @@ private: excellon_state m_State; // state of excellon file analysis bool m_SlotOn; // true during an oval driil definition -public: EXCELLON_IMAGE( GERBVIEW_FRAME* aParent, LAYER_NUM layer ) : +public: EXCELLON_IMAGE( GERBVIEW_FRAME* aParent, int layer ) : GERBER_IMAGE( aParent, layer ) { m_State = READ_HEADER_STATE; diff --git a/gerbview/class_gbr_layer_box_selector.cpp b/gerbview/class_gbr_layer_box_selector.cpp index cd598482b2..2410bf078c 100644 --- a/gerbview/class_gbr_layer_box_selector.cpp +++ b/gerbview/class_gbr_layer_box_selector.cpp @@ -40,7 +40,7 @@ void GBR_LAYER_BOX_SELECTOR::Resync() { Clear(); - for( LAYER_NUM layerid = FIRST_LAYER; layerid < NB_LAYERS; ++layerid ) + for( int layerid = 0; layerid < GERBER_DRAWLAYERS_COUNT; ++layerid ) { wxBitmap layerbmp( 14, 14 ); wxString layername; @@ -59,7 +59,7 @@ void GBR_LAYER_BOX_SELECTOR::Resync() // Returns a color index from the layer id -EDA_COLOR_T GBR_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayer ) const +EDA_COLOR_T GBR_LAYER_BOX_SELECTOR::GetLayerColor( int aLayer ) const { GERBVIEW_FRAME* frame = (GERBVIEW_FRAME*) GetParent()->GetParent(); @@ -68,7 +68,7 @@ EDA_COLOR_T GBR_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayer ) const // Returns the name of the layer id -wxString GBR_LAYER_BOX_SELECTOR::GetLayerName( LAYER_NUM aLayer ) const +wxString GBR_LAYER_BOX_SELECTOR::GetLayerName( int aLayer ) const { wxString name; name.Printf( _( "Layer %d" ), aLayer + 1 ); diff --git a/gerbview/class_gbr_layer_box_selector.h b/gerbview/class_gbr_layer_box_selector.h index dc78cf93b7..f404566ebc 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 @@ -24,15 +22,14 @@ public: // Returns a color index from the layer id // Virtual function - EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const; + EDA_COLOR_T GetLayerColor( int aLayer ) const; // Returns true if the layer id is enabled (i.e. is it should be displayed) // Virtual function - bool IsLayerEnabled( LAYER_NUM aLayer ) const { return true; }; + bool IsLayerEnabled( int aLayer ) const { return true; }; // Returns the name of the layer id - // Virtual function - wxString GetLayerName( LAYER_NUM aLayer ) const; + wxString GetLayerName( int aLayer ) const; }; #endif //CLASS_GBR_LAYER_BOX_SELECTOR_H diff --git a/gerbview/class_gbr_layout.cpp b/gerbview/class_gbr_layout.cpp index ad475e07f6..fee2bae61f 100644 --- a/gerbview/class_gbr_layout.cpp +++ b/gerbview/class_gbr_layout.cpp @@ -14,7 +14,9 @@ GBR_LAYOUT::GBR_LAYOUT() { PAGE_INFO pageInfo( wxT( "GERBER" ) ); SetPageSettings( pageInfo ); - m_printLayersMask = FULL_LAYERS; + +// no m_printLayersMask = -1; + m_printLayersMask.set(); } @@ -22,16 +24,6 @@ GBR_LAYOUT::~GBR_LAYOUT() { } -/* Function IsLayerVisible - * tests whether a given layer is visible - * param aLayer = The layer to be tested - * return bool - true if the layer is visible. - */ -bool GBR_LAYOUT::IsLayerVisible( LAYER_NUM aLayer ) const -{ - return m_printLayersMask & GetLayerMask( aLayer ); -} - EDA_RECT GBR_LAYOUT::ComputeBoundingBox() { diff --git a/gerbview/class_gbr_layout.h b/gerbview/class_gbr_layout.h index da0c511604..2bce7de431 100644 --- a/gerbview/class_gbr_layout.h +++ b/gerbview/class_gbr_layout.h @@ -11,6 +11,7 @@ #include #include // PAGE_INFO +#include // GERBER_DRAWLAYERS_COUNT #include #include @@ -23,11 +24,11 @@ class GBR_LAYOUT { private: - EDA_RECT m_BoundingBox; - PAGE_INFO m_paper; - TITLE_BLOCK m_titles; - wxPoint m_originAxisPosition; - LAYER_MSK m_printLayersMask; // When printing: the list of layers to print + EDA_RECT m_BoundingBox; + PAGE_INFO m_paper; + TITLE_BLOCK m_titles; + wxPoint m_originAxisPosition; + std::bitset m_printLayersMask; // When printing: the list of layers to print public: DLIST m_Drawings; // linked list of Gerber Items @@ -87,24 +88,35 @@ public: void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode, const wxPoint& aOffset, bool aPrintBlackAndWhite = false ); - /** - * Function SetVisibleLayers - * changes the bit-mask of visible layers - * @param aLayerMask = The new bit-mask of visible layers + * Function SetPrintableLayers + * changes the list of printable layers + * @param aLayerMask = The new bit-mask of printable layers */ - void SetVisibleLayers( LAYER_MSK aLayerMask ) + void SetPrintableLayers( const std::bitset & aLayerMask ) { m_printLayersMask = aLayerMask; } /** - * Function IsLayerVisible + * Function GetPrintableLayers + * @return the bit-mask of printable layers + */ + std::bitset GetPrintableLayers() + { + return m_printLayersMask; + } + + /** + * Function IsLayerPrintable * tests whether a given layer is visible * @param aLayer = The layer to be tested * @return bool - true if the layer is visible. */ - bool IsLayerVisible( LAYER_NUM aLayer ) const; + bool IsLayerPrintable( int aLayer ) const + { + return m_printLayersMask[ aLayer ]; + } #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const; // overload 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.cpp b/gerbview/class_gerber_draw_item.cpp index f01f3d5d55..e7e2341f8c 100644 --- a/gerbview/class_gerber_draw_item.cpp +++ b/gerbview/class_gerber_draw_item.cpp @@ -36,6 +36,7 @@ #include #include +#include #include #include @@ -44,7 +45,7 @@ GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( GBR_LAYOUT* aParent, GERBER_IMAGE* aGerberpa EDA_ITEM( (EDA_ITEM*)aParent, TYPE_GERBER_DRAW_ITEM ) { m_imageParams = aGerberparams; - m_Layer = FIRST_LAYER; + m_Layer = 0; m_Shape = GBR_SEGMENT; m_Flashed = false; m_DCode = 0; diff --git a/gerbview/class_gerber_draw_item.h b/gerbview/class_gerber_draw_item.h index c7a0b695cc..49e3340c6c 100644 --- a/gerbview/class_gerber_draw_item.h +++ b/gerbview/class_gerber_draw_item.h @@ -90,7 +90,7 @@ public: * redundancy for these parameters */ private: - LAYER_NUM m_Layer; + int m_Layer; // These values are used to draw this item, according to gerber layers parameters // Because they can change inside a gerber image, they are stored here @@ -123,7 +123,7 @@ public: * Function GetLayer * returns the layer this item is on. */ - LAYER_NUM GetLayer() const { return m_Layer; } + int GetLayer() const { return m_Layer; } /** * Function SetLayer @@ -132,12 +132,7 @@ public: * is virtual because some items (in fact: class DIMENSION) * have a slightly different initialization */ - void SetLayer( LAYER_NUM aLayer ) { m_Layer = aLayer; } - - LAYER_MSK GetLayerMask() - { - return ::GetLayerMask( m_Layer ); - } + void SetLayer( int aLayer ) { m_Layer = aLayer; } bool GetLayerPolarity() { diff --git a/gerbview/class_gerbview_layer_widget.cpp b/gerbview/class_gerbview_layer_widget.cpp index 911f2594f3..6101db824d 100644 --- a/gerbview/class_gerbview_layer_widget.cpp +++ b/gerbview/class_gerbview_layer_widget.cpp @@ -37,6 +37,7 @@ #include #include +#include #include #include #include @@ -166,10 +167,10 @@ void GERBER_LAYER_WIDGET::onRightDownLayers( wxMouseEvent& event ) 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; + int rowCount; + int menuId = event.GetId(); + bool visible = (menuId == ID_SHOW_ALL_LAYERS) ? true : false;; + long visibleLayers = 0; bool force_active_layer_visible; m_alwaysShowActiveLayer = ( menuId == ID_ALWAYS_SHOW_NO_LAYERS_BUT_ACTIVE ); @@ -186,7 +187,7 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) for( int row=0; row < rowCount; ++row ) { wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 ); - LAYER_NUM layer = getDecodedId( cb->GetId() ); + int layer = getDecodedId( cb->GetId() ); bool loc_visible = visible; if( force_active_layer_visible && (layer == myframe->getActiveLayer() ) ) @@ -195,9 +196,9 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) cb->SetValue( loc_visible ); if( loc_visible ) - visibleLayers |= GetLayerMask( row ); + visibleLayers |= 1 << row; else - visibleLayers &= ~GetLayerMask( row ); + visibleLayers &= ~( 1 << row ); } myframe->SetVisibleLayers( visibleLayers ); @@ -224,7 +225,7 @@ void GERBER_LAYER_WIDGET::ReFill() { ClearLayerRows(); - for( LAYER_NUM layer = FIRST_LAYER; layer < NB_GERBER_LAYERS; ++layer ) + for( int layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer ) { wxString msg; msg.Printf( _("Layer %d"), layer+1 ); @@ -237,18 +238,18 @@ 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(); myframe->GetCanvas()->Refresh(); } -bool GERBER_LAYER_WIDGET::OnLayerSelect( LAYER_NUM aLayer ) +bool GERBER_LAYER_WIDGET::OnLayerSelect( int aLayer ) { // the layer change from the GERBER_LAYER_WIDGET can be denied by returning // false from this function. - LAYER_NUM layer = myframe->getActiveLayer( ); + int layer = myframe->getActiveLayer( ); myframe->setActiveLayer( aLayer, false ); myframe->syncLayerBox(); @@ -261,14 +262,14 @@ bool GERBER_LAYER_WIDGET::OnLayerSelect( LAYER_NUM aLayer ) return true; } -void GERBER_LAYER_WIDGET::OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal ) +void GERBER_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal ) { - LAYER_MSK visibleLayers = myframe->GetVisibleLayers(); + long visibleLayers = myframe->GetVisibleLayers(); if( isVisible ) - visibleLayers |= GetLayerMask( aLayer ); + visibleLayers |= 1 << aLayer; else - visibleLayers &= ~GetLayerMask( aLayer ); + visibleLayers &= ~( 1 << 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/controle.cpp b/gerbview/controle.cpp index 150b23d064..2bfd01e8d3 100644 --- a/gerbview/controle.cpp +++ b/gerbview/controle.cpp @@ -30,6 +30,7 @@ #include #include #include +#include void GERBVIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey ) diff --git a/gerbview/dcode.cpp b/gerbview/dcode.cpp index 5e1dc793c3..8063b81b0c 100644 --- a/gerbview/dcode.cpp +++ b/gerbview/dcode.cpp @@ -38,6 +38,7 @@ #include #include +#include #include #include diff --git a/gerbview/dialogs/dialog_print_using_printer.cpp b/gerbview/dialogs/dialog_print_using_printer.cpp index 3f9f338416..95e938282a 100644 --- a/gerbview/dialogs/dialog_print_using_printer.cpp +++ b/gerbview/dialogs/dialog_print_using_printer.cpp @@ -6,7 +6,7 @@ #define wxTEST_POSTSCRIPT_IN_MSW 1 #include -//#include + #include #include #include @@ -16,9 +16,9 @@ #include #include +#include #include -static long s_SelectedLayers; static double s_ScaleList[] = { 0, 0.5, 0.7, 0.999, 1.0, 1.4, 2.0, 3.0, 4.0 }; @@ -27,8 +27,8 @@ static double s_ScaleList[] = #define MAX_SCALE 100.0 // static print data and page setup data, to remember settings during the session -static wxPrintData* g_PrintData; -static wxPageSetupDialogData* g_pageSetupData = (wxPageSetupDialogData*) NULL; +static wxPrintData* s_printData; +static wxPageSetupDialogData* s_pageSetupData = (wxPageSetupDialogData*) NULL; // Variables locales static PRINT_PARAMETERS s_Parameters; @@ -41,8 +41,8 @@ class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_BASE { private: GERBVIEW_FRAME* m_Parent; - wxConfigBase* m_Config; - wxCheckBox* m_BoxSelectLayer[32]; + wxConfigBase* m_Config; + wxCheckBox* m_BoxSelectLayer[32]; public: DIALOG_PRINT_USING_PRINTER( GERBVIEW_FRAME* parent ); @@ -63,7 +63,10 @@ private: public: bool IsMirrored() { return m_Print_Mirror->IsChecked(); } bool PrintUsingSinglePage() { return true; } - int SetLayerMaskFromListSelection(); + int SetLayerSetFromListSelection(); + // Prepare print parameters. return true if OK, + // false if there is an issue (mainly no printable layers) + bool PreparePrintPrms(); }; @@ -75,17 +78,17 @@ void GERBVIEW_FRAME::ToPrinter( wxCommandEvent& event ) * Display the print dialog */ { - if( g_PrintData == NULL ) // First print - g_PrintData = new wxPrintData(); + if( s_printData == NULL ) // First print + s_printData = new wxPrintData(); - if( !g_PrintData->Ok() ) + if( !s_printData->Ok() ) { DisplayError( this, _( "Error Init Printer info" ) ); return; } - g_PrintData->SetQuality( wxPRINT_QUALITY_HIGH ); - g_PrintData->SetOrientation( GetPageSettings().IsPortrait() ? + s_printData->SetQuality( wxPRINT_QUALITY_HIGH ); + s_printData->SetOrientation( GetPageSettings().IsPortrait() ? wxPORTRAIT : wxLANDSCAPE ); DIALOG_PRINT_USING_PRINTER* frame = new DIALOG_PRINT_USING_PRINTER( this ); @@ -118,31 +121,29 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) /************************************************************************/ { SetFocus(); - LAYER_NUM layer_max = NB_GERBER_LAYERS; wxString msg; - if( g_pageSetupData == NULL ) + if( s_pageSetupData == NULL ) { - g_pageSetupData = new wxPageSetupDialogData; + s_pageSetupData = new wxPageSetupDialogData; // Set initial page margins. - // Margins are already set in Pcbnew, so we can use 0 - g_pageSetupData->SetMarginTopLeft(wxPoint(0, 0)); - g_pageSetupData->SetMarginBottomRight(wxPoint(0, 0)); + // Margins are already set in Gerbview, so we can use 0 + s_pageSetupData->SetMarginTopLeft(wxPoint(0, 0)); + s_pageSetupData->SetMarginBottomRight(wxPoint(0, 0)); } - s_Parameters.m_PageSetupData = g_pageSetupData; + s_Parameters.m_PageSetupData = s_pageSetupData; - layer_max = NB_LAYERS; // Create layer list - for( LAYER_NUM ii = FIRST_LAYER; ii < layer_max; ++ii ) + for( int ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii ) { - LAYER_MSK mask = GetLayerMask( ii ); msg = _( "Layer" ); msg << wxT( " " ) << ii + 1; m_BoxSelectLayer[ii] = new wxCheckBox( this, -1, msg ); - if( mask & s_SelectedLayers ) - m_BoxSelectLayer[ii]->SetValue( true ); + if( g_GERBER_List[ii] == NULL ) // Nothing loaded on this draw layer + m_BoxSelectLayer[ii]->Enable( false ); + if( ii < 16 ) m_leftLayersBoxSizer->Add( m_BoxSelectLayer[ii], wxGROW | wxLEFT | wxRIGHT | wxTOP ); @@ -170,21 +171,14 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) s_Parameters.m_YScaleAdjust > MAX_SCALE ) s_Parameters.m_XScaleAdjust = s_Parameters.m_YScaleAdjust = 1.0; - s_SelectedLayers = 0; - for( LAYER_NUM layer = FIRST_LAYER; layer < layer_max; ++layer ) + for( int layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer ) { wxString layerKey; bool option; layerKey.Printf( OPTKEY_LAYERBASE, layer ); - - option = false; - if( m_Config->Read( layerKey, &option ) ) - { - m_BoxSelectLayer[layer]->SetValue( option ); - if( option ) - s_SelectedLayers |= GetLayerMask( layer ); - } + m_Config->Read( layerKey, &option, false ); + m_BoxSelectLayer[layer]->SetValue( option ); } } @@ -214,30 +208,29 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) m_FineAdjustYscaleOpt->Enable(enable); } -/**************************************************************/ -int DIALOG_PRINT_USING_PRINTER::SetLayerMaskFromListSelection() -/**************************************************************/ +int DIALOG_PRINT_USING_PRINTER::SetLayerSetFromListSelection() { int page_count = 0; - s_Parameters.m_PrintMaskLayer = NO_LAYERS; - for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii ) + std::bitset layerMask; + for( int ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii ) { - if( m_BoxSelectLayer[ii]->IsChecked() ) + if( m_BoxSelectLayer[ii]->IsChecked() && m_BoxSelectLayer[ii]->IsEnabled() ) { page_count++; - s_Parameters.m_PrintMaskLayer |= GetLayerMask( ii ); + layerMask[ii] = true; } + else + layerMask[ii] = false; } + m_Parent->GetGerberLayout()->SetPrintableLayers( layerMask ); s_Parameters.m_PageCount = page_count; return page_count; } -/********************************************************************/ void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event ) -/********************************************************************/ { SetPrintParameters(); @@ -249,19 +242,18 @@ void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event ) m_Config->Write( OPTKEY_PRINT_PAGE_FRAME, s_Parameters.m_Print_Sheet_Ref); m_Config->Write( OPTKEY_PRINT_MONOCHROME_MODE, s_Parameters.m_Print_Black_and_White); wxString layerKey; - for( LAYER_NUM layer = FIRST_LAYER; layer < NB_GERBER_LAYERS; ++layer ) + for( int layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer ) { layerKey.Printf( OPTKEY_LAYERBASE, layer ); m_Config->Write( layerKey, m_BoxSelectLayer[layer]->IsChecked() ); } } + EndModal( 0 ); } -/******************************************************************/ void DIALOG_PRINT_USING_PRINTER::SetPrintParameters( ) -/******************************************************************/ { s_Parameters.m_PrintMirror = m_Print_Mirror->GetValue(); s_Parameters.m_Print_Black_and_White = @@ -271,7 +263,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]; @@ -303,38 +295,45 @@ void DIALOG_PRINT_USING_PRINTER::OnScaleSelectionClick( wxCommandEvent& event ) m_FineAdjustYscaleOpt->Enable(enable); } -/**********************************************************/ +// Open a dialog box for printer setup (printer options, page size ...) void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event ) -/**********************************************************/ - -/* Open a dialog box for printer setup (printer options, page size ...) - */ { - *g_pageSetupData = *g_PrintData; + *s_pageSetupData = *s_printData; - wxPageSetupDialog pageSetupDialog(this, g_pageSetupData); + wxPageSetupDialog pageSetupDialog(this, s_pageSetupData); pageSetupDialog.ShowModal(); - (*g_PrintData) = pageSetupDialog.GetPageSetupDialogData().GetPrintData(); - (*g_pageSetupData) = pageSetupDialog.GetPageSetupDialogData(); + (*s_printData) = pageSetupDialog.GetPageSetupDialogData().GetPrintData(); + (*s_pageSetupData) = pageSetupDialog.GetPageSetupDialogData(); } - -/************************************************************/ -void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event ) -/************************************************************/ - -/* Open and display a previewer frame for printing - */ +bool DIALOG_PRINT_USING_PRINTER::PreparePrintPrms() { SetPrintParameters( ); + // If no layer selected, we have no plot. prompt user if it happens + // because he could think there is a bug in Pcbnew: + if( m_Parent->GetGerberLayout()->GetPrintableLayers().none() ) + { + DisplayError( this, _( "No layer selected" ) ); + return false; + } + + return true; +} + +// Open and display a previewer frame for printing +void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event ) +{ + if( !PreparePrintPrms() ) + return; + // Pass two printout objects: for preview, and possible printing. wxString title = _( "Print Preview" ); wxPrintPreview* preview = new wxPrintPreview( new BOARD_PRINTOUT_CONTROLLER( s_Parameters, m_Parent, title ), new BOARD_PRINTOUT_CONTROLLER( s_Parameters, m_Parent, title ), - g_PrintData ); + s_printData ); if( preview == NULL ) { @@ -342,16 +341,6 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event ) return; } - SetLayerMaskFromListSelection(); - - // If no layer selected, we have no plot. prompt user if it happens - // because he could think there is a bug in Pcbnew: - if( s_Parameters.m_PrintMaskLayer == 0 ) - { - DisplayError( this, _( "No layer selected" ) ); - return; - } - // Uses the parent position and size. // @todo uses last position and size ans store them when exit in m_Config @@ -365,29 +354,16 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event ) } -/***************************************************************************/ void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event ) -/***************************************************************************/ - -/* Called on activate Print button - */ { - SetPrintParameters( ); - - // If no layer selected, we have no plot. prompt user if it happens - // because he could think there is a bug in Pcbnew: - if( s_Parameters.m_PrintMaskLayer == 0 ) - { - DisplayError( this, _( "No layer selected" ) ); + if( !PreparePrintPrms() ) return; - } - wxPrintDialogData printDialogData( *g_PrintData ); + wxPrintDialogData printDialogData( *s_printData ); - wxPrinter printer( &printDialogData ); - - wxString title = _( "Print" ); - BOARD_PRINTOUT_CONTROLLER printout( s_Parameters, m_Parent, title ); + wxPrinter printer( &printDialogData ); + wxString title = _( "Print" ); + BOARD_PRINTOUT_CONTROLLER printout( s_Parameters, m_Parent, title ); #if !defined(__WINDOWS__) && !wxCHECK_VERSION(2,9,0) wxDC* dc = printout.GetDC(); @@ -402,7 +378,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event ) } else { - *g_PrintData = printer.GetPrintDialogData().GetPrintData(); + *s_printData = printer.GetPrintDialogData().GetPrintData(); } } diff --git a/gerbview/dialogs/dialog_select_one_pcb_layer.cpp b/gerbview/dialogs/dialog_select_one_pcb_layer.cpp index 80dd1b46cc..00dcc9b657 100644 --- a/gerbview/dialogs/dialog_select_one_pcb_layer.cpp +++ b/gerbview/dialogs/dialog_select_one_pcb_layer.cpp @@ -8,7 +8,7 @@ #include // Exported function -const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber ); +const wxString GetPCBDefaultLayerName( int aLayerNumber ); enum layer_sel_id { @@ -23,11 +23,11 @@ class SELECT_LAYER_DIALOG : public wxDialog private: GERBVIEW_FRAME* m_Parent; wxRadioBox* m_LayerList; - LAYER_NUM m_LayerId[int(NB_LAYERS) + 1]; // One extra element for "(Deselect)" radiobutton + int m_LayerId[int(GERBER_DRAWLAYERS_COUNT) + 1]; // One extra element for "(Deselect)" radiobutton public: // Constructor and destructor - SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent, LAYER_NUM aDefaultLayer, + SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent, int aDefaultLayer, int aCopperLayerCount, bool aShowDeselectOption ); ~SELECT_LAYER_DIALOG() { }; @@ -47,10 +47,10 @@ END_EVENT_TABLE() /** Install the dialog box for layer selection - * @param aDefaultLayer = Preselection (NB_LAYERS for "(Deselect)" layer) + * @param aDefaultLayer = Preselection (GERBER_DRAWLAYERS_COUNT for "(Deselect)" layer) * @param aCopperLayerCount = number of copper layers * @param aShowDeselectOption = display a "(Deselect)" radiobutton (when set to true) - * @return new layer value (NB_LAYERS when "(Deselect)" radiobutton selected), + * @return new layer value (GERBER_DRAWLAYERS_COUNT when "(Deselect)" radiobutton selected), * or -1 if canceled * * Providing the option to also display a "(Deselect)" radiobutton makes the @@ -61,10 +61,10 @@ END_EVENT_TABLE() * different radiobutton is clicked on) prior to then clicking on the "Deselect" * button provided within the "Layer selection:" dialog box). */ -LAYER_NUM GERBVIEW_FRAME::SelectPCBLayer( LAYER_NUM aDefaultLayer, int aCopperLayerCount, +int GERBVIEW_FRAME::SelectPCBLayer( int aDefaultLayer, int aCopperLayerCount, bool aShowDeselectOption ) { - LAYER_NUM layer; + int layer; SELECT_LAYER_DIALOG* frame = new SELECT_LAYER_DIALOG( this, aDefaultLayer, aCopperLayerCount, aShowDeselectOption ); @@ -82,14 +82,17 @@ LAYER_NUM GERBVIEW_FRAME::SelectPCBLayer( LAYER_NUM aDefaultLayer, int aCopperLa * to the right of that radiobox. */ SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent, - LAYER_NUM aDefaultLayer, int aCopperLayerCount, + int aDefaultLayer, int aCopperLayerCount, bool aShowDeselectOption ) : wxDialog( parent, -1, _( "Select Layer:" ), wxPoint( -1, -1 ), wxSize( 470, 250 ), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ) { + #define NB_PCB_LAYERS 64 + #define FIRST_COPPER_LAYER 0 + #define LAST_COPPER_LAYER 31 wxButton* Button; - LAYER_NUM ii; + int ii; wxString LayerList[NB_PCB_LAYERS + 1]; // One extra element for "(Deselect)" // radiobutton int LayerCount, LayerSelect = -1; @@ -98,9 +101,10 @@ SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent, // Build the layer list; first build copper layers list LayerCount = 0; - for( ii = FIRST_COPPER_LAYER; ii < NB_COPPER_LAYERS; ++ii ) + + for( ii = FIRST_COPPER_LAYER; ii <= LAST_COPPER_LAYER; ++ii ) { - m_LayerId[ii] = FIRST_LAYER; + m_LayerId[ii] = 0; if( ii == FIRST_COPPER_LAYER || ii == LAST_COPPER_LAYER || ii < aCopperLayerCount-1 ) { @@ -113,10 +117,11 @@ SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent, LayerCount++; } } + // Build the layer list; build non copper layers list for( ; ii < NB_PCB_LAYERS; ++ii ) { - m_LayerId[ii] = FIRST_LAYER; + m_LayerId[ii] = 0; LayerList[LayerCount] = GetPCBDefaultLayerName( ii ); @@ -182,42 +187,42 @@ void SELECT_LAYER_DIALOG::OnCancelClick( wxCommandEvent& event ) EndModal( -1 ); } -const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber ) +const wxString GetPCBDefaultLayerName( int aLayerNumber ) { const wxChar* txt; // 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; + case F_Cu: txt = wxT( "F.Cu" ); break; + case In1_Cu: txt = wxT( "In1.Cu" ); break; + case In2_Cu: txt = wxT( "In2.Cu" ); break; + case In3_Cu: txt = wxT( "In3.Cu" ); break; + case In4_Cu: txt = wxT( "In4.Cu" ); break; + case In5_Cu: txt = wxT( "In5.Cu" ); break; + case In6_Cu: txt = wxT( "In6.Cu" ); break; + case In7_Cu: txt = wxT( "In7.Cu" ); break; + case In8_Cu: txt = wxT( "In8.Cu" ); break; + case In9_Cu: txt = wxT( "In9.Cu" ); break; + case In10_Cu: txt = wxT( "In10.Cu" ); break; + case In11_Cu: txt = wxT( "In11.Cu" ); break; + case In12_Cu: txt = wxT( "In12.Cu" ); break; + case In13_Cu: txt = wxT( "In13.Cu" ); break; + case In14_Cu: txt = wxT( "In14.Cu" ); 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/dialogs/dialog_show_page_borders.cpp b/gerbview/dialogs/dialog_show_page_borders.cpp index 210291792a..7c2dcfd7ea 100644 --- a/gerbview/dialogs/dialog_show_page_borders.cpp +++ b/gerbview/dialogs/dialog_show_page_borders.cpp @@ -32,6 +32,7 @@ #include #include +#include #include diff --git a/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp b/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp index 24928c9f75..b2d52c851a 100644 --- a/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp +++ b/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp @@ -11,6 +11,7 @@ #include #include +#include #include diff --git a/gerbview/draw_gerber_screen.cpp b/gerbview/draw_gerber_screen.cpp index e8efa84f68..21aaba20f1 100644 --- a/gerbview/draw_gerber_screen.cpp +++ b/gerbview/draw_gerber_screen.cpp @@ -36,21 +36,21 @@ #include #include +#include #include #include #include #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(); GBR_DISPLAY_OPTIONS imgDisplayOptions = m_DisplayOptions; + std::bitset printLayersMask = GetGerberLayout()->GetPrintableLayers(); // Set draw options for printing: - SetVisibleLayers( aPrintMasklayer ); m_DisplayOptions.m_DisplayFlashedItemsFill = true; m_DisplayOptions.m_DisplayLinesFill = true; m_DisplayOptions.m_DisplayPolygonsFill = true; @@ -58,7 +58,10 @@ void GERBVIEW_FRAME::PrintPage( wxDC* aDC, LAYER_MSK aPrintMasklayer, m_DisplayOptions.m_IsPrinting = true; PRINT_PARAMETERS* printParameters = (PRINT_PARAMETERS*)aData; - + std::bitset printCurrLayerMask; + printCurrLayerMask.reset(); + printCurrLayerMask.set(printParameters->m_Flags); // m_Flags contains the draw layer number + GetGerberLayout()->SetPrintableLayers( printCurrLayerMask ); m_canvas->SetPrintMirrored( aPrintMirrorMode ); bool printBlackAndWhite = printParameters && printParameters->m_Print_Black_and_White; @@ -68,7 +71,7 @@ void GERBVIEW_FRAME::PrintPage( wxDC* aDC, LAYER_MSK aPrintMasklayer, m_canvas->SetPrintMirrored( false ); // Restore draw options: - SetVisibleLayers( visiblemask ); + GetGerberLayout()->SetPrintableLayers( printLayersMask ); m_DisplayOptions = imgDisplayOptions; } @@ -211,14 +214,14 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode, bool end = false; - for( LAYER_NUM layer = FIRST_LAYER; !end; ++layer ) + for( int layer = 0; !end; ++layer ) { - LAYER_NUM active_layer = gerbFrame->getActiveLayer(); + int active_layer = gerbFrame->getActiveLayer(); if( layer == active_layer ) // active layer will be drawn after other layers continue; - if( layer == NB_GERBER_LAYERS ) // last loop: draw active layer + if( layer == GERBER_DRAWLAYERS_COUNT ) // last loop: draw active layer { end = true; layer = active_layer; diff --git a/gerbview/events_called_functions.cpp b/gerbview/events_called_functions.cpp index 6f258ab2b8..bfbff86459 100644 --- a/gerbview/events_called_functions.cpp +++ b/gerbview/events_called_functions.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -226,7 +227,7 @@ void GERBVIEW_FRAME::OnSelectActiveDCode( wxCommandEvent& event ) void GERBVIEW_FRAME::OnSelectActiveLayer( wxCommandEvent& event ) { - LAYER_NUM layer = getActiveLayer(); + int layer = getActiveLayer(); setActiveLayer( event.GetSelection() ); @@ -240,7 +241,7 @@ void GERBVIEW_FRAME::OnSelectActiveLayer( wxCommandEvent& event ) void GERBVIEW_FRAME::OnShowGerberSourceFile( wxCommandEvent& event ) { - LAYER_NUM layer = getActiveLayer(); + int layer = getActiveLayer(); GERBER_IMAGE* gerber_layer = g_GERBER_List[layer]; if( gerber_layer ) diff --git a/gerbview/excellon_read_drill_file.cpp b/gerbview/excellon_read_drill_file.cpp index 952d89c8d3..7c9726d2b0 100644 --- a/gerbview/excellon_read_drill_file.cpp +++ b/gerbview/excellon_read_drill_file.cpp @@ -67,6 +67,7 @@ #include #include +#include #include #include #include @@ -92,13 +93,13 @@ extern double ReadDouble( char*& text, bool aSkipSeparator = true ); extern void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem, APERTURE_T aAperture, int Dcode_index, - LAYER_NUM aLayer, + int aLayer, const wxPoint& aPos, wxSize aSize, bool aLayerNegative ); void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index, - LAYER_NUM aLayer, + int aLayer, const wxPoint& aStart, const wxPoint& aEnd, wxSize aPenSize, @@ -167,7 +168,7 @@ static EXCELLON_CMD excellon_G_CmdList[] = bool GERBVIEW_FRAME::Read_EXCELLON_File( const wxString& aFullFileName ) { wxString msg; - LAYER_NUM layer = getActiveLayer(); // current layer used in GerbView + int layer = getActiveLayer(); // current layer used in GerbView if( g_GERBER_List[layer] == NULL ) { diff --git a/gerbview/export_to_pcbnew.cpp b/gerbview/export_to_pcbnew.cpp index 1594f5d7af..f770256667 100644 --- a/gerbview/export_to_pcbnew.cpp +++ b/gerbview/export_to_pcbnew.cpp @@ -7,13 +7,13 @@ #include #include -// #include #include #include #include #include #include #include +#include #include #include #include @@ -123,7 +123,7 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event ) int layercount = 0; // Count the Gerber layers which are actually currently used - for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii ) + for( LAYER_NUM ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii ) { if( g_GERBER_List[ii] != NULL ) layercount++; @@ -190,16 +190,17 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( LAYER_NUM* LayerLookUpTable, int aCopperLay // create an image of gerber data // First: non copper layers: GERBER_DRAW_ITEM* gerb_item = m_gerbview_frame->GetItemsList(); + int pcbCopperLayerMax = 31; for( ; gerb_item; gerb_item = gerb_item->Next() ) { - LAYER_NUM layer = gerb_item->GetLayer(); + int layer = gerb_item->GetLayer(); LAYER_NUM pcb_layer_number = LayerLookUpTable[layer]; if( !IsPcbLayer( pcb_layer_number ) ) continue; - if( pcb_layer_number > LAST_COPPER_LAYER ) + if( pcb_layer_number > pcbCopperLayerMax ) export_non_copper_item( gerb_item, pcb_layer_number ); } @@ -209,10 +210,10 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( LAYER_NUM* LayerLookUpTable, int aCopperLay for( ; gerb_item; gerb_item = gerb_item->Next() ) { - LAYER_NUM layer = gerb_item->GetLayer(); + int layer = gerb_item->GetLayer(); LAYER_NUM pcb_layer_number = LayerLookUpTable[layer]; - if( pcb_layer_number < 0 || pcb_layer_number > LAST_COPPER_LAYER ) + if( pcb_layer_number < 0 || pcb_layer_number > pcbCopperLayerMax ) continue; else @@ -398,13 +399,7 @@ void GBR_TO_PCB_EXPORTER::writePcbHeader() // Write copper layer count fprintf( m_fp, "LayerCount %d\n", m_pcbCopperLayersCount ); - // Write enabled layer mask: - int lmask = ALL_NO_CU_LAYERS | EXTERNAL_CU_LAYERS; - for( int ii = 0; ii < m_pcbCopperLayersCount - 2; ii++ ) - lmask |= 2 << ii; - - fprintf( m_fp, "EnabledLayers %08X\n", lmask ); fprintf( m_fp, "$EndGENERAL\n\n" ); // Creates void setup diff --git a/gerbview/files.cpp b/gerbview/files.cpp index 6d219cd131..5b016e87a9 100644 --- a/gerbview/files.cpp +++ b/gerbview/files.cpp @@ -33,6 +33,7 @@ #include #include +#include #include #include #include @@ -163,7 +164,7 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName ) } // Read gerber files: each file is loaded on a new GerbView layer - LAYER_NUM layer = getActiveLayer(); + int layer = getActiveLayer(); for( unsigned ii = 0; ii < filenamesList.GetCount(); ii++ ) { @@ -244,7 +245,7 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName ) } // Read gerber files: each file is loaded on a new GerbView layer - LAYER_NUM layer = getActiveLayer(); + int layer = getActiveLayer(); for( unsigned ii = 0; ii < filenamesList.GetCount(); ii++ ) { diff --git a/gerbview/gerbview.cpp b/gerbview/gerbview.cpp index f7147d20bb..34412da4b1 100644 --- a/gerbview/gerbview.cpp +++ b/gerbview/gerbview.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include diff --git a/gerbview/gerbview.h b/gerbview/gerbview.h index 42a469a631..89385344f1 100644 --- a/gerbview/gerbview.h +++ b/gerbview/gerbview.h @@ -8,9 +8,6 @@ #include #include -#include -#include -#include #define CURSEUR_ON_GRILLE 0 #define CURSEUR_OFF_GRILLE 1 @@ -32,6 +29,8 @@ extern const wxChar* g_GerberPageSizeList[8]; #define GERB_STOP_DRAW 2 // Extinguish light (lift pen) #define GERB_FLASH 3 // Flash +// number fo draw layers in Gerbview +#define GERBER_DRAWLAYERS_COUNT 32 /** * Enum GERBER_VISIBLE_ID @@ -47,9 +46,6 @@ enum GERBER_VISIBLE_ID END_GERBER_VISIBLE_LIST // sentinel }; -extern const wxString GerbviewProjectFileExt; -extern const wxString GerbviewProjectFileWildcard; - // Interpolation type enum Gerb_Interpolation { @@ -93,13 +89,6 @@ enum Gerb_Analyse_Cmd ENTER_RS274X_CMD }; - -/**************/ -/* rs274x.cpp */ -/**************/ -bool GetEndOfBlock( char buff[GERBER_BUFZ], char*& text, FILE* gerber_file ); -extern GERBER_IMAGE* g_GERBER_List[32]; - -#include +extern GERBER_IMAGE* g_GERBER_List[GERBER_DRAWLAYERS_COUNT]; #endif // ifndef GERBVIEW_H diff --git a/gerbview/gerbview_config.cpp b/gerbview/gerbview_config.cpp index db1ed29f3e..4202284555 100644 --- a/gerbview/gerbview_config.cpp +++ b/gerbview/gerbview_config.cpp @@ -38,14 +38,13 @@ #include #include +#include #include #include #define GROUP wxT("/gerbview") -#define INSETUP true - void GERBVIEW_FRAME::Process_Config( wxCommandEvent& event ) { diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 09abe01df2..ccb7cbf431 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -27,7 +27,6 @@ */ #include -//#include #include #include #include @@ -40,6 +39,7 @@ #include #include +#include #include #include #include @@ -92,7 +92,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ): SetLayout( new GBR_LAYOUT() ); - SetVisibleLayers( FULL_LAYERS ); // All 32 layers visible. + SetVisibleLayers( -1 ); // All draw layers visible. SetScreen( new GBR_SCREEN( GetGerberLayout()->GetPageSettings().GetSizeIU() ) ); @@ -167,6 +167,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ): m_LayersManager->ReFillRender(); // Update colors in Render after the config is read m_auimgr.Update(); + setActiveLayer( 0, true ); Zoom_Automatique( true ); // Gives a default zoom value } @@ -184,9 +185,9 @@ void GERBVIEW_FRAME::OnCloseWindow( wxCloseEvent& Event ) bool GERBVIEW_FRAME::OpenProjectFiles( const std::vector& aFileSet, int aCtl ) { - const unsigned limit = std::min( unsigned( aFileSet.size() ), unsigned( NB_GERBER_LAYERS ) ); + const unsigned limit = std::min( unsigned( aFileSet.size() ), unsigned( GERBER_DRAWLAYERS_COUNT ) ); - LAYER_NUM layer = FIRST_LAYER; + int layer = 0; for( unsigned i=0; i= NB_GERBER_LAYERS ) - layer = FIRST_LAYER; + if( layer >= GERBER_DRAWLAYERS_COUNT ) + layer = 0; } return NO_AVAILABLE_LAYERS; @@ -398,9 +399,9 @@ void GERBVIEW_FRAME::Liste_D_Codes() wxArrayString list; double scale = g_UserUnit == INCHES ? IU_PER_MILS * 1000 : IU_PER_MM; - LAYER_NUM curr_layer = getActiveLayer(); + int curr_layer = getActiveLayer(); - for( LAYER_NUM layer = FIRST_LAYER; layer < NB_LAYERS; ++layer ) + for( int layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer ) { GERBER_IMAGE* gerber = g_GERBER_List[layer]; @@ -551,9 +552,9 @@ 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 +long GERBVIEW_FRAME::GetVisibleLayers() const { - return FULL_LAYERS; // TODO + return -1; // TODO } @@ -563,9 +564,9 @@ 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( long aLayerMask ) { - GetGerberLayout()->SetVisibleLayers( aLayerMask ); +// GetGerberLayout()->SetVisibleLayers( aLayerMask ); } @@ -575,12 +576,12 @@ void GERBVIEW_FRAME::SetVisibleLayers( LAYER_MSK aLayerMask ) * @param aLayer = The layer to be tested * @return bool - true if the layer is visible. */ -bool GERBVIEW_FRAME::IsLayerVisible( LAYER_NUM aLayer ) const +bool GERBVIEW_FRAME::IsLayerVisible( int aLayer ) const { if( ! m_DisplayOptions.m_IsPrinting ) return m_LayersManager->IsLayerVisible( aLayer ); else - return GetGerberLayout()->IsLayerVisible( aLayer ); + return GetGerberLayout()->IsLayerPrintable( aLayer ); } @@ -664,7 +665,7 @@ EDA_COLOR_T GERBVIEW_FRAME::GetNegativeItemsColor() const * Function GetLayerColor * gets a layer color for any valid layer. */ -EDA_COLOR_T GERBVIEW_FRAME::GetLayerColor( LAYER_NUM aLayer ) const +EDA_COLOR_T GERBVIEW_FRAME::GetLayerColor( int aLayer ) const { return m_colorsSettings->GetLayerColor( aLayer ); } @@ -674,7 +675,7 @@ EDA_COLOR_T GERBVIEW_FRAME::GetLayerColor( LAYER_NUM aLayer ) const * Function SetLayerColor * changes a layer color for any valid layer. */ -void GERBVIEW_FRAME::SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor ) +void GERBVIEW_FRAME::SetLayerColor( int aLayer, EDA_COLOR_T aColor ) { m_colorsSettings->SetLayerColor( aLayer, aColor ); } @@ -684,7 +685,7 @@ void GERBVIEW_FRAME::SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor ) * Function getActiveLayer * returns the active layer */ -LAYER_NUM GERBVIEW_FRAME::getActiveLayer() +int GERBVIEW_FRAME::getActiveLayer() { return ( (GBR_SCREEN*) GetScreen() )->m_Active_Layer; } @@ -695,7 +696,7 @@ LAYER_NUM GERBVIEW_FRAME::getActiveLayer() * will change the currently active layer to \a aLayer and also * update the PCB_LAYER_WIDGET. */ -void GERBVIEW_FRAME::setActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate ) +void GERBVIEW_FRAME::setActiveLayer( int aLayer, bool doLayerWidgetUpdate ) { ( (GBR_SCREEN*) GetScreen() )->m_Active_Layer = aLayer; diff --git a/gerbview/gerbview_frame.h b/gerbview/gerbview_frame.h index df14fdaa4b..fc35c3d4a5 100644 --- a/gerbview/gerbview_frame.h +++ b/gerbview/gerbview_frame.h @@ -37,7 +37,6 @@ #include #include #include -#include #define NO_AVAILABLE_LAYERS UNDEFINED_LAYER @@ -167,7 +166,7 @@ public: * different radiobutton is clicked on) prior to then clicking on the "Deselect" * button provided within the "Layer selection:" dialog box). */ - LAYER_NUM SelectPCBLayer( LAYER_NUM aDefaultLayer, int aOpperLayerCount, bool aNullLayer = false ); + int SelectPCBLayer( int aDefaultLayer, int aOpperLayerCount, bool aNullLayer = false ); protected: GERBER_LAYER_WIDGET* m_LayersManager; @@ -306,9 +305,9 @@ public: * Function GetVisibleLayers * is a proxy function that calls the correspondent function in m_BoardSettings * Returns a bit-mask of all the layers that are visible - * @return int - the visible layers in bit-mapped form. + * @return long - the visible layers in bit-mapped form. */ - LAYER_MSK GetVisibleLayers() const; + long GetVisibleLayers() const; /** * Function SetVisibleLayers @@ -316,7 +315,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( long aLayerMask ); /** * Function IsLayerVisible @@ -324,7 +323,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( int aLayer ) const; /** * Function GetVisibleElementColor @@ -338,13 +337,13 @@ public: * Function GetLayerColor * gets a layer color for any valid layer. */ - EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const; + EDA_COLOR_T GetLayerColor( int aLayer ) const; /** * Function SetLayerColor * changes a layer color for any valid layer. */ - void SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor ); + void SetLayerColor( int aLayer, EDA_COLOR_T aColor ); /** * Function GetNegativeItemsColor @@ -396,13 +395,13 @@ public: * will change the currently active layer to \a aLayer and also * update the GERBER_LAYER_WIDGET. */ - void setActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate = true ); + void setActiveLayer( int aLayer, bool doLayerWidgetUpdate = true ); /** * Function getActiveLayer * returns the active layer */ - LAYER_NUM getActiveLayer(); + int getActiveLayer(); /** * Function getNextAvailableLayer @@ -411,7 +410,7 @@ public: * @param aLayer The first layer to search. * @return The first empty layer found or NO_AVAILABLE_LAYERS. */ - LAYER_NUM getNextAvailableLayer( LAYER_NUM aLayer = FIRST_LAYER ) const; + int getNextAvailableLayer( int aLayer = 0 ) const; bool hasAvailableLayers() const { @@ -667,7 +666,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/hotkeys.cpp b/gerbview/hotkeys.cpp index 29082a6349..76bae66e51 100644 --- a/gerbview/hotkeys.cpp +++ b/gerbview/hotkeys.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include diff --git a/gerbview/initpcb.cpp b/gerbview/initpcb.cpp index 1ae5090a3c..f428dd9a54 100644 --- a/gerbview/initpcb.cpp +++ b/gerbview/initpcb.cpp @@ -32,6 +32,7 @@ #include #include +#include #include #include #include @@ -39,7 +40,7 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query ) { - LAYER_NUM layer; + int layer; if( GetGerberLayout() == NULL ) return false; @@ -52,7 +53,7 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query ) GetGerberLayout()->m_Drawings.DeleteAll(); - for( layer = FIRST_LAYER; layer < NB_GERBER_LAYERS; ++layer ) + for( layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer ) { if( g_GERBER_List[layer] ) { @@ -65,7 +66,7 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query ) SetScreen( new GBR_SCREEN( GetPageSettings().GetSizeIU() ) ); - setActiveLayer( FIRST_LAYER ); + setActiveLayer( 0 ); m_LayersManager->UpdateLayerIcons(); syncLayerBox(); return true; @@ -74,7 +75,7 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query ) void GERBVIEW_FRAME::Erase_Current_Layer( bool query ) { - LAYER_NUM layer = getActiveLayer(); + int layer = getActiveLayer(); wxString msg; msg.Printf( _( "Clear layer %d?" ), layer + 1 ); diff --git a/gerbview/locate.cpp b/gerbview/locate.cpp index 7e6ba30737..f2fb2a4d50 100644 --- a/gerbview/locate.cpp +++ b/gerbview/locate.cpp @@ -31,6 +31,7 @@ #include #include +#include #include @@ -46,7 +47,7 @@ GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc if( aTypeloc == CURSEUR_ON_GRILLE ) ref = GetNearestGridPosition( ref ); - LAYER_NUM layer = getActiveLayer(); + int layer = getActiveLayer(); // Search first on active layer GERBER_DRAW_ITEM* gerb_item = GetItemsList(); diff --git a/gerbview/menubar.cpp b/gerbview/menubar.cpp index fd2b6c0abf..4703b6da66 100644 --- a/gerbview/menubar.cpp +++ b/gerbview/menubar.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include diff --git a/gerbview/onleftclick.cpp b/gerbview/onleftclick.cpp index dc73fbac08..ceedc7f39b 100644 --- a/gerbview/onleftclick.cpp +++ b/gerbview/onleftclick.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include #include diff --git a/gerbview/onrightclick.cpp b/gerbview/onrightclick.cpp index aefc0e006b..ca9224b5a4 100644 --- a/gerbview/onrightclick.cpp +++ b/gerbview/onrightclick.cpp @@ -8,6 +8,7 @@ #include #include +#include #include diff --git a/gerbview/pcbplot.cpp b/gerbview/pcbplot.cpp index e13b1de974..0e39eb48bb 100644 --- a/gerbview/pcbplot.cpp +++ b/gerbview/pcbplot.cpp @@ -6,6 +6,7 @@ #include #include +#include #include /** TODO */ diff --git a/gerbview/readgerb.cpp b/gerbview/readgerb.cpp index ac374bb5c7..cb932db050 100644 --- a/gerbview/readgerb.cpp +++ b/gerbview/readgerb.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -25,7 +26,7 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName, wxString msg; char* text; - LAYER_NUM layer; // current layer used in GerbView + int layer; // current layer used in GerbView layer = getActiveLayer(); diff --git a/gerbview/rs274d.cpp b/gerbview/rs274d.cpp index 7023d63930..74cb464cb9 100644 --- a/gerbview/rs274d.cpp +++ b/gerbview/rs274d.cpp @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -107,7 +108,7 @@ void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem, APERTURE_T aAperture, int Dcode_index, - LAYER_NUM aLayer, + int aLayer, const wxPoint& aPos, wxSize aSize, bool aLayerNegative ) @@ -159,7 +160,7 @@ void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem, */ void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index, - LAYER_NUM aLayer, + int aLayer, const wxPoint& aStart, const wxPoint& aEnd, wxSize aPenSize, @@ -208,7 +209,7 @@ void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem, * false when arc is inside one quadrant * @param aLayerNegative = true if the current layer is negative */ -static void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index, LAYER_NUM aLayer, +static void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index, int aLayer, const wxPoint& aStart, const wxPoint& aEnd, const wxPoint& aRelCenter, wxSize aPenSize, bool aClockwise, bool aMultiquadrant, @@ -344,10 +345,11 @@ static void fillArcPOLY( GERBER_DRAW_ITEM* aGbrItem, * so we muse create a dummy track and use its geometric parameters */ static GERBER_DRAW_ITEM dummyGbrItem( NULL, NULL ); + static const int drawlayer = 0; aGbrItem->SetLayerPolarity( aLayerNegative ); - fillArcGBRITEM( &dummyGbrItem, 0, FIRST_LAYER, + fillArcGBRITEM( &dummyGbrItem, 0, drawlayer, aStart, aEnd, rel_center, wxSize(0, 0), aClockwise, aMultiquadrant, aLayerNegative ); @@ -568,7 +570,7 @@ bool GERBER_IMAGE::Execute_DCODE_Command( char*& text, int D_commande ) GERBER_DRAW_ITEM* gbritem; GBR_LAYOUT* layout = m_Parent->GetGerberLayout(); - LAYER_NUM activeLayer = m_Parent->getActiveLayer(); + int activeLayer = m_Parent->getActiveLayer(); int dcode = 0; D_CODE* tool = NULL; diff --git a/gerbview/rs274x.cpp b/gerbview/rs274x.cpp index e35c94bd2e..aeb7871429 100644 --- a/gerbview/rs274x.cpp +++ b/gerbview/rs274x.cpp @@ -12,6 +12,7 @@ extern int ReadInt( char*& text, bool aSkipSeparator = true ); extern double ReadDouble( char*& text, bool aSkipSeparator = true ); +extern bool GetEndOfBlock( char buff[GERBER_BUFZ], char*& text, FILE* gerber_file ); #define CODE( x, y ) ( ( (x) << 8 ) + (y) ) diff --git a/gerbview/select_layers_to_pcb.cpp b/gerbview/select_layers_to_pcb.cpp index 058dfd5d54..03e48aa3c9 100644 --- a/gerbview/select_layers_to_pcb.cpp +++ b/gerbview/select_layers_to_pcb.cpp @@ -27,9 +27,9 @@ */ #include -//#include #include #include +#include #include #include @@ -41,7 +41,7 @@ extern const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber ); enum swap_layer_id { ID_LAYERS_MAP_DIALOG = ID_GERBER_END_LIST, ID_BUTTON_0, - ID_TEXT_0 = ID_BUTTON_0 + NB_GERBER_LAYERS + ID_TEXT_0 = ID_BUTTON_0 + GERBER_DRAWLAYERS_COUNT }; @@ -55,7 +55,7 @@ int LAYERS_MAP_DIALOG::m_exportBoardCopperLayersCount = 2; BEGIN_EVENT_TABLE( LAYERS_MAP_DIALOG, LAYERS_MAP_DIALOG_BASE ) - EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + NB_GERBER_LAYERS-1, + EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + GERBER_DRAWLAYERS_COUNT-1, wxEVT_COMMAND_BUTTON_CLICKED, LAYERS_MAP_DIALOG::OnSelectLayer ) END_EVENT_TABLE() @@ -102,8 +102,7 @@ void LAYERS_MAP_DIALOG::initDialog() // version are also 26 pixels wide and 26 pixels high. If appropriate, // the above code should be modified as required in the event that those // buttons should be some other size in that version. - - for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii ) + for( int ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii ) { // Specify the default value for each member of these arrays. m_buttonTable[ii] = -1; @@ -111,32 +110,31 @@ void LAYERS_MAP_DIALOG::initDialog() } // Ensure we have: - // at least 2 copper layers and BOARD_COPPER_LAYERS_MAX_COUNT copper layers max + // at least 2 copper layers and less than max pacb copper layers count // and even layers count because a board *must* have even layers count - // and maxi BOARD_COPPER_LAYERS_MAX_COUNT copper layers count normalizeBrdLayersCount(); int idx = ( m_exportBoardCopperLayersCount / 2 ) - 1; m_comboCopperLayersCount->SetSelection( idx ); - LAYER_NUM pcb_layer_num = FIRST_LAYER; - m_itemsCount = 0; - for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii ) + LAYER_NUM pcb_layer_num = 0; + m_gerberActiveLayersCount = 0; + for( int ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii ) { if( g_GERBER_List[ii] == NULL ) - continue; + break; 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_buttonTable[m_gerberActiveLayersCount] = ii; m_layersLookUpTable[ii] = pcb_layer_num; - m_itemsCount++; + m_gerberActiveLayersCount++; ++pcb_layer_num; } - if( m_itemsCount <= NB_GERBER_LAYERS/2 ) // Only one list is enough + if( m_gerberActiveLayersCount <= GERBER_DRAWLAYERS_COUNT/2 ) // Only one list is enough { m_staticlineSep->Hide(); } @@ -151,7 +149,7 @@ void LAYERS_MAP_DIALOG::initDialog() } wxFlexGridSizer* flexColumnBoxSizer = m_flexLeftColumnBoxSizer; - for( int ii = 0; ii < m_itemsCount; ii++ ) + for( int ii = 0; ii < m_gerberActiveLayersCount; ii++ ) { // Each Gerber layer has an associated static text string (to // identify that layer), a button (for invoking a child dialog @@ -178,7 +176,7 @@ void LAYERS_MAP_DIALOG::initDialog() // is nb_items; otherwise, the number of rows is 16 (with two // separate columns of controls being used if nb_items > 16). - if( ii == NB_GERBER_LAYERS/2 ) + if( ii == GERBER_DRAWLAYERS_COUNT/2 ) flexColumnBoxSizer = m_flexRightColumnBoxSizer; // Provide a text string to identify the Gerber layer @@ -226,7 +224,7 @@ void LAYERS_MAP_DIALOG::initDialog() wxDefaultSize, 0 ); goodSize = text->GetSize(); - for( LAYER_NUM jj = FIRST_LAYER; jj < NB_LAYERS; ++jj ) + for( LAYER_NUM jj = 0; jj < GERBER_DRAWLAYERS_COUNT; ++jj ) { text->SetLabel( GetPCBDefaultLayerName( jj ) ); if( goodSize.x < text->GetSize().x ) @@ -259,8 +257,8 @@ void LAYERS_MAP_DIALOG::normalizeBrdLayersCount() if( ( m_exportBoardCopperLayersCount & 1 ) ) m_exportBoardCopperLayersCount++; - if( m_exportBoardCopperLayersCount > NB_LAYERS ) - m_exportBoardCopperLayersCount = NB_LAYERS; + if( m_exportBoardCopperLayersCount > GERBER_DRAWLAYERS_COUNT ) + m_exportBoardCopperLayersCount = GERBER_DRAWLAYERS_COUNT; if( m_exportBoardCopperLayersCount < 2 ) m_exportBoardCopperLayersCount = 2; @@ -284,11 +282,11 @@ void LAYERS_MAP_DIALOG::OnResetClick( wxCommandEvent& event ) wxString msg; int ii; LAYER_NUM layer; - for( ii = 0, layer = FIRST_LAYER; ii < m_itemsCount; ii++, ++layer ) + for( ii = 0, layer = 0; ii < m_gerberActiveLayersCount; ii++, ++layer ) { 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 ); @@ -306,7 +304,7 @@ void LAYERS_MAP_DIALOG::OnStoreSetup( wxCommandEvent& event ) config->Write( wxT("BrdLayersCount"), m_exportBoardCopperLayersCount ); wxString key; - for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii ) + for( int ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii ) { key.Printf( wxT("GbrLyr%dToPcb"), ii ); config->Write( key, m_layersLookUpTable[ii] ); @@ -324,7 +322,7 @@ void LAYERS_MAP_DIALOG::OnGetSetup( wxCommandEvent& event ) m_comboCopperLayersCount->SetSelection( idx ); wxString key; - for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii ) + for( int ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++ii ) { key.Printf( wxT("GbrLyr%dToPcb"), ii ); int ilayer; @@ -332,7 +330,7 @@ void LAYERS_MAP_DIALOG::OnGetSetup( wxCommandEvent& event ) m_layersLookUpTable[ii] = ilayer; } - for( int ii = 0; ii < m_itemsCount; ii++ ) + for( int ii = 0; ii < m_gerberActiveLayersCount; ii++ ) { LAYER_NUM layer = m_layersLookUpTable[ii]; if( layer == UNSELECTED_LAYER ) @@ -354,7 +352,7 @@ void LAYERS_MAP_DIALOG::OnSelectLayer( wxCommandEvent& event ) ii = event.GetId() - ID_BUTTON_0; - if( (ii < FIRST_LAYER) || (ii >= NB_GERBER_LAYERS) ) + if( (ii < 0) || (ii >= GERBER_DRAWLAYERS_COUNT) ) { wxFAIL_MSG( wxT("Bad layer id") ); return; @@ -362,7 +360,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 ); @@ -406,9 +404,9 @@ void LAYERS_MAP_DIALOG::OnOkClick( wxCommandEvent& event ) normalizeBrdLayersCount(); int inner_layer_max = 0; - for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii ) + for( int ii = 0; ii < GERBER_DRAWLAYERS_COUNT; ++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/gerbview/select_layers_to_pcb.h b/gerbview/select_layers_to_pcb.h index dd27ee28ea..08dd56326b 100644 --- a/gerbview/select_layers_to_pcb.h +++ b/gerbview/select_layers_to_pcb.h @@ -6,24 +6,23 @@ #define _SELECT_LAYERS_TO_PCB_H_ #include -#include /* * This dialog shows the gerber files loaded, and allows user to choose - * equivalence tbetween gerber layers and pcb layers + * equivalence between gerber layers and pcb layers */ class LAYERS_MAP_DIALOG : public LAYERS_MAP_DIALOG_BASE { private: GERBVIEW_FRAME* m_Parent; - int m_itemsCount; + int m_gerberActiveLayersCount; // Number of initialized gerber layers static int m_exportBoardCopperLayersCount; wxFlexGridSizer* m_flexRightColumnBoxSizer; // An extra wxFlexGridSizer used // when we have more than 16 gerber files loaded - LAYER_NUM m_layersLookUpTable[NB_GERBER_LAYERS]; // Indexes Gerber layers to PCB file layers + LAYER_NUM m_layersLookUpTable[GERBER_DRAWLAYERS_COUNT]; // Indexes Gerber layers to PCB file layers // the last value in table is the number of copper layers - int m_buttonTable[int(NB_GERBER_LAYERS)+1]; // Indexes buttons to Gerber layers - wxStaticText* m_layersList[int(NB_GERBER_LAYERS)+1]; // Indexes text strings to buttons + int m_buttonTable[int(GERBER_DRAWLAYERS_COUNT)+1]; // Indexes buttons to Gerber layers + wxStaticText* m_layersList[int(GERBER_DRAWLAYERS_COUNT)+1]; // Indexes text strings to buttons public: LAYERS_MAP_DIALOG( GERBVIEW_FRAME* parent ); ~LAYERS_MAP_DIALOG() {}; diff --git a/gerbview/toolbars_gerber.cpp b/gerbview/toolbars_gerber.cpp index bc878db1d4..7ad3b5e7b2 100644 --- a/gerbview/toolbars_gerber.cpp +++ b/gerbview/toolbars_gerber.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -292,7 +293,7 @@ void GERBVIEW_FRAME::OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent ) void GERBVIEW_FRAME::OnUpdateSelectDCode( wxUpdateUIEvent& aEvent ) { - LAYER_NUM layer = getActiveLayer(); + int layer = getActiveLayer(); GERBER_IMAGE* gerber = g_GERBER_List[layer]; int selected = ( gerber ) ? gerber->m_Selected_Tool : 0; 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..19e3f9ab6e 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 ) ); @@ -156,7 +156,7 @@ public: * @param aLayer The layer to test for. * @return bool - true if on given layer, else false. */ - virtual bool IsOnLayer( LAYER_NUM aLayer ) const + virtual bool IsOnLayer( LAYER_ID aLayer ) const { return m_Layer == aLayer; } 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..2f26161b16 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 @@ -36,17 +35,18 @@ public: // Virtual function pure because GerbView uses its own functions in a derived class virtual bool IsLayerEnabled( LAYER_NUM aLayer ) const = 0; - bool SetLayersOrdered(bool value); - bool SetLayersHotkeys(bool value); + bool SetLayersOrdered( bool value ); + bool SetLayersHotkeys( bool value ); protected: // Fills the layer bitmap aLayerbmp with the layer color void SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM 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/config_params.h b/include/config_params.h index 5529fbfce5..81fd617c62 100644 --- a/include/config_params.h +++ b/include/config_params.h @@ -89,13 +89,14 @@ enum paramcfg_id { class PARAM_CFG_BASE { public: - const wxChar* m_Ident; ///< Keyword in config data - paramcfg_id m_Type; ///< Type of parameter - const wxChar* m_Group; ///< Group name (this is like a path in the config data) - bool m_Setup; ///< Install or Project based parameter, true == install + wxString m_Ident; ///< Keyword in config data + paramcfg_id m_Type; ///< Type of parameter + wxString m_Group; ///< Group name (this is like a path in the config data) + bool m_Setup; ///< Install or Project based parameter, true == install public: - PARAM_CFG_BASE( const wxChar* ident, const paramcfg_id type, const wxChar* group = NULL ); + PARAM_CFG_BASE( const wxString& ident, const paramcfg_id type, + const wxChar* group = NULL ); virtual ~PARAM_CFG_BASE() {} /** @@ -126,12 +127,12 @@ public: int m_Default; ///< The default value of the parameter public: - PARAM_CFG_INT( const wxChar* ident, int* ptparam, + PARAM_CFG_INT( const wxString& ident, int* ptparam, int default_val = 0, int min = std::numeric_limits::min(), int max = std::numeric_limits::max(), const wxChar* group = NULL ); - PARAM_CFG_INT( bool Insetup, const wxChar* ident, int* ptparam, + PARAM_CFG_INT( bool Insetup, const wxString& ident, int* ptparam, int default_val = 0, int min = std::numeric_limits::min(), int max = std::numeric_limits::max(), @@ -154,13 +155,13 @@ public: double m_BIU_to_cfgunit; ///< the factor to convert the saved value in internal value public: - PARAM_CFG_INT_WITH_SCALE( const wxChar* ident, int* ptparam, + PARAM_CFG_INT_WITH_SCALE( const wxString& ident, int* ptparam, int default_val = 0, int min = std::numeric_limits::min(), int max = std::numeric_limits::max(), const wxChar* group = NULL, double aBiu2cfgunit = 1.0); - PARAM_CFG_INT_WITH_SCALE( bool Insetup, const wxChar* ident, int* ptparam, + PARAM_CFG_INT_WITH_SCALE( bool Insetup, const wxString& ident, int* ptparam, int default_val = 0, int min = std::numeric_limits::min(), int max = std::numeric_limits::max(), @@ -183,9 +184,9 @@ public: EDA_COLOR_T m_Default; ///< The default value of the parameter public: - PARAM_CFG_SETCOLOR( const wxChar* ident, EDA_COLOR_T* ptparam, + PARAM_CFG_SETCOLOR( const wxString& ident, EDA_COLOR_T* ptparam, EDA_COLOR_T default_val, const wxChar* group = NULL ); - PARAM_CFG_SETCOLOR( bool Insetup, const wxChar* ident, EDA_COLOR_T* ptparam, + PARAM_CFG_SETCOLOR( bool Insetup, const wxString& ident, EDA_COLOR_T* ptparam, EDA_COLOR_T default_val, const wxChar* group = NULL ); virtual void ReadParam( wxConfigBase* aConfig ) const; @@ -205,10 +206,10 @@ public: double m_Min, m_Max; ///< Minimum and maximum values of the param type public: - PARAM_CFG_DOUBLE( const wxChar* ident, double* ptparam, + PARAM_CFG_DOUBLE( const wxString& ident, double* ptparam, double default_val = 0.0, double min = 0.0, double max = 10000.0, const wxChar* group = NULL ); - PARAM_CFG_DOUBLE( bool Insetup, const wxChar* ident, double* ptparam, + PARAM_CFG_DOUBLE( bool Insetup, const wxString& ident, double* ptparam, double default_val = 0.0, double min = 0.0, double max = 10000.0, const wxChar* group = NULL ); @@ -228,9 +229,9 @@ public: int m_Default; ///< The default value of the parameter public: - PARAM_CFG_BOOL( const wxChar* ident, bool* ptparam, + PARAM_CFG_BOOL( const wxString& ident, bool* ptparam, int default_val = false, const wxChar* group = NULL ); - PARAM_CFG_BOOL( bool Insetup, const wxChar* ident, bool* ptparam, + PARAM_CFG_BOOL( bool Insetup, const wxString& ident, bool* ptparam, int default_val = false, const wxChar* group = NULL ); virtual void ReadParam( wxConfigBase* aConfig ) const; @@ -242,19 +243,20 @@ public: * Configuration parameter - wxString Class * */ -class PARAM_CFG_WXSTRING : public PARAM_CFG_BASE +class PARAM_CFG_WXSTRING : public PARAM_CFG_BASE { public: wxString* m_Pt_param; ///< Pointer to the parameter value wxString m_default; ///< The default value of the parameter public: - PARAM_CFG_WXSTRING( const wxChar* ident, wxString* ptparam, const wxChar* group = NULL ); + PARAM_CFG_WXSTRING( const wxString& ident, wxString* ptparam, const wxChar* group = NULL ); + PARAM_CFG_WXSTRING( bool Insetup, - const wxChar* ident, + const wxString& ident, wxString* ptparam, const wxString& default_val = wxEmptyString, - const wxChar* group = NULL ); + const wxChar* group = NULL ); virtual void ReadParam( wxConfigBase* aConfig ) const; virtual void SaveParam( wxConfigBase* aConfig ) const; @@ -273,7 +275,8 @@ public: wxString* m_Pt_param; ///< Pointer to the parameter value public: - PARAM_CFG_FILENAME( const wxChar* ident, wxString* ptparam, const wxChar* group = NULL ); + PARAM_CFG_FILENAME( const wxString& ident, wxString* ptparam, + const wxChar* group = NULL ); virtual void ReadParam( wxConfigBase* aConfig ) const; virtual void SaveParam( wxConfigBase* aConfig ) const; }; diff --git a/include/draw_frame.h b/include/draw_frame.h index a7ee30cd0b..6608c4b634 100644 --- a/include/draw_frame.h +++ b/include/draw_frame.h @@ -636,7 +636,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/gr_basic.h b/include/gr_basic.h index d994548e76..6c4da5ba74 100644 --- a/include/gr_basic.h +++ b/include/gr_basic.h @@ -88,6 +88,8 @@ typedef int wxPenStyle; extern GR_DRAWMODE g_XorMode; +extern EDA_COLOR_T g_DrawBgColor; + typedef enum { diff --git a/include/layers_id_colors_and_visibility.h b/include/layers_id_colors_and_visibility.h index 5b73d4f266..095d8281ba 100644 --- a/include/layers_id_colors_and_visibility.h +++ b/include/layers_id_colors_and_visibility.h @@ -27,188 +27,364 @@ * @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; + /** - * @return bool if 2 layer masks have a comman layer - * @param aMask1 = a layer mask - * @param aMask2 = an other layer mask + * 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; + * : + * things to do with layer_id; + * } + * + * */ -inline bool IsLayerMasksIntersect( LAYER_MSK aMask1, LAYER_MSK aMask2 ) +class LSEQ : public BASE_SEQ { - return (aMask1 & aMask2) != 0; -} + unsigned m_index; -/** - * Count the number of set layers in the mask - */ -inline int LayerMaskCountSet( LAYER_MSK aMask ) -{ - int count = 0; +public: - for( LAYER_NUM i = FIRST_LAYER; i < NB_LAYERS; ++i ) + 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 { - if( aMask & GetLayerMask( i ) ) - ++count; + return at( m_index ); // throws std::out_of_range } - 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\ +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: + + // The constructor flavors are carefully chosen to prevent LSET( int ) from compiling. + // That excludes "LSET s = 0;" and excludes "LSET s = -1;", etc. + // LSET s = 0; needs to be removed from the code, this accomplishes that. + // Remember LSET( LAYER_ID(0) ) sets bit 0, so "LSET s = 0;" is illegal + // to prevent that surprize. Therefore LSET's constructor suite is significantly + // different than the base class from which it is derived. + + // Other member functions (non-constructor functions) are identical to the base + // class's and therefore are re-used from the base class. + + /** + * Constructor LSET() + * creates an empty (cleared) set. + */ + LSET() : + BASE_SET() // all bits are set to zero in BASE_SET() + { + } + + LSET( const BASE_SET& aOther ) : + BASE_SET( aOther ) + { + } + + /** + * Constructor LSET( LAYER_ID ) + * takes a LAYER_ID and sets that bit. This makes the following code into + * a bug: + * + * LSET s = 0; + * + * Instead use: + * + * + * LSET s; + * + * + * for an empty set. + */ + LSET( LAYER_ID aLayer ) : // LAYER_ID deliberately exludes int and relatives + BASE_SET() + { + 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( unsigned, LAYER_ID, ...) + * takes one or more LAYER_IDs in the argument list to construct + * the set. Typically only used in static construction. + * + * @param aIdCount is the number of LAYER_IDs which follow. + * @param aFirst is the first included in @a aIdCount and must always be present, and can + * be followed by any number of additional LAYER_IDs so long as @a aIdCount accurately + * reflects the count. + */ + LSET( unsigned aIdCount, LAYER_ID aFirst, ... ); // args chosen to prevent LSET( int ) from compiling + + /** + * 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() const; + +private: + + /// Take this off the market, it may not be used because of LSET( LAYER_ID ). + LSET( unsigned long __val ) + { + // not usable, it's private. + } }; @@ -253,12 +429,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 +463,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 +504,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 +553,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 +632,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 +643,11 @@ 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_ + +LAYER_ID ToLAYER_ID( int aLayer ); + +#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..d95bdfc64c 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 = LSET(), + 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 9545bfc9a7..ef71d06b96 100644 --- a/include/wxEeschemaStruct.h +++ b/include/wxEeschemaStruct.h @@ -1264,7 +1264,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 96d35e4bc8..8153fd9d5e 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 2c0099f76d..c73830bee4 100644 --- a/pagelayout_editor/pl_editor_frame.cpp +++ b/pagelayout_editor/pl_editor_frame.cpp @@ -503,7 +503,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 e266e1ca26..e7a0f76181 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..fa5a5325e2 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( ToLAYER_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,32 @@ 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 ) +// if( id != aLayer && nameTemp == wxString( m_Layer[id].m_name ) ) + return false; + } +#endif + + m_Layer[aLayer].m_name = nameTemp; return true; } @@ -423,7 +389,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 +397,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 +412,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 +475,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 +514,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 +618,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 +839,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 +1164,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 +1333,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 +1348,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 +1364,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 +1377,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,32 +1395,34 @@ ZONE_CONTAINER* BOARD::HitTestForAnyFilledArea( const wxPoint& aRefPos, } -int BOARD::SetAreasNetCodesFromNetNames( void ) +int BOARD::SetAreasNetCodesFromNetNames() { int error_count = 0; for( int ii = 0; ii < GetAreaCount(); ii++ ) { - if( !GetArea( ii )->IsOnCopperLayer() ) + ZONE_CONTAINER* it = GetArea( ii ); + + if( !it->IsOnCopperLayer() ) { - GetArea( ii )->SetNetCode( NETINFO_LIST::UNCONNECTED ); + it->SetNetCode( NETINFO_LIST::UNCONNECTED ); continue; } - if( GetArea( ii )->GetNetCode() != 0 ) // i.e. if this zone is connected to a net + if( it->GetNetCode() != 0 ) // i.e. if this zone is connected to a net { - const NETINFO_ITEM* net = GetArea( ii )->GetNet(); + const NETINFO_ITEM* net = it->GetNet(); if( net ) { - GetArea( ii )->SetNetCode( net->GetNet() ); + it->SetNetCode( net->GetNet() ); } else { error_count++; // keep Net Name and set m_NetCode to -1 : error flag. - GetArea( ii )->SetNetCode( -1 ); + it->SetNetCode( -1 ); } } } @@ -1465,7 +1431,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 +1445,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 +1498,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 +1522,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 +1536,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 +1547,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 +1627,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 +1646,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 +1680,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 +1718,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 +1751,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 +1898,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 +1918,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 +1967,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 +1977,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 +1997,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 +2013,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 +2066,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 +2101,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 90f5e2d655..0460e39445 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -87,29 +87,32 @@ 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; } + wxString m_name; ///< The name of the layer, there should be no spaces in this name. - void SetFixedListIndex( int aIndex ) { m_fixedListIndex = aIndex; } - int GetFixedListIndex() const { return m_fixedListIndex; } + LAYER_T m_type; ///< The type of the layer - /** The name of the layer, there should be no spaces in this name. */ - wxString m_Name; + bool m_visible; - /** The type of the layer */ - LAYER_T m_Type; + int m_number; /** * Function ShowType @@ -127,10 +130,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 +179,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 +216,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 +439,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 +451,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 +460,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 +472,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 +483,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 +491,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 +544,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 +629,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 +665,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 +1001,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 +1012,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 +1087,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 +1210,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 +1220,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 +1242,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 +1259,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 +1286,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 +1329,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 +1345,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..96cb0ff53f 100644 --- a/pcbnew/class_drawsegment.cpp +++ b/pcbnew/class_drawsegment.cpp @@ -173,7 +173,8 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, int l_trace; int mode; int radius; - LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; + + LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; EDA_COLOR_T color; BOARD * brd = GetBoard( ); @@ -185,13 +186,12 @@ 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 ); } - GRSetDrawMode( DC, draw_mode ); - l_trace = m_Width >> 1; /* half trace width */ + l_trace = m_Width >> 1; // half trace width // Line start point or Circle and Arc center ux0 = m_Start.x + aOffset.x; @@ -247,7 +247,6 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, EXCHG( StAngle, EndAngle ); } - if( mode == LINE ) GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius, color ); @@ -612,4 +611,3 @@ EDA_ITEM* DRAWSEGMENT::Clone() const { return new DRAWSEGMENT( *this ); } - diff --git a/pcbnew/class_edge_mod.cpp b/pcbnew/class_edge_mod.cpp index ede9d43564..2d1ba56e57 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; } @@ -111,18 +111,17 @@ void EDGE_MODULE::SetDrawCoord() void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, const wxPoint& offset ) { - int ux0, uy0, dx, dy, radius, StAngle, EndAngle; - int type_trace; - int typeaff; - LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; - PCB_BASE_FRAME* frame; + int ux0, uy0, dx, dy, radius, StAngle, EndAngle; + int type_trace; + int typeaff; + LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; + MODULE* module = (MODULE*) m_Parent; - if( module == NULL ) + if( !module ) return; - - BOARD * brd = GetBoard( ); + BOARD* brd = GetBoard( ); if( brd->IsLayerVisible( m_Layer ) == false ) return; @@ -135,8 +134,7 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, ColorTurnToDarkDarkGray( &color ); } - - frame = (PCB_BASE_FRAME*) panel->GetParent(); + PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) panel->GetParent(); type_trace = m_Shape; @@ -149,7 +147,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_marker_pcb.cpp b/pcbnew/class_marker_pcb.cpp index 9222698696..dd7d4e17a8 100644 --- a/pcbnew/class_marker_pcb.cpp +++ b/pcbnew/class_marker_pcb.cpp @@ -85,7 +85,7 @@ MARKER_PCB::~MARKER_PCB() * param aLayer The layer to test for. * return bool - true if on given layer, else false. */ -bool MARKER_PCB::IsOnLayer( LAYER_NUM aLayer ) const +bool MARKER_PCB::IsOnLayer( LAYER_ID aLayer ) const { return IsCopperLayer( aLayer ); } diff --git a/pcbnew/class_marker_pcb.h b/pcbnew/class_marker_pcb.h index 05e73ef3da..d1e7790323 100644 --- a/pcbnew/class_marker_pcb.h +++ b/pcbnew/class_marker_pcb.h @@ -79,7 +79,7 @@ public: return HitTestMarker( aPosition ); } - bool IsOnLayer( LAYER_NUM aLayer ) const; + bool IsOnLayer( LAYER_ID aLayer ) const; void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); 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..0e3f015d39 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 ).any() ) 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..621c1ad477 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,15 @@ 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 +497,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 ef1ab7f409..2d4eca4ebc 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..7de31f47a8 100644 --- a/pcbnew/class_pcb_layer_box_selector.cpp +++ b/pcbnew/class_pcb_layer_box_selector.cpp @@ -40,6 +40,36 @@ #include +// translate aLayer to its hotkey +static int layer2hotkey_id( LAYER_ID aLayer ) +{ + switch( aLayer ) + { + case F_Cu: return HK_SWITCH_LAYER_TO_COMPONENT; + + case B_Cu: return HK_SWITCH_LAYER_TO_COPPER; + + case In1_Cu: return HK_SWITCH_LAYER_TO_INNER1; + case In2_Cu: return HK_SWITCH_LAYER_TO_INNER2; + case In3_Cu: return HK_SWITCH_LAYER_TO_INNER3; + case In4_Cu: return HK_SWITCH_LAYER_TO_INNER4; + case In5_Cu: return HK_SWITCH_LAYER_TO_INNER5; + case In6_Cu: return HK_SWITCH_LAYER_TO_INNER6; + case In7_Cu: return HK_SWITCH_LAYER_TO_INNER7; + case In8_Cu: return HK_SWITCH_LAYER_TO_INNER8; + case In9_Cu: return HK_SWITCH_LAYER_TO_INNER9; + case In10_Cu: return HK_SWITCH_LAYER_TO_INNER10; + case In11_Cu: return HK_SWITCH_LAYER_TO_INNER11; + case In12_Cu: return HK_SWITCH_LAYER_TO_INNER12; + case In13_Cu: return HK_SWITCH_LAYER_TO_INNER13; + case In14_Cu: return HK_SWITCH_LAYER_TO_INNER14; + + default: + return -1; + } +} + + // class to display a layer list in a wxBitmapComboBox. // Reload the Layers @@ -47,40 +77,39 @@ void PCB_LAYER_BOX_SELECTOR::Resync() { Clear(); - static DECLARE_LAYERS_ORDER_LIST( layertranscode ); - static DECLARE_LAYERS_HOTKEY( layerhk ); - // Tray to fix a minimum width fot the BitmapComboBox - int minwidth = 80, h; + int minwidth = 80; + 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 ) + const int BM_SIZE = 14; + + 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 ) - layername = AddHotkeyName( layername, m_hotkeys, - layerhk[layerid], IS_COMMENT ); + if( m_layerhotkeys && m_hotkeys ) + { + int id = layer2hotkey_id( layerid ); + + if( id != -1 ) + layername = AddHotkeyName( layername, m_hotkeys, id, IS_COMMENT ); + } Append( layername, layerbmp, (void*)(intptr_t) layerid ); - int w; + + int w, h; + dc.GetTextExtent ( layername, &w, &h ); + minwidth = std::max( minwidth, w ); } @@ -96,27 +125,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( ToLAYER_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( ToLAYER_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( ToLAYER_ID( aLayer ) ); } + diff --git a/pcbnew/class_pcb_layer_box_selector.h b/pcbnew/class_pcb_layer_box_selector.h index 5ac87e5da4..07790861a8 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,11 +28,10 @@ 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; } // Accessors @@ -39,11 +39,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 +61,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..4004ca9715 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 = ToLAYER_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 = ToLAYER_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 = ToLAYER_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( ToLAYER_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( ToLAYER_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 821277a0a2..08d7aea310 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,56 +371,62 @@ 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 ); - if( bottom_layer <= layer_number && layer_number <= top_layer ) + wxASSERT( top_layer <= bottom_layer ); + + if( top_layer <= layer_number && layer_number <= bottom_layer ) return true; else 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 ) + wxASSERT( top_layer <= bottom_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 ) + if( aBottomLayer < aTopLayer ) EXCHG( aBottomLayer, aTopLayer ); m_Layer = aTopLayer; @@ -428,17 +434,17 @@ 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 t_layer = F_Cu; + LAYER_ID b_layer = B_Cu; if( GetViaType() != VIA_THROUGH ) { b_layer = m_BottomLayer; t_layer = m_Layer; - if( b_layer > t_layer ) + if( b_layer < t_layer ) EXCHG( b_layer, t_layer ); } @@ -594,7 +600,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) ) ) { @@ -613,6 +619,7 @@ void TRACK::DrawShortNetname( EDA_DRAW_PANEL* panel, } } + void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, const wxPoint& aOffset ) { @@ -630,7 +637,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 ); @@ -677,6 +684,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, DrawShortNetname( panel, aDC, aDrawMode, color ); } + void SEGZONE::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, const wxPoint& aOffset ) { @@ -697,7 +705,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 +769,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 +884,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 +895,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 +905,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 +921,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 +1183,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 +1261,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 +1276,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 +1296,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 +1333,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 +1350,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 +1375,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 +1383,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 +1394,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 +1404,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 +1432,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 +1451,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 +1476,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 a35b62dcf5..c658395ee4 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 @@ -281,7 +281,7 @@ public: return wxT( "TRACK" ); } - /** + /** * Function GetClearance * returns the clearance in internal units. If \a aItem is not NULL then the * returned clearance is the greater of this object's clearance and @@ -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.cpp b/pcbnew/class_zone.cpp index 6c2008bf73..104dd19e72 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -140,13 +140,13 @@ const wxPoint& ZONE_CONTAINER::GetPosition() const void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE aDrawMode, const wxPoint& offset ) { - if( DC == NULL ) + if( !DC ) return; - wxPoint seg_start, seg_end; - LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; + wxPoint seg_start, seg_end; + LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; + BOARD* brd = GetBoard(); - BOARD* brd = GetBoard(); EDA_COLOR_T color = brd->GetLayerColor( m_Layer ); if( brd->IsLayerVisible( m_Layer ) == false && ( color & HIGHLIGHT_FLAG ) != HIGHLIGHT_FLAG ) @@ -227,8 +227,8 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel, if( m_FilledPolysList.GetCornersCount() == 0 ) // Nothing to draw return; - BOARD* brd = GetBoard(); - LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; + BOARD* brd = GetBoard(); + LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; EDA_COLOR_T color = brd->GetLayerColor( m_Layer ); if( brd->IsLayerVisible( m_Layer ) == false && ( color & HIGHLIGHT_FLAG ) != HIGHLIGHT_FLAG ) @@ -366,11 +366,11 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( EDA_DRAW_PANEL* panel, wxDC* DC, bool is_close_segment = false; wxPoint seg_start, seg_end; - if( DC == NULL ) + if( !DC ) return; - LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; - BOARD* brd = GetBoard(); + LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; + BOARD* brd = GetBoard(); EDA_COLOR_T color = brd->GetLayerColor( m_Layer ); if( DisplayOpt.ContrastModeDisplay ) diff --git a/pcbnew/class_zone.h b/pcbnew/class_zone.h index 332fc84144..332e3c5141 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 IsCopperLayer( 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..fc2a679346 100644 --- a/pcbnew/connect.cpp +++ b/pcbnew/connect.cpp @@ -75,7 +75,8 @@ void CONNECTIONS::SearchConnectionsPadsToIntersectingPads() for( unsigned ii = 0; ii < m_sortedPads.size(); ii++ ) { - D_PAD * pad = m_sortedPads[ii]; + D_PAD* pad = m_sortedPads[ii]; + pad->m_PadsConnected.clear(); candidates.clear(); @@ -84,12 +85,14 @@ void CONNECTIONS::SearchConnectionsPadsToIntersectingPads() // add pads to pad.m_PadsConnected, if they are connected for( unsigned jj = 0; jj < candidates.size(); jj++ ) { - CONNECTED_POINT * item = candidates[jj]; - D_PAD * candidate_pad = item->GetPad(); + CONNECTED_POINT* item = candidates[jj]; + + D_PAD* candidate_pad = item->GetPad(); + if( pad == candidate_pad ) continue; - if( (pad->GetLayerMask() & candidate_pad->GetLayerMask()) == 0 ) + if( !( pad->GetLayerSet() & candidate_pad->GetLayerSet() ).any() ) continue; if( pad->HitTest( item->GetPoint() ) ) { @@ -122,7 +125,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() ).any() ) continue; if( pad->HitTest( cp_item->GetPoint() ) ) @@ -242,12 +245,13 @@ static bool sortConnectedPointByXthenYCoordinates( const CONNECTED_POINT & aRef, return aRef.GetPoint().x < aTst.GetPoint().x; } -void CONNECTIONS::BuildTracksCandidatesList( TRACK * aBegin, TRACK * aEnd) +void CONNECTIONS::BuildTracksCandidatesList( TRACK* aBegin, TRACK* aEnd) { m_candidates.clear(); m_firstTrack = m_lastTrack = aBegin; unsigned ii = 0; + // Count candidates ( i.e. end points ) for( const TRACK* track = aBegin; track; track = track->Next() ) { @@ -257,14 +261,17 @@ void CONNECTIONS::BuildTracksCandidatesList( TRACK * aBegin, TRACK * aEnd) ii += 2; m_lastTrack = track; + if( track == aEnd ) break; } + // Build candidate list m_candidates.reserve( ii ); for( TRACK* track = aBegin; track; track = track->Next() ) { - CONNECTED_POINT candidate( track, track->GetStart()); + CONNECTED_POINT candidate( track, track->GetStart() ); + m_candidates.push_back( candidate ); if( track->Type() != PCB_VIA_T ) { @@ -282,6 +289,7 @@ void CONNECTIONS::BuildTracksCandidatesList( TRACK * aBegin, TRACK * aEnd) sort( m_candidates.begin(), m_candidates.end(), sortConnectedPointByXthenYCoordinates ); } + /* Populates .m_connected with tracks/vias connected to aTrack * param aTrack = track or via to use as reference * For calculation time reason, an exhaustive search cannot be made @@ -291,55 +299,67 @@ void CONNECTIONS::BuildTracksCandidatesList( TRACK * aBegin, TRACK * aEnd) * because with this constraint we can make a fast search in track list * m_candidates is expected to be populated by the track candidates ends list */ -int CONNECTIONS::SearchConnectedTracks( const TRACK * aTrack ) +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 + #ifdef USE_EXTENDED_SEARCH int dist_max = aTrack->GetWidth() / 2; static std::vector tracks_candidates; #endif + wxPoint position = aTrack->GetStart(); + for( int kk = 0; kk < 2; kk++ ) { #ifndef USE_EXTENDED_SEARCH int idx = searchEntryPointInCandidatesList( position ); - if ( idx >= 0 ) + + if( idx >= 0 ) { // search after: - for ( unsigned ii = idx; ii < m_candidates.size(); ii ++ ) + for( unsigned ii = idx; ii < m_candidates.size(); ii ++ ) { if( m_candidates[ii].GetTrack() == aTrack ) continue; + if( m_candidates[ii].GetPoint() != position ) break; - if( m_candidates[ii].GetTrack()->GetLayerMask() & layerMask ) + + if( ( m_candidates[ii].GetTrack()->GetLayerSet() & layerMask ).any() ) m_connected.push_back( m_candidates[ii].GetTrack() ); } + // search before: - for ( int ii = idx-1; ii >= 0; ii -- ) + for( int ii = idx-1; ii >= 0; ii -- ) { if( m_candidates[ii].GetTrack() == aTrack ) continue; + if( m_candidates[ii].GetPoint() != position ) break; - if( m_candidates[ii].GetTrack()->GetLayerMask() & layerMask ) + + if( ( m_candidates[ii].GetTrack()->GetLayerSet() & layerMask ).any() ) m_connected.push_back( m_candidates[ii].GetTrack() ); } } #else - tracks_candidates.clear(); - CollectItemsNearTo( tracks_candidates, position, dist_max ); - for ( unsigned ii = 0; ii < tracks_candidates.size(); ii ++ ) - { - TRACK * ctrack = tracks_candidates[ii]->GetTrack(); - if( ( ctrack->GetLayerMask() & layerMask ) == 0 ) + tracks_candidates.clear(); + + CollectItemsNearTo( tracks_candidates, position, dist_max ); + + for( unsigned ii = 0; ii < tracks_candidates.size(); ii++ ) + { + TRACK* ctrack = tracks_candidates[ii]->GetTrack(); + + if( !( ctrack->GetLayerSet() & layerMask ).any() ) continue; if( ctrack == aTrack ) @@ -348,6 +368,7 @@ int CONNECTIONS::SearchConnectedTracks( const TRACK * aTrack ) // We have a good candidate: calculate the actual distance // between ends, which should be <= dist max. wxPoint delta = tracks_candidates[ii]->GetPoint() - position; + int dist = KiROUND( EuclideanNorm( delta ) ); if( dist > dist_max ) @@ -367,7 +388,8 @@ int CONNECTIONS::SearchConnectedTracks( const TRACK * aTrack ) return count; } -int CONNECTIONS::searchEntryPointInCandidatesList( const wxPoint & aPoint) + +int CONNECTIONS::searchEntryPointInCandidatesList( const wxPoint& aPoint ) { // Search the aPoint coordinates in m_Candidates // m_Candidates is sorted by X then Y values, and a fast binary search is used @@ -376,15 +398,18 @@ int CONNECTIONS::searchEntryPointInCandidatesList( const wxPoint & aPoint) int delta = m_candidates.size(); int idx = 0; // Starting index is the beginning of list + while( delta ) { // Calculate half size of remaining interval to test. // Ensure the computed value is not truncated (too small) - if( (delta & 1) && ( delta > 1 ) ) + if( ( delta & 1 ) && ( delta > 1 ) ) delta++; + delta /= 2; - CONNECTED_POINT & candidate = m_candidates[idx]; + CONNECTED_POINT& candidate = m_candidates[idx]; + if( candidate.GetPoint() == aPoint ) // candidate found { return idx; @@ -604,6 +629,7 @@ void CONNECTIONS::Propagate_SubNets() for( unsigned ii = 0; ii < curr_track->m_TracksConnected.size(); ii++ ) { BOARD_CONNECTED_ITEM* track = curr_track->m_TracksConnected[ii]; + if( curr_track->GetSubNet() ) // The current track is already a cluster member { // The other track is already a cluster member, so we can merge the 2 clusters @@ -613,8 +639,8 @@ void CONNECTIONS::Propagate_SubNets() } else { - /* The other track is not yet attached to a cluster , so we can add this - * other track to the cluster */ + // The other track is not yet attached to a cluster , so we can add this + // other track to the cluster track->SetSubNet( curr_track->GetSubNet() ); } } @@ -628,8 +654,8 @@ void CONNECTIONS::Propagate_SubNets() } else { - /* it is connected to an other segment not in a cluster, so we must - * create a new cluster (only with the 2 track segments) */ + // it is connected to an other segment not in a cluster, so we must + // create a new cluster (only with the 2 track segments) sub_netcode++; curr_track->SetSubNet( sub_netcode ); track->SetSubNet( curr_track->GetSubNet() ); @@ -645,10 +671,12 @@ void CONNECTIONS::Propagate_SubNets() // sub_netcodes to intersecting pads for( unsigned ii = 0; ii < m_sortedPads.size(); ii++ ) { - D_PAD * curr_pad = m_sortedPads[ii]; + D_PAD* curr_pad = m_sortedPads[ii]; + for( unsigned jj = 0; jj < curr_pad->m_PadsConnected.size(); jj++ ) { - D_PAD * pad = curr_pad->m_PadsConnected[jj]; + D_PAD* pad = curr_pad->m_PadsConnected[jj]; + if( curr_pad->GetSubNet() ) // the current pad is already attached to a cluster { if( pad->GetSubNet() > 0 ) @@ -657,8 +685,10 @@ void CONNECTIONS::Propagate_SubNets() // Store the initial subnets, which will be modified by Merge_PadsSubNets int subnet1 = pad->GetSubNet(); int subnet2 = curr_pad->GetSubNet(); + // merge subnets of pads only, even those not connected by tracks Merge_PadsSubNets( subnet1, subnet2 ); + // merge subnets of tracks (and pads, which are already merged) Merge_SubNets( subnet1, subnet2 ); } @@ -713,12 +743,15 @@ void PCB_BASE_FRAME::TestConnections() // note some nets can have no tracks, and pads intersecting // so Build_CurrNet_SubNets_Connections must be called for each net CONNECTIONS connections( m_Pcb ); + int last_net_tested = 0; int current_net_code = 0; + for( TRACK* track = m_Pcb->m_Track; track; ) { // At this point, track is the first track of a given net current_net_code = track->GetNetCode(); + // Get last track of the current net TRACK* lastTrack = track->GetEndNetCode( current_net_code ); @@ -777,6 +810,7 @@ void PCB_BASE_FRAME::TestNetConnection( wxDC* aDC, int aNetCode ) if( m_Pcb->m_Track ) { CONNECTIONS connections( m_Pcb ); + TRACK* firstTrack; TRACK* lastTrack = NULL; firstTrack = m_Pcb->m_Track.GetFirst()->GetStartNetCode( aNetCode ); @@ -827,22 +861,19 @@ void PCB_BASE_FRAME::TestNetConnection( wxDC* aDC, int aNetCode ) */ void PCB_BASE_FRAME::RecalculateAllTracksNetcode() { - TRACK* curr_track; - // Build the net info list GetBoard()->BuildListOfNets(); // Reset variables and flags used in computation - curr_track = m_Pcb->m_Track; - for( ; curr_track != NULL; curr_track = curr_track->Next() ) + for( TRACK* t = m_Pcb->m_Track; t; t = t->Next() ) { - curr_track->m_TracksConnected.clear(); - curr_track->m_PadsConnected.clear(); - curr_track->start = NULL; - curr_track->end = NULL; - curr_track->SetState( BUSY | IN_EDIT | BEGIN_ONPAD | END_ONPAD, false ); - curr_track->SetZoneSubNet( 0 ); - curr_track->SetNetCode( NETINFO_LIST::UNCONNECTED ); + t->m_TracksConnected.clear(); + t->m_PadsConnected.clear(); + t->start = NULL; + t->end = NULL; + t->SetState( BUSY | IN_EDIT | BEGIN_ONPAD | END_ONPAD, false ); + t->SetZoneSubNet( 0 ); + t->SetNetCode( NETINFO_LIST::UNCONNECTED ); } // If no pad, reset pointers and netcode, and do nothing else @@ -856,21 +887,19 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode() // First pass: build connections between track segments and pads. connections.SearchTracksConnectedToPads(); - /* For tracks connected to at least one pad, - * set the track net code to the pad netcode - */ - curr_track = m_Pcb->m_Track; - for( ; curr_track != NULL; curr_track = curr_track->Next() ) + // For tracks connected to at least one pad, + // set the track net code to the pad netcode + for( TRACK* t = m_Pcb->m_Track; t; t = t->Next() ) { - if( curr_track->m_PadsConnected.size() ) - curr_track->SetNetCode( curr_track->m_PadsConnected[0]->GetNetCode() ); + if( t->m_PadsConnected.size() ) + t->SetNetCode( t->m_PadsConnected[0]->GetNetCode() ); } // Pass 2: build connections between track ends - for( curr_track = m_Pcb->m_Track; curr_track != NULL; curr_track = curr_track->Next() ) + for( TRACK* t = m_Pcb->m_Track; t; t = t->Next() ) { - connections.SearchConnectedTracks( curr_track ); - connections.GetConnectedTracks( curr_track ); + connections.SearchConnectedTracks( t ); + connections.GetConnectedTracks( t ); } // Propagate net codes from a segment to other connected segments @@ -881,31 +910,35 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode() { new_pass_request = false; - for( curr_track = m_Pcb->m_Track; curr_track; curr_track = curr_track->Next() ) + for( TRACK* t = m_Pcb->m_Track; t; t = t->Next() ) { - int netcode = curr_track->GetNetCode(); + int netcode = t->GetNetCode(); + if( netcode == 0 ) - { // try to find a connected item having a netcode - for( unsigned kk = 0; kk < curr_track->m_TracksConnected.size(); kk++ ) + { + // try to find a connected item having a netcode + for( unsigned kk = 0; kk < t->m_TracksConnected.size(); kk++ ) { - int altnetcode = curr_track->m_TracksConnected[kk]->GetNetCode(); + int altnetcode = t->m_TracksConnected[kk]->GetNetCode(); if( altnetcode ) { new_pass_request = true; netcode = altnetcode; - curr_track->SetNetCode(netcode); + t->SetNetCode(netcode); break; } } } + if( netcode ) // this track has a netcode - { // propagate this netcode to connected tracks having no netcode - for( unsigned kk = 0; kk < curr_track->m_TracksConnected.size(); kk++ ) + { + // propagate this netcode to connected tracks having no netcode + for( unsigned kk = 0; kk < t->m_TracksConnected.size(); kk++ ) { - int altnetcode = curr_track->m_TracksConnected[kk]->GetNetCode(); + int altnetcode = t->m_TracksConnected[kk]->GetNetCode(); if( altnetcode == 0 ) { - curr_track->m_TracksConnected[kk]->SetNetCode(netcode); + t->m_TracksConnected[kk]->SetNetCode(netcode); new_pass_request = true; } } 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 a24fde6d18..6ba70d8baa 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,68 +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, - UNDEFINED_LAYER, - aFullFileName, - wxEmptyString ); + &plot_opts, UNDEFINED_LAYER, 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(); } @@ -368,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..b39505a713 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,30 @@ 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( + m_LayerSelectionCtrl->GetItemCount(), msg, layer ); + + if( m_settings.m_CurrentZone_Layer == layer ) m_LayerSelectionCtrl->Select( itemIndex ); wxSize tsize( GetTextSize( msg, m_LayerSelectionCtrl ) ); @@ -281,8 +284,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 +469,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 = ToLAYER_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..e06f990b29 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( ToLAYER_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( ToLAYER_ID( 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..fff88b87af 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( ToLAYER_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..02f9c551b1 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( ToLAYER_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..9c2141b7ff 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 = ToLAYER_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..74f20e6500 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,93 @@ 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, + + 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, + 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 +210,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 +226,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 +257,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 +317,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 ); @@ -305,14 +361,19 @@ DIALOG_LAYERS_SETUP::DIALOG_LAYERS_SETUP( PCB_EDIT_FRAME* parent ) : void DIALOG_LAYERS_SETUP::showCopperChoice( int copperCount ) { - static const int copperCounts[] = { 2,4,6,8,10,12,14,16 }; + if( copperCount > MAX_CU_LAYERS ) + copperCount = MAX_CU_LAYERS; - for( unsigned i = 0; iSetSelection(i); + int idx = lyrCnt/2 - 1; + m_CopperLayersChoice->SetSelection(idx); break; } } @@ -325,8 +386,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 +480,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 +514,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 +551,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 +578,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 +599,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 +629,7 @@ int DIALOG_LAYERS_SETUP::getLayerTypeIndex( LAYER_NUM aLayer ) return ret; } + wxString DIALOG_LAYERS_SETUP::getLayerName( LAYER_NUM aLayer ) { wxString ret; @@ -590,6 +643,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 +682,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 +720,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..c67da1bc62 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"), _("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..4769253a1d 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" "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..eca91a1935 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( ToLAYER_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 cc8ccbda45..4cffce5151 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 ); } @@ -243,48 +236,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; } } @@ -683,13 +674,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 ); @@ -787,51 +777,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, layer, 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, - layer, 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..043dc10776 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( ToLAYER_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..82764600aa 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() ).any() ) 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..0860d623d5 100644 --- a/pcbnew/drc.cpp +++ b/pcbnew/drc.cpp @@ -536,6 +536,7 @@ void DRC::testUnconnected() D_PAD* padEnd = rat.m_PadEnd; msg = padStart->GetSelectMenuText() + wxT( " net " ) + padStart->GetNetname(); + DRC_ITEM* uncItem = new DRC_ITEM( DRCE_UNCONNECTED_PADS, msg, padEnd->GetSelectMenuText(), @@ -676,7 +677,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 +687,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 +713,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..87acf726dd 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() ).any() ) continue; // the minimum distance = clearance plus half the reference track diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index 4e48b04098..b79e51b944 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 ToLAYER_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..eb6bb85843 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(); @@ -520,11 +523,11 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_PCB_ZONE_DUPLICATE: - { - ZONE_CONTAINER* zone = (ZONE_CONTAINER*) GetCurItem(); - duplicateZone( &dc, zone ); - } - break; + { + ZONE_CONTAINER* zone = (ZONE_CONTAINER*) GetCurItem(); + duplicateZone( &dc, zone ); + } + break; case ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE: m_canvas->MoveCursorToCrossHair(); @@ -556,60 +559,60 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_PCB_MOVE_ZONE_CORNER: - { - m_canvas->MoveCursorToCrossHair(); - ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); - m_canvas->SetAutoPanRequest( true ); - Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->GetSelectedCorner(), false ); + { + m_canvas->MoveCursorToCrossHair(); + ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); + m_canvas->SetAutoPanRequest( true ); + Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->GetSelectedCorner(), false ); + } break; - } case ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT: - { - m_canvas->MoveCursorToCrossHair(); - ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); - m_canvas->SetAutoPanRequest( true ); - Start_Move_Zone_Drag_Outline_Edge( &dc, zone_cont, zone_cont->GetSelectedCorner() ); + { + m_canvas->MoveCursorToCrossHair(); + ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); + m_canvas->SetAutoPanRequest( true ); + Start_Move_Zone_Drag_Outline_Edge( &dc, zone_cont, zone_cont->GetSelectedCorner() ); + } break; - } case ID_POPUP_PCB_MOVE_ZONE_OUTLINES: - { - m_canvas->MoveCursorToCrossHair(); - ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); - m_canvas->SetAutoPanRequest( true ); - Start_Move_Zone_Outlines( &dc, zone_cont ); + { + m_canvas->MoveCursorToCrossHair(); + ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); + m_canvas->SetAutoPanRequest( true ); + Start_Move_Zone_Outlines( &dc, zone_cont ); + } break; - } case ID_POPUP_PCB_ADD_ZONE_CORNER: - { - m_canvas->MoveCursorToCrossHair(); - ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); - wxPoint pos = GetCrossHairPosition(); + { + m_canvas->MoveCursorToCrossHair(); + ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); + wxPoint pos = GetCrossHairPosition(); - /* add corner between zone_cont->m_CornerSelection - * and zone_cont->m_CornerSelection+1 - * and start move the new corner - */ - zone_cont->Draw( m_canvas, &dc, GR_XOR ); - zone_cont->Outline()->InsertCorner( zone_cont->GetSelectedCorner(), pos.x, pos.y ); - zone_cont->SetSelectedCorner( zone_cont->GetSelectedCorner() + 1 ); - zone_cont->Draw( m_canvas, &dc, GR_XOR ); - m_canvas->SetAutoPanRequest( true ); - Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->GetSelectedCorner(), true ); + /* add corner between zone_cont->m_CornerSelection + * and zone_cont->m_CornerSelection+1 + * and start move the new corner + */ + zone_cont->Draw( m_canvas, &dc, GR_XOR ); + zone_cont->Outline()->InsertCorner( zone_cont->GetSelectedCorner(), pos.x, pos.y ); + zone_cont->SetSelectedCorner( zone_cont->GetSelectedCorner() + 1 ); + zone_cont->Draw( m_canvas, &dc, GR_XOR ); + m_canvas->SetAutoPanRequest( true ); + Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->GetSelectedCorner(), true ); + } break; - } case ID_POPUP_PCB_PLACE_ZONE_OUTLINES: case ID_POPUP_PCB_PLACE_ZONE_CORNER: - { - m_canvas->MoveCursorToCrossHair(); - ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); - End_Move_Zone_Corner_Or_Outlines( &dc, zone_cont ); - m_canvas->SetAutoPanRequest( false ); + { + m_canvas->MoveCursorToCrossHair(); + ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); + End_Move_Zone_Corner_Or_Outlines( &dc, zone_cont ); + m_canvas->SetAutoPanRequest( false ); + } break; - } case ID_POPUP_PCB_FILL_ALL_ZONES: 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( ToLAYER_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..7312a741d2 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,23 +118,24 @@ 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_BLIND_BURIED: + via->SetLayerPair( first_layer, last_layer ); + break; - case VIA_MICROVIA: // from external to the near neighbor inner layer + 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 ) + LAYER_ID last_inner_layer = ToLAYER_ID( ( GetBoard()->GetCopperLayerCount() - 2 ) ); + + if( first_layer == B_Cu ) 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 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 ); @@ -143,10 +144,10 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) via->SetWidth( net->GetMicroViaSize() ); } } - break; + break; - default: - break; + default: + break; } if( g_Drc_On && BAD_DRC == m_drc->Drc( via, GetBoard()->m_Track ) ) @@ -310,4 +311,3 @@ void PCB_EDIT_FRAME::Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC ) GetBoard()->m_FullRatsnest[ii].m_Status &= ~CH_VISIBLE; } } - diff --git a/pcbnew/editrack.cpp b/pcbnew/editrack.cpp index fa5dbacf73..ade0736df6 100644 --- a/pcbnew/editrack.cpp +++ b/pcbnew/editrack.cpp @@ -62,8 +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 ) { @@ -99,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 { @@ -123,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(); @@ -138,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 @@ -159,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() ); @@ -175,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 ); @@ -415,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; @@ -452,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); } } @@ -1010,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 ) { @@ -1048,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; @@ -1058,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..5d166c5882 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,15 @@ 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; - ext = wxT( "cad" ); - wildcard = _( "GenCAD 1.4 board files (.cad)|*.cad" ); +#if 0 // working on this 30-Jun-14, not ready yet, failed the initial testing. + + wxFileName fn = GetBoard()->GetFileName(); + FILE* file; + + wxString ext = wxT( "cad" ); + wxString wildcard = _( "GenCAD 1.4 board files (.cad)|*.cad" ); + fn.SetExt( ext ); wxFileDialog dlg( this, _( "Save GenCAD Board File" ), wxGetCwd(), @@ -136,6 +275,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 +302,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 +339,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() ) { @@ -206,6 +347,8 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent ) module->SetFlag( 0 ); } } +#endif + } @@ -231,8 +374,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 +396,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 +416,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 +434,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 +444,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 +608,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 +648,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 +663,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 +704,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 +746,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 +755,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 +805,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 +902,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 +926,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 +973,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 +1012,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 +1049,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 +1085,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 +1102,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 +1189,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 +1200,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 4da01357c9..4a6c71d24b 100644 --- a/pcbnew/exporters/export_vrml.cpp +++ b/pcbnew/exporters/export_vrml.cpp @@ -135,12 +135,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: @@ -168,7 +167,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 ); @@ -215,7 +214,7 @@ public: double GetLayerZ( LAYER_NUM aLayer ) { - if( aLayer >= NB_LAYERS ) + if( unsigned( aLayer ) >= DIM( layer_z ) ) return 0; return layer_z[ aLayer ]; @@ -275,19 +274,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; @@ -412,13 +411,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 ); @@ -426,13 +425,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 ); @@ -440,9 +439,9 @@ static void write_layers( MODEL_VRML& aModel, std::ofstream& output_file, BOARD* aModel.plated_holes.Tesselate( NULL, true ); write_triangle_bag( output_file, aModel.GetColor( VRML_COLOR_TIN ), &aModel.plated_holes, false, false, - aModel.GetLayerZ( LAST_COPPER_LAYER ) + aModel.GetLayerZ( F_Cu ) + Millimeter2iu( ART_OFFSET / 2.0 ) * aModel.scale, - aModel.GetLayerZ( FIRST_COPPER_LAYER ) + aModel.GetLayerZ( B_Cu ) - Millimeter2iu( ART_OFFSET / 2.0 ) * aModel.scale, aModel.precision ); @@ -450,13 +449,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 ); } @@ -469,8 +468,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 @@ -480,19 +481,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 ); } @@ -585,7 +586,7 @@ static void export_vrml_drawsegment( MODEL_VRML& aModel, DRAWSEGMENT* drawseg ) double yf = drawseg->GetEnd().y * aModel.scale; // Items on the edge layer are handled elsewhere; just return - if( layer == EDGE_N ) + if( layer == Edge_Cuts ) return; switch( drawseg->GetShape() ) @@ -674,10 +675,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() ) @@ -792,11 +792,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 ) @@ -804,7 +804,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 ); @@ -812,7 +812,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 ); @@ -831,8 +831,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; @@ -841,7 +841,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 @@ -851,14 +851,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, track->GetStart().y * aModel.scale, @@ -1139,14 +1138,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 ); } @@ -1207,7 +1206,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() ) { @@ -1229,7 +1228,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..7c474553c3 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( ToLAYER_ID( layer1 ) ) ), + TO_UTF8( m_pcb->GetLayerName( ToLAYER_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.cpp b/pcbnew/hotkeys.cpp index 6e63856363..bfd91c7bf0 100644 --- a/pcbnew/hotkeys.cpp +++ b/pcbnew/hotkeys.cpp @@ -37,10 +37,12 @@ static EDA_HOTKEY HkMouseLeftClick( wxT( "Mouse Left Click" ), static EDA_HOTKEY HkMouseLeftDClick( wxT( "Mouse Left DClick" ), HK_LEFT_DCLICK, WXK_END, 0 ); -static EDA_HOTKEY HkSwitch2CopperLayer( wxT( "Switch to Copper layer" ), +static EDA_HOTKEY HkSwitch2CopperLayer( wxT( "Switch to Copper (B.Cu) layer" ), HK_SWITCH_LAYER_TO_COPPER, WXK_PAGEDOWN ); -static EDA_HOTKEY HkSwitch2ComponentLayer( wxT( "Switch to Component layer" ), + +static EDA_HOTKEY HkSwitch2ComponentLayer( wxT( "Switch to Component (F.Cu) layer" ), HK_SWITCH_LAYER_TO_COMPONENT, WXK_PAGEUP ); + static EDA_HOTKEY HkSwitch2InnerLayer1( wxT( "Switch to Inner layer 1" ), HK_SWITCH_LAYER_TO_INNER1, WXK_F5 ); static EDA_HOTKEY HkSwitch2InnerLayer2( wxT( "Switch to Inner layer 2" ), diff --git a/pcbnew/hotkeys_board_editor.cpp b/pcbnew/hotkeys_board_editor.cpp index 1cffe09577..15b42f134d 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 = ToLAYER_ID( GetBoard()->GetCopperLayerCount() - 2 ); else - --ll; + ll = ll - 1; - SwitchLayer( aDC, ll ); + SwitchLayer( aDC, ToLAYER_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, ToLAYER_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 3a31fd0297..6cd7e86fc4 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( ToLAYER_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 ); } @@ -141,6 +145,7 @@ void DXF2BRD_CONVERTER::addPolyline(const DRW_Polyline& data ) // Obviously, the z coordinate is ignored wxPoint startpoint; + for( unsigned ii = 0; ii < data.vertlist.size(); ii++ ) { DRW_Vertex* vertex = data.vertlist[ii]; @@ -153,7 +158,8 @@ void DXF2BRD_CONVERTER::addPolyline(const DRW_Polyline& data ) } DRAWSEGMENT* segm = new DRAWSEGMENT( m_brd ); - segm->SetLayer( m_brdLayer ); + + segm->SetLayer( ToLAYER_ID( m_brdLayer ) ); segm->SetStart( startpoint ); wxPoint endpoint( mapX( vertex->basePoint.x ), mapY( vertex->basePoint.y ) ); segm->SetEnd( endpoint ); @@ -172,6 +178,7 @@ void DXF2BRD_CONVERTER::addLWPolyline(const DRW_LWPolyline& data ) // (obviously contant and is the width of the DRW_LWPolyline. // the variable width of each vertex (when exists) is not used. wxPoint startpoint; + for( unsigned ii = 0; ii < data.vertlist.size(); ii++ ) { DRW_Vertex2D* vertex = data.vertlist[ii]; @@ -184,7 +191,8 @@ void DXF2BRD_CONVERTER::addLWPolyline(const DRW_LWPolyline& data ) } DRAWSEGMENT* segm = new DRAWSEGMENT( m_brd ); - segm->SetLayer( m_brdLayer ); + + segm->SetLayer( ToLAYER_ID( m_brdLayer ) ); segm->SetStart( startpoint ); wxPoint endpoint( mapX( vertex->x ), mapY( vertex->y ) ); segm->SetEnd( endpoint ); @@ -202,7 +210,7 @@ void DXF2BRD_CONVERTER::addCircle( const DRW_Circle& data ) { DRAWSEGMENT* segm = new DRAWSEGMENT( m_brd ); - segm->SetLayer( m_brdLayer ); + segm->SetLayer( ToLAYER_ID( m_brdLayer ) ); segm->SetShape( S_CIRCLE ); wxPoint center( mapX( data.basePoint.x ), mapY( data.basePoint.y ) ); segm->SetCenter( center ); @@ -222,7 +230,7 @@ void DXF2BRD_CONVERTER::addArc( const DRW_Arc& data ) { DRAWSEGMENT* segm = new DRAWSEGMENT( m_brd ); - segm->SetLayer( m_brdLayer ); + segm->SetLayer( ToLAYER_ID( m_brdLayer ) ); segm->SetShape( S_ARC ); // Init arc centre: @@ -259,7 +267,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( ToLAYER_ID( m_brdLayer ) ); wxPoint refPoint( mapX(data.basePoint.x), mapY(data.basePoint.y) ); wxPoint secPoint( mapX(data.secPoint.x), mapY(data.secPoint.y) ); @@ -387,7 +395,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( ToLAYER_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..e92c20454c 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 LEG_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 LEG_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,89 @@ static EDA_TEXT_VJUSTIFY_T vertJustify( const char* vertical ) } +/// Count the number of set layers in the mask +inline int layerMaskCountSet( LEG_MASK aMask ) +{ + int count = 0; + + for( int i = 0; 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( unsigned( old ) <= unsigned( LAYER_N_FRONT ) ) + { + if( old == LAYER_N_FRONT ) + newid = F_Cu; + else if( old == LAYER_N_BACK ) + newid = B_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; + + if( ( aMask & ALL_CU_LAYERS ) == ALL_CU_LAYERS ) + { + ret = LSET::AllCuMask(); + + aMask &= ~ALL_CU_LAYERS; + } + + for( int i=0; aMask; ++i, aMask >>= 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 +490,7 @@ void LEGACY_PLUGIN::loadAllSections( bool doAppend ) module->SetFPID( fpid ); - LoadMODULE( module.get() ); + loadMODULE( module.get() ); m_board->Add( module.release(), ADD_APPEND ); } @@ -412,6 +610,7 @@ void LEGACY_PLUGIN::loadGENERAL() { char* line; char* saveptr; + bool saw_LayerCount = false; while( ( line = READLINE( m_reader ) ) != NULL ) { @@ -428,28 +627,60 @@ void LEGACY_PLUGIN::loadGENERAL() } } + else if( TESTLINE( "LayerCount" ) ) + { + int tmp = intParse( line + SZ( "LayerCount" ) ); + m_board->SetCopperLayerCount( tmp ); + + // This has to be set early so that leg_layer2new() works OK, and + // that means before parsing "EnabledLayers" and "VisibleLayers". + m_cu_count = tmp; + + saw_LayerCount = true; + } + else if( TESTLINE( "EnabledLayers" ) ) { - LAYER_MSK enabledLayers = hexParse( line + SZ( "EnabledLayers" ) ); + if( !saw_LayerCount ) + THROW_IO_ERROR( "Missing '$GENERAL's LayerCount" ); - // layer usage - m_board->SetEnabledLayers( enabledLayers ); + LEG_MASK enabledLayers = hexParse( line + SZ( "EnabledLayers" ) ); + + LSET new_mask = leg_mask2new( m_cu_count, enabledLayers ); + + //DBG( printf( "EnabledLayers: %s\n", new_mask.FmtHex().c_str() );) + + m_board->SetEnabledLayers( new_mask ); // layer visibility equals layer usage, unless overridden later via "VisibleLayers" - m_board->SetVisibleLayers( enabledLayers ); + // Must call SetEnabledLayers() before calling SetVisibleLayers(). + m_board->SetVisibleLayers( new_mask ); } else if( TESTLINE( "VisibleLayers" ) ) { - LAYER_MSK visibleLayers = hexParse( line + SZ( "VisibleLayers" ) ); - m_board->SetVisibleLayers( visibleLayers ); + if( !saw_LayerCount ) + THROW_IO_ERROR( "Missing '$GENERAL's LayerCount" ); + + LEG_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" ) ); + if( !saw_LayerCount ) + { + LEG_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 ); + + saw_LayerCount = true; + } } else if( TESTLINE( "BoardThickness" ) ) @@ -671,29 +902,50 @@ void LEGACY_PLUGIN::loadSETUP() bds.m_AuxOrigin = wxPoint( gx, gy ); } + /* Done from $General above's "LayerCount" else if( TESTLINE( "Layers" ) ) { int tmp = intParse( line + SZ( "Layers" ) ); m_board->SetCopperLayerCount( tmp ); + + m_cu_count = tmp; } + */ else if( TESTSUBSTR( "Layer[" ) ) { // 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 ); + + /* + switch( layer_num ) + { + case LAYER_N_BACK: + layer_id = B_Cu; + break; + + case LAYER_N_FRONT: + layer_id = F_Cu; + break; + + default: + layer_id = LAYER_ID( 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 +1193,7 @@ void LEGACY_PLUGIN::loadSETUP() } -void LEGACY_PLUGIN::LoadMODULE( MODULE* aModule ) +void LEGACY_PLUGIN::loadMODULE( MODULE* aModule ) { char* line; char* saveptr; @@ -999,7 +1251,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 +1269,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 +1551,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 ); + LEG_MASK layer_mask = hexParse( data ); - pad->SetLayerMask( layer_mask ); + pad->SetLayerSet( leg_mask2new( m_cu_count, layer_mask ) ); pad->SetAttribute( attribute ); } @@ -1428,8 +1682,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 +1791,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 +1851,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 +1895,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 +2023,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 +2218,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 +2240,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 +2315,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 +2356,6 @@ void LEGACY_PLUGIN::loadTrackList( int aStructType ) newTrack->SetEnd( wxPoint( end_x, end_y ) ); newTrack->SetWidth( width ); - newTrack->SetLayer( layer ); if( makeType == PCB_VIA_T ) // Ensure layers are OK when possible: { @@ -2110,7 +2368,18 @@ 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 ); + else + { + LAYER_ID back = leg_layer2new( m_cu_count, (layer_num >> 4) & 0xf ); + LAYER_ID front = leg_layer2new( m_cu_count, layer_num & 0xf ); + + via->SetLayerPair( front, back ); + } + } + else + { + newTrack->SetLayer( leg_layer2new( m_cu_count, layer_num ) ); } newTrack->SetNetCode( getNetCode( net_code ) ); @@ -2266,8 +2535,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 +2769,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 +2777,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 +2953,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 +2980,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 +3050,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 +3068,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 +3236,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 +3342,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 +3444,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 +3711,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 +3749,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 +3853,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 +4169,8 @@ void LEGACY_PLUGIN::savePCB_TEXT( const TEXTE_PCB* me ) const fprintf( m_fp, "$EndTEXTPCB\n" ); } +#endif // NO LEGACY_PLUGIN::Save() + //------------------------------------------------- @@ -3925,7 +4205,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 +4371,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 +4438,7 @@ void LP_CACHE::LoadModules( LINE_READER* aReader ) } +#if 0 void LP_CACHE::Save() { if( !m_writable ) @@ -4242,10 +4523,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 +4591,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 +4629,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 +4686,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 +4717,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 +4727,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 ac355ff6f8..02c0601e10 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/minimun_spanning_tree.cpp b/pcbnew/minimun_spanning_tree.cpp index 8d683f7786..5e608d3ea9 100644 --- a/pcbnew/minimun_spanning_tree.cpp +++ b/pcbnew/minimun_spanning_tree.cpp @@ -121,7 +121,7 @@ void MIN_SPAN_TREE::updateDistances( int target ) void MIN_SPAN_TREE::BuildTree() { - /* Add the first node to the tree */ + // Add the first node to the tree inTree[0] = 1; updateDistances( 0 ); @@ -129,6 +129,7 @@ void MIN_SPAN_TREE::BuildTree() { // Find the node with the smallest distance to the tree int min = -1; + for( int ii = 0; ii < m_Size; ++ii ) { if( !inTree[ii] ) 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..75c2ffed0c 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 = ToLAYER_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..9c0f597ada 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -62,20 +62,48 @@ 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_ID( 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 ) + { + std::string key = StrPrintf( "Inner%d", i ); + + m_layerMasks[ key ] = LSET( LAYER_ID( In15_Cu - i ) ); + } + +#if defined(DEBUG) && 0 + printf( "m_layerMasks:\n" ); + for( LSET_MAP::const_iterator it = m_layerMasks.begin(); it != m_layerMasks.end(); ++it ) + { + printf( " [%s] == 0x%s\n", it->first.c_str(), it->second.FmtHex().c_str() ); + } + + printf( "m_layerIndices:\n" ); + for( LAYER_ID_MAP::const_iterator it = m_layerIndices.begin(); it != m_layerIndices.end(); ++it ) + { + printf( " [%s] == %d\n", it->first.c_str(), it->second ); + } +#endif + } @@ -623,39 +651,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 +695,144 @@ 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(); + if( layer.m_type == LT_UNDEFINED ) // it's a non-copper layer + break; - NeedSYMBOL(); - type = CurText(); + cu.push_back( layer ); // it's copper + } - token = NextTok(); + // All Cu layers are parsed, but not the non-cu layers here. - if( token == T_hide ) + // The original *.kicad_pcb file format and the inverted + // Cu stack format both have all the Cu layers first, so use this + // trick 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 ) { - isVisible = false; - NeedRIGHT(); - } - else if( token == T_RIGHT ) - { - isVisible = true; - } - else - { - Expecting( "hide or )" ); + cu[i].m_number = i; } - enabledLayers |= GetLayerMask( layerIndex ); + for( std::vector::const_iterator it = cu.begin(); itm_number ); - if( isVisible ) - visibleLayers |= GetLayerMask( layerIndex ); + if( it->m_visible ) + visibleLayers.set( it->m_number ); - m_layerIndices[ name ] = layerIndex; - m_layerMasks[ name ] = GetLayerMask(layerIndex); + m_board->SetLayer( LAYER_ID( it->m_number ), *it ); - wxString wname = FROM_UTF8( name.c_str() ); - enum LAYER_T layerType = LAYER::ParseType( type.c_str() ); - LAYER layer( wname, layerType, isVisible ); + UTF8 name = it->m_name; - layer.SetFixedListIndex( layerIndex ); - m_board->SetLayer( layerIndex, layer ); + m_layerIndices[ name ] = LAYER_ID( it->m_number ); + m_layerMasks[ name ] = LSET( LAYER_ID( it->m_number ) ); + } -// wxLogDebug( wxT( "Mapping layer %s to index %d" ), GetChars( wname ), layerIndex ); + copperLayerCount = cu.size(); + } - if( layerType != LT_UNDEFINED ) - copperLayerCount++; + if( token != T_RIGHT ) + { + // read any non-copper layers + for( token = NextTok(); token != T_RIGHT; token = NextTok() ) + { + LAYER layer; + + parseLayer( &layer ); + + LAYER_ID_MAP::const_iterator it = m_layerIndices.find( UTF8( 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 ); + } } // 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 +841,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 +877,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 +892,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; } @@ -1701,55 +1802,55 @@ MODULE* PCB_PARSER::parseMODULE( wxArrayString* aInitialComments ) throw( IO_ERR break; case T_fp_text: - { - TEXTE_MODULE* text = parseTEXTE_MODULE(); - text->SetParent( module.get() ); - double orientation = text->GetOrientation(); - orientation -= module->GetOrientation(); - text->SetOrientation( orientation ); - text->SetDrawCoord(); - - switch( text->GetType() ) { - case TEXTE_MODULE::TEXT_is_REFERENCE: - module->Reference() = *text; - delete text; - break; + TEXTE_MODULE* text = parseTEXTE_MODULE(); + text->SetParent( module.get() ); + double orientation = text->GetOrientation(); + orientation -= module->GetOrientation(); + text->SetOrientation( orientation ); + text->SetDrawCoord(); - case TEXTE_MODULE::TEXT_is_VALUE: - module->Value() = *text; - delete text; - break; + switch( text->GetType() ) + { + case TEXTE_MODULE::TEXT_is_REFERENCE: + module->Reference() = *text; + delete text; + break; - default: - module->GraphicalItems().PushBack( text ); + case TEXTE_MODULE::TEXT_is_VALUE: + module->Value() = *text; + delete text; + break; + + default: + module->GraphicalItems().PushBack( text ); + } } - break; - } case T_fp_arc: case T_fp_circle: case T_fp_curve: case T_fp_line: case T_fp_poly: - { - EDGE_MODULE* em = parseEDGE_MODULE(); - em->SetParent( module.get() ); - em->SetDrawCoord(); - module->GraphicalItems().PushBack( em ); + { + EDGE_MODULE* em = parseEDGE_MODULE(); + em->SetParent( module.get() ); + em->SetDrawCoord(); + module->GraphicalItems().PushBack( em ); + } break; - } case T_pad: - { - D_PAD* pad = parseD_PAD( module.get() ); - wxPoint pt = pad->GetPos0(); - RotatePoint( &pt, module->GetOrientation() ); - pad->SetPosition( pt + module->GetPosition() ); - module->AddPad( pad ); + { + D_PAD* pad = parseD_PAD( module.get() ); + wxPoint pt = pad->GetPos0(); + + RotatePoint( &pt, module->GetOrientation() ); + pad->SetPosition( pt + module->GetPosition() ); + module->AddPad( pad ); + } break; - } case T_model: module->Add3DModel( parse3DModel() ); @@ -2028,8 +2129,9 @@ D_PAD* PCB_PARSER::parseD_PAD( MODULE* aParent ) throw( IO_ERROR, PARSE_ERROR ) wxCHECK_MSG( CurTok() == T_pad, NULL, wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as D_PAD." ) ); - wxSize sz; + wxSize sz; wxPoint pt; + std::auto_ptr< D_PAD > pad( new D_PAD( aParent ) ); NeedSYMBOLorNUMBER(); @@ -2126,77 +2228,77 @@ D_PAD* PCB_PARSER::parseD_PAD( MODULE* aParent ) throw( IO_ERROR, PARSE_ERROR ) break; case T_rect_delta: - { - wxSize delta; - delta.SetWidth( parseBoardUnits( "rectangle delta width" ) ); - delta.SetHeight( parseBoardUnits( "rectangle delta height" ) ); - pad->SetDelta( delta ); - NeedRIGHT(); + { + wxSize delta; + delta.SetWidth( parseBoardUnits( "rectangle delta width" ) ); + delta.SetHeight( parseBoardUnits( "rectangle delta height" ) ); + pad->SetDelta( delta ); + NeedRIGHT(); + } break; - } case T_drill: - { - bool haveWidth = false; - wxSize drillSize = pad->GetDrillSize(); - - for( token = NextTok(); token != T_RIGHT; token = NextTok() ) { - if( token == T_LEFT ) - token = NextTok(); + bool haveWidth = false; + wxSize drillSize = pad->GetDrillSize(); - switch( token ) + for( token = NextTok(); token != T_RIGHT; token = NextTok() ) { - case T_oval: - pad->SetDrillShape( PAD_DRILL_OBLONG ); - break; + if( token == T_LEFT ) + token = NextTok(); - case T_NUMBER: - { - if( !haveWidth ) + switch( token ) { - drillSize.SetWidth( parseBoardUnits() ); + case T_oval: + pad->SetDrillShape( PAD_DRILL_OBLONG ); + break; - // If height is not defined the width and height are the same. - drillSize.SetHeight( drillSize.GetWidth() ); - haveWidth = true; - } - else - { - drillSize.SetHeight( parseBoardUnits() ); - } + case T_NUMBER: + { + if( !haveWidth ) + { + drillSize.SetWidth( parseBoardUnits() ); - break; + // If height is not defined the width and height are the same. + drillSize.SetHeight( drillSize.GetWidth() ); + haveWidth = true; + } + else + { + drillSize.SetHeight( parseBoardUnits() ); + } + + } + break; + + case T_offset: + pt.x = parseBoardUnits( "drill offset x" ); + pt.y = parseBoardUnits( "drill offset y" ); + pad->SetOffset( pt ); + NeedRIGHT(); + break; + + default: + Expecting( "oval, size, or offset" ); + } } - case T_offset: - pt.x = parseBoardUnits( "drill offset x" ); - pt.y = parseBoardUnits( "drill offset y" ); - pad->SetOffset( pt ); - NeedRIGHT(); - break; + // This fixes a bug caused by setting the default D_PAD drill size to a value + // other than 0 used to fix a bunch of debug assertions even though it is defined + // as a through hole pad. Wouldn't a though hole pad with no drill be a surface + // mount pad (or a conn pad which is a smd pad with no solder paste)? + if( ( pad->GetAttribute() != PAD_SMD ) && ( pad->GetAttribute() != PAD_CONN ) ) + pad->SetDrillSize( drillSize ); + else + pad->SetDrillSize( wxSize( 0, 0 ) ); - default: - Expecting( "oval, size, or offset" ); - } } - - // This fixes a bug caused by setting the default D_PAD drill size to a value - // other than 0 used to fix a bunch of debug assertions even though it is defined - // as a through hole pad. Wouldn't a though hole pad with no drill be a surface - // mount pad (or a conn pad which is a smd pad with no solder paste)? - if( ( pad->GetAttribute() != PAD_SMD ) && ( pad->GetAttribute() != PAD_CONN ) ) - pad->SetDrillSize( drillSize ); - else - pad->SetDrillSize( wxSize( 0, 0 ) ); - break; - } case T_layers: { - LAYER_MSK layerMask = parseBoardItemLayersAsMask(); - pad->SetLayerMask( layerMask ); + LSET layerMask = parseBoardItemLayersAsMask(); + pad->SetLayerSet( layerMask ); } break; @@ -2366,11 +2468,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 +2509,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; @@ -2631,68 +2734,65 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR ) break; case T_polygon: - { - std::vector< wxPoint > corners; - - NeedLEFT(); - token = NextTok(); - - if( token != T_pts ) - Expecting( T_pts ); - - for( token = NextTok(); token != T_RIGHT; token = NextTok() ) { - corners.push_back( parseXY() ); - } - - NeedRIGHT(); - zone->AddPolygon( corners ); - } - - break; - - case T_filled_polygon: - { - // "(filled_polygon (pts" - NeedLEFT(); - token = NextTok(); - - if( token != T_pts ) - Expecting( T_pts ); - - for( token = NextTok(); token != T_RIGHT; token = NextTok() ) - { - pts.Append( CPolyPt( parseXY() ) ); - } - - NeedRIGHT(); - pts.CloseLastContour(); - } - - break; - - case T_fill_segments: - { - std::vector< SEGMENT > segs; - - for( token = NextTok(); token != T_RIGHT; token = NextTok() ) - { - if( token != T_LEFT ) - Expecting( T_LEFT ); + std::vector< wxPoint > corners; + NeedLEFT(); token = NextTok(); if( token != T_pts ) Expecting( T_pts ); - SEGMENT segment( parseXY(), parseXY() ); + for( token = NextTok(); token != T_RIGHT; token = NextTok() ) + { + corners.push_back( parseXY() ); + } + NeedRIGHT(); - segs.push_back( segment ); + zone->AddPolygon( corners ); } + break; - zone->AddFillSegments( segs ); - } + case T_filled_polygon: + { + // "(filled_polygon (pts" + NeedLEFT(); + token = NextTok(); + if( token != T_pts ) + Expecting( T_pts ); + + for( token = NextTok(); token != T_RIGHT; token = NextTok() ) + { + pts.Append( CPolyPt( parseXY() ) ); + } + + NeedRIGHT(); + pts.CloseLastContour(); + } + break; + + case T_fill_segments: + { + std::vector< SEGMENT > segs; + + for( token = NextTok(); token != T_RIGHT; token = NextTok() ) + { + if( token != T_LEFT ) + Expecting( T_LEFT ); + + token = NextTok(); + + if( token != T_pts ) + Expecting( T_pts ); + + SEGMENT segment( parseXY(), parseXY() ); + NeedRIGHT(); + segs.push_back( segment ); + } + + zone->AddFillSegments( segs ); + } break; default: 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 20a51562a0..9508956010 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_useGerberAttributes = false; m_excludeEdgeLayer = true; @@ -126,12 +125,17 @@ 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_usegerberextensions ), m_useGerberExtensions ? trueStr : falseStr ); - if( m_useGerberAttributes ) // save this option only if active, + if( m_useGerberAttributes ) // save this option only if active, // to avoid incompatibility with older Pcbnew version aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_usegerberattributes ), trueStr ); @@ -314,7 +318,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) @@ -329,45 +334,79 @@ 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_usegerberattributes: aPcbPlotParams->m_useGerberAttributes = 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 ); @@ -387,45 +426,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 d6788b5d59..c3f6170a8c 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 */ @@ -269,9 +269,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 c5487afa12..9d709e8ad8 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 @@ -806,7 +806,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.. @@ -814,17 +814,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(); @@ -847,16 +847,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 ) ); @@ -867,7 +867,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(); @@ -884,22 +884,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 ) ); @@ -910,7 +910,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; @@ -944,13 +944,13 @@ 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 ) @@ -1052,9 +1052,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 e0ae55575f..86db046e2c 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 94f8d72d95..d8eda36868 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: @@ -293,153 +307,100 @@ 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 - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "ShowPageLimits" ), - &m_showPageLimits, true ) ); - // 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: + wxASSERT( DIM( cds.m_LayersColors ) == LAYER_ID_COUNT ); + 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" ); + } } } @@ -115,87 +90,83 @@ wxString GetGerberFileFunction( const BOARD *aBoard, LAYER_NUM aLayer ) switch( aLayer ) { - case LAYER_N_BACK: - attrib = wxString::Format( wxT( "Copper,L%d" ), aBoard->GetCopperLayerCount() ); - break; - - 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: - // LAYER_N_2 is the first inner layer counting from the bottom; this - // must be converted to a 1-based number starting from the top - attrib = wxString::Format( wxT( "Copper,L%d" ), - aBoard->GetCopperLayerCount() - ( aLayer - LAYER_N_2 + 1 ) ); - break; - - case LAYER_N_FRONT: - attrib = wxString( wxT( "Copper,L1" ) ); - break; - - case ADHESIVE_N_FRONT: + case F_Adhes: attrib = wxString( wxT( "Glue,Top" ) ); break; - case ADHESIVE_N_BACK: + case B_Adhes: attrib = wxString( wxT( "Glue,Bot" ) ); break; - case SILKSCREEN_N_FRONT: + case F_SilkS: attrib = wxString( wxT( "Legend,Top" ) ); break; - case SILKSCREEN_N_BACK: + case B_SilkS: attrib = wxString( wxT( "Legend,Bot" ) ); break; - case SOLDERMASK_N_FRONT: + case F_Mask: attrib = wxString( wxT( "Soldermask,Top" ) ); break; - case SOLDERMASK_N_BACK: + case B_Mask: attrib = wxString( wxT( "Soldermask,Bot" ) ); break; - case SOLDERPASTE_N_FRONT: + case F_Paste: attrib = wxString( wxT( "Paste,Top" ) ); break; - case SOLDERPASTE_N_BACK: + case B_Paste: attrib = wxString( wxT( "Paste,Bot" ) ); break; - case EDGE_N: + case Edge_Cuts: attrib = wxString( wxT( "Profile" ) ); break; - case DRAW_N: + case Dwgs_User: attrib = wxString( wxT( "Drawing" ) ); break; - case COMMENT_N: + case Cmts_User: attrib = wxString( wxT( "Other,Comment" ) ); break; - case ECO1_N: - case ECO2_N: - attrib = wxString::Format( wxT( "Other,ECO%d" ), aLayer - ECO1_N + 1 ); + case Eco1_User: + case Eco2_User: + attrib = wxString::Format( wxT( "Other,ECO%d" ), aLayer - Eco1_User + 1 ); + break; + + case F_Cu: + attrib = wxString( wxT( "Copper,L1" ) ); + break; + + case B_Cu: + attrib = wxString::Format( wxT( "Copper,L%d" ), aBoard->GetCopperLayerCount() ); + break; + + default: + if( IsCopperLayer( aLayer ) ) + { +#if 0 // was: + // LAYER_N_2 is the first inner layer counting from the bottom; this + // must be converted to a 1-based number starting from the top + attrib = wxString::Format( wxT( "Copper,L%d" ), + aBoard->GetCopperLayerCount() - ( aLayer - LAYER_N_2 + 1 ) ); +#else + attrib = wxString::Format( wxT( "Copper,L%d" ), aLayer ); +#endif + } break; } // Add the signal type of the layer, if relevant - if( FIRST_COPPER_LAYER <= aLayer && aLayer <= LAST_COPPER_LAYER ) { - LAYER_T type = aBoard->GetLayerType( aLayer ); + if( IsCopperLayer( aLayer ) ) + { + LAYER_T type = aBoard->GetLayerType( ToLAYER_ID( aLayer ) ); + switch( type ) { case LT_SIGNAL: @@ -215,6 +186,7 @@ wxString GetGerberFileFunction( const BOARD *aBoard, LAYER_NUM aLayer ) return attrib; } + void BuildPlotFileName( wxFileName* aFilename, const wxString& aOutputDir, const wxString& aSuffix, diff --git a/pcbnew/pcbplot.h b/pcbnew/pcbplot.h index cd6c9788d2..27fa8d897a 100644 --- a/pcbnew/pcbplot.h +++ b/pcbnew/pcbplot.h @@ -69,20 +69,18 @@ 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; - m_layerMask = 0; } /** @@ -99,7 +97,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 ); @@ -202,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 ); /** @@ -214,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 @@ -225,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 ); @@ -264,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 ); /** * Function GetGerberFileFunction diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index 85d44422e3..42c93949f1 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( ToLAYER_ID( 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..e1d965dbc4 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( ToLAYER_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 7162c93618..b6a0ff904a 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; @@ -155,38 +145,41 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, } save_opt = DisplayOpt; - LAYER_NUM activeLayer = GetScreen()->m_Active_Layer; + + LAYER_ID activeLayer = GetScreen()->m_Active_Layer; DisplayOpt.ContrastModeDisplay = false; 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 +187,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 +228,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 +239,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 +265,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 +278,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 +298,17 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, * vias */ if( drillShapeOpt != PRINT_PARAMETERS::NO_DRILL_SHAPE ) { - TRACK * track = Pcb->m_Track; - EDA_COLOR_T color = GetDrawBgColor(); + 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. @@ -342,19 +341,20 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, m_DisplayPadNum = DisplayOpt.DisplayPadNum; m_DisplayModEdge = DisplayOpt.DisplayModEdge; m_DisplayModText = DisplayOpt.DisplayModText; - GetBoard()->SetElementVisibility(NO_CONNECTS_VISIBLE, nctmp); - GetBoard()->SetElementVisibility(ANCHOR_VISIBLE, anchorsTmp); + + GetBoard()->SetElementVisibility( NO_CONNECTS_VISIBLE, nctmp ); + GetBoard()->SetElementVisibility( ANCHOR_VISIBLE, anchorsTmp ); } 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 +385,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 +406,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 +418,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 a21dd3bfb0..595c39f2a7 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; @@ -90,45 +90,35 @@ 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; -#endif + m_PrintParams.m_PrintMaskLayer.set( Edge_Cuts ); DrawPage(); - m_PrintParams.m_PrintMaskLayer = mask_layer; + m_PrintParams.m_PrintMaskLayer = lset; +#else // GERBVIEW + // in gerbview, draw layers are printed on separate pages + m_PrintParams.m_Flags = aPage-1; // = gerber draw layer id + DrawPage(); +#endif 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/ratsnest.cpp b/pcbnew/ratsnest.cpp index a9703a5450..2deb23d175 100644 --- a/pcbnew/ratsnest.cpp +++ b/pcbnew/ratsnest.cpp @@ -20,8 +20,8 @@ #include /** - * @brief class MIN_SPAN_TREE_PADS (derived from MIN_SPAN_TREE) specialize - * the basic class to calculate a minimum spanning tree from a list of pads, + * @brief class MIN_SPAN_TREE_PADS (derived from MIN_SPAN_TREE) specializes + * the base class to calculate a minimum spanning tree from a list of pads, * and to add this tree as ratsnest to the main ratsnest list. */ class MIN_SPAN_TREE_PADS: public MIN_SPAN_TREE @@ -52,9 +52,9 @@ public: * Function AddTreeToRatsnest * Adds the current minimum spanning tree as ratsnest items * to the main ratsnest list - * @param aRatsnestList = the main ratsnest list + * @param aRatsnestList = a ratsnest list to add to */ - void AddTreeToRatsnest( std::vector &aRatsnestList ); + void AddTreeToRatsnest( std::vector* aRatsnestList ); /** * Function GetWeight @@ -68,13 +68,15 @@ public: }; -void MIN_SPAN_TREE_PADS::AddTreeToRatsnest( std::vector &aRatsnestList ) +void MIN_SPAN_TREE_PADS::AddTreeToRatsnest( std::vector* aRatsnestList ) { std::vector& padsBuffer = *m_PadsList; + if( padsBuffer.empty() ) return; int netcode = padsBuffer[0]->GetNetCode(); + // Note: to get edges in minimum spanning tree, // the index value 0 is not used: it is just // the entry point of the minimum spanning tree. @@ -83,12 +85,14 @@ void MIN_SPAN_TREE_PADS::AddTreeToRatsnest( std::vector &aRatsnes { // Create the new ratsnest RATSNEST_ITEM net; + net.SetNet( netcode ); net.m_Status = CH_ACTIF | CH_VISIBLE; net.m_Lenght = GetDist(ii); net.m_PadStart = padsBuffer[ii]; net.m_PadEnd = padsBuffer[ GetWhoTo(ii) ]; - aRatsnestList.push_back( net ); + + aRatsnestList->push_back( net ); } } @@ -110,13 +114,13 @@ int MIN_SPAN_TREE_PADS::GetWeight( int aItem1, int aItem2 ) if( pad1 == pad2 ) return 0; + int weight = abs( pad2->GetPosition().x - pad1->GetPosition().x ) + abs( pad2->GetPosition().y - pad1->GetPosition().y ); return weight + 1; } - /* Note about the ratsnest computation: * Building the general ratsnest: * For each net, the ratsnest is the set of lines connecting pads, @@ -230,6 +234,7 @@ void PCB_BASE_FRAME::Build_Board_Ratsnest() // (net_code = 0 -> no connect) noconn = 0; MIN_SPAN_TREE_PADS min_spanning_tree; + for( ; current_net_code < m_Pcb->GetNetCount(); current_net_code++ ) { NETINFO_ITEM* net = m_Pcb->FindNet( current_net_code ); @@ -245,7 +250,7 @@ void PCB_BASE_FRAME::Build_Board_Ratsnest() min_spanning_tree.MSP_Init( &net->m_PadInNetList ); min_spanning_tree.BuildTree(); - min_spanning_tree.AddTreeToRatsnest( m_Pcb->m_FullRatsnest ); + min_spanning_tree.AddTreeToRatsnest( &m_Pcb->m_FullRatsnest ); net->m_RatsnestEndIdx = m_Pcb->GetRatsnestsCount(); } @@ -255,7 +260,7 @@ void PCB_BASE_FRAME::Build_Board_Ratsnest() // Update the ratsnest display option (visible/invisible) flag for( unsigned ii = 0; ii < m_Pcb->GetRatsnestsCount(); ii++ ) { - if( !GetBoard()->IsElementVisible(RATSNEST_VISIBLE) ) // Clear VISIBLE flag + if( !GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) ) // Clear VISIBLE flag m_Pcb->m_FullRatsnest[ii].m_Status &= ~CH_VISIBLE; } } @@ -532,14 +537,13 @@ void PCB_BASE_FRAME::build_ratsnest_module( MODULE* aModule ) */ if( (m_Pcb->m_Status_Pcb & RATSNEST_ITEM_LOCAL_OK) == 0 ) { - /* Compute the "internal" ratsnest, i.e the links between the current - * footprint pads - */ + // Compute the "internal" ratsnest, i.e the links between the current + // footprint pads localPadList.clear(); m_Pcb->m_LocalRatsnest.clear(); // collect active pads of the module: - for( pad_ref = aModule->Pads(); pad_ref != NULL; pad_ref = pad_ref->Next() ) + for( pad_ref = aModule->Pads(); pad_ref; pad_ref = pad_ref->Next() ) { if( pad_ref->GetNetCode() == NETINFO_LIST::UNCONNECTED ) continue; @@ -600,8 +604,9 @@ void PCB_BASE_FRAME::build_ratsnest_module( MODULE* aModule ) */ current_net_code = localPadList[0]->GetNetCode(); - MIN_SPAN_TREE_PADS min_spanning_tree; + MIN_SPAN_TREE_PADS min_spanning_tree; std::vector padsBuffer; // contains pads of only one net + for( unsigned ii = 0; ii < pads_module_count; ii++ ) { // Search the end of pad list relative to the current net @@ -616,16 +621,20 @@ void PCB_BASE_FRAME::build_ratsnest_module( MODULE* aModule ) break; } - for(unsigned kk = ii; kk < jj; kk++ ) + for( unsigned kk = ii; kk < jj; kk++ ) padsBuffer.push_back( localPadList[kk] ); + min_spanning_tree.MSP_Init( &padsBuffer ); min_spanning_tree.BuildTree(); - min_spanning_tree.AddTreeToRatsnest( m_Pcb->m_LocalRatsnest ); + min_spanning_tree.AddTreeToRatsnest( &m_Pcb->m_LocalRatsnest ); padsBuffer.clear(); + ii = jj; + if( ii < localPadList.size() ) current_net_code = localPadList[ii]->GetNetCode(); } + internalRatsCount = m_Pcb->m_LocalRatsnest.size(); // set the flag LOCAL_RATSNEST_ITEM of the ratsnest status: @@ -647,6 +656,7 @@ void PCB_BASE_FRAME::build_ratsnest_module( MODULE* aModule ) * so, for each net, only one rats nest item is created */ RATSNEST_ITEM local_rats; + local_rats.m_Lenght = INT_MAX; local_rats.m_Status = 0; bool addRats = false; @@ -780,6 +790,7 @@ static bool sort_by_distance( const wxPoint& ref, const wxPoint& compare ) return lengthref < lengthcmp; } + static bool sort_by_point( const wxPoint& ref, const wxPoint& compare ) { if( ref.x == compare.x ) diff --git a/pcbnew/router/pns_index.h b/pcbnew/router/pns_index.h index edb58b33e4..9e1ef37db0 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(); } @@ -137,7 +137,7 @@ public: ITEM_SET::iterator end() { return m_allItems.end(); } private: - static const int MaxSubIndices = 64; + static const int MaxSubIndices = 128; static const int SI_Multilayer = 2; static const int SI_SegDiagonal = 0; static const int SI_SegStraight = 1; @@ -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..70e3c5d36a 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( ToLAYER_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..e1c7f90ab8 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( ToLAYER_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( ToLAYER_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( ToLAYER_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( ToLAYER_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..576806f483 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( ToLAYER_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( ToLAYER_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 = ToLAYER_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..b2ecc0ab7f 100644 --- a/pcbnew/specctra.cpp +++ b/pcbnew/specctra.cpp @@ -75,25 +75,50 @@ 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( ToLAYER_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] = ToLAYER_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( ToLAYER_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 09e63ab089..beda815643 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; @@ -2137,7 +2139,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..8073245dc9 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( ToLAYER_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( ToLAYER_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 ? ToLAYER_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/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index ab77b42d1f..8c11346ada 100644 --- a/pcbnew/tool_pcb.cpp +++ b/pcbnew/tool_pcb.cpp @@ -286,6 +286,7 @@ void PCB_EDIT_FRAME::ReCreateHToolbar() m_SelLayerBox = new PCB_LAYER_BOX_SELECTOR( m_mainToolBar, ID_TOOLBARH_PCB_SELECT_LAYER ); m_SelLayerBox->SetBoardFrame( this ); } + ReCreateLayerBox( false ); m_mainToolBar->AddControl( m_SelLayerBox ); 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..80cf1511d5 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, ToLAYER_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, ToLAYER_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/pcbnew/zones_polygons_test_connections.cpp b/pcbnew/zones_polygons_test_connections.cpp index b1d69d0455..50127d0dfb 100644 --- a/pcbnew/zones_polygons_test_connections.cpp +++ b/pcbnew/zones_polygons_test_connections.cpp @@ -71,15 +71,15 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode ) // clear .m_ZoneSubnet parameter for pads for( MODULE* module = m_Modules; module; module = module->Next() ) { - for( D_PAD* pad = module->Pads(); pad != NULL; pad = pad->Next() ) - if( (aNetcode < 0) || ( aNetcode == pad->GetNetCode() ) ) + for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() ) + if( aNetcode < 0 || aNetcode == pad->GetNetCode() ) pad->SetZoneSubNet( 0 ); } // clear .m_ZoneSubnet parameter for tracks and vias for( TRACK* track = m_Track; track; track = track->Next() ) { - if( (aNetcode < 0) || ( aNetcode == track->GetNetCode() ) ) + if( aNetcode < 0 || aNetcode == track->GetNetCode() ) track->SetZoneSubNet( 0 ); } @@ -88,40 +88,50 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode ) // Build zones candidates list std::vector zones_candidates; + + zones_candidates.reserve( GetAreaCount() ); + for( int index = 0; index < GetAreaCount(); index++ ) { - ZONE_CONTAINER* curr_zone = GetArea( index ); - if( !curr_zone->IsOnCopperLayer() ) + ZONE_CONTAINER* zone = GetArea( index ); + + if( !zone->IsOnCopperLayer() ) continue; - if( (aNetcode >= 0) && ( aNetcode != curr_zone->GetNetCode() ) ) + + if( aNetcode >= 0 && aNetcode != zone->GetNetCode() ) continue; - if( curr_zone->GetFilledPolysList().GetCornersCount() == 0 ) + + if( zone->GetFilledPolysList().GetCornersCount() == 0 ) continue; - zones_candidates.push_back(curr_zone); + + zones_candidates.push_back( zone ); } + // sort them by netcode then vertices count. // For a given net, examine the smaller zones first slightly speed up calculation // (25% faster) // this is only noticeable with very large boards and depends on board zones topology // This is due to the fact some items are connected by small zones ares, // before examining large zones areas and these items are not tested after a connection is found - sort(zones_candidates.begin(), zones_candidates.end(), sort_areas ); + sort( zones_candidates.begin(), zones_candidates.end(), sort_areas ); int oldnetcode = -1; for( unsigned idx = 0; idx < zones_candidates.size(); idx++ ) { - ZONE_CONTAINER* curr_zone = zones_candidates[idx]; + ZONE_CONTAINER* zone = zones_candidates[idx]; - int netcode = curr_zone->GetNetCode(); + int netcode = zone->GetNetCode(); // Build a list of candidates connected to the net: // At this point, layers are not considered, because areas on different layers can // be connected by a via or a pad. // (because zones are sorted by netcode, there is made only once per net) NETINFO_ITEM* net = FindNet( netcode ); + wxASSERT( net ); if( net == NULL ) continue; + if( oldnetcode != netcode ) { oldnetcode = netcode; @@ -129,38 +139,43 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode ) // Build the list of pads candidates connected to the net: candidates.reserve( net->m_PadInNetList.size() ); + for( unsigned ii = 0; ii < net->m_PadInNetList.size(); ii++ ) candidates.push_back( net->m_PadInNetList[ii] ); // Build the list of track candidates connected to the net: TRACK* track = m_Track.GetFirst()->GetStartNetCode( netcode ); + for( ; track; track = track->Next() ) { if( track->GetNetCode() != netcode ) break; + candidates.push_back( track ); } } // test if a candidate is inside a filled area of this zone unsigned indexstart = 0, indexend; - const CPOLYGONS_LIST& polysList = curr_zone->GetFilledPolysList(); + const CPOLYGONS_LIST& polysList = zone->GetFilledPolysList(); + for( indexend = 0; indexend < polysList.GetCornersCount(); indexend++ ) { // end of a filled sub-area found if( polysList.IsEndContour( indexend ) ) { subnet++; - EDA_RECT bbox = curr_zone->CalculateSubAreaBoundaryBox( indexstart, indexend ); + EDA_RECT bbox = zone->CalculateSubAreaBoundaryBox( indexstart, indexend ); for( unsigned ic = 0; ic < candidates.size(); ic++ ) - { // test if this area is connected to a board item: + { + // test if this area is connected to a board item: BOARD_CONNECTED_ITEM* item = candidates[ic]; if( item->GetZoneSubNet() == subnet ) // Already merged continue; - if( !item->IsOnLayer( curr_zone->GetLayer() ) ) + if( !item->IsOnLayer( zone->GetLayer() ) ) continue; wxPoint pos1, pos2; @@ -236,7 +251,7 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode ) // End test candidates for the current filled area indexstart = indexend + 1; // prepare test next area, starting at indexend+1 // (if exists). End read one area in - // curr_zone->m_FilledPolysList + // zone->m_FilledPolysList } } // End read all segments in zone } // End read all zones candidates @@ -253,15 +268,15 @@ void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb ) { for( int index = 0; index < aPcb->GetAreaCount(); index++ ) { - ZONE_CONTAINER* curr_zone = aPcb->GetArea( index ); + ZONE_CONTAINER* zone = aPcb->GetArea( index ); - if ( ! curr_zone->IsOnCopperLayer() ) + if ( ! zone->IsOnCopperLayer() ) continue; - if ( curr_zone->GetNetCode() <= 0 ) + if ( zone->GetNetCode() <= 0 ) continue; - Merge_SubNets_Connected_By_CopperAreas( aPcb, curr_zone->GetNetCode() ); + Merge_SubNets_Connected_By_CopperAreas( aPcb, zone->GetNetCode() ); } } @@ -285,9 +300,9 @@ void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode ) for( int index = 0; index < aPcb->GetAreaCount(); index++ ) { - ZONE_CONTAINER* curr_zone = aPcb->GetArea( index ); + ZONE_CONTAINER* zone = aPcb->GetArea( index ); - if( aNetcode == curr_zone->GetNetCode() ) + if( aNetcode == zone->GetNetCode() ) { found = true; break; 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; }