Fixes for line, wire and bus styles.

1) Return the default netclass if an assignment is not found
2) Local overrides have precedence over netclass values

Fixes https://gitlab.com/kicad/code/kicad/issues/5308
This commit is contained in:
Jeff Young 2020-08-24 18:00:19 +01:00
parent d1e2b57d96
commit d5878e552d
4 changed files with 16 additions and 8 deletions

View File

@ -269,7 +269,7 @@ bool SCH_CONNECTION::IsDriver() const
} }
const wxString& SCH_CONNECTION::Name( bool aIgnoreSheet ) const wxString SCH_CONNECTION::Name( bool aIgnoreSheet ) const
{ {
wxASSERT( !m_cached_name.IsEmpty() ); wxASSERT( !m_cached_name.IsEmpty() );
return aIgnoreSheet ? m_cached_name : m_cached_name_with_path; return aIgnoreSheet ? m_cached_name : m_cached_name_with_path;

View File

@ -153,7 +153,7 @@ public:
m_dirty = false; m_dirty = false;
} }
const wxString& Name( bool aIgnoreSheet = false ) const; wxString Name( bool aIgnoreSheet = false ) const;
const wxString& RawName() const const wxString& RawName() const
{ {

View File

@ -167,6 +167,8 @@ NETCLASSPTR SCH_ITEM::NetClass() const
if( !netclassName.IsEmpty() ) if( !netclassName.IsEmpty() )
return netSettings.m_NetClasses.Find( netclassName ); return netSettings.m_NetClasses.Find( netclassName );
else
return netSettings.m_NetClasses.GetDefault();
} }
return nullptr; return nullptr;

View File

@ -208,9 +208,12 @@ void SCH_LINE::SetLineColor( const double r, const double g, const double b, con
COLOR4D SCH_LINE::GetLineColor() const COLOR4D SCH_LINE::GetLineColor() const
{ {
if( m_stroke.GetColor() != COLOR4D::UNSPECIFIED )
return m_stroke.GetColor();
NETCLASSPTR netclass = NetClass(); NETCLASSPTR netclass = NetClass();
if( netclass && netclass->GetSchematicColor() != COLOR4D::UNSPECIFIED ) if( netclass )
return netclass->GetSchematicColor(); return netclass->GetSchematicColor();
return m_stroke.GetColor(); return m_stroke.GetColor();
@ -252,6 +255,9 @@ PLOT_DASH_TYPE SCH_LINE::GetLineStyle() const
PLOT_DASH_TYPE SCH_LINE::GetEffectiveLineStyle() const PLOT_DASH_TYPE SCH_LINE::GetEffectiveLineStyle() const
{ {
if( m_stroke.GetType() != PLOT_DASH_TYPE::DEFAULT )
return m_stroke.GetType();
NETCLASSPTR netclass = NetClass(); NETCLASSPTR netclass = NetClass();
if( netclass ) if( netclass )
@ -823,13 +829,13 @@ void SCH_LINE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
conn->AppendInfoToMsgPanel( aList ); conn->AppendInfoToMsgPanel( aList );
NET_SETTINGS& netSettings = Schematic()->Prj().GetProjectFile().NetSettings(); NET_SETTINGS& netSettings = Schematic()->Prj().GetProjectFile().NetSettings();
const wxString& netname = conn->Name( true ); wxString netname = conn->Name( true );
wxString netclassName = netSettings.m_NetClasses.GetDefaultPtr()->GetName();
if( netSettings.m_NetClassAssignments.count( netname ) ) if( netSettings.m_NetClassAssignments.count( netname ) )
{ netclassName = netSettings.m_NetClassAssignments[ netname ];
const wxString& netclassName = netSettings.m_NetClassAssignments[ netname ];
aList.push_back( MSG_PANEL_ITEM( _( "Assigned Netclass" ), netclassName, DARKRED ) ); aList.push_back( MSG_PANEL_ITEM( _( "Assigned Netclass" ), netclassName, DARKRED ) );
}
} }
} }
} }