Add highlight shadows for highlighted nets.

Fixes https://gitlab.com/kicad/code/kicad/issues/8817
This commit is contained in:
Jeff Young 2021-09-15 21:03:07 +01:00
parent 4ba3937f8a
commit f7721dd274
9 changed files with 322 additions and 152 deletions

View File

@ -53,7 +53,8 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataToWindow()
m_checkSelTextBox->SetValue( cfg->m_Selection.text_as_box );
m_checkSelDrawChildItems->SetValue( cfg->m_Selection.draw_selected_children );
m_checkSelFillShapes->SetValue( cfg->m_Selection.fill_shapes );
m_selWidthCtrl->SetValue( cfg->m_Selection.thickness );
m_selWidthCtrl->SetValue( cfg->m_Selection.selection_thickness );
m_highlightWidthCtrl->SetValue( cfg->m_Selection.highlight_thickness );
m_checkCrossProbeCenter->SetValue( cfg->m_CrossProbing.center_on_items );
m_checkCrossProbeZoom->SetValue( cfg->m_CrossProbing.zoom_to_fit );
@ -77,7 +78,8 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow()
cfg->m_Selection.text_as_box = m_checkSelTextBox->GetValue();
cfg->m_Selection.draw_selected_children = m_checkSelDrawChildItems->GetValue();
cfg->m_Selection.fill_shapes = m_checkSelFillShapes->GetValue();
cfg->m_Selection.thickness = KiROUND( m_selWidthCtrl->GetValue() );
cfg->m_Selection.selection_thickness = KiROUND( m_selWidthCtrl->GetValue() );
cfg->m_Selection.highlight_thickness = KiROUND( m_highlightWidthCtrl->GetValue() );
cfg->m_CrossProbing.center_on_items = m_checkCrossProbeCenter->GetValue();
cfg->m_CrossProbing.zoom_to_fit = m_checkCrossProbeZoom->GetValue();

View File

@ -39,7 +39,7 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWind
bRightColumn->Add( sbSizer1, 0, wxEXPAND|wxTOP, 5 );
wxStaticBoxSizer* sbSizer3;
sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Selection") ), wxVERTICAL );
sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Selection && Highlighting") ), wxVERTICAL );
m_checkSelTextBox = new wxCheckBox( sbSizer3->GetStaticBox(), wxID_ANY, _("Draw selected text items as box"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer3->Add( m_checkSelTextBox, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
@ -50,26 +50,34 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWind
m_checkSelFillShapes = new wxCheckBox( sbSizer3->GetStaticBox(), wxID_ANY, _("Fill selected shapes"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer3->Add( m_checkSelFillShapes, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxFlexGridSizer* fgSizer321;
fgSizer321 = new wxFlexGridSizer( 0, 2, 3, 0 );
fgSizer321->AddGrowableCol( 1 );
fgSizer321->SetFlexibleDirection( wxBOTH );
fgSizer321->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
wxGridBagSizer* gbSizer1;
gbSizer1 = new wxGridBagSizer( 0, 0 );
gbSizer1->SetFlexibleDirection( wxBOTH );
gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
gbSizer1->SetEmptyCellSize( wxSize( -1,10 ) );
m_selWidthLabel = new wxStaticText( sbSizer3->GetStaticBox(), wxID_ANY, _("&Highlight thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
m_selWidthLabel = new wxStaticText( sbSizer3->GetStaticBox(), wxID_ANY, _("Selection thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
m_selWidthLabel->Wrap( -1 );
fgSizer321->Add( m_selWidthLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
gbSizer1->Add( m_selWidthLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_selWidthCtrl = new wxSpinCtrlDouble( sbSizer3->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxSP_ARROW_KEYS, 0, 50, 0, 1 );
m_selWidthCtrl->SetDigits( 0 );
fgSizer321->Add( m_selWidthCtrl, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
gbSizer1->Add( m_selWidthCtrl, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
sbSizer3->Add( fgSizer321, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_highlightColorNote = new wxStaticText( sbSizer3->GetStaticBox(), wxID_ANY, _("(highlight color can be edited in the \"Colors\" page)"), wxDefaultPosition, wxDefaultSize, 0 );
m_highlightColorNote = new wxStaticText( sbSizer3->GetStaticBox(), wxID_ANY, _("(selection color can be edited in the \"Colors\" page)"), wxDefaultPosition, wxDefaultSize, 0 );
m_highlightColorNote->Wrap( -1 );
sbSizer3->Add( m_highlightColorNote, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
gbSizer1->Add( m_highlightColorNote, wxGBPosition( 1, 0 ), wxGBSpan( 1, 2 ), wxALL, 5 );
m_highlightWidthLabel = new wxStaticText( sbSizer3->GetStaticBox(), wxID_ANY, _("Highlight thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
m_highlightWidthLabel->Wrap( -1 );
gbSizer1->Add( m_highlightWidthLabel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_highlightWidthCtrl = new wxSpinCtrlDouble( sbSizer3->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxSP_ARROW_KEYS, 0, 50, 0, 1 );
m_highlightWidthCtrl->SetDigits( 0 );
gbSizer1->Add( m_highlightWidthCtrl, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_VERTICAL, 5 );
sbSizer3->Add( gbSizer1, 1, wxEXPAND, 5 );
bRightColumn->Add( sbSizer3, 0, wxTOP|wxEXPAND, 5 );

View File

@ -286,7 +286,7 @@
<property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Selection</property>
<property name="label">Selection &amp;&amp; Highlighting</property>
<property name="minimum_size"></property>
<property name="name">sbSizer3</property>
<property name="orient">wxVERTICAL</property>
@ -486,24 +486,26 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">2</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxGridBagSizer" expanded="1">
<property name="empty_cell_size">-1,10</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">1</property>
<property name="growablecols"></property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size">-1,-1</property>
<property name="name">fgSizer321</property>
<property name="minimum_size"></property>
<property name="name">gbSizer1</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">0</property>
<property name="vgap">3</property>
<object class="sizeritem" expanded="1">
<property name="vgap">0</property>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL</property>
<property name="row">0</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
@ -532,7 +534,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">&amp;Highlight thickness:</property>
<property name="label">Selection thickness:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@ -561,10 +563,13 @@
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
<property name="proportion">0</property>
<property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL</property>
<property name="row">0</property>
<property name="rowspan">1</property>
<object class="wxSpinCtrlDouble" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
@ -625,12 +630,13 @@
<property name="window_style"></property>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<property name="colspan">2</property>
<property name="column">0</property>
<property name="flag">wxALL</property>
<property name="row">1</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
@ -659,7 +665,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">(highlight color can be edited in the &quot;Colors&quot; page)</property>
<property name="label">(selection color can be edited in the &quot;Colors&quot; page)</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@ -688,6 +694,139 @@
<property name="wrap">-1</property>
</object>
</object>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="row">3</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Highlight thickness:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_highlightWidthLabel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="row">3</property>
<property name="rowspan">1</property>
<object class="wxSpinCtrlDouble" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="digits">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="inc">1</property>
<property name="initial">0</property>
<property name="max">50</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_highlightWidthCtrl</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxALIGN_RIGHT|wxSP_ARROW_KEYS</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">

View File

@ -20,6 +20,7 @@
#include <wx/statbox.h>
#include <wx/stattext.h>
#include <wx/spinctrl.h>
#include <wx/gbsizer.h>
#include <wx/panel.h>
///////////////////////////////////////////////////////////////////////////
@ -42,6 +43,8 @@ class PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE : public wxPanel
wxStaticText* m_selWidthLabel;
wxSpinCtrlDouble* m_selWidthCtrl;
wxStaticText* m_highlightColorNote;
wxStaticText* m_highlightWidthLabel;
wxSpinCtrlDouble* m_highlightWidthCtrl;
wxCheckBox* m_checkCrossProbeCenter;
wxCheckBox* m_checkCrossProbeZoom;
wxCheckBox* m_checkCrossProbeAutoHighlight;

View File

@ -55,6 +55,7 @@
#include <panel_eeschema_editing_options.h>
#include <panel_sym_editing_options.h>
#include <dialogs/panel_gal_display_options.h>
#include <panel_eeschema_display_options.h>
// The main sheet of the project
SCH_SHEET* g_RootSheet = nullptr;
@ -217,7 +218,7 @@ static struct IFACE : public KIFACE_BASE
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
APP_SETTINGS_BASE* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>();
return new PANEL_GAL_DISPLAY_OPTIONS( aParent, cfg );
return new PANEL_EESCHEMA_DISPLAY_OPTIONS( aParent, cfg );
}
case PANEL_SCH_EDIT_OPTIONS:

View File

@ -174,7 +174,10 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() :
&m_Input.drag_is_move, false ) );
m_params.emplace_back( new PARAM<int>( "selection.thickness",
&m_Selection.thickness, 3 ) );
&m_Selection.selection_thickness, 3 ) );
m_params.emplace_back( new PARAM<int>( "selection.highlight_thickness",
&m_Selection.highlight_thickness, 2 ) );
m_params.emplace_back( new PARAM<bool>( "selection.draw_selected_children",
&m_Selection.draw_selected_children, true ) );

View File

@ -118,7 +118,8 @@ public:
struct SELECTION
{
int thickness;
int selection_thickness;
int highlight_thickness;
bool draw_selected_children;
bool fill_shapes;
bool select_pin_selects_symbol;

View File

@ -263,14 +263,16 @@ bool SCH_PAINTER::isUnitAndConversionShown( const LIB_ITEM* aItem ) const
}
float SCH_PAINTER::getShadowWidth() const
float SCH_PAINTER::getShadowWidth( bool aForHighlight ) const
{
const MATRIX3x3D& matrix = m_gal->GetScreenWorldMatrix();
int milsWidth = aForHighlight ? eeconfig()->m_Selection.highlight_thickness
: eeconfig()->m_Selection.selection_thickness;
// For best visuals the selection width must be a cross between the zoom level and the
// default line width.
return (float) std::fabs( matrix.GetScale().x * 2.75 ) +
Mils2iu( eeconfig()->m_Selection.thickness );
return (float) std::fabs( matrix.GetScale().x * milsWidth ) + Mils2iu( milsWidth );
}
@ -314,11 +316,13 @@ COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDr
color = m_schSettings.GetLayerColor( aLayer );
}
if( aItem->IsBrightened() && !aDrawingShadows ) // Selection disambiguation, etc.
if( aItem->IsBrightened() ) // Selection disambiguation, net highlighting, etc.
{
color = m_schSettings.GetLayerColor( LAYER_BRIGHTENED );
if( aLayer == LAYER_DEVICE_BACKGROUND || aLayer == LAYER_SHEET_BACKGROUND )
if( aDrawingShadows )
color = color.WithAlpha( 0.15 );
else if( aLayer == LAYER_DEVICE_BACKGROUND || aLayer == LAYER_SHEET_BACKGROUND )
color = color.WithAlpha( 0.2 );
}
else if( aItem->IsSelected() )
@ -341,8 +345,8 @@ float SCH_PAINTER::getLineWidth( const LIB_ITEM* aItem, bool aDrawingShadows ) c
{
float width = (float) aItem->GetEffectivePenWidth( &m_schSettings );
if( aItem->IsSelected() && aDrawingShadows )
width += getShadowWidth();
if( ( aItem->IsBrightened() || aItem->IsSelected() ) && aDrawingShadows )
width += getShadowWidth( aItem->IsBrightened() );
return width;
}
@ -354,8 +358,8 @@ float SCH_PAINTER::getLineWidth( const SCH_ITEM* aItem, bool aDrawingShadows ) c
float width = (float) aItem->GetPenWidth();
if( aItem->IsSelected() && aDrawingShadows )
width += getShadowWidth();
if( ( aItem->IsBrightened() || aItem->IsSelected() ) && aDrawingShadows )
width += getShadowWidth( aItem->IsBrightened() );
return std::max( width, 1.0f );
}
@ -365,8 +369,8 @@ float SCH_PAINTER::getTextThickness( const SCH_TEXT* aItem, bool aDrawingShadows
{
float width = (float) aItem->GetEffectiveTextPenWidth( m_schSettings.GetDefaultPenWidth() );
if( aItem->IsSelected() && aDrawingShadows )
width += getShadowWidth();
if( ( aItem->IsBrightened() || aItem->IsSelected() ) && aDrawingShadows )
width += getShadowWidth( aItem->IsBrightened() );
return width;
}
@ -376,8 +380,8 @@ float SCH_PAINTER::getTextThickness( const SCH_FIELD* aItem, bool aDrawingShadow
{
float width = (float) aItem->GetEffectiveTextPenWidth( m_schSettings.GetDefaultPenWidth() );
if( aItem->IsSelected() && aDrawingShadows )
width += getShadowWidth();
if( ( aItem->IsBrightened() || aItem->IsSelected() ) && aDrawingShadows )
width += getShadowWidth( aItem->IsBrightened() );
return width;
}
@ -388,8 +392,8 @@ float SCH_PAINTER::getTextThickness( const LIB_FIELD* aItem, bool aDrawingShadow
float width = (float) std::max( aItem->GetEffectiveTextPenWidth(),
m_schSettings.GetDefaultPenWidth() );
if( aItem->IsSelected() && aDrawingShadows )
width += getShadowWidth();
if( ( aItem->IsBrightened() || aItem->IsSelected() ) && aDrawingShadows )
width += getShadowWidth( aItem->IsBrightened() );
return width;
}
@ -400,8 +404,8 @@ float SCH_PAINTER::getTextThickness( const LIB_TEXT* aItem, bool aDrawingShadows
float width = (float) std::max( aItem->GetEffectiveTextPenWidth(),
m_schSettings.GetDefaultPenWidth() );
if( aItem->IsSelected() && aDrawingShadows )
width += getShadowWidth();
if( ( aItem->IsBrightened() || aItem->IsSelected() ) && aDrawingShadows )
width += getShadowWidth( aItem->IsBrightened() );
return width;
}
@ -490,7 +494,7 @@ bool SCH_PAINTER::setDeviceColors( const LIB_ITEM* aItem, int aLayer )
switch( aLayer )
{
case LAYER_SELECTION_SHADOWS:
if( aItem->IsSelected() )
if( aItem->IsBrightened() || aItem->IsSelected() )
{
m_gal->SetIsFill( false );
m_gal->SetIsStroke( true );
@ -614,7 +618,7 @@ void SCH_PAINTER::draw( const LIB_FIELD *aField, int aLayer )
{
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
if( drawingShadows && !aField->IsSelected() )
if( drawingShadows && !( aField->IsBrightened() || aField->IsSelected() ) )
return;
if( !isUnitAndConversionShown( aField ) )
@ -689,7 +693,7 @@ void SCH_PAINTER::draw( const LIB_TEXT *aText, int aLayer )
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
if( drawingShadows && !aText->IsSelected() )
if( drawingShadows && !( aText->IsBrightened() || aText->IsSelected() ) )
return;
COLOR4D color = getRenderColor( aText, LAYER_DEVICE, drawingShadows );
@ -743,7 +747,7 @@ int SCH_PAINTER::externalPinDecoSize( const LIB_PIN &aPin )
// Draw the target (an open circle) for a pin which has no connection or is being moved.
void SCH_PAINTER::drawPinDanglingSymbol( const VECTOR2I& aPos, const COLOR4D& aColor,
bool aDrawingShadows )
bool aDrawingShadows, bool aBrightened )
{
// Dangling symbols must be drawn in a slightly different colour so they can be seen when
// they overlap with a junction dot.
@ -751,7 +755,7 @@ void SCH_PAINTER::drawPinDanglingSymbol( const VECTOR2I& aPos, const COLOR4D& aC
m_gal->SetIsFill( false );
m_gal->SetIsStroke( true );
m_gal->SetLineWidth( aDrawingShadows ? getShadowWidth()
m_gal->SetLineWidth( aDrawingShadows ? getShadowWidth( aBrightened )
: m_schSettings.GetDanglineSymbolThickness() );
m_gal->DrawCircle( aPos, TARGET_PIN_RADIUS );
@ -767,7 +771,7 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
bool drawingDangling = aLayer == LAYER_DANGLING;
bool isDangling = m_schSettings.m_IsSymbolEditor || aPin->HasFlag( IS_DANGLING );
if( drawingShadows && !aPin->IsSelected() )
if( drawingShadows && !( aPin->IsBrightened() || aPin->IsSelected() ) )
return;
VECTOR2I pos = mapCoords( aPin->GetPosition() );
@ -782,7 +786,7 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
else
{
if( drawingDangling && isDangling && aPin->IsPowerConnection() )
drawPinDanglingSymbol( pos, color, drawingShadows );
drawPinDanglingSymbol( pos, color, drawingShadows, aPin->IsBrightened() );
return;
}
@ -791,7 +795,7 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
if( drawingDangling )
{
if( isDangling )
drawPinDanglingSymbol( pos, color, drawingShadows );
drawPinDanglingSymbol( pos, color, drawingShadows, aPin->IsBrightened() );
return;
}
@ -1028,7 +1032,7 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
if( drawingShadows )
{
float shadowWidth = getShadowWidth();
float shadowWidth = getShadowWidth( aPin->IsBrightened() );
if( eeconfig()->m_Selection.text_as_box )
{
@ -1204,7 +1208,7 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
// Draw the target (an open square) for a wire or label which has no connection or is
// being moved.
void SCH_PAINTER::drawDanglingSymbol( const wxPoint& aPos, const COLOR4D& aColor, int aWidth,
bool aDrawingShadows )
bool aDrawingShadows, bool aBrightened )
{
wxPoint radius( aWidth + Mils2iu( DANGLING_SYMBOL_SIZE / 2 ),
aWidth + Mils2iu( DANGLING_SYMBOL_SIZE / 2 ) );
@ -1214,7 +1218,7 @@ void SCH_PAINTER::drawDanglingSymbol( const wxPoint& aPos, const COLOR4D& aColor
m_gal->SetStrokeColor( aColor.Brightened( 0.3 ) );
m_gal->SetIsStroke( true );
m_gal->SetIsFill( false );
m_gal->SetLineWidth( aDrawingShadows ? getShadowWidth()
m_gal->SetLineWidth( aDrawingShadows ? getShadowWidth( aBrightened )
: m_schSettings.GetDanglineSymbolThickness() );
m_gal->DrawRectangle( aPos - radius, aPos + radius );
@ -1225,7 +1229,7 @@ void SCH_PAINTER::draw( const SCH_JUNCTION *aJct, int aLayer )
{
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
if( drawingShadows && !aJct->IsSelected() )
if( drawingShadows && !( aJct->IsBrightened() || aJct->IsSelected() ) )
return;
COLOR4D color = getRenderColor( aJct, aJct->GetLayer(), drawingShadows );
@ -1249,7 +1253,7 @@ void SCH_PAINTER::draw( const SCH_LINE *aLine, int aLayer )
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
bool drawingDangling = aLayer == LAYER_DANGLING;
if( drawingShadows && !aLine->IsSelected() )
if( drawingShadows && !( aLine->IsBrightened() || aLine->IsSelected() ) )
return;
COLOR4D color = getRenderColor( aLine, aLine->GetLayer(), drawingShadows );
@ -1260,14 +1264,14 @@ void SCH_PAINTER::draw( const SCH_LINE *aLine, int aLayer )
{
if( aLine->IsStartDangling() && aLine->IsWire() )
{
drawDanglingSymbol( aLine->GetStartPoint(), color,
getLineWidth( aLine, drawingShadows ), drawingShadows );
drawDanglingSymbol( aLine->GetStartPoint(), color, getLineWidth( aLine, drawingShadows ),
drawingShadows, aLine->IsBrightened() );
}
if( aLine->IsEndDangling() && aLine->IsWire() )
{
drawDanglingSymbol( aLine->GetEndPoint(), color,
getLineWidth( aLine, drawingShadows ), drawingShadows );
drawDanglingSymbol( aLine->GetEndPoint(), color, getLineWidth( aLine, drawingShadows ),
drawingShadows, aLine->IsBrightened() );
}
return;
@ -1299,7 +1303,7 @@ void SCH_PAINTER::draw( const SCH_SHAPE* aShape, int aLayer )
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
PLOT_DASH_TYPE lineStyle = aShape->GetEffectiveLineStyle();
if( drawingShadows && !aShape->IsSelected() )
if( drawingShadows && !( aShape->IsBrightened() || aShape->IsSelected() ) )
return;
auto drawShape =
@ -1407,7 +1411,7 @@ void SCH_PAINTER::draw( const SCH_TEXT *aText, int aLayer )
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
bool drawingDangling = aLayer == LAYER_DANGLING;
if( drawingShadows && !aText->IsSelected() )
if( drawingShadows && !( aText->IsBrightened() || aText->IsSelected() ) )
return;
switch( aText->Type() )
@ -1445,7 +1449,7 @@ void SCH_PAINTER::draw( const SCH_TEXT *aText, int aLayer )
if( aText->IsDangling() )
{
drawDanglingSymbol( aText->GetTextPos(), color, Mils2iu( DANGLING_SYMBOL_SIZE / 2 ),
drawingShadows );
drawingShadows, aText->IsBrightened() );
}
return;
@ -1470,7 +1474,7 @@ void SCH_PAINTER::draw( const SCH_TEXT *aText, int aLayer )
return;
}
float shadowWidth = getShadowWidth();
float shadowWidth = getShadowWidth( aText->IsBrightened() );
switch( aText->GetLabelSpinStyle() )
{
@ -1596,7 +1600,7 @@ void SCH_PAINTER::draw( const SCH_FIELD *aField, int aLayer )
{
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
if( drawingShadows && !aField->IsSelected() )
if( drawingShadows && !( aField->IsBrightened() || aField->IsSelected() ) )
return;
aLayer = aField->GetLayer();
@ -1733,7 +1737,7 @@ void SCH_PAINTER::draw( SCH_HIERLABEL *aLabel, int aLayer )
{
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
if( drawingShadows && !aLabel->IsSelected() )
if( drawingShadows && !( aLabel->IsBrightened() || aLabel->IsSelected() ) )
return;
COLOR4D color = getRenderColor( aLabel, LAYER_HIERLABEL, drawingShadows );
@ -1776,13 +1780,21 @@ void SCH_PAINTER::draw( const SCH_SHEET *aSheet, int aLayer )
{
for( SCH_SHEET_PIN* sheetPin : aSheet->GetPins() )
{
if( drawingShadows && !aSheet->IsSelected() && !sheetPin->IsSelected() )
continue;
if( drawingShadows && aSheet->IsSelected()
&& !eeconfig()->m_Selection.draw_selected_children )
if( drawingShadows )
{
break;
if( ( aSheet->IsBrightened() || aSheet->IsSelected() )
&& eeconfig()->m_Selection.draw_selected_children )
{
// fall through to draw
}
else if( sheetPin->IsBrightened() || sheetPin->IsSelected() )
{
// fall through to draw
}
else
{
continue;
}
}
int width = std::max( aSheet->GetPenWidth(), m_schSettings.GetDefaultPenWidth() );
@ -1827,7 +1839,7 @@ void SCH_PAINTER::draw( const SCH_SHEET *aSheet, int aLayer )
m_gal->DrawRectangle( pos, pos + size );
if( drawingShadows && !eeconfig()->m_Selection.draw_selected_children && aSheet->IsSelected() )
if( drawingShadows && !eeconfig()->m_Selection.draw_selected_children )
return;
for( const SCH_FIELD& field : aSheet->GetFields() )
@ -1840,7 +1852,7 @@ void SCH_PAINTER::draw( const SCH_NO_CONNECT *aNC, int aLayer )
{
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
if( drawingShadows && !aNC->IsSelected() )
if( drawingShadows && !( aNC->IsBrightened() || aNC->IsSelected() ) )
return;
m_gal->SetIsStroke( true );
@ -1863,7 +1875,7 @@ void SCH_PAINTER::draw( const SCH_BUS_ENTRY_BASE *aEntry, int aLayer )
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
bool drawingDangling = aLayer == LAYER_DANGLING;
if( drawingShadows && !aEntry->IsSelected() )
if( drawingShadows && !( aEntry->IsBrightened() || aEntry->IsSelected() ) )
return;
if( aEntry->IsSelected() )
@ -1886,7 +1898,8 @@ void SCH_PAINTER::draw( const SCH_BUS_ENTRY_BASE *aEntry, int aLayer )
m_gal->SetIsFill( false );
m_gal->SetIsStroke( true );
m_gal->SetStrokeColor( color.Brightened( 0.3 ) );
m_gal->SetLineWidth( m_schSettings.GetDanglineSymbolThickness() );
m_gal->SetLineWidth( drawingShadows ? getShadowWidth( aEntry->IsBrightened() )
: m_schSettings.GetDanglineSymbolThickness() );
if( aEntry->IsDanglingStart() )
{
@ -1934,7 +1947,7 @@ void SCH_PAINTER::draw( const SCH_BITMAP *aBitmap, int aLayer )
COLOR4D color = getRenderColor( aBitmap, LAYER_DRAW_BITMAPS, true );
m_gal->SetIsStroke( true );
m_gal->SetStrokeColor( color );
m_gal->SetLineWidth ( getShadowWidth() );
m_gal->SetLineWidth ( getShadowWidth( aBitmap->IsBrightened() ) );
m_gal->SetIsFill( false );
// Draws a bounding box.
@ -1959,7 +1972,7 @@ void SCH_PAINTER::draw( const SCH_MARKER *aMarker, int aLayer )
{
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
if( drawingShadows && !aMarker->IsSelected() )
if( drawingShadows && !( aMarker->IsBrightened() || aMarker->IsSelected() ) )
return;
COLOR4D color = getRenderColor( aMarker, aMarker->GetColorLayer(), drawingShadows );

View File

@ -169,16 +169,16 @@ private:
void draw( const SCH_BUS_ENTRY_BASE* aEntry, int aLayer );
void drawPinDanglingSymbol( const VECTOR2I& aPos, const COLOR4D& aColor,
bool aDrawingShadows );
bool aDrawingShadows, bool aBrightened );
void drawDanglingSymbol( const wxPoint& aPos, const COLOR4D& aColor, int aWidth,
bool aDrawingShadows );
bool aDrawingShadows, bool aBrightened );
int internalPinDecoSize( const LIB_PIN &aPin );
int externalPinDecoSize( const LIB_PIN &aPin );
bool isUnitAndConversionShown( const LIB_ITEM* aItem ) const;
float getShadowWidth() const;
float getShadowWidth( bool aForHighlight ) const;
COLOR4D getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDrawingShadows ) const;
float getLineWidth( const LIB_ITEM* aItem, bool aDrawingShadows ) const;
float getLineWidth( const SCH_ITEM* aItem, bool aDrawingShadows ) const;