Simplify layer pair indicator icon.

It now just has top layer / bottom layer from the router's layer
pair.  The current layer is visible in the drop-down just to the
left, and the via stuff was confusing anyway.
This commit is contained in:
Jeff Young 2021-01-04 11:54:30 +00:00
parent 5c8927678a
commit 354d9b4e63
2 changed files with 37 additions and 54 deletions

View File

@ -84,18 +84,14 @@ protected:
struct LAYER_TOOLBAR_ICON_VALUES struct LAYER_TOOLBAR_ICON_VALUES
{ {
int previous_requested_scale; int previous_requested_scale;
COLOR4D previous_active_layer_color;
COLOR4D previous_Route_Layer_TOP_color; COLOR4D previous_Route_Layer_TOP_color;
COLOR4D previous_Route_Layer_BOTTOM_color; COLOR4D previous_Route_Layer_BOTTOM_color;
COLOR4D previous_via_color;
COLOR4D previous_background_color; COLOR4D previous_background_color;
LAYER_TOOLBAR_ICON_VALUES() LAYER_TOOLBAR_ICON_VALUES()
: previous_requested_scale( 0 ), : previous_requested_scale( 0 ),
previous_active_layer_color( COLOR4D::UNSPECIFIED ),
previous_Route_Layer_TOP_color( COLOR4D::UNSPECIFIED ), previous_Route_Layer_TOP_color( COLOR4D::UNSPECIFIED ),
previous_Route_Layer_BOTTOM_color( COLOR4D::UNSPECIFIED ), previous_Route_Layer_BOTTOM_color( COLOR4D::UNSPECIFIED ),
previous_via_color( COLOR4D::UNSPECIFIED ),
previous_background_color( COLOR4D::UNSPECIFIED ) previous_background_color( COLOR4D::UNSPECIFIED )
{ {
} }

View File

@ -58,39 +58,44 @@ static std::unique_ptr<wxBitmap> LayerPairBitmap;
#define BM_LAYERICON_SIZE 24 #define BM_LAYERICON_SIZE 24
static const char s_BitmapLayerIcon[BM_LAYERICON_SIZE][BM_LAYERICON_SIZE] = static const char s_BitmapLayerIcon[BM_LAYERICON_SIZE][BM_LAYERICON_SIZE] =
{ {
// 0 = draw pixel with active layer color // 0 = draw pixel with white
// 1 = draw pixel with top layer color (top/bottom layer used inautoroute and place via) // 1 = draw pixel with black
// 2 = draw pixel with bottom layer color // 2 = draw pixel with top layer from router pair
// 3 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, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } { 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
{ 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
{ 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
}; };
static COLOR4D ICON_WHITE { 0.86, 0.86, 0.86, 1.0 };
static COLOR4D ICON_BLACK { 0.28, 0.28, 0.28, 1.0 };
void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild ) void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild )
{ {
int ii, jj; int ii, jj;
COLOR4D active_layer_color, top_color, bottom_color, via_color, background_color; COLOR4D top_color, bottom_color, background_color;
bool change = aForceRebuild; bool change = aForceRebuild;
int requested_scale = Pgm().GetCommonSettings()->m_Appearance.icon_scale; int requested_scale = Pgm().GetCommonSettings()->m_Appearance.icon_scale;
@ -101,14 +106,6 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild )
change = true; change = true;
} }
active_layer_color = GetColorSettings()->GetColor( GetActiveLayer() );
if( m_prevIconVal.previous_active_layer_color != active_layer_color )
{
m_prevIconVal.previous_active_layer_color = active_layer_color;
change = true;
}
top_color = GetColorSettings()->GetColor( GetScreen()->m_Route_Layer_TOP ); top_color = GetColorSettings()->GetColor( GetScreen()->m_Route_Layer_TOP );
if( m_prevIconVal.previous_Route_Layer_TOP_color != top_color ) if( m_prevIconVal.previous_Route_Layer_TOP_color != top_color )
@ -125,15 +122,6 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild )
change = true; change = true;
} }
int via_type = static_cast<int>( GetDesignSettings().m_CurrentViaType );
via_color = GetColorSettings()->GetColor( LAYER_VIAS + via_type );
if( m_prevIconVal.previous_via_color != via_color )
{
m_prevIconVal.previous_via_color = via_color;
change = true;
}
background_color = GetColorSettings()->GetColor( LAYER_PCB_BACKGROUND ); background_color = GetColorSettings()->GetColor( LAYER_PCB_BACKGROUND );
if( m_prevIconVal.previous_background_color != background_color ) if( m_prevIconVal.previous_background_color != background_color )
@ -146,8 +134,7 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild )
{ {
LayerPairBitmap = std::make_unique<wxBitmap>( 24, 24 ); LayerPairBitmap = std::make_unique<wxBitmap>( 24, 24 );
// Draw the icon, with colors according to the active layer and layer pairs for via // Draw the icon, with colors according to the router's layer pair
// command (change layer)
wxMemoryDC iconDC; wxMemoryDC iconDC;
iconDC.SelectObject( *LayerPairBitmap ); iconDC.SelectObject( *LayerPairBitmap );
wxBrush brush; wxBrush brush;
@ -168,10 +155,10 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild )
switch( s_BitmapLayerIcon[ii][jj] ) switch( s_BitmapLayerIcon[ii][jj] )
{ {
default: default:
case 0: pen.SetColour( active_layer_color.ToColour() ); break; case 0: pen.SetColour( ICON_WHITE.ToColour() ); break;
case 1: pen.SetColour( top_color.ToColour() ); break; case 1: pen.SetColour( ICON_BLACK.ToColour() ); break;
case 2: pen.SetColour( bottom_color.ToColour() ); break; case 2: pen.SetColour( top_color.ToColour() ); break;
case 3: pen.SetColour( via_color.ToColour() ); break; case 3: pen.SetColour( bottom_color.ToColour() ); break;
} }
buttonColor = s_BitmapLayerIcon[ii][jj]; buttonColor = s_BitmapLayerIcon[ii][jj];