From cc81ccf79aabd27ce9b4afb94bca607076f677f3 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Thu, 27 Jun 2024 19:57:14 +0100 Subject: [PATCH] Display unit name in symbol context menu Fixes https://gitlab.com/kicad/code/kicad/-/issues/18285 --- eeschema/tools/sch_edit_tool.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index 5a1a526305..cab326a441 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -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 )