Commit a97c9a1b authored by Maciej Suminski's avatar Maciej Suminski

Added possibility to show/hide layers using right sidebar (PCB layer widget)...

Added possibility to show/hide layers using right sidebar (PCB layer widget) in the GAL rendered view.
parent e262b321
...@@ -268,7 +268,7 @@ void VIEW::SetCenter( const VECTOR2D& aCenter ) ...@@ -268,7 +268,7 @@ void VIEW::SetCenter( const VECTOR2D& aCenter )
void VIEW::SetLayerVisible( int aLayer, bool aVisible ) void VIEW::SetLayerVisible( int aLayer, bool aVisible )
{ {
// FIXME m_layers[aLayer].enabled = aVisible;
} }
...@@ -355,15 +355,18 @@ void VIEW::redrawRect( const BOX2I& aRect ) ...@@ -355,15 +355,18 @@ void VIEW::redrawRect( const BOX2I& aRect )
BOOST_FOREACH( VIEW_LAYER* l, m_orderedLayers ) 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 ); m_gal->SetLayerDepth( (double) l->renderingOrder );
l->items->Query( aRect, drawFunc ); l->items->Query( aRect, drawFunc );
l->isDirty = false; l->isDirty = false;
totalItems += drawFunc.count; totalItems += drawFunc.count;
totalDrawTime += drawFunc.time; totalDrawTime += drawFunc.time;
totalCached += drawFunc.countCached; totalCached += drawFunc.countCached;
}
} }
prof_end( &totalCycles ); prof_end( &totalCycles );
...@@ -399,7 +402,7 @@ void VIEW::Clear() ...@@ -399,7 +402,7 @@ void VIEW::Clear()
l->items->Query( r, v ); l->items->Query( r, v );
l->items->RemoveAll(); l->items->RemoveAll();
}; }
} }
......
...@@ -31,6 +31,10 @@ ...@@ -31,6 +31,10 @@
#include <fctsys.h> #include <fctsys.h>
#include <appl_wxstruct.h> #include <appl_wxstruct.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
#ifdef KICAD_GAL
#include <class_drawpanel_gal.h>
#include <view/view.h>
#endif
#include <confirm.h> #include <confirm.h>
#include <wxPcbStruct.h> #include <wxPcbStruct.h>
#include <pcbstruct.h> // enum PCB_VISIBLE #include <pcbstruct.h> // enum PCB_VISIBLE
...@@ -358,6 +362,20 @@ void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal ...@@ -358,6 +362,20 @@ void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal
brd->SetVisibleLayers( visibleLayers ); 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 ) if( isFinal )
myframe->GetCanvas()->Refresh(); myframe->GetCanvas()->Refresh();
} }
...@@ -394,6 +412,20 @@ void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled ) ...@@ -394,6 +412,20 @@ void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
brd->SetElementVisibility( aId, 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(); myframe->GetCanvas()->Refresh();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment