diff --git a/eeschema/dialogs/dialog_shape_properties.cpp b/eeschema/dialogs/dialog_shape_properties.cpp index be49786a1d..0e5d419f1a 100644 --- a/eeschema/dialogs/dialog_shape_properties.cpp +++ b/eeschema/dialogs/dialog_shape_properties.cpp @@ -248,30 +248,30 @@ void DIALOG_SHAPE_PROPERTIES::onFillRadioButton( wxCommandEvent& event ) if( event.GetId() == NO_FILL ) { m_rbFillNone->SetValue( true ); - m_fillColorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false ); + m_customColorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false ); } else if( event.GetId() == FILLED_SHAPE ) { m_rbFillOutline->SetValue( true ); - COLOR4D color = m_shape->GetStroke().GetColor(); + COLOR4D color = m_borderColorSwatch->GetSwatchColor(); - if( color == COLOR4D::UNSPECIFIED ) + if( color == COLOR4D::UNSPECIFIED || !m_rbFillOutline->GetValue() ) color = m_frame->GetRenderSettings()->GetLayerColor( LAYER_DEVICE ); - m_fillColorSwatch->SetSwatchColor( color, false ); + m_customColorSwatch->SetSwatchColor( color, false ); } else if( event.GetId() == FILLED_WITH_BG_BODYCOLOR ) { m_rbFillBackground->SetValue( true ); COLOR4D color = m_frame->GetRenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ); - m_fillColorSwatch->SetSwatchColor( color, false ); + m_customColorSwatch->SetSwatchColor( color, false ); } else if( event.GetId() == FILLED_WITH_COLOR ) { m_rbFillCustom->SetValue( true ); - m_fillColorSwatch->GetNewSwatchColor(); + m_customColorSwatch->GetNewSwatchColor(); } } @@ -280,6 +280,19 @@ void DIALOG_SHAPE_PROPERTIES::onBorderSwatch( wxCommandEvent& aEvent ) { if( m_rbFillOutline->GetValue() ) m_fillColorSwatch->SetSwatchColor( m_borderColorSwatch->GetSwatchColor(), false ); + + if( m_rbFillOutline->IsEnabled() && m_rbFillOutline->GetValue() ) + { + COLOR4D color = COLOR4D::UNSPECIFIED; + + if( m_rbFillOutline->GetValue() ) + color = m_fillColorSwatch->GetSwatchColor(); + + if( color == COLOR4D::UNSPECIFIED ) + color = m_frame->GetRenderSettings()->GetLayerColor( LAYER_DEVICE ); + + m_customColorSwatch->SetSwatchColor( color, false ); + } } diff --git a/eeschema/dialogs/dialog_shape_properties_base.cpp b/eeschema/dialogs/dialog_shape_properties_base.cpp index 916fdf5a6e..bae739dc84 100644 --- a/eeschema/dialogs/dialog_shape_properties_base.cpp +++ b/eeschema/dialogs/dialog_shape_properties_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf) +// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf02) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -16,9 +16,9 @@ BEGIN_EVENT_TABLE( DIALOG_SHAPE_PROPERTIES_BASE, DIALOG_SHIM ) EVT_CHECKBOX( wxID_ANY, DIALOG_SHAPE_PROPERTIES_BASE::_wxFB_onBorderChecked ) EVT_CHECKBOX( wxID_ANY, DIALOG_SHAPE_PROPERTIES_BASE::_wxFB_onFillChecked ) EVT_RADIOBUTTON( NO_FILL, DIALOG_SHAPE_PROPERTIES_BASE::_wxFB_onFillRadioButton ) - EVT_RADIOBUTTON( FILLED_SHAPE, DIALOG_SHAPE_PROPERTIES_BASE::_wxFB_onFill ) - EVT_RADIOBUTTON( FILLED_WITH_BG_BODYCOLOR, DIALOG_SHAPE_PROPERTIES_BASE::_wxFB_onFill ) - EVT_RADIOBUTTON( FILLED_WITH_COLOR, DIALOG_SHAPE_PROPERTIES_BASE::_wxFB_onFill ) + EVT_RADIOBUTTON( FILLED_SHAPE, DIALOG_SHAPE_PROPERTIES_BASE::_wxFB_onFillRadioButton ) + EVT_RADIOBUTTON( FILLED_WITH_BG_BODYCOLOR, DIALOG_SHAPE_PROPERTIES_BASE::_wxFB_onFillRadioButton ) + EVT_RADIOBUTTON( FILLED_WITH_COLOR, DIALOG_SHAPE_PROPERTIES_BASE::_wxFB_onFillRadioButton ) END_EVENT_TABLE() DIALOG_SHAPE_PROPERTIES_BASE::DIALOG_SHAPE_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) @@ -174,7 +174,7 @@ DIALOG_SHAPE_PROPERTIES_BASE::DIALOG_SHAPE_PROPERTIES_BASE( wxWindow* parent, wx m_rbFillCustom = new wxRadioButton( bSizerFill->GetStaticBox(), FILLED_WITH_COLOR, _("Fill with:"), wxDefaultPosition, wxDefaultSize, 0 ); gbSizer1->Add( m_rbFillCustom, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 ); - m_customColorSwatch = new COLOR_SWATCH( bSizerFill->GetStaticBox(), FILLED_WITH_COLOR, wxDefaultPosition, wxDefaultSize, 0 ); + m_customColorSwatch = new COLOR_SWATCH( bSizerFill->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); gbSizer1->Add( m_customColorSwatch, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); diff --git a/eeschema/dialogs/dialog_shape_properties_base.fbp b/eeschema/dialogs/dialog_shape_properties_base.fbp index bd961893ec..8a2c9713e5 100644 --- a/eeschema/dialogs/dialog_shape_properties_base.fbp +++ b/eeschema/dialogs/dialog_shape_properties_base.fbp @@ -1527,7 +1527,7 @@ - onFill + onFillRadioButton @@ -1596,7 +1596,7 @@ - onFill + onFillRadioButton @@ -1665,7 +1665,7 @@ - onFill + onFillRadioButton @@ -1706,7 +1706,7 @@ 0 0 - FILLED_WITH_COLOR + wxID_ANY 0 diff --git a/eeschema/dialogs/dialog_shape_properties_base.h b/eeschema/dialogs/dialog_shape_properties_base.h index 56a4f776cf..6538ca6b25 100644 --- a/eeschema/dialogs/dialog_shape_properties_base.h +++ b/eeschema/dialogs/dialog_shape_properties_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf) +// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf02) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -47,7 +47,6 @@ class DIALOG_SHAPE_PROPERTIES_BASE : public DIALOG_SHIM void _wxFB_onBorderChecked( wxCommandEvent& event ){ onBorderChecked( event ); } void _wxFB_onFillChecked( wxCommandEvent& event ){ onFillChecked( event ); } void _wxFB_onFillRadioButton( wxCommandEvent& event ){ onFillRadioButton( event ); } - void _wxFB_onFill( wxCommandEvent& event ){ onFill( event ); } protected: @@ -97,7 +96,6 @@ class DIALOG_SHAPE_PROPERTIES_BASE : public DIALOG_SHIM virtual void onBorderChecked( wxCommandEvent& event ) { event.Skip(); } virtual void onFillChecked( wxCommandEvent& event ) { event.Skip(); } virtual void onFillRadioButton( wxCommandEvent& event ) { event.Skip(); } - virtual void onFill( wxCommandEvent& event ) { event.Skip(); } public: diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index bbcc0b1934..6b1d05fd6c 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -315,10 +315,21 @@ float SCH_PAINTER::getShadowWidth( bool aForHighlight ) const } +// A helper function to know if a EDA_ITEM is a member of a footprint +static bool IsItemFPMember( const EDA_ITEM* aItem ) +{ + return aItem->GetParent() && ( aItem->GetParent()->Type() == LIB_SYMBOL_T + || aItem->GetParent()->Type() == SCH_SYMBOL_T ); +} + + COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDrawingShadows, bool aDimmed ) const { COLOR4D color = m_schSettings.GetLayerColor( aLayer ); + // Graphic items of a SYMBOL frequently use the LAYER_DEVICE layer color + // (i.e. when no specific color is set) + bool isFpMember = IsItemFPMember( aItem ); if( aItem->Type() == SCH_LINE_T ) { @@ -348,14 +359,22 @@ COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDr const SCH_SHAPE* shape = static_cast( aItem ); if( aLayer == LAYER_DEVICE_BACKGROUND || aLayer == LAYER_NOTES_BACKGROUND ) - color = shape->GetFillColor(); + { + if( !isFpMember || shape->GetFillColor() != COLOR4D::UNSPECIFIED ) + color = shape->GetFillColor(); + if( isFpMember && shape->GetFillMode() == FILL_T::FILLED_SHAPE ) + color = shape->GetStroke().GetColor(); + } else - color = shape->GetStroke().GetColor(); + { + if( !isFpMember || shape->GetStroke().GetColor() != COLOR4D::UNSPECIFIED ) + color = shape->GetStroke().GetColor(); + } // A filled shape means filled; if they didn't specify a fill colour then use the // border colour. if( color == COLOR4D::UNSPECIFIED ) - color = m_schSettings.GetLayerColor( LAYER_NOTES ); + color = m_schSettings.GetLayerColor( isFpMember ? LAYER_DEVICE : LAYER_NOTES ); } else if( aItem->IsType( { SCH_LABEL_LOCATE_ANY_T } ) ) { @@ -371,12 +390,13 @@ COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDr if( aLayer == LAYER_DEVICE_BACKGROUND || aLayer == LAYER_NOTES_BACKGROUND ) color = textBox->GetFillColor(); - else + else if( !isFpMember || textBox->GetTextColor() != COLOR4D::UNSPECIFIED ) color = textBox->GetTextColor(); } else if( const EDA_TEXT* otherTextItem = dynamic_cast( aItem ) ) { - color = otherTextItem->GetTextColor(); + if( !isFpMember || otherTextItem->GetTextColor() != COLOR4D::UNSPECIFIED ) + color = otherTextItem->GetTextColor(); } } @@ -1679,7 +1699,9 @@ void SCH_PAINTER::draw( const SCH_TEXT* aText, int aLayer, bool aDimmed ) case SCH_HIER_LABEL_T: aLayer = LAYER_HIERLABEL; break; case SCH_GLOBAL_LABEL_T: aLayer = LAYER_GLOBLABEL; break; case SCH_DIRECTIVE_LABEL_T: aLayer = LAYER_NETCLASS_REFS; break; - case SCH_LABEL_T: aLayer = LAYER_LOCLABEL; break; + case SCH_TEXT_T: + aLayer = IsItemFPMember( aText ) ? LAYER_DEVICE : LAYER_NOTES; + break; default: aLayer = LAYER_NOTES; break; }