Convert 3DViewer to new hotkey architecture.
This commit is contained in:
parent
aeadc768f6
commit
a3f3fb39de
|
@ -660,79 +660,42 @@ void EDA_3D_CANVAS::OnRightClick( wxMouseEvent &event )
|
|||
|
||||
wxPoint pos;
|
||||
wxMenu PopUpMenu;
|
||||
wxString msg;
|
||||
|
||||
pos.x = event.GetX();
|
||||
pos.y = event.GetY();
|
||||
|
||||
msg = AddHotkeyName( _( "Zoom +" ), GetHotkeyConfig(),
|
||||
ID_POPUP_ZOOMIN );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_ZOOMIN,
|
||||
msg, KiBitmap( zoom_in_xpm ) );
|
||||
|
||||
|
||||
msg = AddHotkeyName( _( "Zoom -" ), GetHotkeyConfig(),
|
||||
ID_POPUP_ZOOMOUT );
|
||||
_( "Zoom +\tF1" ), KiBitmap( zoom_in_xpm ) );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_ZOOMOUT,
|
||||
msg, KiBitmap( zoom_out_xpm ) );
|
||||
_( "Zoom -\tF2" ), KiBitmap( zoom_out_xpm ) );
|
||||
|
||||
PopUpMenu.AppendSeparator();
|
||||
|
||||
msg = AddHotkeyName( _( "Top View" ), GetHotkeyConfig(),
|
||||
ID_POPUP_VIEW_ZPOS );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_ZPOS,
|
||||
msg, KiBitmap( axis3d_top_xpm ) );
|
||||
|
||||
msg = AddHotkeyName( _( "Bottom View" ), GetHotkeyConfig(),
|
||||
ID_POPUP_VIEW_ZNEG );
|
||||
_( "Top View\tZ" ), KiBitmap( axis3d_top_xpm ) );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_ZNEG,
|
||||
msg, KiBitmap( axis3d_bottom_xpm ) );
|
||||
_( "Bottom View\tShift+Z" ), KiBitmap( axis3d_bottom_xpm ) );
|
||||
|
||||
PopUpMenu.AppendSeparator();
|
||||
|
||||
msg = AddHotkeyName( _( "Right View" ), GetHotkeyConfig(),
|
||||
ID_POPUP_VIEW_XPOS );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_XPOS,
|
||||
msg, KiBitmap( axis3d_right_xpm ) );
|
||||
|
||||
msg = AddHotkeyName( _( "Left View" ), GetHotkeyConfig(),
|
||||
ID_POPUP_VIEW_XNEG );
|
||||
_( "Right View\tX" ), KiBitmap( axis3d_right_xpm ) );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_XNEG,
|
||||
msg, KiBitmap( axis3d_left_xpm ) );
|
||||
_( "Left View\tShift+X" ), KiBitmap( axis3d_left_xpm ) );
|
||||
|
||||
PopUpMenu.AppendSeparator();
|
||||
|
||||
msg = AddHotkeyName( _( "Front View" ), GetHotkeyConfig(),
|
||||
ID_POPUP_VIEW_YPOS );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_YPOS,
|
||||
msg, KiBitmap( axis3d_front_xpm ) );
|
||||
|
||||
msg = AddHotkeyName( _( "Back View" ), GetHotkeyConfig(),
|
||||
ID_POPUP_VIEW_YNEG );
|
||||
_( "Front View\tY" ), KiBitmap( axis3d_front_xpm ) );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_YNEG,
|
||||
msg, KiBitmap( axis3d_back_xpm ) );
|
||||
_( "Back View\tShift+Y" ), KiBitmap( axis3d_back_xpm ) );
|
||||
|
||||
PopUpMenu.AppendSeparator();
|
||||
|
||||
msg = AddHotkeyName( _( "Move Left <-" ), GetHotkeyConfig(),
|
||||
ID_POPUP_MOVE3D_LEFT );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_LEFT,
|
||||
msg, KiBitmap( left_xpm ) );
|
||||
|
||||
msg = AddHotkeyName( _( "Move Right ->" ), GetHotkeyConfig(),
|
||||
ID_POPUP_MOVE3D_RIGHT );
|
||||
_( "Move Left <-\tLeft" ), KiBitmap( left_xpm ) );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_RIGHT,
|
||||
msg, KiBitmap( right_xpm ) );
|
||||
|
||||
msg = AddHotkeyName( _( "Move Up ^" ), GetHotkeyConfig(),
|
||||
ID_POPUP_MOVE3D_UP );
|
||||
_( "Move Right ->\tRight" ), KiBitmap( right_xpm ) );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_UP,
|
||||
msg, KiBitmap( up_xpm ) );
|
||||
|
||||
msg = AddHotkeyName( _( "Move Down" ), GetHotkeyConfig(),
|
||||
ID_POPUP_MOVE3D_DOWN );
|
||||
_( "Move Up ^\tUp" ), KiBitmap( up_xpm ) );
|
||||
AddMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_DOWN,
|
||||
msg, KiBitmap( down_xpm ) );
|
||||
_( "Move Down\tDown" ), KiBitmap( down_xpm ) );
|
||||
|
||||
PopupMenu( &PopUpMenu, pos );
|
||||
}
|
||||
|
|
|
@ -128,11 +128,6 @@ class EDA_3D_CANVAS : public HIDPI_GL_CANVAS
|
|||
|
||||
bool IsOpenGLInitialized() const { return m_is_opengl_initialized; }
|
||||
|
||||
/**
|
||||
* Return a structure containing currently used hotkey mapping.
|
||||
*/
|
||||
EDA_HOTKEY_CONFIG* GetHotkeyConfig() const;
|
||||
|
||||
private:
|
||||
|
||||
void OnPaint( wxPaintEvent &event );
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013-2016 CERN
|
||||
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef EDA_3D_ACTIONS_H
|
||||
#define EDA_3D_ACTIONS_H
|
||||
|
||||
#include <tool/tool_action.h>
|
||||
#include <tool/actions.h>
|
||||
#include <core/optional.h>
|
||||
|
||||
class TOOL_EVENT;
|
||||
class TOOL_MANAGER;
|
||||
|
||||
/**
|
||||
* Class EDA_3D_ACTIONS
|
||||
*
|
||||
* Note: these aren't "real" actions; we just use them to see the hotkeys display.
|
||||
*/
|
||||
class EDA_3D_ACTIONS : public ACTIONS
|
||||
{
|
||||
public:
|
||||
static TOOL_ACTION pivotCenter;
|
||||
static TOOL_ACTION moveLeft;
|
||||
static TOOL_ACTION moveRight;
|
||||
static TOOL_ACTION moveUp;
|
||||
static TOOL_ACTION moveDown;
|
||||
static TOOL_ACTION homeView;
|
||||
static TOOL_ACTION resetView;
|
||||
|
||||
static TOOL_ACTION viewFront;
|
||||
static TOOL_ACTION viewBack;
|
||||
static TOOL_ACTION viewLeft;
|
||||
static TOOL_ACTION viewRight;
|
||||
static TOOL_ACTION viewTop;
|
||||
static TOOL_ACTION viewBottom;
|
||||
|
||||
static TOOL_ACTION rotate45axisZ;
|
||||
static TOOL_ACTION zoomIn;
|
||||
static TOOL_ACTION zoomOut;
|
||||
static TOOL_ACTION attributesTHT;
|
||||
static TOOL_ACTION attributesSMD;
|
||||
static TOOL_ACTION attributesVirtual;
|
||||
|
||||
///> @copydoc COMMON_ACTIONS::TranslateLegacyId()
|
||||
virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override { return OPT<TOOL_EVENT>(); }
|
||||
};
|
||||
|
||||
#endif
|
|
@ -24,273 +24,368 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file 3d_menubar.cpp
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
|
||||
#include <tool/conditional_menu.h>
|
||||
#include <eda_3d_viewer.h>
|
||||
#include <3d_canvas/cinfo3d_visu.h>
|
||||
#include <menus_helpers.h>
|
||||
#include <3d_viewer_id.h>
|
||||
#include <3d_actions.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tool/conditional_menu.h>
|
||||
#include <tool/common_control.h>
|
||||
#include "help_common_strings.h"
|
||||
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::pivotCenter( "3DViewer.Control.pivotCenter", AS_GLOBAL,
|
||||
' ', "", "Center pivot rotation (Middle mouse click)" );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::moveLeft( "3DViewer.Control.moveLeft", AS_GLOBAL,
|
||||
WXK_LEFT, "", "Move board Left" );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::moveRight( "3DViewer.Control.moveRight", AS_GLOBAL,
|
||||
WXK_RIGHT, "", "Move board Right" );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::moveUp( "3DViewer.Control.moveUp", AS_GLOBAL,
|
||||
WXK_UP, "", "Move board Up" );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::moveDown( "3DViewer.Control.moveDown", AS_GLOBAL,
|
||||
WXK_DOWN, "", "Move board Down" );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::homeView( "3DViewer.Control.homeView", AS_GLOBAL,
|
||||
WXK_HOME, "", "Home view" );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::resetView( "3DViewer.Control.resetView", AS_GLOBAL,
|
||||
'R', "", "Reset view" );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::viewFront( "3DViewer.Control.viewFront", AS_GLOBAL,
|
||||
'Y', "", "View Front" );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::viewBack( "3DViewer.Control.viewBack", AS_GLOBAL,
|
||||
MD_SHIFT + 'Y', "", "View Back" );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::viewLeft( "3DViewer.Control.viewLeft", AS_GLOBAL,
|
||||
MD_SHIFT + 'X', "", "View Left" );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::viewRight( "3DViewer.Control.viewRight", AS_GLOBAL,
|
||||
'X', "", "View Right" );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::viewTop( "3DViewer.Control.viewTop", AS_GLOBAL,
|
||||
'Z', "", "View Top" );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::viewBottom( "3DViewer.Control.viewBottom", AS_GLOBAL,
|
||||
MD_SHIFT + 'Z', "", "View Bottom" );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::rotate45axisZ( "3DViewer.Control.rotate45axisZ", AS_GLOBAL,
|
||||
WXK_TAB, "", "Rotate 45 degrees over Z axis" );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::zoomIn( "3DViewer.Control.zoomIn", AS_GLOBAL,
|
||||
WXK_F1, "", "Zoom in " );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::zoomOut( "3DViewer.Control.zoomOut", AS_GLOBAL,
|
||||
WXK_F2, "", "Zoom out" );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::attributesTHT( "3DViewer.Control.attributesTHT", AS_GLOBAL,
|
||||
'T', "", "Toggle 3D models with type Through Hole" );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::attributesSMD( "3DViewer.Control.attributesSMD", AS_GLOBAL,
|
||||
'S', "", "Toggle 3D models with type Surface Mount" );
|
||||
|
||||
TOOL_ACTION EDA_3D_ACTIONS::attributesVirtual( "3DViewer.Control.attributesVirtual", AS_GLOBAL,
|
||||
'V', "", "Toggle 3D models with type Virtual" );
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::CreateMenuBar()
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::CreateMenuBar" );
|
||||
|
||||
COMMON_CONTROL* tool = m_toolManager->GetTool<COMMON_CONTROL>();
|
||||
wxMenuBar* menuBar = new wxMenuBar;
|
||||
wxMenu* fileMenu = new wxMenu;
|
||||
wxMenu* editMenu = new wxMenu;
|
||||
wxMenu* viewMenu = new wxMenu;
|
||||
wxMenu* prefsMenu = new wxMenu;
|
||||
|
||||
menuBar->Append( fileMenu, _( "&File" ) );
|
||||
|
||||
AddMenuItem( fileMenu, ID_MENU_SCREENCOPY_PNG,
|
||||
_( "Export Current View as PNG..." ),
|
||||
KiBitmap( export_xpm ) );
|
||||
//-- File menu -----------------------------------------------------------
|
||||
//
|
||||
CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, tool );
|
||||
|
||||
AddMenuItem( fileMenu, ID_MENU_SCREENCOPY_JPEG,
|
||||
_( "Export Current View as JPEG..." ),
|
||||
KiBitmap( export_xpm ) );
|
||||
fileMenu->AddItem( ID_MENU_SCREENCOPY_PNG, _( "Export Current View as PNG..." ), "",
|
||||
export_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
fileMenu->AppendSeparator();
|
||||
AddMenuItem( fileMenu, wxID_EXIT,
|
||||
_( "&Exit" ),
|
||||
KiBitmap( exit_xpm ) );
|
||||
fileMenu->AddItem( ID_MENU_SCREENCOPY_JPEG, _( "Export Current View as JPEG..." ), "",
|
||||
export_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
menuBar->Append( editMenu, _( "&Edit" ) );
|
||||
fileMenu->AddSeparator();
|
||||
// Don't use ACTIONS::quit; wxWidgets moves this on OSX and expects to find it via wxID_EXIT
|
||||
fileMenu->AddItem( wxID_EXIT, _( "Quit" ), "", exit_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
AddMenuItem( editMenu, ID_TOOL_SCREENCOPY_TOCLIBBOARD,
|
||||
_( "Copy 3D Image" ),
|
||||
KiBitmap( copy_xpm ) );
|
||||
//-- Edit menu -------------------------------------------------------
|
||||
//
|
||||
CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, tool );
|
||||
|
||||
menuBar->Append( viewMenu, _( "&View" ) );
|
||||
editMenu->AddItem( ID_TOOL_SCREENCOPY_TOCLIBBOARD, _( "Copy 3D Image" ), "",
|
||||
copy_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
AddMenuItem( viewMenu, ID_ZOOM_IN,
|
||||
_( "Zoom &In" ), HELP_ZOOM_IN,
|
||||
KiBitmap( zoom_in_xpm ) );
|
||||
//-- View menu -------------------------------------------------------
|
||||
//
|
||||
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, tool );
|
||||
|
||||
AddMenuItem( viewMenu, ID_ZOOM_OUT,
|
||||
_( "Zoom &Out" ), HELP_ZOOM_OUT,
|
||||
KiBitmap( zoom_out_xpm ) );
|
||||
viewMenu->AddItem( ID_ZOOM_IN, _( "Zoom In\tF1" ), HELP_ZOOM_IN,
|
||||
zoom_in_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
AddMenuItem( viewMenu, ID_ZOOM_PAGE,
|
||||
_( "Zoom to &Fit" ), HELP_ZOOM_FIT,
|
||||
KiBitmap( zoom_fit_in_page_xpm ) );
|
||||
viewMenu->AddItem( ID_ZOOM_OUT, _( "Zoom Out\tF2" ), HELP_ZOOM_OUT,
|
||||
zoom_out_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
AddMenuItem( viewMenu, ID_ZOOM_REDRAW,
|
||||
_( "&Redraw" ), HELP_ZOOM_REDRAW,
|
||||
KiBitmap( zoom_redraw_xpm ) );
|
||||
viewMenu->AddItem( ID_ZOOM_PAGE, _( "Zoom to Fit" ), HELP_ZOOM_FIT,
|
||||
zoom_fit_in_page_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
viewMenu->AddItem( ID_ZOOM_REDRAW, _( "Redraw\tR" ), HELP_ZOOM_REDRAW,
|
||||
zoom_redraw_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
viewMenu->AddSeparator();
|
||||
viewMenu->AddItem( ID_ROTATE3D_X_NEG, _( "Rotate X Clockwise\tShift+X" ), "",
|
||||
rotate_neg_x_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
viewMenu->AddItem( ID_ROTATE3D_X_POS, _( "Rotate X Counterclockwise\tX" ), "",
|
||||
rotate_pos_x_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
viewMenu->AddSeparator();
|
||||
viewMenu->AddItem( ID_ROTATE3D_Y_NEG, _( "Rotate Y Clockwise\tShift+Y" ), "",
|
||||
rotate_neg_y_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
viewMenu->AddItem( ID_ROTATE3D_Y_POS, _( "Rotate Y Counterclockwise\tY" ), "",
|
||||
rotate_pos_y_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
viewMenu->AddSeparator();
|
||||
viewMenu->AddItem( ID_ROTATE3D_Z_NEG, _( "Rotate Z Clockwise\tShift+Z" ), "",
|
||||
rotate_neg_z_xpm, SELECTION_CONDITIONS::ShowAlways );;
|
||||
|
||||
viewMenu->AddItem( ID_ROTATE3D_Z_POS, _( "Rotate Z Counterclockwise\tZ" ), "",
|
||||
rotate_pos_z_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
viewMenu->AppendSeparator();
|
||||
viewMenu->AddItem( ID_MOVE3D_LEFT, _( "Move Left\tLeft" ), "",
|
||||
left_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
AddMenuItem( viewMenu, ID_ROTATE3D_X_NEG,
|
||||
_( "Rotate X Clockwise" ),
|
||||
KiBitmap( rotate_neg_x_xpm ) );
|
||||
viewMenu->AddItem( ID_MOVE3D_RIGHT, _( "Move Right\tRight" ), "",
|
||||
right_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
AddMenuItem( viewMenu, ID_ROTATE3D_X_POS,
|
||||
_( "Rotate X Counterclockwise" ),
|
||||
KiBitmap( rotate_pos_x_xpm ) );
|
||||
viewMenu->AddItem( ID_MOVE3D_UP, _( "Move Up\tUp" ), "",
|
||||
up_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
viewMenu->AppendSeparator();
|
||||
viewMenu->AddItem( ID_MOVE3D_DOWN, _( "Move Down\tDown" ), "",
|
||||
down_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
AddMenuItem( viewMenu, ID_ROTATE3D_Y_NEG,
|
||||
_( "Rotate Y Clockwise" ),
|
||||
KiBitmap( rotate_neg_y_xpm ) );
|
||||
viewMenu->Resolve();
|
||||
|
||||
AddMenuItem( viewMenu, ID_ROTATE3D_Y_POS,
|
||||
_( "Rotate Y Counterclockwise" ),
|
||||
KiBitmap( rotate_pos_y_xpm ) );
|
||||
//-- Preferences menu -----------------------------------------------
|
||||
//
|
||||
CONDITIONAL_MENU* prefsMenu = new CONDITIONAL_MENU( false, tool );
|
||||
|
||||
viewMenu->AppendSeparator();
|
||||
auto raytracingCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return m_settings.RenderEngineGet() != RENDER_ENGINE_OPENGL_LEGACY;
|
||||
};
|
||||
auto NormalModeCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return m_settings.MaterialModeGet() == MATERIAL_MODE_NORMAL;
|
||||
};
|
||||
auto DiffuseModeCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return m_settings.MaterialModeGet() == MATERIAL_MODE_DIFFUSE_ONLY;
|
||||
};
|
||||
auto CADModeCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return m_settings.MaterialModeGet() == MATERIAL_MODE_CAD_MODE;
|
||||
};
|
||||
auto copperThicknessCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return m_settings.GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS );
|
||||
};
|
||||
auto boundingBoxesCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return m_settings.GetFlag( FL_RENDER_OPENGL_SHOW_MODEL_BBOX );
|
||||
};
|
||||
auto renderShadowsCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return m_settings.GetFlag( FL_RENDER_RAYTRACING_SHADOWS );
|
||||
};
|
||||
auto proceduralTexturesCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return m_settings.GetFlag( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES );
|
||||
};
|
||||
auto showFloorCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return m_settings.GetFlag( FL_RENDER_RAYTRACING_BACKFLOOR );
|
||||
};
|
||||
auto useRefractionsCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return m_settings.GetFlag( FL_RENDER_RAYTRACING_REFRACTIONS );
|
||||
};
|
||||
auto useReflectionsCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return m_settings.GetFlag( FL_RENDER_RAYTRACING_REFLECTIONS );
|
||||
};
|
||||
auto antiAliasingCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return m_settings.GetFlag( FL_RENDER_RAYTRACING_ANTI_ALIASING );
|
||||
};
|
||||
auto postProcessCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return m_settings.GetFlag( FL_RENDER_RAYTRACING_POST_PROCESSING );
|
||||
};
|
||||
auto showAxesCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return m_settings.GetFlag( FL_AXIS );
|
||||
};
|
||||
|
||||
prefsMenu->AddItem( ID_TOOL_SET_VISIBLE_ITEMS, _( "Display Options" ), "",
|
||||
read_setup_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
AddMenuItem( viewMenu, ID_ROTATE3D_Z_NEG,
|
||||
_( "Rotate Z Clockwise" ),
|
||||
KiBitmap( rotate_neg_z_xpm ) );
|
||||
prefsMenu->AddCheckItem( ID_RENDER_CURRENT_VIEW, _( "Raytracing" ), "",
|
||||
tools_xpm, raytracingCondition );
|
||||
|
||||
AddMenuItem( viewMenu, ID_ROTATE3D_Z_POS,
|
||||
_( "Rotate Z Counterclockwise" ),
|
||||
KiBitmap( rotate_pos_z_xpm ) );
|
||||
// Render options submenu
|
||||
CONDITIONAL_MENU* optsSubmenu = new CONDITIONAL_MENU( false, tool );
|
||||
optsSubmenu->SetTitle( _( "Render Options" ) );
|
||||
optsSubmenu->SetIcon( options_3drender_xpm );
|
||||
|
||||
viewMenu->AppendSeparator();
|
||||
// Material properties submenu
|
||||
CONDITIONAL_MENU* propsSubmenu = new CONDITIONAL_MENU( false, tool );
|
||||
propsSubmenu->SetTitle( _( "Material Properties" ) );
|
||||
propsSubmenu->SetIcon( color_materials_xpm );
|
||||
|
||||
AddMenuItem( viewMenu, ID_MOVE3D_LEFT,
|
||||
_( "Move left" ),
|
||||
KiBitmap( left_xpm ) );
|
||||
propsSubmenu->AddCheckItem( ID_MENU3D_FL_RENDER_MATERIAL_MODE_NORMAL,
|
||||
_( "Use All Properties" ),
|
||||
_( "Use all material properties from each 3D model file" ),
|
||||
nullptr, NormalModeCondition );
|
||||
|
||||
AddMenuItem( viewMenu, ID_MOVE3D_RIGHT,
|
||||
_( "Move right" ),
|
||||
KiBitmap( right_xpm ) );
|
||||
propsSubmenu->AddCheckItem( ID_MENU3D_FL_RENDER_MATERIAL_MODE_DIFFUSE_ONLY,
|
||||
_( "Use Diffuse Only" ),
|
||||
_( "Use only the diffuse color property from model 3D model file" ),
|
||||
nullptr, DiffuseModeCondition );
|
||||
|
||||
AddMenuItem( viewMenu, ID_MOVE3D_UP,
|
||||
_( "Move up" ),
|
||||
KiBitmap( up_xpm ) );
|
||||
propsSubmenu->AddCheckItem( ID_MENU3D_FL_RENDER_MATERIAL_MODE_CAD_MODE,
|
||||
_( "CAD Color Style" ),
|
||||
_( "Use a CAD color style based on the diffuse color of the material" ),
|
||||
nullptr, CADModeCondition );
|
||||
|
||||
AddMenuItem( viewMenu, ID_MOVE3D_DOWN,
|
||||
_( "Move down" ),
|
||||
KiBitmap( down_xpm ) );
|
||||
optsSubmenu->AddMenu( propsSubmenu, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
menuBar->Append( prefsMenu, _( "&Preferences" ) );
|
||||
optsSubmenu->AddCheckItem( ID_MENU3D_FL_OPENGL_RENDER_COPPER_THICKNESS,
|
||||
_( "Show Copper Thickness" ),
|
||||
_( "Shows the copper thickness on copper layers (slower loading)" ),
|
||||
use_3D_copper_thickness_xpm, copperThicknessCondition );
|
||||
|
||||
AddMenuItem( prefsMenu, ID_TOOL_SET_VISIBLE_ITEMS,
|
||||
_( "Display Options" ),
|
||||
KiBitmap( read_setup_xpm ) );
|
||||
optsSubmenu->AddCheckItem( ID_MENU3D_FL_OPENGL_RENDER_SHOW_MODEL_BBOX,
|
||||
_( "Show Model Bounding Boxes" ), "",
|
||||
ortho_xpm, boundingBoxesCondition );
|
||||
|
||||
prefsMenu->AppendCheckItem( ID_RENDER_CURRENT_VIEW, _( "Raytracing" ) );
|
||||
prefsMenu->Check( ID_RENDER_CURRENT_VIEW,
|
||||
m_settings.RenderEngineGet() != RENDER_ENGINE_OPENGL_LEGACY );
|
||||
// Raytracing submenu
|
||||
CONDITIONAL_MENU* raySubmenu = new CONDITIONAL_MENU( false, tool );
|
||||
raySubmenu->SetTitle( _( "Raytracing Options" ) );
|
||||
raySubmenu->SetIcon( tools_xpm );
|
||||
|
||||
wxMenu * renderOptionsMenu = new wxMenu;
|
||||
AddMenuItem( prefsMenu, renderOptionsMenu, ID_MENU3D_FL,
|
||||
_( "Render Options" ), KiBitmap( options_3drender_xpm ) );
|
||||
raySubmenu->AddCheckItem( ID_MENU3D_FL_RAYTRACING_RENDER_SHADOWS,
|
||||
_( "Render Shadows" ), "",
|
||||
green_xpm, renderShadowsCondition );
|
||||
|
||||
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,
|
||||
raySubmenu->AddCheckItem( ID_MENU3D_FL_RAYTRACING_PROCEDURAL_TEXTURES,
|
||||
_( "Procedural Textures" ),
|
||||
_( "Apply procedural textures to materials (slow)"),
|
||||
KiBitmap( green_xpm ), wxITEM_CHECK );
|
||||
green_xpm, proceduralTexturesCondition );
|
||||
|
||||
AddMenuItem( renderOptionsMenu_RAYTRACING, ID_MENU3D_FL_RAYTRACING_BACKFLOOR,
|
||||
raySubmenu->AddCheckItem( ID_MENU3D_FL_RAYTRACING_BACKFLOOR,
|
||||
_( "Add Floor" ),
|
||||
_( "Adds a floor plane below the board (slow)"),
|
||||
KiBitmap( green_xpm ), wxITEM_CHECK );
|
||||
green_xpm, showFloorCondition );
|
||||
|
||||
AddMenuItem( renderOptionsMenu_RAYTRACING, ID_MENU3D_FL_RAYTRACING_REFRACTIONS,
|
||||
raySubmenu->AddCheckItem( ID_MENU3D_FL_RAYTRACING_REFRACTIONS,
|
||||
_( "Refractions" ),
|
||||
_( "Render materials with refractions properties on final render (slow)"),
|
||||
KiBitmap( green_xpm ), wxITEM_CHECK );
|
||||
green_xpm, useRefractionsCondition );
|
||||
|
||||
AddMenuItem( renderOptionsMenu_RAYTRACING, ID_MENU3D_FL_RAYTRACING_REFLECTIONS,
|
||||
raySubmenu->AddCheckItem( ID_MENU3D_FL_RAYTRACING_REFLECTIONS,
|
||||
_( "Reflections" ),
|
||||
_( "Render materials with reflections properties on final render (slow)"),
|
||||
KiBitmap( green_xpm ), wxITEM_CHECK );
|
||||
green_xpm, useReflectionsCondition );
|
||||
|
||||
AddMenuItem( renderOptionsMenu_RAYTRACING, ID_MENU3D_FL_RAYTRACING_ANTI_ALIASING,
|
||||
raySubmenu->AddCheckItem( ID_MENU3D_FL_RAYTRACING_ANTI_ALIASING,
|
||||
_( "Anti-aliasing" ),
|
||||
_( "Render with improved quality on final render (slow)"),
|
||||
KiBitmap( green_xpm ), wxITEM_CHECK );
|
||||
green_xpm, antiAliasingCondition );
|
||||
|
||||
AddMenuItem( renderOptionsMenu_RAYTRACING, ID_MENU3D_FL_RAYTRACING_POST_PROCESSING,
|
||||
raySubmenu->AddCheckItem( 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 );
|
||||
green_xpm, postProcessCondition );
|
||||
|
||||
optsSubmenu->AddMenu( raySubmenu, SELECTION_CONDITIONS::ShowAlways );
|
||||
prefsMenu->AddMenu( optsSubmenu, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
prefsMenu->AddSeparator();
|
||||
|
||||
// Color submenu
|
||||
CONDITIONAL_MENU* colorSubmenu = new CONDITIONAL_MENU( false, tool );
|
||||
colorSubmenu->SetTitle( _( "Choose Colors" ) );
|
||||
colorSubmenu->SetIcon( palette_xpm );
|
||||
|
||||
colorSubmenu->AddItem( ID_MENU3D_BGCOLOR_TOP, _( "Background Top Color..." ), "",
|
||||
setcolor_3d_bg_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
colorSubmenu->AddItem( ID_MENU3D_BGCOLOR_BOTTOM, _( "Background Bottom Color..." ), "",
|
||||
setcolor_3d_bg_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
colorSubmenu->AddItem( ID_MENU3D_SILKSCREEN_COLOR, _( "Silkscreen Color..." ), "",
|
||||
setcolor_silkscreen_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
colorSubmenu->AddItem( ID_MENU3D_SOLDERMASK_COLOR, _( "Solder Mask Color..." ), "",
|
||||
setcolor_soldermask_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
colorSubmenu->AddItem( ID_MENU3D_SOLDERPASTE_COLOR, _( "Solder Paste Color..." ), "",
|
||||
setcolor_solderpaste_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
colorSubmenu->AddItem( ID_MENU3D_COPPER_COLOR, _( "Copper/Surface Finish Color..." ), "",
|
||||
setcolor_copper_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
colorSubmenu->AddItem( ID_MENU3D_PCB_BODY_COLOR, _( "Board Body Color..." ), "",
|
||||
setcolor_board_body_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
prefsMenu->AddMenu( colorSubmenu );
|
||||
|
||||
prefsMenu->AddCheckItem( ID_MENU3D_AXIS_ONOFF, _( "Show 3D &Axis" ), "",
|
||||
axis3d_front_xpm, showAxesCondition );
|
||||
|
||||
// Grid submenu
|
||||
CONDITIONAL_MENU* gridSubmenu = new CONDITIONAL_MENU( false, tool );
|
||||
gridSubmenu->SetTitle( _( "3D Grid" ) );
|
||||
gridSubmenu->SetIcon( grid_xpm );
|
||||
|
||||
auto noGridCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return m_settings.GridGet() == GRID3D_NONE;
|
||||
};
|
||||
auto grid10mmCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return m_settings.GridGet() == GRID3D_10MM;
|
||||
};
|
||||
auto grid5mmCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return m_settings.GridGet() == GRID3D_5MM;
|
||||
};
|
||||
auto grid2p5mmCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return m_settings.GridGet() == GRID3D_2P5MM;
|
||||
};
|
||||
auto grid_1mmCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return m_settings.GridGet() == GRID3D_1MM;
|
||||
};
|
||||
|
||||
gridSubmenu->AddItem( ID_MENU3D_GRID_NOGRID, _( "No 3D Grid" ), "",
|
||||
nullptr, noGridCondition );
|
||||
gridSubmenu->AddItem( ID_MENU3D_GRID_10_MM, _( "3D Grid 10mm" ), "",
|
||||
nullptr, grid10mmCondition );
|
||||
gridSubmenu->AddItem( ID_MENU3D_GRID_5_MM, _( "3D Grid 5mm" ), "",
|
||||
nullptr, grid5mmCondition );
|
||||
gridSubmenu->AddItem( ID_MENU3D_GRID_2P5_MM, _( "3D Grid 2.5mm" ), "",
|
||||
nullptr, grid2p5mmCondition );
|
||||
gridSubmenu->AddItem( ID_MENU3D_GRID_1_MM, _( "3D Grid 1mm" ), "",
|
||||
nullptr, grid_1mmCondition );
|
||||
|
||||
prefsMenu->AddMenu( gridSubmenu, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
prefsMenu->AppendSeparator();
|
||||
prefsMenu->AddItem( ID_MENU3D_RESET_DEFAULTS, _( "Reset to Default Settings" ), "",
|
||||
tools_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
|
||||
// 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 );
|
||||
|
||||
// Reset options
|
||||
// /////////////////////////////////////////////////////////////////////////
|
||||
prefsMenu->AppendSeparator();
|
||||
|
||||
AddMenuItem( prefsMenu, ID_MENU3D_RESET_DEFAULTS,
|
||||
_( "Reset to Default Settings" ),
|
||||
KiBitmap( tools_xpm ) );
|
||||
|
||||
prefsMenu->Resolve();
|
||||
|
||||
//-- Menubar -------------------------------------------------------------
|
||||
//
|
||||
menuBar->Append( fileMenu, _( "&File" ) );
|
||||
menuBar->Append( editMenu, _( "&Edit" ) );
|
||||
menuBar->Append( viewMenu, _( "&View" ) );
|
||||
menuBar->Append( prefsMenu, _( "&Preferences" ) );
|
||||
AddStandardHelpMenu( menuBar );
|
||||
|
||||
SetMenuBar( menuBar );
|
||||
|
|
|
@ -31,14 +31,15 @@
|
|||
|
||||
#include "../3d_viewer_id.h"
|
||||
#include "../common_ogl/cogl_att_list.h"
|
||||
|
||||
#include <3d_actions.h>
|
||||
#include <bitmaps.h>
|
||||
#include <dpi_scaling.h>
|
||||
#include <gestfich.h>
|
||||
#include <pgm_base.h>
|
||||
#include <project.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tool/common_control.h>
|
||||
#include <hotkeys_basic.h>
|
||||
#include <wx/colordlg.h>
|
||||
#include <wx/colourdata.h>
|
||||
|
@ -137,19 +138,6 @@ BEGIN_EVENT_TABLE( EDA_3D_VIEWER, EDA_BASE_FRAME )
|
|||
EVT_MENU_RANGE( ID_MENU3D_GRID, ID_MENU3D_GRID_END, EDA_3D_VIEWER::On3DGridSelection )
|
||||
|
||||
EVT_CLOSE( EDA_3D_VIEWER::OnCloseWindow )
|
||||
|
||||
EVT_UPDATE_UI_RANGE( ID_MENU3D_FL_RENDER_MATERIAL_MODE_NORMAL,
|
||||
ID_MENU3D_FL_RENDER_MATERIAL_MODE_CAD_MODE,
|
||||
EDA_3D_VIEWER::OnUpdateUIMaterial )
|
||||
EVT_UPDATE_UI_RANGE( ID_MENU3D_FL_OPENGL_RENDER_COPPER_THICKNESS,
|
||||
ID_MENU3D_FL_OPENGL_RENDER_SHOW_MODEL_BBOX,
|
||||
EDA_3D_VIEWER::OnUpdateUIOpenGL )
|
||||
EVT_UPDATE_UI_RANGE( ID_MENU3D_FL_RAYTRACING_RENDER_SHADOWS,
|
||||
ID_MENU3D_FL_RAYTRACING_PROCEDURAL_TEXTURES,
|
||||
EDA_3D_VIEWER::OnUpdateUIRayTracing )
|
||||
|
||||
EVT_UPDATE_UI( ID_RENDER_CURRENT_VIEW, EDA_3D_VIEWER::OnUpdateUIEngine )
|
||||
EVT_UPDATE_UI( ID_MENU3D_AXIS_ONOFF, EDA_3D_VIEWER::OnUpdateUIAxis )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
|
@ -192,6 +180,15 @@ EDA_3D_VIEWER::EDA_3D_VIEWER( KIWAY *aKiway, PCB_BASE_FRAME *aParent,
|
|||
// Some settings need the canvas
|
||||
loadCommonSettings();
|
||||
|
||||
// Create the manager
|
||||
m_toolManager = new TOOL_MANAGER;
|
||||
m_toolManager->SetEnvironment( nullptr, nullptr, nullptr, this );
|
||||
|
||||
// Register tools
|
||||
m_toolManager->RegisterTool( new COMMON_CONTROL );
|
||||
m_actions = new EDA_3D_ACTIONS();
|
||||
m_toolManager->InitTools();
|
||||
|
||||
CreateMenuBar();
|
||||
ReCreateMainToolbar();
|
||||
|
||||
|
@ -375,7 +372,7 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
|
|||
takeScreenshot( event );
|
||||
return;
|
||||
|
||||
case ID_MENU3D_BGCOLOR_BOTTOM_SELECTION:
|
||||
case ID_MENU3D_BGCOLOR_BOTTOM:
|
||||
if( Set3DColorFromUser( m_settings.m_BgColorBot, _( "Background Color, Bottom" ),
|
||||
nullptr ) )
|
||||
{
|
||||
|
@ -386,7 +383,7 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
|
|||
}
|
||||
return;
|
||||
|
||||
case ID_MENU3D_BGCOLOR_TOP_SELECTION:
|
||||
case ID_MENU3D_BGCOLOR_TOP:
|
||||
if( Set3DColorFromUser( m_settings.m_BgColorTop, _( "Background Color, Top" ), nullptr ) )
|
||||
{
|
||||
if( m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY )
|
||||
|
@ -396,23 +393,23 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
|
|||
}
|
||||
return;
|
||||
|
||||
case ID_MENU3D_SILKSCREEN_COLOR_SELECTION:
|
||||
case ID_MENU3D_SILKSCREEN_COLOR:
|
||||
Set3DSilkScreenColorFromUser();
|
||||
return;
|
||||
|
||||
case ID_MENU3D_SOLDERMASK_COLOR_SELECTION:
|
||||
case ID_MENU3D_SOLDERMASK_COLOR:
|
||||
Set3DSolderMaskColorFromUser();
|
||||
return;
|
||||
|
||||
case ID_MENU3D_SOLDERPASTE_COLOR_SELECTION:
|
||||
case ID_MENU3D_SOLDERPASTE_COLOR:
|
||||
Set3DSolderPasteColorFromUser();
|
||||
return;
|
||||
|
||||
case ID_MENU3D_COPPER_COLOR_SELECTION:
|
||||
case ID_MENU3D_COPPER_COLOR:
|
||||
Set3DCopperColorFromUser();
|
||||
break;
|
||||
|
||||
case ID_MENU3D_PCB_BODY_COLOR_SELECTION:
|
||||
case ID_MENU3D_PCB_BODY_COLOR:
|
||||
Set3DBoardBodyColorFromUser();
|
||||
break;
|
||||
|
||||
|
@ -555,12 +552,6 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
|
|||
}
|
||||
return;
|
||||
|
||||
case ID_MENU3D_HELP_HOTKEY_SHOW_CURRENT_LIST:
|
||||
{
|
||||
DisplayHotKeys();
|
||||
}
|
||||
return;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( "Invalid event in EDA_3D_VIEWER::Process_Special_Functions()" );
|
||||
return;
|
||||
|
@ -579,29 +570,13 @@ void EDA_3D_VIEWER::On3DGridSelection( wxCommandEvent &event )
|
|||
|
||||
switch( id )
|
||||
{
|
||||
case ID_MENU3D_GRID_NOGRID:
|
||||
m_settings.GridSet( GRID3D_NONE );
|
||||
break;
|
||||
case ID_MENU3D_GRID_NOGRID: m_settings.GridSet( GRID3D_NONE ); break;
|
||||
case ID_MENU3D_GRID_10_MM: m_settings.GridSet( GRID3D_10MM ); break;
|
||||
case ID_MENU3D_GRID_5_MM: m_settings.GridSet( GRID3D_5MM ); break;
|
||||
case ID_MENU3D_GRID_2P5_MM: m_settings.GridSet( GRID3D_2P5MM ); break;
|
||||
case ID_MENU3D_GRID_1_MM: m_settings.GridSet( GRID3D_1MM ); break;
|
||||
|
||||
case ID_MENU3D_GRID_10_MM:
|
||||
m_settings.GridSet( GRID3D_10MM );
|
||||
break;
|
||||
|
||||
case ID_MENU3D_GRID_5_MM:
|
||||
m_settings.GridSet( GRID3D_5MM );
|
||||
break;
|
||||
|
||||
case ID_MENU3D_GRID_2P5_MM:
|
||||
m_settings.GridSet( GRID3D_2P5MM );
|
||||
break;
|
||||
|
||||
case ID_MENU3D_GRID_1_MM:
|
||||
m_settings.GridSet( GRID3D_1MM );
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( "Invalid event in EDA_3D_VIEWER::On3DGridSelection()" );
|
||||
return;
|
||||
default: wxFAIL_MSG( "Invalid event in EDA_3D_VIEWER::On3DGridSelection()" );
|
||||
}
|
||||
|
||||
if( m_canvas )
|
||||
|
@ -640,25 +615,11 @@ void EDA_3D_VIEWER::ProcessZoom( wxCommandEvent &event )
|
|||
|
||||
switch( id )
|
||||
{
|
||||
case ID_ZOOM_PAGE:
|
||||
m_canvas->SetView3D( WXK_HOME );
|
||||
break;
|
||||
|
||||
case ID_ZOOM_IN:
|
||||
m_canvas->SetView3D( WXK_F1 );
|
||||
break;
|
||||
|
||||
case ID_ZOOM_OUT:
|
||||
m_canvas->SetView3D( WXK_F2 );
|
||||
break;
|
||||
|
||||
case ID_ZOOM_REDRAW:
|
||||
m_canvas->Request_refresh();
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( "Invalid event in EDA_3D_VIEWER::ProcessZoom()" );
|
||||
return;
|
||||
case ID_ZOOM_PAGE: m_canvas->SetView3D( WXK_HOME ); break;
|
||||
case ID_ZOOM_IN: m_canvas->SetView3D( WXK_F1 ); break;
|
||||
case ID_ZOOM_OUT: m_canvas->SetView3D( WXK_F2 ); break;
|
||||
case ID_ZOOM_REDRAW: m_canvas->Request_refresh(); break;
|
||||
default: wxFAIL_MSG( "Invalid event in EDA_3D_VIEWER::ProcessZoom()" );
|
||||
}
|
||||
|
||||
m_canvas->DisplayStatus();
|
||||
|
@ -1042,215 +1003,107 @@ bool EDA_3D_VIEWER::Set3DColorFromUser( SFVEC3D &aColor, const wxString& aTitle,
|
|||
|
||||
bool EDA_3D_VIEWER::Set3DSilkScreenColorFromUser()
|
||||
{
|
||||
CUSTOM_COLORS_LIST definedColors;
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 241.0/255.0, 241.0/255.0, 241.0/255.0, "White" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 4.0/255.0, 18.0/255.0, 21.0/255.0, "Dark" ) );
|
||||
CUSTOM_COLORS_LIST colors;
|
||||
|
||||
bool change = Set3DColorFromUser( m_settings.m_SilkScreenColor,
|
||||
_( "Solder Mask Color" ), &definedColors );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 241.0/255.0, 241.0/255.0, 241.0/255.0, "White" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 4.0/255.0, 18.0/255.0, 21.0/255.0, "Dark" ) );
|
||||
|
||||
if( change )
|
||||
if( Set3DColorFromUser( m_settings.m_SilkScreenColor, _( "Silkscreen Color" ), &colors ) )
|
||||
{
|
||||
NewDisplay( true );
|
||||
return true;
|
||||
}
|
||||
|
||||
return change;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool EDA_3D_VIEWER::Set3DSolderMaskColorFromUser()
|
||||
{
|
||||
CUSTOM_COLORS_LIST definedColors;
|
||||
CUSTOM_COLORS_LIST colors;
|
||||
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 20/255.0, 51/255.0, 36/255.0, "Green" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 91/255.0, 168/255.0, 12/255.0, "Light Green" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 13/255.0, 104/255.0, 11/255.0,
|
||||
"Saturated Green" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 181/255.0, 19/255.0, 21/255.0, "Red" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 239/255.0, 53/255.0, 41/255.0,
|
||||
"Red Light Orange" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 210/255.0, 40/255.0, 14/255.0, "Red 2" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 2/255.0, 59/255.0, 162/255.0, "Blue" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 54/255.0, 79/255.0, 116/255.0, "Light blue 1" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 61/255.0, 85/255.0, 130/255.0, "Light blue 2" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 21/255.0, 70/255.0, 80/255.0,
|
||||
"Green blue (dark)" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 11/255.0, 11/255.0, 11/255.0, "Black" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 245/255.0, 245/255.0, 245/255.0, "White" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 119/255.0, 31/255.0, 91/255.0, "Purple" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 32/255.0, 2/255.0, 53/255.0, "Purple Dark" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 20/255.0, 51/255.0, 36/255.0, "Green" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 91/255.0, 168/255.0, 12/255.0, "Light Green" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 13/255.0, 104/255.0, 11/255.0, "Saturated Green" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 181/255.0, 19/255.0, 21/255.0, "Red" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 239/255.0, 53/255.0, 41/255.0, "Red Light Orange" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 210/255.0, 40/255.0, 14/255.0, "Red 2" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 2/255.0, 59/255.0, 162/255.0, "Blue" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 54/255.0, 79/255.0, 116/255.0, "Light blue 1" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 61/255.0, 85/255.0, 130/255.0, "Light blue 2" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 21/255.0, 70/255.0, 80/255.0, "Green blue (dark)" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 11/255.0, 11/255.0, 11/255.0, "Black" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 245/255.0, 245/255.0, 245/255.0, "White" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 119/255.0, 31/255.0, 91/255.0, "Purple" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 32/255.0, 2/255.0, 53/255.0, "Purple Dark" ) );
|
||||
|
||||
bool change = Set3DColorFromUser( m_settings.m_SolderMaskColor,
|
||||
_( "Solder Mask Color" ),
|
||||
&definedColors );
|
||||
|
||||
if( change )
|
||||
if( Set3DColorFromUser( m_settings.m_SolderMaskColor, _( "Solder Mask Color" ), &colors ) )
|
||||
{
|
||||
NewDisplay( true );
|
||||
return true;
|
||||
}
|
||||
|
||||
return change;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool EDA_3D_VIEWER::Set3DCopperColorFromUser()
|
||||
{
|
||||
CUSTOM_COLORS_LIST definedColors;
|
||||
CUSTOM_COLORS_LIST colors;
|
||||
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 184/255.0, 115/255.0, 50/255.0, "Copper" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 178/255.0, 156/255.0, 0.0, "Gold" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 213/255.0, 213/255.0, 213/255.0, "Silver" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 160/255.0, 160/255.0, 160/255.0, "Tin" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 184/255.0, 115/255.0, 50/255.0, "Copper" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 178/255.0, 156/255.0, 0.0, "Gold" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 213/255.0, 213/255.0, 213/255.0, "Silver" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 160/255.0, 160/255.0, 160/255.0, "Tin" ) );
|
||||
|
||||
bool change = Set3DColorFromUser( m_settings.m_CopperColor, _( "Copper Color" ),
|
||||
&definedColors );
|
||||
|
||||
if( change )
|
||||
if( Set3DColorFromUser( m_settings.m_CopperColor, _( "Copper Color" ), &colors ) )
|
||||
{
|
||||
NewDisplay( true );
|
||||
return true;
|
||||
}
|
||||
|
||||
return change;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool EDA_3D_VIEWER::Set3DBoardBodyColorFromUser()
|
||||
{
|
||||
CUSTOM_COLORS_LIST definedColors;
|
||||
CUSTOM_COLORS_LIST colors;
|
||||
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 51/255.0, 43/255.0, 22/255.0,
|
||||
"FR4 natural, dark" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 109/255.0, 116/255.0, 75/255.0, "FR4 natural" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 78/255.0, 14/255.0, 5/255.0, "brown/red" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 146/255.0, 99/255.0, 47/255.0, "brown 1" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 160/255.0, 123/255.0, 54/255.0, "brown 2" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 146/255.0, 99/255.0, 47/255.0, "brown 3" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 63/255.0, 126/255.0, 71/255.0, "green 1" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 117/255.0, 122/255.0, 90/255.0, "green 2" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 51/255.0, 43/255.0, 22/255.0, "FR4 natural, dark" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 109/255.0, 116/255.0, 75/255.0, "FR4 natural" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 78/255.0, 14/255.0, 5/255.0, "brown/red" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 146/255.0, 99/255.0, 47/255.0, "brown 1" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 160/255.0, 123/255.0, 54/255.0, "brown 2" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 146/255.0, 99/255.0, 47/255.0, "brown 3" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 63/255.0, 126/255.0, 71/255.0, "green 1" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 117/255.0, 122/255.0, 90/255.0, "green 2" ) );
|
||||
|
||||
bool change = Set3DColorFromUser( m_settings.m_BoardBodyColor, _( "Board Body Color" ),
|
||||
&definedColors );
|
||||
if( change )
|
||||
if( Set3DColorFromUser( m_settings.m_BoardBodyColor, _( "Board Body Color" ), &colors ) )
|
||||
{
|
||||
NewDisplay( true );
|
||||
return true;
|
||||
}
|
||||
|
||||
return change;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool EDA_3D_VIEWER::Set3DSolderPasteColorFromUser()
|
||||
{
|
||||
CUSTOM_COLORS_LIST definedColors;
|
||||
CUSTOM_COLORS_LIST colors;
|
||||
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 128/255.0, 128/255.0, 128/255.0, "grey" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 213/255.0, 213/255.0, 213/255.0, "Silver" ) );
|
||||
definedColors.push_back( CUSTOM_COLOR_ITEM( 90/255.0, 90/255.0, 90/255.0, "grey 2" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 128/255.0, 128/255.0, 128/255.0, "grey" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 213/255.0, 213/255.0, 213/255.0, "Silver" ) );
|
||||
colors.push_back( CUSTOM_COLOR_ITEM( 90/255.0, 90/255.0, 90/255.0, "grey 2" ) );
|
||||
|
||||
bool change = Set3DColorFromUser( m_settings.m_SolderPasteColor,
|
||||
_( "Solder Paste Color" ), &definedColors );
|
||||
|
||||
if( change )
|
||||
if( Set3DColorFromUser( m_settings.m_SolderPasteColor, _( "Solder Paste Color" ), &colors ) )
|
||||
{
|
||||
NewDisplay( true );
|
||||
|
||||
return change;
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::OnUpdateUIEngine( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::OnUpdateUIEngine %s %s",
|
||||
( !m_disable_ray_tracing ) ? "enable" : "disable",
|
||||
( m_settings.RenderEngineGet() == RENDER_ENGINE_RAYTRACING ) ?
|
||||
"Ray Trace" : "OpenGL Legacy" );
|
||||
|
||||
aEvent.Enable( !m_disable_ray_tracing );
|
||||
aEvent.Check( m_settings.RenderEngineGet() != RENDER_ENGINE_OPENGL_LEGACY );
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::OnUpdateUIMaterial( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::OnUpdateUIMaterial() id %d", aEvent.GetId() );
|
||||
|
||||
// Set the state of toggle menus according to the current display options
|
||||
switch( aEvent.GetId() )
|
||||
{
|
||||
case ID_MENU3D_FL_RENDER_MATERIAL_MODE_NORMAL:
|
||||
aEvent.Check( m_settings.MaterialModeGet() == MATERIAL_MODE_NORMAL );
|
||||
break;
|
||||
|
||||
case ID_MENU3D_FL_RENDER_MATERIAL_MODE_DIFFUSE_ONLY:
|
||||
aEvent.Check( m_settings.MaterialModeGet() == MATERIAL_MODE_DIFFUSE_ONLY );
|
||||
break;
|
||||
|
||||
case ID_MENU3D_FL_RENDER_MATERIAL_MODE_CAD_MODE:
|
||||
aEvent.Check( m_settings.MaterialModeGet() == MATERIAL_MODE_CAD_MODE );
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( "Invalid event in EDA_3D_VIEWER::OnUpdateUIMaterial()" );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::OnUpdateUIOpenGL( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::OnUpdateUIOpenGL() id %d", aEvent.GetId() );
|
||||
|
||||
// OpenGL
|
||||
switch( aEvent.GetId() )
|
||||
{
|
||||
case ID_MENU3D_FL_OPENGL_RENDER_COPPER_THICKNESS:
|
||||
aEvent.Check( m_settings.GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) );
|
||||
break;
|
||||
|
||||
case ID_MENU3D_FL_OPENGL_RENDER_SHOW_MODEL_BBOX:
|
||||
aEvent.Check( m_settings.GetFlag( FL_RENDER_OPENGL_SHOW_MODEL_BBOX ) );
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( "Invalid event in EDA_3D_VIEWER::OnUpdateUIOpenGL()" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::OnUpdateUIRayTracing( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::OnUpdateUIRayTracing() id %d", aEvent.GetId() );
|
||||
|
||||
// Raytracing
|
||||
switch( aEvent.GetId() )
|
||||
{
|
||||
case ID_MENU3D_FL_RAYTRACING_RENDER_SHADOWS:
|
||||
aEvent.Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_SHADOWS ) );
|
||||
break;
|
||||
|
||||
case ID_MENU3D_FL_RAYTRACING_BACKFLOOR:
|
||||
aEvent.Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_BACKFLOOR ) );
|
||||
break;
|
||||
|
||||
case ID_MENU3D_FL_RAYTRACING_REFRACTIONS:
|
||||
aEvent.Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_REFRACTIONS ) );
|
||||
break;
|
||||
|
||||
case ID_MENU3D_FL_RAYTRACING_REFLECTIONS:
|
||||
aEvent.Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_REFLECTIONS ) );
|
||||
break;
|
||||
|
||||
case ID_MENU3D_FL_RAYTRACING_POST_PROCESSING:
|
||||
aEvent.Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_POST_PROCESSING ) );
|
||||
break;
|
||||
|
||||
case ID_MENU3D_FL_RAYTRACING_ANTI_ALIASING:
|
||||
aEvent.Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_ANTI_ALIASING ) );
|
||||
break;
|
||||
|
||||
case ID_MENU3D_FL_RAYTRACING_PROCEDURAL_TEXTURES:
|
||||
aEvent.Check( m_settings.GetFlag( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES ) );
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( "Invalid event in EDA_3D_VIEWER::OnUpdateUIMaterial()" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER::OnUpdateUIAxis( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
aEvent.Check( m_settings.GetFlag( FL_AXIS ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -90,30 +90,11 @@ class EDA_3D_VIEWER : public KIWAY_PLAYER
|
|||
*/
|
||||
void NewDisplay( bool aForceImmediateRedraw = false );
|
||||
|
||||
/**
|
||||
* Set the default file name (eg: to be suggested to a screenshot)
|
||||
* @param aFn = file name to assign
|
||||
*/
|
||||
void SetDefaultFileName( const wxString& aFn )
|
||||
{
|
||||
m_defaultSaveScreenshotFileName = aFn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the default suggested file name
|
||||
*/
|
||||
const wxFileName& GetDefaultFileName() const { return m_defaultSaveScreenshotFileName; }
|
||||
|
||||
/**
|
||||
* @return current settings
|
||||
*/
|
||||
CINFO3D_VISU &GetSettings() { return m_settings; }
|
||||
|
||||
/**
|
||||
* Return a structure containing currently used hotkey mapping.
|
||||
*/
|
||||
EDA_HOTKEY_CONFIG* GetHotkeyConfig() const;
|
||||
|
||||
/**
|
||||
* Get a SFVEC3D from a wx colour dialog
|
||||
* @param aColor is the SFVEC3D to change
|
||||
|
@ -183,12 +164,6 @@ class EDA_3D_VIEWER : public KIWAY_PLAYER
|
|||
void OnRenderEngineSelection( wxCommandEvent &event );
|
||||
void OnDisableRayTracing( wxCommandEvent& aEvent );
|
||||
|
||||
void OnUpdateUIEngine( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateUIMaterial( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateUIOpenGL( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateUIRayTracing( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateUIAxis( wxUpdateUIEvent& aEvent );
|
||||
|
||||
void ProcessZoom( wxCommandEvent &event );
|
||||
|
||||
void OnActivate( wxActivateEvent &event );
|
||||
|
@ -199,19 +174,11 @@ class EDA_3D_VIEWER : public KIWAY_PLAYER
|
|||
|
||||
void CreateMenuBar();
|
||||
|
||||
void DisplayHotKeys()
|
||||
{
|
||||
// JEY TODO: need a toolManager....
|
||||
DisplayHotkeyList( this, GetToolManager() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Equivalent of EDA_DRAW_FRAME::ReCreateHToolbar
|
||||
*/
|
||||
void ReCreateMainToolbar();
|
||||
|
||||
void SetToolbars();
|
||||
|
||||
void SaveSettings( wxConfigBase *aCfg ) override;
|
||||
|
||||
void LoadSettings( wxConfigBase *aCfg ) override;
|
||||
|
|
|
@ -1,105 +0,0 @@
|
|||
/*
|
||||
* 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( "List Hotkeys" ), wxID_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)
|
||||
static struct EDA_HOTKEY_CONFIG s_3DViewer_Hotkeys_Descr[] =
|
||||
{
|
||||
{ &g_CommonSectionTag, viewer3d_Hotkey_List, &viewer3DSectionTitle },
|
||||
{ NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
EDA_HOTKEY_CONFIG* EDA_3D_VIEWER::GetHotkeyConfig() const
|
||||
{
|
||||
return s_3DViewer_Hotkeys_Descr;
|
||||
}
|
||||
|
||||
|
||||
EDA_HOTKEY_CONFIG* EDA_3D_CANVAS::GetHotkeyConfig() const
|
||||
{
|
||||
return s_3DViewer_Hotkeys_Descr;
|
||||
}
|
|
@ -32,13 +32,13 @@ enum id_3dview_frm
|
|||
ID_ORTHO,
|
||||
ID_MENU3D_COLOR,
|
||||
ID_MENU3D_BGCOLOR,
|
||||
ID_MENU3D_BGCOLOR_BOTTOM_SELECTION,
|
||||
ID_MENU3D_BGCOLOR_TOP_SELECTION,
|
||||
ID_MENU3D_SILKSCREEN_COLOR_SELECTION,
|
||||
ID_MENU3D_SOLDERMASK_COLOR_SELECTION,
|
||||
ID_MENU3D_SOLDERPASTE_COLOR_SELECTION,
|
||||
ID_MENU3D_PCB_BODY_COLOR_SELECTION,
|
||||
ID_MENU3D_COPPER_COLOR_SELECTION,
|
||||
ID_MENU3D_BGCOLOR_BOTTOM,
|
||||
ID_MENU3D_BGCOLOR_TOP,
|
||||
ID_MENU3D_SILKSCREEN_COLOR,
|
||||
ID_MENU3D_SOLDERMASK_COLOR,
|
||||
ID_MENU3D_SOLDERPASTE_COLOR,
|
||||
ID_MENU3D_PCB_BODY_COLOR,
|
||||
ID_MENU3D_COPPER_COLOR,
|
||||
ID_MENU3D_AXIS_ONOFF,
|
||||
|
||||
ID_MENU3D_MODULE_ONOFF,
|
||||
|
@ -85,8 +85,6 @@ enum id_3dview_frm
|
|||
ID_MENU3D_RESET_DEFAULTS,
|
||||
|
||||
// Help
|
||||
ID_MENU3D_HELP_HOTKEY_SHOW_CURRENT_LIST,
|
||||
|
||||
ID_MENU_COMMAND_END,
|
||||
|
||||
ID_RENDER_CURRENT_VIEW,
|
||||
|
|
|
@ -88,7 +88,6 @@ set(3D-VIEWER_SRCS
|
|||
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
|
||||
|
|
|
@ -40,7 +40,8 @@ wxString HOTKEY_STORE::GetSectionName( TOOL_ACTION* aAction )
|
|||
{ wxT( "kicad" ), _( "Kicad Manager" ) },
|
||||
{ wxT( "eeschema" ), _( "Eeschema" ) },
|
||||
{ wxT( "pcbnew" ), _( "Pcbnew" ) },
|
||||
{ wxT( "plEditor" ), _( "Page Layout Editor" ) }
|
||||
{ wxT( "plEditor" ), _( "Page Layout Editor" ), },
|
||||
{ wxT( "3DViewer" ), _( "3D Viewer" ) }
|
||||
};
|
||||
|
||||
wxString appName = GetAppName( aAction );
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2010-2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2019 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
|
||||
|
@ -23,11 +23,6 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file hotkeys_basic.cpp
|
||||
* @brief Some functions to handle hotkeys in KiCad
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <kiface_i.h>
|
||||
#include <hotkeys_basic.h>
|
||||
|
@ -48,21 +43,8 @@
|
|||
#include <tool/tool_action.h>
|
||||
|
||||
|
||||
wxString g_CommonSectionTag( wxT( "[common]" ) );
|
||||
|
||||
|
||||
/* Class to handle hotkey commands hotkeys have a default value
|
||||
* This class allows the real key code changed by user from a key code list
|
||||
* file.
|
||||
*/
|
||||
EDA_HOTKEY::EDA_HOTKEY( const wxChar* infomsg, int idcommand, int keycode ) :
|
||||
m_KeyCode( keycode ),
|
||||
m_InfoMsg( infomsg ),
|
||||
m_Idcommand( idcommand )
|
||||
{ }
|
||||
|
||||
|
||||
/* class to handle the printable name and the keycode
|
||||
/*
|
||||
* class to handle the printable name and the keycode
|
||||
*/
|
||||
struct hotkey_name_descr
|
||||
{
|
||||
|
@ -235,88 +217,6 @@ wxString AddHotkeyName( const wxString& aText, int aHotKey, HOTKEY_ACTION_TYPE a
|
|||
}
|
||||
|
||||
|
||||
/* AddHotkeyName
|
||||
* Add the key name from the Command id value ( m_Idcommand member value)
|
||||
* aText = a wxString. returns aText + key name
|
||||
* aList = pointer to a EDA_HOTKEY_CONFIG DescrList of commands
|
||||
* aCommandId = Command Id value
|
||||
* aShortCutType = IS_HOTKEY to add <tab><keyname> (active shortcuts in menus)
|
||||
* IS_ACCELERATOR to add <tab><Shift+keyname> (active accelerators in menus)
|
||||
* IS_COMMENT to add <spaces><(keyname)>
|
||||
* Return a wxString (aText + key name) if key found or aText without modification
|
||||
*/
|
||||
wxString AddHotkeyName( const wxString& aText,
|
||||
struct EDA_HOTKEY_CONFIG* aDescList,
|
||||
int aCommandId,
|
||||
HOTKEY_ACTION_TYPE aShortCutType )
|
||||
{
|
||||
// JEY TODO: obsolete once 3DViewer and ProjectManager are moved over...
|
||||
wxString msg = aText;
|
||||
wxString keyname;
|
||||
EDA_HOTKEY** list;
|
||||
|
||||
if( aDescList )
|
||||
{
|
||||
for( ; aDescList->m_HK_InfoList != nullptr; aDescList++ )
|
||||
{
|
||||
list = aDescList->m_HK_InfoList;
|
||||
keyname = KeyNameFromCommandId( list, aCommandId );
|
||||
|
||||
if( !keyname.IsEmpty() )
|
||||
{
|
||||
switch( aShortCutType )
|
||||
{
|
||||
case IS_HOTKEY:
|
||||
msg << wxT( "\t" ) << keyname;
|
||||
break;
|
||||
|
||||
case IS_COMMENT:
|
||||
msg << wxT( " (" ) << keyname << wxT( ")" );
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USING_MAC_CMD
|
||||
// On OSX, the modifier equivalent to the Ctrl key of PCs
|
||||
// is the Cmd key, but in code we should use Ctrl as prefix in menus
|
||||
msg.Replace( MODIFIER_CMD_MAC, MODIFIER_CTRL_BASE );
|
||||
#endif
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function KeyNameFromCommandId
|
||||
* return the key name from the Command id value ( m_Idcommand member value)
|
||||
* @param aList = pointer to a EDA_HOTKEY list of commands
|
||||
* @param aCommandId = Command Id value
|
||||
* @return the key name in a wxString
|
||||
*/
|
||||
wxString KeyNameFromCommandId( EDA_HOTKEY** aList, int aCommandId )
|
||||
{
|
||||
// JEY TODO: obsolete once 3DViewer and ProjectManager are moved over...
|
||||
wxString keyname;
|
||||
|
||||
for( ; *aList != nullptr; aList++ )
|
||||
{
|
||||
EDA_HOTKEY* hk_decr = *aList;
|
||||
|
||||
if( hk_decr->m_Idcommand == aCommandId )
|
||||
{
|
||||
keyname = KeyNameFromKeyCode( hk_decr->m_KeyCode );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return keyname;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function KeyCodeFromKeyName
|
||||
* return the key code from its user-friendly key name (ie: "Ctrl+M")
|
||||
|
@ -431,7 +331,7 @@ void ReadHotKeyConfig( wxString fileName, std::map<std::string, int>& aHotKeys )
|
|||
}
|
||||
|
||||
|
||||
int WriteHotKeyConfig( std::map<std::string, TOOL_ACTION*> aActionMap )
|
||||
int WriteHotKeyConfig( const std::map<std::string, TOOL_ACTION*>& aActionMap )
|
||||
{
|
||||
std::map<std::string, int> hotkeys;
|
||||
wxFileName fn( "user" );
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
LAYER_SELECTOR::LAYER_SELECTOR()
|
||||
{
|
||||
m_layerhotkeys = true;
|
||||
m_hotkeys = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -80,8 +79,6 @@ LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id,
|
|||
wxBitmapComboBox( parent, id, wxEmptyString, pos, size, n, choices, wxCB_READONLY ),
|
||||
LAYER_SELECTOR()
|
||||
{
|
||||
m_hotkeys = NULL;
|
||||
|
||||
if( choices != NULL )
|
||||
ResyncBitmapOnly();
|
||||
|
||||
|
@ -95,8 +92,6 @@ LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id,
|
|||
wxBitmapComboBox( parent, id, wxEmptyString, pos, size, choices, wxCB_READONLY ),
|
||||
LAYER_SELECTOR()
|
||||
{
|
||||
m_hotkeys = NULL;
|
||||
|
||||
if( !choices.IsEmpty() )
|
||||
ResyncBitmapOnly();
|
||||
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2014-2018 KiCad Developers, see CHANGELOG.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
|
||||
*/
|
||||
|
||||
#ifndef HELP_MESSAGE_FILE_H
|
||||
#define HELP_MESSAGE_FILE_H
|
||||
|
||||
#define SAVE_HLP_MSG _( "Save footprint associations in schematic symbol footprint fields" )
|
||||
|
||||
#endif // HELP_MESSAGE_FILE_H
|
|
@ -36,16 +36,16 @@
|
|||
#include <netlist_reader.h>
|
||||
#include <bitmaps.h>
|
||||
#include <widgets/progress_reporter.h>
|
||||
#include <3d_cache/3d_cache.h>
|
||||
#include <dialog_configure_paths.h>
|
||||
#include <cvpcb.h>
|
||||
#include <listboxes.h>
|
||||
#include <wx/statline.h>
|
||||
#include <invoke_pcb_dialog.h>
|
||||
#include <display_footprints_frame.h>
|
||||
#include <cvpcb_id.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tool/action_toolbar.h>
|
||||
#include <cvpcb_mainframe.h>
|
||||
#include <tool/common_control.h>
|
||||
|
||||
wxSize const FRAME_MIN_SIZE_DU( 350, 250 );
|
||||
wxSize const FRAME_DEFAULT_SIZE_DU( 450, 300 );
|
||||
|
@ -102,7 +102,7 @@ END_EVENT_TABLE()
|
|||
|
||||
CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||
KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, _( "Assign Footprints" ), wxDefaultPosition,
|
||||
wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, CVPCB_MAINFRAME_NAME )
|
||||
wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, CVPCB_MAINFRAME_NAME )
|
||||
{
|
||||
m_compListBox = NULL;
|
||||
m_footprintListBox = NULL;
|
||||
|
@ -131,6 +131,14 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
// Frame size and position
|
||||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
||||
|
||||
// Create the manager
|
||||
m_toolManager = new TOOL_MANAGER;
|
||||
m_toolManager->SetEnvironment( nullptr, nullptr, nullptr, this );
|
||||
|
||||
// Register tools
|
||||
m_toolManager->RegisterTool( new COMMON_CONTROL );
|
||||
m_toolManager->InitTools();
|
||||
|
||||
ReCreateMenuBar();
|
||||
ReCreateHToolbar();
|
||||
|
||||
|
@ -941,13 +949,6 @@ void CVPCB_MAINFRAME::SetStatusText( const wxString& aText, int aNumber )
|
|||
}
|
||||
|
||||
|
||||
void CVPCB_MAINFRAME::OnConfigurePaths( wxCommandEvent& aEvent )
|
||||
{
|
||||
DIALOG_CONFIGURE_PATHS dlg( this, Prj().Get3DCacheManager()->GetResolver() );
|
||||
dlg.ShowModal();
|
||||
}
|
||||
|
||||
|
||||
void CVPCB_MAINFRAME::ShowChangedLanguage()
|
||||
{
|
||||
EDA_BASE_FRAME::ShowChangedLanguage();
|
||||
|
|
|
@ -22,10 +22,6 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file cvpcb_mainframe.h
|
||||
*/
|
||||
|
||||
#ifndef _CVPCB_MAINFRAME_H_
|
||||
#define _CVPCB_MAINFRAME_H_
|
||||
|
||||
|
@ -136,8 +132,6 @@ public:
|
|||
*/
|
||||
void DelAssociations( wxCommandEvent& event );
|
||||
|
||||
void OnConfigurePaths( wxCommandEvent& aEvent );
|
||||
|
||||
/**
|
||||
* Function OnEditEquFilesList
|
||||
* envokes the equ files list edit dialog.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2004-2018 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2004-2019 KiCad Developers, see change_log.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
|
||||
|
@ -22,65 +22,62 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <common_help_msg.h>
|
||||
#include <kiface_i.h>
|
||||
#include <menus_helpers.h>
|
||||
#include <pgm_base.h>
|
||||
#include <tool/action_menu.h>
|
||||
#include <bitmaps.h>
|
||||
#include <tool/conditional_menu.h>
|
||||
#include <tool/actions.h>
|
||||
#include "cvpcb.h"
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tool/common_control.h>
|
||||
#include "cvpcb_id.h"
|
||||
#include "cvpcb_mainframe.h"
|
||||
|
||||
|
||||
void CVPCB_MAINFRAME::ReCreateMenuBar()
|
||||
{
|
||||
COMMON_CONTROL* tool = m_toolManager->GetTool<COMMON_CONTROL>();
|
||||
// wxWidgets handles the Mac Application menu behind the scenes, but that means
|
||||
// we always have to start from scratch with a new wxMenuBar.
|
||||
wxMenuBar* oldMenuBar = GetMenuBar();
|
||||
wxMenuBar* menuBar = new wxMenuBar();
|
||||
|
||||
// Recreate all menus:
|
||||
//-- File menu -----------------------------------------------------------
|
||||
//
|
||||
CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, tool );
|
||||
|
||||
// Menu File:
|
||||
wxMenu* filesMenu = new wxMenu;
|
||||
fileMenu->AddItem( ID_SAVE_PROJECT,
|
||||
_( "&Save Schematic\tCtrl+S" ),
|
||||
_( "Save footprint associations in schematic symbol footprint fields" ),
|
||||
save_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
fileMenu->Resolve();
|
||||
|
||||
// Save the footprints back into eeschema
|
||||
AddMenuItem( filesMenu, ID_SAVE_PROJECT,
|
||||
_( "&Save Schematic\tCtrl+S" ),
|
||||
SAVE_HLP_MSG,
|
||||
KiBitmap( save_xpm ) );
|
||||
//-- Preferences menu -----------------------------------------------
|
||||
//
|
||||
CONDITIONAL_MENU* prefsMenu = new CONDITIONAL_MENU( false, tool );
|
||||
|
||||
// Preferences Menu :
|
||||
wxMenu* preferencesMenu = new wxMenu;
|
||||
prefsMenu->AddItem( ACTIONS::configurePaths, SELECTION_CONDITIONS::ShowAlways );
|
||||
prefsMenu->AddItem( ACTIONS::showFootprintLibTable, SELECTION_CONDITIONS::ShowAlways );
|
||||
prefsMenu->AddItem( wxID_PREFERENCES,
|
||||
_( "Preferences...\tCTRL+," ),
|
||||
_( "Show preferences for all open tools" ),
|
||||
preference_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
// Path configuration edit dialog.
|
||||
// JEY TODO: fix these....
|
||||
AddMenuItem( preferencesMenu,
|
||||
ID_PREFERENCES_CONFIGURE_PATHS,
|
||||
_( "&Configure Paths..." ),
|
||||
_( "Edit path configuration environment variables" ),
|
||||
KiBitmap( editor_xpm ) );
|
||||
prefsMenu->AddSeparator();
|
||||
prefsMenu->AddItem( ID_CVPCB_EQUFILES_LIST_EDIT,
|
||||
_( "Footprint &Association Files..." ),
|
||||
_( "Configure footprint association file (.equ) list. These files are "
|
||||
"used to automatically assign footprint names from symbol values." ),
|
||||
library_table_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
AddMenuItem( preferencesMenu, ID_CVPCB_LIB_TABLE_EDIT,
|
||||
_( "Manage &Footprint Libraries..." ), _( "Manage footprint libraries" ),
|
||||
KiBitmap( library_table_xpm ) );
|
||||
prefsMenu->AddSeparator();
|
||||
Pgm().AddMenuLanguageList( prefsMenu );
|
||||
|
||||
preferencesMenu->AppendSeparator();
|
||||
AddMenuItem( preferencesMenu, ID_CVPCB_EQUFILES_LIST_EDIT,
|
||||
_( "Footprint &Association Files..." ),
|
||||
_( "Configure footprint association file (.equ) list."
|
||||
"These files are used to automatically assign "
|
||||
"the footprint name from the symbol value" ),
|
||||
KiBitmap( library_table_xpm ) );
|
||||
preferencesMenu->AppendSeparator();
|
||||
prefsMenu->Resolve();
|
||||
|
||||
// Language submenu
|
||||
Pgm().AddMenuLanguageList( preferencesMenu );
|
||||
|
||||
// Create the menubar and append all submenus
|
||||
menuBar->Append( filesMenu, _( "&File" ) );
|
||||
menuBar->Append( preferencesMenu, _( "&Preferences" ) );
|
||||
//-- Menubar -------------------------------------------------------------
|
||||
//
|
||||
menuBar->Append( fileMenu, _( "&File" ) );
|
||||
menuBar->Append( prefsMenu, _( "&Preferences" ) );
|
||||
AddStandardHelpMenu( menuBar );
|
||||
|
||||
SetMenuBar( menuBar );
|
||||
|
|
|
@ -44,49 +44,6 @@ class TOOL_MANAGER;
|
|||
class EDA_BASE_FRAME;
|
||||
|
||||
|
||||
/* Identifiers (tags) in key code configuration file (or section names)
|
||||
* .m_SectionTag member of a EDA_HOTKEY_CONFIG
|
||||
*/
|
||||
extern wxString g_CommonSectionTag;
|
||||
|
||||
/**
|
||||
* class EDA_HOTKEY
|
||||
* is a class to handle hot key commands. Hot keys have a default value.
|
||||
* This class allows the real key code changed by user(from a key code list file)
|
||||
*/
|
||||
class EDA_HOTKEY
|
||||
{
|
||||
public:
|
||||
int m_KeyCode; // Key code (ascii value for ascii keys or wxWidgets code for function key
|
||||
wxString m_InfoMsg; // info message.
|
||||
int m_Idcommand; // internal id for the corresponding command (see hotkey_id_command list)
|
||||
|
||||
public:
|
||||
EDA_HOTKEY( const wxChar* infomsg, int idcommand, int keycode );
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Structure EDA_HOTKEY_CONFIG
|
||||
* contains the information required to save hot key information to a configuration file.
|
||||
* a Section name and the corresponding list of hotkeys (EDA_HOTKEY list)
|
||||
* hotkeys are grouped by section.
|
||||
* a section is a list of hotkey infos ( a EDA_HOTKEY list).
|
||||
* A full list of hotkeys can used one or many sections
|
||||
* for instance:
|
||||
* the schematic editor uses a common section (zoom hotkeys list ..) and a specific section
|
||||
* the library editor uses the same common section and a specific section
|
||||
* this feature avoid duplications and made hotkey file config easier to understand and edit
|
||||
*/
|
||||
struct EDA_HOTKEY_CONFIG
|
||||
{
|
||||
public:
|
||||
wxString* m_SectionTag; // The configuration file section name.
|
||||
EDA_HOTKEY** m_HK_InfoList; // List of EDA_HOTKEY pointers
|
||||
wxString* m_Title; // Title displayed in hotkey editor and used as comment in file
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Function KeyCodeFromKeyName
|
||||
* return the key code from its user-friendly key name (ie: "Ctrl+M")
|
||||
|
@ -101,15 +58,6 @@ int KeyCodeFromKeyName( const wxString& keyname );
|
|||
*/
|
||||
wxString KeyNameFromKeyCode( int aKeycode, bool * aIsFound = nullptr );
|
||||
|
||||
/**
|
||||
* Function KeyNameFromCommandId
|
||||
* return the key name from the Command id value ( m_Idcommand member value)
|
||||
* @param aList = pointer to a EDA_HOTKEY list of commands
|
||||
* @param aCommandId = Command Id value
|
||||
* @return the key name in a wxString
|
||||
*/
|
||||
wxString KeyNameFromCommandId( EDA_HOTKEY** aList, int aCommandId );
|
||||
|
||||
/**
|
||||
* An helper enum for AddHotkeyName function
|
||||
* In menus we can add a hot key, or an accelerator , or sometimes just a comment
|
||||
|
@ -134,20 +82,6 @@ enum HOTKEY_ACTION_TYPE
|
|||
wxString AddHotkeyName( const wxString& aText, int aHotKey,
|
||||
HOTKEY_ACTION_TYPE aStyle = IS_HOTKEY);
|
||||
|
||||
/**
|
||||
* Function AddHotkeyName
|
||||
* Add the key name from the Command id value ( m_Idcommand member value)
|
||||
* @param aText = a wxString. returns aText + key name
|
||||
* @param aDescrList = pointer to a EDA_HOTKEY_CONFIG DescrList of commands
|
||||
* @param aCommandId = Command Id value
|
||||
* @param aShortCutType The #HOTKEY_ACTION_TYPE of the shortcut.
|
||||
* @return a wxString (aTest + key name) if key found or aText without modification
|
||||
*/
|
||||
wxString AddHotkeyName( const wxString& aText,
|
||||
struct EDA_HOTKEY_CONFIG* aDescrList,
|
||||
int aCommandId,
|
||||
HOTKEY_ACTION_TYPE aShortCutType = IS_HOTKEY );
|
||||
|
||||
/**
|
||||
* Function DisplayHotkeyList
|
||||
* Displays the current hotkey list
|
||||
|
@ -169,7 +103,7 @@ void ReadHotKeyConfig( wxString aFileName, std::map<std::string, int>& aHotKeys
|
|||
* Function WriteHotKeyConfig
|
||||
* Updates the hotkeys config file with the hotkeys from the given actions map.
|
||||
*/
|
||||
int WriteHotKeyConfig( std::map<std::string, TOOL_ACTION*> aActionMap );
|
||||
int WriteHotKeyConfig( const std::map<std::string, TOOL_ACTION*>& aActionMap );
|
||||
|
||||
/**
|
||||
* Function ReadLegacyHotkeyConfigFile
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include <gal/color4d.h>
|
||||
#include <layers_id_colors_and_visibility.h>
|
||||
|
||||
struct EDA_HOTKEY_CONFIG;
|
||||
using KIGFX::COLOR4D;
|
||||
|
||||
/* Basic class to build a layer list.
|
||||
|
@ -41,10 +40,6 @@ class LAYER_SELECTOR
|
|||
protected:
|
||||
bool m_layerhotkeys;
|
||||
|
||||
public:
|
||||
// Hotkey Info
|
||||
struct EDA_HOTKEY_CONFIG* m_hotkeys;
|
||||
|
||||
public:
|
||||
LAYER_SELECTOR();
|
||||
|
||||
|
@ -71,10 +66,6 @@ public:
|
|||
*/
|
||||
class LAYER_BOX_SELECTOR : public wxBitmapComboBox, public LAYER_SELECTOR
|
||||
{
|
||||
public:
|
||||
// Hotkey Info
|
||||
struct EDA_HOTKEY_CONFIG* m_hotkeys;
|
||||
|
||||
public:
|
||||
LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
|
|
Loading…
Reference in New Issue