2011-03-21 20:35:16 +00:00
|
|
|
/**
|
|
|
|
* @file libedit_onrightclick.cpp
|
2013-01-01 20:52:37 +00:00
|
|
|
* @brief Library editor: create the pop menus when clicking on mouse right button
|
2011-03-21 20:35:16 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2013-01-01 20:52:37 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2014-02-07 19:32:08 +00:00
|
|
|
* Copyright (C) 2004-2014 KiCad Developers, see change_log.txt for contributors.
|
2013-01-01 20:52:37 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
2009-09-22 12:27:57 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <confirm.h>
|
|
|
|
#include <eeschema_id.h>
|
|
|
|
#include <hotkeys.h>
|
|
|
|
#include <class_drawpanel.h>
|
2018-01-30 08:56:43 +00:00
|
|
|
#include <sch_screen.h>
|
2013-01-12 17:32:24 +00:00
|
|
|
#include <msgpanel.h>
|
2009-09-22 12:27:57 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <general.h>
|
2018-01-30 10:49:51 +00:00
|
|
|
#include <lib_edit_frame.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_libentry.h>
|
|
|
|
#include <lib_pin.h>
|
|
|
|
#include <lib_polyline.h>
|
2012-04-09 09:16:47 +00:00
|
|
|
#include <menus_helpers.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* functions to add commands and submenus depending on the item */
|
2010-11-19 16:28:46 +00:00
|
|
|
static void AddMenusForBlock( wxMenu* PopMenu, LIB_EDIT_FRAME* frame );
|
|
|
|
static void AddMenusForPin( wxMenu* PopMenu, LIB_PIN* Pin, LIB_EDIT_FRAME* frame );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
LIB_ITEM* item = GetDrawItem();
|
|
|
|
bool blockActive = GetScreen()->IsBlockActive();
|
2018-03-13 16:26:17 +00:00
|
|
|
wxString msg;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
if( blockActive )
|
2011-02-16 10:14:02 +00:00
|
|
|
{
|
|
|
|
AddMenusForBlock( PopMenu, this );
|
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-03-13 16:26:17 +00:00
|
|
|
LIB_PART* part = GetCurPart();
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
|
|
|
if( !part )
|
2009-09-22 12:27:57 +00:00
|
|
|
return true;
|
2008-10-18 23:41:16 +00:00
|
|
|
|
2011-02-16 10:14:02 +00:00
|
|
|
// If Command in progress, put menu "cancel"
|
2013-01-02 07:55:48 +00:00
|
|
|
if( item && item->InEditMode() )
|
2008-10-18 23:41:16 +00:00
|
|
|
{
|
2012-03-26 23:47:08 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _( "Cancel" ),
|
|
|
|
KiBitmap( cancel_xpm ) );
|
2008-10-18 23:41:16 +00:00
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
}
|
2011-03-21 20:35:16 +00:00
|
|
|
else
|
|
|
|
{
|
2011-04-27 19:44:32 +00:00
|
|
|
item = LocateItemUsingCursor( aPosition );
|
|
|
|
|
|
|
|
// If the clarify item selection context menu is aborted, don't show the context menu.
|
2011-12-29 20:11:42 +00:00
|
|
|
if( item == NULL && m_canvas->GetAbortRequest() )
|
2011-04-27 19:44:32 +00:00
|
|
|
{
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetAbortRequest( false );
|
2011-04-27 19:44:32 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-03-21 20:35:16 +00:00
|
|
|
if( GetToolId() != ID_NO_TOOL_SELECTED )
|
|
|
|
{
|
|
|
|
// If a tool is active, put menu "end tool"
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _( "End Tool" ),
|
2012-03-20 14:17:58 +00:00
|
|
|
KiBitmap( cursor_xpm ) );
|
2011-03-21 20:35:16 +00:00
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
}
|
2008-10-18 23:41:16 +00:00
|
|
|
}
|
2011-02-23 13:48:19 +00:00
|
|
|
|
2011-04-27 19:44:32 +00:00
|
|
|
if( item )
|
2013-01-12 17:32:24 +00:00
|
|
|
{
|
|
|
|
MSG_PANEL_ITEMS items;
|
2018-04-10 10:52:12 +00:00
|
|
|
item->GetMsgPanelInfo( m_UserUnits, items );
|
2013-01-12 17:32:24 +00:00
|
|
|
SetMsgPanel( items );
|
|
|
|
}
|
2009-04-05 20:49:15 +00:00
|
|
|
else
|
2013-01-12 17:32:24 +00:00
|
|
|
{
|
2018-03-13 16:26:17 +00:00
|
|
|
if( GetToolId() == ID_NO_TOOL_SELECTED )
|
|
|
|
{
|
|
|
|
msg = AddHotkeyName( _( "&Paste" ), g_Libedit_Hokeys_Descr, HK_EDIT_PASTE );
|
|
|
|
AddMenuItem( PopMenu, wxID_PASTE, msg,
|
|
|
|
_( "Pastes item(s) from the Clipboard" ),
|
|
|
|
KiBitmap( paste_xpm ) );
|
|
|
|
}
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
return true;
|
2013-01-12 17:32:24 +00:00
|
|
|
}
|
2008-10-18 23:41:16 +00:00
|
|
|
|
2017-12-18 05:21:00 +00:00
|
|
|
SetDrawItem( item );
|
2013-01-02 07:55:48 +00:00
|
|
|
bool not_edited = !item->InEditMode();
|
2008-10-18 23:41:16 +00:00
|
|
|
|
2011-04-27 19:44:32 +00:00
|
|
|
switch( item->Type() )
|
2008-10-18 23:41:16 +00:00
|
|
|
{
|
2010-12-10 19:47:44 +00:00
|
|
|
case LIB_PIN_T:
|
2011-04-27 19:44:32 +00:00
|
|
|
AddMenusForPin( PopMenu, (LIB_PIN*) item, this );
|
2009-09-22 12:27:57 +00:00
|
|
|
break;
|
2008-10-18 23:41:16 +00:00
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case LIB_ARC_T:
|
2013-01-02 07:55:48 +00:00
|
|
|
if( not_edited )
|
2009-09-22 12:27:57 +00:00
|
|
|
{
|
2017-07-04 15:17:55 +00:00
|
|
|
msg = AddHotkeyName( _( "Move" ), g_Libedit_Hokeys_Descr,
|
2009-12-06 18:04:41 +00:00
|
|
|
HK_LIBEDIT_MOVE_GRAPHIC_ITEM );
|
2012-03-26 23:47:08 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg,
|
2017-07-03 15:13:13 +00:00
|
|
|
KiBitmap( move_xpm ) );
|
2017-07-04 15:17:55 +00:00
|
|
|
msg = AddHotkeyName( _( "Drag Arc Edge" ), g_Libedit_Hokeys_Descr, HK_DRAG );
|
2017-07-03 15:13:13 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, KiBitmap( move_xpm ) );
|
2009-09-22 12:27:57 +00:00
|
|
|
}
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit Arc Options" ), g_Libedit_Hokeys_Descr, HK_EDIT );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, KiBitmap( options_arc_xpm ) );
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2013-01-02 07:55:48 +00:00
|
|
|
if( not_edited )
|
2009-09-22 12:27:57 +00:00
|
|
|
{
|
2017-07-04 15:17:55 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete" ), g_Libedit_Hokeys_Descr, HK_DELETE );
|
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, KiBitmap( delete_xpm ) );
|
2009-09-22 12:27:57 +00:00
|
|
|
}
|
|
|
|
break;
|
2008-10-18 23:41:16 +00:00
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case LIB_CIRCLE_T:
|
2013-01-02 07:55:48 +00:00
|
|
|
if( not_edited )
|
2009-09-22 12:27:57 +00:00
|
|
|
{
|
2017-07-04 15:17:55 +00:00
|
|
|
msg = AddHotkeyName( _( "Move" ), g_Libedit_Hokeys_Descr,
|
2009-12-06 18:04:41 +00:00
|
|
|
HK_LIBEDIT_MOVE_GRAPHIC_ITEM );
|
2012-03-26 23:47:08 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg,
|
2017-07-04 15:17:55 +00:00
|
|
|
KiBitmap( move_xpm ) );
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Drag Circle Outline" ), g_Libedit_Hokeys_Descr, HK_DRAG );
|
2012-03-26 23:47:08 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg,
|
|
|
|
KiBitmap( move_rectangle_xpm ) );
|
2010-07-26 17:06:36 +00:00
|
|
|
}
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2018-02-09 16:28:33 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit Circle Options..." ), g_Libedit_Hokeys_Descr, HK_EDIT );
|
2012-03-26 23:47:08 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg,
|
|
|
|
KiBitmap( options_circle_xpm ) );
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2013-01-02 07:55:48 +00:00
|
|
|
if( not_edited )
|
2009-09-22 12:27:57 +00:00
|
|
|
{
|
2017-07-04 15:17:55 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete" ), g_Libedit_Hokeys_Descr, HK_DELETE );
|
2012-03-26 23:47:08 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg,
|
|
|
|
KiBitmap( delete_circle_xpm ) );
|
2009-09-22 12:27:57 +00:00
|
|
|
}
|
|
|
|
break;
|
2008-10-18 23:41:16 +00:00
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case LIB_RECTANGLE_T:
|
2013-01-02 07:55:48 +00:00
|
|
|
if( not_edited )
|
2009-09-22 12:27:57 +00:00
|
|
|
{
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Move Rectangle" ), g_Libedit_Hokeys_Descr,
|
2009-12-06 18:04:41 +00:00
|
|
|
HK_LIBEDIT_MOVE_GRAPHIC_ITEM );
|
2012-03-26 23:47:08 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg,
|
|
|
|
KiBitmap( move_rectangle_xpm ) );
|
2009-09-22 12:27:57 +00:00
|
|
|
}
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2018-02-09 16:28:33 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit Rectangle Options..." ), g_Libedit_Hokeys_Descr, HK_EDIT );
|
2012-03-26 23:47:08 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg,
|
|
|
|
KiBitmap( options_rectangle_xpm ) );
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2013-01-02 07:55:48 +00:00
|
|
|
if( not_edited )
|
2010-07-26 17:06:36 +00:00
|
|
|
{
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Drag Rectangle Edge" ), g_Libedit_Hokeys_Descr, HK_DRAG );
|
2012-03-26 23:47:08 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg,
|
|
|
|
KiBitmap( move_rectangle_xpm ) );
|
2017-07-04 15:17:55 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete" ), g_Libedit_Hokeys_Descr, HK_DELETE );
|
2012-03-26 23:47:08 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg,
|
|
|
|
KiBitmap( delete_rectangle_xpm ) );
|
2009-09-22 12:27:57 +00:00
|
|
|
}
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
break;
|
2008-10-18 23:41:16 +00:00
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case LIB_TEXT_T:
|
2013-01-02 07:55:48 +00:00
|
|
|
if( not_edited )
|
2009-09-22 12:27:57 +00:00
|
|
|
{
|
2017-07-04 15:17:55 +00:00
|
|
|
msg = AddHotkeyName( _( "Move" ), g_Libedit_Hokeys_Descr,
|
2009-12-06 18:04:41 +00:00
|
|
|
HK_LIBEDIT_MOVE_GRAPHIC_ITEM );
|
2012-03-26 23:47:08 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg,
|
2017-06-02 09:51:11 +00:00
|
|
|
KiBitmap( move_xpm ) );
|
2009-09-22 12:27:57 +00:00
|
|
|
}
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2018-02-09 16:28:33 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit..." ), g_Libedit_Hokeys_Descr, HK_EDIT );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2017-07-20 12:37:11 +00:00
|
|
|
msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Libedit_Hokeys_Descr, HK_ROTATE );
|
2017-07-04 15:17:55 +00:00
|
|
|
AddMenuItem( PopMenu, ID_LIBEDIT_ROTATE_ITEM, msg, KiBitmap( rotate_cw_xpm ) );
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2013-01-02 07:55:48 +00:00
|
|
|
if( not_edited )
|
2009-09-22 12:27:57 +00:00
|
|
|
{
|
2017-07-04 15:17:55 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete" ), g_Libedit_Hokeys_Descr, HK_DELETE );
|
2017-07-03 15:13:13 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, KiBitmap( delete_xpm ) );
|
2009-09-22 12:27:57 +00:00
|
|
|
}
|
|
|
|
break;
|
2008-10-18 23:41:16 +00:00
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case LIB_POLYLINE_T:
|
2013-01-02 07:55:48 +00:00
|
|
|
if( not_edited )
|
2009-09-22 12:27:57 +00:00
|
|
|
{
|
2017-07-04 15:17:55 +00:00
|
|
|
msg = AddHotkeyName( _( "Move" ), g_Libedit_Hokeys_Descr,
|
2009-12-06 18:04:41 +00:00
|
|
|
HK_LIBEDIT_MOVE_GRAPHIC_ITEM );
|
2012-03-26 23:47:08 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg,
|
2017-07-04 15:17:55 +00:00
|
|
|
KiBitmap( move_xpm ) );
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Drag Edge Point" ), g_Libedit_Hokeys_Descr, HK_DRAG );
|
2017-07-04 15:17:55 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, KiBitmap( move_exactly_xpm ) );
|
2009-09-22 12:27:57 +00:00
|
|
|
}
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2011-04-27 19:44:32 +00:00
|
|
|
if( item->IsNew() )
|
2009-09-22 12:27:57 +00:00
|
|
|
{
|
2012-03-26 23:47:08 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_END_CREATE_ITEM, _( "Line End" ),
|
2014-02-07 19:32:08 +00:00
|
|
|
KiBitmap( checked_ok_xpm ) );
|
2009-09-22 12:27:57 +00:00
|
|
|
}
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2018-02-09 16:28:33 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit Line Options..." ), g_Libedit_Hokeys_Descr, HK_EDIT );
|
2012-03-26 23:47:08 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg,
|
|
|
|
KiBitmap( options_segment_xpm ) );
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2013-01-02 07:55:48 +00:00
|
|
|
if( not_edited )
|
2009-09-22 12:27:57 +00:00
|
|
|
{
|
2017-07-04 15:17:55 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete" ), g_Libedit_Hokeys_Descr, HK_DELETE );
|
2012-03-26 23:47:08 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg,
|
2017-07-04 15:17:55 +00:00
|
|
|
KiBitmap( delete_xpm ) );
|
2009-09-22 12:27:57 +00:00
|
|
|
}
|
2013-01-02 07:55:48 +00:00
|
|
|
|
|
|
|
if( item->IsNew() )
|
2009-09-22 12:27:57 +00:00
|
|
|
{
|
2011-04-27 19:44:32 +00:00
|
|
|
if( ( (LIB_POLYLINE*) item )->GetCornerCount() > 2 )
|
2008-10-18 23:41:16 +00:00
|
|
|
{
|
2017-07-04 15:17:55 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete" ), g_Libedit_Hokeys_Descr, HK_DELETE );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT,
|
2017-07-04 15:17:55 +00:00
|
|
|
msg, KiBitmap( delete_xpm ) );
|
2008-10-18 23:41:16 +00:00
|
|
|
}
|
2009-09-22 12:27:57 +00:00
|
|
|
}
|
2010-02-04 17:46:12 +00:00
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
break;
|
2008-10-18 23:41:16 +00:00
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case LIB_FIELD_T:
|
2013-01-02 07:55:48 +00:00
|
|
|
if( not_edited )
|
2009-09-22 12:27:57 +00:00
|
|
|
{
|
2017-07-04 15:17:55 +00:00
|
|
|
msg = AddHotkeyName( _( "Move" ), g_Libedit_Hokeys_Descr,
|
2009-12-06 18:04:41 +00:00
|
|
|
HK_LIBEDIT_MOVE_GRAPHIC_ITEM );
|
2012-03-26 23:47:08 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg,
|
2017-07-04 15:17:55 +00:00
|
|
|
KiBitmap( move_xpm ) );
|
2009-09-22 12:27:57 +00:00
|
|
|
}
|
2011-09-01 12:54:34 +00:00
|
|
|
|
2017-07-20 12:37:11 +00:00
|
|
|
msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Libedit_Hokeys_Descr, HK_ROTATE );
|
2017-06-02 09:51:11 +00:00
|
|
|
AddMenuItem( PopMenu, ID_LIBEDIT_ROTATE_ITEM, msg, KiBitmap( rotate_cw_xpm ) );
|
2018-02-09 16:28:33 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit..." ), g_Libedit_Hokeys_Descr, HK_EDIT );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_FIELD_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
|
2009-09-22 12:27:57 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
2011-04-27 19:44:32 +00:00
|
|
|
wxFAIL_MSG( wxString::Format( wxT( "Unknown library item type %d" ),
|
|
|
|
item->Type() ) );
|
2017-12-18 05:21:00 +00:00
|
|
|
SetDrawItem( NULL );
|
2009-09-22 12:27:57 +00:00
|
|
|
break;
|
2008-10-18 23:41:16 +00:00
|
|
|
}
|
2009-09-22 12:27:57 +00:00
|
|
|
|
2008-10-18 23:41:16 +00:00
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
return true;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2010-11-19 16:28:46 +00:00
|
|
|
void AddMenusForPin( wxMenu* PopMenu, LIB_PIN* Pin, LIB_EDIT_FRAME* frame )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2011-12-21 13:42:02 +00:00
|
|
|
bool selected = Pin->IsSelected();
|
|
|
|
bool not_in_move = !Pin->IsMoving();
|
2009-12-06 18:04:41 +00:00
|
|
|
wxString msg;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-10-18 23:41:16 +00:00
|
|
|
if( not_in_move )
|
2009-12-06 18:04:41 +00:00
|
|
|
{
|
2017-07-04 15:17:55 +00:00
|
|
|
msg = AddHotkeyName( _( "Move" ), g_Libedit_Hokeys_Descr,
|
2009-12-06 18:04:41 +00:00
|
|
|
HK_LIBEDIT_MOVE_GRAPHIC_ITEM );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, KiBitmap( move_xpm ) );
|
2009-12-06 18:04:41 +00:00
|
|
|
}
|
2008-10-18 23:41:16 +00:00
|
|
|
|
2018-02-09 16:28:33 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit..." ), g_Libedit_Hokeys_Descr, HK_EDIT);
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_LIBEDIT_EDIT_PIN, msg, KiBitmap( edit_xpm ) );
|
2008-10-18 23:41:16 +00:00
|
|
|
|
2017-07-20 12:37:11 +00:00
|
|
|
msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Libedit_Hokeys_Descr, HK_ROTATE );
|
2017-06-02 09:51:11 +00:00
|
|
|
AddMenuItem( PopMenu, ID_LIBEDIT_ROTATE_ITEM, msg, KiBitmap( rotate_cw_xpm ) );
|
2010-01-17 20:25:10 +00:00
|
|
|
|
2008-10-18 23:41:16 +00:00
|
|
|
if( not_in_move )
|
|
|
|
{
|
2017-07-04 15:17:55 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete" ), g_Libedit_Hokeys_Descr, HK_DELETE );
|
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, KiBitmap( delete_xpm ) );
|
2008-10-18 23:41:16 +00:00
|
|
|
}
|
2010-12-10 19:47:44 +00:00
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
wxMenu* global_pin_change = new wxMenu;
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( PopMenu, global_pin_change,
|
|
|
|
ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_ITEM,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "Global" ), KiBitmap( pin_to_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( global_pin_change,
|
|
|
|
ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM,
|
2018-02-09 16:28:33 +00:00
|
|
|
selected ? _( "Push Pin Size to Selected Pin" ) :
|
|
|
|
_( "Push Pin Size to Others" ), KiBitmap( pin_size_to_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( global_pin_change,
|
|
|
|
ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM,
|
2018-02-09 16:28:33 +00:00
|
|
|
selected ? _( "Push Pin Name Size to Selected Pin" ) :
|
|
|
|
_( "Push Pin Name Size to Others" ), KiBitmap( pin_name_to_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( global_pin_change,
|
|
|
|
ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM,
|
2018-02-09 16:28:33 +00:00
|
|
|
selected ? _( "Push Pin Num Size to Selected Pin" ) :
|
|
|
|
_( "Push Pin Num Size to Others" ), KiBitmap( pin_number_to_xpm ) );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
/* Add menu commands for block */
|
|
|
|
|
2010-11-19 16:28:46 +00:00
|
|
|
void AddMenusForBlock( wxMenu* PopMenu, LIB_EDIT_FRAME* frame )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2016-04-22 14:15:16 +00:00
|
|
|
wxString msg;
|
2012-03-26 23:47:08 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _( "Cancel Block" ),
|
|
|
|
KiBitmap( cancel_xpm ) );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-03-26 23:47:08 +00:00
|
|
|
if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_ZOOM_BLOCK,
|
2018-02-09 16:28:33 +00:00
|
|
|
_( "Zoom Block" ),
|
2011-09-08 05:58:45 +00:00
|
|
|
KiBitmap( zoom_area_xpm ) );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-10-18 23:41:16 +00:00
|
|
|
PopMenu->AppendSeparator();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2014-02-07 19:32:08 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), KiBitmap( checked_ok_xpm ) );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-03-26 23:47:08 +00:00
|
|
|
if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
|
2008-10-18 23:41:16 +00:00
|
|
|
{
|
2012-03-26 23:47:08 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SELECT_ITEMS_BLOCK, _( "Select Items" ),
|
|
|
|
KiBitmap( green_xpm ) );
|
2017-11-20 13:11:50 +00:00
|
|
|
msg = AddHotkeyName( _( "Cut Block" ), g_Schematic_Hokeys_Descr,
|
2018-02-22 19:05:10 +00:00
|
|
|
HK_EDIT_CUT );
|
2017-11-20 13:11:50 +00:00
|
|
|
AddMenuItem( PopMenu, wxID_CUT, msg, KiBitmap( cut_xpm ) );
|
|
|
|
msg = AddHotkeyName( _( "Copy Block" ), g_Schematic_Hokeys_Descr,
|
2018-02-22 19:05:10 +00:00
|
|
|
HK_EDIT_COPY );
|
2017-11-20 13:11:50 +00:00
|
|
|
AddMenuItem( PopMenu, wxID_COPY, msg, KiBitmap( copy_xpm ) );
|
|
|
|
AddMenuItem( PopMenu, ID_POPUP_DUPLICATE_BLOCK, _( "Duplicate Block" ),
|
|
|
|
KiBitmap( duplicate_xpm ) );
|
2018-01-05 18:07:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Mirror Block Around Horizontal(X) Axis" ), g_Libedit_Hokeys_Descr,
|
|
|
|
HK_MIRROR_X );
|
2016-04-22 14:15:16 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_MIRROR_X_BLOCK, msg,
|
2012-03-26 23:47:08 +00:00
|
|
|
KiBitmap( mirror_v_xpm ) );
|
2018-03-02 18:17:09 +00:00
|
|
|
msg = AddHotkeyName( _( "Mirror Block Around Vertical(Y) Axis" ), g_Libedit_Hokeys_Descr,
|
|
|
|
HK_MIRROR_Y );
|
|
|
|
AddMenuItem( PopMenu, ID_POPUP_MIRROR_Y_BLOCK, msg,
|
|
|
|
KiBitmap( mirror_h_xpm ) );
|
2017-07-20 12:37:11 +00:00
|
|
|
msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Libedit_Hokeys_Descr, HK_ROTATE );
|
2016-04-22 14:15:16 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_ROTATE_BLOCK, msg,
|
2012-03-26 23:47:08 +00:00
|
|
|
KiBitmap( rotate_ccw_xpm ) );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK, _( "Delete Block" ), KiBitmap( delete_xpm ) );
|
2008-10-18 23:41:16 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|