Browse Source

Gerbview: apply layer colors to GAL after sorting (Fixes lp:1720540)

pull/5/merge
Jon Evans 8 years ago
committed by jean-pierre charras
parent
commit
e5847b7953
  1. 10
      gerbview/class_gerbview_layer_widget.cpp
  2. 13
      pcbnew/layer_widget.cpp

10
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;
}

13
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<COLOR_SWATCH*>( getLayerComp( row, col ) );
wxASSERT( bmb );
auto swatch = static_cast<COLOR_SWATCH*>( 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<COLOR_SWATCH*>( 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

Loading…
Cancel
Save