2011-10-19 20:32:21 +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) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2017-10-06 18:07:43 +00:00
|
|
|
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
2017-01-31 01:31:19 +00:00
|
|
|
* Copyright (C) 2004-2017 KiCad Developers, see change_log.txt for contributors.
|
2011-10-19 20:32:21 +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
|
|
|
|
*/
|
|
|
|
|
2011-10-07 14:41:30 +00:00
|
|
|
/**
|
|
|
|
* @file eeschema/onrightclick.cpp
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <eeschema_id.h>
|
|
|
|
#include <class_drawpanel.h>
|
|
|
|
#include <confirm.h>
|
2018-01-30 10:49:51 +00:00
|
|
|
#include <sch_edit_frame.h>
|
2012-04-09 09:16:47 +00:00
|
|
|
#include <menus_helpers.h>
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <general.h>
|
|
|
|
#include <hotkeys.h>
|
|
|
|
#include <class_library.h>
|
|
|
|
#include <sch_bus_entry.h>
|
|
|
|
#include <sch_marker.h>
|
|
|
|
#include <sch_text.h>
|
|
|
|
#include <sch_junction.h>
|
|
|
|
#include <sch_component.h>
|
|
|
|
#include <sch_line.h>
|
|
|
|
#include <sch_no_connect.h>
|
|
|
|
#include <sch_sheet.h>
|
|
|
|
#include <sch_sheet_path.h>
|
|
|
|
#include <sch_bitmap.h>
|
2017-10-06 18:07:43 +00:00
|
|
|
#include <symbol_lib_table.h>
|
2010-11-10 15:30:12 +00:00
|
|
|
|
2010-01-17 20:25:10 +00:00
|
|
|
#include <iostream>
|
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 );
|
2017-10-06 18:07:43 +00:00
|
|
|
static void AddMenusForEditComponent( wxMenu* PopMenu, SCH_COMPONENT* Component,
|
|
|
|
SYMBOL_LIB_TABLE* aLibs );
|
|
|
|
static void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component,
|
|
|
|
SYMBOL_LIB_TABLE* aLibs );
|
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 AddMenusForMarkers( wxMenu* aPopMenu, SCH_MARKER* aMarker, SCH_EDIT_FRAME* aFrame );
|
2011-08-31 14:59:20 +00:00
|
|
|
static void AddMenusForBitmap( wxMenu* aPopMenu, SCH_BITMAP * aBitmap );
|
2013-04-01 10:35:20 +00:00
|
|
|
static void AddMenusForBusEntry( wxMenu* aPopMenu, SCH_BUS_ENTRY_BASE * aBusEntry );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
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
|
|
|
{
|
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
|
|
|
SCH_ITEM* item = GetScreen()->GetCurItem();
|
|
|
|
bool blockActive = GetScreen()->IsBlockActive();
|
|
|
|
wxString msg;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2018-04-25 12:28:41 +00:00
|
|
|
// Do not start a block command on context menu.
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetCanStartBlock( -1 );
|
2007-08-20 01:20:48 +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 )
|
2008-03-20 01:50:21 +00:00
|
|
|
{
|
|
|
|
AddMenusForBlock( PopMenu, this );
|
2007-09-29 13:31:10 +00:00
|
|
|
PopMenu->AppendSeparator();
|
2012-12-29 12:55:36 +00:00
|
|
|
|
2018-06-22 13:05:11 +00:00
|
|
|
// If we have a block containing only one main element we append its edit submenu
|
2012-12-29 12:55:36 +00:00
|
|
|
if( item != NULL )
|
|
|
|
{
|
|
|
|
switch( item->Type() )
|
|
|
|
{
|
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
|
|
|
case SCH_COMPONENT_T:
|
2017-10-06 18:07:43 +00:00
|
|
|
AddMenusForEditComponent( PopMenu, (SCH_COMPONENT *) item,
|
|
|
|
Prj().SchSymbolLibTable() );
|
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
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCH_TEXT_T:
|
2018-02-09 16:28:33 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit Text..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
|
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
|
|
|
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
|
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCH_LABEL_T:
|
2018-02-09 16:28:33 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit Label..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
|
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
|
|
|
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
|
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCH_GLOBAL_LABEL_T:
|
2018-02-09 16:28:33 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit Global Label..." ), g_Schematic_Hokeys_Descr,
|
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
|
|
|
HK_EDIT );
|
|
|
|
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
|
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCH_HIERARCHICAL_LABEL_T:
|
2018-02-09 16:28:33 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit Hierarchical Label..." ), g_Schematic_Hokeys_Descr,
|
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
|
|
|
HK_EDIT );
|
|
|
|
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
|
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCH_BITMAP_T:
|
2018-02-09 16:28:33 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit Image..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
|
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
|
|
|
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( image_xpm ) );
|
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2012-12-29 12:55:36 +00:00
|
|
|
}
|
|
|
|
}
|
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
|
|
|
{
|
2018-04-25 12:28:41 +00:00
|
|
|
bool actionCancelled = false;
|
2018-01-16 23:48:13 +00:00
|
|
|
item = LocateAndShowItem( aPosition, SCH_COLLECTOR::AllItemsButPins, 0, &actionCancelled );
|
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.
|
2018-01-16 23:48:13 +00:00
|
|
|
if( item == NULL && actionCancelled )
|
2011-03-25 19:16:05 +00:00
|
|
|
return false;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2012-10-23 16:37:19 +00:00
|
|
|
// If a command is in progress: add "cancel" and "end tool" menu
|
2011-12-29 20:11:42 +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-10-19 20:32:21 +00:00
|
|
|
AddMenuItem( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "Cancel" ),
|
|
|
|
KiBitmap( cancel_xpm ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-10-19 20:32:21 +00:00
|
|
|
AddMenuItem( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "End Tool" ),
|
2012-03-20 14:17:58 +00:00
|
|
|
KiBitmap( cursor_xpm ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2011-09-01 12:54:34 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
PopMenu->AppendSeparator();
|
2012-10-23 16:37:19 +00:00
|
|
|
|
|
|
|
switch( GetToolId() )
|
|
|
|
{
|
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
|
|
|
case ID_WIRE_BUTT:
|
|
|
|
AddMenusForWire( PopMenu, NULL, this );
|
|
|
|
if( item == NULL )
|
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
break;
|
2012-10-23 16:37:19 +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
|
|
|
case ID_BUS_BUTT:
|
|
|
|
AddMenusForBus( PopMenu, NULL, this );
|
|
|
|
if( item == NULL )
|
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
break;
|
2012-10-23 16:37:19 +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
|
|
|
default:
|
|
|
|
break;
|
2012-10-23 16:37:19 +00:00
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-03-25 19:16:05 +00:00
|
|
|
if( item && item->GetFlags() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-10-19 20:32:21 +00:00
|
|
|
AddMenuItem( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "Cancel" ),
|
|
|
|
KiBitmap( 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
|
|
|
{
|
2018-04-25 12:28:41 +00:00
|
|
|
if( GetToolId() == ID_NO_TOOL_SELECTED && m_blockItems.GetCount() > 0 )
|
|
|
|
{
|
2018-03-13 16:26:17 +00:00
|
|
|
msg = AddHotkeyName( _( "&Paste" ), g_Schematic_Hokeys_Descr, HK_EDIT_PASTE );
|
|
|
|
AddMenuItem( PopMenu, wxID_PASTE, msg,
|
|
|
|
_( "Pastes item(s) from the Clipboard" ),
|
|
|
|
KiBitmap( paste_xpm ) );
|
2018-04-25 12:28:41 +00:00
|
|
|
PopMenu->AppendSeparator();
|
2018-03-13 16:26:17 +00:00
|
|
|
}
|
|
|
|
|
2011-12-08 21:05:43 +00:00
|
|
|
if( m_CurrentSheet->Last() != g_RootSheet )
|
2012-03-20 14:17:58 +00:00
|
|
|
{
|
2015-06-14 17:58:57 +00:00
|
|
|
msg = AddHotkeyName( _( "Leave Sheet" ), g_Schematic_Hokeys_Descr, HK_LEAVE_SHEET );
|
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_LEAVE_SHEET, msg,
|
2011-10-19 20:32:21 +00:00
|
|
|
KiBitmap( leave_sheet_xpm ) );
|
2012-03-20 14:17:58 +00:00
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
}
|
2018-03-13 16:26:17 +00:00
|
|
|
|
2007-10-07 18:24:15 +00:00
|
|
|
return true;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2013-03-30 19:55:26 +00:00
|
|
|
bool is_new = item->IsNew();
|
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:
|
2011-10-19 20:32:21 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete No Connect" ),
|
|
|
|
KiBitmap( delete_xpm ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_JUNCTION_T:
|
2011-05-20 19:21:09 +00:00
|
|
|
addJunctionMenuEntries( PopMenu, (SCH_JUNCTION*) item );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2013-04-01 10:35:20 +00:00
|
|
|
case SCH_BUS_BUS_ENTRY_T:
|
|
|
|
case SCH_BUS_WIRE_ENTRY_T:
|
2015-03-13 16:48:42 +00:00
|
|
|
AddMenusForBusEntry( PopMenu, static_cast<SCH_BUS_ENTRY_BASE*>( item ) );
|
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:
|
2017-10-06 18:07:43 +00:00
|
|
|
AddMenusForComponent( PopMenu, (SCH_COMPONENT*) item, Prj().SchSymbolLibTable() );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2011-08-31 14:59:20 +00:00
|
|
|
case SCH_BITMAP_T:
|
|
|
|
AddMenusForBitmap( PopMenu, (SCH_BITMAP*) item );
|
|
|
|
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 )
|
2011-10-19 20:32:21 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_END_LINE, _( "End Drawing" ),
|
2014-02-07 19:32:08 +00:00
|
|
|
KiBitmap( checked_ok_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
|
2018-07-07 22:04:43 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, _( "Edit..." ),
|
|
|
|
KiBitmap( edit_xpm ) );
|
2011-10-19 20:32:21 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Drawing" ),
|
|
|
|
KiBitmap( 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
|
|
|
{
|
2012-12-08 17:24:49 +00:00
|
|
|
wxString msg, name;
|
|
|
|
|
2013-04-09 17:49:01 +00:00
|
|
|
if( !Field->GetFlags() )
|
2012-12-08 17:24:49 +00:00
|
|
|
{
|
2013-04-09 17:49:01 +00:00
|
|
|
switch( Field->GetId() )
|
|
|
|
{
|
2013-04-10 07:23:20 +00:00
|
|
|
case REFERENCE: name = _( "Move Reference" ); break;
|
|
|
|
case VALUE: name = _( "Move Value" ); break;
|
|
|
|
case FOOTPRINT: name = _( "Move Footprint Field" ); break;
|
|
|
|
default: name = _( "Move Field" ); break;
|
2013-04-09 17:49:01 +00:00
|
|
|
}
|
|
|
|
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( name, g_Schematic_Hokeys_Descr,
|
2013-04-09 17:49:01 +00:00
|
|
|
HK_MOVE_COMPONENT_OR_ITEM );
|
2017-06-02 09:51:11 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
|
2012-12-08 17:24:49 +00:00
|
|
|
}
|
2010-01-17 20:25:10 +00:00
|
|
|
|
2013-04-09 17:49:01 +00:00
|
|
|
switch( Field->GetId() )
|
2010-09-05 17:01:48 +00:00
|
|
|
{
|
2013-04-10 07:23:20 +00:00
|
|
|
case REFERENCE: name = _( "Rotate Reference" ); break;
|
|
|
|
case VALUE: name = _( "Rotate Value" ); break;
|
|
|
|
case FOOTPRINT: name = _( "Rotate Footprint Field" ); break;
|
|
|
|
default: name = _( "Rotate Field" ); break;
|
2010-01-17 20:25:10 +00:00
|
|
|
}
|
|
|
|
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( name, g_Schematic_Hokeys_Descr, HK_ROTATE );
|
2017-06-02 09:51:11 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
|
2012-12-08 17:24:49 +00:00
|
|
|
|
|
|
|
// Ref, value and footprint have specific hotkeys. Show the specific hotkey:
|
|
|
|
hotkey_id_commnand id;
|
|
|
|
switch( Field->GetId() )
|
|
|
|
{
|
2013-04-09 17:49:01 +00:00
|
|
|
case REFERENCE:
|
|
|
|
id = HK_EDIT_COMPONENT_REFERENCE;
|
2018-02-09 16:28:33 +00:00
|
|
|
name = _( "Edit Reference..." );
|
2013-04-09 17:49:01 +00:00
|
|
|
break;
|
|
|
|
case VALUE:
|
|
|
|
id = HK_EDIT_COMPONENT_VALUE;
|
2018-02-09 16:28:33 +00:00
|
|
|
name = _( "Edit Value..." );
|
2013-04-09 17:49:01 +00:00
|
|
|
break;
|
|
|
|
case FOOTPRINT:
|
|
|
|
id = HK_EDIT_COMPONENT_FOOTPRINT;
|
2018-02-09 16:28:33 +00:00
|
|
|
name = _( "Edit Footprint Field..." );
|
2013-04-09 17:49:01 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
id = HK_EDIT;
|
2018-02-09 16:28:33 +00:00
|
|
|
name = _( "Edit Field..." );
|
2013-04-09 17:49:01 +00:00
|
|
|
break;
|
2012-12-08 17:24:49 +00:00
|
|
|
}
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( name, g_Schematic_Hokeys_Descr, id );
|
2011-10-27 13:34:28 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2017-10-06 18:07:43 +00:00
|
|
|
void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, SYMBOL_LIB_TABLE* aLibs )
|
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;
|
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
|
|
|
{
|
2017-06-02 09:51:11 +00:00
|
|
|
msg.Printf( _( "Move %s" ),
|
2013-04-09 17:49:01 +00:00
|
|
|
GetChars( Component->GetField( REFERENCE )->GetText() ) );
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( msg, g_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT_OR_ITEM );
|
2011-10-28 20:30:50 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
|
2017-06-02 09:51:11 +00:00
|
|
|
msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
|
|
|
|
AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
wxMenu* orientmenu = new wxMenu;
|
2017-07-20 12:37:11 +00:00
|
|
|
msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
|
2014-08-23 15:43:26 +00:00
|
|
|
AddMenuItem( orientmenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
|
2017-07-20 12:37:11 +00:00
|
|
|
AddMenuItem( orientmenu, ID_SCH_ROTATE_COUNTERCLOCKWISE, _( "Rotate Counterclockwise" ),
|
2011-10-19 20:32:21 +00:00
|
|
|
KiBitmap( rotate_ccw_xpm ) );
|
2018-01-05 18:07:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Mirror Around Horizontal(X) Axis" ), g_Schematic_Hokeys_Descr,
|
|
|
|
HK_MIRROR_X );
|
2011-10-28 20:30:50 +00:00
|
|
|
AddMenuItem( orientmenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
|
2018-01-05 18:07:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Mirror Around Vertical(Y) Axis" ), g_Schematic_Hokeys_Descr,
|
|
|
|
HK_MIRROR_Y );
|
2011-10-28 20:30:50 +00:00
|
|
|
AddMenuItem( orientmenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
|
2017-10-06 18:07:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Reset to Default" ), g_Schematic_Hokeys_Descr,
|
|
|
|
HK_ORIENT_NORMAL_COMPONENT );
|
2011-10-28 20:30:50 +00:00
|
|
|
AddMenuItem( orientmenu, ID_SCH_ORIENT_NORMAL, msg, KiBitmap( normal_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( PopMenu, orientmenu, ID_POPUP_SCH_GENERIC_ORIENT_CMP,
|
2017-06-02 09:51:11 +00:00
|
|
|
_( "Orientation" ), KiBitmap( orient_xpm ) );
|
2007-08-20 01:20:48 +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
|
|
|
AddMenusForEditComponent( PopMenu, Component, aLibs );
|
2012-12-29 12:55:36 +00:00
|
|
|
|
|
|
|
if( !Component->GetFlags() )
|
|
|
|
{
|
2017-07-03 15:21:22 +00:00
|
|
|
msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr,
|
2017-07-03 15:37:18 +00:00
|
|
|
HK_DUPLICATE_ITEM );
|
2017-07-04 15:17:55 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
|
2017-06-02 09:51:11 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
|
2012-12-29 12:55:36 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CMP, msg, KiBitmap( delete_xpm ) );
|
|
|
|
}
|
|
|
|
|
2015-12-13 16:56:47 +00:00
|
|
|
msg = AddHotkeyName( _( "Autoplace Fields" ), g_Schematic_Hokeys_Descr, HK_AUTOPLACE_FIELDS );
|
|
|
|
AddMenuItem( PopMenu, ID_AUTOPLACE_FIELDS, msg, KiBitmap( autoplace_fields_xpm ) );
|
|
|
|
|
2017-10-24 07:47:23 +00:00
|
|
|
if( !Component->GetField( DATASHEET )->GetFullyQualifiedText().IsEmpty() )
|
2017-10-06 18:07:43 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_DISPLAYDOC_CMP, _( "Open Documentation" ),
|
|
|
|
KiBitmap( datasheet_xpm ) );
|
2012-12-29 12:55:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-10-06 18:07:43 +00:00
|
|
|
void AddMenusForEditComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, SYMBOL_LIB_TABLE* aLibs )
|
2012-12-29 12:55:36 +00:00
|
|
|
{
|
|
|
|
if( Component->Type() != SCH_COMPONENT_T )
|
|
|
|
{
|
|
|
|
wxASSERT( 0 );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
wxString msg;
|
|
|
|
LIB_PART* part = NULL;
|
2017-10-06 18:07:43 +00:00
|
|
|
LIB_ALIAS* alias = NULL;
|
2012-12-29 12:55:36 +00:00
|
|
|
|
2017-10-06 18:07:43 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
alias = aLibs->LoadSymbol( Component->GetLibId() );
|
|
|
|
}
|
|
|
|
catch( ... )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
if( alias )
|
|
|
|
part = alias->GetPart();
|
2012-12-29 12:55:36 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
wxMenu* editmenu = new wxMenu;
|
2018-02-09 16:28:33 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit Properties..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
|
2017-06-02 09:51:11 +00:00
|
|
|
AddMenuItem( editmenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( config_xpm ) );
|
2007-08-20 01:20:48 +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( part && part->IsNormal() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2018-02-09 16:28:33 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit Value..." ), g_Schematic_Hokeys_Descr,
|
2012-12-08 17:24:49 +00:00
|
|
|
HK_EDIT_COMPONENT_VALUE );
|
|
|
|
AddMenuItem( editmenu, ID_SCH_EDIT_COMPONENT_VALUE, msg,
|
|
|
|
KiBitmap( edit_comp_value_xpm ) );
|
|
|
|
|
2018-02-09 16:28:33 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit Reference..." ), g_Schematic_Hokeys_Descr,
|
2012-12-08 17:24:49 +00:00
|
|
|
HK_EDIT_COMPONENT_REFERENCE );
|
|
|
|
AddMenuItem( editmenu, ID_SCH_EDIT_COMPONENT_REFERENCE, msg,
|
2011-10-19 20:32:21 +00:00
|
|
|
KiBitmap( edit_comp_ref_xpm ) );
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2018-02-09 16:28:33 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit Footprint..." ), g_Schematic_Hokeys_Descr,
|
2008-03-21 11:16:18 +00:00
|
|
|
HK_EDIT_COMPONENT_FOOTPRINT );
|
2011-10-27 13:34:28 +00:00
|
|
|
AddMenuItem( editmenu, ID_SCH_EDIT_COMPONENT_FOOTPRINT, msg,
|
2011-10-19 20:32:21 +00:00
|
|
|
KiBitmap( edit_comp_footprint_xpm ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2008-12-12 21:30:07 +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( part && part->HasConversion() )
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( editmenu, ID_POPUP_SCH_EDIT_CONVERT_CMP, _( "Convert" ),
|
2011-09-08 05:58:45 +00:00
|
|
|
KiBitmap( component_select_alternate_shape_xpm ) );
|
2009-09-18 14:56:05 +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( part && part->GetUnitCount() >= 2 )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
wxMenu* sel_unit_menu = new wxMenu; int ii;
|
2011-09-01 12:54:34 +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
|
|
|
for( ii = 0; ii < part->GetUnitCount(); 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();
|
2015-04-07 11:52:29 +00:00
|
|
|
num_unit.Printf( _( "Unit %s" ), GetChars( LIB_PART::SubReference( ii + 1, false ) ) );
|
2011-01-18 10:42:49 +00:00
|
|
|
wxMenuItem * item = sel_unit_menu->Append( ID_POPUP_SCH_SELECT_UNIT1 + ii,
|
2011-09-01 12:54:34 +00:00
|
|
|
num_unit, wxEmptyString,
|
|
|
|
wxITEM_CHECK );
|
2011-01-18 10:42:49 +00:00
|
|
|
if( unit == ii + 1 )
|
|
|
|
item->Check(true);
|
2015-04-07 11:52:29 +00:00
|
|
|
|
|
|
|
// The ID max for these submenus is ID_POPUP_SCH_SELECT_UNIT_CMP_MAX
|
|
|
|
// See eeschema_id to modify this value.
|
|
|
|
if( ii >= (ID_POPUP_SCH_SELECT_UNIT_CMP_MAX - ID_POPUP_SCH_SELECT_UNIT1) )
|
|
|
|
break; // We have used all IDs for these submenus
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2009-09-18 14:56:05 +00:00
|
|
|
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( editmenu, sel_unit_menu, ID_POPUP_SCH_SELECT_UNIT_CMP,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "Unit" ), KiBitmap( component_select_unit_xpm ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2011-05-28 18:51:32 +00:00
|
|
|
if( !Component->GetFlags() )
|
|
|
|
{
|
2015-03-14 11:50:39 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit with Library Editor" ), g_Schematic_Hokeys_Descr,
|
|
|
|
HK_EDIT_COMPONENT_WITH_LIBEDIT );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( editmenu, ID_POPUP_SCH_CALL_LIBEDIT_AND_LOAD_CMP,
|
2015-03-14 11:50:39 +00:00
|
|
|
msg, KiBitmap( libedit_xpm ) );
|
2011-05-28 18:51:32 +00:00
|
|
|
}
|
|
|
|
|
2011-10-27 13:34:28 +00:00
|
|
|
AddMenuItem( PopMenu, editmenu, ID_SCH_EDIT_ITEM,
|
2017-06-02 09:51:11 +00:00
|
|
|
_( "Properties" ), KiBitmap( config_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
|
|
|
{
|
2017-06-02 09:51:11 +00:00
|
|
|
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
|
2010-06-24 18:31:43 +00:00
|
|
|
HK_MOVE_COMPONENT_OR_ITEM );
|
2017-06-02 09:51:11 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
|
|
|
|
msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr,
|
2010-07-17 11:14:57 +00:00
|
|
|
HK_DRAG );
|
2017-06-02 09:51:11 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
|
2017-07-03 15:21:22 +00:00
|
|
|
msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr,
|
2017-07-03 15:37:18 +00:00
|
|
|
HK_DUPLICATE_ITEM );
|
2017-07-04 15:17:55 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
|
2009-10-18 13:12:00 +00:00
|
|
|
}
|
2010-06-24 18:31:43 +00:00
|
|
|
|
2017-07-20 12:37:11 +00:00
|
|
|
msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
|
2017-06-02 09:51:11 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
|
2018-02-09 16:28:33 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
|
2011-10-27 13:34:28 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
|
2017-06-02 09:51:11 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
|
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
// add menu change type text (to label, glabel, text):
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "Change to Label" ), KiBitmap( glabel2label_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "Change to Text" ), KiBitmap( glabel2text_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "Change Type" ), KiBitmap( 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
|
|
|
{
|
2017-07-04 15:17:55 +00:00
|
|
|
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
|
2010-01-17 20:25:10 +00:00
|
|
|
HK_MOVE_COMPONENT_OR_ITEM );
|
2017-06-02 09:51:11 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
|
2017-07-04 15:17:55 +00:00
|
|
|
msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
|
2017-06-02 09:51:11 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
|
2017-07-04 15:17:55 +00:00
|
|
|
msg = AddHotkeyName( _( "Copy" ), g_Schematic_Hokeys_Descr,
|
2017-07-03 15:37:18 +00:00
|
|
|
HK_DUPLICATE_ITEM );
|
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( copy_xpm ) );
|
2009-10-18 13:12:00 +00:00
|
|
|
}
|
2011-09-01 12:54:34 +00:00
|
|
|
|
2017-07-20 12:37:11 +00:00
|
|
|
msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
|
2017-06-02 09:51:11 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
|
2018-02-09 16:28:33 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
|
2011-10-27 13:34:28 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
|
2017-07-04 15:17:55 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
|
2017-07-03 15:13:13 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
|
2008-02-12 21:12:46 +00:00
|
|
|
|
|
|
|
// add menu change type text (to label, glabel, text):
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "Change to Label" ), KiBitmap( glabel2label_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "Change to Text" ), KiBitmap( glabel2text_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "Change to Global Label" ), KiBitmap( label2glabel_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "Change Type" ), KiBitmap( 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
|
|
|
{
|
2017-07-04 15:17:55 +00:00
|
|
|
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
|
2010-01-17 20:25:10 +00:00
|
|
|
HK_MOVE_COMPONENT_OR_ITEM );
|
2017-06-02 09:51:11 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
|
2017-07-04 15:17:55 +00:00
|
|
|
msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
|
2017-06-02 09:51:11 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
|
2017-07-04 15:17:55 +00:00
|
|
|
msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr,
|
2017-07-03 15:37:18 +00:00
|
|
|
HK_DUPLICATE_ITEM );
|
2017-07-04 15:17:55 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
|
2009-10-18 13:12:00 +00:00
|
|
|
}
|
2011-09-01 12:54:34 +00:00
|
|
|
|
2017-07-20 12:37:11 +00:00
|
|
|
msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
|
2011-10-28 20:30:50 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
|
2018-02-09 16:28:33 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
|
2011-10-27 13:34:28 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
|
2017-07-04 15:17:55 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
|
2017-07-03 15:13:13 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
// add menu change type text (to label, glabel, text):
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "Change to Text" ), KiBitmap( label2text_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "Change to Global Label" ), KiBitmap( label2glabel_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "Change Type" ), KiBitmap( 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
|
|
|
{
|
2017-06-02 09:51:11 +00:00
|
|
|
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
|
2010-01-17 20:25:10 +00:00
|
|
|
HK_MOVE_COMPONENT_OR_ITEM );
|
2017-06-02 09:51:11 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
|
2017-07-03 15:21:22 +00:00
|
|
|
msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr,
|
2017-07-03 15:37:18 +00:00
|
|
|
HK_DUPLICATE_ITEM );
|
2017-07-04 15:17:55 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
|
2009-12-27 14:01:21 +00:00
|
|
|
}
|
2010-06-24 18:31:43 +00:00
|
|
|
|
2017-07-20 12:37:11 +00:00
|
|
|
msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
|
2011-10-28 20:30:50 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
|
2018-02-09 16:28:33 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
|
2011-10-27 13:34:28 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
|
2017-06-02 09:51:11 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
|
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_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
|
|
|
|
*/
|
2013-03-18 19:36:07 +00:00
|
|
|
if( Text->GetText().Find( wxT( "\n" ) ) == wxNOT_FOUND )
|
2009-05-12 13:23:05 +00:00
|
|
|
{
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "Change to Label" ), KiBitmap( label2text_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "Change to Global Label" ), KiBitmap( label2glabel_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "Change Type" ), KiBitmap( gl_change_xpm ) );
|
2009-05-12 13:23:05 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-05-20 19:21:09 +00:00
|
|
|
void SCH_EDIT_FRAME::addJunctionMenuEntries( wxMenu* aMenu, SCH_JUNCTION* aJunction )
|
2009-09-18 14:56:05 +00:00
|
|
|
{
|
2010-01-09 08:50:30 +00:00
|
|
|
wxString msg;
|
2011-05-20 19:21:09 +00:00
|
|
|
SCH_SCREEN* screen = GetScreen();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete Junction" ), g_Schematic_Hokeys_Descr, HK_DELETE );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( aMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
|
2011-05-20 19:21:09 +00:00
|
|
|
|
|
|
|
if( !aJunction->IsNew() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-05-20 19:21:09 +00:00
|
|
|
if( m_collectedItems.IsDraggableJunction() )
|
2017-06-02 09:51:11 +00:00
|
|
|
AddMenuItem( aMenu, ID_SCH_DRAG_ITEM, _( "Drag Junction" ), KiBitmap( drag_xpm ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-10-19 20:32:21 +00:00
|
|
|
if( screen->GetWire( aJunction->GetPosition(), EXCLUDE_END_POINTS_T ) )
|
|
|
|
AddMenuItem( aMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ),
|
|
|
|
KiBitmap( break_line_xpm ) );
|
2011-05-20 19:21:09 +00:00
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-10-19 20:32:21 +00:00
|
|
|
if( screen->GetWireOrBus( aJunction->GetPosition() ) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-10-19 20:32:21 +00:00
|
|
|
AddMenuItem( aMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ),
|
|
|
|
KiBitmap( delete_node_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( aMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
|
2011-09-08 05:58:45 +00:00
|
|
|
KiBitmap( 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-03-10 19:36:30 +00:00
|
|
|
SCH_SCREEN* screen = frame->GetScreen();
|
2013-08-03 05:15:23 +00:00
|
|
|
wxPoint pos = frame->GetCrossHairPosition();
|
|
|
|
wxString msg;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2012-10-23 16:37:19 +00:00
|
|
|
if( Wire == NULL )
|
|
|
|
{
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Begin Wire" ), g_Schematic_Hokeys_Descr, HK_BEGIN_WIRE );
|
2012-10-23 16:37:19 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_BEGIN_WIRE, msg, KiBitmap( add_line_xpm ) );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool is_new = Wire->IsNew();
|
2007-08-20 01:20:48 +00:00
|
|
|
if( is_new )
|
2009-08-28 07:11:56 +00:00
|
|
|
{
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Wire End" ), g_Schematic_Hokeys_Descr, HK_END_CURR_LINEWIREBUS );
|
2014-02-07 19:32:08 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_END_LINE, msg, KiBitmap( checked_ok_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
|
|
|
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Drag Wire" ), g_Schematic_Hokeys_Descr, HK_DRAG );
|
2017-06-02 09:51:11 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
|
2009-08-28 07:11:56 +00:00
|
|
|
PopMenu->AppendSeparator();
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete Wire" ), g_Schematic_Hokeys_Descr, HK_DELETE );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
|
2011-10-19 20:32:21 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ),
|
|
|
|
KiBitmap( delete_node_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
|
2011-09-08 05:58:45 +00:00
|
|
|
KiBitmap( delete_connection_xpm ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
SCH_LINE* line = screen->GetWireOrBus( frame->GetCrossHairPosition() );
|
2011-03-25 19:16:05 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
if( line && !line->IsEndPoint( frame->GetCrossHairPosition() ) )
|
2011-10-19 20:32:21 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ),
|
|
|
|
KiBitmap( break_line_xpm ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Add Junction" ), g_Schematic_Hokeys_Descr, HK_ADD_JUNCTION );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, KiBitmap( add_junction_xpm ) );
|
2018-02-09 16:28:33 +00:00
|
|
|
msg = AddHotkeyName( _( "Add Label..." ), g_Schematic_Hokeys_Descr, HK_ADD_LABEL );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, KiBitmap( 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.
|
2011-12-07 20:19:29 +00:00
|
|
|
if( Wire->IsEndPoint( pos ) )
|
2018-02-09 16:28:33 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label..." ),
|
2011-10-19 20:32:21 +00:00
|
|
|
KiBitmap( 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
|
|
|
{
|
2013-08-03 05:15:23 +00:00
|
|
|
wxPoint pos = frame->GetCrossHairPosition();
|
|
|
|
wxString msg;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2012-10-23 16:37:19 +00:00
|
|
|
if( Bus == NULL )
|
|
|
|
{
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Begin Bus" ), g_Schematic_Hokeys_Descr, HK_BEGIN_BUS );
|
2012-10-23 16:37:19 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_BEGIN_BUS, msg, KiBitmap( add_bus_xpm ) );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool is_new = Bus->IsNew();
|
2007-08-20 01:20:48 +00:00
|
|
|
if( is_new )
|
2009-08-28 07:11:56 +00:00
|
|
|
{
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Bus End" ), g_Schematic_Hokeys_Descr, HK_END_CURR_LINEWIREBUS );
|
2014-02-07 19:32:08 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_END_LINE, msg, KiBitmap( checked_ok_xpm ) );
|
2009-08-28 07:11:56 +00:00
|
|
|
return;
|
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete Bus" ), g_Schematic_Hokeys_Descr, HK_DELETE );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_bus_xpm ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Bus" ), KiBitmap( break_bus_xpm ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
PopMenu->AppendSeparator();
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Add Junction" ), g_Schematic_Hokeys_Descr, HK_ADD_JUNCTION );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, KiBitmap( add_junction_xpm ) );
|
2018-02-09 16:28:33 +00:00
|
|
|
msg = AddHotkeyName( _( "Add Label..." ), g_Schematic_Hokeys_Descr, HK_ADD_LABEL );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, KiBitmap( 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.
|
2011-12-07 20:19:29 +00:00
|
|
|
if( Bus->IsEndPoint( pos ) )
|
2018-02-09 16:28:33 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label..." ),
|
2011-10-19 20:32:21 +00:00
|
|
|
KiBitmap( 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
|
|
|
{
|
2011-10-19 20:32:21 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_ENTER_SHEET, _( "Enter Sheet" ),
|
|
|
|
KiBitmap( enter_sheet_xpm ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
PopMenu->AppendSeparator();
|
2017-07-04 15:17:55 +00:00
|
|
|
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
|
2010-06-24 18:31:43 +00:00
|
|
|
HK_MOVE_COMPONENT_OR_ITEM );
|
2017-06-02 09:51:11 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
|
2010-06-24 18:31:43 +00:00
|
|
|
|
2017-07-04 15:17:55 +00:00
|
|
|
msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
|
2017-06-02 09:51:11 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
|
2015-04-26 16:32:16 +00:00
|
|
|
|
2017-07-24 19:58:55 +00:00
|
|
|
PopMenu->AppendSeparator();
|
2018-01-05 18:07:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Select Items On PCB" ), g_Schematic_Hokeys_Descr,
|
|
|
|
HK_SELECT_ITEMS_ON_PCB );
|
2017-09-18 09:25:32 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_SELECT_ON_PCB, msg, KiBitmap( select_same_sheet_xpm ) );
|
2017-07-24 19:58:55 +00:00
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
|
2015-04-26 16:32:16 +00:00
|
|
|
wxMenu* orientmenu = new wxMenu;
|
2017-07-20 12:37:11 +00:00
|
|
|
msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
|
2015-04-26 16:32:16 +00:00
|
|
|
AddMenuItem( orientmenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
|
|
|
|
|
2017-07-20 12:37:11 +00:00
|
|
|
AddMenuItem( orientmenu, ID_SCH_ROTATE_COUNTERCLOCKWISE, _( "Rotate Counterclockwise" ),
|
2015-04-26 16:32:16 +00:00
|
|
|
KiBitmap( rotate_ccw_xpm ) );
|
|
|
|
|
2018-01-05 18:07:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Mirror Around Horizontal(X) Axis" ), g_Schematic_Hokeys_Descr,
|
|
|
|
HK_MIRROR_X );
|
2015-04-26 16:32:16 +00:00
|
|
|
AddMenuItem( orientmenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
|
2018-01-05 18:07:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Mirror Around Vertical(Y) Axis" ), g_Schematic_Hokeys_Descr,
|
|
|
|
HK_MIRROR_Y );
|
2015-04-26 16:32:16 +00:00
|
|
|
AddMenuItem( orientmenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
|
|
|
|
|
|
|
|
AddMenuItem( PopMenu, orientmenu, ID_POPUP_SCH_GENERIC_ORIENT_CMP,
|
2017-06-02 09:51:11 +00:00
|
|
|
_( "Orientation" ), KiBitmap( orient_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
|
|
|
{
|
2017-06-02 09:51:11 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_END_SHEET, _( "Place" ), KiBitmap( checked_ok_xpm ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-02-09 16:28:33 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
|
2017-06-02 09:51:11 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( editor_xpm ) );
|
2010-01-17 20:25:10 +00:00
|
|
|
|
2017-06-02 09:51:11 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_RESIZE_SHEET, _( "Resize" ),
|
2011-10-19 20:32:21 +00:00
|
|
|
KiBitmap( resize_sheet_xpm ) );
|
2009-05-16 05:38:38 +00:00
|
|
|
PopMenu->AppendSeparator();
|
2015-07-24 10:23:34 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_IMPORT_HLABEL_TO_SHEETPIN, _( "Import Sheet Pins" ),
|
2011-09-08 05:58:45 +00:00
|
|
|
KiBitmap( 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
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_CLEANUP_SHEET, _( "Cleanup Sheet Pins" ),
|
2011-09-08 05:58:45 +00:00
|
|
|
KiBitmap( options_pinsheet_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
|
2009-05-16 05:38:38 +00:00
|
|
|
PopMenu->AppendSeparator();
|
2017-06-02 09:51:11 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( 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
|
|
|
{
|
2017-07-04 15:17:55 +00:00
|
|
|
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
|
2010-06-24 18:31:43 +00:00
|
|
|
HK_MOVE_COMPONENT_OR_ITEM );
|
2011-10-28 20:30:50 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
|
2010-01-17 20:25:10 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2018-02-09 16:28:33 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, _( "Edit..." ), KiBitmap( edit_xpm ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-03-10 19:36:30 +00:00
|
|
|
if( !PinSheet->GetFlags() )
|
2017-07-04 15:17:55 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete" ),
|
|
|
|
KiBitmap( delete_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
|
|
|
|
2011-10-19 20:32:21 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel Block" ),
|
|
|
|
KiBitmap( cancel_xpm ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
|
2012-03-26 23:47:08 +00:00
|
|
|
if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_ZOOM_BLOCK, _( "Window Zoom" ), KiBitmap( zoom_area_xpm ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2014-02-07 19:32:08 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), KiBitmap( checked_ok_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.
|
2012-03-26 23:47:08 +00:00
|
|
|
if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
|
2009-09-18 14:56:05 +00:00
|
|
|
{
|
2017-07-03 15:58:07 +00:00
|
|
|
msg = AddHotkeyName( _( "Cut Block" ), g_Schematic_Hokeys_Descr,
|
2018-02-22 19:05:10 +00:00
|
|
|
HK_EDIT_CUT );
|
2017-12-23 19:44:16 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_CUT_BLOCK, msg, KiBitmap( cut_xpm ) );
|
2017-07-03 15:21:22 +00:00
|
|
|
msg = AddHotkeyName( _( "Copy Block" ), g_Schematic_Hokeys_Descr,
|
2018-02-22 19:05:10 +00:00
|
|
|
HK_EDIT_COPY );
|
2017-12-23 19:44:16 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_COPY_BLOCK, msg, KiBitmap( copy_xpm ) );
|
2017-08-29 19:16:56 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_DUPLICATE_BLOCK, _( "Duplicate Block" ),
|
|
|
|
KiBitmap( duplicate_xpm ) );
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Drag Block" ), g_Schematic_Hokeys_Descr,
|
2010-03-31 14:00:54 +00:00
|
|
|
HK_MOVEBLOCK_TO_DRAGBLOCK );
|
2017-06-02 09:51:11 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_DRAG_BLOCK, msg, KiBitmap( drag_xpm ) );
|
2017-08-29 19:16:56 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete Block" ), g_Schematic_Hokeys_Descr, HK_DELETE );
|
|
|
|
AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK, msg, KiBitmap( delete_xpm ) );
|
2018-01-05 18:07:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Mirror Block Around Vertical(Y) Axis" ), g_Schematic_Hokeys_Descr,
|
2015-04-26 16:32:16 +00:00
|
|
|
HK_MIRROR_Y );
|
2012-02-22 23:35:26 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
|
2018-01-05 18:07:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Mirror Block Around Horizontal(X) Axis" ),
|
|
|
|
g_Schematic_Hokeys_Descr, HK_MIRROR_X );
|
2012-02-22 23:35:26 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Rotate Block CCW" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
|
2013-01-21 20:16:04 +00:00
|
|
|
AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
|
2010-09-05 17:01:48 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
#if 0
|
2007-06-05 12:10:51 +00:00
|
|
|
#ifdef __WINDOWS__
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( menu_other_block_commands, ID_GEN_COPY_BLOCK_TO_CLIPBOARD,
|
2017-06-02 09:51:11 +00:00
|
|
|
_( "Copy to Clipboard" ), KiBitmap( copy_xpm ) );
|
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
|
|
|
{
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, _( "Delete Marker" ), KiBitmap( delete_xpm ) );
|
2011-10-19 20:32:21 +00:00
|
|
|
AddMenuItem( aPopMenu, ID_POPUP_SCH_GETINFO_MARKER, _( "Marker Error Info" ),
|
|
|
|
KiBitmap( info_xpm ) );
|
2009-07-08 15:42:45 +00:00
|
|
|
}
|
2011-08-31 14:59:20 +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
|
|
|
|
2011-08-31 14:59:20 +00:00
|
|
|
void AddMenusForBitmap( wxMenu* aPopMenu, SCH_BITMAP * aBitmap )
|
|
|
|
{
|
|
|
|
wxString msg;
|
2015-03-13 16:48:42 +00:00
|
|
|
|
2011-08-31 14:59:20 +00:00
|
|
|
if( aBitmap->GetFlags() == 0 )
|
|
|
|
{
|
2017-07-04 15:17:55 +00:00
|
|
|
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
|
2011-10-19 20:32:21 +00:00
|
|
|
HK_MOVE_COMPONENT_OR_ITEM );
|
2011-10-28 20:30:50 +00:00
|
|
|
AddMenuItem( aPopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
|
2011-08-31 14:59:20 +00:00
|
|
|
}
|
|
|
|
|
2017-07-20 12:37:11 +00:00
|
|
|
msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
|
2011-10-28 20:30:50 +00:00
|
|
|
AddMenuItem( aPopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
|
2018-01-05 18:07:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Mirror Around Horizontal(X) Axis" ), g_Schematic_Hokeys_Descr,
|
2015-04-26 16:32:16 +00:00
|
|
|
HK_MIRROR_X );
|
2013-01-21 20:16:04 +00:00
|
|
|
AddMenuItem( aPopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
|
2018-01-05 18:07:43 +00:00
|
|
|
msg = AddHotkeyName( _( "Mirror Around Vertical(Y) Axis" ), g_Schematic_Hokeys_Descr,
|
2015-04-26 16:32:16 +00:00
|
|
|
HK_MIRROR_Y );
|
2013-01-21 20:16:04 +00:00
|
|
|
AddMenuItem( aPopMenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
|
2018-02-09 16:28:33 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit Image..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
|
2013-01-21 20:16:04 +00:00
|
|
|
AddMenuItem( aPopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( image_xpm ) );
|
2011-08-31 14:59:20 +00:00
|
|
|
|
|
|
|
if( aBitmap->GetFlags() == 0 )
|
|
|
|
{
|
|
|
|
aPopMenu->AppendSeparator();
|
2017-07-04 15:17:55 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
|
2011-08-31 14:59:20 +00:00
|
|
|
}
|
|
|
|
}
|
2011-12-18 17:57:05 +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
|
|
|
|
2013-04-01 10:35:20 +00:00
|
|
|
void AddMenusForBusEntry( wxMenu* aPopMenu, SCH_BUS_ENTRY_BASE* aBusEntry )
|
2011-12-18 17:57:05 +00:00
|
|
|
{
|
|
|
|
wxString msg;
|
2015-03-13 16:48:42 +00:00
|
|
|
|
2011-12-18 17:57:05 +00:00
|
|
|
if( !aBusEntry->GetFlags() )
|
|
|
|
{
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Move Bus Entry" ), g_Schematic_Hokeys_Descr,
|
2011-12-18 17:57:05 +00:00
|
|
|
HK_MOVE_COMPONENT_OR_ITEM );
|
|
|
|
AddMenuItem( aPopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( aBusEntry->GetBusEntryShape() == '\\' )
|
|
|
|
AddMenuItem( aPopMenu, ID_POPUP_SCH_ENTRY_SELECT_SLASH,
|
|
|
|
_( "Set Bus Entry Shape /" ), KiBitmap( change_entry_orient_xpm ) );
|
|
|
|
else
|
|
|
|
AddMenuItem( aPopMenu, ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH,
|
|
|
|
_( "Set Bus Entry Shape \\" ), KiBitmap( change_entry_orient_xpm ) );
|
|
|
|
|
2014-10-15 11:40:38 +00:00
|
|
|
msg = AddHotkeyName( _( "Delete Bus Entry" ), g_Schematic_Hokeys_Descr, HK_DELETE );
|
2011-12-18 17:57:05 +00:00
|
|
|
AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
|
|
|
|
}
|