From fa4d759fcbb09967b50b58510a0b964cc3529ecb Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 2 Mar 2024 12:15:50 +0000 Subject: [PATCH] First alt-pin menu item must be fetched from the LIB_PIN. (The SCH_PIN will return any alt function already assigned.) Fixes https://gitlab.com/kicad/code/kicad/-/issues/17221 --- eeschema/tools/sch_edit_tool.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index 98d9aa04c1..5dc2831067 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -138,12 +138,13 @@ private: EE_SELECTION_TOOL* selTool = getToolManager()->GetTool(); EE_SELECTION& selection = selTool->GetSelection(); SCH_PIN* pin = dynamic_cast( selection.Front() ); + LIB_PIN* libPin = pin ? pin->GetLibPin() : nullptr; Clear(); - wxCHECK( pin, /* void */ ); + wxCHECK( libPin, /* void */ ); - wxMenuItem* item = Append( ID_POPUP_SCH_ALT_PIN_FUNCTION, pin->GetName(), wxEmptyString, + wxMenuItem* item = Append( ID_POPUP_SCH_ALT_PIN_FUNCTION, libPin->GetName(), wxEmptyString, wxITEM_CHECK ); if( pin->GetAlt().IsEmpty() ) @@ -151,7 +152,7 @@ private: int ii = 1; - for( const auto& [ name, definition ] : pin->GetLibPin()->GetAlternates() ) + for( const auto& [ name, definition ] : libPin->GetAlternates() ) { item = Append( ID_POPUP_SCH_ALT_PIN_FUNCTION + ii, name, wxEmptyString, wxITEM_CHECK );