2007-08-20 01:20:48 +00:00
|
|
|
|
/******************************************************************/
|
|
|
|
|
/* onrightclick.cpp - creation du menu popup appele par le bouton */
|
|
|
|
|
/* droit de la souris */
|
|
|
|
|
/******************************************************************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
|
#include "id.h"
|
|
|
|
|
#include "class_drawpanel.h"
|
|
|
|
|
#include "confirm.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
|
#include "program.h"
|
|
|
|
|
#include "libcmp.h"
|
|
|
|
|
#include "general.h"
|
2009-07-08 15:42:45 +00:00
|
|
|
|
#include "class_marker_sch.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
|
#include "protos.h"
|
2007-08-30 08:15:05 +00:00
|
|
|
|
#include "hotkeys.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
|
#include "bitmaps.h"
|
|
|
|
|
|
|
|
|
|
/* functions to add commands and submenus depending on the item */
|
2007-08-20 01:20:48 +00:00
|
|
|
|
static void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame );
|
|
|
|
|
static void AddMenusForWire( wxMenu* PopMenu, EDA_DrawLineStruct* Wire,
|
|
|
|
|
WinEDA_SchematicFrame* frame );
|
|
|
|
|
static void AddMenusForBus( wxMenu* PopMenu, EDA_DrawLineStruct* Bus,
|
|
|
|
|
WinEDA_SchematicFrame* frame );
|
|
|
|
|
static void AddMenusForHierchicalSheet( wxMenu* PopMenu, DrawSheetStruct* Sheet );
|
2008-04-15 19:38:19 +00:00
|
|
|
|
static void AddMenusForPinSheet( wxMenu* PopMenu, Hierarchical_PIN_Sheet_Struct* 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 );
|
2008-09-17 17:26:25 +00:00
|
|
|
|
static void AddMenusForComponentField( wxMenu* PopMenu, SCH_CMP_FIELD* Field );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
static void AddMenusForJunction( wxMenu* PopMenu, DrawJunctionStruct* Junction,
|
|
|
|
|
WinEDA_SchematicFrame* frame );
|
2009-07-08 15:42:45 +00:00
|
|
|
|
static void AddMenusForMarkers( wxMenu* aPopMenu, MARKER_SCH* aMarker,
|
|
|
|
|
WinEDA_SchematicFrame* aFrame );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************/
|
2007-10-07 18:24:15 +00:00
|
|
|
|
bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
|
2007-08-20 01:20:48 +00:00
|
|
|
|
wxMenu* PopMenu )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*****************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
|
/* Prepare le menu PullUp affich<63> par un click sur le bouton droit
|
2007-08-20 01:20:48 +00:00
|
|
|
|
* de la souris.
|
2008-02-12 21:12:46 +00:00
|
|
|
|
* Ce menu est ensuite compl<EFBFBD>t<EFBFBD> par la liste des commandes de ZOOM
|
2007-08-20 01:20:48 +00:00
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2008-04-14 19:22:48 +00:00
|
|
|
|
SCH_ITEM* DrawStruct = (SCH_ITEM*) GetScreen()->GetCurItem();
|
2009-07-25 04:53:39 +00:00
|
|
|
|
bool BlockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE);
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DrawPanel->m_CanStartBlock = -1; // Ne pas engager un debut de bloc sur validation menu
|
|
|
|
|
|
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
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
2009-04-14 16:45:22 +00:00
|
|
|
|
{ // Just try to locate items at cursor position
|
|
|
|
|
DrawStruct = SchematicGeneralLocateAndDisplay( false );
|
2007-09-01 12:00:30 +00:00
|
|
|
|
if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
2008-04-15 19:38:19 +00:00
|
|
|
|
Hierarchical_PIN_Sheet_Struct* slabel;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
slabel = LocateSheetLabel( (DrawSheetStruct*) DrawStruct,
|
2008-03-21 11:16:18 +00:00
|
|
|
|
GetScreen()->m_Curseur );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
if( slabel )
|
|
|
|
|
DrawStruct = slabel;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-14 16:45:22 +00:00
|
|
|
|
// If Command in progress: add "cancel" and "end tool" menu
|
2007-08-20 01:20:48 +00:00
|
|
|
|
if( m_ID_current_state )
|
|
|
|
|
{
|
|
|
|
|
if( DrawStruct && DrawStruct->m_Flags )
|
|
|
|
|
{
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ), cancel_xpm );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_CLOSE_CURRENT_TOOL, _( "End Tool" ), cancel_tool_xpm );
|
|
|
|
|
}
|
|
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2007-09-29 13:31:10 +00:00
|
|
|
|
if( DrawStruct && DrawStruct->m_Flags )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
2008-03-20 01:50:21 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ), cancel_xpm );
|
|
|
|
|
PopMenu->AppendSeparator();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( DrawStruct == NULL )
|
|
|
|
|
{
|
2008-02-12 21:12:46 +00:00
|
|
|
|
if( GetSheet()->Last() != g_RootSheet )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_LEAVE_SHEET, _( "Leave Sheet" ), leave_sheet_xpm );
|
|
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
|
}
|
2007-10-07 18:24:15 +00:00
|
|
|
|
return true;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
|
GetScreen()->SetCurItem( DrawStruct );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
int flags = DrawStruct->m_Flags;
|
|
|
|
|
bool is_new = (flags & IS_NEW) ? TRUE : FALSE;
|
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
|
switch( DrawStruct->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
|
|
|
|
case DRAW_NOCONNECT_STRUCT_TYPE:
|
|
|
|
|
|
2008-10-18 23:41:16 +00:00
|
|
|
|
// if( !flags ) PopMenu->Append(ID_POPUP_SCH_MOVE_ITEM_REQUEST, "Move Noconnect");
|
2008-04-17 16:25:29 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Noconn" ), delete_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case DRAW_JUNCTION_STRUCT_TYPE:
|
|
|
|
|
AddMenusForJunction( PopMenu, (DrawJunctionStruct*) DrawStruct, this );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case DRAW_BUSENTRY_STRUCT_TYPE:
|
|
|
|
|
if( !flags )
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST,
|
2008-04-17 16:25:29 +00:00
|
|
|
|
_( "Move Bus Entry" ), move_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
if( GetBusEntryShape( (DrawBusEntryStruct*) DrawStruct ) == '\\' )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
PopMenu->Append( ID_POPUP_SCH_ENTRY_SELECT_SLASH, _( "Set Bus Entry /" ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
else
|
2008-04-17 16:25:29 +00:00
|
|
|
|
PopMenu->Append( ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH, _( "Set Bus Entry \\" ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE,
|
2008-04-17 16:25:29 +00:00
|
|
|
|
_( "Delete Bus Entry" ), delete_bus_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2009-08-01 19:26:05 +00:00
|
|
|
|
case TYPE_MARKER_SCH:
|
2009-07-08 15:42:45 +00:00
|
|
|
|
AddMenusForMarkers( PopMenu, (MARKER_SCH*) DrawStruct, this );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
|
case TYPE_SCH_TEXT:
|
|
|
|
|
AddMenusForText( PopMenu, (SCH_TEXT*) DrawStruct );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
|
case TYPE_SCH_LABEL:
|
|
|
|
|
AddMenusForLabel( PopMenu, (SCH_LABEL*) DrawStruct );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
|
case TYPE_SCH_GLOBALLABEL:
|
|
|
|
|
AddMenusForGLabel( PopMenu, (SCH_GLOBALLABEL*) DrawStruct );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
2008-03-20 01:50:21 +00:00
|
|
|
|
|
|
|
|
|
case TYPE_SCH_HIERLABEL:
|
|
|
|
|
AddMenusForHLabel( PopMenu, (SCH_HIERLABEL*) DrawStruct );
|
2008-02-12 21:12:46 +00:00
|
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
case DRAW_PART_TEXT_STRUCT_TYPE:
|
|
|
|
|
{
|
2008-09-17 17:26:25 +00:00
|
|
|
|
AddMenusForComponentField( PopMenu, (SCH_CMP_FIELD*) DrawStruct );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
if( flags )
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
// Many fields are inside a component. If this is the case, add the component menu
|
2008-03-21 11:16:18 +00:00
|
|
|
|
SCH_COMPONENT* Component = LocateSmallestComponent( (SCH_SCREEN*) GetScreen() );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
if( Component )
|
|
|
|
|
{
|
|
|
|
|
PopMenu->AppendSeparator();
|
2008-03-21 11:16:18 +00:00
|
|
|
|
AddMenusForComponent( PopMenu, Component );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
|
case TYPE_SCH_COMPONENT:
|
|
|
|
|
AddMenusForComponent( PopMenu, (SCH_COMPONENT*) DrawStruct );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case DRAW_SEGMENT_STRUCT_TYPE:
|
2007-05-06 16:03:28 +00:00
|
|
|
|
// if( !flags ) PopMenu->Append(ID_POPUP_SCH_MOVE_ITEM_REQUEST, "Move");
|
2008-04-14 19:22:48 +00:00
|
|
|
|
switch( DrawStruct->GetLayer() )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
|
|
|
|
case LAYER_WIRE:
|
|
|
|
|
AddMenusForWire( PopMenu, (EDA_DrawLineStruct*) DrawStruct, this );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LAYER_BUS:
|
|
|
|
|
AddMenusForBus( PopMenu, (EDA_DrawLineStruct*) DrawStruct, this );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
if( is_new )
|
2008-04-17 16:25:29 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_END_LINE, _( "End Drawing" ), apply_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE,
|
2008-04-17 16:25:29 +00:00
|
|
|
|
_( "Delete Drawing" ), delete_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case DRAW_SHEET_STRUCT_TYPE:
|
|
|
|
|
AddMenusForHierchicalSheet( PopMenu, (DrawSheetStruct*) DrawStruct );
|
|
|
|
|
break;
|
|
|
|
|
|
2008-04-15 19:38:19 +00:00
|
|
|
|
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
|
|
|
|
|
AddMenusForPinSheet( PopMenu, (Hierarchical_PIN_Sheet_Struct*) DrawStruct );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
wxString msg;
|
|
|
|
|
msg.Printf(
|
|
|
|
|
wxT( "WinEDA_SchematicFrame::OnRightClick Error: unknown DrawType %d" ),
|
2007-09-01 12:00:30 +00:00
|
|
|
|
DrawStruct->Type() );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
DisplayError( this, msg );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PopMenu->AppendSeparator();
|
2008-03-20 01:50:21 +00:00
|
|
|
|
return true;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
2008-09-17 17:26:25 +00:00
|
|
|
|
void AddMenusForComponentField( wxMenu* PopMenu, SCH_CMP_FIELD* Field )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*************************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Add menu commands for a component field (like value, reference)
|
2007-08-20 01:20:48 +00:00
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
|
if( !Field->m_Flags )
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST, _( "Move Field" ), move_text_xpm );
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_FIELD, _( "Rotate Field" ), rotate_field_xpm );
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_FIELD, _( "Edit Field" ), edit_text_xpm );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/**************************************************************************/
|
2008-03-20 01:50:21 +00:00
|
|
|
|
void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/**************************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Add menu commands for a component
|
2007-08-20 01:20:48 +00:00
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2008-03-21 11:16:18 +00:00
|
|
|
|
if( Component->Type() != TYPE_SCH_COMPONENT )
|
|
|
|
|
{
|
|
|
|
|
wxASSERT( 0 );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2007-08-30 08:15:05 +00:00
|
|
|
|
wxString msg;
|
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
EDA_LibComponentStruct* LibEntry;
|
|
|
|
|
|
2009-08-27 11:41:56 +00:00
|
|
|
|
LibEntry = ( EDA_LibComponentStruct* ) FindLibPart( Component->m_ChipName );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
if( !Component->m_Flags )
|
|
|
|
|
{
|
2008-10-18 23:41:16 +00:00
|
|
|
|
msg = _( "Move Component" );
|
2008-10-06 05:44:29 +00:00
|
|
|
|
msg << wxT(" ") << Component->GetField( REFERENCE )->m_Text;
|
2008-03-22 18:08:44 +00:00
|
|
|
|
msg = AddHotkeyName( msg, s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_CMP_REQUEST,
|
2007-08-30 08:15:05 +00:00
|
|
|
|
msg, move_xpm );
|
2008-10-18 23:41:16 +00:00
|
|
|
|
msg = AddHotkeyName( _( "Drag Component" ), s_Schematic_Hokeys_Descr, HK_DRAG_COMPONENT );
|
2007-09-22 14:31:20 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DRAG_CMP_REQUEST,
|
|
|
|
|
msg, move_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// add menu orient et sous menu:
|
|
|
|
|
wxMenu* orientmenu = new wxMenu;
|
2007-09-06 11:52:26 +00:00
|
|
|
|
msg = AddHotkeyName( _( "Rotate +" ), s_Schematic_Hokeys_Descr, HK_ROTATE_COMPONENT );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
ADD_MENUITEM( orientmenu, ID_POPUP_SCH_ROTATE_CMP_COUNTERCLOCKWISE,
|
2007-08-30 08:15:05 +00:00
|
|
|
|
msg, rotate_pos_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
ADD_MENUITEM( orientmenu, ID_POPUP_SCH_ROTATE_CMP_CLOCKWISE, _( "Rotate -" ), rotate_neg_xpm );
|
2007-09-06 11:52:26 +00:00
|
|
|
|
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 );
|
2007-09-06 11:52:26 +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 );
|
2007-09-06 11:52:26 +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 );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
ADD_MENUITEM_WITH_SUBMENU( PopMenu, orientmenu,
|
|
|
|
|
ID_POPUP_SCH_GENERIC_ORIENT_CMP, _(
|
2008-10-18 23:41:16 +00:00
|
|
|
|
"Orient Component" ), orient_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
wxMenu* editmenu = new wxMenu;
|
|
|
|
|
ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_CMP, _( "Edit" ), edit_component_xpm );
|
|
|
|
|
|
|
|
|
|
if( LibEntry && LibEntry->m_Options != ENTRY_POWER )
|
|
|
|
|
{
|
2008-03-20 01:50:21 +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 );
|
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_REF_CMP, _( "Reference" ), edit_comp_ref_xpm );
|
2008-03-20 01:50:21 +00:00
|
|
|
|
|
2008-03-21 11:16:18 +00:00
|
|
|
|
msg = AddHotkeyName( _(
|
|
|
|
|
"Footprint " ), s_Schematic_Hokeys_Descr,
|
|
|
|
|
HK_EDIT_COMPONENT_FOOTPRINT );
|
2008-03-20 01:50:21 +00:00
|
|
|
|
ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_FOOTPRINT_CMP, msg, edit_comp_footprint_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
}
|
|
|
|
|
if( LibEntry && (LookForConvertPart( LibEntry ) >= 2) )
|
2008-12-12 21:30:07 +00:00
|
|
|
|
ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_CONVERT_CMP,_( "Convert" ), component_select_alternate_shape_xpm );
|
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
if( LibEntry && (LibEntry->m_UnitCount >= 2) )
|
|
|
|
|
{
|
|
|
|
|
wxMenu* sel_unit_menu = new wxMenu; int ii;
|
|
|
|
|
for( ii = 0; ii < LibEntry->m_UnitCount; ii++ )
|
|
|
|
|
{
|
|
|
|
|
wxString num_unit; num_unit.Printf( _(
|
|
|
|
|
"Unit %d %c" ), ii + 1,
|
|
|
|
|
"?ABCDEFGHIJKLMNOPQRSTUVWXYZ"[ii + 1] );
|
|
|
|
|
sel_unit_menu->Append( ID_POPUP_SCH_SELECT_UNIT1 + ii,
|
|
|
|
|
num_unit );
|
|
|
|
|
}
|
2008-12-12 21:30:07 +00:00
|
|
|
|
ADD_MENUITEM_WITH_SUBMENU( editmenu, sel_unit_menu, ID_POPUP_SCH_SELECT_UNIT_CMP, _( "Unit" ), component_select_unit_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ADD_MENUITEM_WITH_SUBMENU( PopMenu, editmenu,
|
|
|
|
|
ID_POPUP_SCH_GENERIC_EDIT_CMP, _(
|
2008-10-18 23:41:16 +00:00
|
|
|
|
"Edit Component" ), edit_component_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
if( !Component->m_Flags )
|
|
|
|
|
{
|
2008-10-18 23:41:16 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_COPY_COMPONENT_CMP, _( "Copy Component" ), import_xpm );
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_CMP, _( "Delete Component" ), delete_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-08-27 11:41:56 +00:00
|
|
|
|
LibEntry = ( EDA_LibComponentStruct* ) FindLibPart( Component->m_ChipName,
|
|
|
|
|
wxEmptyString, ALIAS );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
if( LibEntry && !LibEntry->m_DocFile.IsEmpty() )
|
|
|
|
|
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 )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*******************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Add menu commands for a Global Label
|
2007-08-20 01:20:48 +00:00
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
|
wxMenu* menu_change_type = new wxMenu;
|
|
|
|
|
|
|
|
|
|
if( !GLabel->m_Flags )
|
2008-10-18 23:41:16 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST, _( "Move Global Label" ), move_text_xpm );
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_TEXT, _( "Rotate Global Label" ), rotate_glabel_xpm );
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_TEXT, _( "Edit Global Label" ), edit_text_xpm );
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Global Label" ), 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 );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
ADD_MENUITEM_WITH_SUBMENU( PopMenu, menu_change_type,
|
2008-10-18 23:41:16 +00:00
|
|
|
|
ID_POPUP_SCH_CHANGE_TYPE_TEXT, _( "Change Type" ), gl_change_xpm );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
2008-03-21 11:16:18 +00:00
|
|
|
|
|
|
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
|
/*******************************************************************/
|
2008-03-20 01:50:21 +00:00
|
|
|
|
void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* HLabel )
|
2008-02-12 21:12:46 +00:00
|
|
|
|
/*******************************************************************/
|
2008-03-21 11:16:18 +00:00
|
|
|
|
|
2008-10-15 11:46:53 +00:00
|
|
|
|
/* Add menu commands for a hierarchical Label
|
2008-02-12 21:12:46 +00:00
|
|
|
|
*/
|
|
|
|
|
{
|
|
|
|
|
wxMenu* menu_change_type = new wxMenu;
|
|
|
|
|
|
|
|
|
|
if( !HLabel->m_Flags )
|
2008-10-18 23:41:16 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST, _( "Move Hierarchical Label" ), move_text_xpm );
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_TEXT, _( "Rotate Hierarchical Label" ), rotate_glabel_xpm );
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_TEXT, _( "Edit Hierarchical Label" ), edit_text_xpm );
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Hierarchical label" ), 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 );
|
2008-02-12 21:12:46 +00:00
|
|
|
|
ADD_MENUITEM_WITH_SUBMENU( PopMenu, menu_change_type,
|
2008-10-18 23:41:16 +00:00
|
|
|
|
ID_POPUP_SCH_CHANGE_TYPE_TEXT, _( "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
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*****************************************************************/
|
2008-03-20 01:50:21 +00:00
|
|
|
|
void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*****************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Add menu commands for a Label
|
2007-08-20 01:20:48 +00:00
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
|
wxMenu* menu_change_type = new wxMenu;
|
|
|
|
|
|
|
|
|
|
if( !Label->m_Flags )
|
2008-10-18 23:41:16 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST, _( "Move Label" ), move_text_xpm );
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_TEXT, _( "Rotate Label" ), rotate_pos_xpm );
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_TEXT, _( "Edit Label" ), edit_text_xpm );
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Label" ), 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 );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
ADD_MENUITEM_WITH_SUBMENU( PopMenu, menu_change_type,
|
2008-10-18 23:41:16 +00:00
|
|
|
|
ID_POPUP_SCH_CHANGE_TYPE_TEXT, _( "Change Type" ), gl_change_xpm );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*****************************************************************/
|
2008-03-20 01:50:21 +00:00
|
|
|
|
void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*****************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Add menu commands for a Text (a comment)
|
2007-08-20 01:20:48 +00:00
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
|
wxMenu* menu_change_type = new wxMenu;
|
|
|
|
|
|
|
|
|
|
if( !Text->m_Flags )
|
2008-10-18 23:41:16 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST, _( "Move Text" ), move_text_xpm );
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ROTATE_TEXT, _( "Rotate Text" ), rotate_pos_xpm );
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_TEXT, _( "Edit Text" ), edit_text_xpm );
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Text" ), 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
|
|
|
|
|
*/
|
|
|
|
|
if( Text->m_Text.Find( wxT("\n") ) == wxNOT_FOUND )
|
|
|
|
|
{
|
|
|
|
|
ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL,
|
|
|
|
|
_( "Change to Label" ), label2text_xpm );
|
|
|
|
|
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,
|
|
|
|
|
_( "Change to Glabel" ), label2glabel_xpm );
|
|
|
|
|
ADD_MENUITEM_WITH_SUBMENU( PopMenu, menu_change_type,
|
|
|
|
|
ID_POPUP_SCH_CHANGE_TYPE_TEXT, _( "Change Type" ), gl_change_xpm );
|
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
void AddMenusForJunction( wxMenu* PopMenu, DrawJunctionStruct* Junction,
|
|
|
|
|
WinEDA_SchematicFrame* frame )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*****************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Add menu commands for a junction
|
2007-08-20 01:20:48 +00:00
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
|
bool is_new = (Junction->m_Flags & IS_NEW) ? TRUE : FALSE;
|
|
|
|
|
|
|
|
|
|
if( !is_new )
|
|
|
|
|
{
|
2008-02-12 21:12:46 +00:00
|
|
|
|
if( PickStruct( frame->GetScreen()->m_Curseur, frame->GetScreen(),
|
2007-08-20 01:20:48 +00:00
|
|
|
|
WIREITEM | BUSITEM | EXCLUDE_WIRE_BUS_ENDPOINTS ) )
|
2008-10-18 23:41:16 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ), break_line_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-10-18 23:41:16 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Junction" ), delete_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
|
if( PickStruct( frame->GetScreen()->m_Curseur, frame->GetScreen(),
|
2007-08-20 01:20:48 +00:00
|
|
|
|
WIREITEM | BUSITEM ) )
|
|
|
|
|
{
|
2008-10-18 23:41:16 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ), delete_node_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _(
|
2008-10-18 23:41:16 +00:00
|
|
|
|
"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
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*****************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
void AddMenusForWire( wxMenu* PopMenu, EDA_DrawLineStruct* Wire,
|
|
|
|
|
WinEDA_SchematicFrame* frame )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*****************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Add menu commands for a wire
|
2007-08-20 01:20:48 +00:00
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
|
bool is_new = (Wire->m_Flags & IS_NEW) ? TRUE : FALSE;
|
|
|
|
|
wxPoint pos = frame->GetScreen()->m_Curseur;
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2009-08-28 07:11:56 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DRAG_WIRE_REQUEST, _( "Drag Wire" ), move_track_xpm );
|
|
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Wire" ), delete_xpm );
|
2008-10-18 23:41:16 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ), delete_node_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _(
|
2008-10-18 23:41:16 +00:00
|
|
|
|
"Delete Connection" ), delete_connection_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
|
if( PickStruct( frame->GetScreen()->m_Curseur, frame->GetScreen(),
|
2007-08-20 01:20:48 +00:00
|
|
|
|
WIREITEM | BUSITEM | EXCLUDE_WIRE_BUS_ENDPOINTS ) )
|
2008-10-18 23:41:16 +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();
|
|
|
|
|
|
2008-10-18 23:41:16 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, _( "Add Junction" ), add_junction_xpm );
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_LABEL, _( "Add Label" ), add_line_label_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
// Place Global label command only if the cursor is over one end of the Wire:
|
|
|
|
|
if( ( pos.x == Wire->m_Start.x && pos.y == Wire->m_Start.y)
|
|
|
|
|
|| ( pos.x == Wire->m_End.x && pos.y == Wire->m_End.y ) )
|
2008-10-18 23:41:16 +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
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*****************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
void AddMenusForBus( wxMenu* PopMenu, EDA_DrawLineStruct* Bus,
|
|
|
|
|
WinEDA_SchematicFrame* frame )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*****************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Add menu commands for a Bus
|
2007-08-20 01:20:48 +00:00
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
|
bool is_new = (Bus->m_Flags & IS_NEW) ? TRUE : FALSE;
|
|
|
|
|
wxPoint pos = frame->GetScreen()->m_Curseur;
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE,
|
2008-10-18 23:41:16 +00:00
|
|
|
|
_( "Delete Bus" ), delete_bus_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2009-08-28 07:11:56 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_BREAK_WIRE,
|
2008-10-18 23:41:16 +00:00
|
|
|
|
_( "Break Bus" ), break_bus_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
PopMenu->AppendSeparator();
|
2008-10-18 23:41:16 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, _( "Add Junction" ), add_junction_xpm );
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_LABEL, _( "Add Label" ), add_line_label_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
// Place Global label command only if the cursor is over one end of the Bus:
|
|
|
|
|
if( ( pos.x == Bus->m_Start.x && pos.y == Bus->m_Start.y)
|
|
|
|
|
|| ( pos.x == Bus->m_End.x && pos.y == Bus->m_End.y ) )
|
2008-10-18 23:41:16 +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
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/************************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
void AddMenusForHierchicalSheet( wxMenu* PopMenu, DrawSheetStruct* Sheet )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/************************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Add menu commands for a Sheet
|
2007-08-20 01:20:48 +00:00
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
|
if( !Sheet->m_Flags )
|
|
|
|
|
{
|
2008-10-18 23:41:16 +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();
|
2008-10-18 23:41:16 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST, _( "Move Sheet" ), move_sheet_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( Sheet->m_Flags )
|
|
|
|
|
{
|
2008-10-18 23:41:16 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_END_SHEET, _( "Place Sheet" ), apply_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2008-10-18 23:41:16 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_SHEET, _( "Edit Sheet" ), edit_sheet_xpm );
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_RESIZE_SHEET, _( "Resize Sheet" ), resize_sheet_xpm );
|
2009-05-16 05:38:38 +00:00
|
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_IMPORT_GLABEL, _("Import PinSheets"),
|
|
|
|
|
import_hierarchical_label_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
if( Sheet->m_Label ) // Sheet has pin labels, and can be cleaned
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_CLEANUP_SHEET,
|
|
|
|
|
_( "Cleanup PinSheets" ), options_pinsheet_xpm );
|
2009-05-16 05:38:38 +00:00
|
|
|
|
PopMenu->AppendSeparator();
|
2008-10-18 23:41:16 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Sheet" ), delete_sheet_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/************************************************************************/
|
2008-04-15 19:38:19 +00:00
|
|
|
|
void AddMenusForPinSheet( wxMenu* PopMenu, Hierarchical_PIN_Sheet_Struct* PinSheet )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/************************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Add menu commands for a Pin Sheet (or Sheet label)
|
2007-08-20 01:20:48 +00:00
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
|
if( !PinSheet->m_Flags )
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_PINSHEET, _( "Move PinSheet" ), move_xpm );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_EDIT_PINSHEET, _( "Edit PinSheet" ), edit_xpm );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
if( !PinSheet->m_Flags )
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete PinSheet" ), delete_pinsheet_xpm );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/**********************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/**********************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Add menu commands for block
|
2007-08-20 01:20:48 +00:00
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2008-10-18 23:41:16 +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 )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_ZOOM_BLOCK,
|
2009-05-05 17:32:07 +00:00
|
|
|
|
_( "Window Zoom" ), zoom_selected_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-07-25 04:53:39 +00:00
|
|
|
|
if( frame->GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE )
|
2009-05-05 17:32:07 +00:00
|
|
|
|
{ // After a block move (that is also a block selection) one can reselect a block function:
|
|
|
|
|
ADD_MENUITEM( PopMenu, wxID_COPY, _( "Save Block" ), copy_button );
|
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_COPY_BLOCK,
|
2008-10-18 23:41:16 +00:00
|
|
|
|
_( "Copy Block" ), copyblock_xpm );
|
2009-05-05 17:32:07 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_DRAG_BLOCK,
|
2008-10-18 23:41:16 +00:00
|
|
|
|
_( "Drag Block" ), move_xpm );
|
2009-05-05 17:32:07 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_DELETE_BLOCK,
|
2008-10-18 23:41:16 +00:00
|
|
|
|
_( "Delete Block" ), delete_xpm );
|
2009-05-05 17:32:07 +00:00
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_MIRROR_Y_BLOCK, _(
|
2007-08-20 01:20:48 +00:00
|
|
|
|
"Mirror Block ||" ), mirror_H_xpm );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
#if 0
|
2007-06-05 12:10:51 +00:00
|
|
|
|
#ifdef __WINDOWS__
|
2007-08-20 01:20:48 +00:00
|
|
|
|
ADD_MENUITEM( menu_other_block_commands, ID_GEN_COPY_BLOCK_TO_CLIPBOARD,
|
|
|
|
|
_( "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
|
|
|
|
|
|
|
|
|
/**********************************************************************/
|
|
|
|
|
void AddMenusForMarkers( wxMenu* aPopMenu, MARKER_SCH* aMarker,
|
|
|
|
|
WinEDA_SchematicFrame* aFrame )
|
|
|
|
|
/**********************************************************************/
|
|
|
|
|
{
|
|
|
|
|
ADD_MENUITEM( aPopMenu, ID_POPUP_SCH_DELETE, _( "Delete Marker" ), delete_xpm );
|
2009-07-13 06:20:18 +00:00
|
|
|
|
ADD_MENUITEM( aPopMenu, ID_POPUP_SCH_GETINFO_MARKER, _( "Marker Error Info" ), info_xpm );
|
2009-07-08 15:42:45 +00:00
|
|
|
|
}
|