7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-19 00:21:36 +00:00

Traverse to parent symbol when editing symbol-relevant fields on a pin

This commit is contained in:
JamesJCode 2024-08-27 21:36:51 +01:00
parent a9e115925a
commit 222d48d639

View File

@ -1746,7 +1746,8 @@ void SCH_EDIT_TOOL::editFieldText( SCH_FIELD* aField )
int SCH_EDIT_TOOL::EditField( const TOOL_EVENT& aEvent )
{
EE_SELECTION sel = m_selectionTool->RequestSelection( { SCH_FIELD_T, SCH_SYMBOL_T } );
EE_SELECTION sel =
m_selectionTool->RequestSelection( { SCH_FIELD_T, SCH_SYMBOL_T, SCH_PIN_T } );
if( sel.Size() != 1 )
return 0;
@ -1795,6 +1796,27 @@ int SCH_EDIT_TOOL::EditField( const TOOL_EVENT& aEvent )
if( !field->IsVisible() )
clearSelection = true;
}
else if( item->Type() == SCH_PIN_T )
{
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( item->GetParent() );
if( symbol )
{
if( aEvent.IsAction( &EE_ACTIONS::editReference ) )
{
editFieldText( symbol->GetField( REFERENCE_FIELD ) );
}
else if( aEvent.IsAction( &EE_ACTIONS::editValue ) )
{
editFieldText( symbol->GetField( VALUE_FIELD ) );
}
else if( aEvent.IsAction( &EE_ACTIONS::editFootprint ) )
{
if( !symbol->IsPower() )
editFieldText( symbol->GetField( FOOTPRINT_FIELD ) );
}
}
}
if( clearSelection )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );