diff --git a/3d-viewer/3d_draw.cpp b/3d-viewer/3d_draw.cpp index 93f88ebd16..f8ba411577 100644 --- a/3d-viewer/3d_draw.cpp +++ b/3d-viewer/3d_draw.cpp @@ -285,7 +285,7 @@ void EDA_3D_CANVAS::BuildBoard3DView() // but I assume that's backwards for( unsigned i=0; i LSET s = 0; + * + * since that will call this constructor and set bit zero, probably not what was + * intended. Use + * + * + * LSET s; + * + * + * for an empty set. */ - LSET( int aLayer ) + LSET( LAYER_ID aLayer ) // LAYER_ID deliberately exludes int and relatives { set( aLayer ); } @@ -225,7 +241,7 @@ public: /** * Constructor LSET( int, ...) * takes a variable number of LAYER_IDs in the argument list to construct - * the set. + * the set. Typically used only in static construction. * @param aIdCount is the number of LAYER_IDs which follow. */ LSET( size_t aIdCount, ... ); @@ -341,24 +357,13 @@ public: * 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(); + LAYER_ID ExtractLayer() const; private: }; -/** - * @return bool if 2 layer masks have a comman layer - * @param aMask1 = a layer mask - * @param aMask2 = an other layer mask - */ -inline bool IsLayerMasksIntersect( LSET aMask1, LSET aMask2 ) -{ - return (aMask1 & aMask2).any(); -} - - /** * Enum PCB_VISIBLE * is a set of visible PCB elements. @@ -618,4 +623,7 @@ inline bool IsNetnameLayer( LAYER_NUM aLayer ) aLayer < NETNAMES_GAL_LAYER( END_NETNAMES_VISIBLE_LIST ); } + +LAYER_ID ToLAYER_ID( int aLayer ); + #endif // LAYERS_ID_AND_VISIBILITY_H_ diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 86e404330e..8897255f9c 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -83,7 +83,7 @@ BOARD::BOARD() : for( LAYER_NUM layer = 0; layer < LAYER_ID_COUNT; ++layer ) { - m_Layer[layer].m_name = GetStandardLayerName( LAYER_ID( layer ) ); + m_Layer[layer].m_name = GetStandardLayerName( ToLAYER_ID( layer ) ); if( IsCopperLayer( layer ) ) m_Layer[layer].m_type = LT_SIGNAL; diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp index 0d22b34b85..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( ); @@ -189,9 +190,8 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, 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 5f14f0e1a7..2d1ba56e57 100644 --- a/pcbnew/class_edge_mod.cpp +++ b/pcbnew/class_edge_mod.cpp @@ -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; diff --git a/pcbnew/class_pcb_layer_box_selector.cpp b/pcbnew/class_pcb_layer_box_selector.cpp index 7b56b7d27e..7de31f47a8 100644 --- a/pcbnew/class_pcb_layer_box_selector.cpp +++ b/pcbnew/class_pcb_layer_box_selector.cpp @@ -40,26 +40,34 @@ #include +// translate aLayer to its hotkey +static int layer2hotkey_id( LAYER_ID aLayer ) +{ + switch( aLayer ) + { + case F_Cu: return HK_SWITCH_LAYER_TO_COMPONENT; -#define DECLARE_LAYERS_HOTKEY(list) int list[] = \ - { \ - HK_SWITCH_LAYER_TO_COPPER, \ - HK_SWITCH_LAYER_TO_INNER1, \ - HK_SWITCH_LAYER_TO_INNER2, \ - HK_SWITCH_LAYER_TO_INNER3, \ - HK_SWITCH_LAYER_TO_INNER4, \ - HK_SWITCH_LAYER_TO_INNER5, \ - HK_SWITCH_LAYER_TO_INNER6, \ - HK_SWITCH_LAYER_TO_INNER7, \ - HK_SWITCH_LAYER_TO_INNER8, \ - HK_SWITCH_LAYER_TO_INNER9, \ - HK_SWITCH_LAYER_TO_INNER10, \ - HK_SWITCH_LAYER_TO_INNER11, \ - HK_SWITCH_LAYER_TO_INNER12, \ - HK_SWITCH_LAYER_TO_INNER13, \ - HK_SWITCH_LAYER_TO_INNER14, \ - HK_SWITCH_LAYER_TO_COMPONENT \ - }; + 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. @@ -69,14 +77,12 @@ void PCB_LAYER_BOX_SELECTOR::Resync() { Clear(); - static const 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 + const int BM_SIZE = 14; LSET show = getEnabledLayers() & ~m_layerMaskDisable; @@ -90,16 +96,20 @@ void PCB_LAYER_BOX_SELECTOR::Resync() wxString layername = GetLayerName( layerid ); - if( m_layerhotkeys && m_hotkeys && layerid < DIM(layerhk) ) + if( m_layerhotkeys && m_hotkeys ) { - layername = AddHotkeyName( layername, m_hotkeys, - layerhk[layerid], IS_COMMENT ); + 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 ); } @@ -115,7 +125,7 @@ bool PCB_LAYER_BOX_SELECTOR::IsLayerEnabled( LAYER_NUM aLayer ) const BOARD* board = m_boardFrame->GetBoard(); wxASSERT( board != NULL ); - return board->IsLayerEnabled( (LAYER_ID) aLayer ); + return board->IsLayerEnabled( ToLAYER_ID( aLayer ) ); } @@ -136,7 +146,7 @@ EDA_COLOR_T PCB_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayer ) const BOARD* board = m_boardFrame->GetBoard(); wxASSERT( board ); - return board->GetLayerColor( (LAYER_ID) aLayer ); + return board->GetLayerColor( ToLAYER_ID( aLayer ) ); } @@ -147,6 +157,6 @@ wxString PCB_LAYER_BOX_SELECTOR::GetLayerName( LAYER_NUM aLayer ) const BOARD* board = m_boardFrame->GetBoard(); wxASSERT( board ); - return board->GetLayerName( (LAYER_ID) 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 7dbad7000f..07790861a8 100644 --- a/pcbnew/class_pcb_layer_box_selector.h +++ b/pcbnew/class_pcb_layer_box_selector.h @@ -32,7 +32,6 @@ public: LAYER_BOX_SELECTOR( parent, id, pos, size, n, choices ) { m_boardFrame = NULL; - m_layerMaskDisable = 0; } // Accessors diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp index 3e70199ae7..4004ca9715 100644 --- a/pcbnew/class_pcb_layer_widget.cpp +++ b/pcbnew/class_pcb_layer_widget.cpp @@ -168,7 +168,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) for( int row = rowCount-1; row>=0; --row ) { wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 ); - LAYER_ID layer = (LAYER_ID) getDecodedId( cb->GetId() ); + LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) ); if( IsCopperLayer( layer ) ) { @@ -181,7 +181,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) for( int row=0; rowGetId() ); + LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) ); if( IsCopperLayer( layer ) ) { @@ -266,7 +266,7 @@ void PCB_LAYER_WIDGET::SyncLayerVisibilities() wxWindow* w = getLayerComp( row, 0 ); - LAYER_ID layerId = (LAYER_ID) getDecodedId( w->GetId() ); + LAYER_ID layerId = ToLAYER_ID( getDecodedId( w->GetId() ) ); // this does not fire a UI event SetLayerVisible( layerId, board->IsLayerVisible( layerId ) ); @@ -351,7 +351,7 @@ void PCB_LAYER_WIDGET::ReFill() void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, EDA_COLOR_T aColor ) { - myframe->GetBoard()->SetLayerColor( (LAYER_ID) aLayer, aColor ); + myframe->GetBoard()->SetLayerColor( ToLAYER_ID( aLayer ), aColor ); myframe->ReCreateLayerBox( false ); if( myframe->IsGalCanvasActive() ) @@ -369,7 +369,7 @@ 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( (LAYER_ID) aLayer, false ); + myframe->SetActiveLayer( ToLAYER_ID( aLayer ), false ); if( m_alwaysShowActiveCopperLayer ) OnLayerSelected(); 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/dialogs/dialog_copper_zones.cpp b/pcbnew/dialogs/dialog_copper_zones.cpp index eadc3fa26b..a6685e3d6b 100644 --- a/pcbnew/dialogs/dialog_copper_zones.cpp +++ b/pcbnew/dialogs/dialog_copper_zones.cpp @@ -468,7 +468,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab return false; } - m_settings.m_CurrentZone_Layer = (LAYER_ID) 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_global_deletion.cpp b/pcbnew/dialogs/dialog_global_deletion.cpp index f3fed257e7..feafe844ca 100644 --- a/pcbnew/dialogs/dialog_global_deletion.cpp +++ b/pcbnew/dialogs/dialog_global_deletion.cpp @@ -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( LAYER_ID( aLayer ) ) ); + m_textCtrlCurrLayer->SetValue( m_Parent->GetBoard()->GetLayerName( ToLAYER_ID( aLayer ) ) ); } diff --git a/pcbnew/dialogs/dialog_graphic_item_properties.cpp b/pcbnew/dialogs/dialog_graphic_item_properties.cpp index d9cb7818c9..fff88b87af 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties.cpp @@ -232,7 +232,7 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event ) msg = m_DefaultThicknessCtrl->GetValue(); int thickness = ValueFromString( g_UserUnit, msg ); - m_Item->SetLayer( (LAYER_ID) m_LayerSelectionCtrl->GetLayerSelection() ); + m_Item->SetLayer( ToLAYER_ID( m_LayerSelectionCtrl->GetLayerSelection() ) ); if( m_Item->GetLayer() == Edge_Cuts ) m_brdSettings.m_EdgeSegmentWidth = thickness; diff --git a/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp b/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp index 25c4328580..02f9c551b1 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp @@ -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_ID( 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 ac2c8d08db..9c2141b7ff 100644 --- a/pcbnew/dialogs/dialog_keepout_area_properties.cpp +++ b/pcbnew/dialogs/dialog_keepout_area_properties.cpp @@ -222,7 +222,7 @@ bool DIALOG_KEEPOUT_AREA_PROPERTIES::AcceptOptionsForKeepOut() return false; } - m_zonesettings.m_CurrentZone_Layer = (LAYER_ID) 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_pcb_text_properties.cpp b/pcbnew/dialogs/dialog_pcb_text_properties.cpp index bb0d207555..eca91a1935 100644 --- a/pcbnew/dialogs/dialog_pcb_text_properties.cpp +++ b/pcbnew/dialogs/dialog_pcb_text_properties.cpp @@ -250,7 +250,7 @@ void DIALOG_PCB_TEXT_PROPERTIES::OnOkClick( wxCommandEvent& event ) } // Set the layer on which the PCB text is laying - m_SelectedPCBText->SetLayer( (LAYER_ID) 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/dimension.cpp b/pcbnew/dimension.cpp index 1058804938..043dc10776 100644 --- a/pcbnew/dimension.cpp +++ b/pcbnew/dimension.cpp @@ -208,7 +208,7 @@ void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event ) CurrentDimension->Text().SetMirrored( ( m_rbMirror->GetSelection() == 1 ) ? true : false ); - CurrentDimension->SetLayer( (LAYER_ID) m_SelLayerBox->GetLayerSelection() ); + CurrentDimension->SetLayer( ToLAYER_ID( m_SelLayerBox->GetLayerSelection() ) ); #ifndef USE_WX_OVERLAY if( m_DC ) // Display new text { diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index 1d307e9ede..b79e51b944 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -2708,7 +2708,7 @@ LAYER_ID EAGLE_PLUGIN::kicad_layer( int aEagleLayer ) const } } - return LAYER_ID( kiLayer ); + return ToLAYER_ID( kiLayer ); } diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 9606618a0f..eb6bb85843 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -523,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(); @@ -559,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(); @@ -1007,7 +1007,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_TOOLBARH_PCB_SELECT_LAYER: - SetActiveLayer( (LAYER_ID) m_SelLayerBox->GetLayerSelection() ); + SetActiveLayer( ToLAYER_ID( m_SelLayerBox->GetLayerSelection() ) ); if( DisplayOpt.ContrastModeDisplay ) m_canvas->Refresh( true ); diff --git a/pcbnew/editrack-part2.cpp b/pcbnew/editrack-part2.cpp index a9475c5c78..d690135f22 100644 --- a/pcbnew/editrack-part2.cpp +++ b/pcbnew/editrack-part2.cpp @@ -126,7 +126,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) case VIA_MICROVIA: // from external to the near neighbor inner layer { - LAYER_ID last_inner_layer = (LAYER_ID) ( GetBoard()->GetCopperLayerCount() - 2 ); + LAYER_ID last_inner_layer = ToLAYER_ID( ( GetBoard()->GetCopperLayerCount() - 2 ) ); if( first_layer == B_Cu ) last_layer = last_inner_layer; diff --git a/pcbnew/exporters/gen_drill_report_files.cpp b/pcbnew/exporters/gen_drill_report_files.cpp index 6c5ddb9dc9..7c474553c3 100644 --- a/pcbnew/exporters/gen_drill_report_files.cpp +++ b/pcbnew/exporters/gen_drill_report_files.cpp @@ -321,8 +321,8 @@ bool EXCELLON_WRITER::GenDrillReportFile( const wxString& aFullFileName ) 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( (LAYER_ID) layer1 ) ), - TO_UTF8( m_pcb->GetLayerName( (LAYER_ID) layer2 ) ) ); + TO_UTF8( m_pcb->GetLayerName( ToLAYER_ID( layer1 ) ) ), + TO_UTF8( m_pcb->GetLayerName( ToLAYER_ID( layer2 ) ) ) ); } fputs( line, m_file ); 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 cde7e7820e..15b42f134d 100644 --- a/pcbnew/hotkeys_board_editor.cpp +++ b/pcbnew/hotkeys_board_editor.cpp @@ -248,11 +248,11 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit if( ll == F_Cu ) ll = B_Cu; else if( ll == B_Cu ) - ll = (LAYER_ID) GetBoard()->GetCopperLayerCount() - 2; + ll = ToLAYER_ID( GetBoard()->GetCopperLayerCount() - 2 ); else ll = ll - 1; - SwitchLayer( aDC, (LAYER_ID) ll ); + SwitchLayer( aDC, ToLAYER_ID( ll ) ); break; case HK_SWITCH_LAYER_TO_NEXT: @@ -266,7 +266,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit else if( ++ll >= GetBoard()->GetCopperLayerCount() - 1 ) ll = B_Cu; - SwitchLayer( aDC, (LAYER_ID) ll ); + SwitchLayer( aDC, ToLAYER_ID( ll ) ); break; case HK_SWITCH_LAYER_TO_COMPONENT: diff --git a/pcbnew/import_dxf/dxf2brd_items.cpp b/pcbnew/import_dxf/dxf2brd_items.cpp index 0f484fca53..0fe7913fa6 100644 --- a/pcbnew/import_dxf/dxf2brd_items.cpp +++ b/pcbnew/import_dxf/dxf2brd_items.cpp @@ -124,7 +124,7 @@ void DXF2BRD_CONVERTER::addLine( const DRW_Line& data ) { DRAWSEGMENT* segm = new DRAWSEGMENT( m_brd ); - segm->SetLayer( (LAYER_ID) m_brdLayer ); + segm->SetLayer( ToLAYER_ID( m_brdLayer ) ); wxPoint start( mapX( data.basePoint.x ), mapY( data.basePoint.y ) ); @@ -146,7 +146,7 @@ void DXF2BRD_CONVERTER::addCircle( const DRW_Circle& data ) { DRAWSEGMENT* segm = new DRAWSEGMENT( m_brd ); - segm->SetLayer( (LAYER_ID) 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 ); @@ -166,7 +166,7 @@ void DXF2BRD_CONVERTER::addArc( const DRW_Arc& data ) { DRAWSEGMENT* segm = new DRAWSEGMENT( m_brd ); - segm->SetLayer( (LAYER_ID) m_brdLayer ); + segm->SetLayer( ToLAYER_ID( m_brdLayer ) ); segm->SetShape( S_ARC ); // Init arc centre: @@ -203,7 +203,7 @@ void DXF2BRD_CONVERTER::addArc( const DRW_Arc& data ) void DXF2BRD_CONVERTER::addText(const DRW_Text& data) { TEXTE_PCB* pcb_text = new TEXTE_PCB( m_brd ); - pcb_text->SetLayer( (LAYER_ID) 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) ); @@ -331,7 +331,7 @@ void DXF2BRD_CONVERTER::addMText( const DRW_MText& data ) } TEXTE_PCB* pcb_text = new TEXTE_PCB( m_brd ); - pcb_text->SetLayer( (LAYER_ID) m_brdLayer ); + pcb_text->SetLayer( ToLAYER_ID( m_brdLayer ) ); wxPoint textpos( mapX( data.basePoint.x ), mapY( data.basePoint.y ) ); pcb_text->SetTextPosition( textpos ); diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb.cpp index 4cfcbe48e4..75c2ffed0c 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb.cpp @@ -517,7 +517,7 @@ void PCB::MapLayer( XNODE* aNode ) #if 0 // was: KiCadLayer = FIRST_COPPER_LAYER + m_layersStackup.GetCount() - 1 - layernum; #else - KiCadLayer = LAYER_ID( layernum ); + KiCadLayer = ToLAYER_ID( layernum ); #endif } diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 7fd27d8807..9592ca3a43 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -967,7 +967,7 @@ void PCB_EDIT_FRAME::syncLayerVisibilities() for( LAYER_NUM i = 0; i < END_PCB_VISIBLE_LIST; ++i ) { - view->SetLayerVisible( ITEM_GAL_LAYER( i ), m_Pcb->IsElementVisible( LAYER_ID( i ) ) ); + view->SetLayerVisible( ITEM_GAL_LAYER( i ), m_Pcb->IsElementVisible( i ) ); } // Enable some layers that are GAL specific diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index f806648dd1..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( (LAYER_ID) aLayer ); + EDA_COLOR_T color = m_board->GetLayerColor( ToLAYER_ID( aLayer ) ); if (color == WHITE) color = LIGHTGRAY; return color; diff --git a/pcbnew/print_board_functions.cpp b/pcbnew/print_board_functions.cpp index 59ad38945d..b6a0ff904a 100644 --- a/pcbnew/print_board_functions.cpp +++ b/pcbnew/print_board_functions.cpp @@ -145,7 +145,8 @@ 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; @@ -333,15 +334,16 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, m_canvas->SetPrintMirrored( false ); DisplayOpt = save_opt; - GetScreen()->m_Active_Layer = LAYER_ID( activeLayer ); + GetScreen()->m_Active_Layer = activeLayer; m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill; m_DisplayPadFill = DisplayOpt.DisplayPadFill; m_DisplayViaFill = DisplayOpt.DisplayViaFill; 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 ); } diff --git a/pcbnew/router/pns_router.cpp b/pcbnew/router/pns_router.cpp index 32812e760b..70e3c5d36a 100644 --- a/pcbnew/router/pns_router.cpp +++ b/pcbnew/router/pns_router.cpp @@ -744,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( (LAYER_ID) 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 fb06dc35a2..e1c7f90ab8 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -538,7 +538,7 @@ void ROUTER_TOOL::performRouting() m_router->SwitchLayer( m_startLayer ); - frame->SetActiveLayer( (LAYER_ID) 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( (LAYER_ID) 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( (LAYER_ID) 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( (LAYER_ID) m_router->GetCurrentLayer() ); + frame->SetActiveLayer( ToLAYER_ID( m_router->GetCurrentLayer() ) ); m_router->Move( m_endSnapPoint, m_endItem ); } else if( evt->IsAction( &ACT_EndTrack ) ) diff --git a/pcbnew/sel_layer.cpp b/pcbnew/sel_layer.cpp index 8444695289..576806f483 100644 --- a/pcbnew/sel_layer.cpp +++ b/pcbnew/sel_layer.cpp @@ -62,13 +62,13 @@ protected: // Virtual function EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const { - return m_brd->GetLayerColor( LAYER_ID( aLayer ) ); + return m_brd->GetLayerColor( ToLAYER_ID( aLayer ) ); } // Returns the name of the layer id wxString GetLayerName( LAYER_NUM aLayer ) const // overrides LAYER_SELECTOR { - return m_brd->GetLayerName( LAYER_ID( aLayer ) ); + return m_brd->GetLayerName( ToLAYER_ID( aLayer ) ); } }; @@ -233,7 +233,7 @@ LAYER_ID PCB_BASE_FRAME::SelectLayer( LAYER_ID aDefaultLayer, dlg.ShowModal(); - LAYER_ID layer = (LAYER_ID) dlg.GetLayerSelection(); + LAYER_ID layer = ToLAYER_ID( dlg.GetLayerSelection() ); return layer; } diff --git a/pcbnew/specctra.cpp b/pcbnew/specctra.cpp index 4f521ee2a9..b2ecc0ab7f 100644 --- a/pcbnew/specctra.cpp +++ b/pcbnew/specctra.cpp @@ -93,7 +93,7 @@ void SPECCTRA_DB::buildLayerMaps( BOARD* aBoard ) kicadLayer2pcb[kilayer] = pcbNdx; // save the specctra layer name in SPECCTRA_DB::layerIds for later. - layerIds.push_back( TO_UTF8( aBoard->GetLayerName( LAYER_ID( kilayer ) ) ) ); + layerIds.push_back( TO_UTF8( aBoard->GetLayerName( ToLAYER_ID( kilayer ) ) ) ); } #else @@ -110,15 +110,14 @@ void SPECCTRA_DB::buildLayerMaps( BOARD* aBoard ) for( unsigned i = 0; i < pcbLayer2kicad.size(); ++i ) { if( i < layerCount-1 ) - pcbLayer2kicad[i] = LAYER_ID( i ); + 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( LAYER_ID( i ) ) ) ); + layerIds.push_back( TO_UTF8( aBoard->GetLayerName( ToLAYER_ID( i ) ) ) ); } - #endif } diff --git a/pcbnew/swap_layers.cpp b/pcbnew/swap_layers.cpp index 32f00e817d..8073245dc9 100644 --- a/pcbnew/swap_layers.cpp +++ b/pcbnew/swap_layers.cpp @@ -171,7 +171,7 @@ SWAP_LAYERS_DIALOG::SWAP_LAYERS_DIALOG( PCB_BASE_FRAME* parent, LAYER_ID* aArray /* Provide a text string to identify this layer (with trailing spaces * within that string being purged). */ - label = new wxStaticText( this, wxID_STATIC, board->GetLayerName( LAYER_ID( layer ) ), + label = new wxStaticText( this, wxID_STATIC, board->GetLayerName( ToLAYER_ID( layer ) ), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); @@ -212,7 +212,7 @@ SWAP_LAYERS_DIALOG::SWAP_LAYERS_DIALOG( PCB_BASE_FRAME* parent, LAYER_ID* aArray for( unsigned jj = 1; jj < DIM( layer_list ); ++jj ) { - text->SetLabel( board->GetLayerName( LAYER_ID( jj ) ) ); + text->SetLabel( board->GetLayerName( ToLAYER_ID( jj ) ) ); if( goodSize.x < text->GetSize().x ) goodSize.x = text->GetSize().x; @@ -292,7 +292,7 @@ void SWAP_LAYERS_DIALOG::Sel_Layer( wxCommandEvent& event ) LSET notallowed_mask = IsCopperLayer( ii ) ? LSET::AllNonCuMask() : LSET::AllCuMask(); - layer = m_Parent->SelectLayer( layer == NO_CHANGE ? LAYER_ID( ii ): layer, notallowed_mask ); + layer = m_Parent->SelectLayer( layer == NO_CHANGE ? ToLAYER_ID( ii ): layer, notallowed_mask ); if( !IsValidLayer( layer ) ) return; diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index 90c2cf6ee8..4a88cb6115 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/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp index 745c2be7bc..80cf1511d5 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -315,7 +315,7 @@ int PCBNEW_CONTROL::LayerNext( TOOL_EVENT& aEvent ) else ++layer; - editFrame->SwitchLayer( NULL, LAYER_ID( layer ) ); + editFrame->SwitchLayer( NULL, ToLAYER_ID( layer ) ); editFrame->GetGalCanvas()->SetFocus(); setTransitions(); @@ -342,7 +342,7 @@ int PCBNEW_CONTROL::LayerPrev( TOOL_EVENT& aEvent ) --layer; assert( IsCopperLayer( layer ) ); - editFrame->SwitchLayer( NULL, LAYER_ID( layer ) ); + editFrame->SwitchLayer( NULL, ToLAYER_ID( layer ) ); editFrame->GetGalCanvas()->SetFocus(); setTransitions();