Context menu cleanup for eeschema modern toolset.
This commit is contained in:
parent
90a663facd
commit
7273748c57
|
@ -47,55 +47,6 @@
|
|||
#include <tools/sch_actions.h>
|
||||
#include <tools/sch_selection_tool.h>
|
||||
|
||||
static void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame );
|
||||
static void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet );
|
||||
static void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component,
|
||||
SYMBOL_LIB_TABLE* aLibs );
|
||||
|
||||
|
||||
bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
|
||||
{
|
||||
SCH_ITEM* item = GetScreen()->GetCurItem();
|
||||
wxString msg;
|
||||
|
||||
// If a command is in progress: add "cancel" and "end tool" menu
|
||||
if( GetToolId() != ID_NO_TOOL_SELECTED )
|
||||
{
|
||||
switch( GetToolId() )
|
||||
{
|
||||
case ID_BUS_BUTT:
|
||||
AddMenusForBus( PopMenu, NULL, this );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case SCH_COMPONENT_T:
|
||||
AddMenusForComponent( PopMenu, (SCH_COMPONENT*) item, Prj().SchSymbolLibTable() );
|
||||
break;
|
||||
|
||||
case SCH_LINE_T:
|
||||
switch( item->GetLayer() )
|
||||
{
|
||||
case LAYER_BUS:
|
||||
AddMenusForBus( PopMenu, (SCH_LINE*) item, this );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case SCH_SHEET_T:
|
||||
AddMenusForHierchicalSheet( PopMenu, (SCH_SHEET*) item );
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, SYMBOL_LIB_TABLE* aLibs )
|
||||
{
|
||||
wxString msg;
|
||||
|
@ -168,10 +119,3 @@ void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame )
|
|||
}
|
||||
|
||||
|
||||
void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet )
|
||||
{
|
||||
AddMenuItem( PopMenu, ID_POPUP_IMPORT_HLABEL_TO_SHEETPIN, _( "Import Sheet Pins" ),
|
||||
KiBitmap( import_hierarchical_label_xpm ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -371,7 +371,7 @@ public:
|
|||
|
||||
void KiwayMailIn( KIWAY_EXPRESS& aEvent ) override;
|
||||
|
||||
bool OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) override;
|
||||
bool OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) override { return true; }
|
||||
void OnSelectOptionToolbar( wxCommandEvent& event );
|
||||
double BestZoom() override;
|
||||
|
||||
|
|
|
@ -118,6 +118,7 @@ public:
|
|||
static TOOL_ACTION editFootprint;
|
||||
static TOOL_ACTION autoplaceFields;
|
||||
static TOOL_ACTION convertDeMorgan;
|
||||
static TOOL_ACTION editSymbolUnit;
|
||||
static TOOL_ACTION doDelete;
|
||||
static TOOL_ACTION addJunction;
|
||||
static TOOL_ACTION addLabel;
|
||||
|
|
|
@ -263,6 +263,8 @@ bool SCH_DRAWING_TOOL::Init()
|
|||
ctxMenu.AddItem( SCH_ACTIONS::finishWire, wireToolCondition && drawingSegmentsCondition, 1 );
|
||||
ctxMenu.AddItem( SCH_ACTIONS::finishBus, busToolCondition && drawingSegmentsCondition, 1 );
|
||||
ctxMenu.AddItem( SCH_ACTIONS::finishLine, lineToolCondition && drawingSegmentsCondition, 1 );
|
||||
// TODO(JE): add menu access to unfold bus...
|
||||
|
||||
ctxMenu.AddItem( SCH_ACTIONS::resizeSheet, sheetToolCondition && idleCondition, 1 );
|
||||
|
||||
ctxMenu.AddSeparator( idleBusOrLineToolCondition, 100 );
|
||||
|
@ -278,12 +280,15 @@ bool SCH_DRAWING_TOOL::Init()
|
|||
//
|
||||
CONDITIONAL_MENU& selToolMenu = m_selectionTool->GetToolMenu().GetMenu();
|
||||
|
||||
// TODO(JE): add menu access to unfold bus on busSelectionCondition...
|
||||
|
||||
selToolMenu.AddItem( SCH_ACTIONS::resizeSheet, singleSheetCondition, 1 );
|
||||
|
||||
selToolMenu.AddItem( SCH_ACTIONS::addJunction, wireOrBusSelectionCondition, 100 );
|
||||
selToolMenu.AddItem( SCH_ACTIONS::addLabel, wireOrBusSelectionCondition, 100 );
|
||||
selToolMenu.AddItem( SCH_ACTIONS::addGlobalLabel, wireOrBusSelectionCondition, 100 );
|
||||
selToolMenu.AddItem( SCH_ACTIONS::addHierLabel, wireOrBusSelectionCondition, 100 );
|
||||
selToolMenu.AddItem( SCH_ACTIONS::importSheetPin, singleSheetCondition, 100 );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -352,6 +352,7 @@ bool SCH_EDIT_TOOL::Init()
|
|||
ctxMenu.AddItem( SCH_ACTIONS::editValue, singleComponentCondition );
|
||||
ctxMenu.AddItem( SCH_ACTIONS::editFootprint, singleComponentCondition );
|
||||
ctxMenu.AddItem( SCH_ACTIONS::convertDeMorgan, singleDeMorganSymbolCondition );
|
||||
// JEY TODO: add menu access for changing symbol unit
|
||||
|
||||
ctxMenu.AddSeparator( SELECTION_CONDITIONS::NotEmpty );
|
||||
ctxMenu.AddItem( SCH_ACTIONS::cut, SELECTION_CONDITIONS::NotEmpty );
|
||||
|
@ -375,6 +376,7 @@ bool SCH_EDIT_TOOL::Init()
|
|||
drawingMenu.AddItem( SCH_ACTIONS::editValue, singleComponentCondition, 200 );
|
||||
drawingMenu.AddItem( SCH_ACTIONS::editFootprint, singleComponentCondition, 200 );
|
||||
drawingMenu.AddItem( SCH_ACTIONS::convertDeMorgan, singleDeMorganSymbolCondition, 200 );
|
||||
// JEY TODO: add menu access for changing symbol unit
|
||||
drawingMenu.AddItem( SCH_ACTIONS::toShapeSlash, entryCondition, 200 );
|
||||
drawingMenu.AddItem( SCH_ACTIONS::toShapeBackslash, entryCondition, 200 );
|
||||
drawingMenu.AddItem( SCH_ACTIONS::toLabel, toLabelCondition, 200 );
|
||||
|
@ -405,6 +407,7 @@ bool SCH_EDIT_TOOL::Init()
|
|||
selToolMenu.AddItem( SCH_ACTIONS::editFootprint, singleSymbolCondition, 200 );
|
||||
selToolMenu.AddItem( SCH_ACTIONS::autoplaceFields, singleComponentCondition, 200 );
|
||||
selToolMenu.AddItem( SCH_ACTIONS::convertDeMorgan, singleDeMorganSymbolCondition, 200 );
|
||||
// JEY TODO: add menu access for changing symbol unit
|
||||
selToolMenu.AddItem( SCH_ACTIONS::showDatasheet, singleSymbolCondition, 200 );
|
||||
selToolMenu.AddItem( SCH_ACTIONS::toShapeSlash, entryCondition, 200 );
|
||||
selToolMenu.AddItem( SCH_ACTIONS::toShapeBackslash, entryCondition, 200 );
|
||||
|
|
Loading…
Reference in New Issue