Display unit name in symbol context menu

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18285
This commit is contained in:
Ian McInerney 2024-06-27 19:57:14 +01:00
parent bdf70ec869
commit cc81ccf79a
1 changed files with 7 additions and 3 deletions

View File

@ -106,10 +106,14 @@ private:
for( int ii = 0; ii < symbol->GetLibSymbolRef()->GetUnitCount(); ii++ )
{
wxString num_unit;
num_unit.Printf( _( "Unit %s" ), symbol->SubReference( ii + 1, false ) );
wxString unit_text;
wxMenuItem* item = Append( ID_POPUP_SCH_SELECT_UNIT1 + ii, num_unit, wxEmptyString,
if( symbol->GetLibSymbolRef()->HasUnitDisplayName( ii + 1 ) )
unit_text = symbol->GetLibSymbolRef()->GetUnitDisplayName( ii + 1 );
else
unit_text.Printf( _( "Unit %s" ), symbol->SubReference( ii + 1, false ) );
wxMenuItem* item = Append( ID_POPUP_SCH_SELECT_UNIT1 + ii, unit_text, wxEmptyString,
wxITEM_CHECK );
if( unit == ii + 1 )