From 20ed9b475bbc26b5a40f1de6200ca281de679e60 Mon Sep 17 00:00:00 2001 From: Roberto Fernandez Bautista Date: Sat, 14 May 2022 16:49:53 +0100 Subject: [PATCH] Configurable hyperlink hovering color --- common/layer_id.cpp | 1 + common/settings/builtin_color_themes.h | 4 +++- common/settings/color_settings.cpp | 3 ++- eeschema/sch_painter.cpp | 8 +++++++- include/layer_ids.h | 1 + 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/common/layer_id.cpp b/common/layer_id.cpp index 3cf92abb9e..03733c2214 100644 --- a/common/layer_id.cpp +++ b/common/layer_id.cpp @@ -141,6 +141,7 @@ wxString LayerName( int aLayer ) case LAYER_SCHEMATIC_GRID_AXES: return _( "Axes" ); case LAYER_SCHEMATIC_BACKGROUND: return _( "Background" ); case LAYER_SCHEMATIC_CURSOR: return _( "Cursor" ); + case LAYER_HOVERED: return _( "Hovered items" ); case LAYER_BRIGHTENED: return _( "Highlighted items" ); case LAYER_HIDDEN: return _( "Hidden items" ); case LAYER_SELECTION_SHADOWS: return _( "Selection highlight" ); diff --git a/common/settings/builtin_color_themes.h b/common/settings/builtin_color_themes.h index f6ca9f9767..fd45155724 100644 --- a/common/settings/builtin_color_themes.h +++ b/common/settings/builtin_color_themes.h @@ -30,6 +30,7 @@ static const std::map s_defaultTheme = { LAYER_SCHEMATIC_ANCHOR, CSS_COLOR( 0, 0, 255, 1 ) }, { LAYER_SCHEMATIC_AUX_ITEMS, CSS_COLOR( 0, 0, 0, 1 ) }, { LAYER_SCHEMATIC_BACKGROUND, CSS_COLOR( 245, 244, 239, 1 ) }, + { LAYER_HOVERED, CSS_COLOR( 0, 0, 255, 1 ) }, { LAYER_BRIGHTENED, CSS_COLOR( 255, 0, 255, 1 ) }, { LAYER_BUS, CSS_COLOR( 0, 0, 132, 1 ) }, { LAYER_BUS_JUNCTION, CSS_COLOR( 0, 0, 132, 1 ) }, @@ -184,6 +185,7 @@ static const std::map s_classicTheme = { LAYER_SCHEMATIC_ANCHOR, CSS_COLOR( 0, 0, 255, 1 ) }, { LAYER_SCHEMATIC_AUX_ITEMS, COLOR4D( BLACK ) }, { LAYER_SCHEMATIC_BACKGROUND, COLOR4D( WHITE ) }, + { LAYER_HOVERED, COLOR4D( BLUE ) }, { LAYER_BRIGHTENED, COLOR4D( PUREMAGENTA ) }, { LAYER_BUS, COLOR4D( BLUE ) }, { LAYER_BUS_JUNCTION, COLOR4D( BLUE ) }, @@ -201,7 +203,7 @@ static const std::map s_classicTheme = { LAYER_GLOBLABEL, COLOR4D( RED ) }, { LAYER_HIERLABEL, COLOR4D( BROWN ) }, { LAYER_LOCLABEL, COLOR4D( BLACK ) }, - { LAYER_NETCLASS_REFS, COLOR4D( BLACK ) }, + { LAYER_NETCLASS_REFS, COLOR4D( BLACK ) }, { LAYER_NOCONNECT, COLOR4D( BLUE ) }, { LAYER_NOTES, COLOR4D( LIGHTBLUE ) }, { LAYER_PRIVATE_NOTES, COLOR4D( LIGHTBLUE ) }, diff --git a/common/settings/color_settings.cpp b/common/settings/color_settings.cpp index e9e5419c19..6fffb3e7ac 100644 --- a/common/settings/color_settings.cpp +++ b/common/settings/color_settings.cpp @@ -30,7 +30,7 @@ ///! Update the schema version whenever a migration is required -const int colorsSchemaVersion = 4; +const int colorsSchemaVersion = 5; COLOR_SETTINGS::COLOR_SETTINGS( const wxString& aFilename, bool aAbsolutePath ) : @@ -76,6 +76,7 @@ COLOR_SETTINGS::COLOR_SETTINGS( const wxString& aFilename, bool aAbsolutePath ) CLR( "schematic.anchor", LAYER_SCHEMATIC_ANCHOR ); CLR( "schematic.aux_items", LAYER_SCHEMATIC_AUX_ITEMS ); CLR( "schematic.background", LAYER_SCHEMATIC_BACKGROUND ); + CLR( "schematic.hovered", LAYER_HOVERED ); CLR( "schematic.brightened", LAYER_BRIGHTENED ); CLR( "schematic.bus", LAYER_BUS ); CLR( "schematic.bus_junction", LAYER_BUS_JUNCTION ); diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index cb96aa7dc0..9eedb7271a 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -1837,6 +1837,12 @@ void SCH_PAINTER::draw( const SCH_TEXT *aText, int aLayer ) return; } + if( aText->IsHypertext() && ( aText->GetFlags() & IS_ROLLOVER ) && !drawingShadows + && !aText->IsMoving() ) + { + color = m_schSettings.GetLayerColor( LAYER_HOVERED ); + } + m_gal->SetStrokeColor( color ); m_gal->SetFillColor( color ); @@ -2164,7 +2170,7 @@ void SCH_PAINTER::draw( const SCH_FIELD *aField, int aLayer ) if( aField->IsHypertext() && ( aField->GetFlags() & IS_ROLLOVER ) > 0 && !drawingShadows && !aField->IsMoving() ) { - color = PUREBLUE; + color = m_schSettings.GetLayerColor( LAYER_HOVERED ); } // Calculate the text orientation according to the parent orientation. diff --git a/include/layer_ids.h b/include/layer_ids.h index c7024fa8a1..04a9fce4dc 100644 --- a/include/layer_ids.h +++ b/include/layer_ids.h @@ -375,6 +375,7 @@ enum SCH_LAYER_ID: int LAYER_SCHEMATIC_GRID_AXES, LAYER_SCHEMATIC_BACKGROUND, LAYER_SCHEMATIC_CURSOR, + LAYER_HOVERED, LAYER_BRIGHTENED, LAYER_HIDDEN, LAYER_SELECTION_SHADOWS,