Build out some of the modern toolkit context menus.
This commit is contained in:
parent
7632f89157
commit
42383ae871
|
@ -71,9 +71,11 @@ void GRID_MENU::update()
|
|||
|
||||
for( unsigned int i = 0; i < GetMenuItemCount(); ++i )
|
||||
{
|
||||
int menuId = ID_POPUP_GRID_SELECT + 1 + i;
|
||||
GRID_TYPE& grid = screen->GetGrid( i );
|
||||
wxMenuItem* menuItem = FindItemByPosition( i );
|
||||
|
||||
SetLabel( menuId, gridsList[i] ); // Refresh label in case units have changed
|
||||
Check( menuId, menuId == currentId ); // Refresh checkmark
|
||||
menuItem->SetId( grid.m_CmdId );
|
||||
menuItem->SetItemLabel( gridsList[ i ] ); // Refresh label in case units have changed
|
||||
menuItem->Check( grid.m_CmdId == currentId ); // Refresh checkmark
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ void TOOL_MENU::CloseContextMenu( OPT_TOOL_EVENT& evt )
|
|||
// This makes the factory functions a bit less verbose
|
||||
using S_C = SELECTION_CONDITIONS;
|
||||
|
||||
void TOOL_MENU::AddStandardSubMenus( EDA_DRAW_FRAME& aFrame )
|
||||
void TOOL_MENU::AddStandardSubMenus( EDA_DRAW_FRAME* aFrame )
|
||||
{
|
||||
m_menu.AddItem( ACTIONS::zoomCenter, S_C::ShowAlways, 1000 );
|
||||
m_menu.AddItem( ACTIONS::zoomIn, S_C::ShowAlways, 1000 );
|
||||
|
@ -101,6 +101,9 @@ void TOOL_MENU::AddStandardSubMenus( EDA_DRAW_FRAME& aFrame )
|
|||
|
||||
m_menu.AddSeparator(SELECTION_CONDITIONS::ShowAlways, 1000 );
|
||||
|
||||
m_menu.AddMenu( createOwnSubMenu<ZOOM_MENU>( &aFrame ).get(), false, S_C::ShowAlways, 1000 );
|
||||
m_menu.AddMenu( createOwnSubMenu<GRID_MENU>( &aFrame ).get(), false, S_C::ShowAlways, 1000 );
|
||||
if( aFrame )
|
||||
{
|
||||
m_menu.AddMenu( createOwnSubMenu<ZOOM_MENU>( aFrame ).get(), false, S_C::ShowAlways, 1000 );
|
||||
m_menu.AddMenu( createOwnSubMenu<GRID_MENU>( aFrame ).get(), false, S_C::ShowAlways, 1000 );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ CVPCB_SELECTION_TOOL::~CVPCB_SELECTION_TOOL()
|
|||
|
||||
bool CVPCB_SELECTION_TOOL::Init()
|
||||
{
|
||||
m_menu.AddStandardSubMenus( *getEditFrame<DISPLAY_FOOTPRINTS_FRAME>() );
|
||||
m_menu.AddStandardSubMenus( getEditFrame<DISPLAY_FOOTPRINTS_FRAME>() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -683,40 +683,6 @@ const AUTOPLACER::SIDE AUTOPLACER::SIDE_LEFT( -1, 0 );
|
|||
const AUTOPLACER::SIDE AUTOPLACER::SIDE_RIGHT( 1, 0 );
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::OnAutoplaceFields( wxCommandEvent& aEvent )
|
||||
{
|
||||
SCH_SELECTION_TOOL* selTool = GetToolManager()->GetTool<SCH_SELECTION_TOOL>();
|
||||
SCH_SCREEN* screen = GetScreen();
|
||||
SCH_ITEM* item = screen->GetCurItem();
|
||||
|
||||
// Get the item under cursor if we're not currently moving something
|
||||
if( !item )
|
||||
{
|
||||
if( aEvent.GetInt() == 0 )
|
||||
return;
|
||||
|
||||
auto& data = dynamic_cast<EDA_HOTKEY_CLIENT_DATA&>( *aEvent.GetClientObject() );
|
||||
item = selTool->SelectPoint( data.GetPosition(), SCH_COLLECTOR::MovableItems );
|
||||
screen->SetCurItem( NULL );
|
||||
|
||||
if( !item || item->GetEditFlags() )
|
||||
return;
|
||||
}
|
||||
|
||||
SCH_COMPONENT* component = dynamic_cast<SCH_COMPONENT*>( item );
|
||||
if( !component )
|
||||
return;
|
||||
|
||||
if( !component->IsNew() )
|
||||
SaveCopyInUndoList( component, UR_CHANGED );
|
||||
|
||||
component->AutoplaceFields( screen, /* aManual */ true );
|
||||
|
||||
RefreshItem( component );
|
||||
OnModify();
|
||||
}
|
||||
|
||||
|
||||
void SCH_COMPONENT::AutoplaceFields( SCH_SCREEN* aScreen, bool aManual )
|
||||
{
|
||||
if( aManual )
|
||||
|
|
|
@ -132,7 +132,6 @@ enum id_eeschema_frm
|
|||
ID_POPUP_SCH_BREAK_WIRE,
|
||||
ID_POPUP_SCH_BEGIN_WIRE,
|
||||
ID_POPUP_SCH_BEGIN_BUS,
|
||||
ID_POPUP_END_LINE,
|
||||
ID_POPUP_SCH_DELETE_CONNECTION,
|
||||
ID_POPUP_SCH_DELETE_NODE,
|
||||
ID_POPUP_SCH_ENTRY_SELECT_SLASH,
|
||||
|
@ -197,6 +196,7 @@ enum id_eeschema_frm
|
|||
ID_SCH_DRAG,
|
||||
ID_SCH_DUPLICATE,
|
||||
ID_SCH_DELETE,
|
||||
ID_SCH_END_LINE_WIRE_OR_BUS,
|
||||
ID_SCH_UNFOLD_BUS,
|
||||
|
||||
ID_AUTOPLACE_FIELDS,
|
||||
|
|
|
@ -127,7 +127,7 @@ static EDA_HOTKEY HkMouseLeftDClick( _HKI( "Mouse Left Double Click" ), HK_LEFT_
|
|||
static EDA_HOTKEY HkBeginWire( _HKI( "Begin Wire" ), HK_BEGIN_WIRE, 'W', ID_WIRE_BUTT );
|
||||
static EDA_HOTKEY HkBeginBus( _HKI( "Begin Bus" ), HK_BEGIN_BUS, 'B', ID_BUS_BUTT );
|
||||
static EDA_HOTKEY HkEndLineWireBus( _HKI( "End Line Wire Bus" ), HK_END_CURR_LINEWIREBUS, 'K',
|
||||
ID_POPUP_END_LINE );
|
||||
ID_SCH_END_LINE_WIRE_OR_BUS );
|
||||
|
||||
static EDA_HOTKEY HkAddLabel( _HKI( "Add Label" ), HK_ADD_LABEL, 'L', ID_LABEL_BUTT );
|
||||
static EDA_HOTKEY HkAddHierarchicalLabel( _HKI( "Add Hierarchical Label" ), HK_ADD_HLABEL, 'H',
|
||||
|
|
|
@ -92,61 +92,6 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
|
|||
// Do not start a block command on context menu.
|
||||
m_canvas->SetCanStartBlock( -1 );
|
||||
|
||||
if( blockActive )
|
||||
{
|
||||
AddMenusForBlock( PopMenu, this );
|
||||
PopMenu->AppendSeparator();
|
||||
|
||||
// If we have a block containing only one main element we append its edit submenu
|
||||
if( item != NULL )
|
||||
{
|
||||
switch( item->Type() )
|
||||
{
|
||||
case SCH_COMPONENT_T:
|
||||
AddMenusForEditComponent( PopMenu, (SCH_COMPONENT *) item,
|
||||
Prj().SchSymbolLibTable() );
|
||||
PopMenu->AppendSeparator();
|
||||
break;
|
||||
|
||||
case SCH_TEXT_T:
|
||||
msg = AddHotkeyName( _( "Edit Text..." ), g_Schematic_Hotkeys_Descr, HK_EDIT );
|
||||
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
|
||||
PopMenu->AppendSeparator();
|
||||
break;
|
||||
|
||||
case SCH_LABEL_T:
|
||||
msg = AddHotkeyName( _( "Edit Label..." ), g_Schematic_Hotkeys_Descr, HK_EDIT );
|
||||
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
|
||||
PopMenu->AppendSeparator();
|
||||
break;
|
||||
|
||||
case SCH_GLOBAL_LABEL_T:
|
||||
msg = AddHotkeyName( _( "Edit Global Label..." ), g_Schematic_Hotkeys_Descr,
|
||||
HK_EDIT );
|
||||
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
|
||||
PopMenu->AppendSeparator();
|
||||
break;
|
||||
|
||||
case SCH_HIER_LABEL_T:
|
||||
msg = AddHotkeyName( _( "Edit Hierarchical Label..." ), g_Schematic_Hotkeys_Descr,
|
||||
HK_EDIT );
|
||||
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
|
||||
PopMenu->AppendSeparator();
|
||||
break;
|
||||
|
||||
case SCH_BITMAP_T:
|
||||
msg = AddHotkeyName( _( "Edit Image..." ), g_Schematic_Hotkeys_Descr, HK_EDIT );
|
||||
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( image_xpm ) );
|
||||
PopMenu->AppendSeparator();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Try to locate items at cursor position.
|
||||
if( item == NULL || item->GetEditFlags() == 0 )
|
||||
{
|
||||
|
@ -204,14 +149,6 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
|
|||
|
||||
if( item == NULL )
|
||||
{
|
||||
if( GetToolId() == ID_NO_TOOL_SELECTED && m_blockItems.GetCount() > 0 )
|
||||
{
|
||||
msg = AddHotkeyName( _( "&Paste" ), g_Schematic_Hotkeys_Descr, HK_EDIT_PASTE );
|
||||
AddMenuItem( PopMenu, wxID_PASTE, msg, _( "Pastes item(s) from the Clipboard" ),
|
||||
KiBitmap( paste_xpm ) );
|
||||
PopMenu->AppendSeparator();
|
||||
}
|
||||
|
||||
if( g_CurrentSheet->Last() != g_RootSheet )
|
||||
{
|
||||
msg = AddHotkeyName( _( "Leave Sheet" ), g_Schematic_Hotkeys_Descr, HK_LEAVE_SHEET );
|
||||
|
@ -285,9 +222,6 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
|
|||
|
||||
default:
|
||||
if( is_new )
|
||||
AddMenuItem( PopMenu, ID_POPUP_END_LINE, _( "End Drawing" ),
|
||||
KiBitmap( checked_ok_xpm ) );
|
||||
|
||||
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, _( "Edit..." ),
|
||||
KiBitmap( edit_xpm ) );
|
||||
AddMenuItem( PopMenu, ID_SCH_DELETE, _( "Delete Drawing" ),
|
||||
|
@ -343,34 +277,6 @@ void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field )
|
|||
|
||||
msg = AddHotkeyName( name, g_Schematic_Hotkeys_Descr, HK_ROTATE );
|
||||
AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
|
||||
|
||||
// Ref, value and footprint have specific hotkeys. Show the specific hotkey:
|
||||
hotkey_id_commnand id;
|
||||
switch( Field->GetId() )
|
||||
{
|
||||
case REFERENCE:
|
||||
id = HK_EDIT_COMPONENT_REFERENCE;
|
||||
name = _( "Edit Reference..." );
|
||||
break;
|
||||
case VALUE:
|
||||
id = HK_EDIT_COMPONENT_VALUE;
|
||||
name = _( "Edit Value..." );
|
||||
break;
|
||||
case FOOTPRINT:
|
||||
id = HK_EDIT_COMPONENT_FOOTPRINT;
|
||||
name = _( "Edit Footprint Field..." );
|
||||
break;
|
||||
case DATASHEET:
|
||||
id = HK_SHOW_COMPONENT_DATASHEET;
|
||||
name = _( "Show Datasheet" );
|
||||
break;
|
||||
default:
|
||||
id = HK_EDIT;
|
||||
name = _( "Edit Field..." );
|
||||
break;
|
||||
}
|
||||
msg = AddHotkeyName( name, g_Schematic_Hotkeys_Descr, id );
|
||||
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -453,31 +359,6 @@ void AddMenusForEditComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, SYMBOL
|
|||
part = alias->GetPart();
|
||||
|
||||
wxMenu* editmenu = new wxMenu;
|
||||
msg = AddHotkeyName( _( "Edit Properties..." ), g_Schematic_Hotkeys_Descr, HK_EDIT );
|
||||
AddMenuItem( editmenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( config_xpm ) );
|
||||
|
||||
if( part && part->IsNormal() )
|
||||
{
|
||||
msg = AddHotkeyName( _( "Edit Value..." ), g_Schematic_Hotkeys_Descr,
|
||||
HK_EDIT_COMPONENT_VALUE );
|
||||
AddMenuItem( editmenu, ID_SCH_EDIT_COMPONENT_VALUE, msg,
|
||||
KiBitmap( edit_comp_value_xpm ) );
|
||||
|
||||
msg = AddHotkeyName( _( "Edit Reference..." ), g_Schematic_Hotkeys_Descr,
|
||||
HK_EDIT_COMPONENT_REFERENCE );
|
||||
AddMenuItem( editmenu, ID_SCH_EDIT_COMPONENT_REFERENCE, msg,
|
||||
KiBitmap( edit_comp_ref_xpm ) );
|
||||
|
||||
msg = AddHotkeyName( _( "Edit Footprint..." ), g_Schematic_Hotkeys_Descr,
|
||||
HK_EDIT_COMPONENT_FOOTPRINT );
|
||||
AddMenuItem( editmenu, ID_SCH_EDIT_COMPONENT_FOOTPRINT, msg,
|
||||
KiBitmap( edit_comp_footprint_xpm ) );
|
||||
|
||||
msg = AddHotkeyName( _( "Show Datasheet" ), g_Schematic_Hotkeys_Descr,
|
||||
HK_SHOW_COMPONENT_DATASHEET );
|
||||
AddMenuItem( editmenu, ID_POPUP_SCH_DISPLAYDOC_CMP, msg,
|
||||
KiBitmap( datasheet_xpm ) );
|
||||
}
|
||||
|
||||
if( part && part->HasConversion() )
|
||||
AddMenuItem( editmenu, ID_POPUP_SCH_EDIT_CONVERT_CMP, _( "Convert" ),
|
||||
|
@ -515,9 +396,6 @@ void AddMenusForEditComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, SYMBOL
|
|||
AddMenuItem( editmenu, ID_POPUP_SCH_CALL_LIBEDIT_AND_LOAD_CMP,
|
||||
msg, KiBitmap( libedit_xpm ) );
|
||||
}
|
||||
|
||||
AddMenuItem( PopMenu, editmenu, ID_SCH_EDIT_ITEM,
|
||||
_( "Properties" ), KiBitmap( config_xpm ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -526,26 +404,6 @@ void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel )
|
|||
wxMenu* menu_change_type = new wxMenu;
|
||||
wxString msg;
|
||||
|
||||
if( !GLabel->GetEditFlags() )
|
||||
{
|
||||
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hotkeys_Descr,
|
||||
HK_MOVE_COMPONENT_OR_ITEM );
|
||||
AddMenuItem( PopMenu, ID_SCH_MOVE, msg, KiBitmap( move_xpm ) );
|
||||
msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hotkeys_Descr,
|
||||
HK_DRAG );
|
||||
AddMenuItem( PopMenu, ID_SCH_DRAG, msg, KiBitmap( drag_xpm ) );
|
||||
msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hotkeys_Descr,
|
||||
HK_DUPLICATE );
|
||||
AddMenuItem( PopMenu, ID_SCH_DUPLICATE, msg, KiBitmap( duplicate_xpm ) );
|
||||
}
|
||||
|
||||
msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hotkeys_Descr, HK_ROTATE );
|
||||
AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
|
||||
msg = AddHotkeyName( _( "Edit..." ), g_Schematic_Hotkeys_Descr, HK_EDIT );
|
||||
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
|
||||
msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hotkeys_Descr, HK_DELETE );
|
||||
AddMenuItem( PopMenu, ID_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
|
||||
|
||||
// add menu change type text (to label, glabel, text):
|
||||
AddMenuItem( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL,
|
||||
_( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
|
||||
|
@ -563,25 +421,6 @@ void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* HLabel )
|
|||
wxMenu* menu_change_type = new wxMenu;
|
||||
wxString msg;
|
||||
|
||||
if( !HLabel->GetEditFlags() )
|
||||
{
|
||||
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hotkeys_Descr,
|
||||
HK_MOVE_COMPONENT_OR_ITEM );
|
||||
AddMenuItem( PopMenu, ID_SCH_MOVE, msg, KiBitmap( move_xpm ) );
|
||||
msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hotkeys_Descr, HK_DRAG );
|
||||
AddMenuItem( PopMenu, ID_SCH_DRAG, msg, KiBitmap( drag_xpm ) );
|
||||
msg = AddHotkeyName( _( "Copy" ), g_Schematic_Hotkeys_Descr,
|
||||
HK_DUPLICATE );
|
||||
AddMenuItem( PopMenu, ID_SCH_DUPLICATE, msg, KiBitmap( copy_xpm ) );
|
||||
}
|
||||
|
||||
msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hotkeys_Descr, HK_ROTATE );
|
||||
AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
|
||||
msg = AddHotkeyName( _( "Edit..." ), g_Schematic_Hotkeys_Descr, HK_EDIT );
|
||||
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
|
||||
msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hotkeys_Descr, HK_DELETE );
|
||||
AddMenuItem( PopMenu, ID_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
|
||||
|
||||
// add menu change type text (to label, glabel, text):
|
||||
AddMenuItem( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL,
|
||||
_( "Change to Label" ), KiBitmap( glabel2label_xpm ) );
|
||||
|
@ -599,23 +438,6 @@ void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label )
|
|||
wxMenu* menu_change_type = new wxMenu;
|
||||
wxString msg;
|
||||
|
||||
if( !Label->GetEditFlags() )
|
||||
{
|
||||
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hotkeys_Descr, HK_MOVE_COMPONENT_OR_ITEM );
|
||||
AddMenuItem( PopMenu, ID_SCH_MOVE, msg, KiBitmap( move_xpm ) );
|
||||
msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hotkeys_Descr, HK_DRAG );
|
||||
AddMenuItem( PopMenu, ID_SCH_DRAG, msg, KiBitmap( drag_xpm ) );
|
||||
msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hotkeys_Descr, HK_DUPLICATE );
|
||||
AddMenuItem( PopMenu, ID_SCH_DUPLICATE, msg, KiBitmap( duplicate_xpm ) );
|
||||
}
|
||||
|
||||
msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Schematic_Hotkeys_Descr, HK_ROTATE );
|
||||
AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
|
||||
msg = AddHotkeyName( _( "Edit..." ), g_Schematic_Hotkeys_Descr, HK_EDIT );
|
||||
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
|
||||
msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hotkeys_Descr, HK_DELETE );
|
||||
AddMenuItem( PopMenu, ID_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
|
||||
|
||||
// add menu change type text (to label, glabel, text):
|
||||
AddMenuItem( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL,
|
||||
_( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
|
||||
|
@ -633,21 +455,6 @@ void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text )
|
|||
wxString msg;
|
||||
wxMenu* menu_change_type = new wxMenu;
|
||||
|
||||
if( !Text->GetEditFlags() )
|
||||
{
|
||||
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hotkeys_Descr, HK_MOVE_COMPONENT_OR_ITEM );
|
||||
AddMenuItem( PopMenu, ID_SCH_MOVE, msg, KiBitmap( move_xpm ) );
|
||||
msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hotkeys_Descr, HK_DUPLICATE );
|
||||
AddMenuItem( PopMenu, ID_SCH_DUPLICATE, msg, KiBitmap( duplicate_xpm ) );
|
||||
}
|
||||
|
||||
msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Schematic_Hotkeys_Descr, HK_ROTATE );
|
||||
AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
|
||||
msg = AddHotkeyName( _( "Edit..." ), g_Schematic_Hotkeys_Descr, HK_EDIT );
|
||||
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
|
||||
msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hotkeys_Descr, HK_DELETE );
|
||||
AddMenuItem( PopMenu, ID_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
|
||||
|
||||
/* add menu change type text (to label, glabel, text),
|
||||
* but only if this is a single line text
|
||||
*/
|
||||
|
@ -706,13 +513,6 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
|
|||
return;
|
||||
}
|
||||
|
||||
if( Wire->IsNew() )
|
||||
{
|
||||
msg = AddHotkeyName( _( "Wire End" ), g_Schematic_Hotkeys_Descr, HK_END_CURR_LINEWIREBUS );
|
||||
AddMenuItem( PopMenu, ID_POPUP_END_LINE, msg, KiBitmap( checked_ok_xpm ) );
|
||||
return;
|
||||
}
|
||||
|
||||
msg = AddHotkeyName( _( "Drag Wire" ), g_Schematic_Hotkeys_Descr, HK_DRAG );
|
||||
AddMenuItem( PopMenu, ID_SCH_DRAG, msg, KiBitmap( drag_xpm ) );
|
||||
PopMenu->AppendSeparator();
|
||||
|
@ -756,13 +556,6 @@ void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame )
|
|||
return;
|
||||
}
|
||||
|
||||
if( Bus->IsNew() )
|
||||
{
|
||||
msg = AddHotkeyName( _( "Bus End" ), g_Schematic_Hotkeys_Descr, HK_END_CURR_LINEWIREBUS );
|
||||
AddMenuItem( PopMenu, ID_POPUP_END_LINE, msg, KiBitmap( checked_ok_xpm ) );
|
||||
return;
|
||||
}
|
||||
|
||||
msg = AddHotkeyName( _( "Delete Bus" ), g_Schematic_Hotkeys_Descr, HK_DELETE );
|
||||
AddMenuItem( PopMenu, ID_SCH_DELETE, msg, KiBitmap( delete_bus_xpm ) );
|
||||
|
||||
|
@ -882,56 +675,6 @@ void AddMenusForSheetPin( wxMenu* PopMenu, SCH_SHEET_PIN* PinSheet )
|
|||
}
|
||||
|
||||
|
||||
void AddMenusForBlock( wxMenu* PopMenu, SCH_EDIT_FRAME* frame )
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel Block" ),
|
||||
KiBitmap( cancel_xpm ) );
|
||||
|
||||
PopMenu->AppendSeparator();
|
||||
|
||||
if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
|
||||
AddMenuItem( PopMenu, ID_POPUP_ZOOM_BLOCK, _( "Window Zoom" ), KiBitmap( zoom_area_xpm ) );
|
||||
|
||||
AddMenuItem( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), KiBitmap( checked_ok_xpm ) );
|
||||
|
||||
// After a block move (that is also a block selection) one can reselect
|
||||
// a block function.
|
||||
if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
|
||||
{
|
||||
msg = AddHotkeyName( _( "Cut Block" ), g_Schematic_Hotkeys_Descr,
|
||||
HK_EDIT_CUT );
|
||||
AddMenuItem( PopMenu, ID_POPUP_CUT_BLOCK, msg, KiBitmap( cut_xpm ) );
|
||||
msg = AddHotkeyName( _( "Copy Block" ), g_Schematic_Hotkeys_Descr,
|
||||
HK_EDIT_COPY );
|
||||
AddMenuItem( PopMenu, ID_POPUP_COPY_BLOCK, msg, KiBitmap( copy_xpm ) );
|
||||
AddMenuItem( PopMenu, ID_POPUP_DUPLICATE_BLOCK, _( "Duplicate Block" ),
|
||||
KiBitmap( duplicate_xpm ) );
|
||||
msg = AddHotkeyName( _( "Drag Block" ), g_Schematic_Hotkeys_Descr,
|
||||
HK_MOVEBLOCK_TO_DRAGBLOCK );
|
||||
AddMenuItem( PopMenu, ID_POPUP_DRAG_BLOCK, msg, KiBitmap( drag_xpm ) );
|
||||
msg = AddHotkeyName( _( "Delete Block" ), g_Schematic_Hotkeys_Descr, HK_DELETE );
|
||||
AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK, msg, KiBitmap( delete_xpm ) );
|
||||
msg = AddHotkeyName( _( "Mirror Block Around Vertical(Y) Axis" ), g_Schematic_Hotkeys_Descr,
|
||||
HK_MIRROR_Y );
|
||||
AddMenuItem( PopMenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
|
||||
msg = AddHotkeyName( _( "Mirror Block Around Horizontal(X) Axis" ),
|
||||
g_Schematic_Hotkeys_Descr, HK_MIRROR_X );
|
||||
AddMenuItem( PopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
|
||||
msg = AddHotkeyName( _( "Rotate Block CCW" ), g_Schematic_Hotkeys_Descr, HK_ROTATE );
|
||||
AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
|
||||
|
||||
#if 0
|
||||
#ifdef __WINDOWS__
|
||||
AddMenuItem( menu_other_block_commands, ID_GEN_COPY_BLOCK_TO_CLIPBOARD,
|
||||
_( "Copy to Clipboard" ), KiBitmap( copy_xpm ) );
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void AddMenusForMarkers( wxMenu* aPopMenu, SCH_MARKER* aMarker, SCH_EDIT_FRAME* aFrame )
|
||||
{
|
||||
AddMenuItem( aPopMenu, ID_SCH_DELETE, _( "Delete Marker" ), KiBitmap( delete_xpm ) );
|
||||
|
|
|
@ -262,7 +262,6 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_TOOL( wxID_REPLACE, SCH_EDIT_FRAME::OnFindItems )
|
||||
EVT_TOOL( ID_BACKANNO_ITEMS, SCH_EDIT_FRAME::OnLoadCmpToFootprintLinkFile )
|
||||
EVT_TOOL( ID_UPDATE_FIELDS, SCH_EDIT_FRAME::OnUpdateFields )
|
||||
EVT_TOOL( ID_AUTOPLACE_FIELDS, SCH_EDIT_FRAME::OnAutoplaceFields )
|
||||
EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp )
|
||||
EVT_MENU( wxID_INDEX, EDA_DRAW_FRAME::GetKicadHelp )
|
||||
EVT_MENU( ID_HELP_GET_INVOLVED, EDA_DRAW_FRAME::GetKicadContribute )
|
||||
|
|
|
@ -780,11 +780,6 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Handle the #ID_AUTOPLACE_FIELDS event.
|
||||
*/
|
||||
void OnAutoplaceFields( wxCommandEvent& aEvent );
|
||||
|
||||
/**
|
||||
* Handle the #ID_POPUP_SCH_SELECT_ON_PCB event used to select items in Pcbnew
|
||||
* based on the sheet they are placed on.
|
||||
|
|
|
@ -65,7 +65,6 @@
|
|||
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
||||
case ID_POPUP_SCH_ENTRY_SELECT_SLASH:
|
||||
case ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH:
|
||||
case ID_POPUP_END_LINE:
|
||||
case ID_POPUP_SCH_CLEANUP_SHEET:
|
||||
case ID_POPUP_SCH_END_SHEET:
|
||||
case ID_POPUP_SCH_RESIZE_SHEET:
|
||||
|
@ -122,11 +121,6 @@
|
|||
}
|
||||
break;
|
||||
|
||||
case ID_POPUP_END_LINE:
|
||||
case ID_POPUP_SCH_END_SHEET:
|
||||
m_toolManager->RunAction( SCH_ACTIONS::finishDrawing, true );
|
||||
break;
|
||||
|
||||
case ID_POPUP_SCH_DELETE_NODE:
|
||||
case ID_POPUP_SCH_DELETE_CONNECTION:
|
||||
m_canvas->MoveCursorToCrossHair();
|
||||
|
|
|
@ -172,8 +172,11 @@ OPT<TOOL_EVENT> SCH_ACTIONS::TranslateLegacyId( int aId )
|
|||
case ID_ADD_IMAGE_BUTT:
|
||||
return SCH_ACTIONS::placeImage.MakeEvent();
|
||||
|
||||
case ID_POPUP_END_LINE:
|
||||
return SCH_ACTIONS::finishDrawing.MakeEvent();
|
||||
case ID_SCH_END_LINE_WIRE_OR_BUS:
|
||||
return SCH_ACTIONS::finishLineWireOrBus.MakeEvent();
|
||||
|
||||
case ID_POPUP_SCH_END_SHEET:
|
||||
return SCH_ACTIONS::finishSheet.MakeEvent();
|
||||
|
||||
case ID_MENU_DELETE_ITEM_BUTT:
|
||||
case ID_SCHEMATIC_DELETE_ITEM_BUTT:
|
||||
|
@ -232,6 +235,12 @@ OPT<TOOL_EVENT> SCH_ACTIONS::TranslateLegacyId( int aId )
|
|||
|
||||
case wxID_PASTE:
|
||||
return SCH_ACTIONS::paste.MakeEvent();
|
||||
|
||||
case ID_AUTOPLACE_FIELDS:
|
||||
return SCH_ACTIONS::autoplaceFields.MakeEvent();
|
||||
|
||||
case ID_POPUP_SCH_DISPLAYDOC_CMP:
|
||||
return SCH_ACTIONS::showDatasheet.MakeEvent();
|
||||
}
|
||||
|
||||
return OPT<TOOL_EVENT>();
|
||||
|
|
|
@ -109,7 +109,11 @@ public:
|
|||
static TOOL_ACTION placeSchematicText;
|
||||
static TOOL_ACTION drawLines;
|
||||
static TOOL_ACTION placeImage;
|
||||
static TOOL_ACTION finishDrawing;
|
||||
static TOOL_ACTION finishLineWireOrBus;
|
||||
static TOOL_ACTION finishWire;
|
||||
static TOOL_ACTION finishBus;
|
||||
static TOOL_ACTION finishLine;
|
||||
static TOOL_ACTION finishSheet;
|
||||
|
||||
// Editing
|
||||
static TOOL_ACTION move;
|
||||
|
@ -124,6 +128,8 @@ public:
|
|||
static TOOL_ACTION editReference;
|
||||
static TOOL_ACTION editValue;
|
||||
static TOOL_ACTION editFootprint;
|
||||
static TOOL_ACTION autoplaceFields;
|
||||
static TOOL_ACTION showDatasheet;
|
||||
static TOOL_ACTION doDelete;
|
||||
static TOOL_ACTION addJunction;
|
||||
static TOOL_ACTION addLabel;
|
||||
|
|
|
@ -132,9 +132,26 @@ TOOL_ACTION SCH_ACTIONS::placeImage( "eeschema.InteractiveDrawing.placeImage",
|
|||
AS_GLOBAL, 0,
|
||||
_( "Add Image" ), _( "Add bitmap image" ), NULL, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION SCH_ACTIONS::finishDrawing( "eeschema.InteractiveDrawing.finishDrawing",
|
||||
AS_GLOBAL, 0, "", "", NULL, AF_NONE );
|
||||
TOOL_ACTION SCH_ACTIONS::finishLineWireOrBus( "eeschema.InteractiveDrawing.finishLineWireOrBus",
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_END_CURR_LINEWIREBUS ),
|
||||
_( "Finish Wire or Bus" ), _( "Complete drawing at current segment" ),
|
||||
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 );
|
||||
|
||||
TOOL_ACTION SCH_ACTIONS::finishBus( "eeschema.InteractiveDrawing.finishBus",
|
||||
AS_GLOBAL, 0,
|
||||
_( "Finish Bus" ), _( "Complete bus at 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 );
|
||||
|
||||
TOOL_ACTION SCH_ACTIONS::finishSheet( "eeschema.InteractiveDrawing.finishSheet",
|
||||
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 );
|
||||
|
@ -164,15 +181,56 @@ SCH_DRAWING_TOOL::~SCH_DRAWING_TOOL()
|
|||
|
||||
bool SCH_DRAWING_TOOL::Init()
|
||||
{
|
||||
auto activeToolFunctor = [ this ] ( const SELECTION& aSel ) {
|
||||
return ( m_frame->GetToolId() != ID_NO_TOOL_SELECTED );
|
||||
};
|
||||
m_frame = getEditFrame<SCH_EDIT_FRAME>();
|
||||
|
||||
auto activeToolCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
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 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 drawingLineCondition = [] ( const SELECTION& aSel ) {
|
||||
if( aSel.GetSize() == 1 )
|
||||
{
|
||||
SCH_LINE* line = dynamic_cast<SCH_LINE*>( aSel.GetItem( 0 ) );
|
||||
|
||||
return ( line && line->GetLayer() == LAYER_NOTES );
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
auto& ctxMenu = m_menu.GetMenu();
|
||||
|
||||
// cancel current tool goes in main context menu at the top if present
|
||||
ctxMenu.AddItem( ACTIONS::cancelInteractive, activeToolFunctor, 1 );
|
||||
ctxMenu.AddSeparator( activeToolFunctor, 1 );
|
||||
ctxMenu.AddItem( ACTIONS::cancelInteractive, activeToolCondition, 1 );
|
||||
|
||||
ctxMenu.AddItem( SCH_ACTIONS::finishWire, drawingWireCondition, 1 );
|
||||
ctxMenu.AddItem( SCH_ACTIONS::finishBus, drawingBusCondition, 1 );
|
||||
ctxMenu.AddItem( SCH_ACTIONS::finishLine, drawingLineCondition, 1 );
|
||||
|
||||
ctxMenu.AddSeparator( activeToolCondition, 1000 );
|
||||
m_menu.AddStandardSubMenus( m_frame );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -362,8 +420,12 @@ int SCH_DRAWING_TOOL::doPlaceComponent( SCH_COMPONENT* aComponent, SCHLIB_FILTER
|
|||
}
|
||||
else if( evt->IsClick( BUT_RIGHT ) )
|
||||
{
|
||||
// JEY TODO
|
||||
// m_menu.ShowContextMenu( selTool->GetSelection() );
|
||||
SELECTION selection;
|
||||
|
||||
if( aComponent )
|
||||
selection.Add( aComponent );
|
||||
|
||||
m_menu.ShowContextMenu( selection );
|
||||
}
|
||||
else if( aComponent && ( evt->IsAction( &SCH_ACTIONS::refreshPreview ) || evt->IsMotion() ) )
|
||||
{
|
||||
|
@ -484,8 +546,12 @@ int SCH_DRAWING_TOOL::PlaceImage( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else if( evt->IsClick( BUT_RIGHT ) )
|
||||
{
|
||||
// JEY TODO
|
||||
// m_menu.ShowContextMenu( selTool->GetSelection() );
|
||||
SELECTION selection;
|
||||
|
||||
if( image )
|
||||
selection.Add( image );
|
||||
|
||||
m_menu.ShowContextMenu( selection );
|
||||
}
|
||||
else if( image && ( evt->IsAction( &SCH_ACTIONS::refreshPreview ) || evt->IsMotion() ) )
|
||||
{
|
||||
|
@ -574,8 +640,9 @@ int SCH_DRAWING_TOOL::doSingleClickPlace( KICAD_T aType )
|
|||
}
|
||||
else if( evt->IsClick( BUT_RIGHT ) )
|
||||
{
|
||||
// JEY TODO
|
||||
// m_menu.ShowContextMenu( selTool->GetSelection() );
|
||||
SELECTION emptySelection;
|
||||
|
||||
m_menu.ShowContextMenu( emptySelection );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -724,8 +791,12 @@ int SCH_DRAWING_TOOL::doTwoClickPlace( KICAD_T aType )
|
|||
}
|
||||
else if( evt->IsClick( BUT_RIGHT ) )
|
||||
{
|
||||
// JEY TODO
|
||||
// m_menu.ShowContextMenu( selTool->GetSelection() );
|
||||
SELECTION selection;
|
||||
|
||||
if( item )
|
||||
selection.Add( item );
|
||||
|
||||
m_menu.ShowContextMenu( selection );
|
||||
}
|
||||
else if( item && ( evt->IsAction( &SCH_ACTIONS::refreshPreview ) || evt->IsMotion() ) )
|
||||
{
|
||||
|
@ -1045,7 +1116,10 @@ int SCH_DRAWING_TOOL::doDrawSegments( int aType, SCH_LINE* aSegment )
|
|||
|
||||
break;
|
||||
}
|
||||
else if( evt->IsAction( &SCH_ACTIONS::finishDrawing ) )
|
||||
else if( evt->IsAction( &SCH_ACTIONS::finishLineWireOrBus )
|
||||
|| evt->IsAction( &SCH_ACTIONS::finishWire )
|
||||
|| evt->IsAction( &SCH_ACTIONS::finishBus )
|
||||
|| evt->IsAction( &SCH_ACTIONS::finishLine ) )
|
||||
{
|
||||
if( aSegment || m_busUnfold.in_progress )
|
||||
{
|
||||
|
@ -1055,8 +1129,12 @@ int SCH_DRAWING_TOOL::doDrawSegments( int aType, SCH_LINE* aSegment )
|
|||
}
|
||||
else if( evt->IsClick( BUT_RIGHT ) )
|
||||
{
|
||||
// JEY TODO
|
||||
// m_menu.ShowContextMenu();
|
||||
SELECTION selection;
|
||||
|
||||
if( aSegment )
|
||||
selection.Add( aSegment );
|
||||
|
||||
m_menu.ShowContextMenu( selection );
|
||||
}
|
||||
else if( evt->IsClick( BUT_LEFT ) || ( aSegment && evt->IsDblClick( BUT_LEFT ) ) )
|
||||
{
|
||||
|
@ -1402,7 +1480,7 @@ int SCH_DRAWING_TOOL::doDrawSheet( SCH_SHEET *aSheet )
|
|||
m_frame->GetScreen()->SetCurItem( nullptr );
|
||||
}
|
||||
}
|
||||
else if( evt->IsAction( &SCH_ACTIONS::finishDrawing ) )
|
||||
else if( evt->IsAction( &SCH_ACTIONS::finishSheet ) )
|
||||
{
|
||||
if( aSheet )
|
||||
{
|
||||
|
|
|
@ -55,7 +55,7 @@ struct BUS_UNFOLDING_T
|
|||
/**
|
||||
* Class SCH_DRAWING_TOOL
|
||||
*
|
||||
* Tool responsible for drawing graphical elements like lines, arcs, circles, etc.
|
||||
* Tool responsible for drawing/placing items (symbols, wires, busses, labels, etc.)
|
||||
*/
|
||||
|
||||
class SCH_DRAWING_TOOL : public TOOL_INTERACTIVE
|
||||
|
@ -71,10 +71,7 @@ public:
|
|||
void Reset( RESET_REASON aReason ) override;
|
||||
|
||||
///> Get the SCH_DRAWING_TOOL top-level context menu
|
||||
inline TOOL_MENU& GetToolMenu()
|
||||
{
|
||||
return m_menu;
|
||||
}
|
||||
inline TOOL_MENU& GetToolMenu() { return m_menu; }
|
||||
|
||||
int StartWire( const TOOL_EVENT& aEvent );
|
||||
int StartBus( const TOOL_EVENT& aEvent );
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include <hotkeys.h>
|
||||
#include <bitmaps.h>
|
||||
#include <confirm.h>
|
||||
#include <eda_doc.h>
|
||||
#include <base_struct.h>
|
||||
#include <sch_item_struct.h>
|
||||
#include <sch_component.h>
|
||||
#include <sch_sheet.h>
|
||||
|
@ -41,6 +43,7 @@
|
|||
#include <list_operations.h>
|
||||
#include <eeschema_id.h>
|
||||
#include <status_popup.h>
|
||||
#include "sch_drawing_tool.h"
|
||||
|
||||
TOOL_ACTION SCH_ACTIONS::move( "eeschema.InteractiveEdit.move",
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_MOVE_COMPONENT_OR_ITEM ),
|
||||
|
@ -68,11 +71,11 @@ TOOL_ACTION SCH_ACTIONS::rotateCCW( "eeschema.InteractiveEdit.rotateCCW",
|
|||
|
||||
TOOL_ACTION SCH_ACTIONS::mirrorX( "eeschema.InteractiveEdit.mirrorX",
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_MIRROR_X ),
|
||||
_( "Mirror X" ), _( "Mirrors selected item(s) across the X axis" ), 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 Y" ), _( "Mirrors selected item(s) across the Y axis" ), 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 ),
|
||||
|
@ -90,6 +93,14 @@ 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 );
|
||||
|
||||
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 );
|
||||
|
||||
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 );
|
||||
|
||||
TOOL_ACTION SCH_ACTIONS::doDelete( "eeschema.InteractiveEdit.doDelete",
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DELETE ),
|
||||
_( "Delete" ), _( "Deletes selected item(s)" ), delete_xpm );
|
||||
|
@ -119,24 +130,114 @@ SCH_EDIT_TOOL::~SCH_EDIT_TOOL()
|
|||
|
||||
bool SCH_EDIT_TOOL::Init()
|
||||
{
|
||||
// Find the selection tool, so they can cooperate
|
||||
m_frame = getEditFrame<SCH_EDIT_FRAME>();
|
||||
m_selectionTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
|
||||
SCH_DRAWING_TOOL* drawingTool = m_toolMgr->GetTool<SCH_DRAWING_TOOL>();
|
||||
|
||||
if( !m_selectionTool )
|
||||
{
|
||||
DisplayError( NULL, _( "eeshema.InteractiveSelection tool is not available" ) );
|
||||
return false;
|
||||
}
|
||||
else if( !drawingTool )
|
||||
{
|
||||
DisplayError( NULL, _( "eeshema.InteractiveDrawing tool is not available" ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
auto activeToolFunctor = [ this ] ( const SELECTION& aSel ) {
|
||||
auto activeToolCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return ( m_frame->GetToolId() != ID_NO_TOOL_SELECTED );
|
||||
};
|
||||
|
||||
auto& ctxMenu = m_menu.GetMenu();
|
||||
auto noActiveToolCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return ( m_frame->GetToolId() == ID_NO_TOOL_SELECTED );
|
||||
};
|
||||
|
||||
// cancel current tool goes in main context menu at the top if present
|
||||
ctxMenu.AddItem( ACTIONS::cancelInteractive, activeToolFunctor, 1 );
|
||||
ctxMenu.AddSeparator( activeToolFunctor, 1 );
|
||||
auto singleComponentCondition = SELECTION_CONDITIONS::OnlyType( SCH_COMPONENT_T )
|
||||
&& SELECTION_CONDITIONS::Count( 1 );
|
||||
|
||||
auto singleSymbolCondition = [] (const SELECTION& aSel ) {
|
||||
if( aSel.GetSize() == 1 )
|
||||
{
|
||||
SCH_COMPONENT* comp = dynamic_cast<SCH_COMPONENT*>( aSel.GetItem( 0 ) );
|
||||
|
||||
if( comp )
|
||||
{
|
||||
auto partRef = comp->GetPartRef().lock();
|
||||
return !partRef || !partRef->IsPower();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
CONDITIONAL_MENU& ctxMenu = m_menu.GetMenu();
|
||||
|
||||
// Build the edit tool menu (shown when moving or dragging)
|
||||
//
|
||||
ctxMenu.AddItem( ACTIONS::cancelInteractive, activeToolCondition, 1 );
|
||||
|
||||
ctxMenu.AddSeparator( SELECTION_CONDITIONS::NotEmpty );
|
||||
ctxMenu.AddItem( SCH_ACTIONS::rotateCCW, SELECTION_CONDITIONS::NotEmpty );
|
||||
ctxMenu.AddItem( SCH_ACTIONS::rotateCW, SELECTION_CONDITIONS::NotEmpty );
|
||||
ctxMenu.AddItem( SCH_ACTIONS::mirrorX, SELECTION_CONDITIONS::NotEmpty );
|
||||
ctxMenu.AddItem( SCH_ACTIONS::mirrorY, SELECTION_CONDITIONS::NotEmpty );
|
||||
ctxMenu.AddItem( SCH_ACTIONS::duplicate, SELECTION_CONDITIONS::NotEmpty );
|
||||
ctxMenu.AddItem( SCH_ACTIONS::doDelete, SELECTION_CONDITIONS::NotEmpty );
|
||||
|
||||
ctxMenu.AddItem( SCH_ACTIONS::properties, SELECTION_CONDITIONS::Count( 1 ) );
|
||||
ctxMenu.AddItem( SCH_ACTIONS::editReference, singleComponentCondition );
|
||||
ctxMenu.AddItem( SCH_ACTIONS::editValue, singleComponentCondition );
|
||||
ctxMenu.AddItem( SCH_ACTIONS::editReference, singleComponentCondition );
|
||||
|
||||
ctxMenu.AddSeparator( SELECTION_CONDITIONS::NotEmpty );
|
||||
ctxMenu.AddItem( SCH_ACTIONS::cut, SELECTION_CONDITIONS::NotEmpty );
|
||||
ctxMenu.AddItem( SCH_ACTIONS::copy, SELECTION_CONDITIONS::NotEmpty );
|
||||
|
||||
ctxMenu.AddSeparator( SELECTION_CONDITIONS::NotEmpty, 1000 );
|
||||
m_menu.AddStandardSubMenus( m_frame );
|
||||
|
||||
// Add editing actions to the drawing tool menu
|
||||
//
|
||||
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 );
|
||||
|
||||
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 );
|
||||
|
||||
// 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::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.AddSeparator( SELECTION_CONDITIONS::NotEmpty );
|
||||
selToolMenu.AddItem( SCH_ACTIONS::cut, SELECTION_CONDITIONS::NotEmpty );
|
||||
selToolMenu.AddItem( SCH_ACTIONS::copy, SELECTION_CONDITIONS::NotEmpty );
|
||||
// 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 );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -168,6 +269,11 @@ int SCH_EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
if( selection.Empty() )
|
||||
return 0;
|
||||
|
||||
if( aEvent.IsAction( &SCH_ACTIONS::move ) )
|
||||
m_frame->SetToolID( ID_SCH_MOVE, wxCURSOR_DEFAULT, _( "Move Items" ) );
|
||||
else
|
||||
m_frame->SetToolID( ID_SCH_DRAG, wxCURSOR_DEFAULT, _( "Drag Items" ) );
|
||||
|
||||
Activate();
|
||||
controls->ShowCursor( true );
|
||||
controls->SetAutoPan( true );
|
||||
|
@ -342,6 +448,11 @@ int SCH_EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
}
|
||||
|
||||
else if( evt->IsClick( BUT_RIGHT ) )
|
||||
{
|
||||
m_menu.ShowContextMenu( selection );
|
||||
}
|
||||
|
||||
else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) )
|
||||
{
|
||||
break; // Finish
|
||||
|
@ -523,8 +634,7 @@ bool SCH_EDIT_TOOL::updateModificationPoint( SELECTION& aSelection )
|
|||
|
||||
int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
|
||||
SELECTION selection = selTool->RequestSelection( SCH_COLLECTOR::RotatableItems );
|
||||
SELECTION& selection = m_selectionTool->RequestSelection( SCH_COLLECTOR::RotatableItems );
|
||||
|
||||
if( selection.GetSize() == 0 )
|
||||
return 0;
|
||||
|
@ -657,8 +767,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
|
||||
int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
|
||||
SELECTION selection = selTool->RequestSelection( SCH_COLLECTOR::RotatableItems );
|
||||
SELECTION& selection = m_selectionTool->RequestSelection( SCH_COLLECTOR::RotatableItems );
|
||||
|
||||
if( selection.GetSize() == 0 )
|
||||
return 0;
|
||||
|
@ -799,8 +908,7 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
|
|||
|
||||
int SCH_EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
|
||||
SELECTION selection = selTool->RequestSelection( SCH_COLLECTOR::DraggableItems );
|
||||
SELECTION& selection = m_selectionTool->RequestSelection( SCH_COLLECTOR::DraggableItems );
|
||||
|
||||
if( selection.GetSize() == 0 )
|
||||
return 0;
|
||||
|
@ -941,11 +1049,9 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent )
|
|||
|
||||
int SCH_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
|
||||
std::vector<SCH_ITEM*> items;
|
||||
|
||||
// get a copy instead of reference (we're going to clear the selection before removing items)
|
||||
SELECTION selectionCopy = selTool->RequestSelection();
|
||||
SELECTION selectionCopy = m_selectionTool->RequestSelection();
|
||||
|
||||
if( selectionCopy.Empty() )
|
||||
return 0;
|
||||
|
@ -1037,16 +1143,13 @@ int SCH_EDIT_TOOL::EditField( const TOOL_EVENT& aEvent )
|
|||
else if( aEvent.IsAction( &SCH_ACTIONS::editFootprint ) )
|
||||
filter = CmpOrFootprint;
|
||||
|
||||
SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
|
||||
SELECTION& selection = selTool->RequestSelection( filter );
|
||||
SCH_ITEM* item = nullptr;
|
||||
SELECTION& selection = m_selectionTool->RequestSelection( filter );
|
||||
|
||||
if( selection.GetSize() >= 1 )
|
||||
item = (SCH_ITEM*)selection.GetItem( 0 );
|
||||
|
||||
if( !item )
|
||||
if( selection.Empty() )
|
||||
return 0;
|
||||
|
||||
SCH_ITEM* item = (SCH_ITEM*) selection.GetItem( 0 );
|
||||
|
||||
if( item->Type() == SCH_COMPONENT_T )
|
||||
{
|
||||
SCH_COMPONENT* component = (SCH_COMPONENT*) item;
|
||||
|
@ -1067,18 +1170,53 @@ int SCH_EDIT_TOOL::EditField( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
int SCH_EDIT_TOOL::AutoplaceFields( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
SELECTION& selection = m_selectionTool->RequestSelection( SCH_COLLECTOR::ComponentsOnly );
|
||||
|
||||
if( selection.Empty() )
|
||||
return 0;
|
||||
|
||||
SCH_COMPONENT* component = (SCH_COMPONENT*) selection.GetItem( 0 );
|
||||
|
||||
if( !component->IsNew() )
|
||||
m_frame->SaveCopyInUndoList( component, UR_CHANGED );
|
||||
|
||||
component->AutoplaceFields( m_frame->GetScreen(), /* aManual */ true );
|
||||
|
||||
updateView( component );
|
||||
m_frame->OnModify();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int SCH_EDIT_TOOL::ShowDatasheet( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
SELECTION& selection = m_selectionTool->RequestSelection( SCH_COLLECTOR::ComponentsOnly );
|
||||
|
||||
if( selection.Empty() )
|
||||
return 0;
|
||||
|
||||
SCH_COMPONENT* component = (SCH_COMPONENT*) selection.GetItem( 0 );
|
||||
wxString datasheet = component->GetField( DATASHEET )->GetText();
|
||||
|
||||
if( !datasheet.IsEmpty() )
|
||||
GetAssociatedDocument( m_frame, datasheet );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
|
||||
SELECTION& selection = selTool->RequestSelection( SCH_COLLECTOR::EditableItems );
|
||||
SCH_ITEM* item = nullptr;
|
||||
SELECTION& selection = m_selectionTool->RequestSelection( SCH_COLLECTOR::EditableItems );
|
||||
|
||||
if( selection.GetSize() >= 1 )
|
||||
item = (SCH_ITEM*)selection.GetItem( 0 );
|
||||
|
||||
if( !item )
|
||||
if( selection.Empty() )
|
||||
return 0;
|
||||
|
||||
SCH_ITEM* item = (SCH_ITEM*) selection.GetItem( 0 );
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case SCH_COMPONENT_T:
|
||||
|
@ -1193,5 +1331,7 @@ void SCH_EDIT_TOOL::setTransitions()
|
|||
Go( &SCH_EDIT_TOOL::EditField, SCH_ACTIONS::editReference.MakeEvent() );
|
||||
Go( &SCH_EDIT_TOOL::EditField, SCH_ACTIONS::editValue.MakeEvent() );
|
||||
Go( &SCH_EDIT_TOOL::EditField, SCH_ACTIONS::editFootprint.MakeEvent() );
|
||||
Go( &SCH_EDIT_TOOL::AutoplaceFields, SCH_ACTIONS::autoplaceFields.MakeEvent() );
|
||||
Go( &SCH_EDIT_TOOL::ShowDatasheet, SCH_ACTIONS::showDatasheet.MakeEvent() );
|
||||
|
||||
}
|
||||
|
|
|
@ -66,6 +66,8 @@ public:
|
|||
|
||||
int Properties( const TOOL_EVENT& aEvent );
|
||||
int EditField( const TOOL_EVENT& aEvent );
|
||||
int AutoplaceFields( const TOOL_EVENT& aEvent );
|
||||
int ShowDatasheet( const TOOL_EVENT& aEvent );
|
||||
|
||||
/**
|
||||
* Function DoDelete()
|
||||
|
|
|
@ -105,6 +105,8 @@ void SCH_EDITOR_CONTROL::Reset( RESET_REASON aReason )
|
|||
|
||||
bool SCH_EDITOR_CONTROL::Init()
|
||||
{
|
||||
m_frame = getEditFrame<SCH_EDIT_FRAME>();
|
||||
|
||||
auto activeToolCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return ( m_frame->GetToolId() != ID_NO_TOOL_SELECTED );
|
||||
};
|
||||
|
@ -120,7 +122,7 @@ bool SCH_EDITOR_CONTROL::Init()
|
|||
ctxMenu.AddSeparator( activeToolCondition, 1000 );
|
||||
|
||||
// Finally, add the standard zoom & grid items
|
||||
m_menu.AddStandardSubMenus( *getEditFrame<SCH_BASE_FRAME>() );
|
||||
m_menu.AddStandardSubMenus( m_frame );
|
||||
|
||||
/*
|
||||
auto lockMenu = std::make_shared<LOCK_CONTEXT_MENU>();
|
||||
|
|
|
@ -71,7 +71,7 @@ TOOL_ACTION SCH_ACTIONS::selectionClear( "eeschema.InteractiveSelection.Clear",
|
|||
|
||||
SCH_SELECTION_TOOL::SCH_SELECTION_TOOL() :
|
||||
TOOL_INTERACTIVE( "eeschema.InteractiveSelection" ),
|
||||
m_frame( NULL ),
|
||||
m_frame( nullptr ),
|
||||
m_additive( false ),
|
||||
m_subtractive( false ),
|
||||
m_multiple( false ),
|
||||
|
@ -89,10 +89,10 @@ SCH_SELECTION_TOOL::~SCH_SELECTION_TOOL()
|
|||
|
||||
bool SCH_SELECTION_TOOL::Init()
|
||||
{
|
||||
auto frame = getEditFrame<SCH_BASE_FRAME>();
|
||||
m_frame = getEditFrame<SCH_BASE_FRAME>();
|
||||
|
||||
if( frame )
|
||||
m_menu.AddStandardSubMenus( *frame );
|
||||
m_menu.GetMenu().AddSeparator( SELECTION_CONDITIONS::NotEmpty, 1000 );
|
||||
m_menu.AddStandardSubMenus( m_frame );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -66,6 +66,8 @@ public:
|
|||
*/
|
||||
SELECTION& GetSelection();
|
||||
|
||||
inline TOOL_MENU& GetToolMenu() { return m_menu; }
|
||||
|
||||
/**
|
||||
* Function RequestSelection()
|
||||
*
|
||||
|
|
|
@ -166,7 +166,7 @@ bool GERBVIEW_SELECTION_TOOL::Init()
|
|||
menu.AddMenu( selectMenu.get(), false );
|
||||
menu.AddSeparator( SELECTION_CONDITIONS::ShowAlways, 1000 );
|
||||
|
||||
m_menu.AddStandardSubMenus( *getEditFrame<GERBVIEW_FRAME>() );
|
||||
m_menu.AddStandardSubMenus( getEditFrame<GERBVIEW_FRAME>() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ public:
|
|||
* Construct a "basic" menu for a tool, containing only items
|
||||
* that apply to all tools (e.g. zoom and grid)
|
||||
*/
|
||||
void AddStandardSubMenus( EDA_DRAW_FRAME& aFrame );
|
||||
void AddStandardSubMenus( EDA_DRAW_FRAME* aFrame );
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ bool DRAWING_TOOL::Init()
|
|||
// For example, zone fill/unfill is provided by the PCB control tool
|
||||
|
||||
// Finally, add the standard zoom/grid items
|
||||
m_menu.AddStandardSubMenus( *getEditFrame<PCB_BASE_FRAME>() );
|
||||
m_menu.AddStandardSubMenus( getEditFrame<PCB_BASE_FRAME>() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -272,8 +272,8 @@ bool EDIT_TOOL::Init()
|
|||
|
||||
|
||||
menu.AddSeparator( SELECTION_CONDITIONS::NotEmpty );
|
||||
menu.AddItem( PCB_ACTIONS::copyToClipboard, SELECTION_CONDITIONS::NotEmpty );
|
||||
menu.AddItem( PCB_ACTIONS::cutToClipboard, SELECTION_CONDITIONS::NotEmpty );
|
||||
menu.AddItem( PCB_ACTIONS::copyToClipboard, SELECTION_CONDITIONS::NotEmpty );
|
||||
// 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( PCB_ACTIONS::pasteFromClipboard, noActiveToolCondition );
|
||||
|
|
|
@ -288,7 +288,7 @@ bool PCB_EDITOR_CONTROL::Init()
|
|||
ctxMenu.AddSeparator( placeModuleCondition, 1000 );
|
||||
|
||||
// Finally, add the standard zoom & grid items
|
||||
m_menu.AddStandardSubMenus( *getEditFrame<PCB_BASE_FRAME>() );
|
||||
m_menu.AddStandardSubMenus( getEditFrame<PCB_BASE_FRAME>() );
|
||||
|
||||
auto zoneMenu = std::make_shared<ZONE_CONTEXT_MENU>();
|
||||
zoneMenu->SetTool( this );
|
||||
|
|
|
@ -222,7 +222,7 @@ bool PCB_TOOL::Init()
|
|||
ctxMenu.AddSeparator( SELECTION_CONDITIONS::ShowAlways, 1 );
|
||||
|
||||
// Finally, add the standard zoom/grid items
|
||||
m_menu.AddStandardSubMenus( *getEditFrame<PCB_BASE_FRAME>() );
|
||||
m_menu.AddStandardSubMenus( getEditFrame<PCB_BASE_FRAME>() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -220,7 +220,7 @@ bool SELECTION_TOOL::Init()
|
|||
if( frame && ( frame->IsType( FRAME_PCB_MODULE_VIEWER )
|
||||
|| frame->IsType( FRAME_PCB_MODULE_VIEWER_MODAL ) ) )
|
||||
{
|
||||
m_menu.AddStandardSubMenus( *frame );
|
||||
m_menu.AddStandardSubMenus( frame );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ bool SELECTION_TOOL::Init()
|
|||
|
||||
if( frame )
|
||||
{
|
||||
m_menu.AddStandardSubMenus( *frame );
|
||||
m_menu.AddStandardSubMenus( frame );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue