2009-11-04 20:46:53 +00:00
|
|
|
/********************/
|
|
|
|
/* onrightclick.cpp */
|
|
|
|
/********************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
2009-09-22 12:27:57 +00:00
|
|
|
#include "eeschema_id.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
|
|
|
#include "confirm.h"
|
2009-09-25 18:49:04 +00:00
|
|
|
#include "bitmaps.h"
|
2010-11-10 15:30:12 +00:00
|
|
|
#include "class_sch_screen.h"
|
|
|
|
#include "wxEeschemaStruct.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#include "general.h"
|
|
|
|
#include "protos.h"
|
2007-08-30 08:15:05 +00:00
|
|
|
#include "hotkeys.h"
|
2009-09-25 18:49:04 +00:00
|
|
|
#include "class_library.h"
|
2010-12-21 15:13:09 +00:00
|
|
|
#include "sch_bus_entry.h"
|
2010-11-11 21:10:27 +00:00
|
|
|
#include "sch_marker.h"
|
|
|
|
#include "sch_text.h"
|
2011-01-12 21:47:54 +00:00
|
|
|
#include "sch_junction.h"
|
2010-11-11 21:10:27 +00:00
|
|
|
#include "sch_component.h"
|
2010-12-21 15:13:09 +00:00
|
|
|
#include "sch_line.h"
|
|
|
|
#include "sch_no_connect.h"
|
2010-11-11 21:10:27 +00:00
|
|
|
#include "sch_sheet.h"
|
|
|
|
#include "sch_sheet_path.h"
|
2010-11-10 15:30:12 +00:00
|
|
|
|
2010-01-17 20:25:10 +00:00
|
|
|
#include <iostream>
|
|
|
|
using namespace std;
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
static void AddMenusForBlock( wxMenu* PopMenu, SCH_EDIT_FRAME* frame );
|
|
|
|
static void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame );
|
|
|
|
static void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame );
|
2009-11-04 20:46:53 +00:00
|
|
|
static void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet );
|
2011-03-30 19:26:05 +00:00
|
|
|
static void AddMenusForSheetPin( wxMenu* PopMenu, SCH_SHEET_PIN* PinSheet );
|
2008-03-20 01:50:21 +00:00
|
|
|
static void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text );
|
|
|
|
static void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label );
|
|
|
|
static void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel );
|
|
|
|
static void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* GLabel );
|
|
|
|
static void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component );
|
2009-12-02 21:44:03 +00:00
|
|
|
static void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field );
|
2010-12-08 20:12:46 +00:00
|
|
|
static void AddMenusForJunction( wxMenu* PopMenu, SCH_JUNCTION* Junction, SCH_EDIT_FRAME* frame );
|
|
|
|
static void AddMenusForMarkers( wxMenu* aPopMenu, SCH_MARKER* aMarker, SCH_EDIT_FRAME* aFrame );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
/* Prepare context menu when a click on the right mouse button occurs.
|
|
|
|
*
|
|
|
|
* This menu is then added to the list of zoom commands.
|
|
|
|
*/
|
2011-02-02 19:01:21 +00:00
|
|
|
bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
|
2009-09-18 14:56:05 +00:00
|
|
|
{
|
2011-03-25 19:16:05 +00:00
|
|
|
SCH_ITEM* item = GetScreen()->GetCurItem();
|
2011-02-05 19:22:58 +00:00
|
|
|
bool BlockActive = GetScreen()->IsBlockActive();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
// Do not start a block command on context menu.
|
|
|
|
DrawPanel->m_CanStartBlock = -1;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2007-09-29 13:31:10 +00:00
|
|
|
if( BlockActive )
|
2008-03-20 01:50:21 +00:00
|
|
|
{
|
|
|
|
AddMenusForBlock( PopMenu, this );
|
2007-09-29 13:31:10 +00:00
|
|
|
PopMenu->AppendSeparator();
|
2008-03-20 01:50:21 +00:00
|
|
|
return true;
|
|
|
|
}
|
2007-09-29 13:31:10 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
// Try to locate items at cursor position.
|
2011-03-25 19:16:05 +00:00
|
|
|
if( (item == NULL) || (item->GetFlags() == 0) )
|
2009-09-18 14:56:05 +00:00
|
|
|
{
|
2011-03-25 19:16:05 +00:00
|
|
|
item = LocateAndShowItem( aPosition, SCH_COLLECTOR::AllItemsButPins );
|
2010-01-17 20:25:10 +00:00
|
|
|
|
2011-03-25 19:16:05 +00:00
|
|
|
// If the clarify item selection context menu is aborted, don't show the context menu.
|
|
|
|
if( item == NULL && DrawPanel->m_AbortRequest )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-03-25 19:16:05 +00:00
|
|
|
DrawPanel->m_AbortRequest = false;
|
|
|
|
return false;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-14 16:45:22 +00:00
|
|
|
// If Command in progress: add "cancel" and "end tool" menu
|
2011-02-24 20:22:12 +00:00
|
|
|
if( GetToolId() != ID_NO_TOOL_SELECTED )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-03-25 19:16:05 +00:00
|
|
|
if( item && item->GetFlags() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-05 19:22:58 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "Cancel" ), cancel_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-02-05 19:22:58 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "End Tool" ), cancel_tool_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-03-25 19:16:05 +00:00
|
|
|
if( item && item->GetFlags() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-05 19:22:58 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "Cancel" ), cancel_xpm );
|
2008-03-20 01:50:21 +00:00
|
|
|
PopMenu->AppendSeparator();
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-25 19:16:05 +00:00
|
|
|
if( item == NULL )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2008-02-12 21:12:46 +00:00
|
|
|
if( GetSheet()->Last() != g_RootSheet )
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_LEAVE_SHEET, _( "Leave Sheet" ), leave_sheet_xpm );
|
2011-04-05 14:46:51 +00:00
|
|
|
|
2011-03-25 19:16:05 +00:00
|
|
|
PopMenu->AppendSeparator();
|
2007-10-07 18:24:15 +00:00
|
|
|
return true;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2011-03-25 19:16:05 +00:00
|
|
|
int flags = item->GetFlags();
|
|
|
|
bool is_new = (flags & IS_NEW) ? true : false;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-03-25 19:16:05 +00:00
|
|
|
switch( item->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_NO_CONNECT_T:
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-01-10 16:50:40 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete No Connect" ), delete_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_JUNCTION_T:
|
2011-03-25 19:16:05 +00:00
|
|
|
AddMenusForJunction( PopMenu, (SCH_JUNCTION*) item, this );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_BUS_ENTRY_T:
|
2010-06-24 18:31:43 +00:00
|
|
|
if( !flags )
|
|
|
|
{
|
|
|
|
wxString msg = AddHotkeyName( _( "Move Bus Entry" ), s_Schematic_Hokeys_Descr,
|
|
|
|
HK_MOVE_COMPONENT_OR_ITEM );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST, msg, move_xpm );
|
2010-01-17 20:25:10 +00:00
|
|
|
}
|
|
|
|
|
2011-03-25 19:16:05 +00:00
|
|
|
if( GetBusEntryShape( (SCH_BUS_ENTRY*) item ) == '\\' )
|
2010-06-24 18:31:43 +00:00
|
|
|
PopMenu->Append( ID_POPUP_SCH_ENTRY_SELECT_SLASH, _( "Set Bus Entry /" ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
else
|
2010-06-24 18:31:43 +00:00
|
|
|
PopMenu->Append( ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH, _( "Set Bus Entry \\" ) );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Bus Entry" ), delete_bus_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_MARKER_T:
|
2011-03-25 19:16:05 +00:00
|
|
|
AddMenusForMarkers( PopMenu, (SCH_MARKER*) item, this );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_TEXT_T:
|
2011-03-25 19:16:05 +00:00
|
|
|
AddMenusForText( PopMenu, (SCH_TEXT*) item );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_LABEL_T:
|
2011-03-25 19:16:05 +00:00
|
|
|
AddMenusForLabel( PopMenu, (SCH_LABEL*) item );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_GLOBAL_LABEL_T:
|
2011-03-25 19:16:05 +00:00
|
|
|
AddMenusForGLabel( PopMenu, (SCH_GLOBALLABEL*) item );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_HIERARCHICAL_LABEL_T:
|
2011-03-25 19:16:05 +00:00
|
|
|
AddMenusForHLabel( PopMenu, (SCH_HIERLABEL*) item );
|
2008-02-12 21:12:46 +00:00
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_FIELD_T:
|
2011-03-25 19:16:05 +00:00
|
|
|
AddMenusForComponentField( PopMenu, (SCH_FIELD*) item );
|
2011-02-10 19:39:18 +00:00
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_COMPONENT_T:
|
2011-03-25 19:16:05 +00:00
|
|
|
AddMenusForComponent( PopMenu, (SCH_COMPONENT*) item );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_LINE_T:
|
2011-03-25 19:16:05 +00:00
|
|
|
switch( item->GetLayer() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
case LAYER_WIRE:
|
2011-03-25 19:16:05 +00:00
|
|
|
AddMenusForWire( PopMenu, (SCH_LINE*) item, this );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case LAYER_BUS:
|
2011-03-25 19:16:05 +00:00
|
|
|
AddMenusForBus( PopMenu, (SCH_LINE*) item, this );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if( is_new )
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_END_LINE, _( "End Drawing" ), apply_xpm );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Drawing" ), delete_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_SHEET_T:
|
2011-03-25 19:16:05 +00:00
|
|
|
AddMenusForHierchicalSheet( PopMenu, (SCH_SHEET*) item );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2011-03-30 19:26:05 +00:00
|
|
|
case SCH_SHEET_PIN_T:
|
|
|
|
AddMenusForSheetPin( PopMenu, (SCH_SHEET_PIN*) item );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2011-04-05 14:46:51 +00:00
|
|
|
wxFAIL_MSG( wxString::Format( wxT( "Cannot create context menu for unknown type %d" ),
|
|
|
|
item->Type() ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
PopMenu->AppendSeparator();
|
2008-03-20 01:50:21 +00:00
|
|
|
return true;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field )
|
2009-09-18 14:56:05 +00:00
|
|
|
{
|
2010-06-24 18:31:43 +00:00
|
|
|
wxString msg;
|
2010-01-17 20:25:10 +00:00
|
|
|
|
2011-03-10 19:36:30 +00:00
|
|
|
if( !Field->GetFlags() )
|
2010-09-05 17:01:48 +00:00
|
|
|
{
|
2010-06-24 18:31:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Move Field" ), s_Schematic_Hokeys_Descr,
|
|
|
|
HK_MOVE_COMPONENT_OR_ITEM );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST, msg, move_text_xpm );
|
2010-01-17 20:25:10 +00:00
|
|
|
}
|
|
|
|
|
2010-06-24 18:31:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Rotate Field" ), s_Schematic_Hokeys_Descr, HK_ROTATE );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_FIELD, msg, rotate_field_xpm );
|
2010-11-11 21:46:55 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit Field" ), s_Schematic_Hokeys_Descr, HK_EDIT );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_FIELD, msg, edit_text_xpm );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
|
2009-09-18 14:56:05 +00:00
|
|
|
{
|
2010-12-10 19:47:44 +00:00
|
|
|
if( Component->Type() != SCH_COMPONENT_T )
|
2008-03-21 11:16:18 +00:00
|
|
|
{
|
|
|
|
wxASSERT( 0 );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-09-18 14:56:05 +00:00
|
|
|
wxString msg;
|
2010-10-25 15:43:42 +00:00
|
|
|
LIB_ALIAS* libEntry;
|
2009-09-18 14:56:05 +00:00
|
|
|
LIB_COMPONENT* libComponent = NULL;
|
2007-08-30 08:15:05 +00:00
|
|
|
|
2010-12-14 15:56:30 +00:00
|
|
|
libEntry = CMP_LIBRARY::FindLibraryEntry( Component->GetLibName() );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2009-09-18 14:56:05 +00:00
|
|
|
if( libEntry )
|
2010-10-25 15:43:42 +00:00
|
|
|
libComponent = libEntry->GetComponent();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-03-10 19:36:30 +00:00
|
|
|
if( !Component->GetFlags() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2008-10-18 23:41:16 +00:00
|
|
|
msg = _( "Move Component" );
|
2009-09-18 14:56:05 +00:00
|
|
|
msg << wxT( " " ) << Component->GetField( REFERENCE )->m_Text;
|
2010-01-17 20:25:10 +00:00
|
|
|
msg = AddHotkeyName( msg, s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT_OR_ITEM );
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_CMP_REQUEST, msg, move_xpm );
|
|
|
|
msg = AddHotkeyName( _( "Drag Component" ), s_Schematic_Hokeys_Descr, HK_DRAG );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DRAG_CMP_REQUEST, msg, move_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
wxMenu* orientmenu = new wxMenu;
|
2010-06-24 18:31:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Rotate +" ), s_Schematic_Hokeys_Descr, HK_ROTATE );
|
|
|
|
ADD_MENUITEM( orientmenu, ID_POPUP_SCH_ROTATE_CMP_COUNTERCLOCKWISE, msg, rotate_pos_xpm );
|
|
|
|
ADD_MENUITEM( orientmenu, ID_POPUP_SCH_ROTATE_CMP_CLOCKWISE, _( "Rotate -" ), rotate_neg_xpm );
|
|
|
|
msg = AddHotkeyName( _( "Mirror --" ), s_Schematic_Hokeys_Descr, HK_MIRROR_X_COMPONENT );
|
2007-08-30 08:15:05 +00:00
|
|
|
ADD_MENUITEM( orientmenu, ID_POPUP_SCH_MIROR_X_CMP, msg, mirror_V_xpm );
|
2010-06-24 18:31:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Mirror ||" ), s_Schematic_Hokeys_Descr, HK_MIRROR_Y_COMPONENT );
|
2007-08-30 08:15:05 +00:00
|
|
|
ADD_MENUITEM( orientmenu, ID_POPUP_SCH_MIROR_Y_CMP, msg, mirror_H_xpm );
|
2010-06-24 18:31:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Normal" ), s_Schematic_Hokeys_Descr, HK_ORIENT_NORMAL_COMPONENT );
|
2007-08-30 08:15:05 +00:00
|
|
|
ADD_MENUITEM( orientmenu, ID_POPUP_SCH_ORIENT_NORMAL_CMP, msg, normal_xpm );
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM_WITH_SUBMENU( PopMenu, orientmenu, ID_POPUP_SCH_GENERIC_ORIENT_CMP,
|
2009-09-18 14:56:05 +00:00
|
|
|
_( "Orient Component" ), orient_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
wxMenu* editmenu = new wxMenu;
|
2010-06-24 18:31:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit" ), s_Schematic_Hokeys_Descr, HK_EDIT );
|
|
|
|
ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_CMP, msg, edit_component_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2010-10-04 18:54:14 +00:00
|
|
|
if( libComponent && libComponent->IsNormal() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2010-06-24 18:31:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Value " ), s_Schematic_Hokeys_Descr, HK_EDIT_COMPONENT_VALUE );
|
|
|
|
ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_VALUE_CMP, msg, edit_comp_value_xpm );
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_REF_CMP, _( "Reference" ), edit_comp_ref_xpm );
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2009-09-18 14:56:05 +00:00
|
|
|
msg = AddHotkeyName( _( "Footprint " ), s_Schematic_Hokeys_Descr,
|
2008-03-21 11:16:18 +00:00
|
|
|
HK_EDIT_COMPONENT_FOOTPRINT );
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_FOOTPRINT_CMP, msg, edit_comp_footprint_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2008-12-12 21:30:07 +00:00
|
|
|
|
2009-09-18 14:56:05 +00:00
|
|
|
if( libComponent && libComponent->HasConversion() )
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_CONVERT_CMP, _( "Convert" ),
|
|
|
|
component_select_alternate_shape_xpm );
|
2009-09-18 14:56:05 +00:00
|
|
|
|
2009-10-05 17:52:41 +00:00
|
|
|
if( libComponent && ( libComponent->GetPartCount() >= 2 ) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
wxMenu* sel_unit_menu = new wxMenu; int ii;
|
2009-10-05 17:52:41 +00:00
|
|
|
for( ii = 0; ii < libComponent->GetPartCount(); ii++ )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2009-09-18 14:56:05 +00:00
|
|
|
wxString num_unit;
|
2011-01-18 10:42:49 +00:00
|
|
|
int unit = Component->GetUnit();
|
2009-09-18 14:56:05 +00:00
|
|
|
num_unit.Printf( _( "Unit %d %c" ), ii + 1,
|
|
|
|
"?ABCDEFGHIJKLMNOPQRSTUVWXYZ"[ ii + 1 ] );
|
2011-01-18 10:42:49 +00:00
|
|
|
wxMenuItem * item = sel_unit_menu->Append( ID_POPUP_SCH_SELECT_UNIT1 + ii,
|
|
|
|
num_unit, wxEmptyString,
|
|
|
|
wxITEM_CHECK );
|
|
|
|
if( unit == ii + 1 )
|
|
|
|
item->Check(true);
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2009-09-18 14:56:05 +00:00
|
|
|
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM_WITH_SUBMENU( editmenu, sel_unit_menu, ID_POPUP_SCH_SELECT_UNIT_CMP,
|
2009-09-18 14:56:05 +00:00
|
|
|
_( "Unit" ), component_select_unit_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM_WITH_SUBMENU( PopMenu, editmenu, ID_POPUP_SCH_GENERIC_EDIT_CMP,
|
2009-09-18 14:56:05 +00:00
|
|
|
_( "Edit Component" ), edit_component_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-03-10 19:36:30 +00:00
|
|
|
if( !Component->GetFlags() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2010-06-24 18:31:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Copy Component" ), s_Schematic_Hokeys_Descr,
|
2010-01-09 08:50:30 +00:00
|
|
|
HK_COPY_COMPONENT_OR_LABEL );
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, copy_button );
|
|
|
|
msg = AddHotkeyName( _( "Delete Component" ), s_Schematic_Hokeys_Descr, HK_DELETE );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_CMP, msg, delete_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2009-12-15 21:11:05 +00:00
|
|
|
if( libEntry && !libEntry->GetDocFileName().IsEmpty() )
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DISPLAYDOC_CMP, _( "Doc" ), datasheet_xpm );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel )
|
2009-09-18 14:56:05 +00:00
|
|
|
{
|
2009-10-26 19:00:46 +00:00
|
|
|
wxMenu* menu_change_type = new wxMenu;
|
2009-10-18 13:12:00 +00:00
|
|
|
wxString msg;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-03-10 19:36:30 +00:00
|
|
|
if( !GLabel->GetFlags() )
|
2009-10-18 13:12:00 +00:00
|
|
|
{
|
2010-06-24 18:31:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Move Global Label" ), s_Schematic_Hokeys_Descr,
|
|
|
|
HK_MOVE_COMPONENT_OR_ITEM );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST, msg, move_text_xpm );
|
2010-07-17 11:14:57 +00:00
|
|
|
msg = AddHotkeyName( _( "Drag Global Label" ), s_Schematic_Hokeys_Descr,
|
|
|
|
HK_DRAG );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DRAG_CMP_REQUEST, msg, move_text_xpm );
|
2010-06-24 18:31:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Copy Global Label" ), s_Schematic_Hokeys_Descr,
|
2010-01-09 08:50:30 +00:00
|
|
|
HK_COPY_COMPONENT_OR_LABEL );
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, copy_button );
|
2009-10-18 13:12:00 +00:00
|
|
|
}
|
2010-06-24 18:31:43 +00:00
|
|
|
|
|
|
|
msg = AddHotkeyName( _( "Rotate Global Label" ), s_Schematic_Hokeys_Descr, HK_ROTATE );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_TEXT, msg, rotate_glabel_xpm );
|
|
|
|
msg = AddHotkeyName( _( "Edit Global Label" ), s_Schematic_Hokeys_Descr, HK_EDIT );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_TEXT, msg, edit_text_xpm );
|
|
|
|
msg = AddHotkeyName( _( "Delete Global Label" ), s_Schematic_Hokeys_Descr, HK_DELETE );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, msg, delete_text_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
// add menu change type text (to label, glabel, text):
|
2008-02-21 15:33:13 +00:00
|
|
|
ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL,
|
2008-10-18 23:41:16 +00:00
|
|
|
_( "Change to Hierarchical Label" ), label2glabel_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL,
|
2008-10-18 23:41:16 +00:00
|
|
|
_( "Change to Label" ), glabel2label_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT,
|
2008-10-18 23:41:16 +00:00
|
|
|
_( "Change to Text" ), glabel2text_xpm );
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM_WITH_SUBMENU( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
|
2009-09-18 14:56:05 +00:00
|
|
|
_( "Change Type" ), gl_change_xpm );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
2008-03-21 11:16:18 +00:00
|
|
|
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* HLabel )
|
2009-09-18 14:56:05 +00:00
|
|
|
{
|
2009-10-26 19:00:46 +00:00
|
|
|
wxMenu* menu_change_type = new wxMenu;
|
2009-10-18 13:12:00 +00:00
|
|
|
wxString msg;
|
2008-02-12 21:12:46 +00:00
|
|
|
|
2011-03-10 19:36:30 +00:00
|
|
|
if( !HLabel->GetFlags() )
|
2009-10-18 13:12:00 +00:00
|
|
|
{
|
2010-06-24 18:31:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Move Hierarchical Label" ), s_Schematic_Hokeys_Descr,
|
2010-01-17 20:25:10 +00:00
|
|
|
HK_MOVE_COMPONENT_OR_ITEM );
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST, msg, move_text_xpm );
|
2010-07-17 11:14:57 +00:00
|
|
|
msg = AddHotkeyName( _( "Drag Hierarchical Label" ), s_Schematic_Hokeys_Descr,
|
|
|
|
HK_DRAG );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DRAG_CMP_REQUEST, msg, move_text_xpm );
|
2010-06-24 18:31:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Copy Hierarchical Label" ), s_Schematic_Hokeys_Descr,
|
2010-01-09 08:50:30 +00:00
|
|
|
HK_COPY_COMPONENT_OR_LABEL );
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, copy_button );
|
2009-10-18 13:12:00 +00:00
|
|
|
}
|
2010-06-24 18:31:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Rotate Hierarchical Label" ), s_Schematic_Hokeys_Descr, HK_ROTATE );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_TEXT, msg, rotate_glabel_xpm );
|
|
|
|
msg = AddHotkeyName( _( "Edit Hierarchical Label" ), s_Schematic_Hokeys_Descr, HK_EDIT );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_TEXT, msg, edit_text_xpm );
|
|
|
|
msg = AddHotkeyName( _( "Delete Hierarchical Label" ), s_Schematic_Hokeys_Descr, HK_DELETE );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, msg, delete_text_xpm );
|
2008-02-12 21:12:46 +00:00
|
|
|
|
|
|
|
// add menu change type text (to label, glabel, text):
|
|
|
|
ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL,
|
2008-10-18 23:41:16 +00:00
|
|
|
_( "Change to Label" ), glabel2label_xpm );
|
2008-02-12 21:12:46 +00:00
|
|
|
ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT,
|
2008-10-18 23:41:16 +00:00
|
|
|
_( "Change to Text" ), glabel2text_xpm );
|
2008-02-21 12:21:01 +00:00
|
|
|
ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL,
|
2008-10-18 23:41:16 +00:00
|
|
|
_( "Change to Global Label" ), label2glabel_xpm );
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM_WITH_SUBMENU( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
|
2009-09-18 14:56:05 +00:00
|
|
|
_( "Change Type" ), gl_change_xpm );
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label )
|
2009-09-18 14:56:05 +00:00
|
|
|
{
|
2009-10-26 19:00:46 +00:00
|
|
|
wxMenu* menu_change_type = new wxMenu;
|
2009-10-18 13:12:00 +00:00
|
|
|
wxString msg;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-03-10 19:36:30 +00:00
|
|
|
if( !Label->GetFlags() )
|
2009-10-18 13:12:00 +00:00
|
|
|
{
|
2009-11-04 20:46:53 +00:00
|
|
|
msg = AddHotkeyName( _( "Move Label" ), s_Schematic_Hokeys_Descr,
|
2010-01-17 20:25:10 +00:00
|
|
|
HK_MOVE_COMPONENT_OR_ITEM );
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST, msg, move_text_xpm );
|
2010-07-17 11:14:57 +00:00
|
|
|
msg = AddHotkeyName( _( "Drag Label" ), s_Schematic_Hokeys_Descr,
|
|
|
|
HK_DRAG );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DRAG_CMP_REQUEST, msg, move_text_xpm );
|
2010-06-24 18:31:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Copy Label" ), s_Schematic_Hokeys_Descr,
|
2010-01-09 08:50:30 +00:00
|
|
|
HK_COPY_COMPONENT_OR_LABEL );
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, copy_button );
|
2009-10-18 13:12:00 +00:00
|
|
|
}
|
2010-06-24 18:31:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Rotate Label" ), s_Schematic_Hokeys_Descr, HK_ROTATE );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_TEXT, msg, rotate_pos_xpm );
|
|
|
|
msg = AddHotkeyName( _( "Edit Label" ), s_Schematic_Hokeys_Descr, HK_EDIT );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_TEXT, msg, edit_text_xpm );
|
|
|
|
msg = AddHotkeyName( _( "Delete Label" ), s_Schematic_Hokeys_Descr, HK_DELETE );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, msg, delete_text_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
// add menu change type text (to label, glabel, text):
|
2008-02-21 12:21:01 +00:00
|
|
|
ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL,
|
2008-10-18 23:41:16 +00:00
|
|
|
_( "Change to Hierarchical Label" ), label2glabel_xpm );
|
2008-02-21 15:33:13 +00:00
|
|
|
ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT,
|
2008-10-18 23:41:16 +00:00
|
|
|
_( "Change to Text" ), label2text_xpm );
|
2008-02-21 15:33:13 +00:00
|
|
|
ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL,
|
2008-10-18 23:41:16 +00:00
|
|
|
_( "Change to Global Label" ), label2glabel_xpm );
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM_WITH_SUBMENU( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
|
2009-09-18 14:56:05 +00:00
|
|
|
_( "Change Type" ), gl_change_xpm );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text )
|
2009-09-18 14:56:05 +00:00
|
|
|
{
|
2009-12-27 14:01:21 +00:00
|
|
|
wxString msg;
|
2010-09-05 17:01:48 +00:00
|
|
|
wxMenu* menu_change_type = new wxMenu;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-03-10 19:36:30 +00:00
|
|
|
if( !Text->GetFlags() )
|
2009-12-27 14:01:21 +00:00
|
|
|
{
|
2010-06-24 18:31:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Move Text" ), s_Schematic_Hokeys_Descr,
|
2010-01-17 20:25:10 +00:00
|
|
|
HK_MOVE_COMPONENT_OR_ITEM );
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST, msg, move_text_xpm );
|
|
|
|
msg = AddHotkeyName( _( "Copy Text" ), s_Schematic_Hokeys_Descr,
|
2010-01-09 08:50:30 +00:00
|
|
|
HK_COPY_COMPONENT_OR_LABEL );
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, copy_button );
|
2009-12-27 14:01:21 +00:00
|
|
|
}
|
2010-06-24 18:31:43 +00:00
|
|
|
|
|
|
|
msg = AddHotkeyName( _( "Rotate Text" ), s_Schematic_Hokeys_Descr, HK_ROTATE );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_TEXT, msg, rotate_pos_xpm );
|
|
|
|
msg = AddHotkeyName( _( "Edit Text" ), s_Schematic_Hokeys_Descr, HK_EDIT );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_TEXT, msg, edit_text_xpm );
|
|
|
|
msg = AddHotkeyName( _( "Delete Text" ), s_Schematic_Hokeys_Descr, HK_DELETE );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, msg, delete_text_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2009-05-12 13:23:05 +00:00
|
|
|
/* add menu change type text (to label, glabel, text),
|
|
|
|
* but only if this is a single line text
|
|
|
|
*/
|
2009-09-18 14:56:05 +00:00
|
|
|
if( Text->m_Text.Find( wxT( "\n" ) ) == wxNOT_FOUND )
|
2009-05-12 13:23:05 +00:00
|
|
|
{
|
|
|
|
ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL,
|
|
|
|
_( "Change to Label" ), label2text_xpm );
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL,
|
|
|
|
_( "Change to Hierarchical Label" ), label2glabel_xpm );
|
|
|
|
ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL,
|
2011-01-10 16:50:40 +00:00
|
|
|
_( "Change to Global Label" ), label2glabel_xpm );
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM_WITH_SUBMENU( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
|
2009-09-18 14:56:05 +00:00
|
|
|
_( "Change Type" ), gl_change_xpm );
|
2009-05-12 13:23:05 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void AddMenusForJunction( wxMenu* PopMenu, SCH_JUNCTION* Junction, SCH_EDIT_FRAME* frame )
|
2009-09-18 14:56:05 +00:00
|
|
|
{
|
2011-02-21 13:54:29 +00:00
|
|
|
bool is_new = Junction->IsNew();
|
2011-03-10 19:36:30 +00:00
|
|
|
SCH_SCREEN* screen = frame->GetScreen();
|
2010-01-09 08:50:30 +00:00
|
|
|
wxString msg;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
if( !is_new )
|
|
|
|
{
|
2011-03-25 19:16:05 +00:00
|
|
|
if( screen->GetWire( screen->GetCrossHairPosition(), EXCLUDE_END_POINTS_T ) )
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ), break_line_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2010-06-24 18:31:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete Junction" ), s_Schematic_Hokeys_Descr, HK_DELETE );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, msg, delete_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-03-25 19:16:05 +00:00
|
|
|
if( screen->GetWireOrBus( screen->GetCrossHairPosition() ) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ), delete_node_xpm );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
|
|
|
|
delete_connection_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
|
2009-09-18 14:56:05 +00:00
|
|
|
{
|
2011-02-21 13:54:29 +00:00
|
|
|
bool is_new = Wire->IsNew();
|
2011-03-10 19:36:30 +00:00
|
|
|
SCH_SCREEN* screen = frame->GetScreen();
|
|
|
|
wxPoint pos = screen->GetCrossHairPosition();
|
2010-01-09 08:50:30 +00:00
|
|
|
wxString msg;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
if( is_new )
|
2009-08-28 07:11:56 +00:00
|
|
|
{
|
2008-10-18 23:41:16 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_END_LINE, _( "Wire End" ), apply_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
return;
|
2009-08-28 07:11:56 +00:00
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2010-06-24 18:31:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Drag Wire" ), s_Schematic_Hokeys_Descr, HK_DRAG );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DRAG_WIRE_REQUEST, msg, move_track_xpm );
|
2009-08-28 07:11:56 +00:00
|
|
|
PopMenu->AppendSeparator();
|
2010-06-24 18:31:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete Wire" ), s_Schematic_Hokeys_Descr, HK_DELETE );
|
2010-01-09 08:50:30 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, msg, delete_xpm );
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ), delete_node_xpm );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
|
|
|
|
delete_connection_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-03-25 19:16:05 +00:00
|
|
|
SCH_LINE* line = screen->GetWireOrBus( screen->GetCrossHairPosition() );
|
|
|
|
|
|
|
|
if( line && !line->IsEndPoint( screen->GetCrossHairPosition() ) )
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ), break_line_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
|
2010-11-11 17:54:24 +00:00
|
|
|
msg = AddHotkeyName( _( "Add Junction" ), s_Schematic_Hokeys_Descr, HK_ADD_JUNCTION );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, add_junction_xpm );
|
2010-07-17 12:04:42 +00:00
|
|
|
msg = AddHotkeyName( _( "Add Label" ), s_Schematic_Hokeys_Descr, HK_ADD_LABEL );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, add_line_label_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
// Add global label command only if the cursor is over one end of the wire.
|
2010-11-11 17:54:24 +00:00
|
|
|
if( ( pos == Wire->m_Start ) || ( pos == Wire->m_End ) )
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label" ), add_glabel_xpm );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame )
|
2009-09-18 14:56:05 +00:00
|
|
|
{
|
2011-02-21 13:54:29 +00:00
|
|
|
bool is_new = Bus->IsNew();
|
2011-02-11 20:48:13 +00:00
|
|
|
wxPoint pos = frame->GetScreen()->GetCrossHairPosition();
|
2010-11-11 17:54:24 +00:00
|
|
|
wxString msg;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
if( is_new )
|
2009-08-28 07:11:56 +00:00
|
|
|
{
|
2008-10-18 23:41:16 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_END_LINE, _( "Bus End" ), apply_xpm );
|
2009-08-28 07:11:56 +00:00
|
|
|
return;
|
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2010-11-11 17:54:24 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete Bus" ), s_Schematic_Hokeys_Descr, HK_DELETE );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, msg, delete_bus_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Bus" ), break_bus_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
PopMenu->AppendSeparator();
|
2010-11-11 17:54:24 +00:00
|
|
|
msg = AddHotkeyName( _( "Add Junction" ), s_Schematic_Hokeys_Descr, HK_ADD_JUNCTION );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, add_junction_xpm );
|
|
|
|
msg = AddHotkeyName( _( "Add Label" ), s_Schematic_Hokeys_Descr, HK_ADD_LABEL );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, add_line_label_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
// Add global label command only if the cursor is over one end of the bus.
|
2010-11-11 17:54:24 +00:00
|
|
|
if( ( pos == Bus->m_Start ) || ( pos == Bus->m_End ) )
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label" ), add_glabel_xpm );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet )
|
2009-09-18 14:56:05 +00:00
|
|
|
{
|
2010-06-24 18:31:43 +00:00
|
|
|
wxString msg;
|
2010-01-17 20:25:10 +00:00
|
|
|
|
2011-03-10 19:36:30 +00:00
|
|
|
if( !Sheet->GetFlags() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ENTER_SHEET, _( "Enter Sheet" ), enter_sheet_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
PopMenu->AppendSeparator();
|
2010-06-24 18:31:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Move Sheet" ), s_Schematic_Hokeys_Descr,
|
|
|
|
HK_MOVE_COMPONENT_OR_ITEM );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST, msg, move_sheet_xpm );
|
|
|
|
|
|
|
|
msg = AddHotkeyName( _( "Drag Sheet" ), s_Schematic_Hokeys_Descr, HK_DRAG );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DRAG_CMP_REQUEST, msg, move_sheet_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2011-03-10 19:36:30 +00:00
|
|
|
if( Sheet->GetFlags() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_END_SHEET, _( "Place Sheet" ), apply_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-06-24 18:31:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit Sheet" ), s_Schematic_Hokeys_Descr, HK_EDIT );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_SHEET, msg, edit_sheet_xpm );
|
2010-01-17 20:25:10 +00:00
|
|
|
|
2009-09-18 14:56:05 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_RESIZE_SHEET, _( "Resize Sheet" ),
|
|
|
|
resize_sheet_xpm );
|
2009-05-16 05:38:38 +00:00
|
|
|
PopMenu->AppendSeparator();
|
2011-03-30 19:26:05 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_IMPORT_GLABEL, _( "Import Sheet Pins" ),
|
2009-09-18 14:56:05 +00:00
|
|
|
import_hierarchical_label_xpm );
|
2010-06-24 18:31:43 +00:00
|
|
|
|
2011-03-30 19:26:05 +00:00
|
|
|
if( Sheet->HasUndefinedPins() ) // Sheet has pin labels, and can be cleaned
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_CLEANUP_SHEET, _( "Cleanup Sheet Pins" ),
|
2010-06-24 18:31:43 +00:00
|
|
|
options_pinsheet_xpm );
|
2009-05-16 05:38:38 +00:00
|
|
|
PopMenu->AppendSeparator();
|
2010-11-11 17:54:24 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete Sheet" ), s_Schematic_Hokeys_Descr, HK_DELETE );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, msg, delete_sheet_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-30 19:26:05 +00:00
|
|
|
void AddMenusForSheetPin( wxMenu* PopMenu, SCH_SHEET_PIN* PinSheet )
|
2009-09-18 14:56:05 +00:00
|
|
|
{
|
2010-06-24 18:31:43 +00:00
|
|
|
wxString msg;
|
2010-01-17 20:25:10 +00:00
|
|
|
|
2011-03-10 19:36:30 +00:00
|
|
|
if( !PinSheet->GetFlags() )
|
2010-06-24 18:31:43 +00:00
|
|
|
{
|
2011-03-30 19:26:05 +00:00
|
|
|
msg = AddHotkeyName( _( "Move Sheet Pin" ), s_Schematic_Hokeys_Descr,
|
2010-06-24 18:31:43 +00:00
|
|
|
HK_MOVE_COMPONENT_OR_ITEM );
|
2011-03-30 19:26:05 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_SHEET_PIN, msg, move_xpm );
|
2010-01-17 20:25:10 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-03-30 19:26:05 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_SHEET_PIN, _( "Edit Sheet Pin" ), edit_xpm );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-03-10 19:36:30 +00:00
|
|
|
if( !PinSheet->GetFlags() )
|
2011-03-30 19:26:05 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Sheet Pin" ), delete_pinsheet_xpm );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void AddMenusForBlock( wxMenu* PopMenu, SCH_EDIT_FRAME* frame )
|
2009-09-18 14:56:05 +00:00
|
|
|
{
|
2010-03-31 14:00:54 +00:00
|
|
|
wxString msg;
|
2010-09-05 17:01:48 +00:00
|
|
|
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel Block" ), cancel_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
|
2009-07-25 04:53:39 +00:00
|
|
|
if( frame->GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE )
|
2011-03-20 17:10:38 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_ZOOM_BLOCK, _( "Window Zoom" ),
|
|
|
|
zoom_area_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2008-10-18 23:41:16 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), apply_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
// After a block move (that is also a block selection) one can reselect
|
|
|
|
// a block function.
|
|
|
|
if( frame->GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE )
|
2009-09-18 14:56:05 +00:00
|
|
|
{
|
2009-05-05 17:32:07 +00:00
|
|
|
ADD_MENUITEM( PopMenu, wxID_COPY, _( "Save Block" ), copy_button );
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_COPY_BLOCK, _( "Copy Block" ), copyblock_xpm );
|
2010-03-31 14:00:54 +00:00
|
|
|
msg = AddHotkeyName( _( "Drag Block" ), s_Schematic_Hokeys_Descr,
|
|
|
|
HK_MOVEBLOCK_TO_DRAGBLOCK );
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_DRAG_BLOCK, msg, move_xpm );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_DELETE_BLOCK, _( "Delete Block" ), delete_xpm );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_MIRROR_Y_BLOCK, _( "Mirror Block ||" ), mirror_H_xpm );
|
2010-09-05 17:01:48 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_MIRROR_X_BLOCK, _( "Mirror Block --" ), mirror_V_xpm );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_ROTATE_BLOCK, _( "Rotate Block ccw" ), rotate_pos_xpm );
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
#if 0
|
2007-06-05 12:10:51 +00:00
|
|
|
#ifdef __WINDOWS__
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( menu_other_block_commands, ID_GEN_COPY_BLOCK_TO_CLIPBOARD,
|
2007-08-20 01:20:48 +00:00
|
|
|
_( "Copy to Clipboard" ), copy_button );
|
2007-05-06 16:03:28 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
2009-07-08 15:42:45 +00:00
|
|
|
|
2009-09-18 14:56:05 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void AddMenusForMarkers( wxMenu* aPopMenu, SCH_MARKER* aMarker, SCH_EDIT_FRAME* aFrame )
|
2009-07-08 15:42:45 +00:00
|
|
|
{
|
2010-06-24 18:31:43 +00:00
|
|
|
ADD_MENUITEM( aPopMenu, ID_POPUP_SCH_DELETE, _( "Delete Marker" ), delete_xpm );
|
|
|
|
ADD_MENUITEM( aPopMenu, ID_POPUP_SCH_GETINFO_MARKER, _( "Marker Error Info" ), info_xpm );
|
2009-07-08 15:42:45 +00:00
|
|
|
}
|