Allow "Update Symbol" command on power symbols

Power symbols can be modified in the library so it is useful to allow
them to be updated with the right-click menu
This commit is contained in:
Seth Hillbrand 2021-02-16 16:14:23 -08:00
parent a1730d51ff
commit a25dfcd1b4
3 changed files with 17 additions and 2 deletions

View File

@ -66,6 +66,20 @@ SELECTION_CONDITION EE_CONDITIONS::SingleSymbol = [] (const SELECTION& aSel )
}; };
SELECTION_CONDITION EE_CONDITIONS::SingleSymbolOrPower = [] (const SELECTION& aSel )
{
if( aSel.GetSize() == 1 )
{
SCH_COMPONENT* symbol = dynamic_cast<SCH_COMPONENT*>( aSel.Front() );
if( symbol )
return !symbol->GetPartRef();
}
return false;
};
SELECTION_CONDITION EE_CONDITIONS::SingleDeMorganSymbol = [] ( const SELECTION& aSel ) SELECTION_CONDITION EE_CONDITIONS::SingleDeMorganSymbol = [] ( const SELECTION& aSel )
{ {
if( aSel.GetSize() == 1 ) if( aSel.GetSize() == 1 )

View File

@ -46,6 +46,7 @@ class EE_CONDITIONS : public SELECTION_CONDITIONS
{ {
public: public:
static SELECTION_CONDITION SingleSymbol; static SELECTION_CONDITION SingleSymbol;
static SELECTION_CONDITION SingleSymbolOrPower;
static SELECTION_CONDITION SingleDeMorganSymbol; static SELECTION_CONDITION SingleDeMorganSymbol;
static SELECTION_CONDITION SingleMultiUnitSymbol; static SELECTION_CONDITION SingleMultiUnitSymbol;
}; };

View File

@ -348,8 +348,8 @@ bool SCH_EDIT_TOOL::Init()
selToolMenu.AddMenu( symUnitMenu3.get(), E_C::SingleMultiUnitSymbol, 1 ); selToolMenu.AddMenu( symUnitMenu3.get(), E_C::SingleMultiUnitSymbol, 1 );
selToolMenu.AddItem( EE_ACTIONS::editWithLibEdit, singleSymbolCondition && E_C::Idle, 200 ); selToolMenu.AddItem( EE_ACTIONS::editWithLibEdit, singleSymbolCondition && E_C::Idle, 200 );
selToolMenu.AddItem( EE_ACTIONS::changeSymbol, E_C::SingleSymbol, 200 ); selToolMenu.AddItem( EE_ACTIONS::changeSymbol, E_C::SingleSymbolOrPower, 200 );
selToolMenu.AddItem( EE_ACTIONS::updateSymbol, E_C::SingleSymbol, 200 ); selToolMenu.AddItem( EE_ACTIONS::updateSymbol, E_C::SingleSymbolOrPower, 200 );
selToolMenu.AddItem( EE_ACTIONS::toLabel, toLabelCondition, 200 ); selToolMenu.AddItem( EE_ACTIONS::toLabel, toLabelCondition, 200 );
selToolMenu.AddItem( EE_ACTIONS::toHLabel, toHLabelCondition, 200 ); selToolMenu.AddItem( EE_ACTIONS::toHLabel, toHLabelCondition, 200 );