From 354d9b4e63e887ec5623c7f472086bd918365830 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 4 Jan 2021 11:54:30 +0000 Subject: [PATCH] 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. --- pcbnew/pcb_edit_frame.h | 4 -- pcbnew/toolbars_pcb_editor.cpp | 87 +++++++++++++++------------------- 2 files changed, 37 insertions(+), 54 deletions(-) diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h index 1060ff031b..7037e9023e 100644 --- a/pcbnew/pcb_edit_frame.h +++ b/pcbnew/pcb_edit_frame.h @@ -84,18 +84,14 @@ protected: struct LAYER_TOOLBAR_ICON_VALUES { int previous_requested_scale; - COLOR4D previous_active_layer_color; COLOR4D previous_Route_Layer_TOP_color; COLOR4D previous_Route_Layer_BOTTOM_color; - COLOR4D previous_via_color; COLOR4D previous_background_color; LAYER_TOOLBAR_ICON_VALUES() : previous_requested_scale( 0 ), - previous_active_layer_color( COLOR4D::UNSPECIFIED ), previous_Route_Layer_TOP_color( COLOR4D::UNSPECIFIED ), previous_Route_Layer_BOTTOM_color( COLOR4D::UNSPECIFIED ), - previous_via_color( COLOR4D::UNSPECIFIED ), previous_background_color( COLOR4D::UNSPECIFIED ) { } diff --git a/pcbnew/toolbars_pcb_editor.cpp b/pcbnew/toolbars_pcb_editor.cpp index 92ef65c5b8..d4aa3f8de9 100644 --- a/pcbnew/toolbars_pcb_editor.cpp +++ b/pcbnew/toolbars_pcb_editor.cpp @@ -58,39 +58,44 @@ static std::unique_ptr LayerPairBitmap; #define BM_LAYERICON_SIZE 24 static const char s_BitmapLayerIcon[BM_LAYERICON_SIZE][BM_LAYERICON_SIZE] = { - // 0 = draw pixel with active layer color - // 1 = draw pixel with top layer color (top/bottom layer used inautoroute and place via) - // 2 = draw pixel with bottom layer color - // 3 = draw pixel with via color - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + // 0 = draw pixel with white + // 1 = draw pixel with black + // 2 = draw pixel with top layer from router pair + // 3 = draw pixel with bottom layer from router pair + { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3 }, + { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3 }, + { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3 }, + { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3 }, + { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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+ { 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, + { 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, + { 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, 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 ) { 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; int requested_scale = Pgm().GetCommonSettings()->m_Appearance.icon_scale; @@ -101,14 +106,6 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild ) 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 ); if( m_prevIconVal.previous_Route_Layer_TOP_color != top_color ) @@ -125,15 +122,6 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild ) change = true; } - int via_type = static_cast( 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 ); if( m_prevIconVal.previous_background_color != background_color ) @@ -146,8 +134,7 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild ) { LayerPairBitmap = std::make_unique( 24, 24 ); - // Draw the icon, with colors according to the active layer and layer pairs for via - // command (change layer) + // Draw the icon, with colors according to the router's layer pair wxMemoryDC iconDC; iconDC.SelectObject( *LayerPairBitmap ); wxBrush brush; @@ -168,10 +155,10 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild ) switch( s_BitmapLayerIcon[ii][jj] ) { default: - case 0: pen.SetColour( active_layer_color.ToColour() ); break; - case 1: pen.SetColour( top_color.ToColour() ); break; - case 2: pen.SetColour( bottom_color.ToColour() ); break; - case 3: pen.SetColour( via_color.ToColour() ); break; + case 0: pen.SetColour( ICON_WHITE.ToColour() ); break; + case 1: pen.SetColour( ICON_BLACK.ToColour() ); break; + case 2: pen.SetColour( top_color.ToColour() ); break; + case 3: pen.SetColour( bottom_color.ToColour() ); break; } buttonColor = s_BitmapLayerIcon[ii][jj];