Move Spacemouse to advanced config

The spacemouse driver, particularly on Mac, is extremely unstable and
causes crashes even when not being used.  This places the interface
behind an advanced config flag to ensure that users can affirmatively
opt-in to the potential for crashes

(cherry picked from commit 2cd854af14)
This commit is contained in:
Seth Hillbrand 2023-04-07 10:08:43 -07:00
parent 2f51742311
commit d08f937932
18 changed files with 157 additions and 258 deletions

View File

@ -32,6 +32,7 @@
#include <3d_rendering/raytracing/render_3d_raytrace.h>
#include <3d_rendering/opengl/render_3d_opengl.h>
#include <3d_viewer_id.h>
#include <advanced_config.h>
#include <board.h>
#include <reporter.h>
#include <gl_context_mgr.h>
@ -531,13 +532,11 @@ void EDA_3D_CANVAS::DoRePaint()
render_pivot( curtime_delta_s, scale );
}
#if defined( KICAD_USE_3DCONNEXION )
if( m_render3dmousePivot )
if( m_render3dmousePivot && ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
{
const float scale = glm::min( m_camera.GetZoom(), 1.0f );
render3dmousePivot( scale );
}
#endif
// "Swaps the double-buffer of this window, making the back-buffer the
// front-buffer and vice versa, so that the output of the previous OpenGL

View File

@ -178,8 +178,6 @@ public:
*/
void SetRenderPivot( bool aValue ) { m_render_pivot = aValue; }
#if defined( KICAD_USE_3DCONNEXION )
/**
* Get a value indicating whether to render the 3dmouse pivot.
*/
@ -209,7 +207,6 @@ public:
{
m_3dmousePivotPos = aPos;
}
#endif
private:
/**
@ -278,14 +275,12 @@ private:
*/
void render_pivot( float t, float aScale );
#if defined( KICAD_USE_3DCONNEXION )
/**
* Render the 3dmouse pivot cursor.
*
* @param aScale scale to apply on the cursor.
*/
void render3dmousePivot( float aScale );
#endif
/**
* @return true if OpenGL initialization succeeded.
@ -331,10 +326,8 @@ private:
BOARD_ITEM* m_currentRollOverItem;
#if defined( KICAD_USE_3DCONNEXION )
bool m_render3dmousePivot = false; // Render the 3dmouse pivot
SFVEC3F m_3dmousePivotPos; // The position of the 3dmouse pivot
#endif
/**
* Trace mask used to enable or disable the trace output of this class.

View File

@ -120,7 +120,6 @@ void EDA_3D_CANVAS::render_pivot( float t, float aScale )
}
#if defined( KICAD_USE_3DCONNEXION )
void EDA_3D_CANVAS::render3dmousePivot( float aScale )
{
wxASSERT( aScale >= 0.0f );
@ -160,4 +159,3 @@ void EDA_3D_CANVAS::render3dmousePivot( float aScale )
glDisable( GL_BLEND );
glDisable( GL_POINT_SMOOTH );
}
#endif

View File

@ -1,4 +1,3 @@
if( KICAD_USE_3DCONNEXION )
add_library(3d-viewer_navlib STATIC
"nl_3d_viewer_plugin.cpp"
"nl_3d_viewer_plugin_impl.cpp"
@ -23,9 +22,4 @@ if( KICAD_USE_3DCONNEXION )
$<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_LINK_LIBRARIES>
3DxWare::Navlib
)
else()
add_library(3d-viewer_navlib STATIC
"nl_3d_viewer_plugin.cpp"
)
endif(KICAD_USE_3DCONNEXION)

View File

@ -19,14 +19,14 @@
*/
#include "nl_3d_viewer_plugin.h"
#if defined( KICAD_USE_3DCONNEXION )
#include "nl_3d_viewer_plugin_impl.h"
#include <advanced_config.h>
NL_3D_VIEWER_PLUGIN::NL_3D_VIEWER_PLUGIN( EDA_3D_CANVAS* aViewport ) :
m_impl( new NL_3D_VIEWER_PLUGIN_IMPL( aViewport ) )
NL_3D_VIEWER_PLUGIN::NL_3D_VIEWER_PLUGIN( EDA_3D_CANVAS* aViewport )
{
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
m_impl = new NL_3D_VIEWER_PLUGIN_IMPL( aViewport );
}
@ -38,22 +38,6 @@ NL_3D_VIEWER_PLUGIN::~NL_3D_VIEWER_PLUGIN()
void NL_3D_VIEWER_PLUGIN::SetFocus( bool focus )
{
m_impl->SetFocus( focus );
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
m_impl->SetFocus( focus );
}
#else
NL_3D_VIEWER_PLUGIN::NL_3D_VIEWER_PLUGIN( EDA_3D_CANVAS* aViewport ) : m_impl( nullptr )
{
}
void NL_3D_VIEWER_PLUGIN::SetFocus( bool focus )
{
}
NL_3D_VIEWER_PLUGIN::~NL_3D_VIEWER_PLUGIN()
{
}
#endif

View File

@ -39,6 +39,7 @@
#include <3d_viewer/tools/eda_3d_actions.h>
#include <3d_viewer/tools/eda_3d_controller.h>
#include <3d_viewer/tools/eda_3d_conditions.h>
#include <advanced_config.h>
#include <bitmaps.h>
#include <board_design_settings.h>
#include <core/arraydim.h>
@ -56,9 +57,7 @@
#include <widgets/wx_infobar.h>
#include <wildcards_and_files_ext.h>
#if defined( KICAD_USE_3DCONNEXION )
#include <3d_navlib/nl_3d_viewer_plugin.h>
#endif
/**
* Flag to enable 3D viewer main frame window debug tracing.
@ -166,16 +165,18 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
m_canvas->SetInfoBar( m_infoBar );
m_canvas->SetStatusBar( status_bar );
#if defined( KICAD_USE_3DCONNEXION )
try
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
{
m_spaceMouse = new NL_3D_VIEWER_PLUGIN( m_canvas );
try
{
m_spaceMouse = new NL_3D_VIEWER_PLUGIN( m_canvas );
}
catch( const std::system_error& e )
{
wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), e.what() );
}
}
catch( const std::system_error& e )
{
wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), e.what() );
}
#endif
// 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
@ -193,12 +194,7 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
EDA_3D_VIEWER_FRAME::~EDA_3D_VIEWER_FRAME()
{
#if defined( KICAD_USE_3DCONNEXION )
if( m_spaceMouse != nullptr )
{
delete m_spaceMouse;
}
#endif
delete m_spaceMouse;
Prj().GetProjectFile().m_Viewports3D = GetUserViewports();
@ -334,12 +330,11 @@ void EDA_3D_VIEWER_FRAME::handleIconizeEvent( wxIconizeEvent& aEvent )
{
KIWAY_PLAYER::handleIconizeEvent( aEvent );
#if defined( KICAD_USE_3DCONNEXION )
if( m_spaceMouse != nullptr && aEvent.IsIconized() )
if( m_spaceMouse != nullptr && aEvent.IsIconized()
&& ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
{
m_spaceMouse->SetFocus( false );
}
#endif
}
@ -655,12 +650,8 @@ void EDA_3D_VIEWER_FRAME::OnActivate( wxActivateEvent &aEvent )
m_canvas->SetFocus();
}
#if defined( KICAD_USE_3DCONNEXION )
if( m_spaceMouse != nullptr )
{
if( m_spaceMouse != nullptr && ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
m_spaceMouse->SetFocus( aEvent.GetActive() );
}
#endif
aEvent.Skip(); // required under wxMAC
}

View File

@ -122,8 +122,6 @@ target_link_libraries( 3d-viewer
add_subdirectory( 3d_cache )
if( KICAD_USE_3DCONNEXION )
message( STATUS "Including 3Dconnexion SpaceMouse navigation support in 3d-viewer" )
add_subdirectory( 3d_navlib )
target_link_libraries( 3d-viewer PRIVATE 3d-viewer_navlib)
endif()
message( STATUS "Including 3Dconnexion SpaceMouse navigation support in 3d-viewer" )
add_subdirectory( 3d_navlib )
target_link_libraries( 3d-viewer PRIVATE 3d-viewer_navlib)

View File

@ -620,12 +620,9 @@ target_link_libraries( pcbcommon PUBLIC
threadpool
)
if( KICAD_USE_3DCONNEXION )
message( STATUS "Including 3Dconnexion SpaceMouse navigation support in pcbcommon" )
add_subdirectory( ../pcbnew/navlib ./navlib)
target_link_libraries( pcbcommon PUBLIC pcbnew_navlib)
endif()
message( STATUS "Including 3Dconnexion SpaceMouse navigation support in pcbcommon" )
add_subdirectory( ../pcbnew/navlib ./navlib)
target_link_libraries( pcbcommon PUBLIC pcbnew_navlib)
add_dependencies( pcbcommon delaunator )

View File

@ -62,6 +62,11 @@ namespace AC_STACK
namespace AC_KEYS
{
/**
* Decide whether to attempt usage of the 3DConnexion mouse
*/
static const wxChar Use3DConnexionDriver[] = wxT( "3DConnexionDriver" );
/**
* When filling zones, we add an extra amount of clearance to each zone to ensure that rounding
* errors do not overrun minimum clearance distances. This is the extra in mm.
@ -320,6 +325,7 @@ ADVANCED_CFG::ADVANCED_CFG()
m_3DRT_BevelExtentFactor = 1.0 / 16.0;
m_UseClipper2 = true;
m_Use3DConnexionDriver = false;
loadFromConfigFile();
}
@ -463,6 +469,9 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::UseClipper2,
&m_UseClipper2, m_UseClipper2 ) );
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::Use3DConnexionDriver,
&m_Use3DConnexionDriver, m_Use3DConnexionDriver ) );
// Special case for trace mask setting...we just grab them and set them immediately

View File

@ -463,15 +463,12 @@ target_link_libraries( eeschema_kiface_objects
# declare the dependency
add_dependencies( eeschema_kiface_objects common )
if( KICAD_USE_3DCONNEXION )
message( STATUS "Including 3Dconnexion SpaceMouse navigation support in eeschema" )
add_subdirectory( ./navlib )
message( STATUS "Including 3Dconnexion SpaceMouse navigation support in eeschema" )
add_subdirectory( navlib )
target_link_libraries( eeschema_kiface_objects PUBLIC eeschema_navlib)
add_dependencies( eeschema_kiface_objects eeschema_navlib )
endif()
target_link_libraries( eeschema_kiface_objects PUBLIC eeschema_navlib)
add_dependencies( eeschema_kiface_objects eeschema_navlib )
add_library( eeschema_kiface MODULE
eeschema.cpp

View File

@ -1,30 +1,25 @@
if( KICAD_USE_3DCONNEXION )
add_library(eeschema_navlib STATIC
"nl_schematic_plugin.cpp"
"nl_schematic_plugin_impl.cpp"
)
# eeschema_navlib depends on make_lexer outputs in common
add_dependencies( eeschema_navlib common )
add_library(eeschema_navlib STATIC
"nl_schematic_plugin.cpp"
"nl_schematic_plugin_impl.cpp"
)
# Find the 3DxWare SDK component 3DxWare::NlClient
# find_package(TDxWare_SDK 4.0 REQUIRED COMPONENTS 3DxWare::Navlib)
target_compile_definitions(eeschema_navlib PRIVATE
$<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_COMPILE_DEFINITIONS>
)
target_compile_options(eeschema_navlib PRIVATE
$<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_COMPILE_OPTIONS>
)
target_include_directories(eeschema_navlib PRIVATE
$<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:eeschema_kiface_objects,INCLUDE_DIRECTORIES>
)
target_link_libraries(eeschema_navlib
$<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_LINK_LIBRARIES>
3DxWare::Navlib
)
else()
add_library(eeschema_navlib STATIC
"nl_schematic_plugin.cpp"
)
endif(KICAD_USE_3DCONNEXION)
# eeschema_navlib depends on make_lexer outputs in common
add_dependencies( eeschema_navlib common )
# Find the 3DxWare SDK component 3DxWare::NlClient
# find_package(TDxWare_SDK 4.0 REQUIRED COMPONENTS 3DxWare::Navlib)
target_compile_definitions(eeschema_navlib PRIVATE
$<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_COMPILE_DEFINITIONS>
)
target_compile_options(eeschema_navlib PRIVATE
$<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_COMPILE_OPTIONS>
)
target_include_directories(eeschema_navlib PRIVATE
$<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:eeschema_kiface_objects,INCLUDE_DIRECTORIES>
)
target_link_libraries(eeschema_navlib
$<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_LINK_LIBRARIES>
3DxWare::Navlib
)

View File

@ -19,13 +19,15 @@
*/
#include "nl_schematic_plugin.h"
#if defined( KICAD_USE_3DCONNEXION )
#include <advanced_config.h>
#include "nl_schematic_plugin_impl.h"
NL_SCHEMATIC_PLUGIN::NL_SCHEMATIC_PLUGIN() : m_impl( new NL_SCHEMATIC_PLUGIN_IMPL() )
NL_SCHEMATIC_PLUGIN::NL_SCHEMATIC_PLUGIN()
{
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
m_impl = new NL_SCHEMATIC_PLUGIN_IMPL();
}
@ -37,33 +39,13 @@ NL_SCHEMATIC_PLUGIN::~NL_SCHEMATIC_PLUGIN()
void NL_SCHEMATIC_PLUGIN::SetFocus( bool focus )
{
m_impl->SetFocus( focus );
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
m_impl->SetFocus( focus );
}
void NL_SCHEMATIC_PLUGIN::SetCanvas( EDA_DRAW_PANEL_GAL* aViewport )
{
m_impl->SetCanvas( aViewport );
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
m_impl->SetCanvas( aViewport );
}
#else
NL_SCHEMATIC_PLUGIN::NL_SCHEMATIC_PLUGIN()
{
}
void NL_SCHEMATIC_PLUGIN::SetFocus( bool focus )
{
}
void NL_SCHEMATIC_PLUGIN::SetCanvas( EDA_DRAW_PANEL_GAL* aViewport )
{
}
NL_SCHEMATIC_PLUGIN::~NL_SCHEMATIC_PLUGIN()
{
}
#endif

View File

@ -22,6 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <advanced_config.h>
#include <base_units.h>
#include <kiway.h>
#include <lib_tree_model_adapter.h>
@ -46,9 +47,7 @@
#include <tools/ee_selection_tool.h>
#include <wx/choicdlg.h>
#if defined( KICAD_USE_3DCONNEXION )
#include <navlib/nl_schematic_plugin.h>
#endif
LIB_SYMBOL* SchGetLibSymbol( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable,
SYMBOL_LIB* aCacheLib, wxWindow* aParent, bool aShowErrorMsg )
@ -90,10 +89,7 @@ SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aWindo
const wxSize& aSize, long aStyle, const wxString& aFrameName ) :
EDA_DRAW_FRAME( aKiway, aParent, aWindowType, aTitle, aPosition, aSize, aStyle,
aFrameName, schIUScale ),
m_base_frame_defaults( nullptr, "base_Frame_defaults" )
#if defined( KICAD_USE_3DCONNEXION )
,m_spaceMouse( nullptr )
#endif
m_base_frame_defaults( nullptr, "base_Frame_defaults" ), m_spaceMouse( nullptr )
{
createCanvas();
@ -115,10 +111,7 @@ SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aWindo
SCH_BASE_FRAME::~SCH_BASE_FRAME()
{
#if defined( KICAD_USE_3DCONNEXION )
if( m_spaceMouse != nullptr )
delete m_spaceMouse;
#endif
delete m_spaceMouse;
}
@ -349,21 +342,20 @@ void SCH_BASE_FRAME::ActivateGalCanvas()
{
EDA_DRAW_FRAME::ActivateGalCanvas();
#if defined( KICAD_USE_3DCONNEXION )
try
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
{
if( !m_spaceMouse )
try
{
m_spaceMouse = new NL_SCHEMATIC_PLUGIN();
}
if( !m_spaceMouse )
m_spaceMouse = new NL_SCHEMATIC_PLUGIN();
m_spaceMouse->SetCanvas( GetCanvas() );
m_spaceMouse->SetCanvas( GetCanvas() );
}
catch( const std::system_error& e )
{
wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), e.what() );
}
}
catch( const std::system_error& e )
{
wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), e.what() );
}
#endif
}
@ -538,12 +530,8 @@ void SCH_BASE_FRAME::handleActivateEvent( wxActivateEvent& aEvent )
{
EDA_DRAW_FRAME::handleActivateEvent( aEvent );
#if defined( KICAD_USE_3DCONNEXION )
if( m_spaceMouse )
{
if( m_spaceMouse && ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
m_spaceMouse->SetFocus( aEvent.GetActive() );
}
#endif
}
@ -551,12 +539,8 @@ void SCH_BASE_FRAME::handleIconizeEvent( wxIconizeEvent& aEvent )
{
EDA_DRAW_FRAME::handleIconizeEvent( aEvent );
#if defined( KICAD_USE_3DCONNEXION )
if( m_spaceMouse && aEvent.IsIconized() )
{
if( m_spaceMouse && aEvent.IsIconized() && ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
m_spaceMouse->SetFocus( false );
}
#endif
}

View File

@ -270,9 +270,7 @@ protected:
SCHEMATIC_SETTINGS m_base_frame_defaults;
private:
#if defined( KICAD_USE_3DCONNEXION )
NL_SCHEMATIC_PLUGIN* m_spaceMouse;
#endif
};
#endif // SCH_BASE_FRAME_H_

View File

@ -239,6 +239,13 @@ public:
*/
bool m_UseClipper2;
/**
* Use the 3DConnexion Driver
*/
bool m_Use3DConnexionDriver;
///@}
private:
ADVANCED_CFG();

View File

@ -1,30 +1,25 @@
if( KICAD_USE_3DCONNEXION )
add_library(pcbnew_navlib STATIC
"nl_pcbnew_plugin.cpp"
"nl_pcbnew_plugin_impl.cpp"
)
# pcbnew_navlib depends on make_lexer outputs in common
add_dependencies( pcbnew_navlib pcbcommon )
add_library(pcbnew_navlib STATIC
"nl_pcbnew_plugin.cpp"
"nl_pcbnew_plugin_impl.cpp"
)
# Find the 3DxWare SDK component 3DxWare::NlClient
# find_package(TDxWare_SDK 4.0 REQUIRED COMPONENTS 3DxWare::Navlib)
target_compile_definitions(pcbnew_navlib PRIVATE
$<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_COMPILE_DEFINITIONS>
)
target_compile_options(pcbnew_navlib PRIVATE
$<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_COMPILE_OPTIONS>
)
target_include_directories(pcbnew_navlib PRIVATE
$<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:pcbnew_kiface_objects,INCLUDE_DIRECTORIES>
)
target_link_libraries(pcbnew_navlib
$<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_LINK_LIBRARIES>
3DxWare::Navlib
)
else()
add_library(pcbnew_navlib STATIC
"nl_pcbnew_plugin.cpp"
)
endif(KICAD_USE_3DCONNEXION)
# pcbnew_navlib depends on make_lexer outputs in common
add_dependencies( pcbnew_navlib pcbcommon )
# Find the 3DxWare SDK component 3DxWare::NlClient
# find_package(TDxWare_SDK 4.0 REQUIRED COMPONENTS 3DxWare::Navlib)
target_compile_definitions(pcbnew_navlib PRIVATE
$<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_COMPILE_DEFINITIONS>
)
target_compile_options(pcbnew_navlib PRIVATE
$<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_COMPILE_OPTIONS>
)
target_include_directories(pcbnew_navlib PRIVATE
$<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:pcbnew_kiface_objects,INCLUDE_DIRECTORIES>
)
target_link_libraries(pcbnew_navlib
$<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_LINK_LIBRARIES>
3DxWare::Navlib
)

View File

@ -19,14 +19,14 @@
*/
#include "nl_pcbnew_plugin.h"
#if defined( KICAD_USE_3DCONNEXION )
#include "nl_pcbnew_plugin_impl.h"
#include <advanced_config.h>
NL_PCBNEW_PLUGIN::NL_PCBNEW_PLUGIN( PCB_DRAW_PANEL_GAL* aViewport ) :
m_impl( new NL_PCBNEW_PLUGIN_IMPL( aViewport ) )
NL_PCBNEW_PLUGIN::NL_PCBNEW_PLUGIN( PCB_DRAW_PANEL_GAL* aViewport )
{
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
m_impl = new NL_PCBNEW_PLUGIN_IMPL( aViewport );
}
@ -38,22 +38,6 @@ NL_PCBNEW_PLUGIN::~NL_PCBNEW_PLUGIN()
void NL_PCBNEW_PLUGIN::SetFocus( bool focus )
{
m_impl->SetFocus( focus );
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
m_impl->SetFocus( focus );
}
#else
NL_PCBNEW_PLUGIN::NL_PCBNEW_PLUGIN( PCB_DRAW_PANEL_GAL* aViewport )
{
}
void NL_PCBNEW_PLUGIN::SetFocus( bool focus )
{
}
NL_PCBNEW_PLUGIN::~NL_PCBNEW_PLUGIN()
{
}
#endif

View File

@ -33,38 +33,38 @@
#include <boost/uuid/entropy_error.hpp>
#endif
#include <kiface_base.h>
#include <confirm.h>
#include <pcb_base_frame.h>
#include <base_units.h>
#include <widgets/msgpanel.h>
#include <pgm_base.h>
#include <3d_viewer/eda_3d_viewer_frame.h> // To include VIEWER3D_FRAMENAME
#include <footprint_editor_settings.h>
#include <pcbnew_settings.h>
#include <fp_lib_table.h>
#include <pcbnew_id.h>
#include <advanced_config.h>
#include <base_units.h>
#include <board.h>
#include <footprint.h>
#include <cleanup_item.h>
#include <collectors.h>
#include <pcb_draw_panel_gal.h>
#include <math/vector2d.h>
#include <confirm.h>
#include <footprint.h>
#include <footprint_editor_settings.h>
#include <fp_lib_table.h>
#include <kiface_base.h>
#include <pcb_group.h>
#include <pcb_painter.h>
#include <pcbnew_id.h>
#include <pcbnew_settings.h>
#include <pcb_base_frame.h>
#include <pcb_draw_panel_gal.h>
#include <pgm_base.h>
#include <zoom_defines.h>
#include <math/vector2d.h>
#include <widgets/msgpanel.h>
#include <settings/settings_manager.h>
#include <settings/cvpcb_settings.h>
#include <tool/tool_manager.h>
#include <tool/tool_dispatcher.h>
#include <tools/pcb_actions.h>
#include <tool/grid_menu.h>
#include "cleanup_item.h"
#include <zoom_defines.h>
#include <ratsnest/ratsnest_view_item.h>
#if defined( KICAD_USE_3DCONNEXION )
#include <navlib/nl_pcbnew_plugin.h>
#endif
using KIGFX::RENDER_SETTINGS;
using KIGFX::PCB_RENDER_SETTINGS;
@ -84,9 +84,8 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
PCB_BASE_FRAME::~PCB_BASE_FRAME()
{
#if defined( KICAD_USE_3DCONNEXION )
delete m_spaceMouse;
#endif
m_spaceMouse = nullptr;
// Ensure m_canvasType is up to date, to save it in config
m_canvasType = GetCanvas()->GetBackend();
@ -117,12 +116,8 @@ void PCB_BASE_FRAME::handleActivateEvent( wxActivateEvent& aEvent )
{
EDA_DRAW_FRAME::handleActivateEvent( aEvent );
#if defined( KICAD_USE_3DCONNEXION )
if( m_spaceMouse != nullptr )
{
if( m_spaceMouse != nullptr && ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
m_spaceMouse->SetFocus( aEvent.GetActive() );
}
#endif
}
@ -130,12 +125,9 @@ void PCB_BASE_FRAME::handleIconizeEvent( wxIconizeEvent& aEvent )
{
EDA_DRAW_FRAME::handleIconizeEvent( aEvent );
#if defined( KICAD_USE_3DCONNEXION )
if( m_spaceMouse != nullptr && aEvent.IsIconized() )
{
if( m_spaceMouse != nullptr && aEvent.IsIconized()
&& ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
m_spaceMouse->SetFocus( false );
}
#endif
}
@ -1057,19 +1049,21 @@ void PCB_BASE_FRAME::ActivateGalCanvas()
canvas->SetEventDispatcher( m_toolDispatcher );
canvas->StartDrawing();
#if defined( KICAD_USE_3DCONNEXION )
try
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
{
if( m_spaceMouse == nullptr )
try
{
m_spaceMouse = new NL_PCBNEW_PLUGIN( GetCanvas() );
if( m_spaceMouse == nullptr )
{
m_spaceMouse = new NL_PCBNEW_PLUGIN( GetCanvas() );
}
}
catch( const std::system_error& e )
{
wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), e.what() );
}
}
catch( const std::system_error& e )
{
wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), e.what() );
}
#endif
}