Make canvas netclass assignment mirror Setup Dialog assignment.
While it would make more sense to have them both use the old canvas algorithm (of only assigning to the members), I'd be *very* hesitant to change the Setup Dialog and underlying machinery this late in the 6.0 release. Fixes https://gitlab.com/kicad/code/kicad/issues/9160
This commit is contained in:
parent
d7bfd1eb77
commit
cc14dfe3ca
|
@ -31,6 +31,8 @@
|
|||
#include <sch_junction.h>
|
||||
#include <sch_line.h>
|
||||
#include <sch_text.h>
|
||||
#include <project/net_settings.h>
|
||||
#include <project/project_file.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <netclass.h>
|
||||
#include <trigo.h>
|
||||
|
@ -493,13 +495,21 @@ void SCH_BUS_ENTRY_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEM
|
|||
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Bus Entry Type" ), msg ) );
|
||||
|
||||
SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( aFrame );
|
||||
SCH_CONNECTION* conn = dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) ? Connection() : nullptr;
|
||||
|
||||
if( !frame )
|
||||
return;
|
||||
|
||||
if( SCH_CONNECTION* conn = Connection() )
|
||||
if( conn )
|
||||
{
|
||||
conn->AppendInfoToMsgPanel( aList );
|
||||
|
||||
NET_SETTINGS& netSettings = Schematic()->Prj().GetProjectFile().NetSettings();
|
||||
wxString netname = conn->Name();
|
||||
wxString netclassName = netSettings.m_NetClasses.GetDefaultPtr()->GetName();
|
||||
|
||||
if( netSettings.m_NetClassAssignments.count( netname ) )
|
||||
netclassName = netSettings.m_NetClassAssignments[ netname ];
|
||||
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Assigned Netclass" ), netclassName ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -892,11 +892,9 @@ void SCH_LINE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
|
|||
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Line Style" ), msg ) );
|
||||
|
||||
SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( aFrame );
|
||||
SCH_CONNECTION* conn = dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) ? Connection() : nullptr;
|
||||
|
||||
if( frame )
|
||||
{
|
||||
if( SCH_CONNECTION* conn = Connection() )
|
||||
if( conn )
|
||||
{
|
||||
conn->AppendInfoToMsgPanel( aList );
|
||||
|
||||
|
@ -909,7 +907,6 @@ void SCH_LINE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
|
|||
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Assigned Netclass" ), netclassName ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -982,8 +982,7 @@ int SCH_EDITOR_CONTROL::AssignNetclass( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else if( conn->IsBus() && conn->Members().size() == 0 )
|
||||
{
|
||||
m_frame->ShowInfoBarError( _( "Bus must have at least one member to assign a netclass "
|
||||
"to members." ) );
|
||||
m_frame->ShowInfoBarError( _( "Bus has no members to assign netclass to." ) );
|
||||
highlightNet( m_toolMgr, CLEAR );
|
||||
return 0;
|
||||
}
|
||||
|
@ -992,10 +991,10 @@ int SCH_EDITOR_CONTROL::AssignNetclass( const TOOL_EVENT& aEvent )
|
|||
|
||||
if( conn->IsBus() )
|
||||
{
|
||||
for( auto& m : conn->Members() )
|
||||
{
|
||||
netNames.Add( m->Name() );
|
||||
}
|
||||
for( const std::shared_ptr<SCH_CONNECTION>& member : conn->Members() )
|
||||
netNames.Add( member->Name() );
|
||||
|
||||
netNames.Add( conn->Name() );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1014,7 +1013,7 @@ int SCH_EDITOR_CONTROL::AssignNetclass( const TOOL_EVENT& aEvent )
|
|||
defaultItem.Add( _( "Default" ) );
|
||||
items.emplace_back( defaultItem );
|
||||
|
||||
for( const auto& ii : netSettings.m_NetClasses )
|
||||
for( const std::pair<const wxString, NETCLASSPTR>& ii : netSettings.m_NetClasses )
|
||||
{
|
||||
wxArrayString item;
|
||||
item.Add( ii.first );
|
||||
|
@ -1028,7 +1027,7 @@ int SCH_EDITOR_CONTROL::AssignNetclass( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
netclassName = dlg.GetTextSelection();
|
||||
|
||||
for( auto& netName : netNames )
|
||||
for( const wxString& netName : netNames )
|
||||
{
|
||||
// Remove from old netclass membership list
|
||||
if( netSettings.m_NetClassAssignments.count( netName ) )
|
||||
|
|
Loading…
Reference in New Issue