diff --git a/common/view/view.cpp b/common/view/view.cpp index 0e78e23eb7..59ff028cef 100644 --- a/common/view/view.cpp +++ b/common/view/view.cpp @@ -268,7 +268,7 @@ void VIEW::SetCenter( const VECTOR2D& aCenter ) void VIEW::SetLayerVisible( int aLayer, bool aVisible ) { - // FIXME + m_layers[aLayer].enabled = aVisible; } @@ -355,15 +355,18 @@ void VIEW::redrawRect( const BOX2I& aRect ) BOOST_FOREACH( VIEW_LAYER* l, m_orderedLayers ) { - drawItem drawFunc( this, l->id ); + if( l->enabled ) + { + drawItem drawFunc( this, l->id ); - m_gal->SetLayerDepth( (double) l->renderingOrder ); - l->items->Query( aRect, drawFunc ); - l->isDirty = false; + m_gal->SetLayerDepth( (double) l->renderingOrder ); + l->items->Query( aRect, drawFunc ); + l->isDirty = false; - totalItems += drawFunc.count; - totalDrawTime += drawFunc.time; - totalCached += drawFunc.countCached; + totalItems += drawFunc.count; + totalDrawTime += drawFunc.time; + totalCached += drawFunc.countCached; + } } prof_end( &totalCycles ); @@ -399,7 +402,7 @@ void VIEW::Clear() l->items->Query( r, v ); l->items->RemoveAll(); - }; + } } diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp index 819a589f20..ab82861afa 100644 --- a/pcbnew/class_pcb_layer_widget.cpp +++ b/pcbnew/class_pcb_layer_widget.cpp @@ -31,6 +31,10 @@ #include #include #include +#ifdef KICAD_GAL +#include +#include +#endif #include #include #include // enum PCB_VISIBLE @@ -358,6 +362,20 @@ void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal brd->SetVisibleLayers( visibleLayers ); +#ifdef KICAD_GAL + EDA_DRAW_PANEL_GAL *galCanvas = myframe->GetGalCanvas(); + if( galCanvas ) + { + KiGfx::VIEW* view = galCanvas->GetView(); + view->SetLayerVisible( aLayer, isVisible ); + + if( myframe->IsGalCanvasActive() ) + { + galCanvas->Refresh(); + } + } +#endif /* KICAD_GAL */ + if( isFinal ) myframe->GetCanvas()->Refresh(); } @@ -394,6 +412,20 @@ void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled ) brd->SetElementVisibility( aId, isEnabled ); } +#ifdef KICAD_GAL + EDA_DRAW_PANEL_GAL *galCanvas = myframe->GetGalCanvas(); + if( galCanvas ) + { + KiGfx::VIEW* view = galCanvas->GetView(); + view->SetLayerVisible( ITEM_GAL_LAYER( aId ), isEnabled ); + + if( myframe->IsGalCanvasActive() ) + { + galCanvas->Refresh(); + } + } +#endif /* KICAD_GAL */ + myframe->GetCanvas()->Refresh(); }