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

This commit is contained in:
Jon Evans 2017-11-26 19:02:35 -05:00 committed by jean-pierre charras
parent b4e9d9b6f7
commit e5847b7953
2 changed files with 16 additions and 7 deletions

View File

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

View File

@ -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