Pcbnew, Gerbview : fix crash when updating the layer manager.
This commit is contained in:
parent
89f14906a4
commit
5a4c16dcfb
|
@ -418,24 +418,24 @@ void LAYER_WIDGET::insertLayerRow( int aRow, const ROW& aSpec )
|
||||||
sbm->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( LAYER_WIDGET::OnLeftDownLayers ), NULL, this );
|
sbm->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( LAYER_WIDGET::OnLeftDownLayers ), NULL, this );
|
||||||
m_LayersFlexGridSizer->wxSizer::Insert( index+col, sbm, 0, flags );
|
m_LayersFlexGridSizer->wxSizer::Insert( index+col, sbm, 0, flags );
|
||||||
|
|
||||||
// column 1
|
// column 1 (COLUMN_COLORBM)
|
||||||
col = 1;
|
col = COLUMN_COLORBM;
|
||||||
wxBitmapButton* bmb = makeColorButton( m_LayerScrolledWindow, aSpec.color, encodeId( col, aSpec.id ) );
|
wxBitmapButton* bmb = makeColorButton( m_LayerScrolledWindow, aSpec.color, encodeId( col, aSpec.id ) );
|
||||||
bmb->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( LAYER_WIDGET::OnLeftDownLayers ), NULL, this );
|
bmb->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( LAYER_WIDGET::OnLeftDownLayers ), NULL, this );
|
||||||
bmb->Connect( wxEVT_MIDDLE_DOWN, wxMouseEventHandler( LAYER_WIDGET::OnMiddleDownLayerColor ), NULL, this );
|
bmb->Connect( wxEVT_MIDDLE_DOWN, wxMouseEventHandler( LAYER_WIDGET::OnMiddleDownLayerColor ), NULL, this );
|
||||||
bmb->SetToolTip( _("Left click to select, middle click for color change, right click for menu" ) );
|
bmb->SetToolTip( _("Left click to select, middle click for color change, right click for menu" ) );
|
||||||
m_LayersFlexGridSizer->wxSizer::Insert( index+col, bmb, 0, flags );
|
m_LayersFlexGridSizer->wxSizer::Insert( index+col, bmb, 0, flags );
|
||||||
|
|
||||||
// column 2
|
// column 2 (COLUMN_COLOR_LYR_CB)
|
||||||
col = 2;
|
col = COLUMN_COLOR_LYR_CB;
|
||||||
wxCheckBox* cb = new wxCheckBox( m_LayerScrolledWindow, encodeId( col, aSpec.id ), wxEmptyString );
|
wxCheckBox* cb = new wxCheckBox( m_LayerScrolledWindow, encodeId( col, aSpec.id ), wxEmptyString );
|
||||||
cb->SetValue( aSpec.state );
|
cb->SetValue( aSpec.state );
|
||||||
cb->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( LAYER_WIDGET::OnLayerCheckBox ), NULL, this );
|
cb->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( LAYER_WIDGET::OnLayerCheckBox ), NULL, this );
|
||||||
cb->SetToolTip( _( "Enable this for visibility" ) );
|
cb->SetToolTip( _( "Enable this for visibility" ) );
|
||||||
m_LayersFlexGridSizer->wxSizer::Insert( index+col, cb, 0, flags );
|
m_LayersFlexGridSizer->wxSizer::Insert( index+col, cb, 0, flags );
|
||||||
|
|
||||||
// column 3
|
// column 3 (COLUMN_COLOR_LYRNAME)
|
||||||
col = 3;
|
col = COLUMN_COLOR_LYRNAME;
|
||||||
wxStaticText* st = new wxStaticText( m_LayerScrolledWindow, encodeId( col, aSpec.id ), aSpec.rowName );
|
wxStaticText* st = new wxStaticText( m_LayerScrolledWindow, encodeId( col, aSpec.id ), aSpec.rowName );
|
||||||
shrinkFont( st, m_PointSize );
|
shrinkFont( st, m_PointSize );
|
||||||
st->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( LAYER_WIDGET::OnLeftDownLayers ), NULL, this );
|
st->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( LAYER_WIDGET::OnLeftDownLayers ), NULL, this );
|
||||||
|
@ -726,7 +726,7 @@ void LAYER_WIDGET::SetLayerVisible( LAYER_NUM aLayer, bool isVisible )
|
||||||
int row = findLayerRow( aLayer );
|
int row = findLayerRow( aLayer );
|
||||||
if( row >= 0 )
|
if( row >= 0 )
|
||||||
{
|
{
|
||||||
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 );
|
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 2 );
|
||||||
wxASSERT( cb );
|
wxASSERT( cb );
|
||||||
cb->SetValue( isVisible ); // does not fire an event
|
cb->SetValue( isVisible ); // does not fire an event
|
||||||
}
|
}
|
||||||
|
@ -738,7 +738,7 @@ bool LAYER_WIDGET::IsLayerVisible( LAYER_NUM aLayer )
|
||||||
int row = findLayerRow( aLayer );
|
int row = findLayerRow( aLayer );
|
||||||
if( row >= 0 )
|
if( row >= 0 )
|
||||||
{
|
{
|
||||||
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 );
|
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
|
||||||
wxASSERT( cb );
|
wxASSERT( cb );
|
||||||
return cb->GetValue();
|
return cb->GetValue();
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,10 @@
|
||||||
#define LYR_COLUMN_COUNT 4 ///< Layer tab column count
|
#define LYR_COLUMN_COUNT 4 ///< Layer tab column count
|
||||||
#define RND_COLUMN_COUNT 2 ///< Rendering tab column count
|
#define RND_COLUMN_COUNT 2 ///< Rendering tab column count
|
||||||
|
|
||||||
|
#define COLUMN_COLORBM 1
|
||||||
|
#define COLUMN_COLOR_LYR_CB 2
|
||||||
|
#define COLUMN_COLOR_LYRNAME 3
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class LAYER_WIDGET
|
* Class LAYER_WIDGET
|
||||||
|
|
Loading…
Reference in New Issue