Actionize the rest of the 3D viewer.

Fixes https://gitlab.com/kicad/code/kicad/issues/2228
This commit is contained in:
Jeff Young 2020-03-18 22:48:36 +00:00
parent d787596124
commit e9cd9ee8ff
25 changed files with 1010 additions and 1081 deletions

View File

@ -41,6 +41,7 @@
#include <vector>
#include <3d_canvas/eda_3d_canvas.h>
#include <3d_viewer_id.h>
// Define min and max parameter values
#define MAX_SCALE 10000.0
@ -148,17 +149,17 @@ private:
void View3DLeft( wxCommandEvent& event ) override
{
m_previewPane->SetView3D( GR_KB_SHIFT + 'X' );
m_previewPane->SetView3D( ID_VIEW3D_LEFT );
}
void View3DFront( wxCommandEvent& event ) override
{
m_previewPane->SetView3D( 'Y' );
m_previewPane->SetView3D( ID_VIEW3D_FRONT );
}
void View3DTop( wxCommandEvent& event ) override
{
m_previewPane->SetView3D( 'Z' );
m_previewPane->SetView3D( ID_VIEW3D_TOP );
}
void View3DUpdate( wxCommandEvent& event ) override
@ -169,17 +170,17 @@ private:
void View3DRight( wxCommandEvent& event ) override
{
m_previewPane->SetView3D( 'X' );
m_previewPane->SetView3D( ID_VIEW3D_RIGHT );
}
void View3DBack( wxCommandEvent& event ) override
{
m_previewPane->SetView3D( GR_KB_SHIFT + 'Y' );
m_previewPane->SetView3D( ID_VIEW3D_BACK );
}
void View3DBottom( wxCommandEvent& event ) override
{
m_previewPane->SetView3D( GR_KB_SHIFT + 'Z' );
m_previewPane->SetView3D( ID_VIEW3D_BOTTOM );
}
public:

View File

@ -30,22 +30,21 @@
#include <GL/glew.h> // Must be included first
#include <wx/tokenzr.h>
#include "../common_ogl/openGL_includes.h"
#include "../common_ogl/ogl_utils.h"
#include "eda_3d_canvas.h"
#include "../3d_viewer_id.h"
#include "../3d_rendering/3d_render_raytracing/c3d_render_raytracing.h"
#include "../3d_viewer/eda_3d_viewer.h"
#include "../3d_rendering/test_cases.h"
#include <eda_3d_viewer.h>
#include <3d_rendering/3d_render_raytracing/c3d_render_raytracing.h>
#include <3d_rendering/3d_render_ogl_legacy/c3d_render_ogl_legacy.h>
#include <3d_viewer_id.h>
#include <class_board.h>
#include "status_text_reporter.h"
#include <status_text_reporter.h>
#include <gl_context_mgr.h>
#include <profile.h> // To use GetRunningMicroSecs or another profiling utility
#include <bitmaps.h>
#include <hotkeys_basic.h>
#include <menus_helpers.h>
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <tool/tool_dispatcher.h>
#include <widgets/wx_busy_indicator.h>
@ -64,15 +63,12 @@ const float EDA_3D_CANVAS::m_delta_move_step_factor = 0.7f;
BEGIN_EVENT_TABLE( EDA_3D_CANVAS, wxGLCanvas )
EVT_PAINT( EDA_3D_CANVAS::OnPaint )
EVT_CHAR( EDA_3D_CANVAS::OnKeyEvent )
EVT_CHAR_HOOK( EDA_3D_CANVAS::OnCharHook )
// mouse events
EVT_LEFT_DOWN( EDA_3D_CANVAS::OnLeftDown )
EVT_LEFT_UP( EDA_3D_CANVAS::OnLeftUp )
EVT_MIDDLE_UP( EDA_3D_CANVAS::OnMiddleUp )
EVT_MIDDLE_DOWN( EDA_3D_CANVAS::OnMiddleDown)
EVT_RIGHT_DOWN( EDA_3D_CANVAS::OnRightClick )
EVT_MOUSEWHEEL( EDA_3D_CANVAS::OnMouseWheel )
EVT_MOTION( EDA_3D_CANVAS::OnMouseMove )
@ -82,29 +78,22 @@ BEGIN_EVENT_TABLE( EDA_3D_CANVAS, wxGLCanvas )
// other events
EVT_ERASE_BACKGROUND( EDA_3D_CANVAS::OnEraseBackground )
EVT_MENU_RANGE( ID_POPUP_3D_VIEW_START,
ID_POPUP_3D_VIEW_END, EDA_3D_CANVAS::OnPopUpMenu )
EVT_CLOSE( EDA_3D_CANVAS::OnCloseWindow )
EVT_SIZE( EDA_3D_CANVAS::OnResize )
END_EVENT_TABLE()
EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow *aParent,
const int *aAttribList,
BOARD *aBoard,
EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow *aParent, const int *aAttribList, BOARD *aBoard,
CINFO3D_VISU &aSettings , S3D_CACHE *a3DCachePointer ) :
HIDPI_GL_CANVAS( aParent,
wxID_ANY,
aAttribList,
wxDefaultPosition,
wxDefaultSize,
wxFULL_REPAINT_ON_RESIZE
),
m_settings( aSettings )
HIDPI_GL_CANVAS( aParent, wxID_ANY, aAttribList, wxDefaultPosition, wxDefaultSize,
wxFULL_REPAINT_ON_RESIZE ),
m_eventDispatcher( nullptr ),
m_parentStatusBar( nullptr ),
m_glRC( nullptr ),
m_settings( aSettings ),
m_3d_render( nullptr )
{
// Run test cases in debug mode, once.
wxLogTrace( m_logTrace, "EDA_3D_CANVAS::EDA_3D_CANVAS" );
m_editing_timeout_timer.SetOwner( this );
@ -134,11 +123,6 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow *aParent,
m_render_raytracing_was_requested = false;
m_opengl_supports_raytracing = false;
m_parentStatusBar = NULL;
m_glRC = NULL;
m_3d_render = NULL;
m_3d_render_raytracing = new C3D_RENDER_RAYTRACING( aSettings );
m_3d_render_ogl_legacy = new C3D_RENDER_OGL_LEGACY( aSettings );
@ -159,6 +143,24 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow *aParent,
wxASSERT( a3DCachePointer != NULL );
m_settings.Set3DCacheManager( a3DCachePointer );
const wxEventType events[] =
{
// Binding both EVT_CHAR and EVT_CHAR_HOOK ensures that all key events,
// especially special key like arrow keys, are handled by the GAL event dispatcher,
// and not sent to GUI without filtering, because they have a default action (scroll)
// that must not be called.
wxEVT_LEFT_UP, wxEVT_LEFT_DOWN, wxEVT_LEFT_DCLICK,
wxEVT_RIGHT_UP, wxEVT_RIGHT_DOWN, wxEVT_RIGHT_DCLICK,
wxEVT_MIDDLE_UP, wxEVT_MIDDLE_DOWN, wxEVT_MIDDLE_DCLICK,
wxEVT_MOTION, wxEVT_MOUSEWHEEL, wxEVT_CHAR, wxEVT_CHAR_HOOK
#if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT )
, wxEVT_MAGNIFY
#endif
};
for( wxEventType eventType : events )
Connect( eventType, wxEventHandler( EDA_3D_CANVAS::OnEvent ), NULL, m_eventDispatcher );
}
@ -447,8 +449,8 @@ void EDA_3D_CANVAS::OnPaint( wxPaintEvent &event )
{
m_3d_render->SetCurWindowSize( clientSize );
requested_redraw = m_3d_render->Redraw(
m_mouse_was_moved || m_camera_is_moving, &activityReporter, &warningReporter );
requested_redraw = m_3d_render->Redraw( m_mouse_was_moved || m_camera_is_moving,
&activityReporter, &warningReporter );
}
if( m_render_pivot )
@ -490,6 +492,37 @@ void EDA_3D_CANVAS::OnPaint( wxPaintEvent &event )
}
void EDA_3D_CANVAS::SetEventDispatcher( TOOL_DISPATCHER* aEventDispatcher )
{
m_eventDispatcher = aEventDispatcher;
if( m_eventDispatcher )
{
m_parent->Connect( wxEVT_TOOL,
wxCommandEventHandler( TOOL_DISPATCHER::DispatchWxCommand ),
NULL, m_eventDispatcher );
}
else
{
// While loop is used to be sure that all event handlers are removed.
while( m_parent->Disconnect( wxEVT_TOOL,
wxCommandEventHandler( TOOL_DISPATCHER::DispatchWxCommand ),
NULL, m_eventDispatcher ) );
}
}
void EDA_3D_CANVAS::OnEvent( wxEvent& aEvent )
{
if( !m_eventDispatcher )
aEvent.Skip();
else
m_eventDispatcher->DispatchWxEvent( aEvent );
Refresh();
}
void EDA_3D_CANVAS::OnEraseBackground( wxEraseEvent &event )
{
wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnEraseBackground" );
@ -658,158 +691,6 @@ void EDA_3D_CANVAS::OnMiddleUp( wxMouseEvent &event )
}
void EDA_3D_CANVAS::OnRightClick( wxMouseEvent &event )
{
wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnRightClick" );
SetFocus();
if( m_camera_is_moving )
return;
wxPoint pos;
wxMenu PopUpMenu;
pos.x = event.GetX();
pos.y = event.GetY();
AddMenuItem( &PopUpMenu, ID_POPUP_ZOOMIN,
_( "Zoom +\tF1" ), KiBitmap( zoom_in_xpm ) );
AddMenuItem( &PopUpMenu, ID_POPUP_ZOOMOUT,
_( "Zoom -\tF2" ), KiBitmap( zoom_out_xpm ) );
PopUpMenu.AppendSeparator();
AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_ZPOS,
_( "Top View\tZ" ), KiBitmap( axis3d_top_xpm ) );
AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_ZNEG,
_( "Bottom View\tShift+Z" ), KiBitmap( axis3d_bottom_xpm ) );
PopUpMenu.AppendSeparator();
AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_XPOS,
_( "Right View\tX" ), KiBitmap( axis3d_right_xpm ) );
AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_XNEG,
_( "Left View\tShift+X" ), KiBitmap( axis3d_left_xpm ) );
PopUpMenu.AppendSeparator();
AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_YPOS,
_( "Front View\tY" ), KiBitmap( axis3d_front_xpm ) );
AddMenuItem( &PopUpMenu, ID_POPUP_VIEW_YNEG,
_( "Back View\tShift+Y" ), KiBitmap( axis3d_back_xpm ) );
PopUpMenu.AppendSeparator();
AddMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_LEFT,
_( "Move Left <-\tLeft" ), KiBitmap( left_xpm ) );
AddMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_RIGHT,
_( "Move Right ->\tRight" ), KiBitmap( right_xpm ) );
AddMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_UP,
_( "Move Up ^\tUp" ), KiBitmap( up_xpm ) );
AddMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_DOWN,
_( "Move Down\tDown" ), KiBitmap( down_xpm ) );
PopupMenu( &PopUpMenu, pos );
}
void EDA_3D_CANVAS::OnPopUpMenu( wxCommandEvent &event )
{
int id = event.GetId();
wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnPopUpMenu id:%d", id );
int key = 0;
switch( id )
{
case ID_POPUP_ZOOMIN:
key = WXK_F1;
break;
case ID_POPUP_ZOOMOUT:
key = WXK_F2;
break;
case ID_POPUP_VIEW_XPOS:
key = 'X';
break;
case ID_POPUP_VIEW_XNEG:
key = GR_KB_SHIFT + 'X';
break;
case ID_POPUP_VIEW_YPOS:
key = 'Y';
break;
case ID_POPUP_VIEW_YNEG:
key = GR_KB_SHIFT + 'Y';
break;
case ID_POPUP_VIEW_ZPOS:
key = 'Z';
break;
case ID_POPUP_VIEW_ZNEG:
key = GR_KB_SHIFT + 'Z';
break;
case ID_POPUP_MOVE3D_LEFT:
key = WXK_LEFT;
break;
case ID_POPUP_MOVE3D_RIGHT:
key = WXK_RIGHT;
break;
case ID_POPUP_MOVE3D_UP:
key = WXK_UP;
break;
case ID_POPUP_MOVE3D_DOWN:
key = WXK_DOWN;
break;
default:
return;
}
SetView3D( key );
}
void EDA_3D_CANVAS::OnCharHook( wxKeyEvent &event )
{
//wxLogTrace( m_logTrace, "EDA_3D_CANVAS::OnCharHook" );
event.Skip();
}
void EDA_3D_CANVAS::OnKeyEvent( wxKeyEvent& event )
{
//wxLogTrace( m_logTrace, "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;
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();
}
void EDA_3D_CANVAS::OnTimerTimeout_Editing( wxTimerEvent &event )
{
(void)event;
@ -835,11 +716,6 @@ void EDA_3D_CANVAS::restart_editingTimeOut_Timer()
void EDA_3D_CANVAS::OnTimerTimeout_Redraw( wxTimerEvent &event )
{
(void)event;
//Refresh();
//Update();
wxPaintEvent redrawEvent;
wxPostEvent( this, redrawEvent );
}
@ -854,8 +730,7 @@ void EDA_3D_CANVAS::Request_refresh( bool aRedrawImmediately )
//Refresh();
//Update();
// Using PostEvent will take priority to other events, like
// mouse movements, keys, etc.
// Using PostEvent will take priority to other events like mouse movements, keys, etc.
wxPaintEvent redrawEvent;
wxPostEvent( this, redrawEvent );
@ -1033,7 +908,7 @@ bool EDA_3D_CANVAS::SetView3D( int aKeycode )
request_start_moving_camera( glm::min( glm::max( m_settings.CameraGet().ZoomGet(), 0.5f ), 1.125f ) );
return true;
case 'X':
case ID_VIEW3D_RIGHT:
m_settings.CameraGet().SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
m_settings.CameraGet().SetT0_and_T1_current_T();
m_settings.CameraGet().Reset_T1();
@ -1042,7 +917,7 @@ bool EDA_3D_CANVAS::SetView3D( int aKeycode )
request_start_moving_camera();
return true;
case GR_KB_SHIFT + 'X':
case ID_VIEW3D_LEFT:
m_settings.CameraGet().SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
m_settings.CameraGet().SetT0_and_T1_current_T();
m_settings.CameraGet().Reset_T1();
@ -1051,7 +926,7 @@ bool EDA_3D_CANVAS::SetView3D( int aKeycode )
request_start_moving_camera();
return true;
case 'Y':
case ID_VIEW3D_FRONT:
m_settings.CameraGet().SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
m_settings.CameraGet().SetT0_and_T1_current_T();
m_settings.CameraGet().Reset_T1();
@ -1059,7 +934,7 @@ bool EDA_3D_CANVAS::SetView3D( int aKeycode )
request_start_moving_camera();
return true;
case GR_KB_SHIFT + 'Y':
case ID_VIEW3D_BACK:
m_settings.CameraGet().SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
m_settings.CameraGet().SetT0_and_T1_current_T();
m_settings.CameraGet().Reset_T1();
@ -1068,7 +943,7 @@ bool EDA_3D_CANVAS::SetView3D( int aKeycode )
request_start_moving_camera();
return true;
case 'Z':
case ID_VIEW3D_TOP:
m_settings.CameraGet().SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
m_settings.CameraGet().SetT0_and_T1_current_T();
m_settings.CameraGet().Reset_T1();
@ -1076,7 +951,7 @@ bool EDA_3D_CANVAS::SetView3D( int aKeycode )
glm::min( glm::max( m_settings.CameraGet().ZoomGet(), 0.5f ), 1.125f ) );
return true;
case GR_KB_SHIFT + 'Z':
case ID_VIEW3D_BOTTOM:
m_settings.CameraGet().SetInterpolateMode( CAMERA_INTERPOLATION::BEZIER );
m_settings.CameraGet().SetT0_and_T1_current_T();
m_settings.CameraGet().Reset_T1();
@ -1104,17 +979,9 @@ void EDA_3D_CANVAS::RenderEngineChanged()
{
switch( m_settings.RenderEngineGet() )
{
case RENDER_ENGINE::OPENGL_LEGACY:
m_3d_render = m_3d_render_ogl_legacy;
break;
case RENDER_ENGINE::RAYTRACING:
m_3d_render = m_3d_render_raytracing;
break;
default:
m_3d_render = NULL;
break;
case RENDER_ENGINE::OPENGL_LEGACY: m_3d_render = m_3d_render_ogl_legacy; break;
case RENDER_ENGINE::RAYTRACING: m_3d_render = m_3d_render_raytracing; break;
default: m_3d_render = NULL; break;
}
if( m_3d_render )

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2020 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
@ -22,36 +22,22 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file eda_3d_canvas.h
* @brief
*/
#ifndef EDA_3D_CANVAS_H
#define EDA_3D_CANVAS_H
#include "cinfo3d_visu.h"
#include "3d_rendering/c3d_render_base.h"
#include "3d_rendering/3d_render_ogl_legacy/c3d_render_ogl_legacy.h"
#include "3d_rendering/3d_render_raytracing/c3d_render_raytracing.h"
#include "3d_cache/3d_cache.h"
#include <gal/hidpi_gl_canvas.h>
#include <wx/clipbrd.h>
#include <wx/dataobj.h>
#include <wx/image.h>
#include <wx/wupdlock.h>
#include <wx/timer.h>
#include <wx/statusbr.h>
#include <pcb_base_frame.h>
// Flag for special keys
// TODO Remove these when Action-ifying 3d viewer
#define GR_KB_RIGHTSHIFT ( 0x01000000U )
#define GR_KB_LEFTSHIFT ( 0x02000000U )
#define GR_KB_CTRL ( 0x04000000U )
#define GR_KB_ALT ( 0x08000000U )
#define GR_KB_SHIFT ( GR_KB_LEFTSHIFT | GR_KB_RIGHTSHIFT )
class wxStatusBar;
class BOARD;
class C3D_RENDER_RAYTRACING;
class C3D_RENDER_OGL_LEGACY;
/**
@ -59,10 +45,7 @@
*/
class EDA_3D_CANVAS : public HIDPI_GL_CANVAS
{
public:
/**
* @brief EDA_3D_CANVAS - Creates a new 3D Canvas with a attribute list
* @param aParent: the parent creator of this canvas
@ -78,6 +61,15 @@ class EDA_3D_CANVAS : public HIDPI_GL_CANVAS
~EDA_3D_CANVAS();
/**
* Function SetEventDispatcher()
* Sets a dispatcher that processes events and forwards them to tools.
* @param aEventDispatcher is the object that will be used for dispatching events.
* DRAW_PANEL_GAL does not take over the ownership. Passing NULL disconnects all event
* handlers from the DRAW_PANEL_GAL and parent frame.
*/
void SetEventDispatcher( TOOL_DISPATCHER* aEventDispatcher );
void SetStatusBar( wxStatusBar *aStatusBar ) { m_parentStatusBar = aStatusBar; }
void ReloadRequest( BOARD *aBoard = NULL, S3D_CACHE *aCachePointer = NULL );
@ -130,11 +122,10 @@ class EDA_3D_CANVAS : public HIDPI_GL_CANVAS
*/
void Request_refresh( bool aRedrawImmediately = true );
void OnKeyEvent( wxKeyEvent& event );
bool SupportsRayTracing() const { return m_opengl_supports_raytracing; }
bool IsOpenGLInitialized() const { return m_is_opengl_initialized; }
/**
* Used to forward events to the canvas from popups, etc.
*/
void OnEvent( wxEvent& aEvent );
private:
@ -149,57 +140,34 @@ private:
#endif
void OnMouseMove( wxMouseEvent &event );
void OnLeftDown( wxMouseEvent &event );
void OnLeftUp( wxMouseEvent &event );
void OnMiddleUp( wxMouseEvent &event );
void OnMiddleDown( wxMouseEvent &event );
void OnRightClick( wxMouseEvent &event );
void OnPopUpMenu( wxCommandEvent &event );
void OnCharHook( wxKeyEvent& event );
void OnTimerTimeout_Editing( wxTimerEvent& event );
/**
* @brief OnCloseWindow - called when the frame is closed
* @param event
*/
void OnCloseWindow( wxCloseEvent &event );
void OnResize( wxSizeEvent &event );
void OnTimerTimeout_Redraw( wxTimerEvent& event );
DECLARE_EVENT_TABLE()
private:
/**
* @brief stop_editingTimeOut_Timer - stop the editing time, so it will not timeout
*/
void stop_editingTimeOut_Timer();
/**
* @brief restart_editingTimeOut_Timer - reset the editing timer
*/
void restart_editingTimeOut_Timer();
/**
* @brief request_start_moving_camera - start a camera movement
* @param aMovingSpeed: the time speed
* @param aRenderPivot: if it should display pivot cursor while move
*/
void request_start_moving_camera( float aMovingSpeed = 2.0f,
bool aRenderPivot = true );
void request_start_moving_camera( float aMovingSpeed = 2.0f, bool aRenderPivot = true );
/**
* @brief move_pivot_based_on_cur_mouse_position -
@ -207,7 +175,6 @@ private:
*/
void move_pivot_based_on_cur_mouse_position();
/**
* @brief render_pivot - render the pivot cursor
* @param t: time between 0.0 and 1.0
@ -228,60 +195,34 @@ private:
private:
/// current OpenGL context
wxGLContext *m_glRC;
TOOL_DISPATCHER* m_eventDispatcher;
wxStatusBar* m_parentStatusBar; // Parent statusbar to report progress
/// Parent statusbar to report progress
wxStatusBar *m_parentStatusBar;
wxGLContext* m_glRC; // Current OpenGL context
bool m_is_opengl_initialized;
/// Time timeout will expires after some time sinalizing that the mouse /
/// keyboard movements are over.
wxTimer m_editing_timeout_timer;
wxTimer m_editing_timeout_timer; // Expires after some time signalling that
// the mouse / keyboard movements are over
wxTimer m_redraw_trigger_timer; // Used to schedule a redraw event
/// This timer will be used to schedule a redraw event
wxTimer m_redraw_trigger_timer;
bool m_mouse_is_moving; // Mouse activity is in progress
bool m_mouse_was_moved;
bool m_camera_is_moving; // Camera animation is ongoing
bool m_render_pivot; // Render the pivot while camera moving
float m_camera_moving_speed; // 1.0f will be 1:1
unsigned m_strtime_camera_movement; // Ticktime of camera movement start
/// true if mouse activity is on progress
bool m_mouse_is_moving;
CINFO3D_VISU& m_settings; // Pre-computed 3D information and visual
// settings to render the board
C3D_RENDER_BASE* m_3d_render;
C3D_RENDER_RAYTRACING* m_3d_render_raytracing;
C3D_RENDER_OGL_LEGACY* m_3d_render_ogl_legacy;
/// true if there was some type of activity, it will be used to render in
/// preview mode
bool m_mouse_was_moved;
static const float m_delta_move_step_factor; // Step factor to used with cursor on
// relation to the current zoom
/// true if camera animation is ongoing
bool m_camera_is_moving;
/// activated the render of pivot while camera moving
bool m_render_pivot;
/// 1.0f will be 1:1
float m_camera_moving_speed;
/// Stores the ticktime when the camera star its movement
unsigned m_strtime_camera_movement;
/// Stores all pre-computed 3D information and visualization settings to render the board
CINFO3D_VISU &m_settings;
/// The current render in used for this canvas
C3D_RENDER_BASE *m_3d_render;
/// Raytracing render class
C3D_RENDER_RAYTRACING *m_3d_render_raytracing;
/// OpenGL legacy render class
C3D_RENDER_OGL_LEGACY *m_3d_render_ogl_legacy;
/// Flag to store if opengl was initialized already
bool m_is_opengl_initialized;
/// Step factor to used with cursor on relation to the current zoom
static const float m_delta_move_step_factor;
/// Flags that the user requested the current view to be render with raytracing
bool m_render_raytracing_was_requested;
bool m_opengl_supports_raytracing;
bool m_opengl_supports_raytracing;
bool m_render_raytracing_was_requested;
/**
* Trace mask used to enable or disable the trace output of this class.

View File

@ -434,16 +434,6 @@ void CCAMERA::SetCurMousePosition( const wxPoint &aNewMousePosition )
}
void CCAMERA::SetProjection( PROJECTION_TYPE aProjectionType )
{
if( m_projectionType != aProjectionType )
{
m_projectionType = aProjectionType;
rebuildProjection();
}
}
void CCAMERA::ToggleProjection()
{
if( m_projectionType == PROJECTION_TYPE::ORTHO )

View File

@ -160,9 +160,8 @@ class CCAMERA
*/
void SetCurMousePosition( const wxPoint &aPosition );
void SetProjection( PROJECTION_TYPE aProjectionType );
void ToggleProjection();
PROJECTION_TYPE GetProjection() { return m_projectionType; }
/**
* @brief SetCurWindowSize - update the windows size of the camera

View File

@ -1,129 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 Jon Evans <jon@craftyjon.com>
* Copyright (C) 2017-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 as published by the
* Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <tool/tool_manager.h>
#include <bitmaps.h>
#include "3d_actions.h"
// Actions, being statically-defined, require specialized I18N handling. We continue to
// use the _() macro so that string harvesting by the I18N framework doesn't have to be
// specialized, but we don't translate on initialization and instead do it in the getters.
#undef _
#define _(s) s
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" );

View File

@ -29,10 +29,9 @@
#include <eda_3d_viewer.h>
#include <menus_helpers.h>
#include <3d_viewer_id.h>
#include <3d_actions.h>
#include <3d_viewer/tools/3d_actions.h>
#include <tool/tool_manager.h>
#include <tool/common_control.h>
#include "help_common_strings.h"
void EDA_3D_VIEWER::CreateMenuBar()
@ -72,51 +71,28 @@ void EDA_3D_VIEWER::CreateMenuBar()
//
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, tool );
viewMenu->AddItem( ID_ZOOM_IN, _( "Zoom In\tF1" ), HELP_ZOOM_IN,
zoom_in_xpm, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ID_ZOOM_OUT, _( "Zoom Out\tF2" ), HELP_ZOOM_OUT,
zoom_out_xpm, SELECTION_CONDITIONS::ShowAlways );
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->AddItem( ACTIONS::zoomIn, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomOut, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomFitScreen, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomRedraw, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddSeparator();
viewMenu->AddItem( ID_ROTATE3D_X_NEG, _( "Rotate X Clockwise" ) + "\tCtrl+Shift+X", "",
rotate_neg_x_xpm, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ID_ROTATE3D_X_POS, _( "Rotate X Counterclockwise" ) + "\tCtrl+X", "",
rotate_pos_x_xpm, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( EDA_3D_ACTIONS::rotateXCW, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( EDA_3D_ACTIONS::rotateXCCW, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddSeparator();
viewMenu->AddItem( ID_ROTATE3D_Y_NEG, _( "Rotate Y Clockwise" ) + "\tCtrl+Shift+Y", "",
rotate_neg_y_xpm, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ID_ROTATE3D_Y_POS, _( "Rotate Y Counterclockwise" ) + "\tCtrl+Y", "",
rotate_pos_y_xpm, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( EDA_3D_ACTIONS::rotateYCW, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( EDA_3D_ACTIONS::rotateYCCW, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddSeparator();
viewMenu->AddItem( ID_ROTATE3D_Z_NEG, _( "Rotate Z Clockwise" ) + "\tCtrl+Shift+Z", "",
rotate_neg_z_xpm, SELECTION_CONDITIONS::ShowAlways );;
viewMenu->AddItem( ID_ROTATE3D_Z_POS, _( "Rotate Z Counterclockwise" ) + "\tCtrl+Z", "",
rotate_pos_z_xpm, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( EDA_3D_ACTIONS::rotateZCW, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( EDA_3D_ACTIONS::rotateZCCW, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddSeparator();
viewMenu->AddItem( ID_MOVE3D_LEFT, _( "Move Left\tLeft" ), "",
left_xpm, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ID_MOVE3D_RIGHT, _( "Move Right\tRight" ), "",
right_xpm, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ID_MOVE3D_UP, _( "Move Up\tUp" ), "",
up_xpm, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ID_MOVE3D_DOWN, _( "Move Down\tDown" ), "",
down_xpm, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( EDA_3D_ACTIONS::moveLeft, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( EDA_3D_ACTIONS::moveRight, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( EDA_3D_ACTIONS::moveUp, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( EDA_3D_ACTIONS::moveDown, SELECTION_CONDITIONS::ShowAlways );
viewMenu->Resolve();
@ -229,53 +205,22 @@ void EDA_3D_VIEWER::CreateMenuBar()
optsSubmenu->AddMenu( propsSubmenu, SELECTION_CONDITIONS::ShowAlways );
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 );
optsSubmenu->AddCheckItem( ID_MENU3D_FL_OPENGL_RENDER_SHOW_MODEL_BBOX,
_( "Show Model Bounding Boxes" ), "",
ortho_xpm, boundingBoxesCondition );
optsSubmenu->AddCheckItem( EDA_3D_ACTIONS::showCopperThickness, copperThicknessCondition );
optsSubmenu->AddCheckItem( EDA_3D_ACTIONS::showBoundingBoxes, boundingBoxesCondition );
// Raytracing submenu
CONDITIONAL_MENU* raySubmenu = new CONDITIONAL_MENU( false, tool );
raySubmenu->SetTitle( _( "Raytracing Options" ) );
raySubmenu->SetIcon( tools_xpm );
raySubmenu->AddCheckItem( ID_MENU3D_FL_RAYTRACING_RENDER_SHADOWS,
_( "Render Shadows" ), "",
green_xpm, renderShadowsCondition );
raySubmenu->AddCheckItem( EDA_3D_ACTIONS::renderShadows, renderShadowsCondition );
raySubmenu->AddCheckItem( EDA_3D_ACTIONS::proceduralTextures, proceduralTexturesCondition );
raySubmenu->AddCheckItem( EDA_3D_ACTIONS::addFloor, showFloorCondition );
raySubmenu->AddCheckItem( EDA_3D_ACTIONS::showRefractions, useRefractionsCondition );
raySubmenu->AddCheckItem( EDA_3D_ACTIONS::showReflections, useReflectionsCondition );
raySubmenu->AddCheckItem( EDA_3D_ACTIONS::antiAliasing, antiAliasingCondition );
raySubmenu->AddCheckItem( ID_MENU3D_FL_RAYTRACING_PROCEDURAL_TEXTURES,
_( "Procedural Textures" ),
_( "Apply procedural textures to materials (slow)"),
green_xpm, proceduralTexturesCondition );
raySubmenu->AddCheckItem( ID_MENU3D_FL_RAYTRACING_BACKFLOOR,
_( "Add Floor" ),
_( "Adds a floor plane below the board (slow)"),
green_xpm, showFloorCondition );
raySubmenu->AddCheckItem( ID_MENU3D_FL_RAYTRACING_REFRACTIONS,
_( "Refractions" ),
_( "Render materials with refractions properties on final render (slow)"),
green_xpm, useRefractionsCondition );
raySubmenu->AddCheckItem( ID_MENU3D_FL_RAYTRACING_REFLECTIONS,
_( "Reflections" ),
_( "Render materials with reflections properties on final render (slow)"),
green_xpm, useReflectionsCondition );
raySubmenu->AddCheckItem( ID_MENU3D_FL_RAYTRACING_ANTI_ALIASING,
_( "Anti-aliasing" ),
_( "Render with improved quality on final render (slow)"),
green_xpm, antiAliasingCondition );
raySubmenu->AddCheckItem( ID_MENU3D_FL_RAYTRACING_POST_PROCESSING,
_( "Post-processing" ),
_( "Apply Screen Space Ambient Occlusion and Global Illumination reflections on final render (slow)"),
green_xpm, postProcessCondition );
raySubmenu->AddCheckItem( EDA_3D_ACTIONS::postProcessing, postProcessCondition );
optsSubmenu->AddMenu( raySubmenu, SELECTION_CONDITIONS::ShowAlways );
prefsMenu->AddMenu( optsSubmenu, SELECTION_CONDITIONS::ShowAlways );
@ -312,13 +257,12 @@ void EDA_3D_VIEWER::CreateMenuBar()
if( Parent()->IsType( FRAME_PCB_EDITOR ) )
{
colorSubmenu->AddItem( ID_MENU3D_STACKUP_COLORS, _( "Get colors from physical stackup" ), "",
nullptr, SELECTION_CONDITIONS::ShowAlways );
nullptr, SELECTION_CONDITIONS::ShowAlways );
}
prefsMenu->AddMenu( colorSubmenu );
prefsMenu->AddCheckItem( ID_MENU3D_AXIS_ONOFF, _( "Show 3D &Axis" ), "",
axis3d_front_xpm, showAxesCondition );
prefsMenu->AddCheckItem( EDA_3D_ACTIONS::showAxis, showAxesCondition );
// Grid submenu
CONDITIONAL_MENU* gridSubmenu = new CONDITIONAL_MENU( false, tool );
@ -352,16 +296,11 @@ void EDA_3D_VIEWER::CreateMenuBar()
};
//clang-format on
gridSubmenu->AddCheckItem( ID_MENU3D_GRID_NOGRID, _( "No 3D Grid" ), "",
nullptr, noGridCondition );
gridSubmenu->AddCheckItem( ID_MENU3D_GRID_10_MM, _( "3D Grid 10mm" ), "",
nullptr, grid10mmCondition );
gridSubmenu->AddCheckItem( ID_MENU3D_GRID_5_MM, _( "3D Grid 5mm" ), "",
nullptr, grid5mmCondition );
gridSubmenu->AddCheckItem( ID_MENU3D_GRID_2P5_MM, _( "3D Grid 2.5mm" ), "",
nullptr, grid2p5mmCondition );
gridSubmenu->AddCheckItem( ID_MENU3D_GRID_1_MM, _( "3D Grid 1mm" ), "",
nullptr, grid_1mmCondition );
gridSubmenu->AddCheckItem( EDA_3D_ACTIONS::noGrid, noGridCondition );
gridSubmenu->AddCheckItem( EDA_3D_ACTIONS::show10mmGrid, grid10mmCondition );
gridSubmenu->AddCheckItem( EDA_3D_ACTIONS::show5mmGrid, grid5mmCondition );
gridSubmenu->AddCheckItem( EDA_3D_ACTIONS::show2_5mmGrid, grid2p5mmCondition );
gridSubmenu->AddCheckItem( EDA_3D_ACTIONS::show1mmGrid, grid_1mmCondition );
prefsMenu->AddMenu( gridSubmenu, SELECTION_CONDITIONS::ShowAlways );

View File

@ -29,13 +29,13 @@
*/
#include <fctsys.h>
#include <wx/wupdlock.h>
#include <eda_3d_viewer.h>
#include <3d_canvas/cinfo3d_visu.h>
#include <menus_helpers.h>
#include <tool/action_toolbar.h>
#include <tools/3d_actions.h>
#include <3d_viewer_id.h>
void EDA_3D_VIEWER::ReCreateMainToolbar()
{
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::ReCreateMainToolbar" );
@ -43,14 +43,10 @@ void EDA_3D_VIEWER::ReCreateMainToolbar()
wxWindowUpdateLocker dummy( this );
if( m_mainToolBar )
{
m_mainToolBar->Clear();
}
else
{
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
}
m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
// Set up toolbar
m_mainToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
@ -74,77 +70,40 @@ void EDA_3D_VIEWER::ReCreateMainToolbar()
_( "Render current view using Raytracing" ), wxITEM_CHECK );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString,
KiScaledBitmap( zoom_in_xpm, this ),
_( "Zoom in" ) );
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
KiScaledBitmap( zoom_out_xpm, this ),
_( "Zoom out" ) );
m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
KiScaledBitmap( zoom_redraw_xpm, this ),
_( "Redraw view" ) );
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
KiScaledBitmap( zoom_fit_in_page_xpm, this ),
_( "Zoom to fit 3D model" ) );
m_mainToolBar->Add( ACTIONS::zoomRedraw );
m_mainToolBar->Add( ACTIONS::zoomInCenter );
m_mainToolBar->Add( ACTIONS::zoomOutCenter );
m_mainToolBar->Add( ACTIONS::zoomFitScreen );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_ROTATE3D_X_NEG, wxEmptyString,
KiScaledBitmap( rotate_neg_x_xpm, this ),
_( "Rotate X Clockwise" ) );
m_mainToolBar->AddTool( ID_ROTATE3D_X_POS, wxEmptyString,
KiScaledBitmap( rotate_pos_x_xpm, this ),
_( "Rotate X Counterclockwise" ) );
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateXCW );
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateXCCW );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_ROTATE3D_Y_NEG, wxEmptyString,
KiScaledBitmap( rotate_neg_y_xpm, this ),
_( "Rotate Y Clockwise" ) );
m_mainToolBar->AddTool( ID_ROTATE3D_Y_POS, wxEmptyString,
KiScaledBitmap( rotate_pos_y_xpm, this ),
_( "Rotate Y Counterclockwise" ) );
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateYCW );
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateYCCW );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_ROTATE3D_Z_NEG, wxEmptyString,
KiScaledBitmap( rotate_neg_z_xpm, this ),
_( "Rotate Z Clockwise" ) );
m_mainToolBar->AddTool( ID_ROTATE3D_Z_POS, wxEmptyString,
KiScaledBitmap( rotate_pos_z_xpm, this ),
_( "Rotate Z Counterclockwise" ) );
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateZCW );
m_mainToolBar->Add( EDA_3D_ACTIONS::rotateZCCW );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_MOVE3D_LEFT, wxEmptyString,
KiScaledBitmap( left_xpm, this ),
_( "Move left" ) );
m_mainToolBar->AddTool( ID_MOVE3D_RIGHT, wxEmptyString,
KiScaledBitmap( right_xpm, this ),
_( "Move right" ) );
m_mainToolBar->AddTool( ID_MOVE3D_UP, wxEmptyString,
KiScaledBitmap( up_xpm, this ),
_( "Move up" ) );
m_mainToolBar->AddTool( ID_MOVE3D_DOWN, wxEmptyString,
KiScaledBitmap( down_xpm, this ),
_( "Move down" ) );
m_mainToolBar->Add( EDA_3D_ACTIONS::moveLeft );
m_mainToolBar->Add( EDA_3D_ACTIONS::moveRight );
m_mainToolBar->Add( EDA_3D_ACTIONS::moveUp );
m_mainToolBar->Add( EDA_3D_ACTIONS::moveDown );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_ORTHO, wxEmptyString,
KiScaledBitmap( ortho_xpm, this ),
_( "Enable/Disable orthographic projection" ),
wxITEM_CHECK );
m_mainToolBar->Add( EDA_3D_ACTIONS::toggleOrtho, ACTION_TOOLBAR::TOGGLE );
m_mainToolBar->Realize();
}
}
void EDA_3D_VIEWER::SyncToolbars()
{
bool isOrtho = m_settings.CameraGet().GetProjection() == PROJECTION_TYPE::ORTHO;
m_mainToolBar->Toggle( EDA_3D_ACTIONS::toggleOrtho, isOrtho );
m_mainToolBar->Refresh();
}

View File

@ -22,19 +22,23 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <wx/colordlg.h>
#include <wx/colour.h>
#include <wx/string.h>
#include <wx/wupdlock.h>
#include <wx/clipbrd.h>
#include "eda_3d_viewer.h"
#include "3d_viewer_settings.h"
#include "../3d_viewer_id.h"
#include <3d_viewer_settings.h>
#include <3d_viewer_id.h>
#include "../common_ogl/cogl_att_list.h"
#include <3d_actions.h>
#include <3d_viewer/tools/3d_actions.h>
#include <3d_viewer/tools/3d_viewer_control.h>
#include <bitmaps.h>
#include <board_stackup_manager/class_board_stackup.h>
#include <board_stackup_manager/stackup_predefined_prms.h>
#include <class_board.h>
#include <dpi_scaling.h>
#include <gestfich.h>
#include <hotkeys_basic.h>
#include <layers_id_colors_and_visibility.h>
#include <pgm_base.h>
#include <project.h>
@ -42,12 +46,9 @@
#include <settings/settings_manager.h>
#include <tool/common_control.h>
#include <tool/tool_manager.h>
#include <tool/tool_dispatcher.h>
#include <tool/action_toolbar.h>
#include <wildcards_and_files_ext.h>
#include <wx/colordlg.h>
#include <wx/colour.h>
#include <wx/string.h>
#include <wx/toolbar.h>
/**
* Flag to enable 3D viewer main frame window debug tracing.
@ -64,8 +65,6 @@ BEGIN_EVENT_TABLE( EDA_3D_VIEWER, EDA_BASE_FRAME )
EVT_ACTIVATE( EDA_3D_VIEWER::OnActivate )
EVT_SET_FOCUS( EDA_3D_VIEWER::OnSetFocus )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_REDRAW, EDA_3D_VIEWER::ProcessZoom )
EVT_TOOL_RANGE( ID_START_COMMAND_3D, ID_MENU_COMMAND_END,
EDA_3D_VIEWER::Process_Special_Functions )
@ -75,8 +74,6 @@ BEGIN_EVENT_TABLE( EDA_3D_VIEWER, EDA_BASE_FRAME )
EVT_MENU( ID_RENDER_CURRENT_VIEW, EDA_3D_VIEWER::OnRenderEngineSelection )
EVT_MENU( ID_DISABLE_RAY_TRACING, EDA_3D_VIEWER::OnDisableRayTracing )
EVT_MENU_RANGE( ID_MENU3D_GRID, ID_MENU3D_GRID_END, EDA_3D_VIEWER::On3DGridSelection )
EVT_UPDATE_UI( ID_RENDER_CURRENT_VIEW, EDA_3D_VIEWER::OnUpdateUIEngine )
EVT_UPDATE_UI_RANGE( ID_MENU3D_FL_RENDER_MATERIAL_MODE_NORMAL,
ID_MENU3D_FL_RENDER_MATERIAL_MODE_CAD_MODE,
@ -86,18 +83,17 @@ BEGIN_EVENT_TABLE( EDA_3D_VIEWER, EDA_BASE_FRAME )
END_EVENT_TABLE()
EDA_3D_VIEWER::EDA_3D_VIEWER( KIWAY *aKiway, PCB_BASE_FRAME *aParent,
const wxString &aTitle, long style ) :
KIWAY_PLAYER( aKiway, aParent,
FRAME_PCB_DISPLAY3D, aTitle,
wxDefaultPosition, wxDefaultSize,
style, QUALIFIED_VIEWER3D_FRAMENAME( aParent ) )
EDA_3D_VIEWER::EDA_3D_VIEWER( KIWAY *aKiway, PCB_BASE_FRAME *aParent, const wxString &aTitle,
long style ) :
KIWAY_PLAYER( aKiway, aParent, FRAME_PCB_DISPLAY3D, aTitle, wxDefaultPosition,
wxDefaultSize, style, QUALIFIED_VIEWER3D_FRAMENAME( aParent ) ),
m_mainToolBar( nullptr ),
m_canvas( nullptr ),
m_toolDispatcher( nullptr )
{
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::EDA_3D_VIEWER %s", aTitle );
m_canvas = NULL;
m_disable_ray_tracing = false;
m_mainToolBar = nullptr;
m_AboutTitle = "3D Viewer";
// Give it an icon
@ -115,11 +111,8 @@ EDA_3D_VIEWER::EDA_3D_VIEWER( KIWAY *aKiway, PCB_BASE_FRAME *aParent,
wxStatusBar *status_bar = CreateStatusBar( arrayDim( status_dims ) );
SetStatusWidths( arrayDim( status_dims ), status_dims );
m_canvas = new EDA_3D_CANVAS( this,
COGL_ATT_LIST::GetAttributesList( true ),
aParent->GetBoard(),
m_settings,
Prj().Get3DCacheManager() );
m_canvas = new EDA_3D_CANVAS( this, COGL_ATT_LIST::GetAttributesList( true ),
aParent->GetBoard(), m_settings, Prj().Get3DCacheManager() );
if( m_canvas )
m_canvas->SetStatusBar( status_bar );
@ -129,13 +122,20 @@ EDA_3D_VIEWER::EDA_3D_VIEWER( KIWAY *aKiway, PCB_BASE_FRAME *aParent,
// Create the manager
m_toolManager = new TOOL_MANAGER;
m_toolManager->SetEnvironment( nullptr, nullptr, nullptr, this );
m_toolManager->SetEnvironment( GetBoard(), nullptr, nullptr, this );
m_actions = new EDA_3D_ACTIONS();
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
m_canvas->SetEventDispatcher( m_toolDispatcher );
// Register tools
m_toolManager->RegisterTool( new COMMON_CONTROL );
m_actions = new EDA_3D_ACTIONS();
m_toolManager->RegisterTool( new EDA_3D_VIEWER_CONTROL );
m_toolManager->InitTools();
// Run the viewer control tool, it is supposed to be always active
m_toolManager->InvokeTool( "3DViewer.Control" );
CreateMenuBar();
ReCreateMainToolbar();
@ -146,9 +146,6 @@ EDA_3D_VIEWER::EDA_3D_VIEWER( KIWAY *aKiway, PCB_BASE_FRAME *aParent,
m_auimgr.Update();
m_mainToolBar->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( EDA_3D_VIEWER::OnKeyEvent ),
NULL, this );
// Fixes bug in Windows (XP and possibly others) where the canvas requires the focus
// in order to receive mouse events. Otherwise, the user has to click somewhere on
// the canvas before it will respond to mouse wheel events.
@ -159,8 +156,7 @@ EDA_3D_VIEWER::EDA_3D_VIEWER( KIWAY *aKiway, PCB_BASE_FRAME *aParent,
EDA_3D_VIEWER::~EDA_3D_VIEWER()
{
m_mainToolBar->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( EDA_3D_VIEWER::OnKeyEvent ),
NULL, this );
m_canvas->SetEventDispatcher( nullptr );
m_auimgr.UnInit();
@ -216,8 +212,6 @@ void EDA_3D_VIEWER::OnCloseWindow( wxCloseEvent &event )
}
#define ROT_ANGLE 10.0
void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
{
int id = event.GetId();
@ -236,91 +230,6 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
NewDisplay( true );
break;
case ID_ROTATE3D_X_POS:
m_settings.CameraGet().RotateX( glm::radians( ROT_ANGLE ) );
if( m_settings.RenderEngineGet() == RENDER_ENGINE::OPENGL_LEGACY )
m_canvas->Request_refresh();
else
m_canvas->RenderRaytracingRequest();
break;
case ID_ROTATE3D_X_NEG:
m_settings.CameraGet().RotateX( -glm::radians( ROT_ANGLE ) );
if( m_settings.RenderEngineGet() == RENDER_ENGINE::OPENGL_LEGACY )
m_canvas->Request_refresh();
else
m_canvas->RenderRaytracingRequest();
break;
case ID_ROTATE3D_Y_POS:
m_settings.CameraGet().RotateY( glm::radians(ROT_ANGLE) );
if( m_settings.RenderEngineGet() == RENDER_ENGINE::OPENGL_LEGACY )
m_canvas->Request_refresh();
else
m_canvas->RenderRaytracingRequest();
break;
case ID_ROTATE3D_Y_NEG:
m_settings.CameraGet().RotateY( -glm::radians(ROT_ANGLE) );
if( m_settings.RenderEngineGet() == RENDER_ENGINE::OPENGL_LEGACY )
m_canvas->Request_refresh();
else
m_canvas->RenderRaytracingRequest();
break;
case ID_ROTATE3D_Z_POS:
m_settings.CameraGet().RotateZ( glm::radians(ROT_ANGLE) );
if( m_settings.RenderEngineGet() == RENDER_ENGINE::OPENGL_LEGACY )
m_canvas->Request_refresh();
else
m_canvas->RenderRaytracingRequest();
break;
case ID_ROTATE3D_Z_NEG:
m_settings.CameraGet().RotateZ( -glm::radians(ROT_ANGLE) );
if( m_settings.RenderEngineGet() == RENDER_ENGINE::OPENGL_LEGACY )
m_canvas->Request_refresh();
else
m_canvas->RenderRaytracingRequest();
break;
case ID_MOVE3D_LEFT:
m_canvas->SetView3D( WXK_LEFT );
return;
case ID_MOVE3D_RIGHT:
m_canvas->SetView3D( WXK_RIGHT );
return;
case ID_MOVE3D_UP:
m_canvas->SetView3D( WXK_UP );
return;
case ID_MOVE3D_DOWN:
m_canvas->SetView3D( WXK_DOWN );
return;
case ID_ORTHO:
m_settings.CameraGet().ToggleProjection();
if( m_settings.RenderEngineGet() == RENDER_ENGINE::OPENGL_LEGACY )
m_canvas->Request_refresh();
else
m_canvas->RenderRaytracingRequest();
return;
case ID_TOOL_SCREENCOPY_TOCLIBBOARD:
case ID_MENU_SCREENCOPY_PNG:
case ID_MENU_SCREENCOPY_JPEG:
@ -373,11 +282,6 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
NewDisplay( true );
break;
case ID_MENU3D_REALISTIC_MODE:
m_settings.SetFlag( FL_USE_REALISTIC_MODE, isChecked );
NewDisplay( true );
return;
case ID_MENU3D_FL_RENDER_MATERIAL_MODE_NORMAL:
m_settings.MaterialModeSet( MATERIAL_MODE::NORMAL );
NewDisplay( true );
@ -393,111 +297,6 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
NewDisplay( true );
return;
case ID_MENU3D_FL_OPENGL_RENDER_COPPER_THICKNESS:
m_settings.SetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS, isChecked );
NewDisplay( true );
return;
case ID_MENU3D_FL_OPENGL_RENDER_SHOW_MODEL_BBOX:
m_settings.SetFlag( FL_RENDER_OPENGL_SHOW_MODEL_BBOX, isChecked );
m_canvas->Request_refresh();
return;
case ID_MENU3D_FL_RAYTRACING_RENDER_SHADOWS:
m_settings.SetFlag( FL_RENDER_RAYTRACING_SHADOWS, isChecked );
m_canvas->Request_refresh();
return;
case ID_MENU3D_FL_RAYTRACING_PROCEDURAL_TEXTURES:
m_settings.SetFlag( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES, isChecked );
NewDisplay( true );
return;
case ID_MENU3D_FL_RAYTRACING_BACKFLOOR:
m_settings.SetFlag( FL_RENDER_RAYTRACING_BACKFLOOR, isChecked );
NewDisplay( true );
return;
case ID_MENU3D_FL_RAYTRACING_REFRACTIONS:
m_settings.SetFlag( FL_RENDER_RAYTRACING_REFRACTIONS, isChecked );
m_canvas->Request_refresh();
return;
case ID_MENU3D_FL_RAYTRACING_REFLECTIONS:
m_settings.SetFlag( FL_RENDER_RAYTRACING_REFLECTIONS, isChecked );
m_canvas->Request_refresh();
return;
case ID_MENU3D_FL_RAYTRACING_POST_PROCESSING:
m_settings.SetFlag( FL_RENDER_RAYTRACING_POST_PROCESSING, isChecked );
NewDisplay( true );
return;
case ID_MENU3D_FL_RAYTRACING_ANTI_ALIASING:
m_settings.SetFlag( FL_RENDER_RAYTRACING_ANTI_ALIASING, isChecked );
m_canvas->Request_refresh();
return;
case ID_MENU3D_SHOW_BOARD_BODY:
m_settings.SetFlag( FL_SHOW_BOARD_BODY, isChecked );
NewDisplay( true );
return;
case ID_MENU3D_AXIS_ONOFF:
m_settings.SetFlag( FL_AXIS, isChecked );
m_canvas->Request_refresh();
return;
case ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_NORMAL:
m_settings.SetFlag( FL_MODULE_ATTRIBUTES_NORMAL, isChecked );
NewDisplay( true );
return;
case ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_NORMAL_INSERT:
m_settings.SetFlag( FL_MODULE_ATTRIBUTES_NORMAL_INSERT, isChecked );
NewDisplay( true );
return;
case ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_VIRTUAL:
m_settings.SetFlag( FL_MODULE_ATTRIBUTES_VIRTUAL, isChecked );
NewDisplay( true );
return;
case ID_MENU3D_ZONE_ONOFF:
m_settings.SetFlag( FL_ZONE, isChecked );
NewDisplay( true );
return;
case ID_MENU3D_ADHESIVE_ONOFF:
m_settings.SetFlag( FL_ADHESIVE, isChecked );
NewDisplay( true );
return;
case ID_MENU3D_SILKSCREEN_ONOFF:
m_settings.SetFlag( FL_SILKSCREEN, isChecked );
NewDisplay( true );
return;
case ID_MENU3D_SOLDER_MASK_ONOFF:
m_settings.SetFlag( FL_SOLDERMASK, isChecked );
NewDisplay( true );
return;
case ID_MENU3D_SOLDER_PASTE_ONOFF:
m_settings.SetFlag( FL_SOLDERPASTE, isChecked );
NewDisplay( true );
return;
case ID_MENU3D_COMMENTS_ONOFF:
m_settings.SetFlag( FL_COMMENTS, isChecked );
NewDisplay( true );
return;
case ID_MENU3D_ECO_ONOFF:
m_settings.SetFlag( FL_ECO, isChecked );
NewDisplay( true );
return;
case ID_MENU3D_RESET_DEFAULTS:
{
auto cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
@ -518,57 +317,6 @@ void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
}
void EDA_3D_VIEWER::On3DGridSelection( wxCommandEvent &event )
{
int id = event.GetId();
wxASSERT( id < ID_MENU3D_GRID_END );
wxASSERT( id > ID_MENU3D_GRID );
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::On3DGridSelection id %d", id );
switch( id )
{
case ID_MENU3D_GRID_NOGRID:
m_settings.GridSet( GRID3D_TYPE::NONE );
break;
case ID_MENU3D_GRID_10_MM:
m_settings.GridSet( GRID3D_TYPE::GRID_10MM );
break;
case ID_MENU3D_GRID_5_MM:
m_settings.GridSet( GRID3D_TYPE::GRID_5MM );
break;
case ID_MENU3D_GRID_2P5_MM:
m_settings.GridSet( GRID3D_TYPE::GRID_2P5MM );
break;
case ID_MENU3D_GRID_1_MM:
m_settings.GridSet( GRID3D_TYPE::GRID_1MM );
break;
default:
wxFAIL_MSG( "Invalid event in EDA_3D_VIEWER::On3DGridSelection()" );
}
int menu_ids[]
{
ID_MENU3D_GRID_NOGRID, ID_MENU3D_GRID_10_MM, ID_MENU3D_GRID_5_MM,
ID_MENU3D_GRID_2P5_MM, ID_MENU3D_GRID_1_MM
};
// Refresh checkmarks
wxMenuBar* menuBar = GetMenuBar();
for( int ii = 0; ii < 5; ii++ )
{
wxMenuItem* item = menuBar->FindItem( menu_ids[ii] );
item->Check( menu_ids[ii] == id );
}
if( m_canvas )
m_canvas->Request_refresh();
}
void EDA_3D_VIEWER::OnRenderEngineSelection( wxCommandEvent &event )
{
const RENDER_ENGINE old_engine = m_settings.RenderEngineGet();
@ -589,28 +337,6 @@ void EDA_3D_VIEWER::OnRenderEngineSelection( wxCommandEvent &event )
}
void EDA_3D_VIEWER::ProcessZoom( wxCommandEvent &event )
{
int id = event.GetId();
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::ProcessZoom id:%d", id );
if( m_canvas == NULL )
return;
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()" );
}
m_canvas->DisplayStatus();
}
void EDA_3D_VIEWER::OnDisableRayTracing( wxCommandEvent& aEvent )
{
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::%s disabling ray tracing.", __WXFUNCTION__ );
@ -876,15 +602,6 @@ void EDA_3D_VIEWER::CommonSettingsChanged( bool aEnvVarsChanged )
}
void EDA_3D_VIEWER::OnKeyEvent( wxKeyEvent& event )
{
if( m_canvas )
return m_canvas->OnKeyEvent( event );
event.Skip();
}
void EDA_3D_VIEWER::takeScreenshot( wxCommandEvent& event )
{
wxString fullFileName;

View File

@ -77,6 +77,8 @@ class EDA_3D_VIEWER : public KIWAY_PLAYER
BOARD* GetBoard() { return Parent()->GetBoard(); }
EDA_3D_CANVAS* GetCanvas() { return m_canvas; }
/**
* Request reloading the 3D view. However the request will be executed
* only when the 3D canvas is refreshed.
@ -108,55 +110,47 @@ class EDA_3D_VIEWER : public KIWAY_PLAYER
* Get a SFVEC3D from a wx colour dialog
* @param aColor is the SFVEC3D to change
* @param aTitle is the title displayed in the colordialog selector
* @param aPredefinedColors is a reference to a CUSTOM_COLOR_ITEM list
* which contains a few predefined colors
* if empty, no predefined colors are used.
* no change if aborted by user
* @param aPredefinedColors is a reference to a CUSTOM_COLOR_ITEM list which contains
* a few predefined colors
*/
bool Set3DColorFromUser( SFVEC3D &aColor, const wxString& aTitle,
CUSTOM_COLORS_LIST* aPredefinedColors );
/**
* Set the solder mask color from a set of colors
* @return true if a new color is chosen, false if
* no change or aborted by user
* @return true if a new color is chosen, false if no change or aborted by user
*/
bool Set3DSolderMaskColorFromUser();
/**
* Set the solder mask color from a set of colors
* @return true if a new color is chosen, false if
* no change or aborted by user
* @return true if a new color is chosen, false if no change or aborted by user
*/
bool Set3DSolderPasteColorFromUser();
/**
* Set the copper color from a set of colors
* @return true if a new color is chosen, false if
* no change or aborted by user
* @return true if a new color is chosen, false if no change or aborted by user
*/
bool Set3DCopperColorFromUser();
/**
* Set the copper color from a set of colors
* @return true if a new color is chosen, false if
* no change or aborted by user
* @return true if a new color is chosen, false if no change or aborted by user
*/
bool Set3DBoardBodyColorFromUser();
/**
* Set the silkscreen color from a set of colors
* @return true if a new color is chosen, false if
* no change or aborted by user
* @return true if a new color is chosen, false if no change or aborted by user
*/
bool Set3DSilkScreenColorFromUser();
/**
* Notification that common settings are updated.
*
* This would be private (and only called by the Kiway), but we
* need to do this manually from the PCB frame because the 3D viewer isn't
* updated via the #KIWAY.
* This would be private (and only called by the Kiway), but we need to do this manually
* from the PCB frame because the 3D viewer isn't updated via the #KIWAY.
*/
void CommonSettingsChanged( bool aEnvVarsChanged ) override;
@ -171,13 +165,9 @@ private:
void Process_Special_Functions( wxCommandEvent &event );
void On3DGridSelection( wxCommandEvent &event );
void OnRenderEngineSelection( wxCommandEvent &event );
void OnDisableRayTracing( wxCommandEvent& aEvent );
void ProcessZoom( wxCommandEvent &event );
void OnActivate( wxActivateEvent &event );
void OnSetFocus( wxFocusEvent &event );
@ -188,18 +178,13 @@ private:
void OnUpdateUIMaterial( wxUpdateUIEvent& aEvent );
void CreateMenuBar();
/**
* Equivalent of EDA_DRAW_FRAME::ReCreateHToolbar
*/
void ReCreateMainToolbar();
void SyncToolbars() override;
void SaveSettings( APP_SETTINGS_BASE *aCfg ) override;
void LoadSettings( APP_SETTINGS_BASE *aCfg ) override;
void OnKeyEvent( wxKeyEvent& event );
/**
* Create a Screenshot of the current 3D view.
* Output file format is png or jpeg, or image is copied to the clipboard
@ -220,13 +205,15 @@ private:
*/
void loadCommonSettings();
wxFileName m_defaultSaveScreenshotFileName;
wxFileName m_defaultSaveScreenshotFileName;
wxAuiToolBar* m_mainToolBar;
EDA_3D_CANVAS* m_canvas;
CINFO3D_VISU m_settings;
ACTION_TOOLBAR* m_mainToolBar;
EDA_3D_CANVAS* m_canvas;
CINFO3D_VISU m_settings;
bool m_disable_ray_tracing;
TOOL_DISPATCHER* m_toolDispatcher;
bool m_disable_ray_tracing;
/**
* Trace mask used to enable or disable the trace output of this class.

View File

@ -0,0 +1,300 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 Jon Evans <jon@craftyjon.com>
* Copyright (C) 2017-2020 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <tool/tool_manager.h>
#include <bitmaps.h>
#include <3d_viewer_id.h>
#include <3d_enums.h>
#include "3d_actions.h"
// Actions, being statically-defined, require specialized I18N handling. We continue to
// use the _() macro so that string harvesting by the I18N framework doesn't have to be
// specialized, but we don't translate on initialization and instead do it in the getters.
#undef _
#define _(s) s
TOOL_ACTION EDA_3D_ACTIONS::controlActivate( "3DViewer.Control", AS_GLOBAL,
0, "", "", "",
NULL, AF_ACTIVATE ); // No description, it is not supposed to be shown anywhere
TOOL_ACTION EDA_3D_ACTIONS::pivotCenter( "3DViewer.Control.pivotCenter",
AS_GLOBAL,
' ', "",
"Center pivot rotation (Middle mouse click)" );
TOOL_ACTION EDA_3D_ACTIONS::rotateXCW( "3DViewer.Control.rotateXclockwise",
AS_GLOBAL,
0, "",
_( "Rotate X Clockwise" ), _( "Rotate X Clockwise" ),
rotate_neg_x_xpm, AF_NONE, (void*) ID_ROTATE3D_X_NEG );
TOOL_ACTION EDA_3D_ACTIONS::rotateXCCW( "3DViewer.Control.rotateXcounterclockwise",
AS_GLOBAL,
0, "",
_( "Rotate X Counterclockwise" ), _( "Rotate X Counterclockwise" ),
rotate_pos_x_xpm, AF_NONE, (void*) ID_ROTATE3D_X_POS );
TOOL_ACTION EDA_3D_ACTIONS::rotateYCW( "3DViewer.Control.rotateYclockwise",
AS_GLOBAL,
0, "",
_( "Rotate Y Clockwise" ), _( "Rotate Y Clockwise" ),
rotate_neg_y_xpm, AF_NONE, (void*) ID_ROTATE3D_Y_NEG );
TOOL_ACTION EDA_3D_ACTIONS::rotateYCCW( "3DViewer.Control.rotateYcounterclockwise",
AS_GLOBAL,
0, "",
_( "Rotate Y Counterclockwise" ), _( "Rotate Y Counterclockwise" ),
rotate_pos_y_xpm, AF_NONE, (void*) ID_ROTATE3D_Y_POS );
TOOL_ACTION EDA_3D_ACTIONS::rotateZCW( "3DViewer.Control.rotateZclockwise",
AS_GLOBAL,
0, "",
_( "Rotate Z Clockwise" ), _( "Rotate Z Clockwise" ),
rotate_neg_z_xpm, AF_NONE, (void*) ID_ROTATE3D_Z_NEG );
TOOL_ACTION EDA_3D_ACTIONS::rotateZCCW( "3DViewer.Control.rotateZcounterclockwise",
AS_GLOBAL,
0, "",
_( "Rotate Z Counterclockwise" ), _( "Rotate Z Counterclockwise" ),
rotate_pos_z_xpm, AF_NONE, (void*) ID_ROTATE3D_Z_POS );
TOOL_ACTION EDA_3D_ACTIONS::moveLeft( "3DViewer.Control.moveLeft",
AS_GLOBAL,
WXK_LEFT, "",
_( "Move board Left" ), _( "Move board Left" ),
left_xpm, AF_NONE, (void*) CURSOR_LEFT );
TOOL_ACTION EDA_3D_ACTIONS::moveRight( "3DViewer.Control.moveRight",
AS_GLOBAL,
WXK_RIGHT, "",
_( "Move board Right" ), _( "Move board Right" ),
right_xpm, AF_NONE, (void*) CURSOR_RIGHT );
TOOL_ACTION EDA_3D_ACTIONS::moveUp( "3DViewer.Control.moveUp",
AS_GLOBAL,
WXK_UP, "",
_( "Move board Up" ), _( "Move board Up" ),
up_xpm, AF_NONE, (void*) CURSOR_UP );
TOOL_ACTION EDA_3D_ACTIONS::moveDown( "3DViewer.Control.moveDown",
AS_GLOBAL,
WXK_DOWN, "",
_( "Move board Down" ), _( "Move board Down" ),
down_xpm, AF_NONE, (void*) CURSOR_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::toggleOrtho( "3DViewer.Control.toggleOrtho",
AS_GLOBAL, 0, "",
_( "Toggle orthographic projection" ), _( "Enable/disable orthographic projection" ),
ortho_xpm );
TOOL_ACTION EDA_3D_ACTIONS::viewFront( "3DViewer.Control.viewFront",
AS_GLOBAL,
'Y', "",
_( "View Front" ), _( "View Front" ),
axis3d_front_xpm, AF_NONE, (void*) ID_VIEW3D_FRONT );
TOOL_ACTION EDA_3D_ACTIONS::viewBack( "3DViewer.Control.viewBack",
AS_GLOBAL,
MD_SHIFT + 'Y', "",
_( "View Back" ), _( "View Back" ),
axis3d_back_xpm, AF_NONE, (void*) ID_VIEW3D_BACK );
TOOL_ACTION EDA_3D_ACTIONS::viewLeft( "3DViewer.Control.viewLeft",
AS_GLOBAL,
MD_SHIFT + 'X', "",
_( "View Left" ), _( "View Left" ),
axis3d_left_xpm, AF_NONE, (void*) ID_VIEW3D_LEFT );
TOOL_ACTION EDA_3D_ACTIONS::viewRight( "3DViewer.Control.viewRight",
AS_GLOBAL,
'X', "",
_( "View Right" ), _( "View Right" ),
axis3d_right_xpm, AF_NONE, (void*) ID_VIEW3D_RIGHT );
TOOL_ACTION EDA_3D_ACTIONS::viewTop( "3DViewer.Control.viewTop",
AS_GLOBAL,
'Z', "",
_( "View Top" ), _( "View Top" ),
axis3d_top_xpm, AF_NONE, (void*) ID_VIEW3D_TOP );
TOOL_ACTION EDA_3D_ACTIONS::viewBottom( "3DViewer.Control.viewBottom",
AS_GLOBAL,
MD_SHIFT + 'Z', "",
_( "View Bottom" ), _( "View Bottom" ),
axis3d_bottom_xpm, AF_NONE, (void*) ID_VIEW3D_BOTTOM );
TOOL_ACTION EDA_3D_ACTIONS::noGrid( "3DViewer.Control.noGrid",
AS_GLOBAL, 0, "",
_( "No 3D Grid" ), _( "No 3D Grid" ),
nullptr, AF_NONE, (void*) GRID3D_TYPE::NONE );
TOOL_ACTION EDA_3D_ACTIONS::show10mmGrid( "3DViewer.Control.show10mmGrid",
AS_GLOBAL, 0, "",
_( "3D Grid 10mm" ), _( "3D Grid 10mm" ),
nullptr, AF_NONE, (void*) GRID3D_TYPE::GRID_10MM );
TOOL_ACTION EDA_3D_ACTIONS::show5mmGrid( "3DViewer.Control.show5mmGrid",
AS_GLOBAL, 0, "",
_( "3D Grid 5mm" ), _( "3D Grid 5mm" ),
nullptr, AF_NONE, (void*) GRID3D_TYPE::GRID_5MM );
TOOL_ACTION EDA_3D_ACTIONS::show2_5mmGrid( "3DViewer.Control.show2_5mmGrid",
AS_GLOBAL, 0, "",
_( "3D Grid 2.5mm" ), _( "3D Grid 2.5mm" ),
nullptr, AF_NONE, (void*) GRID3D_TYPE::GRID_2P5MM );
TOOL_ACTION EDA_3D_ACTIONS::show1mmGrid( "3DViewer.Control.show1mmGrid",
AS_GLOBAL, 0, "",
_( "3D Grid 1mm" ), _( "3D Grid 1mm" ),
nullptr, AF_NONE, (void*) GRID3D_TYPE::GRID_1MM );
TOOL_ACTION EDA_3D_ACTIONS::rotate45axisZ( "3DViewer.Control.rotate45axisZ",
AS_GLOBAL,
WXK_TAB, "",
"Rotate 45 degrees over Z axis" );
TOOL_ACTION EDA_3D_ACTIONS::attributesTHT( "3DViewer.Control.attributesTHT",
AS_GLOBAL,
'T', "",
_( "Toggle Through Hole 3D models" ), _( "Toggle 3D models with 'Through hole' attribute" ),
nullptr, AF_NONE, (void*) FL_MODULE_ATTRIBUTES_NORMAL );
TOOL_ACTION EDA_3D_ACTIONS::attributesSMD( "3DViewer.Control.attributesSMD",
AS_GLOBAL,
'S', "",
_( "Toggle SMD 3D models" ), _( "Toggle 3D models with 'Surface mount' attribute" ),
nullptr, AF_NONE, (void*) FL_MODULE_ATTRIBUTES_NORMAL_INSERT );
TOOL_ACTION EDA_3D_ACTIONS::attributesVirtual( "3DViewer.Control.attributesVirtual",
AS_GLOBAL,
'V', "",
_( "Toggle Virtual 3D models" ), _( "Toggle 3D models with 'Virtual' attribute" ),
nullptr, AF_NONE, (void*) FL_MODULE_ATTRIBUTES_VIRTUAL );
TOOL_ACTION EDA_3D_ACTIONS::showCopperThickness( "3DViewer.Control.showCopperThickness",
AS_GLOBAL, 0, "",
_( "Show Copper Thickness" ), _( "Shows the thickness of copper layers (slow)" ),
use_3D_copper_thickness_xpm, AF_NONE, (void*) FL_RENDER_OPENGL_COPPER_THICKNESS );
TOOL_ACTION EDA_3D_ACTIONS::showBoundingBoxes( "3DViewer.Control.showBoundingBoxes",
AS_GLOBAL, 0, "",
_( "Show Model Bounding Boxes" ), _( "Show Model Bounding Boxes" ),
ortho_xpm, AF_NONE, (void*) FL_RENDER_OPENGL_SHOW_MODEL_BBOX );
TOOL_ACTION EDA_3D_ACTIONS::renderShadows( "3DViewer.Control.renderShadows",
AS_GLOBAL, 0, "",
_( "Render Shadows" ), _( "Render Shadows" ),
nullptr, AF_NONE, (void*) FL_RENDER_RAYTRACING_SHADOWS );
TOOL_ACTION EDA_3D_ACTIONS::proceduralTextures( "3DViewer.Control.proceduralTextures",
AS_GLOBAL, 0, "",
_( "Procedural Textures" ), _( "Apply procedural textures to materials (slow)" ),
nullptr, AF_NONE, (void*) FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES );
TOOL_ACTION EDA_3D_ACTIONS::addFloor( "3DViewer.Control.addFloor",
AS_GLOBAL, 0, "",
_( "Add Floor" ), _( "Adds a floor plane below the board (slow)"),
nullptr, AF_NONE, (void*) FL_RENDER_RAYTRACING_BACKFLOOR );
TOOL_ACTION EDA_3D_ACTIONS::showRefractions( "3DViewer.Control.showRefractions",
AS_GLOBAL, 0, "",
_( "Refractions" ), _( "Render materials with refractive properties on final render (slow)" ),
nullptr, AF_NONE, (void*) FL_RENDER_RAYTRACING_REFRACTIONS );
TOOL_ACTION EDA_3D_ACTIONS::showReflections( "3DViewer.Control.showReflections",
AS_GLOBAL, 0, "",
_( "Reflections" ), _( "Render materials with reflective properties on final render (slow)" ),
nullptr, AF_NONE, (void*) FL_RENDER_RAYTRACING_REFLECTIONS );
TOOL_ACTION EDA_3D_ACTIONS::antiAliasing( "3DViewer.Control.antiAliasing",
AS_GLOBAL, 0, "",
_( "Anti-aliasing" ), _( "Render with improved quality on final render (slow)" ),
nullptr, AF_NONE, (void*) FL_RENDER_RAYTRACING_ANTI_ALIASING );
TOOL_ACTION EDA_3D_ACTIONS::postProcessing( "3DViewer.Control.postProcessing",
AS_GLOBAL, 0, "",
_( "Post-processing" ),
_( "Apply Screen Space Ambient Occlusion and Global Illumination reflections on final render (slow)"),
nullptr, AF_NONE, (void*) FL_RENDER_RAYTRACING_POST_PROCESSING );
TOOL_ACTION EDA_3D_ACTIONS::toggleRealisticMode( "3DViewer.Control.toggleRealisticMode",
AS_GLOBAL, 0, "",
_( "Toggle realistic mode" ), _( "Toggle realistic mode" ),
nullptr, AF_NONE, (void*) FL_USE_REALISTIC_MODE );
TOOL_ACTION EDA_3D_ACTIONS::toggleBoardBody( "3DViewer.Control.toggleBoardBody",
AS_GLOBAL, 0, "",
_( "Toggle board body display" ), _( "Toggle board body display" ),
nullptr, AF_NONE, (void*) FL_SHOW_BOARD_BODY );
TOOL_ACTION EDA_3D_ACTIONS::showAxis( "3DViewer.Control.showAxis",
AS_GLOBAL, 0, "",
_( "Show 3D Axis" ), _( "Show 3D Axis" ),
axis3d_front_xpm, AF_NONE, (void*) FL_AXIS );
TOOL_ACTION EDA_3D_ACTIONS::toggleZones( "3DViewer.Control.toggleZones",
AS_GLOBAL, 0, "",
_( "Toggle zone display" ), _( "Toggle zone display" ),
nullptr, AF_NONE, (void*) FL_ZONE );
TOOL_ACTION EDA_3D_ACTIONS::toggleAdhesive( "3DViewer.Control.toggleAdhesive",
AS_GLOBAL, 0, "",
_( "Toggle adhesive display" ), _( "Toggle display of adhesive layers" ),
nullptr, AF_NONE, (void*) FL_ADHESIVE );
TOOL_ACTION EDA_3D_ACTIONS::toggleSilk( "3DViewer.Control.toggleSilk",
AS_GLOBAL, 0, "",
_( "Toggle silkscreen display" ), _( "Toggle display of silkscreen layers" ),
nullptr, AF_NONE, (void*) FL_SILKSCREEN );
TOOL_ACTION EDA_3D_ACTIONS::toggleSolderMask( "3DViewer.Control.toggleSolderMask",
AS_GLOBAL, 0, "",
_( "Toggle solder mask display" ), _( "Toggle display of solder mask layers" ),
nullptr, AF_NONE, (void*) FL_SOLDERMASK );
TOOL_ACTION EDA_3D_ACTIONS::toggleSolderPaste( "3DViewer.Control.toggleSolderPaste",
AS_GLOBAL, 0, "",
_( "Toggle solder paste display" ), _( "Toggle display of solder paste layers" ),
nullptr, AF_NONE, (void*) FL_SOLDERPASTE );
TOOL_ACTION EDA_3D_ACTIONS::toggleComments( "3DViewer.Control.toggleComments",
AS_GLOBAL, 0, "",
_( "Toggle comments display" ), _( "Toggle display of comments and drawings layers" ),
nullptr, AF_NONE, (void*) FL_COMMENTS );
TOOL_ACTION EDA_3D_ACTIONS::toggleECO( "3DViewer.Control.toggleECO",
AS_GLOBAL, 0, "",
_( "Toggle ECO display" ), _( "Toggle display of ECO layers" ),
nullptr, AF_NONE, (void*) FL_ECO );

View File

@ -41,13 +41,22 @@ class TOOL_MANAGER;
class EDA_3D_ACTIONS : public ACTIONS
{
public:
static TOOL_ACTION controlActivate;
static TOOL_ACTION pivotCenter;
static TOOL_ACTION rotateXCW;
static TOOL_ACTION rotateXCCW;
static TOOL_ACTION rotateYCW;
static TOOL_ACTION rotateYCCW;
static TOOL_ACTION rotateZCW;
static TOOL_ACTION rotateZCCW;
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 toggleOrtho;
static TOOL_ACTION viewFront;
static TOOL_ACTION viewBack;
@ -56,12 +65,35 @@ public:
static TOOL_ACTION viewTop;
static TOOL_ACTION viewBottom;
static TOOL_ACTION noGrid;
static TOOL_ACTION show10mmGrid;
static TOOL_ACTION show5mmGrid;
static TOOL_ACTION show2_5mmGrid;
static TOOL_ACTION show1mmGrid;
static TOOL_ACTION rotate45axisZ;
static TOOL_ACTION zoomIn;
static TOOL_ACTION zoomOut;
static TOOL_ACTION attributesTHT;
static TOOL_ACTION attributesSMD;
static TOOL_ACTION attributesVirtual;
static TOOL_ACTION showCopperThickness;
static TOOL_ACTION showBoundingBoxes;
static TOOL_ACTION renderShadows;
static TOOL_ACTION proceduralTextures;
static TOOL_ACTION addFloor;
static TOOL_ACTION showRefractions;
static TOOL_ACTION showReflections;
static TOOL_ACTION antiAliasing;
static TOOL_ACTION postProcessing;
static TOOL_ACTION toggleRealisticMode;
static TOOL_ACTION toggleBoardBody;
static TOOL_ACTION showAxis;
static TOOL_ACTION toggleZones;
static TOOL_ACTION toggleAdhesive;
static TOOL_ACTION toggleSilk;
static TOOL_ACTION toggleSolderMask;
static TOOL_ACTION toggleSolderPaste;
static TOOL_ACTION toggleComments;
static TOOL_ACTION toggleECO;
///> @copydoc COMMON_ACTIONS::TranslateLegacyId()
virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override { return OPT<TOOL_EVENT>(); }

View File

@ -0,0 +1,315 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 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
*/
#include <tool/actions.h>
#include <tool/tool_manager.h>
#include <eda_3d_viewer.h>
#include <id.h>
#include <kiface_i.h>
#include <3d_viewer_id.h>
#include "3d_viewer_control.h"
#include "3d_actions.h"
bool EDA_3D_VIEWER_CONTROL::Init()
{
CONDITIONAL_MENU& ctxMenu = m_menu.GetMenu();
ctxMenu.AddItem( ACTIONS::zoomIn, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddItem( ACTIONS::zoomOut, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddSeparator();
ctxMenu.AddItem( EDA_3D_ACTIONS::viewTop, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddItem( EDA_3D_ACTIONS::viewBottom, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddSeparator();
ctxMenu.AddItem( EDA_3D_ACTIONS::viewRight, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddItem( EDA_3D_ACTIONS::viewLeft, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddSeparator();
ctxMenu.AddItem( EDA_3D_ACTIONS::viewFront, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddItem( EDA_3D_ACTIONS::viewBack, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddSeparator();
ctxMenu.AddItem( EDA_3D_ACTIONS::moveLeft, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddItem( EDA_3D_ACTIONS::moveRight, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddItem( EDA_3D_ACTIONS::moveUp, SELECTION_CONDITIONS::ShowAlways );
ctxMenu.AddItem( EDA_3D_ACTIONS::moveDown, SELECTION_CONDITIONS::ShowAlways );
return true;
}
void EDA_3D_VIEWER_CONTROL::Reset( RESET_REASON aReason )
{
m_frame = getEditFrame<EDA_3D_VIEWER>();
}
int EDA_3D_VIEWER_CONTROL::UpdateMenu( const TOOL_EVENT& aEvent )
{
ACTION_MENU* actionMenu = aEvent.Parameter<ACTION_MENU*>();
CONDITIONAL_MENU* conditionalMenu = dynamic_cast<CONDITIONAL_MENU*>( actionMenu );
SELECTION dummySel;
if( conditionalMenu )
conditionalMenu->Evaluate( dummySel );
if( actionMenu )
actionMenu->UpdateAll();
return 0;
}
int EDA_3D_VIEWER_CONTROL::Main( const TOOL_EVENT& aEvent )
{
// Main loop: keep receiving events
while( TOOL_EVENT* evt = Wait() )
{
if( evt->IsClick( BUT_RIGHT ) )
m_menu.ShowContextMenu();
else
evt->SetPassEvent();
}
return 0;
}
int EDA_3D_VIEWER_CONTROL::ViewControl( const TOOL_EVENT& aEvent )
{
m_frame->GetCanvas()->SetView3D( aEvent.Parameter<intptr_t>() );
return 0;
}
int EDA_3D_VIEWER_CONTROL::PanControl( const TOOL_EVENT& aEvent )
{
switch( aEvent.Parameter<intptr_t>() )
{
case ACTIONS::CURSOR_UP: m_frame->GetCanvas()->SetView3D( WXK_UP ); break;
case ACTIONS::CURSOR_DOWN: m_frame->GetCanvas()->SetView3D( WXK_DOWN ); break;
case ACTIONS::CURSOR_LEFT: m_frame->GetCanvas()->SetView3D( WXK_LEFT ); break;
case ACTIONS::CURSOR_RIGHT: m_frame->GetCanvas()->SetView3D( WXK_RIGHT ); break;
default: wxFAIL; break;
}
return 0;
}
#define ROT_ANGLE 10.0
int EDA_3D_VIEWER_CONTROL::RotateView( const TOOL_EVENT& aEvent )
{
CINFO3D_VISU& settings = m_frame->GetSettings();
switch( aEvent.Parameter<intptr_t>() )
{
case ID_ROTATE3D_X_NEG: settings.CameraGet().RotateX( -glm::radians( ROT_ANGLE ) ); break;
case ID_ROTATE3D_X_POS: settings.CameraGet().RotateX( glm::radians( ROT_ANGLE ) ); break;
case ID_ROTATE3D_Y_NEG: settings.CameraGet().RotateY( -glm::radians( ROT_ANGLE ) ); break;
case ID_ROTATE3D_Y_POS: settings.CameraGet().RotateY( glm::radians( ROT_ANGLE ) ); break;
case ID_ROTATE3D_Z_NEG: settings.CameraGet().RotateZ( -glm::radians( ROT_ANGLE ) ); break;
case ID_ROTATE3D_Z_POS: settings.CameraGet().RotateZ( glm::radians( ROT_ANGLE ) ); break;
default: wxFAIL; break;
}
if( settings.RenderEngineGet() == RENDER_ENGINE::OPENGL_LEGACY )
m_frame->GetCanvas()->Request_refresh();
else
m_frame->GetCanvas()->RenderRaytracingRequest();
return 0;
}
int EDA_3D_VIEWER_CONTROL::ToggleOrtho( const TOOL_EVENT& aEvent )
{
m_frame->GetSettings().CameraGet().ToggleProjection();
if( m_frame->GetSettings().RenderEngineGet() == RENDER_ENGINE::OPENGL_LEGACY )
m_frame->GetCanvas()->Request_refresh();
else
m_frame->GetCanvas()->RenderRaytracingRequest();
return 0;
}
int EDA_3D_VIEWER_CONTROL::ToggleVisibility( const TOOL_EVENT& aEvent )
{
DISPLAY3D_FLG flag = aEvent.Parameter<DISPLAY3D_FLG>();
CINFO3D_VISU& settings = m_frame->GetSettings();
settings.SetFlag( flag, !settings.GetFlag( flag ) );
switch( flag )
{
case FL_RENDER_OPENGL_SHOW_MODEL_BBOX:
case FL_RENDER_RAYTRACING_SHADOWS:
case FL_RENDER_RAYTRACING_REFRACTIONS:
case FL_RENDER_RAYTRACING_REFLECTIONS:
case FL_RENDER_RAYTRACING_ANTI_ALIASING:
case FL_AXIS:
m_frame->GetCanvas()->Request_refresh();
break;
default:
m_frame->NewDisplay( true );
break;
}
return 0;
}
int EDA_3D_VIEWER_CONTROL::On3DGridSelection( const TOOL_EVENT& aEvent )
{
GRID3D_TYPE grid = aEvent.Parameter<GRID3D_TYPE>();
m_frame->GetSettings().GridSet( grid );
if( m_frame->GetCanvas() )
m_frame->GetCanvas()->Request_refresh();
return 0;
}
int EDA_3D_VIEWER_CONTROL::ZoomRedraw( const TOOL_EVENT& aEvent )
{
m_frame->GetCanvas()->Request_refresh();
return 0;
}
int EDA_3D_VIEWER_CONTROL::ZoomInOut( const TOOL_EVENT& aEvent )
{
bool direction = aEvent.IsAction( &ACTIONS::zoomIn );
return doZoomInOut( direction, true );
}
int EDA_3D_VIEWER_CONTROL::ZoomInOutCenter( const TOOL_EVENT& aEvent )
{
bool direction = aEvent.IsAction( &ACTIONS::zoomInCenter );
return doZoomInOut( direction, false );
}
int EDA_3D_VIEWER_CONTROL::doZoomInOut( bool aDirection, bool aCenterOnCursor )
{
if( m_frame->GetCanvas() )
{
m_frame->GetCanvas()->SetView3D( aDirection ? WXK_F1 : WXK_F2 );
m_frame->GetCanvas()->DisplayStatus();
}
return 0;
}
int EDA_3D_VIEWER_CONTROL::ZoomFitScreen( const TOOL_EVENT& aEvent )
{
if( m_frame->GetCanvas() )
{
m_frame->GetCanvas()->SetView3D( WXK_HOME );
m_frame->GetCanvas()->DisplayStatus();
}
return 0;
}
void EDA_3D_VIEWER_CONTROL::setTransitions()
{
Go( &EDA_3D_VIEWER_CONTROL::Main, EDA_3D_ACTIONS::controlActivate.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::UpdateMenu, ACTIONS::updateMenu.MakeEvent() );
// Pan control
Go( &EDA_3D_VIEWER_CONTROL::PanControl, ACTIONS::panUp.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::PanControl, ACTIONS::panDown.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::PanControl, ACTIONS::panLeft.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::PanControl, ACTIONS::panRight.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::PanControl, EDA_3D_ACTIONS::moveUp.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::PanControl, EDA_3D_ACTIONS::moveDown.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::PanControl, EDA_3D_ACTIONS::moveLeft.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::PanControl, EDA_3D_ACTIONS::moveRight.MakeEvent() );
// View rotation
Go( &EDA_3D_VIEWER_CONTROL::ViewControl, EDA_3D_ACTIONS::viewTop.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ViewControl, EDA_3D_ACTIONS::viewBottom.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ViewControl, EDA_3D_ACTIONS::viewLeft.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ViewControl, EDA_3D_ACTIONS::viewRight.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ViewControl, EDA_3D_ACTIONS::viewFront.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ViewControl, EDA_3D_ACTIONS::viewBack.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::RotateView, EDA_3D_ACTIONS::rotateXCW.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::RotateView, EDA_3D_ACTIONS::rotateXCCW.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::RotateView, EDA_3D_ACTIONS::rotateYCW.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::RotateView, EDA_3D_ACTIONS::rotateYCCW.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::RotateView, EDA_3D_ACTIONS::rotateZCW.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::RotateView, EDA_3D_ACTIONS::rotateZCCW.MakeEvent() );
// Zoom control
Go( &EDA_3D_VIEWER_CONTROL::ZoomRedraw, ACTIONS::zoomRedraw.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ZoomInOut, ACTIONS::zoomIn.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ZoomInOut, ACTIONS::zoomOut.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ZoomInOutCenter, ACTIONS::zoomInCenter.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ZoomInOutCenter, ACTIONS::zoomOutCenter.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ZoomFitScreen, ACTIONS::zoomFitScreen.MakeEvent() );
// Grid
Go( &EDA_3D_VIEWER_CONTROL::On3DGridSelection, EDA_3D_ACTIONS::noGrid.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::On3DGridSelection, EDA_3D_ACTIONS::show10mmGrid.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::On3DGridSelection, EDA_3D_ACTIONS::show5mmGrid.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::On3DGridSelection, EDA_3D_ACTIONS::show2_5mmGrid.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::On3DGridSelection, EDA_3D_ACTIONS::show1mmGrid.MakeEvent() );
// Visibility
Go( &EDA_3D_VIEWER_CONTROL::ToggleOrtho, EDA_3D_ACTIONS::toggleOrtho.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::attributesTHT.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::attributesSMD.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::attributesVirtual.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::showCopperThickness.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::showBoundingBoxes.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::renderShadows.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::proceduralTextures.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::addFloor.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::showRefractions.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::showReflections.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::antiAliasing.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::postProcessing.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::toggleRealisticMode.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::toggleBoardBody.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::showAxis.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::toggleZones.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::toggleAdhesive.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::toggleSilk.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::toggleSolderMask.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::toggleSolderPaste.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::toggleComments.MakeEvent() );
Go( &EDA_3D_VIEWER_CONTROL::ToggleVisibility, EDA_3D_ACTIONS::toggleECO.MakeEvent() );
}

View File

@ -0,0 +1,82 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 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
*/
#ifndef _3D_VIEWER_CONTROL_H
#define _3D_VIEWER_CONTROL_H
#include <tool/tool_interactive.h>
class EDA_3D_VIEWER;
/**
* 3D_VIEWER_CONTROL
*
* Handles actions that are shared between different applications
*/
class EDA_3D_VIEWER_CONTROL : public TOOL_INTERACTIVE
{
public:
EDA_3D_VIEWER_CONTROL() :
TOOL_INTERACTIVE( "3DViewer.Control" ),
m_frame( nullptr )
{ }
~EDA_3D_VIEWER_CONTROL() override { }
/// @copydoc TOOL_INTERACTIVE::Init()
bool Init() override;
/// @copydoc TOOL_BASE::Reset()
void Reset( RESET_REASON aReason ) override;
int UpdateMenu( const TOOL_EVENT& aEvent );
int Main( const TOOL_EVENT& aEvent );
// View controls
int ZoomRedraw( const TOOL_EVENT& aEvent );
int ZoomInOut( const TOOL_EVENT& aEvent );
int ZoomInOutCenter( const TOOL_EVENT& aEvent );
int ZoomFitScreen( const TOOL_EVENT& aEvent );
int PanControl( const TOOL_EVENT& aEvent );
int ViewControl( const TOOL_EVENT& aEvent );
int RotateView( const TOOL_EVENT& aEvent );
int On3DGridSelection( const TOOL_EVENT& aEvent );
int ToggleOrtho( const TOOL_EVENT& aEvent );
int ToggleVisibility( const TOOL_EVENT& aEvent );
private:
///> Sets up handlers for various events.
void setTransitions() override;
///> Pointer to the currently used edit frame.
EDA_3D_VIEWER* m_frame;
int doZoomInOut( bool aDirection, bool aCenterOnCursor );
};
#endif

View File

@ -24,12 +24,13 @@ enum id_3dview_frm
ID_ROTATE3D_Z_NEG,
ID_ROTATE3D_Z_POS,
ID_RELOAD3D_BOARD,
ID_VIEW3D_TOP,
ID_VIEW3D_BOTTOM,
ID_VIEW3D_LEFT,
ID_VIEW3D_RIGHT,
ID_VIEW3D_FRONT,
ID_VIEW3D_BACK,
ID_TOOL_SCREENCOPY_TOCLIBBOARD,
ID_MOVE3D_LEFT,
ID_MOVE3D_RIGHT,
ID_MOVE3D_UP,
ID_MOVE3D_DOWN,
ID_ORTHO,
ID_MENU3D_COLOR,
ID_MENU3D_BGCOLOR,
ID_MENU3D_BGCOLOR_BOTTOM,
@ -40,45 +41,12 @@ enum id_3dview_frm
ID_MENU3D_PCB_BODY_COLOR,
ID_MENU3D_COPPER_COLOR,
ID_MENU3D_STACKUP_COLORS,
ID_MENU3D_AXIS_ONOFF,
ID_MENU3D_MODULE_ONOFF,
ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_NORMAL,
ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_NORMAL_INSERT,
ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_VIRTUAL,
ID_MENU3D_MODULE_ONOFF_END,
ID_MENU3D_ZONE_ONOFF,
ID_MENU3D_LAYERS,
ID_MENU3D_ADHESIVE_ONOFF,
ID_MENU3D_SILKSCREEN_ONOFF,
ID_MENU3D_SOLDER_PASTE_ONOFF,
ID_MENU3D_SOLDER_MASK_ONOFF,
ID_MENU3D_COMMENTS_ONOFF,
ID_MENU3D_ECO_ONOFF,
ID_MENU3D_SHOW_BOARD_BODY,
ID_MENU3D_REALISTIC_MODE,
ID_MENU3D_FL,
ID_MENU3D_FL_RENDER_MATERIAL,
ID_MENU3D_FL_RENDER_MATERIAL_MODE_NORMAL,
ID_MENU3D_FL_RENDER_MATERIAL_MODE_DIFFUSE_ONLY,
ID_MENU3D_FL_RENDER_MATERIAL_MODE_CAD_MODE,
ID_MENU3D_FL_OPENGL,
ID_MENU3D_FL_OPENGL_RENDER_COPPER_THICKNESS,
ID_MENU3D_FL_OPENGL_RENDER_SHOW_MODEL_BBOX,
ID_MENU3D_FL_RAYTRACING,
ID_MENU3D_FL_RAYTRACING_RENDER_SHADOWS,
ID_MENU3D_FL_RAYTRACING_BACKFLOOR,
ID_MENU3D_FL_RAYTRACING_REFRACTIONS,
ID_MENU3D_FL_RAYTRACING_REFLECTIONS,
ID_MENU3D_FL_RAYTRACING_POST_PROCESSING,
ID_MENU3D_FL_RAYTRACING_ANTI_ALIASING,
ID_MENU3D_FL_RAYTRACING_PROCEDURAL_TEXTURES,
ID_MENU_SCREENCOPY_PNG,
ID_MENU_SCREENCOPY_JPEG,
ID_MENU_SCREENCOPY_TOCLIBBOARD,
@ -92,30 +60,7 @@ enum id_3dview_frm
ID_TOOL_SET_VISIBLE_ITEMS,
ID_MENU3D_GRID,
ID_MENU3D_GRID_NOGRID,
ID_MENU3D_GRID_10_MM,
ID_MENU3D_GRID_5_MM,
ID_MENU3D_GRID_2P5_MM,
ID_MENU3D_GRID_1_MM,
ID_MENU3D_GRID_END,
ID_DISABLE_RAY_TRACING,
ID_POPUP_3D_VIEW_START,
ID_POPUP_ZOOMIN,
ID_POPUP_ZOOMOUT,
ID_POPUP_VIEW_XPOS,
ID_POPUP_VIEW_XNEG,
ID_POPUP_VIEW_YPOS,
ID_POPUP_VIEW_YNEG,
ID_POPUP_VIEW_ZPOS,
ID_POPUP_VIEW_ZNEG,
ID_POPUP_MOVE3D_LEFT,
ID_POPUP_MOVE3D_RIGHT,
ID_POPUP_MOVE3D_UP,
ID_POPUP_MOVE3D_DOWN,
ID_POPUP_3D_VIEW_END,
ID_END_COMMAND_3D = ID_KICAD_3D_VIEWER_END,
};

View File

@ -86,13 +86,14 @@ set(3D-VIEWER_SRCS
3d_rendering/cpostshader.cpp
3d_rendering/cpostshader_ssao.cpp
3d_rendering/ctrack_ball.cpp
3d_viewer/3d_actions.cpp
3d_viewer/3d_menubar.cpp
3d_rendering/test_cases.cpp
3d_rendering/trackball.cpp
3d_viewer/3d_toolbar.cpp
3d_viewer/dialogs/dialog_3D_view_option.cpp
3d_viewer/dialogs/dialog_3D_view_option_base.cpp
3d_viewer/tools/3d_actions.cpp
3d_viewer/tools/3d_viewer_control.cpp
3d_viewer/eda_3d_viewer.cpp
3d_viewer/3d_viewer_settings.cpp
common_ogl/cogl_att_list.cpp

View File

@ -326,10 +326,12 @@ int translateSpecialCode( int aKeyCode )
void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent )
{
bool motion = false, buttonEvents = false;
bool motion = false;
bool buttonEvents = false;
VECTOR2D pos;
OPT<TOOL_EVENT> evt;
int key = 0; // key = 0 if the event is not a key event
bool keyIsSpecial = false; // True if the key is a special key code
int key = 0; // key = 0 if the event is not a key event
bool keyIsSpecial = false; // True if the key is a special key code
int type = aEvent.GetEventType();
@ -357,28 +359,39 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent )
wxMouseEvent* me = static_cast<wxMouseEvent*>( &aEvent );
int mods = decodeModifiers( me );
VECTOR2D pos = m_toolMgr->GetViewControls()->GetMousePosition();
if( pos != m_lastMousePos )
if( m_toolMgr->GetViewControls() )
{
motion = true;
m_lastMousePos = pos;
pos = m_toolMgr->GetViewControls()->GetMousePosition();
if( pos != m_lastMousePos )
{
motion = true;
m_lastMousePos = pos;
}
}
for( unsigned int i = 0; i < m_buttons.size(); i++ )
buttonEvents |= handleMouseButton( aEvent, i, motion );
if( !buttonEvents && motion )
if( m_toolMgr->GetViewControls() )
{
evt = TOOL_EVENT( TC_MOUSE, TA_MOUSE_MOTION, mods );
evt->SetMousePosition( pos );
if( !buttonEvents && motion )
{
evt = TOOL_EVENT( TC_MOUSE, TA_MOUSE_MOTION, mods );
evt->SetMousePosition( pos );
}
}
#ifdef __APPLE__
// TODO That's a big ugly workaround, somehow DRAWPANEL_GAL loses focus
// after second LMB click and currently I have no means to do better debugging
if( type == wxEVT_LEFT_UP )
static_cast<EDA_DRAW_FRAME*>( m_toolMgr->GetEditFrame() )->GetCanvas()->SetFocus();
{
EDA_DRAW_FRAME* drawFrame = dynamic_cast<EDA_DRAW_FRAME*>( m_toolMgr->GetEditFrame() );
if( drawFrame )
drawFrame->GetCanvas()->SetFocus();
}
#endif /* __APPLE__ */
}
else if( type == wxEVT_CHAR_HOOK || type == wxEVT_CHAR )

View File

@ -822,7 +822,8 @@ void TOOL_MANAGER::DispatchContextMenu( const TOOL_EVENT& aEvent )
// Store the cursor position, so the tools could execute actions
// using the point where the user has invoked a context menu
m_menuCursor = m_viewControls->GetCursorPosition();
if( m_viewControls )
m_menuCursor = m_viewControls->GetCursorPosition();
// Save all tools cursor settings, as they will be overridden
for( auto idState : m_toolIdIndex )
@ -836,7 +837,8 @@ void TOOL_MANAGER::DispatchContextMenu( const TOOL_EVENT& aEvent )
m_cursorSettings[idState.first] = NULLOPT;
}
m_viewControls->ForceCursorPosition( true, m_menuCursor );
if( m_viewControls )
m_viewControls->ForceCursorPosition( true, m_menuCursor );
// Display a copy of menu
std::unique_ptr<ACTION_MENU> menu( m->Clone() );
@ -848,8 +850,11 @@ void TOOL_MANAGER::DispatchContextMenu( const TOOL_EVENT& aEvent )
frame->PopupMenu( menu.get() );
// Warp the cursor if a menu item was selected
if( menu->GetSelected() >= 0 && m_warpMouseAfterContextMenu )
m_viewControls->WarpCursor( m_menuCursor, true, false );
if( menu->GetSelected() >= 0 )
{
if( m_viewControls && m_warpMouseAfterContextMenu )
m_viewControls->WarpCursor( m_menuCursor, true, false );
}
// Otherwise notify the tool of a cancelled menu
else
{

View File

@ -198,11 +198,7 @@ enum main_id
ID_GRID_SETTINGS,
ID_ZOOM_BEGIN,
ID_ZOOM_IN = ID_ZOOM_BEGIN,
ID_ZOOM_OUT,
ID_ZOOM_PAGE,
ID_ZOOM_REDRAW,
ID_VIEWER_ZOOM_IN,
ID_VIEWER_ZOOM_IN = ID_ZOOM_BEGIN,
ID_VIEWER_ZOOM_OUT,
ID_VIEWER_ZOOM_PAGE,
ID_VIEWER_ZOOM_REDRAW,

View File

@ -1,26 +0,0 @@
/**
* @file pcbnew/help_common_strings.h
* strings common to toolbars and menubar
*/
/**
* These strings are used in menus and tools, that do the same command
* But they are internationalized, and therefore must be created
* at run time, on the fly.
* So they cannot be static.
*
* Therefore they are defined by \#define, used inside menu constructors
*/
#define HELP_UNDO _( "Undo last edit" )
#define HELP_REDO _( "Redo the last undo command" )
#define HELP_FIND _( "Find components and text in current loaded board" )
#define HELP_ZOOM_IN _( "Zoom in" )
#define HELP_ZOOM_OUT _( "Zoom out" )
#define HELP_ZOOM_FIT _( "Zoom to fit board or page" )
#define HELP_ZOOM_REDRAW _( "Redraw screen" )
#define HELP_SHOW_HIDE_LAYERMANAGER _( "Show/hide the layers manager toolbar" )
#define HELP_SHOW_HIDE_MICROWAVE_TOOLS _( "Show/hide microwave toolbar\n(Experimental feature)" )

View File

@ -26,7 +26,6 @@
#include "footprint_edit_frame.h"
#include "help_common_strings.h"
#include "pcbnew.h"
#include "pcbnew_id.h"
#include <menus_helpers.h>

View File

@ -28,7 +28,6 @@
#include <advanced_config.h>
#include <drc/drc.h>
#include <filehistory.h>
#include <help_common_strings.h>
#include <kiface_i.h>
#include <menus_helpers.h>
#include <pcb_edit_frame.h>

View File

@ -63,8 +63,6 @@ BEGIN_EVENT_TABLE( PCB_BASE_FRAME, EDA_DRAW_FRAME )
EVT_UPDATE_UI( ID_ON_GRID_SELECT, PCB_BASE_FRAME::OnUpdateSelectGrid )
EVT_UPDATE_UI( ID_ON_ZOOM_SELECT, PCB_BASE_FRAME::OnUpdateSelectZoom )
EVT_UPDATE_UI_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, PCB_BASE_FRAME::OnUpdateSelectZoom )
END_EVENT_TABLE()

View File

@ -67,7 +67,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
m_mainToolBar->Add( ACTIONS::undo );
m_mainToolBar->Add( ACTIONS::redo );
m_mainToolBar->AddSeparator();
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->Add( ACTIONS::zoomRedraw );
m_mainToolBar->Add( ACTIONS::zoomInCenter );
m_mainToolBar->Add( ACTIONS::zoomOutCenter );

View File

@ -29,7 +29,6 @@
#include <confirm.h>
#include <dialog_helpers.h>
#include <fctsys.h>
#include <help_common_strings.h>
#include <kiface_i.h>
#include <memory>
#include <pcb_edit_frame.h>