Sort netnames in properties panel

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15590
This commit is contained in:
Seth Hillbrand 2024-03-28 13:02:53 -07:00
parent 075cbfc24f
commit c3a5b92ed0
1 changed files with 13 additions and 1 deletions

View File

@ -260,8 +260,20 @@ void PCB_PROPERTIES_PANEL::updateLists( const BOARD* aBoard )
m_propMgr.GetProperty( TYPE_HASH( PCB_VIA ), _HKI( "Layer Bottom" ) )->SetChoices( layersCu ); m_propMgr.GetProperty( TYPE_HASH( PCB_VIA ), _HKI( "Layer Bottom" ) )->SetChoices( layersCu );
// Regenerate nets // Regenerate nets
std::vector<std::pair<wxString, int>> netNames;
netNames.reserve( aBoard->GetNetInfo().NetsByNetcode().size() );
for( const auto& [ netCode, netInfo ] : aBoard->GetNetInfo().NetsByNetcode() ) for( const auto& [ netCode, netInfo ] : aBoard->GetNetInfo().NetsByNetcode() )
nets.Add( UnescapeString( netInfo->GetNetname() ), netCode ); netNames.emplace_back( UnescapeString( netInfo->GetNetname() ), netCode );
std::sort( netNames.begin(), netNames.end(), []( const auto& a, const auto& b )
{
return a.first.CmpNoCase( b.first ) < 0;
} );
for( const auto& [ netName, netCode ] : netNames )
nets.Add( netName, netCode );
auto netProperty = m_propMgr.GetProperty( TYPE_HASH( BOARD_CONNECTED_ITEM ), _HKI( "Net" ) ); auto netProperty = m_propMgr.GetProperty( TYPE_HASH( BOARD_CONNECTED_ITEM ), _HKI( "Net" ) );
netProperty->SetChoices( nets ); netProperty->SetChoices( nets );