2011-10-18 19:59:19 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2015-01-30 18:42:46 +00:00
|
|
|
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
|
|
|
* Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
2018-03-16 12:38:36 +00:00
|
|
|
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@gmail.com>
|
2020-06-29 11:01:43 +00:00
|
|
|
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
2012-06-08 09:56:42 +00:00
|
|
|
*
|
2011-10-18 19:59:19 +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
|
|
|
|
*/
|
|
|
|
|
2018-12-12 14:16:50 +00:00
|
|
|
#include "footprint_edit_frame.h"
|
2020-01-13 01:44:19 +00:00
|
|
|
#include "pcbnew_id.h"
|
2012-04-09 09:16:47 +00:00
|
|
|
#include <menus_helpers.h>
|
2019-05-14 19:21:10 +00:00
|
|
|
#include <tool/actions.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <tool/conditional_menu.h>
|
|
|
|
#include <tool/tool_manager.h>
|
2019-05-15 22:49:48 +00:00
|
|
|
#include <tools/pcb_actions.h>
|
2020-06-29 11:01:43 +00:00
|
|
|
#include <class_board.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <tools/selection_tool.h>
|
2020-06-06 17:42:04 +00:00
|
|
|
#include <widgets/wx_menubar.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
|
|
|
|
void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2019-05-14 19:21:10 +00:00
|
|
|
SELECTION_TOOL* selTool = m_toolManager->GetTool<SELECTION_TOOL>();
|
2018-04-07 13:13:38 +00:00
|
|
|
// wxWidgets handles the Mac Application menu behind the scenes, but that means
|
|
|
|
// we always have to start from scratch with a new wxMenuBar.
|
2020-06-06 17:42:04 +00:00
|
|
|
wxMenuBar* oldMenuBar = GetMenuBar();
|
|
|
|
WX_MENUBAR* menuBar = new WX_MENUBAR();
|
2010-12-17 20:34:29 +00:00
|
|
|
|
2019-05-31 00:15:57 +00:00
|
|
|
auto modifiedDocumentCondition = [this]( const SELECTION& sel ) {
|
2019-12-19 15:34:01 +00:00
|
|
|
return IsContentModified();
|
2019-05-28 13:51:47 +00:00
|
|
|
};
|
2019-08-23 09:56:28 +00:00
|
|
|
auto haveFootprintCondition = [this]( const SELECTION& aSelection ) {
|
2019-06-03 23:50:44 +00:00
|
|
|
return GetBoard()->GetFirstModule() != nullptr;
|
|
|
|
};
|
2019-08-23 09:56:28 +00:00
|
|
|
auto footprintTargettedCondition = [this]( const SELECTION& aSelection ) {
|
|
|
|
return !GetTargetFPID().GetLibItemName().empty();
|
2019-05-28 13:51:47 +00:00
|
|
|
};
|
2010-08-24 17:26:51 +00:00
|
|
|
|
2019-06-02 11:57:29 +00:00
|
|
|
//-- File menu ----------------------------------------------------------
|
2019-05-28 13:51:47 +00:00
|
|
|
//
|
|
|
|
CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, selTool );
|
2010-08-24 17:26:51 +00:00
|
|
|
|
2019-06-03 23:50:44 +00:00
|
|
|
fileMenu->AddItem( ACTIONS::newLibrary, SELECTION_CONDITIONS::ShowAlways );
|
|
|
|
fileMenu->AddItem( ACTIONS::addLibrary, SELECTION_CONDITIONS::ShowAlways );
|
2019-06-04 18:46:52 +00:00
|
|
|
fileMenu->AddItem( PCB_ACTIONS::newFootprint, SELECTION_CONDITIONS::ShowAlways );
|
2018-09-12 20:26:37 +00:00
|
|
|
#ifdef KICAD_SCRIPTING
|
2019-06-04 18:46:52 +00:00
|
|
|
fileMenu->AddItem( PCB_ACTIONS::createFootprint, SELECTION_CONDITIONS::ShowAlways );
|
2018-09-12 20:26:37 +00:00
|
|
|
#endif
|
2018-07-27 10:46:09 +00:00
|
|
|
|
2019-05-28 13:51:47 +00:00
|
|
|
fileMenu->AddSeparator();
|
2019-06-03 23:50:44 +00:00
|
|
|
if( IsCurrentFPFromBoard() )
|
|
|
|
fileMenu->AddItem( PCB_ACTIONS::saveToBoard, modifiedDocumentCondition );
|
|
|
|
else
|
|
|
|
fileMenu->AddItem( PCB_ACTIONS::saveToLibrary, modifiedDocumentCondition );
|
|
|
|
fileMenu->AddItem( ACTIONS::saveAs, footprintTargettedCondition );
|
|
|
|
fileMenu->AddItem( ACTIONS::revert, modifiedDocumentCondition );
|
2018-02-19 19:26:02 +00:00
|
|
|
|
2019-05-28 13:51:47 +00:00
|
|
|
fileMenu->AddSeparator();
|
2019-05-02 15:19:33 +00:00
|
|
|
|
2019-06-15 00:29:42 +00:00
|
|
|
ACTION_MENU* submenuImport = new ACTION_MENU( false );
|
2019-05-28 13:51:47 +00:00
|
|
|
submenuImport->SetTool( selTool );
|
|
|
|
submenuImport->SetTitle( _( "Import" ) );
|
|
|
|
submenuImport->SetIcon( import_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
|
2019-06-06 11:45:28 +00:00
|
|
|
submenuImport->Add( PCB_ACTIONS::importFootprint );
|
2019-06-14 18:50:46 +00:00
|
|
|
submenuImport->Add( _( "&Import Graphics..." ),
|
2019-05-28 13:51:47 +00:00
|
|
|
_( "Import 2D Drawing file to Footprint Editor on Drawings layer" ),
|
|
|
|
ID_GEN_IMPORT_GRAPHICS_FILE, import_vector_xpm );
|
2019-05-02 15:19:33 +00:00
|
|
|
|
2019-05-28 13:51:47 +00:00
|
|
|
fileMenu->AddMenu( submenuImport, SELECTION_CONDITIONS::ShowAlways );
|
2019-05-02 15:19:33 +00:00
|
|
|
|
2019-05-28 13:51:47 +00:00
|
|
|
CONDITIONAL_MENU* submenuExport = new CONDITIONAL_MENU( false, selTool );
|
|
|
|
submenuExport->SetTitle( _( "Export" ) );
|
|
|
|
submenuExport->SetIcon( export_xpm );
|
2014-07-09 13:02:56 +00:00
|
|
|
|
2019-06-13 15:28:24 +00:00
|
|
|
submenuExport->AddItem( PCB_ACTIONS::exportFootprint, haveFootprintCondition );
|
2019-06-06 11:45:28 +00:00
|
|
|
submenuExport->AddItem( ID_MODEDIT_SAVE_PNG, _( "Export View as &PNG..." ),
|
2019-05-28 13:51:47 +00:00
|
|
|
_( "Create a PNG file from the current view" ),
|
|
|
|
plot_xpm, SELECTION_CONDITIONS::ShowAlways );
|
2019-05-02 15:19:33 +00:00
|
|
|
|
2019-05-28 13:51:47 +00:00
|
|
|
fileMenu->AddMenu( submenuExport, SELECTION_CONDITIONS::ShowAlways );
|
2010-08-24 17:26:51 +00:00
|
|
|
|
2019-05-28 13:51:47 +00:00
|
|
|
fileMenu->AddSeparator();
|
2019-06-03 23:50:44 +00:00
|
|
|
fileMenu->AddItem( ACTIONS::print, haveFootprintCondition );
|
2010-08-24 17:26:51 +00:00
|
|
|
|
2019-05-28 13:51:47 +00:00
|
|
|
fileMenu->AddSeparator();
|
2019-08-13 23:34:05 +00:00
|
|
|
fileMenu->AddClose( _( "Footprint Editor" ) );
|
2018-02-19 19:26:02 +00:00
|
|
|
|
2019-06-02 11:57:29 +00:00
|
|
|
fileMenu->Resolve();
|
|
|
|
|
|
|
|
//-- Edit menu -------------------------------------------------------
|
2019-05-28 13:51:47 +00:00
|
|
|
//
|
2019-05-15 22:49:48 +00:00
|
|
|
CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool );
|
2010-08-24 17:26:51 +00:00
|
|
|
|
2019-05-15 22:49:48 +00:00
|
|
|
auto enableUndoCondition = [ this ] ( const SELECTION& sel ) {
|
|
|
|
return GetScreen() && GetScreen()->GetUndoCommandCount() > 0;
|
|
|
|
};
|
|
|
|
auto enableRedoCondition = [ this ] ( const SELECTION& sel ) {
|
|
|
|
return GetScreen() && GetScreen()->GetRedoCommandCount() > 0;
|
|
|
|
};
|
|
|
|
auto noActiveToolCondition = [ this ] ( const SELECTION& aSelection ) {
|
2019-06-24 15:27:05 +00:00
|
|
|
return ToolStackIsEmpty();
|
2019-05-15 22:49:48 +00:00
|
|
|
};
|
2010-08-24 17:26:51 +00:00
|
|
|
|
2019-06-03 23:50:44 +00:00
|
|
|
editMenu->AddItem( ACTIONS::undo, enableUndoCondition );
|
|
|
|
editMenu->AddItem( ACTIONS::redo, enableRedoCondition );
|
2010-08-24 17:26:51 +00:00
|
|
|
|
2019-05-15 22:49:48 +00:00
|
|
|
editMenu->AddSeparator();
|
2019-06-03 23:50:44 +00:00
|
|
|
editMenu->AddItem( ACTIONS::cut, SELECTION_CONDITIONS::NotEmpty );
|
|
|
|
editMenu->AddItem( ACTIONS::copy, SELECTION_CONDITIONS::NotEmpty );
|
|
|
|
editMenu->AddItem( ACTIONS::paste, noActiveToolCondition );
|
2019-07-30 21:44:03 +00:00
|
|
|
editMenu->AddItem( ACTIONS::doDelete, SELECTION_CONDITIONS::NotEmpty );
|
|
|
|
editMenu->AddItem( ACTIONS::duplicate, SELECTION_CONDITIONS::NotEmpty );
|
2018-07-27 10:46:09 +00:00
|
|
|
|
2019-06-03 23:50:44 +00:00
|
|
|
editMenu->AddSeparator();
|
|
|
|
editMenu->AddItem( PCB_ACTIONS::footprintProperties, haveFootprintCondition );
|
|
|
|
editMenu->AddItem( PCB_ACTIONS::defaultPadProperties, SELECTION_CONDITIONS::ShowAlways );
|
2010-08-24 17:26:51 +00:00
|
|
|
|
2020-06-17 12:46:50 +00:00
|
|
|
editMenu->AddSeparator();
|
|
|
|
editMenu->AddItem( PCB_ACTIONS::cleanupGraphics, haveFootprintCondition );
|
|
|
|
|
2019-06-02 11:57:29 +00:00
|
|
|
editMenu->Resolve();
|
|
|
|
|
|
|
|
//-- View menu -------------------------------------------------------
|
2019-05-28 13:51:47 +00:00
|
|
|
//
|
2019-05-14 19:21:10 +00:00
|
|
|
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
|
|
|
|
|
|
|
|
auto gridShownCondition = [ this ] ( const SELECTION& aSel ) {
|
|
|
|
return IsGridVisible();
|
|
|
|
};
|
|
|
|
auto polarCoordsCondition = [ this ] ( const SELECTION& aSel ) {
|
2019-05-17 11:52:38 +00:00
|
|
|
return GetShowPolarCoords();
|
2019-05-14 19:21:10 +00:00
|
|
|
};
|
2019-12-20 14:11:39 +00:00
|
|
|
auto imperialUnitsCondition = [this]( const SELECTION& aSel ) {
|
|
|
|
return GetUserUnits() == EDA_UNITS::INCHES;
|
2019-05-14 19:21:10 +00:00
|
|
|
};
|
2019-12-20 14:11:39 +00:00
|
|
|
auto metricUnitsCondition = [this]( const SELECTION& aSel ) {
|
|
|
|
return GetUserUnits() == EDA_UNITS::MILLIMETRES;
|
2019-05-14 19:21:10 +00:00
|
|
|
};
|
|
|
|
auto fullCrosshairCondition = [ this ] ( const SELECTION& aSel ) {
|
|
|
|
return GetGalDisplayOptions().m_fullscreenCursor;
|
|
|
|
};
|
|
|
|
auto sketchPadsCondition = [ this ] ( const SELECTION& aSel ) {
|
2019-11-07 14:23:09 +00:00
|
|
|
return !GetDisplayOptions().m_DisplayPadFill;
|
2019-05-14 19:21:10 +00:00
|
|
|
};
|
2020-05-26 22:21:38 +00:00
|
|
|
auto sketchGraphicsCondition = [ this ] ( const SELECTION& aSel ) {
|
|
|
|
return !GetDisplayOptions().m_DisplayGraphicsFill;
|
2019-05-14 19:21:10 +00:00
|
|
|
};
|
2020-06-29 11:01:43 +00:00
|
|
|
auto sketchTextCondition = [ this ] ( const SELECTION& aSel ) {
|
|
|
|
return !GetDisplayOptions().m_DisplayTextFill;
|
|
|
|
};
|
2019-05-15 22:49:48 +00:00
|
|
|
auto contrastModeCondition = [ this ] ( const SELECTION& aSel ) {
|
2019-11-07 14:23:09 +00:00
|
|
|
return !GetDisplayOptions().m_ContrastModeDisplay;
|
2019-05-15 22:49:48 +00:00
|
|
|
};
|
2019-05-14 19:21:10 +00:00
|
|
|
auto searchTreeShownCondition = [ this ] ( const SELECTION& aSel ) {
|
|
|
|
return IsSearchTreeShown();
|
|
|
|
};
|
|
|
|
|
2019-06-04 18:46:52 +00:00
|
|
|
viewMenu->AddItem( ACTIONS::showFootprintBrowser, SELECTION_CONDITIONS::ShowAlways );
|
2019-06-03 23:50:44 +00:00
|
|
|
viewMenu->AddItem( ACTIONS::show3DViewer, SELECTION_CONDITIONS::ShowAlways );
|
2010-08-24 17:26:51 +00:00
|
|
|
|
2019-05-14 19:21:10 +00:00
|
|
|
viewMenu->AddSeparator();
|
2019-05-17 11:52:38 +00:00
|
|
|
viewMenu->AddItem( ACTIONS::zoomInCenter, SELECTION_CONDITIONS::ShowAlways );
|
|
|
|
viewMenu->AddItem( ACTIONS::zoomOutCenter, SELECTION_CONDITIONS::ShowAlways );
|
|
|
|
viewMenu->AddItem( ACTIONS::zoomFitScreen, SELECTION_CONDITIONS::ShowAlways );
|
|
|
|
viewMenu->AddItem( ACTIONS::zoomTool, SELECTION_CONDITIONS::ShowAlways );
|
|
|
|
viewMenu->AddItem( ACTIONS::zoomRedraw, SELECTION_CONDITIONS::ShowAlways );
|
2010-08-24 17:26:51 +00:00
|
|
|
|
2019-05-17 11:52:38 +00:00
|
|
|
viewMenu->AddSeparator();
|
|
|
|
viewMenu->AddCheckItem( ACTIONS::toggleGrid, gridShownCondition );
|
|
|
|
viewMenu->AddItem( ACTIONS::gridProperties, SELECTION_CONDITIONS::ShowAlways );
|
|
|
|
viewMenu->AddCheckItem( PCB_ACTIONS::togglePolarCoords, polarCoordsCondition );
|
2018-02-19 19:26:02 +00:00
|
|
|
|
|
|
|
// Units submenu
|
2019-05-14 19:21:10 +00:00
|
|
|
CONDITIONAL_MENU* unitsSubMenu = new CONDITIONAL_MENU( false, selTool );
|
|
|
|
unitsSubMenu->SetTitle( _( "&Units" ) );
|
|
|
|
unitsSubMenu->SetIcon( unit_mm_xpm );
|
2019-05-17 11:52:38 +00:00
|
|
|
unitsSubMenu->AddCheckItem( ACTIONS::imperialUnits, imperialUnitsCondition );
|
|
|
|
unitsSubMenu->AddCheckItem( ACTIONS::metricUnits, metricUnitsCondition );
|
2019-05-14 19:21:10 +00:00
|
|
|
viewMenu->AddMenu( unitsSubMenu );
|
|
|
|
|
2019-05-17 11:52:38 +00:00
|
|
|
viewMenu->AddCheckItem( ACTIONS::toggleCursorStyle, fullCrosshairCondition );
|
2015-05-19 16:39:05 +00:00
|
|
|
|
2019-05-14 19:21:10 +00:00
|
|
|
viewMenu->AddSeparator();
|
|
|
|
// Drawing Mode Submenu
|
|
|
|
CONDITIONAL_MENU* drawingModeSubMenu = new CONDITIONAL_MENU( false, selTool );
|
|
|
|
drawingModeSubMenu->SetTitle( _( "&Drawing Mode" ) );
|
|
|
|
drawingModeSubMenu->SetIcon( add_zone_xpm );
|
2015-05-19 16:39:05 +00:00
|
|
|
|
2020-05-26 22:21:38 +00:00
|
|
|
drawingModeSubMenu->AddCheckItem( PCB_ACTIONS::padDisplayMode, sketchPadsCondition );
|
|
|
|
drawingModeSubMenu->AddCheckItem( PCB_ACTIONS::graphicsOutlines, sketchGraphicsCondition );
|
2020-06-29 11:01:43 +00:00
|
|
|
drawingModeSubMenu->AddCheckItem( PCB_ACTIONS::textOutlines, sketchTextCondition );
|
2019-05-14 19:21:10 +00:00
|
|
|
viewMenu->AddMenu( drawingModeSubMenu );
|
2015-05-19 16:39:05 +00:00
|
|
|
|
2018-02-21 16:29:24 +00:00
|
|
|
// Contrast Mode Submenu
|
2019-05-15 22:49:48 +00:00
|
|
|
CONDITIONAL_MENU* contrastModeSubMenu = new CONDITIONAL_MENU( false, selTool );
|
2019-05-14 19:21:10 +00:00
|
|
|
contrastModeSubMenu->SetTitle( _( "&Contrast Mode" ) );
|
|
|
|
contrastModeSubMenu->SetIcon( contrast_mode_xpm );
|
2019-05-15 22:49:48 +00:00
|
|
|
|
2019-06-02 18:58:09 +00:00
|
|
|
contrastModeSubMenu->AddCheckItem( ACTIONS::highContrastMode, contrastModeCondition );
|
|
|
|
contrastModeSubMenu->AddItem( PCB_ACTIONS::layerAlphaDec, SELECTION_CONDITIONS::ShowAlways );
|
|
|
|
contrastModeSubMenu->AddItem( PCB_ACTIONS::layerAlphaInc, SELECTION_CONDITIONS::ShowAlways );
|
2019-05-14 19:21:10 +00:00
|
|
|
viewMenu->AddMenu( contrastModeSubMenu );
|
2018-02-21 16:29:24 +00:00
|
|
|
|
2019-05-17 11:52:38 +00:00
|
|
|
viewMenu->AddSeparator();
|
2019-06-06 11:45:28 +00:00
|
|
|
viewMenu->AddCheckItem( PCB_ACTIONS::toggleFootprintTree, searchTreeShownCondition );
|
2018-02-19 19:26:02 +00:00
|
|
|
|
2019-06-02 11:57:29 +00:00
|
|
|
viewMenu->Resolve();
|
|
|
|
|
|
|
|
//-- Place menu -------------------------------------------------------
|
2019-05-28 13:51:47 +00:00
|
|
|
//
|
2019-05-15 22:49:48 +00:00
|
|
|
CONDITIONAL_MENU* placeMenu = new CONDITIONAL_MENU( false, selTool );
|
2010-08-24 17:26:51 +00:00
|
|
|
|
2019-06-03 23:50:44 +00:00
|
|
|
placeMenu->AddItem( PCB_ACTIONS::placePad, haveFootprintCondition );
|
2010-08-24 17:26:51 +00:00
|
|
|
|
2019-07-30 13:55:30 +00:00
|
|
|
placeMenu->AddSeparator();
|
2020-07-01 12:28:10 +00:00
|
|
|
placeMenu->AddItem( PCB_ACTIONS::placeText, haveFootprintCondition );
|
|
|
|
placeMenu->AddItem( PCB_ACTIONS::drawArc, haveFootprintCondition );
|
|
|
|
placeMenu->AddItem( PCB_ACTIONS::drawRectangle, haveFootprintCondition );
|
|
|
|
placeMenu->AddItem( PCB_ACTIONS::drawCircle, haveFootprintCondition );
|
|
|
|
placeMenu->AddItem( PCB_ACTIONS::drawLine, haveFootprintCondition );
|
|
|
|
placeMenu->AddItem( PCB_ACTIONS::drawPolygon, haveFootprintCondition );
|
2019-12-19 15:34:01 +00:00
|
|
|
placeMenu->AddItem( PCB_ACTIONS::drawZoneKeepout, haveFootprintCondition );
|
2010-08-24 17:26:51 +00:00
|
|
|
|
2019-07-30 13:55:30 +00:00
|
|
|
placeMenu->AddSeparator();
|
2020-07-01 12:28:10 +00:00
|
|
|
placeMenu->AddItem( PCB_ACTIONS::setAnchor, haveFootprintCondition );
|
|
|
|
placeMenu->AddItem( ACTIONS::gridSetOrigin, haveFootprintCondition );
|
2018-02-19 19:26:02 +00:00
|
|
|
|
2019-06-02 11:57:29 +00:00
|
|
|
placeMenu->Resolve();
|
2018-02-19 19:26:02 +00:00
|
|
|
|
2019-06-03 23:50:44 +00:00
|
|
|
//-- Inspect menu ------------------------------------------------------
|
2019-05-28 13:51:47 +00:00
|
|
|
//
|
2019-06-03 20:06:58 +00:00
|
|
|
CONDITIONAL_MENU* inspectMenu = new CONDITIONAL_MENU( false, selTool );
|
2018-02-19 19:26:02 +00:00
|
|
|
|
2019-06-03 23:50:44 +00:00
|
|
|
inspectMenu->AddItem( ACTIONS::measureTool, haveFootprintCondition );
|
2019-06-03 20:06:58 +00:00
|
|
|
inspectMenu->Resolve();
|
2018-02-19 19:26:02 +00:00
|
|
|
|
2019-06-03 23:50:44 +00:00
|
|
|
//-- Tools menu --------------------------------------------------------
|
2019-05-28 13:51:47 +00:00
|
|
|
//
|
2018-02-19 19:26:02 +00:00
|
|
|
wxMenu* toolsMenu = new wxMenu;
|
|
|
|
|
2018-07-27 10:46:09 +00:00
|
|
|
AddMenuItem( toolsMenu, ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
|
|
|
|
_( "&Load Footprint from PCB..." ),
|
|
|
|
_( "Load a footprint from the current board into the editor" ),
|
|
|
|
KiBitmap( load_module_board_xpm ) );
|
|
|
|
|
2019-04-15 21:09:14 +00:00
|
|
|
AddMenuItem( toolsMenu, ID_ADD_FOOTPRINT_TO_BOARD,
|
2018-02-19 19:26:02 +00:00
|
|
|
_( "&Insert Footprint on PCB" ),
|
|
|
|
_( "Insert footprint onto current board" ),
|
|
|
|
KiBitmap( insert_module_board_xpm ) );
|
|
|
|
|
2015-01-30 18:42:46 +00:00
|
|
|
|
2019-06-02 11:57:29 +00:00
|
|
|
//-- Preferences menu -------------------------------------------------
|
2019-05-28 13:51:47 +00:00
|
|
|
//
|
|
|
|
CONDITIONAL_MENU* prefsMenu = new CONDITIONAL_MENU( false, selTool );
|
2015-03-29 21:22:53 +00:00
|
|
|
|
2019-05-28 13:51:47 +00:00
|
|
|
auto acceleratedGraphicsCondition = [ this ] ( const SELECTION& aSel ) {
|
2019-06-13 17:28:55 +00:00
|
|
|
return GetCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
|
2019-05-28 13:51:47 +00:00
|
|
|
};
|
|
|
|
auto standardGraphicsCondition = [ this ] ( const SELECTION& aSel ) {
|
2019-06-13 17:28:55 +00:00
|
|
|
return GetCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
|
2019-05-28 13:51:47 +00:00
|
|
|
};
|
2015-01-30 18:42:46 +00:00
|
|
|
|
2019-06-03 23:50:44 +00:00
|
|
|
prefsMenu->AddItem( ACTIONS::configurePaths, SELECTION_CONDITIONS::ShowAlways );
|
|
|
|
prefsMenu->AddItem( ACTIONS::showFootprintLibTable, SELECTION_CONDITIONS::ShowAlways );
|
2019-05-28 13:51:47 +00:00
|
|
|
prefsMenu->AddItem( wxID_PREFERENCES,
|
2019-06-09 21:57:23 +00:00
|
|
|
_( "Preferences...\tCTRL+," ),
|
2019-05-28 13:51:47 +00:00
|
|
|
_( "Show preferences for all open tools" ),
|
2019-06-03 23:50:44 +00:00
|
|
|
preference_xpm, SELECTION_CONDITIONS::ShowAlways );
|
2018-02-19 19:26:02 +00:00
|
|
|
|
2019-05-28 13:51:47 +00:00
|
|
|
prefsMenu->AddSeparator();
|
2019-06-16 18:35:32 +00:00
|
|
|
AddMenuLanguageList( prefsMenu, selTool );
|
2017-03-13 15:18:30 +00:00
|
|
|
|
2019-05-28 13:51:47 +00:00
|
|
|
prefsMenu->AddSeparator();
|
2019-06-03 23:50:44 +00:00
|
|
|
prefsMenu->AddCheckItem( ACTIONS::acceleratedGraphics, acceleratedGraphicsCondition );
|
|
|
|
prefsMenu->AddCheckItem( ACTIONS::standardGraphics, standardGraphicsCondition );
|
2015-01-30 18:42:46 +00:00
|
|
|
|
2019-06-02 11:57:29 +00:00
|
|
|
prefsMenu->Resolve();
|
|
|
|
|
2019-05-28 13:51:47 +00:00
|
|
|
//--MenuBar -----------------------------------------------------------
|
|
|
|
//
|
2011-10-18 17:28:49 +00:00
|
|
|
menuBar->Append( fileMenu, _( "&File" ) );
|
|
|
|
menuBar->Append( editMenu, _( "&Edit" ) );
|
|
|
|
menuBar->Append( viewMenu, _( "&View" ) );
|
2010-08-24 17:26:51 +00:00
|
|
|
menuBar->Append( placeMenu, _( "&Place" ) );
|
2018-02-19 19:26:02 +00:00
|
|
|
menuBar->Append( inspectMenu, _( "&Inspect" ) );
|
|
|
|
menuBar->Append( toolsMenu, _( "&Tools" ) );
|
2019-05-28 13:51:47 +00:00
|
|
|
menuBar->Append( prefsMenu, _( "P&references" ) );
|
2019-05-18 10:27:36 +00:00
|
|
|
AddStandardHelpMenu( menuBar );
|
2020-07-11 16:37:05 +00:00
|
|
|
menuBar->SetDoubleBuffered( true );
|
2010-08-24 17:26:51 +00:00
|
|
|
|
2018-04-07 13:13:38 +00:00
|
|
|
SetMenuBar( menuBar );
|
|
|
|
delete oldMenuBar;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|