Add some more context menu stuff to eeschema modern toolset.

This commit is contained in:
Jeff Young 2019-04-29 11:41:27 +01:00
parent b526461a8e
commit ddbd92c274
8 changed files with 170 additions and 132 deletions

View File

@ -132,6 +132,7 @@ enum id_eeschema_frm
ID_POPUP_SCH_BREAK_WIRE,
ID_POPUP_SCH_BEGIN_WIRE,
ID_POPUP_SCH_BEGIN_BUS,
ID_POPUP_SCH_BEGIN_LINES,
ID_POPUP_SCH_DELETE_CONNECTION,
ID_POPUP_SCH_DELETE_NODE,
ID_POPUP_SCH_ENTRY_SELECT_SLASH,

View File

@ -123,8 +123,6 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
return true;
}
bool is_new = item->IsNew();
switch( item->Type() )
{
case SCH_NO_CONNECT_T:
@ -181,7 +179,6 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
case SCH_SHEET_T:
AddMenusForHierchicalSheet( PopMenu, (SCH_SHEET*) item );
break;
}
PopMenu->AppendSeparator();
@ -197,12 +194,6 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, SYMBOL_LIB
void AddMenusForEditComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, SYMBOL_LIB_TABLE* aLibs )
{
if( Component->Type() != SCH_COMPONENT_T )
{
wxASSERT( 0 );
return;
}
wxString msg;
LIB_PART* part = NULL;
LIB_ALIAS* alias = NULL;
@ -360,13 +351,6 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
wxPoint pos = frame->GetCrossHairPosition();
wxString msg;
if( Wire == NULL )
{
msg = AddHotkeyName( _( "Begin Wire" ), g_Schematic_Hotkeys_Descr, HK_BEGIN_WIRE );
AddMenuItem( PopMenu, ID_POPUP_SCH_BEGIN_WIRE, msg, KiBitmap( add_line_xpm ) );
return;
}
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ),
KiBitmap( delete_node_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
@ -398,13 +382,6 @@ void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame )
wxPoint pos = frame->GetCrossHairPosition();
wxString msg;
if( Bus == NULL )
{
msg = AddHotkeyName( _( "Begin Bus" ), g_Schematic_Hotkeys_Descr, HK_BEGIN_BUS );
AddMenuItem( PopMenu, ID_POPUP_SCH_BEGIN_BUS, msg, KiBitmap( add_bus_xpm ) );
return;
}
AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Bus" ), KiBitmap( break_bus_xpm ) );
// TODO(JE) remove once real-time is enabled

View File

@ -164,6 +164,9 @@ OPT<TOOL_EVENT> SCH_ACTIONS::TranslateLegacyId( int aId )
case ID_TEXT_COMMENT_BUTT:
return SCH_ACTIONS::placeSchematicText.MakeEvent();
case ID_POPUP_SCH_BEGIN_LINES:
return SCH_ACTIONS::startLines.MakeEvent();
case ID_MENU_LINE_COMMENT_BUTT:
case ID_LINE_COMMENT_BUTT:
return SCH_ACTIONS::drawLines.MakeEvent();

View File

@ -107,6 +107,7 @@ public:
static TOOL_ACTION placeSheetPin;
static TOOL_ACTION importSheetPin;
static TOOL_ACTION placeSchematicText;
static TOOL_ACTION startLines;
static TOOL_ACTION drawLines;
static TOOL_ACTION placeImage;
static TOOL_ACTION finishLineWireOrBus;

View File

@ -51,86 +51,106 @@
// Drawing tool actions
TOOL_ACTION SCH_ACTIONS::placeSymbol( "eeschema.InteractiveDrawing.placeSymbol",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_NEW_COMPONENT ),
_( "Add Symbol" ), _( "Add a symbol" ), NULL, AF_ACTIVATE );
_( "Add Symbol" ), _( "Add a symbol" ),
nullptr, AF_ACTIVATE );
TOOL_ACTION SCH_ACTIONS::placePower( "eeschema.InteractiveDrawing.placePowerPort",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_NEW_POWER ),
_( "Add Power" ), _( "Add a power port" ), NULL, AF_ACTIVATE );
_( "Add Power" ), _( "Add a power port" ),
nullptr, AF_ACTIVATE );
TOOL_ACTION SCH_ACTIONS::startWire( "eeschema.InteractiveDrawing.startWire",
AS_GLOBAL, 0,
_( "Begin Wire" ), _( "Start drawing a wire" ), NULL, AF_ACTIVATE );
_( "Begin Wire" ), _( "Start drawing a wire" ),
add_line_xpm, AF_ACTIVATE );
TOOL_ACTION SCH_ACTIONS::drawWire( "eeschema.InteractiveDrawing.drawWire",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_BEGIN_WIRE ),
_( "Add Wire" ), _( "Add a wire" ), NULL, AF_ACTIVATE );
_( "Add Wire" ), _( "Add a wire" ),
nullptr, AF_ACTIVATE );
TOOL_ACTION SCH_ACTIONS::startBus( "eeschema.InteractiveDrawing.startBus",
AS_GLOBAL, 0,
_( "Begin Bus" ), _( "Start drawing a bus" ), NULL, AF_ACTIVATE );
_( "Begin Bus" ), _( "Start drawing a bus" ),
add_bus_xpm, AF_ACTIVATE );
TOOL_ACTION SCH_ACTIONS::drawBus( "eeschema.InteractiveDrawing.drawBus",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_BEGIN_BUS ),
_( "Add Bus" ), _( "Add a bus" ), NULL, AF_ACTIVATE );
_( "Add Bus" ), _( "Add a bus" ),
nullptr, AF_ACTIVATE );
TOOL_ACTION SCH_ACTIONS::unfoldBus( "eeschema.InteractiveDrawing.unfoldBus",
AS_GLOBAL, 0, "", "", NULL, AF_ACTIVATE );
TOOL_ACTION SCH_ACTIONS::placeNoConnect( "eeschema.InteractiveDrawing.placeNoConnect",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_NOCONN_FLAG ),
_( "Add No Connect Flag" ), _( "Add a no-connection flag" ), NULL, AF_ACTIVATE );
_( "Add No Connect Flag" ), _( "Add a no-connection flag" ),
nullptr, AF_ACTIVATE );
TOOL_ACTION SCH_ACTIONS::placeJunction( "eeschema.InteractiveDrawing.placeJunction",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_JUNCTION ),
_( "Add Junction" ), _( "Add a junction" ), NULL, AF_ACTIVATE );
_( "Add Junction" ), _( "Add a junction" ),
NULL, AF_ACTIVATE );
TOOL_ACTION SCH_ACTIONS::placeBusWireEntry( "eeschema.InteractiveDrawing.placeBusWireEntry",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_WIRE_ENTRY ),
_( "Add Wire to Bus Entry" ), _( "Add a wire entry to a bus" ), NULL, AF_ACTIVATE );
_( "Add Wire to Bus Entry" ), _( "Add a wire entry to a bus" ),
NULL, AF_ACTIVATE );
TOOL_ACTION SCH_ACTIONS::placeBusBusEntry( "eeschema.InteractiveDrawing.placeBusBusEntry",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_BUS_ENTRY ),
_( "Add Bus to Bus Entry" ), _( "Add a bus entry to a bus" ), NULL, AF_ACTIVATE );
_( "Add Bus to Bus Entry" ), _( "Add a bus entry to a bus" ),
NULL, AF_ACTIVATE );
TOOL_ACTION SCH_ACTIONS::placeLabel( "eeschema.InteractiveDrawing.placeLabel",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_LABEL ),
_( "Add Label" ), _( "Add a net label" ), NULL, AF_ACTIVATE );
_( "Add Label" ), _( "Add a net label" ),
NULL, AF_ACTIVATE );
TOOL_ACTION SCH_ACTIONS::placeHierarchicalLabel( "eeschema.InteractiveDrawing.placeHierarchicalLabel",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_HLABEL ),
_( "Add Hierarchical Label" ), _( "Add a hierarchical sheet label" ), NULL, AF_ACTIVATE );
_( "Add Hierarchical Label" ), _( "Add a hierarchical sheet label" ),
NULL, AF_ACTIVATE );
TOOL_ACTION SCH_ACTIONS::drawSheet( "eeschema.InteractiveDrawing.drawSheet",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_HIER_SHEET ),
_( "Add Sheet" ), _( "Add a hierarchical sheet" ), NULL, AF_ACTIVATE );
_( "Add Sheet" ), _( "Add a hierarchical sheet" ),
NULL, AF_ACTIVATE );
TOOL_ACTION SCH_ACTIONS::resizeSheet( "eeschema.InteractiveDrawing.resizeSheet",
AS_GLOBAL, 0,
_( "Resize Sheet" ), _( "Resize hierarchical sheet" ), NULL, AF_NONE );
AS_GLOBAL, 0, _( "Resize Sheet" ), _( "Resize hierarchical sheet" ),
NULL, AF_NONE );
TOOL_ACTION SCH_ACTIONS::placeSheetPin( "eeschema.InteractiveDrawing.placeSheetPin",
AS_GLOBAL, 0,
_( "Add Sheet Pin" ), _( "Add a sheet pin" ), NULL, AF_ACTIVATE );
AS_GLOBAL, 0, _( "Add Sheet Pin" ), _( "Add a sheet pin" ),
NULL, AF_ACTIVATE );
TOOL_ACTION SCH_ACTIONS::importSheetPin( "eeschema.InteractiveDrawing.importSheetPin",
AS_GLOBAL, 0,
_( "Import Sheet Pin" ), _( "Import a hierarchical sheet pin" ), NULL, AF_ACTIVATE );
AS_GLOBAL, 0, _( "Import Sheet Pin" ), _( "Import a hierarchical sheet pin" ),
NULL, AF_ACTIVATE );
TOOL_ACTION SCH_ACTIONS::placeGlobalLabel( "eeschema.InteractiveDrawing.placeGlobalLabel",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_GLABEL ),
_( "Add Global Label" ), _( "Add a global label" ), NULL, AF_ACTIVATE );
_( "Add Global Label" ), _( "Add a global label" ),
NULL, AF_ACTIVATE );
TOOL_ACTION SCH_ACTIONS::placeSchematicText( "eeschema.InteractiveDrawing.placeSchematicText",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_GRAPHIC_TEXT ),
_( "Add Text" ), _( "Add text" ), NULL, AF_ACTIVATE );
_( "Add Text" ), _( "Add text" ),
NULL, AF_ACTIVATE );
TOOL_ACTION SCH_ACTIONS::startLines( "eeschema.InteractiveDrawing.startLines",
AS_GLOBAL, 0, _( "Begin Lines" ), _( "Start drawing connected graphic lines" ),
add_line_xpm, AF_ACTIVATE );
TOOL_ACTION SCH_ACTIONS::drawLines( "eeschema.InteractiveDrawing.drawLines",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_GRAPHIC_POLYLINE ),
_( "Add Lines" ), _( "Add connected graphic lines" ), NULL, AF_ACTIVATE );
_( "Add Lines" ), _( "Add connected graphic lines" ),
nullptr, AF_ACTIVATE );
TOOL_ACTION SCH_ACTIONS::placeImage( "eeschema.InteractiveDrawing.placeImage",
AS_GLOBAL, 0,
_( "Add Image" ), _( "Add bitmap image" ), NULL, AF_ACTIVATE );
AS_GLOBAL, 0, _( "Add Image" ), _( "Add bitmap image" ),
nullptr, AF_ACTIVATE );
TOOL_ACTION SCH_ACTIONS::finishLineWireOrBus( "eeschema.InteractiveDrawing.finishLineWireOrBus",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_END_CURR_LINEWIREBUS ),
@ -138,29 +158,32 @@ TOOL_ACTION SCH_ACTIONS::finishLineWireOrBus( "eeschema.InteractiveDrawing.finis
checked_ok_xpm, AF_NONE );
TOOL_ACTION SCH_ACTIONS::finishWire( "eeschema.InteractiveDrawing.finishWire",
AS_GLOBAL, 0,
_( "Finish Bus" ), _( "Complete wire at current segment" ), checked_ok_xpm, AF_NONE );
AS_GLOBAL, 0, _( "Finish Wire" ), _( "Complete wire with current segment" ),
checked_ok_xpm, AF_NONE );
TOOL_ACTION SCH_ACTIONS::finishBus( "eeschema.InteractiveDrawing.finishBus",
AS_GLOBAL, 0,
_( "Finish Bus" ), _( "Complete bus at current segment" ), checked_ok_xpm, AF_NONE );
AS_GLOBAL, 0, _( "Finish Bus" ), _( "Complete bus with current segment" ),
checked_ok_xpm, AF_NONE );
TOOL_ACTION SCH_ACTIONS::finishLine( "eeschema.InteractiveDrawing.finishLine",
AS_GLOBAL, 0,
_( "Finish Line" ), _( "Complete polyline at current segment" ), checked_ok_xpm, AF_NONE );
AS_GLOBAL, 0, _( "Finish Lines" ), _( "Complete connected lines with current segment" ),
checked_ok_xpm, AF_NONE );
TOOL_ACTION SCH_ACTIONS::finishSheet( "eeschema.InteractiveDrawing.finishSheet",
AS_GLOBAL, 0,
_( "Finish Sheet" ), _( "Finish drawing sheet" ), checked_ok_xpm, AF_NONE );
AS_GLOBAL, 0, _( "Finish Sheet" ), _( "Finish drawing sheet" ),
checked_ok_xpm, AF_NONE );
TOOL_ACTION SCH_ACTIONS::addJunction( "eeschema.InteractiveEditing.addJunction",
AS_GLOBAL, 0, "", "", NULL, AF_NONE );
AS_GLOBAL, 0, _( "Add Junction" ), _( "Add a wire or bus junction" ),
add_junction_xpm, AF_NONE );
TOOL_ACTION SCH_ACTIONS::addLabel( "eeschema.InteractiveEditing.addLabel",
AS_GLOBAL, 0, "", "", NULL, AF_NONE );
AS_GLOBAL, 0, _( "Add Label" ), _( "Add a label to a wire or bus" ),
add_line_label_xpm, AF_NONE );
TOOL_ACTION SCH_ACTIONS::addGlobalLabel( "eeschema.InteractiveEditing.addGlobalLabel",
AS_GLOBAL, 0, "", "", NULL, AF_NONE );
AS_GLOBAL, 0, _( "Add Global Label" ), _( "Add a global label to a wire or bus" ),
add_glabel_xpm, AF_NONE );
SCH_DRAWING_TOOL::SCH_DRAWING_TOOL() :
@ -187,37 +210,34 @@ bool SCH_DRAWING_TOOL::Init()
return ( m_frame->GetToolId() != ID_NO_TOOL_SELECTED );
};
auto drawingWireCondition = [] ( const SELECTION& aSel ) {
if( aSel.GetSize() == 1 )
{
SCH_LINE* line = dynamic_cast<SCH_LINE*>( aSel.GetItem( 0 ) );
return ( line && line->GetLayer() == LAYER_WIRE );
}
return false;
auto idleWireCondition = [ this ] ( const SELECTION& aSel ) {
return ( m_frame->GetToolId() == ID_WIRE_BUTT && aSel.Empty() );
};
auto drawingBusCondition = [] ( const SELECTION& aSel ) {
if( aSel.GetSize() == 1 )
{
SCH_LINE* line = dynamic_cast<SCH_LINE*>( aSel.GetItem( 0 ) );
return ( line && line->GetLayer() == LAYER_BUS );
}
return false;
auto idleBusCondition = [ this ] ( const SELECTION& aSel ) {
return ( m_frame->GetToolId() == ID_BUS_BUTT && aSel.Empty() );
};
auto drawingLineCondition = [] ( const SELECTION& aSel ) {
if( aSel.GetSize() == 1 )
{
SCH_LINE* line = dynamic_cast<SCH_LINE*>( aSel.GetItem( 0 ) );
auto idleLineCondition = [ this ] ( const SELECTION& aSel ) {
return ( m_frame->GetToolId() == ID_LINE_COMMENT_BUTT && aSel.Empty() );
};
return ( line && line->GetLayer() == LAYER_NOTES );
}
auto drawingWireCondition = [ this ] ( const SELECTION& aSel ) {
return ( m_frame->GetToolId() == ID_WIRE_BUTT
&& aSel.GetSize() == 1
&& dynamic_cast<SCH_LINE*>( aSel.GetItem( 0 ) ) );
};
return false;
auto drawingBusCondition = [ this ] ( const SELECTION& aSel ) {
return ( m_frame->GetToolId() == ID_BUS_BUTT
&& aSel.GetSize() == 1
&& dynamic_cast<SCH_LINE*>( aSel.GetItem( 0 ) ) );
};
auto drawingLineCondition = [ this ] ( const SELECTION& aSel ) {
return ( m_frame->GetToolId() == ID_LINE_COMMENT_BUTT
&& aSel.GetSize() == 1
&& dynamic_cast<SCH_LINE*>( aSel.GetItem( 0 ) ) );
};
auto& ctxMenu = m_menu.GetMenu();
@ -225,6 +245,9 @@ bool SCH_DRAWING_TOOL::Init()
// cancel current tool goes in main context menu at the top if present
ctxMenu.AddItem( ACTIONS::cancelInteractive, activeToolCondition, 1 );
ctxMenu.AddItem( SCH_ACTIONS::startWire, idleWireCondition, 1 );
ctxMenu.AddItem( SCH_ACTIONS::startBus, idleBusCondition, 1 );
ctxMenu.AddItem( SCH_ACTIONS::startLines, idleLineCondition, 1 );
ctxMenu.AddItem( SCH_ACTIONS::finishWire, drawingWireCondition, 1 );
ctxMenu.AddItem( SCH_ACTIONS::finishBus, drawingBusCondition, 1 );
ctxMenu.AddItem( SCH_ACTIONS::finishLine, drawingLineCondition, 1 );
@ -840,7 +863,7 @@ int SCH_DRAWING_TOOL::DrawWire( const TOOL_EVENT& aEvent )
int SCH_DRAWING_TOOL::StartBus( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_WIRE_BUTT, wxCURSOR_PENCIL, _( "Add bus" ) );
m_frame->SetToolID( ID_BUS_BUTT, wxCURSOR_PENCIL, _( "Add bus" ) );
m_frame->GetCanvas()->MoveCursorToCrossHair();
SCH_LINE* segment = startSegments( LAYER_BUS, m_frame->GetCrossHairPosition() );
@ -900,10 +923,25 @@ int SCH_DRAWING_TOOL::UnfoldBus( const TOOL_EVENT& aEvent )
}
int SCH_DRAWING_TOOL::DrawLines( const TOOL_EVENT& aEvent)
int SCH_DRAWING_TOOL::StartLines( const TOOL_EVENT& aEvent)
{
m_frame->SetToolID( ID_LINE_COMMENT_BUTT, wxCURSOR_PENCIL, _( "Add lines" ) );
return doDrawSegments( LAYER_NOTES, nullptr );
m_frame->GetCanvas()->MoveCursorToCrossHair();
SCH_LINE* segment = startSegments( LAYER_NOTES, m_frame->GetCrossHairPosition() );
return doDrawSegments( LAYER_BUS, segment );
}
int SCH_DRAWING_TOOL::DrawLines( const TOOL_EVENT& aEvent)
{
if( m_frame->GetToolId() == ID_LINE_COMMENT_BUTT )
return StartLines( aEvent );
else
{
m_frame->SetToolID( ID_LINE_COMMENT_BUTT, wxCURSOR_PENCIL, _( "Add lines" ) );
return doDrawSegments( LAYER_NOTES, nullptr );
}
}
@ -1561,6 +1599,7 @@ void SCH_DRAWING_TOOL::setTransitions()
Go( &SCH_DRAWING_TOOL::StartWire, SCH_ACTIONS::startWire.MakeEvent() );
Go( &SCH_DRAWING_TOOL::StartBus, SCH_ACTIONS::startBus.MakeEvent() );
Go( &SCH_DRAWING_TOOL::StartLines, SCH_ACTIONS::startLines.MakeEvent() );
Go( &SCH_DRAWING_TOOL::AddJunction, SCH_ACTIONS::addJunction.MakeEvent() );
Go( &SCH_DRAWING_TOOL::AddLabel, SCH_ACTIONS::addLabel.MakeEvent() );
Go( &SCH_DRAWING_TOOL::AddGlobalLabel, SCH_ACTIONS::addGlobalLabel.MakeEvent() );

View File

@ -75,6 +75,7 @@ public:
int StartWire( const TOOL_EVENT& aEvent );
int StartBus( const TOOL_EVENT& aEvent );
int StartLines( const TOOL_EVENT& aEvent );
int AddJunction( const TOOL_EVENT& aEvent );
int AddLabel( const TOOL_EVENT& aEvent );
int AddGlobalLabel( const TOOL_EVENT& aEvent );

View File

@ -47,67 +47,83 @@
TOOL_ACTION SCH_ACTIONS::move( "eeschema.InteractiveEdit.move",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_MOVE_COMPONENT_OR_ITEM ),
_( "Move" ), _( "Moves the selected item(s)" ), move_xpm, AF_ACTIVATE );
_( "Move" ), _( "Moves the selected item(s)" ),
move_xpm, AF_ACTIVATE );
TOOL_ACTION SCH_ACTIONS::drag( "eeschema.InteractiveEdit.drag",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DRAG ),
_( "Drag" ), _( "Drags the selected item(s)" ), move_xpm, AF_ACTIVATE );
_( "Drag" ), _( "Drags the selected item(s)" ),
move_xpm, AF_ACTIVATE );
TOOL_ACTION SCH_ACTIONS::duplicate( "eeschema.InteractiveEdit.duplicate",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DUPLICATE ),
_( "Duplicate" ), _( "Duplicates the selected item(s)" ), duplicate_xpm );
_( "Duplicate" ), _( "Duplicates the selected item(s)" ),
duplicate_xpm );
TOOL_ACTION SCH_ACTIONS::repeatDrawItem( "eeschema.InteractiveEdit.repeatDrawItem",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_REPEAT_LAST ),
_( "Repeat Last Item" ), _( "Duplicates the last drawn item" ) );
_( "Repeat Last Item" ), _( "Duplicates the last drawn item" ),
nullptr );
TOOL_ACTION SCH_ACTIONS::rotateCW( "eeschema.InteractiveEdit.rotateCW",
AS_GLOBAL, 0,
_( "Rotate Clockwise" ), _( "Rotates selected item(s) clockwise" ), rotate_cw_xpm );
_( "Rotate Clockwise" ), _( "Rotates selected item(s) clockwise" ),
rotate_cw_xpm );
TOOL_ACTION SCH_ACTIONS::rotateCCW( "eeschema.InteractiveEdit.rotateCCW",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROTATE ),
_( "Rotate" ), _( "Rotates selected item(s) counter-clockwise" ), rotate_ccw_xpm );
_( "Rotate" ), _( "Rotates selected item(s) counter-clockwise" ),
rotate_ccw_xpm );
TOOL_ACTION SCH_ACTIONS::mirrorX( "eeschema.InteractiveEdit.mirrorX",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_MIRROR_X ),
_( "Mirror Around Horizontal Axis" ), _( "Flips selected item(s) from top to bottom" ), mirror_h_xpm );
_( "Mirror Around Horizontal Axis" ), _( "Flips selected item(s) from top to bottom" ),
mirror_h_xpm );
TOOL_ACTION SCH_ACTIONS::mirrorY( "eeschema.InteractiveEdit.mirrorY",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_MIRROR_Y ),
_( "Mirror Around Vertical Axis" ), _( "Flips selected item(s) from left to right" ), mirror_v_xpm );
_( "Mirror Around Vertical Axis" ), _( "Flips selected item(s) from left to right" ),
mirror_v_xpm );
TOOL_ACTION SCH_ACTIONS::properties( "eeschema.InteractiveEdit.properties",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT ),
_( "Properties..." ), _( "Displays item properties dialog" ), config_xpm );
_( "Properties..." ), _( "Displays item properties dialog" ),
edit_xpm );
TOOL_ACTION SCH_ACTIONS::editReference( "eeschema.InteractiveEdit.editReference",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_COMPONENT_REFERENCE ),
_( "Edit Reference..." ), _( "Displays reference field dialog" ), config_xpm );
_( "Edit Reference..." ), _( "Displays reference field dialog" ),
edit_comp_ref_xpm );
TOOL_ACTION SCH_ACTIONS::editValue( "eeschema.InteractiveEdit.editValue",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_COMPONENT_VALUE ),
_( "Edit Value..." ), _( "Displays value field dialog" ), config_xpm );
_( "Edit Value..." ), _( "Displays value field dialog" ),
edit_comp_value_xpm );
TOOL_ACTION SCH_ACTIONS::editFootprint( "eeschema.InteractiveEdit.editFootprint",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_COMPONENT_FOOTPRINT ),
_( "Edit Footprint..." ), _( "Displays footprint field dialog" ), config_xpm );
_( "Edit Footprint..." ), _( "Displays footprint field dialog" ),
edit_comp_footprint_xpm );
TOOL_ACTION SCH_ACTIONS::autoplaceFields( "eeschema.InteractiveEdit.autoplaceFields",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_AUTOPLACE_FIELDS ),
_( "Autoplace Fields" ), _( "Runs the automatic placement algorithm on the symbol's fields" ), config_xpm );
_( "Autoplace Fields" ), _( "Runs the automatic placement algorithm on the symbol's fields" ),
autoplace_fields_xpm );
TOOL_ACTION SCH_ACTIONS::showDatasheet( "eeschema.InteractiveEdit.showDatasheet",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SHOW_COMPONENT_DATASHEET ),
_( "Show Datasheet" ), _( "Opens the datasheet in a browser" ), config_xpm );
_( "Show Datasheet" ), _( "Opens the datasheet in a browser" ),
datasheet_xpm );
TOOL_ACTION SCH_ACTIONS::doDelete( "eeschema.InteractiveEdit.doDelete",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DELETE ),
_( "Delete" ), _( "Deletes selected item(s)" ), delete_xpm );
_( "Delete" ), _( "Deletes selected item(s)" ),
delete_xpm );
TOOL_ACTION SCH_ACTIONS::deleteItemCursor( "eeschema.InteractiveEdit.deleteItemCursor",
AS_GLOBAL, 0,
_( "DoDelete Items" ), _( "DoDelete clicked items" ), NULL, AF_ACTIVATE );
_( "DoDelete Items" ), _( "DoDelete clicked items" ),
nullptr, AF_ACTIVATE );
@ -201,43 +217,43 @@ bool SCH_EDIT_TOOL::Init()
//
CONDITIONAL_MENU& drawingMenu = drawingTool->GetToolMenu().GetMenu();
ctxMenu.AddSeparator( SELECTION_CONDITIONS::NotEmpty );
drawingMenu.AddItem( SCH_ACTIONS::rotateCCW, SELECTION_CONDITIONS::NotEmpty );
drawingMenu.AddItem( SCH_ACTIONS::rotateCW, SELECTION_CONDITIONS::NotEmpty );
drawingMenu.AddItem( SCH_ACTIONS::mirrorX, SELECTION_CONDITIONS::NotEmpty );
drawingMenu.AddItem( SCH_ACTIONS::mirrorY, SELECTION_CONDITIONS::NotEmpty );
ctxMenu.AddSeparator( SELECTION_CONDITIONS::NotEmpty, 200 );
drawingMenu.AddItem( SCH_ACTIONS::rotateCCW, SELECTION_CONDITIONS::NotEmpty, 200 );
drawingMenu.AddItem( SCH_ACTIONS::rotateCW, SELECTION_CONDITIONS::NotEmpty, 200 );
drawingMenu.AddItem( SCH_ACTIONS::mirrorX, SELECTION_CONDITIONS::NotEmpty, 200 );
drawingMenu.AddItem( SCH_ACTIONS::mirrorY, SELECTION_CONDITIONS::NotEmpty, 200 );
drawingMenu.AddItem( SCH_ACTIONS::properties, SELECTION_CONDITIONS::Count( 1 ) );
drawingMenu.AddItem( SCH_ACTIONS::editReference, singleComponentCondition );
drawingMenu.AddItem( SCH_ACTIONS::editValue, singleComponentCondition );
drawingMenu.AddItem( SCH_ACTIONS::editReference, singleComponentCondition );
drawingMenu.AddItem( SCH_ACTIONS::properties, SELECTION_CONDITIONS::Count( 1 ), 200 );
drawingMenu.AddItem( SCH_ACTIONS::editReference, singleComponentCondition, 200 );
drawingMenu.AddItem( SCH_ACTIONS::editValue, singleComponentCondition, 200 );
drawingMenu.AddItem( SCH_ACTIONS::editReference, singleComponentCondition, 200 );
// Add editing actions to the selection tool menu
//
CONDITIONAL_MENU& selToolMenu = m_selectionTool->GetToolMenu().GetMenu();
selToolMenu.AddItem( SCH_ACTIONS::move, SELECTION_CONDITIONS::NotEmpty );
selToolMenu.AddItem( SCH_ACTIONS::drag, SELECTION_CONDITIONS::NotEmpty );
selToolMenu.AddItem( SCH_ACTIONS::rotateCCW, SELECTION_CONDITIONS::NotEmpty );
selToolMenu.AddItem( SCH_ACTIONS::rotateCW, SELECTION_CONDITIONS::NotEmpty );
selToolMenu.AddItem( SCH_ACTIONS::mirrorX, SELECTION_CONDITIONS::NotEmpty );
selToolMenu.AddItem( SCH_ACTIONS::mirrorY, SELECTION_CONDITIONS::NotEmpty );
selToolMenu.AddItem( SCH_ACTIONS::duplicate, SELECTION_CONDITIONS::NotEmpty );
selToolMenu.AddItem( SCH_ACTIONS::doDelete, SELECTION_CONDITIONS::NotEmpty );
selToolMenu.AddItem( SCH_ACTIONS::move, SELECTION_CONDITIONS::NotEmpty, 200 );
selToolMenu.AddItem( SCH_ACTIONS::drag, SELECTION_CONDITIONS::NotEmpty, 200 );
selToolMenu.AddItem( SCH_ACTIONS::rotateCCW, SELECTION_CONDITIONS::NotEmpty, 200 );
selToolMenu.AddItem( SCH_ACTIONS::rotateCW, SELECTION_CONDITIONS::NotEmpty, 200 );
selToolMenu.AddItem( SCH_ACTIONS::mirrorX, SELECTION_CONDITIONS::NotEmpty, 200 );
selToolMenu.AddItem( SCH_ACTIONS::mirrorY, SELECTION_CONDITIONS::NotEmpty, 200 );
selToolMenu.AddItem( SCH_ACTIONS::duplicate, SELECTION_CONDITIONS::NotEmpty, 200 );
selToolMenu.AddItem( SCH_ACTIONS::doDelete, SELECTION_CONDITIONS::NotEmpty, 200 );
selToolMenu.AddItem( SCH_ACTIONS::properties, SELECTION_CONDITIONS::Count( 1 ) );
selToolMenu.AddItem( SCH_ACTIONS::editReference, singleSymbolCondition );
selToolMenu.AddItem( SCH_ACTIONS::editValue, singleSymbolCondition );
selToolMenu.AddItem( SCH_ACTIONS::editReference, singleSymbolCondition );
selToolMenu.AddItem( SCH_ACTIONS::autoplaceFields, singleComponentCondition );
selToolMenu.AddItem( SCH_ACTIONS::showDatasheet, singleSymbolCondition );
selToolMenu.AddItem( SCH_ACTIONS::properties, SELECTION_CONDITIONS::Count( 1 ), 200 );
selToolMenu.AddItem( SCH_ACTIONS::editReference, singleSymbolCondition, 200 );
selToolMenu.AddItem( SCH_ACTIONS::editValue, singleSymbolCondition, 200 );
selToolMenu.AddItem( SCH_ACTIONS::editReference, singleSymbolCondition, 200 );
selToolMenu.AddItem( SCH_ACTIONS::autoplaceFields, singleComponentCondition, 200 );
selToolMenu.AddItem( SCH_ACTIONS::showDatasheet, singleSymbolCondition, 200 );
selToolMenu.AddSeparator( SELECTION_CONDITIONS::NotEmpty );
selToolMenu.AddItem( SCH_ACTIONS::cut, SELECTION_CONDITIONS::NotEmpty );
selToolMenu.AddItem( SCH_ACTIONS::copy, SELECTION_CONDITIONS::NotEmpty );
selToolMenu.AddSeparator( SELECTION_CONDITIONS::NotEmpty, 200 );
selToolMenu.AddItem( SCH_ACTIONS::cut, SELECTION_CONDITIONS::NotEmpty, 200 );
selToolMenu.AddItem( SCH_ACTIONS::copy, SELECTION_CONDITIONS::NotEmpty, 200 );
// 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.
selToolMenu.AddItem( SCH_ACTIONS::paste, noActiveToolCondition );
selToolMenu.AddItem( SCH_ACTIONS::paste, noActiveToolCondition, 200 );
return true;
}

View File

@ -73,15 +73,15 @@ TOOL_ACTION SCH_ACTIONS::highlightNetCursor( "eeschema.EditorControl.highlightNe
TOOL_ACTION SCH_ACTIONS::cut( "eeschema.EditorControl.cut",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_CUT ),
_( "Cut" ), _( "Cut selected item(s) to clipboard" ), NULL );
_( "Cut" ), _( "Cut selected item(s) to clipboard" ), cut_xpm );
TOOL_ACTION SCH_ACTIONS::copy( "eeschema.EditorControl.copy",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_COPY ),
_( "Copy" ), _( "Copy selected item(s) to clipboard" ), NULL );
_( "Copy" ), _( "Copy selected item(s) to clipboard" ), copy_xpm );
TOOL_ACTION SCH_ACTIONS::paste( "eeschema.EditorControl.paste",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_PASTE ),
_( "Paste" ), _( "Paste clipboard into schematic" ), NULL );
_( "Paste" ), _( "Paste clipboard into schematic" ), paste_xpm );
SCH_EDITOR_CONTROL::SCH_EDITOR_CONTROL() :