diff --git a/common/widgets/layer_presentation.cpp b/common/widgets/layer_presentation.cpp index 85530772d8..d5ef6dc727 100644 --- a/common/widgets/layer_presentation.cpp +++ b/common/widgets/layer_presentation.cpp @@ -74,8 +74,6 @@ void LAYER_PRESENTATION::DrawColorSwatch( wxBitmap& aLayerbmp, int aLayer ) cons // Helper function to create a single bitmap at a specific size using vector graphics static wxBitmap createLayerPairBitmapAtSize( const COLOR4D& aTopColor, const COLOR4D& aBottomColor, int aSize ) { - double scale = aSize / 24.0; - wxBitmap bitmap( aSize, aSize ); wxMemoryDC memDC; memDC.SelectObject( bitmap ); @@ -116,12 +114,14 @@ static wxBitmap createLayerPairBitmapAtSize( const COLOR4D& aTopColor, const COL gc->SetBrush( bottomBrush ); gc->DrawPath( bottomPath ); + int lineScale = std::max( 1, wxRound( aSize / 24.0 ) ); + // Draw separator line with white outline and black center - wxPen whiteLine( *wxWHITE, 3 * scale ); + wxPen whiteLine( *wxWHITE, 3 * lineScale ); gc->SetPen( whiteLine ); gc->StrokeLine( sepTopX, sepTopY, sepBotX, sepBotY ); - wxPen blackLine( *wxBLACK, 1 * scale ); + wxPen blackLine( *wxBLACK, 1 * lineScale ); gc->SetPen( blackLine ); gc->StrokeLine( sepTopX, sepTopY, sepBotX, sepBotY ); @@ -137,7 +137,11 @@ wxBitmapBundle LAYER_PRESENTATION::CreateLayerPairIcon( const COLOR4D& aTopColor wxVector bitmaps; bitmaps.push_back( createLayerPairBitmapAtSize( aTopColor, aBottomColor, aDefSize ) ); + bitmaps.push_back( createLayerPairBitmapAtSize( aTopColor, aBottomColor, aDefSize * 1.3334 ) ); + bitmaps.push_back( createLayerPairBitmapAtSize( aTopColor, aBottomColor, aDefSize * 1.5 ) ); bitmaps.push_back( createLayerPairBitmapAtSize( aTopColor, aBottomColor, aDefSize * 2 ) ); + bitmaps.push_back( createLayerPairBitmapAtSize( aTopColor, aBottomColor, aDefSize * 2.6667 ) ); + bitmaps.push_back( createLayerPairBitmapAtSize( aTopColor, aBottomColor, aDefSize * 3 ) ); return wxBitmapBundle::FromBitmaps( bitmaps ); } diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 099af32a54..5dfc53e62e 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -2900,6 +2900,8 @@ void PCB_EDIT_FRAME::CommonSettingsChanged( int aFlags ) { PCB_BASE_EDIT_FRAME::CommonSettingsChanged( aFlags ); + PrepareLayerIndicator(); + GetAppearancePanel()->OnColorThemeChanged(); SetElementVisibility( LAYER_RATSNEST, GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest ); diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h index 5e21edf9a7..12e6e1a964 100644 --- a/pcbnew/pcb_edit_frame.h +++ b/pcbnew/pcb_edit_frame.h @@ -713,13 +713,13 @@ protected: */ struct LAYER_TOOLBAR_ICON_VALUES { - int previous_requested_scale; + int previous_icon_size; COLOR4D previous_Route_Layer_TOP_color; COLOR4D previous_Route_Layer_BOTTOM_color; COLOR4D previous_background_color; LAYER_TOOLBAR_ICON_VALUES() - : previous_requested_scale( 0 ), + : previous_icon_size( 0 ), previous_Route_Layer_TOP_color( COLOR4D::UNSPECIFIED ), previous_Route_Layer_BOTTOM_color( COLOR4D::UNSPECIFIED ), previous_background_color( COLOR4D::UNSPECIFIED ) diff --git a/pcbnew/toolbars_pcb_editor.cpp b/pcbnew/toolbars_pcb_editor.cpp index ae62446018..6243d81f48 100644 --- a/pcbnew/toolbars_pcb_editor.cpp +++ b/pcbnew/toolbars_pcb_editor.cpp @@ -76,11 +76,11 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild ) COLOR4D top_color, bottom_color, background_color; bool change = aForceRebuild; - int requested_scale = KiIconScale( this ); + int icon_size = Pgm().GetCommonSettings()->m_Appearance.toolbar_icon_size; - if( m_prevIconVal.previous_requested_scale != requested_scale ) + if( m_prevIconVal.previous_icon_size != icon_size ) { - m_prevIconVal.previous_requested_scale = requested_scale; + m_prevIconVal.previous_icon_size = icon_size; change = true; } @@ -100,17 +100,9 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild ) change = true; } - background_color = GetColorSettings()->GetColor( LAYER_PCB_BACKGROUND ); - - if( m_prevIconVal.previous_background_color != background_color ) - { - m_prevIconVal.previous_background_color = background_color; - change = true; - } - if( change || !LayerPairBitmap.IsOk() ) { - LayerPairBitmap = LAYER_PRESENTATION::CreateLayerPairIcon( top_color, bottom_color ); + LayerPairBitmap = LAYER_PRESENTATION::CreateLayerPairIcon( top_color, bottom_color, icon_size ); if( m_tbTopAux ) {