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
(cherry picked from commit 1aa59b806c
)
This commit is contained in:
parent
0363806e7e
commit
fa490644dd
|
@ -209,7 +209,18 @@ void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags )
|
||||||
schematic = schItem->Schematic();
|
schematic = schItem->Schematic();
|
||||||
|
|
||||||
if( schItem->IsSelected() )
|
if( schItem->IsSelected() )
|
||||||
|
{
|
||||||
selectedModified = true;
|
selectedModified = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
schItem->RunOnChildren(
|
||||||
|
[&selectedModified]( SCH_ITEM* aChild )
|
||||||
|
{
|
||||||
|
if( aChild->IsSelected() )
|
||||||
|
selectedModified = true;
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
auto updateConnectivityFlag = [&, this]()
|
auto updateConnectivityFlag = [&, this]()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1556,14 +1556,7 @@ void SCH_EDIT_TOOL::editFieldText( SCH_FIELD* aField )
|
||||||
|
|
||||||
int SCH_EDIT_TOOL::EditField( const TOOL_EVENT& aEvent )
|
int SCH_EDIT_TOOL::EditField( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
EE_SELECTION sel;
|
EE_SELECTION sel = m_selectionTool->RequestSelection( { SCH_FIELD_T, SCH_SYMBOL_T } );
|
||||||
|
|
||||||
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 } );
|
|
||||||
|
|
||||||
if( sel.Size() != 1 )
|
if( sel.Size() != 1 )
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1571,6 +1564,20 @@ int SCH_EDIT_TOOL::EditField( const TOOL_EVENT& aEvent )
|
||||||
bool clearSelection = sel.IsHover();
|
bool clearSelection = sel.IsHover();
|
||||||
EDA_ITEM* item = sel.Front();
|
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 )
|
if( item->Type() == SCH_SYMBOL_T )
|
||||||
{
|
{
|
||||||
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
|
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
|
||||||
|
|
Loading…
Reference in New Issue