diff --git a/eeschema/dialogs/panel_eeschema_display_options.cpp b/eeschema/dialogs/panel_eeschema_display_options.cpp index ab22d7cfd0..86bd3aa1f4 100644 --- a/eeschema/dialogs/panel_eeschema_display_options.cpp +++ b/eeschema/dialogs/panel_eeschema_display_options.cpp @@ -65,9 +65,11 @@ void PANEL_EESCHEMA_DISPLAY_OPTIONS::loadEEschemaSettings( EESCHEMA_SETTINGS* cf m_checkSelDrawChildItems->SetValue( cfg->m_Selection.draw_selected_children ); m_checkSelFillShapes->SetValue( cfg->m_Selection.fill_shapes ); - m_highlightNetclassColors->SetValue( cfg->m_Selection.highlight_netclass_colors ); m_selWidthCtrl->SetValue( cfg->m_Selection.selection_thickness ); m_highlightWidthCtrl->SetValue( cfg->m_Selection.highlight_thickness ); + m_highlightNetclassColors->SetValue( cfg->m_Selection.highlight_netclass_colors ); + m_colHighlightThickness->SetValue( cfg->m_Selection.highlight_netclass_colors_thickness ); + m_colHighlightTransparency->SetValue( cfg->m_Selection.highlight_netclass_colors_alpha * 100 ); m_checkCrossProbeOnSelection->SetValue( cfg->m_CrossProbing.on_selection ); m_checkCrossProbeCenter->SetValue( cfg->m_CrossProbing.center_on_items ); @@ -109,9 +111,12 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow() cfg->m_Selection.draw_selected_children = m_checkSelDrawChildItems->GetValue(); cfg->m_Selection.fill_shapes = m_checkSelFillShapes->GetValue(); - cfg->m_Selection.highlight_netclass_colors = m_highlightNetclassColors->GetValue(); cfg->m_Selection.selection_thickness = KiROUND( m_selWidthCtrl->GetValue() ); cfg->m_Selection.highlight_thickness = KiROUND( m_highlightWidthCtrl->GetValue() ); + cfg->m_Selection.highlight_netclass_colors = m_highlightNetclassColors->GetValue(); + cfg->m_Selection.highlight_netclass_colors_thickness = m_colHighlightThickness->GetValue(); + cfg->m_Selection.highlight_netclass_colors_alpha = + m_colHighlightTransparency->GetValue() / 100.0; cfg->m_CrossProbing.on_selection = m_checkCrossProbeOnSelection->GetValue(); cfg->m_CrossProbing.center_on_items = m_checkCrossProbeCenter->GetValue(); diff --git a/eeschema/dialogs/panel_eeschema_display_options_base.cpp b/eeschema/dialogs/panel_eeschema_display_options_base.cpp index d69c718027..b5ae504b6b 100644 --- a/eeschema/dialogs/panel_eeschema_display_options_base.cpp +++ b/eeschema/dialogs/panel_eeschema_display_options_base.cpp @@ -101,9 +101,6 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWind m_checkSelFillShapes = new wxCheckBox( this, wxID_ANY, _("Fill selected shapes"), wxDefaultPosition, wxDefaultSize, 0 ); bSelectionSizer->Add( m_checkSelFillShapes, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - m_highlightNetclassColors = new wxCheckBox( this, wxID_ANY, _("Highlight netclass colors"), wxDefaultPosition, wxDefaultSize, 0 ); - bSelectionSizer->Add( m_highlightNetclassColors, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - wxGridBagSizer* gbSizer1; gbSizer1 = new wxGridBagSizer( 0, 0 ); gbSizer1->SetFlexibleDirection( wxBOTH ); @@ -114,7 +111,7 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWind m_selWidthLabel->Wrap( -1 ); gbSizer1->Add( m_selWidthLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); - m_selWidthCtrl = new wxSpinCtrlDouble( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxSP_ARROW_KEYS, 0, 50, 0, 1 ); + m_selWidthCtrl = new wxSpinCtrlDouble( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxSP_ARROW_KEYS, 0, 50, 0.000000, 1 ); m_selWidthCtrl->SetDigits( 0 ); gbSizer1->Add( m_selWidthCtrl, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); @@ -131,7 +128,34 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWind gbSizer1->Add( m_highlightWidthCtrl, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - bSelectionSizer->Add( gbSizer1, 1, wxEXPAND|wxRIGHT, 5 ); + bSelectionSizer->Add( gbSizer1, 0, wxEXPAND|wxRIGHT, 5 ); + + m_highlightNetclassColors = new wxCheckBox( this, wxID_ANY, _("Highlight netclass colors"), wxDefaultPosition, wxDefaultSize, 0 ); + bSelectionSizer->Add( m_highlightNetclassColors, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + + wxGridBagSizer* gbSizer11; + gbSizer11 = new wxGridBagSizer( 0, 0 ); + gbSizer11->SetFlexibleDirection( wxBOTH ); + gbSizer11->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_ALL ); + + m_colorHighlightLabel = new wxStaticText( this, wxID_ANY, _("Color highlight thickness:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_colorHighlightLabel->Wrap( -1 ); + gbSizer11->Add( m_colorHighlightLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + m_colHighlightThickness = new wxSpinCtrlDouble( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxSP_ARROW_KEYS, 0, 50, 0, 1 ); + m_colHighlightThickness->SetDigits( 0 ); + gbSizer11->Add( m_colHighlightThickness, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + m_colHighlightLabel2 = new wxStaticText( this, wxID_ANY, _("Color highlight opacity:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_colHighlightLabel2->Wrap( -1 ); + gbSizer11->Add( m_colHighlightLabel2, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + m_colHighlightTransparency = new wxSpinCtrlDouble( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxSP_ARROW_KEYS, 0, 100, 0, 1 ); + m_colHighlightTransparency->SetDigits( 0 ); + gbSizer11->Add( m_colHighlightTransparency, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSelectionSizer->Add( gbSizer11, 0, wxEXPAND, 5 ); bRightColumn->Add( bSelectionSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); diff --git a/eeschema/dialogs/panel_eeschema_display_options_base.fbp b/eeschema/dialogs/panel_eeschema_display_options_base.fbp index c617976df4..9efffe3d73 100644 --- a/eeschema/dialogs/panel_eeschema_display_options_base.fbp +++ b/eeschema/dialogs/panel_eeschema_display_options_base.fbp @@ -205,25 +205,25 @@ 5 wxEXPAND|wxTOP|wxLEFT 0 - + bAppearanceSizer wxVERTICAL none - + 5 wxEXPAND 1 - + bSizer4 wxHORIZONTAL none - + 5 wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL 0 - + 1 1 1 @@ -281,11 +281,11 @@ -1 - + 5 wxALIGN_CENTER_VERTICAL 0 - + 1 1 1 @@ -413,11 +413,11 @@ - + 5 wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND 0 - + 1 1 1 @@ -478,11 +478,11 @@ - + 5 wxBOTTOM|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -543,11 +543,11 @@ - + 5 wxBOTTOM|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -608,11 +608,11 @@ - + 5 wxBOTTOM|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -673,11 +673,11 @@ - + 5 wxBOTTOM|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -738,11 +738,11 @@ - + 5 wxBOTTOM|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -803,11 +803,11 @@ - + 5 wxBOTTOM|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -1075,11 +1075,11 @@ bSelectionSizer wxVERTICAL none - + 5 wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -1140,11 +1140,11 @@ - + 5 wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -1205,11 +1205,359 @@ - + + 5 + wxEXPAND|wxRIGHT + 0 + + -1,10 + wxBOTH + + + 0 + + gbSizer1 + wxFLEX_GROWMODE_SPECIFIED + none + 0 + + 5 + 1 + 0 + wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 0 + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Selection thickness: + 0 + + 0 + + + 0 + + 1 + m_selWidthLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + 1 + 1 + wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 0 + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + 1 + 0.000000 + 50 + + 0 + + 0 + + 0 + + 1 + m_selWidthCtrl + 1 + + + protected + 1 + + Resizable + 1 + + wxALIGN_RIGHT|wxSP_ARROW_KEYS + ; ; forward_declare + 0 + + + + + + + + + 5 + 2 + 0 + wxTOP|wxRIGHT|wxLEFT + 1 + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + (selection color can be edited in the "Colors" page) + 0 + + 0 + + + 0 + + 1 + m_highlightColorNote + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + 1 + 0 + wxALL|wxALIGN_CENTER_VERTICAL + 3 + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Highlight thickness: + 0 + + 0 + + + 0 + + 1 + m_highlightWidthLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + 1 + 1 + wxALL|wxALIGN_CENTER_VERTICAL + 3 + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + 1 + 0 + 50 + + 0 + + 0 + + 0 + + 1 + m_highlightWidthCtrl + 1 + + + protected + 1 + + Resizable + 1 + + wxALIGN_RIGHT|wxSP_ARROW_KEYS + ; ; forward_declare + 0 + + + + + + + + + + 5 wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT 0 - + 1 1 1 @@ -1272,17 +1620,17 @@ 5 - wxEXPAND|wxRIGHT - 1 + wxEXPAND + 0 - -1,10 + -1,-1 wxBOTH 0 - gbSizer1 - wxFLEX_GROWMODE_SPECIFIED + gbSizer11 + wxFLEX_GROWMODE_ALL none 0 @@ -1321,7 +1669,7 @@ 0 0 wxID_ANY - Selection thickness: + Color highlight thickness: 0 0 @@ -1330,7 +1678,7 @@ 0 1 - m_selWidthLabel + m_colorHighlightLabel 1 @@ -1398,7 +1746,7 @@ 0 1 - m_selWidthCtrl + m_colHighlightThickness 1 @@ -1420,9 +1768,9 @@ 5 - 2 + 1 0 - wxTOP|wxRIGHT|wxLEFT + wxALL|wxALIGN_CENTER_VERTICAL 1 1 @@ -1454,7 +1802,7 @@ 0 0 wxID_ANY - (selection color can be edited in the "Colors" page) + Color highlight opacity: 0 0 @@ -1463,72 +1811,7 @@ 0 1 - m_highlightColorNote - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - - - 5 - 1 - 0 - wxALL|wxALIGN_CENTER_VERTICAL - 3 - 1 - - 1 - 1 - 1 - 1 - 0 - - 0 - 0 - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - Highlight thickness: - 0 - - 0 - - - 0 - - 1 - m_highlightWidthLabel + m_colHighlightLabel2 1 @@ -1553,7 +1836,7 @@ 1 1 wxALL|wxALIGN_CENTER_VERTICAL - 3 + 1 1 1 @@ -1587,7 +1870,7 @@ wxID_ANY 1 0 - 50 + 100 0 @@ -1596,7 +1879,7 @@ 0 1 - m_highlightWidthCtrl + m_colHighlightTransparency 1 @@ -1755,16 +2038,16 @@ 5 wxEXPAND|wxTOP|wxLEFT 0 - + bCrossProbingSizer wxVERTICAL none - + 5 wxBOTTOM|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -1825,11 +2108,11 @@ - + 5 wxBOTTOM|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -1890,11 +2173,11 @@ - + 5 wxBOTTOM|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -1955,11 +2238,11 @@ - + 5 wxBOTTOM|wxRIGHT|wxLEFT 0 - + 1 1 1 diff --git a/eeschema/dialogs/panel_eeschema_display_options_base.h b/eeschema/dialogs/panel_eeschema_display_options_base.h index e667446724..25d40b8449 100644 --- a/eeschema/dialogs/panel_eeschema_display_options_base.h +++ b/eeschema/dialogs/panel_eeschema_display_options_base.h @@ -55,12 +55,16 @@ class PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE : public RESETTABLE_PANEL wxStaticLine* m_staticline2; wxCheckBox* m_checkSelDrawChildItems; wxCheckBox* m_checkSelFillShapes; - wxCheckBox* m_highlightNetclassColors; wxStaticText* m_selWidthLabel; wxSpinCtrlDouble* m_selWidthCtrl; wxStaticText* m_highlightColorNote; wxStaticText* m_highlightWidthLabel; wxSpinCtrlDouble* m_highlightWidthCtrl; + wxCheckBox* m_highlightNetclassColors; + wxStaticText* m_colorHighlightLabel; + wxSpinCtrlDouble* m_colHighlightThickness; + wxStaticText* m_colHighlightLabel2; + wxSpinCtrlDouble* m_colHighlightTransparency; wxStaticText* m_crossprobeLabel; wxStaticLine* m_staticline3; wxCheckBox* m_checkCrossProbeOnSelection; diff --git a/eeschema/eeschema_settings.cpp b/eeschema/eeschema_settings.cpp index 1b59dbd9ec..df8c373a21 100644 --- a/eeschema/eeschema_settings.cpp +++ b/eeschema/eeschema_settings.cpp @@ -373,6 +373,12 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() : m_params.emplace_back( new PARAM( "selection.highlight_netclass_colors", &m_Selection.highlight_netclass_colors, false ) ); + m_params.emplace_back( new PARAM( "selection.highlight_netclass_colors_thickness", + &m_Selection.highlight_netclass_colors_thickness, 15, 0, 50 ) ); + + m_params.emplace_back( new PARAM( "selection.highlight_netclass_colors_alpha", + &m_Selection.highlight_netclass_colors_alpha, 0.6, 0, 1 ) ); + m_params.emplace_back( new PARAM( "annotation.automatic", &m_AnnotatePanel.automatic, true ) ); diff --git a/eeschema/eeschema_settings.h b/eeschema/eeschema_settings.h index 579cd15935..c685216eea 100644 --- a/eeschema/eeschema_settings.h +++ b/eeschema/eeschema_settings.h @@ -179,6 +179,8 @@ public: bool draw_selected_children; bool fill_shapes; bool highlight_netclass_colors; + int highlight_netclass_colors_thickness; + double highlight_netclass_colors_alpha; }; struct PAGE_SETTINGS diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index 09dfc1d7fe..e3e3aa6f88 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -486,7 +486,18 @@ float SCH_PAINTER::getLineWidth( const SCH_ITEM* aItem, bool aDrawingShadows, } if( aDrawingWireColorHighlights ) - width *= 4; + { + float colorHighlightWidth = schIUScale.MilsToIU( 15.0 ); + EESCHEMA_SETTINGS* eeschemaCfg = eeconfig(); + + if( eeschemaCfg ) + { + colorHighlightWidth = schIUScale.MilsToIU( + eeschemaCfg->m_Selection.highlight_netclass_colors_thickness ); + } + + width += colorHighlightWidth; + } return width; } @@ -1353,11 +1364,13 @@ void SCH_PAINTER::draw( const SCH_LINE* aLine, int aLayer ) bool drawingOP = aLayer == LAYER_OP_VOLTAGES; bool highlightNetclassColors = false; + double highlightAlpha = 0.6; EESCHEMA_SETTINGS* eeschemaCfg = eeconfig(); if( eeschemaCfg ) { highlightNetclassColors = eeschemaCfg->m_Selection.highlight_netclass_colors; + highlightAlpha = eeschemaCfg->m_Selection.highlight_netclass_colors_alpha; } if( !highlightNetclassColors && drawingNetColorHighlights ) @@ -1399,7 +1412,7 @@ void SCH_PAINTER::draw( const SCH_LINE* aLine, int aLayer ) return; } - color = color.WithAlpha( color.a * 0.6 ); + color = color.WithAlpha( color.a * highlightAlpha ); } if( ( drawingDangling || drawingShadows ) && !aLine->IsNew() )