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
Please add newer entries at the top, list the date and your name with
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>
================================================================================
++ pcbnew:
More about work on color selection and items visibility:
removed global variables and a lot of redundancies
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
......
......@@ -202,8 +202,8 @@ bool GERBER_LAYER_WIDGET::OnLayerSelect( int aLayer )
{
// the layer change from the GERBER_LAYER_WIDGET can be denied by returning
// false from this function.
// myframe->setActiveLayer( aLayer, false );
// myframe->syncLayerBox();
myframe->setActiveLayer( aLayer, false );
myframe->syncLayerBox();
if(DisplayOpt.ContrastModeDisplay)
myframe->DrawPanel->Refresh();
......
......@@ -157,7 +157,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_TOOLBARH_GERBVIEW_SELECT_LAYER:
GetScreen()->m_Active_Layer = m_SelLayerBox->GetChoice();
setActiveLayer(m_SelLayerBox->GetChoice());
DrawPanel->Refresh( TRUE );
break;
......
......@@ -47,14 +47,18 @@ void WinEDA_GerberFrame::Files_io( wxCommandEvent& event )
case ID_MENU_INC_LAYER_AND_APPEND_FILE:
case ID_INC_LAYER_AND_APPEND_FILE:
{
int origLayer = GetScreen()->m_Active_Layer;
GetScreen()->m_Active_Layer++;
int origLayer = getActiveLayer();
if( origLayer < NB_LAYERS )
{
setActiveLayer(origLayer+1);
if( !LoadOneGerberFile( wxEmptyString, 0 ) )
GetScreen()->m_Active_Layer = origLayer;
if( !LoadOneGerberFile( wxEmptyString, 0 ) )
setActiveLayer(origLayer);
SetToolbars();
SetToolbars();
}
else
wxMessageBox(_("Cannot increment layer number: max count reached") );
}
break;
......
......@@ -415,6 +415,8 @@ void WinEDA_GerberFrame::ReFillLayerWidget()
m_auimgr.Update();
else
m_LayersManager->SetSize( bestz );
syncLayerWidget( );
}
/** Function IsGridVisible() , virtual
......@@ -463,3 +465,21 @@ void WinEDA_GerberFrame::SetElementVisibility( int aGERBER_VISIBLE, bool aNewSta
GetBoard()->SetElementVisibility( 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 )
ID_TOOLBARH_GERBVIEW_SELECT_LAYER,
wxDefaultPosition, wxSize( 150, -1 ),
choices );
m_SelLayerBox->SetSelection( GetScreen()->m_Active_Layer );
m_SelLayerBox->SetSelection( getActiveLayer() );
m_HToolBar->AddControl( m_SelLayerBox );
m_HToolBar->AddSeparator();
......
......@@ -117,6 +117,46 @@ public:
*/
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.
*
......
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