From cd4983f09286ea6093743594558d731667db433f Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 31 Jul 2019 22:52:22 -0600 Subject: [PATCH] Switch selection color to platform selection color. --- eeschema/sch_bitmap.cpp | 3 ++- eeschema/sch_painter.cpp | 39 +++++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/eeschema/sch_bitmap.cpp b/eeschema/sch_bitmap.cpp index 59066c7f9d..cf46c63cb3 100644 --- a/eeschema/sch_bitmap.cpp +++ b/eeschema/sch_bitmap.cpp @@ -204,6 +204,7 @@ void SCH_BITMAP::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) void SCH_BITMAP::ViewGetLayers( int aLayers[], int& aCount ) const { - aCount = 1; + aCount = 2; aLayers[0] = LAYER_DRAW_BITMAPS; + aLayers[1] = LAYER_SELECTION_SHADOWS; } diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index 22a81ca56d..8b1a7b946f 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -238,6 +238,7 @@ float SCH_PAINTER::getShadowWidth() COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDrawingShadows ) { static COLOR4D highlightColor( 1.0, 0.3, 0.3, 1.0 ); + static COLOR4D selectionColor = wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ); COLOR4D color = m_schSettings.GetLayerColor( aLayer ); @@ -251,13 +252,7 @@ COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDr else if( aItem->IsSelected() ) { if( aDrawingShadows ) - { - // Synthesize a "drop-shadow" color - double h, s, l; - color.ToHSL( h, s, l ); - // Must allow saturation of 0 to allow greys to stay grey - color.FromHSL( h, std::min( s, 0.25 ), 0.90 ); - } + color = selectionColor.WithAlpha( 0.8 ); } else if( aItem->IsHighlighted() ) // Cross-probing { @@ -1516,24 +1511,32 @@ void SCH_PAINTER::draw( SCH_BITMAP *aBitmap, int aLayer ) m_gal->Save(); m_gal->Translate( aBitmap->GetPosition() ); - // When the image scale factor is not 1.0, we need to modify the actual - // as the image scale factor is similar to a local zoom + // When the image scale factor is not 1.0, we need to modify the actual as the image scale + // factor is similar to a local zoom double img_scale = aBitmap->GetImageScale(); if( img_scale != 1.0 ) m_gal->Scale( VECTOR2D( img_scale, img_scale ) ); - m_gal->DrawBitmap( *aBitmap->GetImage() ); + if( aLayer == LAYER_DRAW_BITMAPS ) + { + m_gal->DrawBitmap( *aBitmap->GetImage() ); + } - if( aBitmap->IsSelected() || aBitmap->IsBrightened() || aBitmap->IsHighlighted() ) + if( aLayer == LAYER_SELECTION_SHADOWS ) { - COLOR4D color = getRenderColor( aBitmap, LAYER_NOTES, false ); - m_gal->SetStrokeColor( color ); - m_gal->SetIsStroke( true ); - m_gal->SetIsFill( false ); - m_gal->SetLineWidth ( getShadowWidth() ); - m_gal->DrawRectangle( VECTOR2D( -aBitmap->GetSize().x / 2.0, -aBitmap->GetSize().y / 2.0 ), - VECTOR2D( aBitmap->GetSize().x / 2.0, aBitmap->GetSize().y / 2.0 ) ); + if( aBitmap->IsSelected() || aBitmap->IsBrightened() || aBitmap->IsHighlighted() ) + { + COLOR4D color = getRenderColor( aBitmap, LAYER_DRAW_BITMAPS, true ); + m_gal->SetIsStroke( true ); + m_gal->SetStrokeColor( color ); + m_gal->SetLineWidth ( getShadowWidth() ); + m_gal->SetIsFill( false ); + + VECTOR2D origin( -aBitmap->GetSize().x / 2.0, -aBitmap->GetSize().y / 2.0 ); + VECTOR2D end = origin + aBitmap->GetSize(); + m_gal->DrawRectangle( origin, end ); + } } m_gal->Restore();