Use common actions where possible.
This commit is contained in:
parent
29df4f809e
commit
bcd48d4bc2
|
@ -151,14 +151,14 @@ bool EDIT_TOOL::Init()
|
||||||
menu.AddItem( PCB_ACTIONS::rotateCcw, SELECTION_CONDITIONS::NotEmpty );
|
menu.AddItem( PCB_ACTIONS::rotateCcw, SELECTION_CONDITIONS::NotEmpty );
|
||||||
menu.AddItem( PCB_ACTIONS::rotateCw, SELECTION_CONDITIONS::NotEmpty );
|
menu.AddItem( PCB_ACTIONS::rotateCw, SELECTION_CONDITIONS::NotEmpty );
|
||||||
menu.AddItem( PCB_ACTIONS::flip, SELECTION_CONDITIONS::NotEmpty );
|
menu.AddItem( PCB_ACTIONS::flip, SELECTION_CONDITIONS::NotEmpty );
|
||||||
menu.AddItem( PCB_ACTIONS::remove, SELECTION_CONDITIONS::NotEmpty );
|
menu.AddItem( ACTIONS::doDelete, SELECTION_CONDITIONS::NotEmpty );
|
||||||
menu.AddItem( PCB_ACTIONS::properties, SELECTION_CONDITIONS::Count( 1 )
|
menu.AddItem( PCB_ACTIONS::properties, SELECTION_CONDITIONS::Count( 1 )
|
||||||
|| SELECTION_CONDITIONS::OnlyTypes( GENERAL_COLLECTOR::Tracks ) );
|
|| SELECTION_CONDITIONS::OnlyTypes( GENERAL_COLLECTOR::Tracks ) );
|
||||||
|
|
||||||
|
|
||||||
menu.AddItem( PCB_ACTIONS::moveExact, SELECTION_CONDITIONS::NotEmpty );
|
menu.AddItem( PCB_ACTIONS::moveExact, SELECTION_CONDITIONS::NotEmpty );
|
||||||
menu.AddItem( PCB_ACTIONS::positionRelative, SELECTION_CONDITIONS::NotEmpty );
|
menu.AddItem( PCB_ACTIONS::positionRelative, SELECTION_CONDITIONS::NotEmpty );
|
||||||
menu.AddItem( PCB_ACTIONS::duplicate, SELECTION_CONDITIONS::NotEmpty );
|
menu.AddItem( ACTIONS::duplicate, SELECTION_CONDITIONS::NotEmpty );
|
||||||
menu.AddItem( PCB_ACTIONS::createArray, SELECTION_CONDITIONS::NotEmpty );
|
menu.AddItem( PCB_ACTIONS::createArray, SELECTION_CONDITIONS::NotEmpty );
|
||||||
|
|
||||||
|
|
||||||
|
@ -427,12 +427,12 @@ int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
// Dispatch TOOL_ACTIONs
|
// Dispatch TOOL_ACTIONs
|
||||||
else if( evt->Category() == TC_COMMAND )
|
else if( evt->Category() == TC_COMMAND )
|
||||||
{
|
{
|
||||||
if( evt->IsAction( &PCB_ACTIONS::remove ) )
|
if( evt->IsAction( &ACTIONS::doDelete ) )
|
||||||
{
|
{
|
||||||
// exit the loop, as there is no further processing for removed items
|
// exit the loop, as there is no further processing for removed items
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if( evt->IsAction( &PCB_ACTIONS::duplicate ) )
|
else if( evt->IsAction( &ACTIONS::duplicate ) )
|
||||||
{
|
{
|
||||||
// On duplicate, stop moving this item
|
// On duplicate, stop moving this item
|
||||||
// The duplicate tool should then select the new item and start
|
// The duplicate tool should then select the new item and start
|
||||||
|
@ -1374,11 +1374,11 @@ void EDIT_TOOL::setTransitions()
|
||||||
Go( &EDIT_TOOL::Rotate, PCB_ACTIONS::rotateCw.MakeEvent() );
|
Go( &EDIT_TOOL::Rotate, PCB_ACTIONS::rotateCw.MakeEvent() );
|
||||||
Go( &EDIT_TOOL::Rotate, PCB_ACTIONS::rotateCcw.MakeEvent() );
|
Go( &EDIT_TOOL::Rotate, PCB_ACTIONS::rotateCcw.MakeEvent() );
|
||||||
Go( &EDIT_TOOL::Flip, PCB_ACTIONS::flip.MakeEvent() );
|
Go( &EDIT_TOOL::Flip, PCB_ACTIONS::flip.MakeEvent() );
|
||||||
Go( &EDIT_TOOL::Remove, PCB_ACTIONS::remove.MakeEvent() );
|
Go( &EDIT_TOOL::Remove, ACTIONS::doDelete.MakeEvent() );
|
||||||
Go( &EDIT_TOOL::Remove, PCB_ACTIONS::deleteFull.MakeEvent() );
|
Go( &EDIT_TOOL::Remove, PCB_ACTIONS::deleteFull.MakeEvent() );
|
||||||
Go( &EDIT_TOOL::Properties, PCB_ACTIONS::properties.MakeEvent() );
|
Go( &EDIT_TOOL::Properties, PCB_ACTIONS::properties.MakeEvent() );
|
||||||
Go( &EDIT_TOOL::MoveExact, PCB_ACTIONS::moveExact.MakeEvent() );
|
Go( &EDIT_TOOL::MoveExact, PCB_ACTIONS::moveExact.MakeEvent() );
|
||||||
Go( &EDIT_TOOL::Duplicate, PCB_ACTIONS::duplicate.MakeEvent() );
|
Go( &EDIT_TOOL::Duplicate, ACTIONS::duplicate.MakeEvent() );
|
||||||
Go( &EDIT_TOOL::Duplicate, PCB_ACTIONS::duplicateIncrement.MakeEvent() );
|
Go( &EDIT_TOOL::Duplicate, PCB_ACTIONS::duplicateIncrement.MakeEvent() );
|
||||||
Go( &EDIT_TOOL::CreateArray, PCB_ACTIONS::createArray.MakeEvent() );
|
Go( &EDIT_TOOL::CreateArray, PCB_ACTIONS::createArray.MakeEvent() );
|
||||||
Go( &EDIT_TOOL::Mirror, PCB_ACTIONS::mirror.MakeEvent() );
|
Go( &EDIT_TOOL::Mirror, PCB_ACTIONS::mirror.MakeEvent() );
|
||||||
|
|
|
@ -157,8 +157,8 @@ bool PAD_TOOL::Init()
|
||||||
|
|
||||||
if( selTool )
|
if( selTool )
|
||||||
{
|
{
|
||||||
auto& toolMenu = selTool->GetToolMenu();
|
TOOL_MENU& toolMenu = selTool->GetToolMenu();
|
||||||
auto& menu = toolMenu.GetMenu();
|
CONDITIONAL_MENU& menu = toolMenu.GetMenu();
|
||||||
|
|
||||||
toolMenu.AddSubMenu( ctxMenu );
|
toolMenu.AddSubMenu( ctxMenu );
|
||||||
|
|
||||||
|
|
|
@ -191,16 +191,10 @@ TOOL_ACTION PCB_ACTIONS::move( "pcbnew.InteractiveMove.move",
|
||||||
_( "Move" ), _( "Moves the selected item(s)" ),
|
_( "Move" ), _( "Moves the selected item(s)" ),
|
||||||
move_xpm, AF_ACTIVATE );
|
move_xpm, AF_ACTIVATE );
|
||||||
|
|
||||||
TOOL_ACTION PCB_ACTIONS::duplicate( "pcbnew.InteractiveEdit.duplicate",
|
|
||||||
AS_GLOBAL,
|
|
||||||
MD_CTRL + 'D', LEGACY_HK_NAME( "Duplicate Item" ),
|
|
||||||
_( "Duplicate" ), _( "Duplicates the selected item(s)" ),
|
|
||||||
duplicate_xpm );
|
|
||||||
|
|
||||||
TOOL_ACTION PCB_ACTIONS::duplicateIncrement( "pcbnew.InteractiveEdit.duplicateIncrementPads",
|
TOOL_ACTION PCB_ACTIONS::duplicateIncrement( "pcbnew.InteractiveEdit.duplicateIncrementPads",
|
||||||
AS_GLOBAL,
|
AS_GLOBAL,
|
||||||
MD_SHIFT + MD_CTRL + 'D', LEGACY_HK_NAME( "Duplicate Item and Increment" ),
|
MD_SHIFT + MD_CTRL + 'D', LEGACY_HK_NAME( "Duplicate Item and Increment" ),
|
||||||
_( "Duplicate" ), _( "Duplicates the selected item(s), incrementing pad numbers" ),
|
_( "Duplicate and Increment" ), _( "Duplicates the selected item(s), incrementing pad numbers" ),
|
||||||
duplicate_xpm );
|
duplicate_xpm );
|
||||||
|
|
||||||
TOOL_ACTION PCB_ACTIONS::moveExact( "pcbnew.InteractiveEdit.moveExact",
|
TOOL_ACTION PCB_ACTIONS::moveExact( "pcbnew.InteractiveEdit.moveExact",
|
||||||
|
@ -239,12 +233,6 @@ TOOL_ACTION PCB_ACTIONS::mirror( "pcbnew.InteractiveEdit.mirror",
|
||||||
_( "Mirror" ), _( "Mirrors selected item" ),
|
_( "Mirror" ), _( "Mirrors selected item" ),
|
||||||
mirror_h_xpm );
|
mirror_h_xpm );
|
||||||
|
|
||||||
TOOL_ACTION PCB_ACTIONS::remove( "pcbnew.InteractiveEdit.remove",
|
|
||||||
AS_GLOBAL,
|
|
||||||
WXK_BACK, "",
|
|
||||||
_( "Delete" ), _( "Deletes selected item(s)" ),
|
|
||||||
delete_xpm, AF_NONE, (void*) REMOVE_FLAGS::NORMAL );
|
|
||||||
|
|
||||||
TOOL_ACTION PCB_ACTIONS::deleteFull( "pcbnew.InteractiveEdit.deleteFull",
|
TOOL_ACTION PCB_ACTIONS::deleteFull( "pcbnew.InteractiveEdit.deleteFull",
|
||||||
AS_GLOBAL,
|
AS_GLOBAL,
|
||||||
WXK_DELETE, LEGACY_HK_NAME( "Delete Full Track" ),
|
WXK_DELETE, LEGACY_HK_NAME( "Delete Full Track" ),
|
||||||
|
|
|
@ -509,7 +509,7 @@ int PCBNEW_CONTROL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
||||||
SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
|
SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
|
||||||
selectionTool->UnbrightenItem( m_pickerItem );
|
selectionTool->UnbrightenItem( m_pickerItem );
|
||||||
selectionTool->AddItemToSel( m_pickerItem, true );
|
selectionTool->AddItemToSel( m_pickerItem, true );
|
||||||
m_toolMgr->RunAction( PCB_ACTIONS::remove, true );
|
m_toolMgr->RunAction( ACTIONS::doDelete, true );
|
||||||
m_pickerItem = nullptr;
|
m_pickerItem = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue