Tidy up context menus a bit
Try and put the common actions in the same places
This commit is contained in:
parent
6bb9aeab4b
commit
479487ceb1
|
@ -272,7 +272,6 @@ bool SCH_EDIT_TOOL::Init()
|
|||
moveMenu.AddItem( EE_ACTIONS::rotateCW, orientCondition );
|
||||
moveMenu.AddItem( EE_ACTIONS::mirrorX, orientCondition );
|
||||
moveMenu.AddItem( EE_ACTIONS::mirrorY, orientCondition );
|
||||
moveMenu.AddItem( ACTIONS::doDelete, E_C::NotEmpty );
|
||||
|
||||
moveMenu.AddItem( EE_ACTIONS::properties, propertiesCondition );
|
||||
moveMenu.AddItem( EE_ACTIONS::editReference, singleSymbolCondition );
|
||||
|
@ -288,6 +287,7 @@ bool SCH_EDIT_TOOL::Init()
|
|||
moveMenu.AddSeparator();
|
||||
moveMenu.AddItem( ACTIONS::cut, E_C::IdleSelection );
|
||||
moveMenu.AddItem( ACTIONS::copy, E_C::IdleSelection );
|
||||
moveMenu.AddItem( ACTIONS::doDelete, E_C::NotEmpty );
|
||||
moveMenu.AddItem( ACTIONS::duplicate, duplicateCondition );
|
||||
|
||||
moveMenu.AddSeparator();
|
||||
|
@ -333,7 +333,6 @@ bool SCH_EDIT_TOOL::Init()
|
|||
selToolMenu.AddItem( EE_ACTIONS::rotateCW, orientCondition, 200 );
|
||||
selToolMenu.AddItem( EE_ACTIONS::mirrorX, orientCondition, 200 );
|
||||
selToolMenu.AddItem( EE_ACTIONS::mirrorY, orientCondition, 200 );
|
||||
selToolMenu.AddItem( ACTIONS::doDelete, E_C::NotEmpty, 200 );
|
||||
|
||||
selToolMenu.AddItem( EE_ACTIONS::properties, propertiesCondition, 200 );
|
||||
selToolMenu.AddItem( EE_ACTIONS::editReference, E_C::SingleSymbol, 200 );
|
||||
|
@ -362,6 +361,7 @@ bool SCH_EDIT_TOOL::Init()
|
|||
selToolMenu.AddItem( ACTIONS::copy, E_C::IdleSelection, 300 );
|
||||
selToolMenu.AddItem( ACTIONS::paste, E_C::Idle, 300 );
|
||||
selToolMenu.AddItem( ACTIONS::pasteSpecial, E_C::Idle, 300 );
|
||||
selToolMenu.AddItem( ACTIONS::doDelete, E_C::NotEmpty, 300 );
|
||||
selToolMenu.AddItem( ACTIONS::duplicate, duplicateCondition, 300 );
|
||||
|
||||
selToolMenu.AddSeparator( 400 );
|
||||
|
|
|
@ -73,8 +73,10 @@ bool SYMBOL_EDITOR_CONTROL::Init()
|
|||
|
||||
ctxMenu.AddItem( ACTIONS::pinLibrary, unpinnedLibSelectedCondition );
|
||||
ctxMenu.AddItem( ACTIONS::unpinLibrary, pinnedLibSelectedCondition );
|
||||
ctxMenu.AddSeparator();
|
||||
|
||||
ctxMenu.AddSeparator();
|
||||
ctxMenu.AddItem( ACTIONS::newLibrary, SELECTION_CONDITIONS::ShowAlways );
|
||||
ctxMenu.AddItem( ACTIONS::addLibrary, SELECTION_CONDITIONS::ShowAlways );
|
||||
ctxMenu.AddItem( ACTIONS::save, libSelectedCondition );
|
||||
ctxMenu.AddItem( EE_ACTIONS::saveLibraryAs, libSelectedCondition );
|
||||
ctxMenu.AddItem( ACTIONS::revert, libSelectedCondition );
|
||||
|
@ -86,14 +88,14 @@ bool SYMBOL_EDITOR_CONTROL::Init()
|
|||
ctxMenu.AddSeparator();
|
||||
ctxMenu.AddItem( ACTIONS::save, symbolSelectedCondition );
|
||||
ctxMenu.AddItem( EE_ACTIONS::saveSymbolAs, symbolSelectedCondition );
|
||||
ctxMenu.AddItem( EE_ACTIONS::duplicateSymbol, symbolSelectedCondition );
|
||||
ctxMenu.AddItem( EE_ACTIONS::deleteSymbol, symbolSelectedCondition );
|
||||
ctxMenu.AddItem( ACTIONS::revert, symbolSelectedCondition );
|
||||
|
||||
ctxMenu.AddSeparator();
|
||||
ctxMenu.AddItem( EE_ACTIONS::cutSymbol, symbolSelectedCondition );
|
||||
ctxMenu.AddItem( EE_ACTIONS::copySymbol, symbolSelectedCondition );
|
||||
ctxMenu.AddItem( EE_ACTIONS::pasteSymbol, libSelectedCondition );
|
||||
ctxMenu.AddItem( EE_ACTIONS::pasteSymbol, SELECTION_CONDITIONS::ShowAlways );
|
||||
ctxMenu.AddItem( EE_ACTIONS::duplicateSymbol, symbolSelectedCondition );
|
||||
ctxMenu.AddItem( EE_ACTIONS::deleteSymbol, symbolSelectedCondition );
|
||||
|
||||
ctxMenu.AddSeparator();
|
||||
ctxMenu.AddItem( EE_ACTIONS::importSymbol, libSelectedCondition );
|
||||
|
|
|
@ -84,7 +84,6 @@ bool SYMBOL_EDITOR_EDIT_TOOL::Init()
|
|||
moveMenu.AddItem( EE_ACTIONS::rotateCW, canEdit && EE_CONDITIONS::NotEmpty, 200 );
|
||||
moveMenu.AddItem( EE_ACTIONS::mirrorX, canEdit && EE_CONDITIONS::NotEmpty, 200 );
|
||||
moveMenu.AddItem( EE_ACTIONS::mirrorY, canEdit && EE_CONDITIONS::NotEmpty, 200 );
|
||||
moveMenu.AddItem( ACTIONS::doDelete, canEdit && EE_CONDITIONS::NotEmpty, 200 );
|
||||
|
||||
moveMenu.AddItem( EE_ACTIONS::properties, canEdit && EE_CONDITIONS::Count( 1 ), 200 );
|
||||
|
||||
|
@ -92,6 +91,7 @@ bool SYMBOL_EDITOR_EDIT_TOOL::Init()
|
|||
moveMenu.AddItem( ACTIONS::cut, EE_CONDITIONS::IdleSelection, 300 );
|
||||
moveMenu.AddItem( ACTIONS::copy, EE_CONDITIONS::IdleSelection, 300 );
|
||||
moveMenu.AddItem( ACTIONS::duplicate, canEdit && EE_CONDITIONS::NotEmpty, 300 );
|
||||
moveMenu.AddItem( ACTIONS::doDelete, canEdit && EE_CONDITIONS::NotEmpty, 200 );
|
||||
|
||||
moveMenu.AddSeparator( 400 );
|
||||
moveMenu.AddItem( ACTIONS::selectAll, havePartCondition, 400 );
|
||||
|
@ -115,7 +115,6 @@ bool SYMBOL_EDITOR_EDIT_TOOL::Init()
|
|||
selToolMenu.AddItem( EE_ACTIONS::rotateCW, canEdit && EE_CONDITIONS::NotEmpty, 200 );
|
||||
selToolMenu.AddItem( EE_ACTIONS::mirrorX, canEdit && EE_CONDITIONS::NotEmpty, 200 );
|
||||
selToolMenu.AddItem( EE_ACTIONS::mirrorY, canEdit && EE_CONDITIONS::NotEmpty, 200 );
|
||||
selToolMenu.AddItem( ACTIONS::doDelete, canEdit && EE_CONDITIONS::NotEmpty, 200 );
|
||||
|
||||
selToolMenu.AddItem( EE_ACTIONS::properties, canEdit && EE_CONDITIONS::Count( 1 ), 200 );
|
||||
|
||||
|
@ -124,6 +123,7 @@ bool SYMBOL_EDITOR_EDIT_TOOL::Init()
|
|||
selToolMenu.AddItem( ACTIONS::copy, EE_CONDITIONS::IdleSelection, 300 );
|
||||
selToolMenu.AddItem( ACTIONS::paste, canEdit && EE_CONDITIONS::Idle, 300 );
|
||||
selToolMenu.AddItem( ACTIONS::duplicate, canEdit && EE_CONDITIONS::NotEmpty, 300 );
|
||||
selToolMenu.AddItem( ACTIONS::doDelete, canEdit && EE_CONDITIONS::NotEmpty, 300 );
|
||||
|
||||
selToolMenu.AddSeparator( 400 );
|
||||
selToolMenu.AddItem( ACTIONS::selectAll, havePartCondition, 400 );
|
||||
|
|
|
@ -106,10 +106,10 @@ bool SYMBOL_EDITOR_PIN_TOOL::Init()
|
|||
|
||||
CONDITIONAL_MENU& selToolMenu = m_selectionTool->GetToolMenu().GetMenu();
|
||||
|
||||
selToolMenu.AddSeparator( 400 );
|
||||
selToolMenu.AddItem( EE_ACTIONS::pushPinLength, canEdit && singlePinCondition, 400 );
|
||||
selToolMenu.AddItem( EE_ACTIONS::pushPinNameSize, canEdit && singlePinCondition, 400 );
|
||||
selToolMenu.AddItem( EE_ACTIONS::pushPinNumSize, canEdit && singlePinCondition, 400 );
|
||||
selToolMenu.AddSeparator( 250 );
|
||||
selToolMenu.AddItem( EE_ACTIONS::pushPinLength, canEdit && singlePinCondition, 250 );
|
||||
selToolMenu.AddItem( EE_ACTIONS::pushPinNameSize, canEdit && singlePinCondition, 250 );
|
||||
selToolMenu.AddItem( EE_ACTIONS::pushPinNumSize, canEdit && singlePinCondition, 250 );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -451,4 +451,3 @@ void SYMBOL_EDITOR_PIN_TOOL::setTransitions()
|
|||
Go( &SYMBOL_EDITOR_PIN_TOOL::PushPinProperties, EE_ACTIONS::pushPinNameSize.MakeEvent() );
|
||||
Go( &SYMBOL_EDITOR_PIN_TOOL::PushPinProperties, EE_ACTIONS::pushPinNumSize.MakeEvent() );
|
||||
}
|
||||
|
||||
|
|
|
@ -75,11 +75,13 @@ bool PL_EDIT_TOOL::Init()
|
|||
//
|
||||
CONDITIONAL_MENU& selToolMenu = m_selectionTool->GetToolMenu().GetMenu();
|
||||
|
||||
selToolMenu.AddItem( ACTIONS::cut, SELECTION_CONDITIONS::NotEmpty, 200 );
|
||||
selToolMenu.AddItem( ACTIONS::copy, SELECTION_CONDITIONS::NotEmpty, 200 );
|
||||
selToolMenu.AddItem( ACTIONS::paste, SELECTION_CONDITIONS::ShowAlways, 200 );
|
||||
selToolMenu.AddItem( PL_ACTIONS::move, SELECTION_CONDITIONS::NotEmpty, 200 );
|
||||
selToolMenu.AddItem( ACTIONS::doDelete, SELECTION_CONDITIONS::NotEmpty, 200 );
|
||||
selToolMenu.AddItem( PL_ACTIONS::move, SELECTION_CONDITIONS::NotEmpty, 250 );
|
||||
|
||||
selToolMenu.AddSeparator( 250 );
|
||||
selToolMenu.AddItem( ACTIONS::cut, SELECTION_CONDITIONS::NotEmpty, 250 );
|
||||
selToolMenu.AddItem( ACTIONS::copy, SELECTION_CONDITIONS::NotEmpty, 250 );
|
||||
selToolMenu.AddItem( ACTIONS::paste, SELECTION_CONDITIONS::ShowAlways, 250 );
|
||||
selToolMenu.AddItem( ACTIONS::doDelete, SELECTION_CONDITIONS::NotEmpty, 250 );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -45,14 +45,6 @@
|
|||
* setting of 40 is arbitrary.
|
||||
*/
|
||||
#define MAX_SELECT_ITEM_IDS 40
|
||||
|
||||
|
||||
SELECTION_CONDITION PL_CONDITIONS::Idle = [] (const SELECTION& aSelection )
|
||||
{
|
||||
return ( !aSelection.Front() || aSelection.Front()->GetEditFlags() == 0 );
|
||||
};
|
||||
|
||||
|
||||
#define HITTEST_THRESHOLD_PIXELS 3
|
||||
|
||||
|
||||
|
@ -75,11 +67,10 @@ bool PL_SELECTION_TOOL::Init()
|
|||
auto& menu = m_menu.GetMenu();
|
||||
|
||||
menu.AddSeparator( 200 );
|
||||
menu.AddItem( PL_ACTIONS::drawLine, PL_CONDITIONS::Idle, 250 );
|
||||
menu.AddItem( PL_ACTIONS::drawRectangle, PL_CONDITIONS::Idle, 250 );
|
||||
menu.AddItem( PL_ACTIONS::placeText, PL_CONDITIONS::Idle, 250 );
|
||||
menu.AddItem( PL_ACTIONS::placeImage, PL_CONDITIONS::Idle, 250 );
|
||||
menu.AddItem( PL_ACTIONS::appendImportedWorksheet, PL_CONDITIONS::Idle, 250 );
|
||||
menu.AddItem( PL_ACTIONS::drawLine, SELECTION_CONDITIONS::Empty, 200 );
|
||||
menu.AddItem( PL_ACTIONS::drawRectangle, SELECTION_CONDITIONS::Empty, 200 );
|
||||
menu.AddItem( PL_ACTIONS::placeText, SELECTION_CONDITIONS::Empty, 200 );
|
||||
menu.AddItem( PL_ACTIONS::placeImage, SELECTION_CONDITIONS::Empty, 200 );
|
||||
|
||||
menu.AddSeparator( 1000 );
|
||||
m_frame->AddStandardSubMenus( m_menu );
|
||||
|
@ -795,5 +786,3 @@ void PL_SELECTION_TOOL::setTransitions()
|
|||
Go( &PL_SELECTION_TOOL::RemoveItemsFromSel, PL_ACTIONS::removeItemsFromSel.MakeEvent() );
|
||||
Go( &PL_SELECTION_TOOL::SelectionMenu, PL_ACTIONS::selectionMenu.MakeEvent() );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -39,13 +39,6 @@ namespace KIGFX
|
|||
}
|
||||
|
||||
|
||||
class PL_CONDITIONS : public SELECTION_CONDITIONS
|
||||
{
|
||||
public:
|
||||
static SELECTION_CONDITION Idle;
|
||||
};
|
||||
|
||||
|
||||
class PL_SELECTION_TOOL : public TOOL_INTERACTIVE
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -143,11 +143,14 @@ bool EDIT_TOOL::Init()
|
|||
menu.AddItem( PCB_ACTIONS::flip, SELECTION_CONDITIONS::NotEmpty );
|
||||
menu.AddItem( PCB_ACTIONS::mirror, inFootprintEditor && SELECTION_CONDITIONS::NotEmpty );
|
||||
|
||||
menu.AddItem( ACTIONS::doDelete, SELECTION_CONDITIONS::NotEmpty );
|
||||
menu.AddItem( PCB_ACTIONS::properties, SELECTION_CONDITIONS::Count( 1 )
|
||||
|| SELECTION_CONDITIONS::OnlyTypes( GENERAL_COLLECTOR::Tracks ) );
|
||||
|
||||
menu.AddItem( ACTIONS::duplicate, SELECTION_CONDITIONS::NotEmpty );
|
||||
// Footprint actions
|
||||
menu.AddSeparator();
|
||||
menu.AddItem( PCB_ACTIONS::editFpInFpEditor, singleFootprintCondition );
|
||||
menu.AddItem( PCB_ACTIONS::updateFootprint, singleFootprintCondition );
|
||||
menu.AddItem( PCB_ACTIONS::changeFootprint, singleFootprintCondition );
|
||||
|
||||
// Add the submenu for create array and special move
|
||||
auto specialToolsSubMenu = std::make_shared<SPECIAL_TOOLS_CONTEXT_MENU>( this );
|
||||
|
@ -161,13 +164,11 @@ bool EDIT_TOOL::Init()
|
|||
// Selection tool handles the context menu for some other tools, such as the Picker.
|
||||
// Don't add things like Paste when another tool is active.
|
||||
menu.AddItem( ACTIONS::paste, noActiveToolCondition, 150 );
|
||||
menu.AddItem( ACTIONS::selectAll, noItemsCondition, 150 );
|
||||
menu.AddItem( ACTIONS::duplicate, SELECTION_CONDITIONS::NotEmpty, 150 );
|
||||
menu.AddItem( ACTIONS::doDelete, SELECTION_CONDITIONS::NotEmpty, 150 );
|
||||
|
||||
// Footprint actions
|
||||
menu.AddSeparator( 150 );
|
||||
menu.AddItem( PCB_ACTIONS::editFpInFpEditor, singleFootprintCondition, 150 );
|
||||
menu.AddItem( PCB_ACTIONS::updateFootprint, singleFootprintCondition, 150 );
|
||||
menu.AddItem( PCB_ACTIONS::changeFootprint, singleFootprintCondition, 150 );
|
||||
menu.AddItem( ACTIONS::selectAll, noItemsCondition, 150 );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -2036,5 +2037,3 @@ void EDIT_TOOL::setTransitions()
|
|||
Go( &EDIT_TOOL::copyToClipboard, PCB_ACTIONS::copyWithReference.MakeEvent() );
|
||||
Go( &EDIT_TOOL::cutToClipboard, ACTIONS::cut.MakeEvent() );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -97,8 +97,8 @@ bool FOOTPRINT_EDITOR_CONTROL::Init()
|
|||
|
||||
ctxMenu.AddItem( ACTIONS::pinLibrary, unpinnedLibSelectedCondition );
|
||||
ctxMenu.AddItem( ACTIONS::unpinLibrary, pinnedLibSelectedCondition );
|
||||
ctxMenu.AddSeparator();
|
||||
|
||||
ctxMenu.AddSeparator();
|
||||
ctxMenu.AddItem( ACTIONS::newLibrary, SELECTION_CONDITIONS::ShowAlways );
|
||||
ctxMenu.AddItem( ACTIONS::addLibrary, SELECTION_CONDITIONS::ShowAlways );
|
||||
ctxMenu.AddItem( ACTIONS::save, libSelectedCondition );
|
||||
|
@ -106,25 +106,25 @@ bool FOOTPRINT_EDITOR_CONTROL::Init()
|
|||
ctxMenu.AddItem( ACTIONS::revert, libSelectedCondition );
|
||||
|
||||
ctxMenu.AddSeparator();
|
||||
ctxMenu.AddItem( PCB_ACTIONS::newFootprint, SELECTION_CONDITIONS::ShowAlways );
|
||||
ctxMenu.AddItem( PCB_ACTIONS::newFootprint, libSelectedCondition );
|
||||
#ifdef KICAD_SCRIPTING
|
||||
ctxMenu.AddItem( PCB_ACTIONS::createFootprint, SELECTION_CONDITIONS::ShowAlways );
|
||||
ctxMenu.AddItem( PCB_ACTIONS::createFootprint, libSelectedCondition );
|
||||
#endif
|
||||
ctxMenu.AddItem( PCB_ACTIONS::editFootprint, fpSelectedCondition );
|
||||
|
||||
ctxMenu.AddSeparator();
|
||||
ctxMenu.AddItem( ACTIONS::save, fpSelectedCondition );
|
||||
ctxMenu.AddItem( ACTIONS::saveCopyAs, fpSelectedCondition );
|
||||
ctxMenu.AddItem( PCB_ACTIONS::deleteFootprint, fpSelectedCondition );
|
||||
ctxMenu.AddItem( ACTIONS::revert, fpSelectedCondition );
|
||||
|
||||
ctxMenu.AddSeparator();
|
||||
ctxMenu.AddItem( PCB_ACTIONS::cutFootprint, fpSelectedCondition );
|
||||
ctxMenu.AddItem( PCB_ACTIONS::copyFootprint, fpSelectedCondition );
|
||||
ctxMenu.AddItem( PCB_ACTIONS::pasteFootprint, SELECTION_CONDITIONS::ShowAlways );
|
||||
ctxMenu.AddItem( PCB_ACTIONS::deleteFootprint, fpSelectedCondition );
|
||||
|
||||
ctxMenu.AddSeparator();
|
||||
ctxMenu.AddItem( PCB_ACTIONS::importFootprint, SELECTION_CONDITIONS::ShowAlways );
|
||||
ctxMenu.AddItem( PCB_ACTIONS::importFootprint, libSelectedCondition );
|
||||
ctxMenu.AddItem( PCB_ACTIONS::exportFootprint, fpSelectedCondition );
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue