Remove ToLayer_ID calls from color checks

Colors are assigned to virtual layers while the ToLayer_ID returns a
physical layer enum.  The GetLayerColor/SetLayerColor take LAYER_NUM
(int) values that can be larger than the physical layer count.
This commit is contained in:
Seth Hillbrand 2018-05-30 13:51:20 -07:00
parent d90d4ff682
commit 3ce8a4856a
4 changed files with 5 additions and 5 deletions

View File

@ -150,7 +150,7 @@ COLOR4D PCB_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayer ) const
{ {
wxASSERT( m_boardFrame ); wxASSERT( m_boardFrame );
return m_boardFrame->Settings().Colors().GetLayerColor( ToLAYER_ID( aLayer ) ); return m_boardFrame->Settings().Colors().GetLayerColor( aLayer );
} }

View File

@ -584,11 +584,11 @@ void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, COLOR4D aColor )
// destroys the GAL color setup // destroys the GAL color setup
if( !myframe->IsGalCanvasActive() ) if( !myframe->IsGalCanvasActive() )
{ {
COLOR4D oldColor = myframe->Settings().Colors().GetLayerColor( ToLAYER_ID( aLayer ) ); COLOR4D oldColor = myframe->Settings().Colors().GetLayerColor( aLayer );
aColor.a = oldColor.a; aColor.a = oldColor.a;
} }
myframe->Settings().Colors().SetLayerColor( ToLAYER_ID( aLayer ), aColor ); myframe->Settings().Colors().SetLayerColor( aLayer, aColor );
if( myframe->IsGalCanvasActive() ) if( myframe->IsGalCanvasActive() )
{ {

View File

@ -56,7 +56,7 @@
COLOR4D BRDITEMS_PLOTTER::getColor( LAYER_NUM aLayer ) COLOR4D BRDITEMS_PLOTTER::getColor( LAYER_NUM aLayer )
{ {
COLOR4D color = m_board->Colors().GetLayerColor( ToLAYER_ID( aLayer ) ); COLOR4D color = m_board->Colors().GetLayerColor( aLayer );
// A hack to avoid plotting ahite itmen in white color, expecting the paper // A hack to avoid plotting ahite itmen in white color, expecting the paper
// is also white: use a non white color: // is also white: use a non white color:

View File

@ -61,7 +61,7 @@ protected:
// Virtual function // Virtual function
COLOR4D GetLayerColor( LAYER_NUM aLayer ) const override COLOR4D GetLayerColor( LAYER_NUM aLayer ) const override
{ {
return m_frame->Settings().Colors().GetLayerColor( ToLAYER_ID( aLayer ) ); return m_frame->Settings().Colors().GetLayerColor( aLayer );
} }
// Returns the name of the layer id // Returns the name of the layer id