mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Improve default net pattern to be all members of bus instead of first member.
Fixes https://gitlab.com/kicad/code/kicad/issues/12546
This commit is contained in:
parent
e49de68a59
commit
c089afb408
@ -1235,37 +1235,28 @@ int SCH_EDITOR_CONTROL::AssignNetclass( const TOOL_EVENT& aEvent )
|
|||||||
|
|
||||||
if( conn )
|
if( conn )
|
||||||
{
|
{
|
||||||
if( !conn->IsBus()
|
wxString netName = conn->Name();
|
||||||
&& ( !conn->Driver()
|
|
||||||
|| CONNECTION_SUBGRAPH::GetDriverPriority( conn->Driver() )
|
if( conn->IsBus() )
|
||||||
< CONNECTION_SUBGRAPH::PRIORITY::SHEET_PIN ) )
|
{
|
||||||
|
wxString prefix;
|
||||||
|
|
||||||
|
if( NET_SETTINGS::ParseBusVector( netName, &prefix, nullptr ) )
|
||||||
|
{
|
||||||
|
netName = prefix + wxT( "*" );
|
||||||
|
}
|
||||||
|
else if( NET_SETTINGS::ParseBusGroup( netName, &prefix, nullptr ) )
|
||||||
|
{
|
||||||
|
netName = prefix + wxT( ".*" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( !conn->Driver() || CONNECTION_SUBGRAPH::GetDriverPriority( conn->Driver() )
|
||||||
|
< CONNECTION_SUBGRAPH::PRIORITY::SHEET_PIN )
|
||||||
{
|
{
|
||||||
m_frame->ShowInfoBarError( _( "Net must be labeled to assign a netclass." ) );
|
m_frame->ShowInfoBarError( _( "Net must be labeled to assign a netclass." ) );
|
||||||
highlightNet( m_toolMgr, CLEAR );
|
highlightNet( m_toolMgr, CLEAR );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if( conn->IsBus() && conn->Members().size() == 0 )
|
|
||||||
{
|
|
||||||
m_frame->ShowInfoBarError( _( "Bus has no members to assign netclass to." ) );
|
|
||||||
highlightNet( m_toolMgr, CLEAR );
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxString netName;
|
|
||||||
|
|
||||||
if( conn->IsBus() && conn->Members().size() )
|
|
||||||
{
|
|
||||||
const std::shared_ptr<SCH_CONNECTION>& member = conn->Members()[0];
|
|
||||||
|
|
||||||
if( member->IsBus() && member->Members().size() )
|
|
||||||
netName = member->Members()[0]->Name();
|
|
||||||
else
|
|
||||||
netName = member->Name();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
netName = conn->Name();
|
|
||||||
}
|
|
||||||
|
|
||||||
DIALOG_ASSIGN_NETCLASS dlg( m_frame, netName, schematic.GetNetClassAssignmentCandidates(),
|
DIALOG_ASSIGN_NETCLASS dlg( m_frame, netName, schematic.GetNetClassAssignmentCandidates(),
|
||||||
[&]( const std::vector<wxString>& aNetNames )
|
[&]( const std::vector<wxString>& aNetNames )
|
||||||
@ -1325,7 +1316,14 @@ int SCH_EDITOR_CONTROL::AssignNetclass( const TOOL_EVENT& aEvent )
|
|||||||
m_frame->GetCanvas()->ForceRefresh();
|
m_frame->GetCanvas()->ForceRefresh();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
dlg.ShowModal();
|
if( dlg.ShowModal() )
|
||||||
|
{
|
||||||
|
getView()->UpdateAllItemsConditionally( KIGFX::REPAINT,
|
||||||
|
[]( KIGFX::VIEW_ITEM* aItem ) -> bool
|
||||||
|
{
|
||||||
|
return dynamic_cast<SCH_LINE*>( aItem );
|
||||||
|
} );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
highlightNet( m_toolMgr, CLEAR );
|
highlightNet( m_toolMgr, CLEAR );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user