diff --git a/gerbview/class_gerbview_layer_widget.cpp b/gerbview/class_gerbview_layer_widget.cpp index 498dac3975..1f84c68f78 100644 --- a/gerbview/class_gerbview_layer_widget.cpp +++ b/gerbview/class_gerbview_layer_widget.cpp @@ -212,6 +212,16 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) GetImagesList()->SortImagesByZOrder(); myframe->ReFillLayerWidget(); myframe->syncLayerBox( true ); + + if( myframe->IsGalCanvasActive() ) + { + for( int layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer ) + { + myframe->SetLayerColor( GERBER_DRAW_LAYER( layer ), + GetLayerColor( GERBER_DRAW_LAYER( layer ) ) ); + } + } + myframe->GetCanvas()->Refresh(); break; } diff --git a/pcbnew/layer_widget.cpp b/pcbnew/layer_widget.cpp index 6722a3f192..b4229a3816 100644 --- a/pcbnew/layer_widget.cpp +++ b/pcbnew/layer_widget.cpp @@ -674,10 +674,10 @@ void LAYER_WIDGET::SetLayerColor( LAYER_NUM aLayer, COLOR4D aColor ) if( row >= 0 ) { int col = 1; // bitmap button is column 1 - auto bmb = static_cast( getLayerComp( row, col ) ); - wxASSERT( bmb ); + auto swatch = static_cast( getLayerComp( row, col ) ); + wxASSERT( swatch ); - bmb->SetSwatchColor( aColor, false ); + swatch->SetSwatchColor( aColor, false ); } } @@ -688,11 +688,10 @@ COLOR4D LAYER_WIDGET::GetLayerColor( LAYER_NUM aLayer ) const if( row >= 0 ) { int col = 1; // bitmap button is column 1 - wxBitmapButton* bmb = (wxBitmapButton*) getLayerComp( row, col ); - wxASSERT( bmb ); + auto swatch = static_cast( getLayerComp( row, col ) ); + wxASSERT( swatch ); - wxString colorTxt = bmb->GetName(); - return ColorFromInt( strtoul( TO_UTF8(colorTxt), NULL, 0 ) ); + return swatch->GetSwatchColor(); } return COLOR4D::UNSPECIFIED; // it's caller fault, gave me a bad layer