Commit af1317f6 authored by jean-pierre charras's avatar jean-pierre charras

Fix crash in Pcbnew and Gerbview when selecting (in layers manager) "always...

Fix crash in Pcbnew and Gerbview when selecting (in layers manager) "always hide all layers but active" from popup menu
parents 2196ed21 680ca222
...@@ -186,7 +186,7 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) ...@@ -186,7 +186,7 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
rowCount = GetLayerRowCount(); rowCount = GetLayerRowCount();
for( int row=0; row < rowCount; ++row ) 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() ); int layer = getDecodedId( cb->GetId() );
bool loc_visible = visible; bool loc_visible = visible;
...@@ -317,7 +317,7 @@ void GERBER_LAYER_WIDGET::UpdateLayerIcons() ...@@ -317,7 +317,7 @@ void GERBER_LAYER_WIDGET::UpdateLayerIcons()
int row_count = GetLayerRowCount(); int row_count = GetLayerRowCount();
for( int row = 0; row < row_count ; row++ ) 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) if( bm == NULL)
continue; continue;
......
...@@ -167,7 +167,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) ...@@ -167,7 +167,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
rowCount = GetLayerRowCount(); rowCount = GetLayerRowCount();
for( int row = rowCount-1; row>=0; --row ) 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() ) ); LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
if( IsCopperLayer( layer ) ) if( IsCopperLayer( layer ) )
...@@ -180,7 +180,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) ...@@ -180,7 +180,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
// Enable/disable the copper layers visibility: // Enable/disable the copper layers visibility:
for( int row=0; row<rowCount; ++row ) 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() ) ); LAYER_ID layer = ToLAYER_ID( getDecodedId( cb->GetId() ) );
if( IsCopperLayer( layer ) ) if( IsCopperLayer( layer ) )
...@@ -264,7 +264,7 @@ void PCB_LAYER_WIDGET::SyncLayerVisibilities() ...@@ -264,7 +264,7 @@ void PCB_LAYER_WIDGET::SyncLayerVisibilities()
// this utilizes more implementation knowledge than ideal, eventually // this utilizes more implementation knowledge than ideal, eventually
// add member ROW getRow() or similar to base LAYER_WIDGET. // 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() ) ); LAYER_ID layerId = ToLAYER_ID( getDecodedId( w->GetId() ) );
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#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_ICON_ACTIVE 0
#define COLUMN_COLORBM 1 #define COLUMN_COLORBM 1
#define COLUMN_COLOR_LYR_CB 2 #define COLUMN_COLOR_LYR_CB 2
#define COLUMN_COLOR_LYRNAME 3 #define COLUMN_COLOR_LYRNAME 3
......
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