Fix crash in Pcbnew and Gerbview when selecting (in layers manager) "always hide all layers but active" from popup menu

This commit is contained in:
jean-pierre charras 2014-07-20 19:46:11 +02:00
commit af1317f6b4
3 changed files with 6 additions and 5 deletions

View File

@ -186,7 +186,7 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
rowCount = GetLayerRowCount();
for( int row=0; row < rowCount; ++row )
{
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 );
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
int layer = getDecodedId( cb->GetId() );
bool loc_visible = visible;
@ -317,7 +317,7 @@ void GERBER_LAYER_WIDGET::UpdateLayerIcons()
int row_count = GetLayerRowCount();
for( int row = 0; row < row_count ; row++ )
{
wxStaticBitmap* bm = (wxStaticBitmap*) getLayerComp( row, 0 );
wxStaticBitmap* bm = (wxStaticBitmap*) getLayerComp( row, COLUMN_ICON_ACTIVE );
if( bm == NULL)
continue;

View File

@ -167,7 +167,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
rowCount = GetLayerRowCount();
for( int row = rowCount-1; row>=0; --row )
{
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 );
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
if( IsCopperLayer( layer ) )
@ -180,7 +180,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
// Enable/disable the copper layers visibility:
for( int row=0; row<rowCount; ++row )
{
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 );
wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
if( IsCopperLayer( layer ) )
@ -264,7 +264,7 @@ void PCB_LAYER_WIDGET::SyncLayerVisibilities()
// this utilizes more implementation knowledge than ideal, eventually
// add member ROW getRow() or similar to base LAYER_WIDGET.
wxWindow* w = getLayerComp( row, 0 );
wxWindow* w = getLayerComp( row, COLUMN_ICON_ACTIVE );
LAYER_ID layerId = ToLAYER_ID( getDecodedId( w->GetId() ) );

View File

@ -47,6 +47,7 @@
#define LYR_COLUMN_COUNT 4 ///< Layer tab column count
#define RND_COLUMN_COUNT 2 ///< Rendering tab column count
#define COLUMN_ICON_ACTIVE 0
#define COLUMN_COLORBM 1
#define COLUMN_COLOR_LYR_CB 2
#define COLUMN_COLOR_LYRNAME 3