3D viewer: fixes about hotkeys and menubar.

Move code to specific files 3d_menubar.cpp and hotkeys.cpp like in other tools.
This commit is contained in:
jean-pierre charras 2018-04-15 14:07:33 +02:00
parent 3e64c9de38
commit 8fcdc4f6c3
7 changed files with 582 additions and 484 deletions

View File

@ -701,7 +701,7 @@ void EDA_3D_CANVAS::OnPopUpMenu( wxCommandEvent &event )
break;
case ID_POPUP_VIEW_XPOS:
key = 'x';
key = GR_KB_SHIFT + 'X';
break;
case ID_POPUP_VIEW_XNEG:
@ -709,7 +709,7 @@ void EDA_3D_CANVAS::OnPopUpMenu( wxCommandEvent &event )
break;
case ID_POPUP_VIEW_YPOS:
key = 'y';
key = GR_KB_SHIFT + 'Y';
break;
case ID_POPUP_VIEW_YNEG:
@ -717,7 +717,7 @@ void EDA_3D_CANVAS::OnPopUpMenu( wxCommandEvent &event )
break;
case ID_POPUP_VIEW_ZPOS:
key = 'z';
key = GR_KB_SHIFT + 'Z';
break;
case ID_POPUP_VIEW_ZNEG:
@ -758,12 +758,27 @@ void EDA_3D_CANVAS::OnCharHook( wxKeyEvent &event )
void EDA_3D_CANVAS::OnKeyEvent( wxKeyEvent& event )
{
//wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::OnKeyEvent" ) );
int localkey = event.GetKeyCode();
// Use only upper char values in comparisons
// (the Shift modifier is a separate attribute)
if( (localkey >= 'a') && (localkey <= 'z') )
localkey += 'A' - 'a';
if( m_camera_is_moving )
return;
SetView3D( event.GetKeyCode() );
event.Skip();
if( event.ShiftDown() )
localkey |= GR_KB_SHIFT;
if( event.ControlDown() )
localkey |= GR_KB_CTRL;
if( event.AltDown() )
localkey |= GR_KB_ALT;
if( !SetView3D( localkey ) )
event.Skip();
}
@ -875,54 +890,55 @@ void EDA_3D_CANVAS::move_pivot_based_on_cur_mouse_position()
}
void EDA_3D_CANVAS::SetView3D( int keycode )
bool EDA_3D_CANVAS::SetView3D( int aKeycode )
{
if( m_camera_is_moving )
return;
return false;
const float delta_move = m_delta_move_step_factor * m_settings.CameraGet().ZoomGet();
const float arrow_moving_time_speed = 8.0f;
bool handled = false;
switch( keycode )
switch( aKeycode )
{
case WXK_SPACE:
move_pivot_based_on_cur_mouse_position();
return;
return true;
case WXK_LEFT:
m_settings.CameraGet().SetInterpolateMode( INTERPOLATION_LINEAR );
m_settings.CameraGet().SetT0_and_T1_current_T();
m_settings.CameraGet().Pan_T1( SFVEC3F( -delta_move, 0.0f, 0.0f ) );
request_start_moving_camera( arrow_moving_time_speed, false );
return;
return true;
case WXK_RIGHT:
m_settings.CameraGet().SetInterpolateMode( INTERPOLATION_LINEAR );
m_settings.CameraGet().SetT0_and_T1_current_T();
m_settings.CameraGet().Pan_T1( SFVEC3F( +delta_move, 0.0f, 0.0f ) );
request_start_moving_camera( arrow_moving_time_speed, false );
return;
return true;
case WXK_UP:
m_settings.CameraGet().SetInterpolateMode( INTERPOLATION_LINEAR );
m_settings.CameraGet().SetT0_and_T1_current_T();
m_settings.CameraGet().Pan_T1( SFVEC3F( 0.0f, +delta_move, 0.0f ) );
request_start_moving_camera( arrow_moving_time_speed, false );
return;
return true;
case WXK_DOWN:
m_settings.CameraGet().SetInterpolateMode( INTERPOLATION_LINEAR );
m_settings.CameraGet().SetT0_and_T1_current_T();
m_settings.CameraGet().Pan_T1( SFVEC3F( 0.0f, -delta_move, 0.0f ) );
request_start_moving_camera( arrow_moving_time_speed, false );
return;
return true;
case WXK_HOME:
m_settings.CameraGet().SetInterpolateMode( INTERPOLATION_BEZIER );
m_settings.CameraGet().SetT0_and_T1_current_T();
m_settings.CameraGet().Reset_T1();
request_start_moving_camera( glm::min( glm::max( m_settings.CameraGet().ZoomGet(), 0.5f ), 1.125f ) );
return;
return true;
case WXK_END:
break;
@ -932,25 +948,28 @@ void EDA_3D_CANVAS::SetView3D( int keycode )
m_settings.CameraGet().SetT0_and_T1_current_T();
m_settings.CameraGet().RotateZ_T1( glm::radians( 45.0f ) );
request_start_moving_camera();
handled = true;
break;
case WXK_F1:
m_settings.CameraGet().SetInterpolateMode( INTERPOLATION_BEZIER );
m_settings.CameraGet().SetT0_and_T1_current_T();
if( m_settings.CameraGet().Zoom_T1( 1.4f ) )
request_start_moving_camera( 3.0f );
return;
return true;
case WXK_F2:
m_settings.CameraGet().SetInterpolateMode( INTERPOLATION_BEZIER );
m_settings.CameraGet().SetT0_and_T1_current_T();
if( m_settings.CameraGet().Zoom_T1( 1/1.4f ) )
request_start_moving_camera( 3.0f );
return;
return true;
case '+':
break;
case '-':
break;
@ -959,6 +978,7 @@ void EDA_3D_CANVAS::SetView3D( int keycode )
m_settings.SetFlag( FL_MODULE_ATTRIBUTES_NORMAL,
!m_settings.GetFlag( FL_MODULE_ATTRIBUTES_NORMAL ) );
ReloadRequest();
handled = true;
break;
case 's':
@ -966,6 +986,7 @@ void EDA_3D_CANVAS::SetView3D( int keycode )
m_settings.SetFlag( FL_MODULE_ATTRIBUTES_NORMAL_INSERT,
!m_settings.GetFlag( FL_MODULE_ATTRIBUTES_NORMAL_INSERT ) );
ReloadRequest();
handled = true;
break;
case 'v':
@ -973,6 +994,7 @@ void EDA_3D_CANVAS::SetView3D( int keycode )
m_settings.SetFlag( FL_MODULE_ATTRIBUTES_VIRTUAL,
!m_settings.GetFlag( FL_MODULE_ATTRIBUTES_VIRTUAL ) );
ReloadRequest();
handled = true;
break;
case 'r':
@ -981,16 +1003,16 @@ void EDA_3D_CANVAS::SetView3D( int keycode )
m_settings.CameraGet().SetT0_and_T1_current_T();
m_settings.CameraGet().Reset_T1();
request_start_moving_camera( glm::min( glm::max( m_settings.CameraGet().ZoomGet(), 0.5f ), 1.125f ) );
return;
return true;
case 'x':
case GR_KB_SHIFT + 'X':
m_settings.CameraGet().SetInterpolateMode( INTERPOLATION_BEZIER );
m_settings.CameraGet().SetT0_and_T1_current_T();
m_settings.CameraGet().Reset_T1();
m_settings.CameraGet().RotateZ_T1( glm::radians( -90.0f ) );
m_settings.CameraGet().RotateX_T1( glm::radians( -90.0f ) );
request_start_moving_camera();
return;
return true;
case 'X':
m_settings.CameraGet().SetInterpolateMode( INTERPOLATION_BEZIER );
@ -999,15 +1021,15 @@ void EDA_3D_CANVAS::SetView3D( int keycode )
m_settings.CameraGet().RotateZ_T1( glm::radians( 90.0f ) );
m_settings.CameraGet().RotateX_T1( glm::radians( -90.0f ) );
request_start_moving_camera();
return;
return true;
case 'y':
case GR_KB_SHIFT + 'Y':
m_settings.CameraGet().SetInterpolateMode( INTERPOLATION_BEZIER );
m_settings.CameraGet().SetT0_and_T1_current_T();
m_settings.CameraGet().Reset_T1();
m_settings.CameraGet().RotateX_T1( glm::radians( -90.0f ) );
request_start_moving_camera();
return;
return true;
case 'Y':
m_settings.CameraGet().SetInterpolateMode( INTERPOLATION_BEZIER );
@ -1016,15 +1038,15 @@ void EDA_3D_CANVAS::SetView3D( int keycode )
m_settings.CameraGet().RotateX_T1( glm::radians( -90.0f ) );
m_settings.CameraGet().RotateZ_T1( glm::radians( -180.0f ) );
request_start_moving_camera();
return;
return true;
case 'z':
case GR_KB_SHIFT + 'Z':
m_settings.CameraGet().SetInterpolateMode( INTERPOLATION_BEZIER );
m_settings.CameraGet().SetT0_and_T1_current_T();
m_settings.CameraGet().Reset_T1();
request_start_moving_camera(
glm::min( glm::max( m_settings.CameraGet().ZoomGet(), 0.5f ), 1.125f ) );
return;
return true;
case 'Z':
m_settings.CameraGet().SetInterpolateMode( INTERPOLATION_BEZIER );
@ -1033,10 +1055,10 @@ void EDA_3D_CANVAS::SetView3D( int keycode )
m_settings.CameraGet().RotateX_T1( glm::radians( -180.0f ) );
request_start_moving_camera(
glm::min( glm::max( m_settings.CameraGet().ZoomGet(), 0.5f ), 1.125f ) );
return;
return true;
default:
return;
return false;
}
m_mouse_was_moved = true;
@ -1045,6 +1067,8 @@ void EDA_3D_CANVAS::SetView3D( int keycode )
DisplayStatus();
Request_refresh();
return handled;
}

View File

@ -100,9 +100,11 @@ class EDA_3D_CANVAS : public HIDPI_GL_CANVAS
/**
* @brief SetView3D - Helper function to call view commands
* @param keycode: ascii key commands
* @param aKeycode: ascii key commands
* @return true if the key code was handled,
* false if no command found for this code.
*/
void SetView3D( int keycode );
bool SetView3D( int aKeycode );
/**
* @brief RenderEngineChanged - Notify that the render engine was changed

View File

@ -0,0 +1,424 @@
/*
* 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>
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
*
* 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
*/
/**
* @file 3d_menubar.cpp
*/
#include <fctsys.h>
#include <eda_3d_viewer.h>
#include <3d_canvas/cinfo3d_visu.h>
#include <menus_helpers.h>
#include <3d_viewer_id.h>
extern struct EDA_HOTKEY_CONFIG g_3DViewer_Hokeys_Descr[];
void EDA_3D_VIEWER::CreateMenuBar()
{
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::CreateMenuBar" ) );
wxMenuBar* menuBar = new wxMenuBar;
wxMenu* fileMenu = new wxMenu;
wxMenu* editMenu = new wxMenu;
wxMenu* prefsMenu = new wxMenu;
wxMenu* helpMenu = new wxMenu;
menuBar->Append( fileMenu, _( "&File" ) );
AddMenuItem( fileMenu, ID_MENU_SCREENCOPY_PNG,
_( "Export Current View as PNG..." ),
KiBitmap( export_xpm ) );
AddMenuItem( fileMenu, ID_MENU_SCREENCOPY_JPEG,
_( "Export Current View as JPEG..." ),
KiBitmap( export_xpm ) );
fileMenu->AppendSeparator();
AddMenuItem( fileMenu, wxID_EXIT,
_( "&Exit" ),
KiBitmap( exit_xpm ) );
menuBar->Append( editMenu, _( "&Edit" ) );
AddMenuItem( editMenu, ID_TOOL_SCREENCOPY_TOCLIBBOARD,
_( "Copy 3D Image" ),
KiBitmap( copy_xpm ) );
menuBar->Append( prefsMenu, _( "&Preferences" ) );
AddMenuItem( prefsMenu, ID_MENU3D_MOUSEWHEEL_PANNING,
_( "Use Touchpad to Pan" ),
KiBitmap( tools_xpm ), wxITEM_CHECK );
prefsMenu->AppendSeparator();
AddMenuItem( prefsMenu, ID_MENU3D_REALISTIC_MODE,
_( "Realistic Mode" ),
KiBitmap( use_3D_copper_thickness_xpm ), wxITEM_CHECK );
wxMenu * renderEngineList = new wxMenu;
AddMenuItem( prefsMenu, renderEngineList, ID_MENU3D_ENGINE,
_( "Render Engine" ), KiBitmap( render_mode_xpm ) );
renderEngineList->AppendRadioItem( ID_MENU3D_ENGINE_OPENGL_LEGACY,
_( "OpenGL" ),
wxEmptyString );
renderEngineList->AppendRadioItem( ID_MENU3D_ENGINE_RAYTRACING,
_( "Raytracing" ),
wxEmptyString );
renderEngineList->Check( ID_MENU3D_ENGINE_OPENGL_LEGACY,
m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY );
renderEngineList->Check( ID_MENU3D_ENGINE_RAYTRACING,
m_settings.RenderEngineGet() == RENDER_ENGINE_RAYTRACING );
wxMenu * renderOptionsMenu = new wxMenu;
AddMenuItem( prefsMenu, renderOptionsMenu, ID_MENU3D_FL,
_( "Render Options" ), KiBitmap( options_3drender_xpm ) );
wxMenu * materialsList = new wxMenu;
AddMenuItem( renderOptionsMenu, materialsList, ID_MENU3D_FL_RENDER_MATERIAL,
_( "Material Properties" ), KiBitmap( color_materials_xpm ) );
materialsList->AppendRadioItem( ID_MENU3D_FL_RENDER_MATERIAL_MODE_NORMAL,
_( "Use All Properties" ),
_( "Use all material properties from each 3D model file" ) );
materialsList->AppendRadioItem( ID_MENU3D_FL_RENDER_MATERIAL_MODE_DIFFUSE_ONLY,
_( "Use Diffuse Only" ),
_( "Use only the diffuse color property from model 3D model file " ) );
materialsList->AppendRadioItem( ID_MENU3D_FL_RENDER_MATERIAL_MODE_CAD_MODE,
_( "CAD Color Style" ),
_( "Use a CAD color style based on the diffuse color of the material" ) );
// Add specific preferences for OpenGL
// /////////////////////////////////////////////////////////////////////////
wxMenu * renderOptionsMenu_OPENGL = new wxMenu;
AddMenuItem( renderOptionsMenu, renderOptionsMenu_OPENGL, ID_MENU3D_FL_OPENGL,
_( "OpenGL Options" ), KiBitmap( tools_xpm ) );
AddMenuItem( renderOptionsMenu_OPENGL, ID_MENU3D_FL_OPENGL_RENDER_COPPER_THICKNESS,
_( "Show Copper Thickness" ),
_( "Shows the copper thickness on copper layers (slower loading)"),
KiBitmap( use_3D_copper_thickness_xpm ), wxITEM_CHECK );
AddMenuItem( renderOptionsMenu_OPENGL, ID_MENU3D_FL_OPENGL_RENDER_SHOW_MODEL_BBOX,
_( "Show Model Bounding Boxes" ),
KiBitmap( ortho_xpm ), wxITEM_CHECK );
// Add specific preferences for Raytracing
// /////////////////////////////////////////////////////////////////////////
wxMenu * renderOptionsMenu_RAYTRACING = new wxMenu;
AddMenuItem( renderOptionsMenu, renderOptionsMenu_RAYTRACING, ID_MENU3D_FL_RAYTRACING,
_( "Raytracing Options" ), KiBitmap( tools_xpm ) );
AddMenuItem( renderOptionsMenu_RAYTRACING, ID_MENU3D_FL_RAYTRACING_RENDER_SHADOWS,
_( "Render Shadows" ),
KiBitmap( green_xpm ), wxITEM_CHECK );
AddMenuItem( renderOptionsMenu_RAYTRACING, ID_MENU3D_FL_RAYTRACING_PROCEDURAL_TEXTURES,
_( "Procedural Textures" ),
_( "Apply procedural textures to materials (slow)"),
KiBitmap( green_xpm ), wxITEM_CHECK );
AddMenuItem( renderOptionsMenu_RAYTRACING, ID_MENU3D_FL_RAYTRACING_BACKFLOOR,
_( "Add Floor" ),
_( "Adds a floor plane below the board (slow)"),
KiBitmap( green_xpm ), wxITEM_CHECK );
AddMenuItem( renderOptionsMenu_RAYTRACING, ID_MENU3D_FL_RAYTRACING_REFRACTIONS,
_( "Refractions" ),
_( "Render materials with refractions properties on final render (slow)"),
KiBitmap( green_xpm ), wxITEM_CHECK );
AddMenuItem( renderOptionsMenu_RAYTRACING, ID_MENU3D_FL_RAYTRACING_REFLECTIONS,
_( "Reflections" ),
_( "Render materials with reflections properties on final render (slow)"),
KiBitmap( green_xpm ), wxITEM_CHECK );
AddMenuItem( renderOptionsMenu_RAYTRACING, ID_MENU3D_FL_RAYTRACING_ANTI_ALIASING,
_( "Anti-aliasing" ),
_( "Render with improved quality on final render (slow)"),
KiBitmap( green_xpm ), wxITEM_CHECK );
AddMenuItem( renderOptionsMenu_RAYTRACING, ID_MENU3D_FL_RAYTRACING_POST_PROCESSING,
_( "Post-processing" ),
_( "Apply Screen Space Ambient Occlusion and Global Illumination reflections on final render (slow)"),
KiBitmap( green_xpm ), wxITEM_CHECK );
prefsMenu->AppendSeparator();
// Colors, axis and grid elements
// /////////////////////////////////////////////////////////////////////////
// Add submenu set Colors
wxMenu * setColorMenu = new wxMenu;
AddMenuItem( prefsMenu, setColorMenu, ID_MENU3D_COLOR,
_( "Choose Colors" ), KiBitmap( palette_xpm ) );
wxMenu * setBgColorMenu = new wxMenu;
AddMenuItem( setColorMenu, setBgColorMenu, ID_MENU3D_BGCOLOR,
_( "Background Color" ), KiBitmap( palette_xpm ) );
AddMenuItem( setBgColorMenu, ID_MENU3D_BGCOLOR_TOP_SELECTION,
_( "Background Top Color..." ), KiBitmap( setcolor_3d_bg_xpm ) );
AddMenuItem( setBgColorMenu, ID_MENU3D_BGCOLOR_BOTTOM_SELECTION,
_( "Background Bottom Color..." ), KiBitmap( setcolor_3d_bg_xpm ) );
AddMenuItem( setColorMenu, ID_MENU3D_SILKSCREEN_COLOR_SELECTION,
_( "Silkscreen Color..." ), KiBitmap( setcolor_silkscreen_xpm ) );
AddMenuItem( setColorMenu, ID_MENU3D_SOLDERMASK_COLOR_SELECTION,
_( "Solder Mask Color..." ), KiBitmap( setcolor_soldermask_xpm ) );
AddMenuItem( setColorMenu, ID_MENU3D_SOLDERPASTE_COLOR_SELECTION,
_( "Solder Paste Color..." ), KiBitmap( setcolor_solderpaste_xpm ) );
AddMenuItem( setColorMenu, ID_MENU3D_COPPER_COLOR_SELECTION,
_( "Copper/Surface Finish Color..." ), KiBitmap( setcolor_copper_xpm ) );
AddMenuItem( setColorMenu, ID_MENU3D_PCB_BODY_COLOR_SELECTION,
_( "Board Body Color..." ), KiBitmap( setcolor_board_body_xpm ) );
AddMenuItem( prefsMenu, ID_MENU3D_AXIS_ONOFF,
_( "Show 3D &Axis" ), KiBitmap( axis3d_front_xpm ), wxITEM_CHECK );
// Creates grid menu
// /////////////////////////////////////////////////////////////////////////
wxMenu * gridlistMenu = new wxMenu;
AddMenuItem( prefsMenu, gridlistMenu, ID_MENU3D_GRID,
_( "3D Grid" ), KiBitmap( grid_xpm ) );
gridlistMenu->AppendRadioItem( ID_MENU3D_GRID_NOGRID, _( "No 3D Grid" ), wxEmptyString );
gridlistMenu->AppendRadioItem( ID_MENU3D_GRID_10_MM, _( "3D Grid 10 mm" ), wxEmptyString );
gridlistMenu->AppendRadioItem( ID_MENU3D_GRID_5_MM, _( "3D Grid 5 mm" ), wxEmptyString );
gridlistMenu->AppendRadioItem( ID_MENU3D_GRID_2P5_MM, _( "3D Grid 2.5 mm" ), wxEmptyString );
gridlistMenu->AppendRadioItem( ID_MENU3D_GRID_1_MM, _( "3D Grid 1 mm" ), wxEmptyString );
// If the grid is on, check the corresponding menuitem showing the grid size
if( m_settings.GridGet() != GRID3D_NONE )
{
gridlistMenu->Check( ID_MENU3D_GRID_10_MM, m_settings.GridGet() == GRID3D_10MM );
gridlistMenu->Check( ID_MENU3D_GRID_5_MM, m_settings.GridGet() == GRID3D_5MM );
gridlistMenu->Check( ID_MENU3D_GRID_2P5_MM, m_settings.GridGet() == GRID3D_2P5MM );
gridlistMenu->Check( ID_MENU3D_GRID_1_MM, m_settings.GridGet() == GRID3D_1MM );
}
else
gridlistMenu->Check( ID_MENU3D_GRID_NOGRID, true );
// Display elements options
// /////////////////////////////////////////////////////////////////////////
prefsMenu->AppendSeparator();
AddMenuItem( prefsMenu, ID_MENU3D_SHOW_BOARD_BODY,
_( "Show Board Bod&y" ), KiBitmap( use_3D_copper_thickness_xpm ), wxITEM_CHECK );
AddMenuItem( prefsMenu, ID_MENU3D_ZONE_ONOFF,
_( "Show Zone &Filling" ), KiBitmap( add_zone_xpm ), wxITEM_CHECK );
wxMenu * moduleAttributes = new wxMenu;
AddMenuItem( prefsMenu, moduleAttributes, ID_MENU3D_MODULE_ONOFF,
_( "Show 3D M&odels" ), KiBitmap( shape_3d_xpm ) );
moduleAttributes->AppendCheckItem( ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_NORMAL,
_( "Through Hole" ),
_( "Footprint Properties -> Placement type -> Through hole" ) );
moduleAttributes->AppendCheckItem( ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_NORMAL_INSERT,
_( "Surface Mount" ),
_( "Footprint Properties -> Placement type -> Surface mount" ) );
moduleAttributes->AppendCheckItem( ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_VIRTUAL,
_( "Virtual" ),
_( "Footprint Properties -> Placement type -> Virtual (eg: edge connectors, test points, mechanical parts)" ) );
// Layer options
// /////////////////////////////////////////////////////////////////////////
prefsMenu->AppendSeparator();
wxMenu * layersMenu = new wxMenu;
AddMenuItem( prefsMenu, layersMenu, ID_MENU3D_LAYERS,
_( "Show &Layers" ), KiBitmap( tools_xpm ) );
AddMenuItem( layersMenu, ID_MENU3D_ADHESIVE_ONOFF,
_( "Show &Adhesive Layers" ), KiBitmap( tools_xpm ), wxITEM_CHECK );
AddMenuItem( layersMenu, ID_MENU3D_SILKSCREEN_ONOFF,
_( "Show &Silkscreen Layers" ), KiBitmap( text_xpm ), wxITEM_CHECK );
AddMenuItem( layersMenu, ID_MENU3D_SOLDER_MASK_ONOFF,
_( "Show Solder &Mask Layers" ), KiBitmap( pads_mask_layers_xpm ), wxITEM_CHECK );
AddMenuItem( layersMenu, ID_MENU3D_SOLDER_PASTE_ONOFF,
_( "Show Solder &Paste Layers" ), KiBitmap( pads_mask_layers_xpm ), wxITEM_CHECK );
// Other layers are not "board" layers, and are not shown in realistic mode
// These menus will be disabled in in realistic mode
AddMenuItem( layersMenu, ID_MENU3D_COMMENTS_ONOFF,
_( "Show &Comments and Drawings Layers" ), KiBitmap( editor_xpm ), wxITEM_CHECK );
AddMenuItem( layersMenu, ID_MENU3D_ECO_ONOFF,
_( "Show &Eco Layers" ), KiBitmap( editor_xpm ), wxITEM_CHECK );
// Reset options
// /////////////////////////////////////////////////////////////////////////
prefsMenu->AppendSeparator();
AddMenuItem( prefsMenu, ID_MENU3D_RESET_DEFAULTS,
_( "Reset to Default Settings" ),
KiBitmap( tools_xpm ) );
// Help menu
// /////////////////////////////////////////////////////////////////////////
menuBar->Append( helpMenu, _( "&Help" ) );
wxString text = AddHotkeyName( _( "&List Hotkeys..." ), g_3DViewer_Hokeys_Descr, HK_HELP );
AddMenuItem( helpMenu, ID_MENU3D_HELP_HOTKEY_SHOW_CURRENT_LIST,
text,
_( "Displays the current hotkeys list and corresponding commands" ),
KiBitmap( hotkeys_xpm ) );
SetMenuBar( menuBar );
SetMenuBarOptionsState();
}
void EDA_3D_VIEWER::SetMenuBarOptionsState()
{
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::SetMenuBarOptionsState" ) );
wxMenuBar* menuBar = GetMenuBar();
if( menuBar == NULL )
{
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::SetMenuBarOptionsState menuBar == NULL" ) );
return;
}
wxMenuItem* item;
// Set the state of toggle menus according to the current display options
item = menuBar->FindItem( ID_MENU3D_MOUSEWHEEL_PANNING );
item->Check( m_settings.GetFlag( FL_MOUSEWHEEL_PANNING ) );
item = menuBar->FindItem( ID_MENU3D_ENGINE_OPENGL_LEGACY );
item->Check( m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY );
item = menuBar->FindItem( ID_MENU3D_ENGINE_RAYTRACING );
item->Check( m_settings.RenderEngineGet() == RENDER_ENGINE_RAYTRACING );
item = menuBar->FindItem( ID_MENU3D_REALISTIC_MODE );
item->Check( m_settings.GetFlag( FL_USE_REALISTIC_MODE ) );
item = menuBar->FindItem( ID_MENU3D_COMMENTS_ONOFF );
item->Enable( !m_settings.GetFlag( FL_USE_REALISTIC_MODE ) );
item = menuBar->FindItem( ID_MENU3D_ECO_ONOFF );
item->Enable( !m_settings.GetFlag( FL_USE_REALISTIC_MODE ) );
item = menuBar->FindItem( ID_MENU3D_FL_RENDER_MATERIAL_MODE_NORMAL );
item->Check( m_settings.MaterialModeGet() == MATERIAL_MODE_NORMAL );
item = menuBar->FindItem( ID_MENU3D_FL_RENDER_MATERIAL_MODE_DIFFUSE_ONLY );
item->Check( m_settings.MaterialModeGet() == MATERIAL_MODE_DIFFUSE_ONLY );
item = menuBar->FindItem( ID_MENU3D_FL_RENDER_MATERIAL_MODE_CAD_MODE );
item->Check( m_settings.MaterialModeGet() == MATERIAL_MODE_CAD_MODE );
// OpenGL
item = menuBar->FindItem( ID_MENU3D_FL_OPENGL_RENDER_COPPER_THICKNESS );
item->Check( m_settings.GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) );
item = menuBar->FindItem( ID_MENU3D_FL_OPENGL_RENDER_SHOW_MODEL_BBOX );
item->Check( m_settings.GetFlag( FL_RENDER_OPENGL_SHOW_MODEL_BBOX ) );
// Raytracing
item = menuBar->FindItem( ID_MENU3D_FL_RAYTRACING_RENDER_SHADOWS );
item->Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_SHADOWS ) );
item = menuBar->FindItem( ID_MENU3D_FL_RAYTRACING_BACKFLOOR );
item->Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_BACKFLOOR ) );
item = menuBar->FindItem( ID_MENU3D_FL_RAYTRACING_REFRACTIONS );
item->Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_REFRACTIONS ) );
item = menuBar->FindItem( ID_MENU3D_FL_RAYTRACING_REFLECTIONS );
item->Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_REFLECTIONS ) );
item = menuBar->FindItem( ID_MENU3D_FL_RAYTRACING_POST_PROCESSING );
item->Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_POST_PROCESSING ) );
item = menuBar->FindItem( ID_MENU3D_FL_RAYTRACING_ANTI_ALIASING );
item->Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_ANTI_ALIASING ) );
item = menuBar->FindItem( ID_MENU3D_FL_RAYTRACING_PROCEDURAL_TEXTURES );
item->Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES ) );
item = menuBar->FindItem( ID_MENU3D_SHOW_BOARD_BODY );
item->Check( m_settings.GetFlag( FL_SHOW_BOARD_BODY ) );
item = menuBar->FindItem( ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_NORMAL );
item->Check( m_settings.GetFlag( FL_MODULE_ATTRIBUTES_NORMAL ) );
item = menuBar->FindItem( ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_NORMAL_INSERT );
item->Check( m_settings.GetFlag( FL_MODULE_ATTRIBUTES_NORMAL_INSERT ) );
item = menuBar->FindItem( ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_VIRTUAL );
item->Check( m_settings.GetFlag( FL_MODULE_ATTRIBUTES_VIRTUAL ) );
item = menuBar->FindItem( ID_MENU3D_ZONE_ONOFF );
item->Check( m_settings.GetFlag( FL_ZONE ) );
item = menuBar->FindItem( ID_MENU3D_AXIS_ONOFF );
item->Check( m_settings.GetFlag( FL_AXIS ) );
item = menuBar->FindItem( ID_MENU3D_ADHESIVE_ONOFF );
item->Check( m_settings.GetFlag( FL_ADHESIVE ) );
item = menuBar->FindItem( ID_MENU3D_SILKSCREEN_ONOFF );
item->Check( m_settings.GetFlag( FL_SILKSCREEN ) );
item = menuBar->FindItem( ID_MENU3D_SOLDER_MASK_ONOFF );
item->Check( m_settings.GetFlag( FL_SOLDERMASK ) );
item = menuBar->FindItem( ID_MENU3D_SOLDER_PASTE_ONOFF );
item->Check( m_settings.GetFlag( FL_SOLDERPASTE ) );
item = menuBar->FindItem( ID_MENU3D_COMMENTS_ONOFF );
item->Check( m_settings.GetFlag( FL_COMMENTS ) );
item = menuBar->FindItem( ID_MENU3D_ECO_ONOFF );
item->Check( m_settings.GetFlag( FL_ECO ));
}

View File

@ -135,392 +135,6 @@ void EDA_3D_VIEWER::ReCreateMainToolbar()
}
void EDA_3D_VIEWER::CreateMenuBar()
{
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::CreateMenuBar" ) );
wxMenuBar* menuBar = new wxMenuBar;
wxMenu* fileMenu = new wxMenu;
wxMenu* editMenu = new wxMenu;
wxMenu* prefsMenu = new wxMenu;
wxMenu* helpMenu = new wxMenu;
menuBar->Append( fileMenu, _( "&File" ) );
AddMenuItem( fileMenu, ID_MENU_SCREENCOPY_PNG,
_( "Export Current View as PNG..." ),
KiBitmap( export_xpm ) );
AddMenuItem( fileMenu, ID_MENU_SCREENCOPY_JPEG,
_( "Export Current View as JPEG..." ),
KiBitmap( export_xpm ) );
fileMenu->AppendSeparator();
AddMenuItem( fileMenu, wxID_EXIT,
_( "&Exit" ),
KiBitmap( exit_xpm ) );
menuBar->Append( editMenu, _( "&Edit" ) );
AddMenuItem( editMenu, ID_TOOL_SCREENCOPY_TOCLIBBOARD,
_( "Copy 3D Image" ),
KiBitmap( copy_xpm ) );
menuBar->Append( prefsMenu, _( "&Preferences" ) );
AddMenuItem( prefsMenu, ID_MENU3D_MOUSEWHEEL_PANNING,
_( "Use Touchpad to Pan" ),
KiBitmap( tools_xpm ), wxITEM_CHECK );
prefsMenu->AppendSeparator();
AddMenuItem( prefsMenu, ID_MENU3D_REALISTIC_MODE,
_( "Realistic Mode" ),
KiBitmap( use_3D_copper_thickness_xpm ), wxITEM_CHECK );
wxMenu * renderEngineList = new wxMenu;
AddMenuItem( prefsMenu, renderEngineList, ID_MENU3D_ENGINE,
_( "Render Engine" ), KiBitmap( render_mode_xpm ) );
renderEngineList->AppendRadioItem( ID_MENU3D_ENGINE_OPENGL_LEGACY,
_( "OpenGL" ),
wxEmptyString );
renderEngineList->AppendRadioItem( ID_MENU3D_ENGINE_RAYTRACING,
_( "Raytracing" ),
wxEmptyString );
renderEngineList->Check( ID_MENU3D_ENGINE_OPENGL_LEGACY,
m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY );
renderEngineList->Check( ID_MENU3D_ENGINE_RAYTRACING,
m_settings.RenderEngineGet() == RENDER_ENGINE_RAYTRACING );
wxMenu * renderOptionsMenu = new wxMenu;
AddMenuItem( prefsMenu, renderOptionsMenu, ID_MENU3D_FL,
_( "Render Options" ), KiBitmap( options_3drender_xpm ) );
wxMenu * materialsList = new wxMenu;
AddMenuItem( renderOptionsMenu, materialsList, ID_MENU3D_FL_RENDER_MATERIAL,
_( "Material Properties" ), KiBitmap( color_materials_xpm ) );
materialsList->AppendRadioItem( ID_MENU3D_FL_RENDER_MATERIAL_MODE_NORMAL,
_( "Use All Properties" ),
_( "Use all material properties from each 3D model file" ) );
materialsList->AppendRadioItem( ID_MENU3D_FL_RENDER_MATERIAL_MODE_DIFFUSE_ONLY,
_( "Use Diffuse Only" ),
_( "Use only the diffuse color property from model 3D model file " ) );
materialsList->AppendRadioItem( ID_MENU3D_FL_RENDER_MATERIAL_MODE_CAD_MODE,
_( "CAD Color Style" ),
_( "Use a CAD color style based on the diffuse color of the material" ) );
// Add specific preferences for OpenGL
// /////////////////////////////////////////////////////////////////////////
wxMenu * renderOptionsMenu_OPENGL = new wxMenu;
AddMenuItem( renderOptionsMenu, renderOptionsMenu_OPENGL, ID_MENU3D_FL_OPENGL,
_( "OpenGL Options" ), KiBitmap( tools_xpm ) );
AddMenuItem( renderOptionsMenu_OPENGL, ID_MENU3D_FL_OPENGL_RENDER_COPPER_THICKNESS,
_( "Show Copper Thickness" ),
_( "Shows the copper thickness on copper layers (slower loading)"),
KiBitmap( use_3D_copper_thickness_xpm ), wxITEM_CHECK );
AddMenuItem( renderOptionsMenu_OPENGL, ID_MENU3D_FL_OPENGL_RENDER_SHOW_MODEL_BBOX,
_( "Show Model Bounding Boxes" ),
KiBitmap( ortho_xpm ), wxITEM_CHECK );
// Add specific preferences for Raytracing
// /////////////////////////////////////////////////////////////////////////
wxMenu * renderOptionsMenu_RAYTRACING = new wxMenu;
AddMenuItem( renderOptionsMenu, renderOptionsMenu_RAYTRACING, ID_MENU3D_FL_RAYTRACING,
_( "Raytracing Options" ), KiBitmap( tools_xpm ) );
AddMenuItem( renderOptionsMenu_RAYTRACING, ID_MENU3D_FL_RAYTRACING_RENDER_SHADOWS,
_( "Render Shadows" ),
KiBitmap( green_xpm ), wxITEM_CHECK );
AddMenuItem( renderOptionsMenu_RAYTRACING, ID_MENU3D_FL_RAYTRACING_PROCEDURAL_TEXTURES,
_( "Procedural Textures" ),
_( "Apply procedural textures to materials (slow)"),
KiBitmap( green_xpm ), wxITEM_CHECK );
AddMenuItem( renderOptionsMenu_RAYTRACING, ID_MENU3D_FL_RAYTRACING_BACKFLOOR,
_( "Add Floor" ),
_( "Adds a floor plane below the board (slow)"),
KiBitmap( green_xpm ), wxITEM_CHECK );
AddMenuItem( renderOptionsMenu_RAYTRACING, ID_MENU3D_FL_RAYTRACING_REFRACTIONS,
_( "Refractions" ),
_( "Render materials with refractions properties on final render (slow)"),
KiBitmap( green_xpm ), wxITEM_CHECK );
AddMenuItem( renderOptionsMenu_RAYTRACING, ID_MENU3D_FL_RAYTRACING_REFLECTIONS,
_( "Reflections" ),
_( "Render materials with reflections properties on final render (slow)"),
KiBitmap( green_xpm ), wxITEM_CHECK );
AddMenuItem( renderOptionsMenu_RAYTRACING, ID_MENU3D_FL_RAYTRACING_ANTI_ALIASING,
_( "Anti-aliasing" ),
_( "Render with improved quality on final render (slow)"),
KiBitmap( green_xpm ), wxITEM_CHECK );
AddMenuItem( renderOptionsMenu_RAYTRACING, ID_MENU3D_FL_RAYTRACING_POST_PROCESSING,
_( "Post-processing" ),
_( "Apply Screen Space Ambient Occlusion and Global Illumination reflections on final render (slow)"),
KiBitmap( green_xpm ), wxITEM_CHECK );
prefsMenu->AppendSeparator();
// Colors, axis and grid elements
// /////////////////////////////////////////////////////////////////////////
// Add submenu set Colors
wxMenu * setColorMenu = new wxMenu;
AddMenuItem( prefsMenu, setColorMenu, ID_MENU3D_COLOR,
_( "Choose Colors" ), KiBitmap( palette_xpm ) );
wxMenu * setBgColorMenu = new wxMenu;
AddMenuItem( setColorMenu, setBgColorMenu, ID_MENU3D_BGCOLOR,
_( "Background Color" ), KiBitmap( palette_xpm ) );
AddMenuItem( setBgColorMenu, ID_MENU3D_BGCOLOR_TOP_SELECTION,
_( "Background Top Color..." ), KiBitmap( setcolor_3d_bg_xpm ) );
AddMenuItem( setBgColorMenu, ID_MENU3D_BGCOLOR_BOTTOM_SELECTION,
_( "Background Bottom Color..." ), KiBitmap( setcolor_3d_bg_xpm ) );
AddMenuItem( setColorMenu, ID_MENU3D_SILKSCREEN_COLOR_SELECTION,
_( "Silkscreen Color..." ), KiBitmap( setcolor_silkscreen_xpm ) );
AddMenuItem( setColorMenu, ID_MENU3D_SOLDERMASK_COLOR_SELECTION,
_( "Solder Mask Color..." ), KiBitmap( setcolor_soldermask_xpm ) );
AddMenuItem( setColorMenu, ID_MENU3D_SOLDERPASTE_COLOR_SELECTION,
_( "Solder Paste Color..." ), KiBitmap( setcolor_solderpaste_xpm ) );
AddMenuItem( setColorMenu, ID_MENU3D_COPPER_COLOR_SELECTION,
_( "Copper/Surface Finish Color..." ), KiBitmap( setcolor_copper_xpm ) );
AddMenuItem( setColorMenu, ID_MENU3D_PCB_BODY_COLOR_SELECTION,
_( "Board Body Color..." ), KiBitmap( setcolor_board_body_xpm ) );
AddMenuItem( prefsMenu, ID_MENU3D_AXIS_ONOFF,
_( "Show 3D &Axis" ), KiBitmap( axis3d_front_xpm ), wxITEM_CHECK );
// Creates grid menu
// /////////////////////////////////////////////////////////////////////////
wxMenu * gridlistMenu = new wxMenu;
AddMenuItem( prefsMenu, gridlistMenu, ID_MENU3D_GRID,
_( "3D Grid" ), KiBitmap( grid_xpm ) );
gridlistMenu->AppendRadioItem( ID_MENU3D_GRID_NOGRID, _( "No 3D Grid" ), wxEmptyString );
gridlistMenu->AppendRadioItem( ID_MENU3D_GRID_10_MM, _( "3D Grid 10 mm" ), wxEmptyString );
gridlistMenu->AppendRadioItem( ID_MENU3D_GRID_5_MM, _( "3D Grid 5 mm" ), wxEmptyString );
gridlistMenu->AppendRadioItem( ID_MENU3D_GRID_2P5_MM, _( "3D Grid 2.5 mm" ), wxEmptyString );
gridlistMenu->AppendRadioItem( ID_MENU3D_GRID_1_MM, _( "3D Grid 1 mm" ), wxEmptyString );
// If the grid is on, check the corresponding menuitem showing the grid size
if( m_settings.GridGet() != GRID3D_NONE )
{
gridlistMenu->Check( ID_MENU3D_GRID_10_MM, m_settings.GridGet() == GRID3D_10MM );
gridlistMenu->Check( ID_MENU3D_GRID_5_MM, m_settings.GridGet() == GRID3D_5MM );
gridlistMenu->Check( ID_MENU3D_GRID_2P5_MM, m_settings.GridGet() == GRID3D_2P5MM );
gridlistMenu->Check( ID_MENU3D_GRID_1_MM, m_settings.GridGet() == GRID3D_1MM );
}
else
gridlistMenu->Check( ID_MENU3D_GRID_NOGRID, true );
// Display elements options
// /////////////////////////////////////////////////////////////////////////
prefsMenu->AppendSeparator();
AddMenuItem( prefsMenu, ID_MENU3D_SHOW_BOARD_BODY,
_( "Show Board Bod&y" ), KiBitmap( use_3D_copper_thickness_xpm ), wxITEM_CHECK );
AddMenuItem( prefsMenu, ID_MENU3D_ZONE_ONOFF,
_( "Show Zone &Filling" ), KiBitmap( add_zone_xpm ), wxITEM_CHECK );
wxMenu * moduleAttributes = new wxMenu;
AddMenuItem( prefsMenu, moduleAttributes, ID_MENU3D_MODULE_ONOFF,
_( "Show 3D M&odels" ), KiBitmap( shape_3d_xpm ) );
moduleAttributes->AppendCheckItem( ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_NORMAL,
_( "Through Hole" ),
_( "Footprint Properties -> Placement type -> Through hole" ) );
moduleAttributes->AppendCheckItem( ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_NORMAL_INSERT,
_( "Surface Mount" ),
_( "Footprint Properties -> Placement type -> Surface mount" ) );
moduleAttributes->AppendCheckItem( ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_VIRTUAL,
_( "Virtual" ),
_( "Footprint Properties -> Placement type -> Virtual (eg: edge connectors, test points, mechanical parts)" ) );
// Layer options
// /////////////////////////////////////////////////////////////////////////
prefsMenu->AppendSeparator();
wxMenu * layersMenu = new wxMenu;
AddMenuItem( prefsMenu, layersMenu, ID_MENU3D_LAYERS,
_( "Show &Layers" ), KiBitmap( tools_xpm ) );
AddMenuItem( layersMenu, ID_MENU3D_ADHESIVE_ONOFF,
_( "Show &Adhesive Layers" ), KiBitmap( tools_xpm ), wxITEM_CHECK );
AddMenuItem( layersMenu, ID_MENU3D_SILKSCREEN_ONOFF,
_( "Show &Silkscreen Layers" ), KiBitmap( text_xpm ), wxITEM_CHECK );
AddMenuItem( layersMenu, ID_MENU3D_SOLDER_MASK_ONOFF,
_( "Show Solder &Mask Layers" ), KiBitmap( pads_mask_layers_xpm ), wxITEM_CHECK );
AddMenuItem( layersMenu, ID_MENU3D_SOLDER_PASTE_ONOFF,
_( "Show Solder &Paste Layers" ), KiBitmap( pads_mask_layers_xpm ), wxITEM_CHECK );
// Other layers are not "board" layers, and are not shown in realistic mode
// These menus will be disabled in in realistic mode
AddMenuItem( layersMenu, ID_MENU3D_COMMENTS_ONOFF,
_( "Show &Comments and Drawings Layers" ), KiBitmap( editor_xpm ), wxITEM_CHECK );
AddMenuItem( layersMenu, ID_MENU3D_ECO_ONOFF,
_( "Show &Eco Layers" ), KiBitmap( editor_xpm ), wxITEM_CHECK );
// Reset options
// /////////////////////////////////////////////////////////////////////////
prefsMenu->AppendSeparator();
AddMenuItem( prefsMenu, ID_MENU3D_RESET_DEFAULTS,
_( "Reset to Default Settings" ),
KiBitmap( tools_xpm ) );
// Help menu
// /////////////////////////////////////////////////////////////////////////
menuBar->Append( helpMenu, _( "&Help" ) );
AddMenuItem( helpMenu, ID_MENU3D_HELP_HOTKEY_SHOW_CURRENT_LIST,
_( "&List Hotkeys..." ),
_( "Displays the current hotkeys list and corresponding commands" ),
KiBitmap( hotkeys_xpm ) );
SetMenuBar( menuBar );
SetMenuBarOptionsState();
}
void EDA_3D_VIEWER::SetMenuBarOptionsState()
{
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::SetMenuBarOptionsState" ) );
wxMenuBar* menuBar = GetMenuBar();
if( menuBar == NULL )
{
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::SetMenuBarOptionsState menuBar == NULL" ) );
return;
}
wxMenuItem* item;
// Set the state of toggle menus according to the current display options
item = menuBar->FindItem( ID_MENU3D_MOUSEWHEEL_PANNING );
item->Check( m_settings.GetFlag( FL_MOUSEWHEEL_PANNING ) );
item = menuBar->FindItem( ID_MENU3D_ENGINE_OPENGL_LEGACY );
item->Check( m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY );
item = menuBar->FindItem( ID_MENU3D_ENGINE_RAYTRACING );
item->Check( m_settings.RenderEngineGet() == RENDER_ENGINE_RAYTRACING );
item = menuBar->FindItem( ID_MENU3D_REALISTIC_MODE );
item->Check( m_settings.GetFlag( FL_USE_REALISTIC_MODE ) );
item = menuBar->FindItem( ID_MENU3D_COMMENTS_ONOFF );
item->Enable( !m_settings.GetFlag( FL_USE_REALISTIC_MODE ) );
item = menuBar->FindItem( ID_MENU3D_ECO_ONOFF );
item->Enable( !m_settings.GetFlag( FL_USE_REALISTIC_MODE ) );
item = menuBar->FindItem( ID_MENU3D_FL_RENDER_MATERIAL_MODE_NORMAL );
item->Check( m_settings.MaterialModeGet() == MATERIAL_MODE_NORMAL );
item = menuBar->FindItem( ID_MENU3D_FL_RENDER_MATERIAL_MODE_DIFFUSE_ONLY );
item->Check( m_settings.MaterialModeGet() == MATERIAL_MODE_DIFFUSE_ONLY );
item = menuBar->FindItem( ID_MENU3D_FL_RENDER_MATERIAL_MODE_CAD_MODE );
item->Check( m_settings.MaterialModeGet() == MATERIAL_MODE_CAD_MODE );
// OpenGL
item = menuBar->FindItem( ID_MENU3D_FL_OPENGL_RENDER_COPPER_THICKNESS );
item->Check( m_settings.GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) );
item = menuBar->FindItem( ID_MENU3D_FL_OPENGL_RENDER_SHOW_MODEL_BBOX );
item->Check( m_settings.GetFlag( FL_RENDER_OPENGL_SHOW_MODEL_BBOX ) );
// Raytracing
item = menuBar->FindItem( ID_MENU3D_FL_RAYTRACING_RENDER_SHADOWS );
item->Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_SHADOWS ) );
item = menuBar->FindItem( ID_MENU3D_FL_RAYTRACING_BACKFLOOR );
item->Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_BACKFLOOR ) );
item = menuBar->FindItem( ID_MENU3D_FL_RAYTRACING_REFRACTIONS );
item->Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_REFRACTIONS ) );
item = menuBar->FindItem( ID_MENU3D_FL_RAYTRACING_REFLECTIONS );
item->Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_REFLECTIONS ) );
item = menuBar->FindItem( ID_MENU3D_FL_RAYTRACING_POST_PROCESSING );
item->Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_POST_PROCESSING ) );
item = menuBar->FindItem( ID_MENU3D_FL_RAYTRACING_ANTI_ALIASING );
item->Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_ANTI_ALIASING ) );
item = menuBar->FindItem( ID_MENU3D_FL_RAYTRACING_PROCEDURAL_TEXTURES );
item->Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES ) );
item = menuBar->FindItem( ID_MENU3D_SHOW_BOARD_BODY );
item->Check( m_settings.GetFlag( FL_SHOW_BOARD_BODY ) );
item = menuBar->FindItem( ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_NORMAL );
item->Check( m_settings.GetFlag( FL_MODULE_ATTRIBUTES_NORMAL ) );
item = menuBar->FindItem( ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_NORMAL_INSERT );
item->Check( m_settings.GetFlag( FL_MODULE_ATTRIBUTES_NORMAL_INSERT ) );
item = menuBar->FindItem( ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_VIRTUAL );
item->Check( m_settings.GetFlag( FL_MODULE_ATTRIBUTES_VIRTUAL ) );
item = menuBar->FindItem( ID_MENU3D_ZONE_ONOFF );
item->Check( m_settings.GetFlag( FL_ZONE ) );
item = menuBar->FindItem( ID_MENU3D_AXIS_ONOFF );
item->Check( m_settings.GetFlag( FL_AXIS ) );
item = menuBar->FindItem( ID_MENU3D_ADHESIVE_ONOFF );
item->Check( m_settings.GetFlag( FL_ADHESIVE ) );
item = menuBar->FindItem( ID_MENU3D_SILKSCREEN_ONOFF );
item->Check( m_settings.GetFlag( FL_SILKSCREEN ) );
item = menuBar->FindItem( ID_MENU3D_SOLDER_MASK_ONOFF );
item->Check( m_settings.GetFlag( FL_SOLDERMASK ) );
item = menuBar->FindItem( ID_MENU3D_SOLDER_PASTE_ONOFF );
item->Check( m_settings.GetFlag( FL_SOLDERPASTE ) );
item = menuBar->FindItem( ID_MENU3D_COMMENTS_ONOFF );
item->Check( m_settings.GetFlag( FL_COMMENTS ) );
item = menuBar->FindItem( ID_MENU3D_ECO_ONOFF );
item->Check( m_settings.GetFlag( FL_ECO ));
}
void EDA_3D_VIEWER::SetToolbars()
{
}

View File

@ -1170,70 +1170,3 @@ bool EDA_3D_VIEWER::Set3DSolderPasteColorFromUser()
return change;
}
// Define 3D Viewer Hotkeys
static EDA_HOTKEY Hk3D_PivotCenter( _HKI( "Center pivot rotation (Middle mouse click)" ), 0, WXK_SPACE );
static EDA_HOTKEY Hk3D_MoveLeft( _HKI( "Move board Left" ), ID_POPUP_MOVE3D_LEFT, WXK_LEFT );
static EDA_HOTKEY Hk3D_MoveRight( _HKI( "Move board Right" ), ID_POPUP_MOVE3D_RIGHT, WXK_RIGHT );
static EDA_HOTKEY Hk3D_MoveUp( _HKI( "Move board Up" ), ID_POPUP_MOVE3D_UP, WXK_UP );
static EDA_HOTKEY Hk3D_MoveDown( _HKI( "Move board Down" ), ID_POPUP_MOVE3D_DOWN, WXK_DOWN );
static EDA_HOTKEY Hk3D_HomeView( _HKI( "Home view" ), 0, WXK_HOME );
static EDA_HOTKEY Hk3D_ResetView( _HKI( "Reset view" ), 0, 'R' );
static EDA_HOTKEY Hk3D_ViewFront( _HKI( "View Front" ), ID_POPUP_VIEW_YPOS, 'Y' );
static EDA_HOTKEY Hk3D_ViewBack( _HKI( "View Back" ), ID_POPUP_VIEW_YNEG, GR_KB_SHIFT + 'Y' );
static EDA_HOTKEY Hk3D_ViewLeft( _HKI( "View Left" ), ID_POPUP_VIEW_XNEG, GR_KB_SHIFT + 'X' );
static EDA_HOTKEY Hk3D_ViewRight( _HKI( "View Right" ), ID_POPUP_VIEW_XPOS, 'X' );
static EDA_HOTKEY Hk3D_ViewTop( _HKI( "View Top" ), ID_POPUP_VIEW_ZPOS, 'Z' );
static EDA_HOTKEY Hk3D_ViewBot( _HKI( "View Bot" ), ID_POPUP_VIEW_ZNEG, GR_KB_SHIFT + 'Z' );
static EDA_HOTKEY Hk3D_Rotate45axisZ( _HKI( "Rotate 45 degrees over Z axis" ), 0, WXK_TAB );
static EDA_HOTKEY Hk3D_ZoomIn( _HKI( "Zoom in " ), ID_POPUP_ZOOMIN, WXK_F1 );
static EDA_HOTKEY Hk3D_ZoomOut( _HKI( "Zoom out" ), ID_POPUP_ZOOMOUT, WXK_F2 );
static EDA_HOTKEY Hk3D_AttributesTHT( _HKI( "Toggle 3D models with type Through Hole" ), 0, 'T' );
static EDA_HOTKEY Hk3D_AttributesSMD( _HKI( "Toggle 3D models with type Surface Mount" ), 0, 'S' );
static EDA_HOTKEY Hk3D_AttributesVirtual( _HKI( "Toggle 3D models with type Virtual" ), 0, 'V' );
static wxString viewer3DSectionTitle( _HKI( "Viewer 3D" ) );
// List of hotkey descriptors for the 3D Viewer only
// !TODO: this is used just for help menu, the structured are not used yet in the viewer
static EDA_HOTKEY* viewer3d_Hotkey_List[] =
{
&Hk3D_PivotCenter,
&Hk3D_MoveLeft,
&Hk3D_MoveRight,
&Hk3D_MoveUp,
&Hk3D_MoveDown,
&Hk3D_HomeView,
&Hk3D_ResetView,
&Hk3D_ViewFront,
&Hk3D_ViewBack,
&Hk3D_ViewLeft,
&Hk3D_ViewRight,
&Hk3D_ViewTop,
&Hk3D_ViewBot,
&Hk3D_Rotate45axisZ,
&Hk3D_ZoomIn,
&Hk3D_ZoomOut,
&Hk3D_AttributesTHT,
&Hk3D_AttributesSMD,
&Hk3D_AttributesVirtual,
NULL
};
// list of sections and corresponding hotkey list for the 3D Viewer
// (used to list current hotkeys)
struct EDA_HOTKEY_CONFIG g_3DViewer_Hokeys_Descr[] =
{
{ &g_CommonSectionTag, viewer3d_Hotkey_List, &viewer3DSectionTitle },
{ NULL, NULL, NULL }
};
void EDA_3D_VIEWER::DisplayHotKeys()
{
DisplayHotkeyList( this, g_3DViewer_Hokeys_Descr );
}

View File

@ -0,0 +1,99 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
*
* 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
*/
/**
* @file hotkeys.cpp
* @brief list of hotkeys used in 3D viewer
*/
#include <hotkeys_basic.h>
#include "eda_3d_viewer.h"
#include "../3d_viewer_id.h"
// Define 3D Viewer Hotkeys
static EDA_HOTKEY HkHotkeysHelp( _HKI( "Help (this window)" ), HK_HELP, GR_KB_CTRL + WXK_F1 );
static EDA_HOTKEY Hk3D_PivotCenter( _HKI( "Center pivot rotation (Middle mouse click)" ), 0, WXK_SPACE );
static EDA_HOTKEY Hk3D_MoveLeft( _HKI( "Move board Left" ), ID_POPUP_MOVE3D_LEFT, WXK_LEFT );
static EDA_HOTKEY Hk3D_MoveRight( _HKI( "Move board Right" ), ID_POPUP_MOVE3D_RIGHT, WXK_RIGHT );
static EDA_HOTKEY Hk3D_MoveUp( _HKI( "Move board Up" ), ID_POPUP_MOVE3D_UP, WXK_UP );
static EDA_HOTKEY Hk3D_MoveDown( _HKI( "Move board Down" ), ID_POPUP_MOVE3D_DOWN, WXK_DOWN );
static EDA_HOTKEY Hk3D_HomeView( _HKI( "Home view" ), 0, WXK_HOME );
static EDA_HOTKEY Hk3D_ResetView( _HKI( "Reset view" ), 0, 'R' );
static EDA_HOTKEY Hk3D_ViewFront( _HKI( "View Front" ), ID_POPUP_VIEW_YPOS, 'Y' );
static EDA_HOTKEY Hk3D_ViewBack( _HKI( "View Back" ), ID_POPUP_VIEW_YNEG, GR_KB_SHIFT + 'Y' );
static EDA_HOTKEY Hk3D_ViewLeft( _HKI( "View Left" ), ID_POPUP_VIEW_XNEG, GR_KB_SHIFT + 'X' );
static EDA_HOTKEY Hk3D_ViewRight( _HKI( "View Right" ), ID_POPUP_VIEW_XPOS, 'X' );
static EDA_HOTKEY Hk3D_ViewTop( _HKI( "View Top" ), ID_POPUP_VIEW_ZPOS, 'Z' );
static EDA_HOTKEY Hk3D_ViewBot( _HKI( "View Bot" ), ID_POPUP_VIEW_ZNEG, GR_KB_SHIFT + 'Z' );
static EDA_HOTKEY Hk3D_Rotate45axisZ( _HKI( "Rotate 45 degrees over Z axis" ), 0, WXK_TAB );
static EDA_HOTKEY Hk3D_ZoomIn( _HKI( "Zoom in " ), ID_POPUP_ZOOMIN, WXK_F1 );
static EDA_HOTKEY Hk3D_ZoomOut( _HKI( "Zoom out" ), ID_POPUP_ZOOMOUT, WXK_F2 );
static EDA_HOTKEY Hk3D_AttributesTHT( _HKI( "Toggle 3D models with type Through Hole" ), 0, 'T' );
static EDA_HOTKEY Hk3D_AttributesSMD( _HKI( "Toggle 3D models with type Surface Mount" ), 0, 'S' );
static EDA_HOTKEY Hk3D_AttributesVirtual( _HKI( "Toggle 3D models with type Virtual" ), 0, 'V' );
static wxString viewer3DSectionTitle( _HKI( "Viewer 3D" ) );
// List of hotkey descriptors for the 3D Viewer only
// !TODO: this is used just for help menu, the structured are not used yet in the viewer
static EDA_HOTKEY* viewer3d_Hotkey_List[] =
{
&HkHotkeysHelp,
&Hk3D_PivotCenter,
&Hk3D_MoveLeft,
&Hk3D_MoveRight,
&Hk3D_MoveUp,
&Hk3D_MoveDown,
&Hk3D_HomeView,
&Hk3D_ResetView,
&Hk3D_ViewFront,
&Hk3D_ViewBack,
&Hk3D_ViewLeft,
&Hk3D_ViewRight,
&Hk3D_ViewTop,
&Hk3D_ViewBot,
&Hk3D_Rotate45axisZ,
&Hk3D_ZoomIn,
&Hk3D_ZoomOut,
&Hk3D_AttributesTHT,
&Hk3D_AttributesSMD,
&Hk3D_AttributesVirtual,
NULL
};
// list of sections and corresponding hotkey list for the 3D Viewer
// (used to list current hotkeys)
struct EDA_HOTKEY_CONFIG g_3DViewer_Hokeys_Descr[] =
{
{ &g_CommonSectionTag, viewer3d_Hotkey_List, &viewer3DSectionTitle },
{ NULL, NULL, NULL }
};
void EDA_3D_VIEWER::DisplayHotKeys()
{
DisplayHotkeyList( this, g_3DViewer_Hokeys_Descr );
}

View File

@ -97,6 +97,8 @@ set(3D-VIEWER_SRCS
3d_rendering/cpostshader.cpp
3d_rendering/cpostshader_ssao.cpp
3d_rendering/ctrack_ball.cpp
3d_viewer/3d_menubar.cpp
3d_viewer/hotkeys.cpp
3d_rendering/test_cases.cpp
3d_rendering/trackball.cpp
3d_viewer/3d_toolbar.cpp