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>
|
|
|
|
#include <class_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>
|
|
|
|
#include <libeditframe.h>
|
|
|
|
#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();
|
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;
|
|
|
|
}
|
|
|
|
|
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_PART* part = GetCurPart();
|
|
|
|
|
|
|
|
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;
|
|
|
|
item->GetMsgPanelInfo( items );
|
|
|
|
SetMsgPanel( items );
|
|
|
|
}
|
2009-04-05 20:49:15 +00:00
|
|
|
else
|
2013-01-12 17:32:24 +00:00
|
|
|
{
|
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
|
|
|
|
2011-04-27 19:44:32 +00:00
|
|
|
m_drawItem = item;
|
2013-01-02 07:55:48 +00:00
|
|
|
bool not_edited = !item->InEditMode();
|
2008-10-18 23:41:16 +00:00
|
|
|
wxString msg;
|
|
|
|
|
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
|
|
|
{
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Move Arc" ), 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_arc_xpm ) );
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Drag Arc Size" ), g_Libedit_Hokeys_Descr, HK_DRAG );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, KiBitmap( move_arc_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
|
|
|
{
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete Arc" ), g_Libedit_Hokeys_Descr, HK_DELETE );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, KiBitmap( delete_arc_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
|
|
|
{
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Move Circle" ), 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_circle_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
|
|
|
|
2014-10-15 11:40:38 +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
|
|
|
{
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete Circle" ), 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
|
|
|
|
2014-10-15 11:40:38 +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 ) );
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete Rectangle" ), 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
|
|
|
{
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Move Text" ), 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_text_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 Text" ), 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
|
|
|
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Rotate Text" ), g_Libedit_Hokeys_Descr, HK_ROTATE );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_LIBEDIT_ROTATE_ITEM, msg, KiBitmap( edit_text_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
|
|
|
{
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete Text" ), g_Libedit_Hokeys_Descr, HK_DELETE );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, KiBitmap( delete_text_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
|
|
|
{
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Move Line" ), 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_line_xpm ) );
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Drag Edge Point" ), g_Libedit_Hokeys_Descr, HK_DRAG );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, KiBitmap( move_line_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
|
|
|
|
2014-10-15 11:40:38 +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
|
|
|
{
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete Line " ), g_Libedit_Hokeys_Descr, HK_DELETE );
|
2012-03-26 23:47:08 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg,
|
|
|
|
KiBitmap( delete_segment_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
|
|
|
{
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete Segment" ), g_Libedit_Hokeys_Descr, HK_DELETE );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT,
|
2011-09-08 05:58:45 +00:00
|
|
|
msg, KiBitmap( delete_segment_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
|
|
|
{
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Move Field" ), 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_field_xpm ) );
|
2009-09-22 12:27:57 +00:00
|
|
|
}
|
2011-09-01 12:54:34 +00:00
|
|
|
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Field Rotate" ), g_Libedit_Hokeys_Descr, HK_ROTATE );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_LIBEDIT_ROTATE_ITEM, msg, KiBitmap( rotate_field_xpm ) );
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Field 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() ) );
|
2009-09-25 18:49:04 +00:00
|
|
|
m_drawItem = 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
|
|
|
}
|
|
|
|
|
2013-01-01 20:52:37 +00:00
|
|
|
// Add menu items for pin edition
|
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
|
|
|
{
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Move Pin " ), 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
|
|
|
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit Pin " ), 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
|
|
|
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Rotate Pin " ), g_Libedit_Hokeys_Descr, HK_ROTATE );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_LIBEDIT_ROTATE_ITEM, msg, KiBitmap( rotate_pin_xpm ) );
|
2010-01-17 20:25:10 +00:00
|
|
|
|
2008-10-18 23:41:16 +00:00
|
|
|
if( not_in_move )
|
|
|
|
{
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete Pin " ), g_Libedit_Hokeys_Descr, HK_DELETE );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, KiBitmap( delete_pin_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,
|
|
|
|
selected ? _( "Pin Size to selected pins" ) :
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "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,
|
|
|
|
selected ? _( "Pin Name Size to selected pin" ) :
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "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,
|
|
|
|
selected ? _( "Pin Num Size to selected pin" ) :
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "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
|
|
|
{
|
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,
|
|
|
|
_( "Zoom Block (drag middle mouse)" ),
|
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 ) );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_COPY_BLOCK, _( "Copy Block" ), KiBitmap( copyblock_xpm ) );
|
2012-03-26 23:47:08 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_MIRROR_Y_BLOCK, _( "Mirror Block ||" ),
|
|
|
|
KiBitmap( mirror_h_xpm ) );
|
|
|
|
AddMenuItem( PopMenu, ID_POPUP_MIRROR_X_BLOCK, _( "Mirror Block --" ),
|
|
|
|
KiBitmap( mirror_v_xpm ) );
|
|
|
|
AddMenuItem( PopMenu, ID_POPUP_ROTATE_BLOCK, _( "Rotate Block ccw" ),
|
|
|
|
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
|
|
|
}
|