Commit 1173add9 authored by charras's avatar charras

Gerbview: finishing layer_widget integration to manage gerber layers colors and visibility

parent 9b57038c
...@@ -4,13 +4,18 @@ KiCad ChangeLog 2010 ...@@ -4,13 +4,18 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2010-Feb-04 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++ gerbview:
Use layer_widget to manage gerber layers colors and visibility.
2010-Jan-31 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> 2010-Jan-31 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================ ================================================================================
++ pcbnew: ++ pcbnew:
More about work on color selection and items visibility: More about work on color selection and items visibility:
removed global variables and a lot of redundancies removed global variables and a lot of redundancies
Now Modedit does not uses the visiblity options of the board editor Now Modedit does not uses the visiblity options of the board editor
(That can create a problem id hide modules is activated) (That can create a problem if hide modules is activated)
work in progress but almost finished work in progress but almost finished
......
...@@ -202,8 +202,8 @@ bool GERBER_LAYER_WIDGET::OnLayerSelect( int aLayer ) ...@@ -202,8 +202,8 @@ bool GERBER_LAYER_WIDGET::OnLayerSelect( int aLayer )
{ {
// the layer change from the GERBER_LAYER_WIDGET can be denied by returning // the layer change from the GERBER_LAYER_WIDGET can be denied by returning
// false from this function. // false from this function.
// myframe->setActiveLayer( aLayer, false ); myframe->setActiveLayer( aLayer, false );
// myframe->syncLayerBox(); myframe->syncLayerBox();
if(DisplayOpt.ContrastModeDisplay) if(DisplayOpt.ContrastModeDisplay)
myframe->DrawPanel->Refresh(); myframe->DrawPanel->Refresh();
......
...@@ -157,7 +157,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -157,7 +157,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_TOOLBARH_GERBVIEW_SELECT_LAYER: case ID_TOOLBARH_GERBVIEW_SELECT_LAYER:
GetScreen()->m_Active_Layer = m_SelLayerBox->GetChoice(); setActiveLayer(m_SelLayerBox->GetChoice());
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
break; break;
......
...@@ -47,15 +47,19 @@ void WinEDA_GerberFrame::Files_io( wxCommandEvent& event ) ...@@ -47,15 +47,19 @@ void WinEDA_GerberFrame::Files_io( wxCommandEvent& event )
case ID_MENU_INC_LAYER_AND_APPEND_FILE: case ID_MENU_INC_LAYER_AND_APPEND_FILE:
case ID_INC_LAYER_AND_APPEND_FILE: case ID_INC_LAYER_AND_APPEND_FILE:
{ {
int origLayer = GetScreen()->m_Active_Layer; int origLayer = getActiveLayer();
if( origLayer < NB_LAYERS )
GetScreen()->m_Active_Layer++; {
setActiveLayer(origLayer+1);
if( !LoadOneGerberFile( wxEmptyString, 0 ) ) if( !LoadOneGerberFile( wxEmptyString, 0 ) )
GetScreen()->m_Active_Layer = origLayer; setActiveLayer(origLayer);
SetToolbars(); SetToolbars();
} }
else
wxMessageBox(_("Cannot increment layer number: max count reached") );
}
break; break;
case ID_APPEND_FILE: case ID_APPEND_FILE:
......
...@@ -415,6 +415,8 @@ void WinEDA_GerberFrame::ReFillLayerWidget() ...@@ -415,6 +415,8 @@ void WinEDA_GerberFrame::ReFillLayerWidget()
m_auimgr.Update(); m_auimgr.Update();
else else
m_LayersManager->SetSize( bestz ); m_LayersManager->SetSize( bestz );
syncLayerWidget( );
} }
/** Function IsGridVisible() , virtual /** Function IsGridVisible() , virtual
...@@ -463,3 +465,21 @@ void WinEDA_GerberFrame::SetElementVisibility( int aGERBER_VISIBLE, bool aNewSta ...@@ -463,3 +465,21 @@ void WinEDA_GerberFrame::SetElementVisibility( int aGERBER_VISIBLE, bool aNewSta
GetBoard()->SetElementVisibility( aGERBER_VISIBLE, aNewState ); GetBoard()->SetElementVisibility( aGERBER_VISIBLE, aNewState );
m_LayersManager->SetRenderState( aGERBER_VISIBLE, aNewState ); m_LayersManager->SetRenderState( aGERBER_VISIBLE, aNewState );
} }
void WinEDA_GerberFrame::syncLayerWidget( )
{
m_LayersManager->SelectLayer( getActiveLayer() );
}
/**
* Function syncLayerBox
* updates the currently "selected" layer within m_SelLayerBox
* The currently active layer, as defined by the return value of
* getActiveLayer(). And updates the colored icon in the toolbar.
*/
void WinEDA_GerberFrame::syncLayerBox()
{
m_SelLayerBox->SetSelection( getActiveLayer() );
}
...@@ -214,7 +214,7 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void ) ...@@ -214,7 +214,7 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
ID_TOOLBARH_GERBVIEW_SELECT_LAYER, ID_TOOLBARH_GERBVIEW_SELECT_LAYER,
wxDefaultPosition, wxSize( 150, -1 ), wxDefaultPosition, wxSize( 150, -1 ),
choices ); choices );
m_SelLayerBox->SetSelection( GetScreen()->m_Active_Layer ); m_SelLayerBox->SetSelection( getActiveLayer() );
m_HToolBar->AddControl( m_SelLayerBox ); m_HToolBar->AddControl( m_SelLayerBox );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
......
...@@ -117,6 +117,46 @@ public: ...@@ -117,6 +117,46 @@ public:
*/ */
void ReFillLayerWidget(); void ReFillLayerWidget();
/**
* Function setActiveLayer
* will change the currently active layer to \a aLayer and also
* update the PCB_LAYER_WIDGET.
*/
void setActiveLayer( int aLayer, bool doLayerWidgetUpdate = true )
{
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = aLayer;
if( doLayerWidgetUpdate )
syncLayerWidget();
}
/**
* Function getActiveLayer
* returns the active layer
*/
int getActiveLayer()
{
return ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer;
}
/**
* Function syncLayerWidget
* updates the currently "selected" layer within the PCB_LAYER_WIDGET.
* The currently active layer is defined by the return value of getActiveLayer().
* <p>
* This function cannot be inline without including layer_widget.h in
* here and we do not want to do that.
*/
void syncLayerWidget( );
/**
* Function syncLayerBox
* updates the currently "selected" layer within m_SelLayerBox
* The currently active layer, as defined by the return value of
* getActiveLayer(). And updates the colored icon in the toolbar.
*/
void syncLayerBox();
/** /**
* Load applications settings specific to the PCBNew. * Load applications settings specific to the PCBNew.
* *
......
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