Fix selection/highlighting of Default netclass
This commit is contained in:
parent
744a8f011e
commit
a36d30656f
|
@ -1890,6 +1890,24 @@ void APPEARANCE_CONTROLS::onNetclassContextMenu( wxCommandEvent& aEvent )
|
||||||
APPEARANCE_SETTING* setting = m_netclassSettingsMap.count( m_contextMenuNetclass ) ?
|
APPEARANCE_SETTING* setting = m_netclassSettingsMap.count( m_contextMenuNetclass ) ?
|
||||||
m_netclassSettingsMap.at( m_contextMenuNetclass ) : nullptr;
|
m_netclassSettingsMap.at( m_contextMenuNetclass ) : nullptr;
|
||||||
|
|
||||||
|
NETCLASSPTR defaultClass = classes.GetDefault();
|
||||||
|
|
||||||
|
auto runOnNetsOfClass =
|
||||||
|
[&]( NETCLASSPTR aClass, std::function<void( NETINFO_ITEM* )> aFunction )
|
||||||
|
{
|
||||||
|
if( aClass == defaultClass )
|
||||||
|
{
|
||||||
|
for( NETINFO_ITEM* net : nets )
|
||||||
|
if( net->GetNetClass() == defaultClass.get() )
|
||||||
|
aFunction( net );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for( const wxString& netName : *aClass )
|
||||||
|
aFunction( nets.GetNetItem( netName ) );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
switch( aEvent.GetId() )
|
switch( aEvent.GetId() )
|
||||||
{
|
{
|
||||||
case ID_SET_NET_COLOR:
|
case ID_SET_NET_COLOR:
|
||||||
|
@ -1919,13 +1937,11 @@ void APPEARANCE_CONTROLS::onNetclassContextMenu( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
if( netclass )
|
if( netclass )
|
||||||
{
|
{
|
||||||
bool first = true;
|
runOnNetsOfClass( netclass,
|
||||||
|
[&]( NETINFO_ITEM* aItem )
|
||||||
for( const wxString& member : *netclass )
|
|
||||||
{
|
{
|
||||||
if( NETINFO_ITEM* net = nets.GetNetItem( member ) )
|
static bool first = true;
|
||||||
{
|
int code = aItem->GetNet();
|
||||||
int code = net->GetNet();
|
|
||||||
|
|
||||||
if( first )
|
if( first )
|
||||||
{
|
{
|
||||||
|
@ -1938,8 +1954,7 @@ void APPEARANCE_CONTROLS::onNetclassContextMenu( wxCommandEvent& aEvent )
|
||||||
board->SetHighLightNet( code, true );
|
board->SetHighLightNet( code, true );
|
||||||
rs->SetHighlight( true, code, true );
|
rs->SetHighlight( true, code, true );
|
||||||
}
|
}
|
||||||
}
|
} );
|
||||||
}
|
|
||||||
|
|
||||||
view->UpdateAllLayersColor();
|
view->UpdateAllLayersColor();
|
||||||
board->HighLightON();
|
board->HighLightON();
|
||||||
|
@ -1951,14 +1966,13 @@ void APPEARANCE_CONTROLS::onNetclassContextMenu( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
if( netclass )
|
if( netclass )
|
||||||
{
|
{
|
||||||
for( const wxString& member : *netclass )
|
runOnNetsOfClass( netclass,
|
||||||
|
[&]( NETINFO_ITEM* aItem )
|
||||||
{
|
{
|
||||||
if( NETINFO_ITEM* net = nets.GetNetItem( member ) )
|
int code = aItem->GetNet();
|
||||||
{
|
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectNet, true,
|
||||||
int code = net->GetNet();
|
code );
|
||||||
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectNet, true, code );
|
} );
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue