2018-04-15 12:07:33 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
|
|
|
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
|
|
|
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
|
2021-03-07 20:31:19 +00:00
|
|
|
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
2018-04-15 12:07:33 +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
|
|
|
|
*/
|
|
|
|
|
2021-03-07 20:31:19 +00:00
|
|
|
#include <bitmaps.h>
|
2019-06-10 22:17:45 +00:00
|
|
|
#include <tool/conditional_menu.h>
|
2018-04-15 12:07:33 +00:00
|
|
|
#include <eda_3d_viewer.h>
|
|
|
|
#include <menus_helpers.h>
|
|
|
|
#include <3d_viewer_id.h>
|
2020-03-18 22:48:36 +00:00
|
|
|
#include <3d_viewer/tools/3d_actions.h>
|
2019-06-10 22:17:45 +00:00
|
|
|
#include <tool/tool_manager.h>
|
|
|
|
#include <tool/common_control.h>
|
2020-06-06 17:42:04 +00:00
|
|
|
#include <widgets/wx_menubar.h>
|
2018-04-15 12:07:33 +00:00
|
|
|
|
|
|
|
|
2019-06-10 22:17:45 +00:00
|
|
|
void EDA_3D_VIEWER::CreateMenuBar()
|
|
|
|
{
|
|
|
|
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::CreateMenuBar" );
|
2018-04-26 18:58:49 +00:00
|
|
|
|
2020-06-06 17:42:04 +00:00
|
|
|
COMMON_CONTROL* tool = m_toolManager->GetTool<COMMON_CONTROL>();
|
|
|
|
WX_MENUBAR* menuBar = new WX_MENUBAR();
|
2018-04-26 18:58:49 +00:00
|
|
|
|
|
|
|
|
2019-06-10 22:17:45 +00:00
|
|
|
//-- File menu -----------------------------------------------------------
|
|
|
|
//
|
2020-07-27 22:42:23 +00:00
|
|
|
ACTION_MENU* fileMenu = new ACTION_MENU( false, tool );
|
2018-04-26 18:58:49 +00:00
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
fileMenu->Add( _( "Export Current View as PNG..." ),
|
|
|
|
"",
|
|
|
|
ID_MENU_SCREENCOPY_PNG,
|
2021-03-08 02:59:07 +00:00
|
|
|
BITMAPS::export_png );
|
2018-04-26 18:58:49 +00:00
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
fileMenu->Add( _( "Export Current View as JPEG..." ),
|
|
|
|
"",
|
|
|
|
ID_MENU_SCREENCOPY_JPEG,
|
2021-03-08 02:59:07 +00:00
|
|
|
BITMAPS::export_file );
|
2018-04-15 12:07:33 +00:00
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
fileMenu->AppendSeparator();
|
2019-08-13 23:34:05 +00:00
|
|
|
fileMenu->AddClose( _( "3D Viewer" ) );
|
2018-04-26 18:58:49 +00:00
|
|
|
|
2019-06-18 18:45:56 +00:00
|
|
|
|
2019-06-10 22:17:45 +00:00
|
|
|
//-- Edit menu -------------------------------------------------------
|
2019-09-24 07:41:05 +00:00
|
|
|
// Avoid to translate hotkey modifiers like Ctrl and Shift.
|
|
|
|
// The translated modifiers do not always work
|
2020-07-27 22:42:23 +00:00
|
|
|
ACTION_MENU* editMenu = new ACTION_MENU( false, tool );
|
2018-04-15 12:07:33 +00:00
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
editMenu->Add( _( "Copy 3D Image" ),
|
|
|
|
"",
|
|
|
|
ID_TOOL_SCREENCOPY_TOCLIBBOARD,
|
2021-03-08 02:59:07 +00:00
|
|
|
BITMAPS::copy );
|
2018-04-15 12:07:33 +00:00
|
|
|
|
2019-06-18 18:45:56 +00:00
|
|
|
|
2019-06-10 22:17:45 +00:00
|
|
|
//-- View menu -------------------------------------------------------
|
|
|
|
//
|
2020-07-27 22:42:23 +00:00
|
|
|
ACTION_MENU* viewMenu = new ACTION_MENU( false, tool );
|
2018-04-15 12:07:33 +00:00
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
viewMenu->Add( ACTIONS::zoomIn );
|
|
|
|
viewMenu->Add( ACTIONS::zoomOut );
|
|
|
|
viewMenu->Add( ACTIONS::zoomFitScreen );
|
|
|
|
viewMenu->Add( ACTIONS::zoomRedraw );
|
2018-04-15 12:07:33 +00:00
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
viewMenu->AppendSeparator();
|
|
|
|
viewMenu->Add( EDA_3D_ACTIONS::rotateXCW );
|
|
|
|
viewMenu->Add( EDA_3D_ACTIONS::rotateXCCW );
|
2018-04-15 12:07:33 +00:00
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
viewMenu->AppendSeparator();
|
|
|
|
viewMenu->Add( EDA_3D_ACTIONS::rotateYCW );
|
|
|
|
viewMenu->Add( EDA_3D_ACTIONS::rotateYCCW );
|
2018-04-15 12:07:33 +00:00
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
viewMenu->AppendSeparator();
|
|
|
|
viewMenu->Add( EDA_3D_ACTIONS::rotateZCW );
|
|
|
|
viewMenu->Add( EDA_3D_ACTIONS::rotateZCCW );
|
2018-04-15 12:07:33 +00:00
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
viewMenu->AppendSeparator();
|
|
|
|
viewMenu->Add( EDA_3D_ACTIONS::moveLeft );
|
|
|
|
viewMenu->Add( EDA_3D_ACTIONS::moveRight );
|
|
|
|
viewMenu->Add( EDA_3D_ACTIONS::moveUp );
|
|
|
|
viewMenu->Add( EDA_3D_ACTIONS::moveDown );
|
2019-06-10 22:17:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
//-- Preferences menu -----------------------------------------------
|
|
|
|
//
|
2020-07-27 22:42:23 +00:00
|
|
|
ACTION_MENU* prefsMenu = new ACTION_MENU( false, tool );
|
2019-06-10 22:17:45 +00:00
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
prefsMenu->Add( _( "Display Options" ), "",
|
|
|
|
ID_TOOL_SET_VISIBLE_ITEMS,
|
2021-03-08 02:59:07 +00:00
|
|
|
BITMAPS::config );
|
2019-12-30 13:01:06 +00:00
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
prefsMenu->Add( _( "Raytracing" ), "",
|
|
|
|
ID_RENDER_CURRENT_VIEW,
|
2021-03-08 02:59:07 +00:00
|
|
|
BITMAPS::tools,
|
2020-07-27 22:42:23 +00:00
|
|
|
ACTION_MENU::CHECK );
|
2019-06-10 22:17:45 +00:00
|
|
|
|
|
|
|
// Render options submenu
|
2020-07-27 22:42:23 +00:00
|
|
|
ACTION_MENU* optsSubmenu = new ACTION_MENU( false, tool );
|
2019-06-10 22:17:45 +00:00
|
|
|
optsSubmenu->SetTitle( _( "Render Options" ) );
|
2021-03-08 02:59:07 +00:00
|
|
|
optsSubmenu->SetIcon( BITMAPS::options_3drender );
|
2019-06-10 22:17:45 +00:00
|
|
|
|
|
|
|
// Material properties submenu
|
2020-07-27 22:42:23 +00:00
|
|
|
ACTION_MENU* propsSubmenu = new ACTION_MENU( false, tool );
|
2019-06-10 22:17:45 +00:00
|
|
|
propsSubmenu->SetTitle( _( "Material Properties" ) );
|
|
|
|
|
2020-07-27 23:16:21 +00:00
|
|
|
propsSubmenu->Add( EDA_3D_ACTIONS::materialNormal, ACTION_MENU::CHECK );
|
|
|
|
propsSubmenu->Add( EDA_3D_ACTIONS::materialDiffuse, ACTION_MENU::CHECK );
|
|
|
|
propsSubmenu->Add( EDA_3D_ACTIONS::materialCAD, ACTION_MENU::CHECK );
|
2019-06-10 22:17:45 +00:00
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
optsSubmenu->Add( propsSubmenu );
|
2019-06-10 22:17:45 +00:00
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
optsSubmenu->Add( EDA_3D_ACTIONS::showBoundingBoxes, ACTION_MENU::CHECK );
|
2019-06-10 22:17:45 +00:00
|
|
|
|
|
|
|
// Raytracing submenu
|
2020-07-27 22:42:23 +00:00
|
|
|
ACTION_MENU* raySubmenu = new ACTION_MENU( false, tool );
|
2019-06-10 22:17:45 +00:00
|
|
|
raySubmenu->SetTitle( _( "Raytracing Options" ) );
|
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
raySubmenu->Add( EDA_3D_ACTIONS::renderShadows, ACTION_MENU::CHECK );
|
|
|
|
raySubmenu->Add( EDA_3D_ACTIONS::proceduralTextures, ACTION_MENU::CHECK );
|
|
|
|
raySubmenu->Add( EDA_3D_ACTIONS::addFloor, ACTION_MENU::CHECK );
|
|
|
|
raySubmenu->Add( EDA_3D_ACTIONS::showRefractions, ACTION_MENU::CHECK );
|
|
|
|
raySubmenu->Add( EDA_3D_ACTIONS::showReflections, ACTION_MENU::CHECK );
|
|
|
|
raySubmenu->Add( EDA_3D_ACTIONS::antiAliasing, ACTION_MENU::CHECK );
|
|
|
|
raySubmenu->Add( EDA_3D_ACTIONS::postProcessing, ACTION_MENU::CHECK );
|
2019-06-10 22:17:45 +00:00
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
optsSubmenu->Add( raySubmenu );
|
|
|
|
prefsMenu->Add( optsSubmenu );
|
2019-06-10 22:17:45 +00:00
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
prefsMenu->AppendSeparator();
|
2019-06-10 22:17:45 +00:00
|
|
|
|
|
|
|
// Color submenu
|
2020-07-27 22:42:23 +00:00
|
|
|
ACTION_MENU* colorSubmenu = new ACTION_MENU( false, tool );
|
2019-06-10 22:17:45 +00:00
|
|
|
colorSubmenu->SetTitle( _( "Choose Colors" ) );
|
2021-03-08 02:59:07 +00:00
|
|
|
colorSubmenu->SetIcon( BITMAPS::color_materials );
|
2019-06-10 22:17:45 +00:00
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
colorSubmenu->Add( _( "Background Top Color..." ),
|
|
|
|
ID_MENU3D_BGCOLOR_TOP,
|
2021-03-08 02:59:07 +00:00
|
|
|
BITMAPS::INVALID_BITMAP );
|
2019-06-10 22:17:45 +00:00
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
colorSubmenu->Add( _( "Background Bottom Color..." ),
|
|
|
|
ID_MENU3D_BGCOLOR_BOTTOM,
|
2021-03-08 02:59:07 +00:00
|
|
|
BITMAPS::INVALID_BITMAP );
|
2019-06-10 22:17:45 +00:00
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
colorSubmenu->Add( _( "Silkscreen Color..." ),
|
|
|
|
ID_MENU3D_SILKSCREEN_COLOR,
|
2021-03-08 02:59:07 +00:00
|
|
|
BITMAPS::INVALID_BITMAP );
|
2019-06-10 22:17:45 +00:00
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
colorSubmenu->Add( _( "Solder Mask Color..." ),
|
|
|
|
ID_MENU3D_SOLDERMASK_COLOR,
|
2021-03-08 02:59:07 +00:00
|
|
|
BITMAPS::INVALID_BITMAP );
|
2019-06-10 22:17:45 +00:00
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
colorSubmenu->Add( _( "Solder Paste Color..." ),
|
|
|
|
ID_MENU3D_SOLDERPASTE_COLOR,
|
2021-03-08 02:59:07 +00:00
|
|
|
BITMAPS::INVALID_BITMAP );
|
2019-06-10 22:17:45 +00:00
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
colorSubmenu->Add( _( "Copper/Surface Finish Color..." ),
|
|
|
|
ID_MENU3D_COPPER_COLOR,
|
2021-03-08 02:59:07 +00:00
|
|
|
BITMAPS::INVALID_BITMAP );
|
2019-06-10 22:17:45 +00:00
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
colorSubmenu->Add( _( "Board Body Color..." ),
|
|
|
|
ID_MENU3D_PCB_BODY_COLOR,
|
2021-03-08 02:59:07 +00:00
|
|
|
BITMAPS::INVALID_BITMAP );
|
2019-06-10 22:17:45 +00:00
|
|
|
|
2020-01-22 22:48:20 +00:00
|
|
|
// Only allow the stackup to be used in the PCB editor, since it isn't editable in the other frames
|
|
|
|
if( Parent()->IsType( FRAME_PCB_EDITOR ) )
|
|
|
|
{
|
2020-07-27 22:42:23 +00:00
|
|
|
colorSubmenu->Add( _( "Get colors from physical stackup" ),
|
|
|
|
ID_MENU3D_STACKUP_COLORS,
|
2021-03-08 02:59:07 +00:00
|
|
|
BITMAPS::INVALID_BITMAP );
|
2020-01-22 22:48:20 +00:00
|
|
|
}
|
2020-01-22 22:38:30 +00:00
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
prefsMenu->Add( colorSubmenu );
|
2019-07-30 17:12:16 +00:00
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
prefsMenu->Add( EDA_3D_ACTIONS::showAxis, ACTION_MENU::CHECK );
|
2019-06-10 22:17:45 +00:00
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
// Grid submenu
|
|
|
|
ACTION_MENU* gridSubmenu = new ACTION_MENU( false, tool );
|
2019-06-10 22:17:45 +00:00
|
|
|
gridSubmenu->SetTitle( _( "3D Grid" ) );
|
2021-03-08 02:59:07 +00:00
|
|
|
gridSubmenu->SetIcon( BITMAPS::grid );
|
2019-06-10 22:17:45 +00:00
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
gridSubmenu->Add( EDA_3D_ACTIONS::noGrid, ACTION_MENU::CHECK);
|
|
|
|
gridSubmenu->Add( EDA_3D_ACTIONS::show10mmGrid, ACTION_MENU::CHECK);
|
|
|
|
gridSubmenu->Add( EDA_3D_ACTIONS::show5mmGrid, ACTION_MENU::CHECK);
|
|
|
|
gridSubmenu->Add( EDA_3D_ACTIONS::show2_5mmGrid, ACTION_MENU::CHECK);
|
|
|
|
gridSubmenu->Add( EDA_3D_ACTIONS::show1mmGrid, ACTION_MENU::CHECK);
|
2019-12-30 13:01:06 +00:00
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
prefsMenu->Add( gridSubmenu );
|
2019-12-30 13:01:06 +00:00
|
|
|
|
2020-07-27 22:42:23 +00:00
|
|
|
prefsMenu->AppendSeparator();
|
2021-03-08 02:59:07 +00:00
|
|
|
prefsMenu->Add( _( "Reset to Default Settings" ), ID_MENU3D_RESET_DEFAULTS, BITMAPS::tools );
|
2018-04-15 12:07:33 +00:00
|
|
|
|
2019-08-06 17:49:33 +00:00
|
|
|
#ifdef __APPLE__ // Note: will get moved to Apple menu by wxWidgets
|
2020-11-04 01:28:55 +00:00
|
|
|
prefsMenu->Add( _( "Preferences..." ) + "\tCtrl+,",
|
2020-07-27 22:42:23 +00:00
|
|
|
_( "Show preferences for all open tools" ),
|
|
|
|
wxID_PREFERENCES,
|
2021-03-08 02:59:07 +00:00
|
|
|
BITMAPS::preference );
|
2019-08-06 17:49:33 +00:00
|
|
|
#endif
|
|
|
|
|
2019-06-10 22:17:45 +00:00
|
|
|
//-- Menubar -------------------------------------------------------------
|
|
|
|
//
|
2020-07-27 22:42:23 +00:00
|
|
|
menuBar->Append( fileMenu, _( "&File" ) );
|
|
|
|
menuBar->Append( editMenu, _( "&Edit" ) );
|
|
|
|
menuBar->Append( viewMenu, _( "&View" ) );
|
2019-06-10 22:17:45 +00:00
|
|
|
menuBar->Append( prefsMenu, _( "&Preferences" ) );
|
2019-05-18 10:27:36 +00:00
|
|
|
AddStandardHelpMenu( menuBar );
|
2018-04-26 18:58:49 +00:00
|
|
|
|
2018-04-15 12:07:33 +00:00
|
|
|
SetMenuBar( menuBar );
|
|
|
|
}
|