Allow selection promotion when editing wrong field type.
Also fixes a bug where a CHT_MODIFY on a parent symbol with a selected child doesn't trigger a selection modified event. Fixes https://gitlab.com/kicad/code/kicad/-/issues/17696
This commit is contained in:
parent
56f6f44b3d
commit
1aa59b806c
|
@ -208,7 +208,18 @@ void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags )
|
|||
schematic = schItem->Schematic();
|
||||
|
||||
if( schItem->IsSelected() )
|
||||
{
|
||||
selectedModified = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
schItem->RunOnChildren(
|
||||
[&selectedModified]( SCH_ITEM* aChild )
|
||||
{
|
||||
if( aChild->IsSelected() )
|
||||
selectedModified = true;
|
||||
} );
|
||||
}
|
||||
|
||||
auto updateConnectivityFlag =
|
||||
[&]()
|
||||
|
|
|
@ -1578,14 +1578,7 @@ void SCH_EDIT_TOOL::editFieldText( SCH_FIELD* aField )
|
|||
|
||||
int SCH_EDIT_TOOL::EditField( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
EE_SELECTION sel;
|
||||
|
||||
if( aEvent.IsAction( &EE_ACTIONS::editReference ) )
|
||||
sel = m_selectionTool->RequestSelection( { SCH_FIELD_LOCATE_REFERENCE_T, SCH_SYMBOL_T } );
|
||||
else if( aEvent.IsAction( &EE_ACTIONS::editValue ) )
|
||||
sel = m_selectionTool->RequestSelection( { SCH_FIELD_LOCATE_VALUE_T, SCH_SYMBOL_T } );
|
||||
else if( aEvent.IsAction( &EE_ACTIONS::editFootprint ) )
|
||||
sel = m_selectionTool->RequestSelection( { SCH_FIELD_LOCATE_FOOTPRINT_T, SCH_SYMBOL_T } );
|
||||
EE_SELECTION sel = m_selectionTool->RequestSelection( { SCH_FIELD_T, SCH_SYMBOL_T } );
|
||||
|
||||
if( sel.Size() != 1 )
|
||||
return 0;
|
||||
|
@ -1593,6 +1586,20 @@ int SCH_EDIT_TOOL::EditField( const TOOL_EVENT& aEvent )
|
|||
bool clearSelection = sel.IsHover();
|
||||
EDA_ITEM* item = sel.Front();
|
||||
|
||||
if( item->Type() == SCH_FIELD_T )
|
||||
{
|
||||
SCH_FIELD* field = static_cast<SCH_FIELD*>( item );
|
||||
|
||||
if( ( aEvent.IsAction( &EE_ACTIONS::editReference ) && field->GetId() != REFERENCE_FIELD )
|
||||
|| ( aEvent.IsAction( &EE_ACTIONS::editValue ) && field->GetId() != VALUE_FIELD )
|
||||
|| ( aEvent.IsAction( &EE_ACTIONS::editFootprint ) && field->GetId() != FOOTPRINT_FIELD ) )
|
||||
{
|
||||
item = field->GetParentSymbol();
|
||||
m_selectionTool->ClearSelection( true );
|
||||
m_selectionTool->AddItemToSel( item );
|
||||
}
|
||||
}
|
||||
|
||||
if( item->Type() == SCH_SYMBOL_T )
|
||||
{
|
||||
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
|
||||
|
|
Loading…
Reference in New Issue