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
This commit is contained in:
Seth Hillbrand 2023-04-07 10:08:43 -07:00
parent 9efd24a69d
commit 2cd854af14
19 changed files with 154 additions and 266 deletions

View File

@ -32,6 +32,7 @@
#include <3d_rendering/raytracing/render_3d_raytrace.h> #include <3d_rendering/raytracing/render_3d_raytrace.h>
#include <3d_rendering/opengl/render_3d_opengl.h> #include <3d_rendering/opengl/render_3d_opengl.h>
#include <3d_viewer_id.h> #include <3d_viewer_id.h>
#include <advanced_config.h>
#include <board.h> #include <board.h>
#include <reporter.h> #include <reporter.h>
#include <gl_context_mgr.h> #include <gl_context_mgr.h>
@ -531,13 +532,11 @@ void EDA_3D_CANVAS::DoRePaint()
render_pivot( curtime_delta_s, scale ); render_pivot( curtime_delta_s, scale );
} }
#if defined( KICAD_USE_3DCONNEXION ) if( m_render3dmousePivot && ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
if( m_render3dmousePivot )
{ {
const float scale = glm::min( m_camera.GetZoom(), 1.0f ); const float scale = glm::min( m_camera.GetZoom(), 1.0f );
render3dmousePivot( scale ); render3dmousePivot( scale );
} }
#endif
// "Swaps the double-buffer of this window, making the back-buffer the // "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 // 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; } void SetRenderPivot( bool aValue ) { m_render_pivot = aValue; }
#if defined( KICAD_USE_3DCONNEXION )
/** /**
* Get a value indicating whether to render the 3dmouse pivot. * Get a value indicating whether to render the 3dmouse pivot.
*/ */
@ -209,7 +207,6 @@ public:
{ {
m_3dmousePivotPos = aPos; m_3dmousePivotPos = aPos;
} }
#endif
private: private:
/** /**
@ -278,14 +275,12 @@ private:
*/ */
void render_pivot( float t, float aScale ); void render_pivot( float t, float aScale );
#if defined( KICAD_USE_3DCONNEXION )
/** /**
* Render the 3dmouse pivot cursor. * Render the 3dmouse pivot cursor.
* *
* @param aScale scale to apply on the cursor. * @param aScale scale to apply on the cursor.
*/ */
void render3dmousePivot( float aScale ); void render3dmousePivot( float aScale );
#endif
/** /**
* @return true if OpenGL initialization succeeded. * @return true if OpenGL initialization succeeded.
@ -331,10 +326,8 @@ private:
BOARD_ITEM* m_currentRollOverItem; BOARD_ITEM* m_currentRollOverItem;
#if defined( KICAD_USE_3DCONNEXION )
bool m_render3dmousePivot = false; // Render the 3dmouse pivot bool m_render3dmousePivot = false; // Render the 3dmouse pivot
SFVEC3F m_3dmousePivotPos; // The position of 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. * 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 ) void EDA_3D_CANVAS::render3dmousePivot( float aScale )
{ {
wxASSERT( aScale >= 0.0f ); wxASSERT( aScale >= 0.0f );
@ -160,4 +159,3 @@ void EDA_3D_CANVAS::render3dmousePivot( float aScale )
glDisable( GL_BLEND ); glDisable( GL_BLEND );
glDisable( GL_POINT_SMOOTH ); glDisable( GL_POINT_SMOOTH );
} }
#endif

View File

@ -1,4 +1,3 @@
if( KICAD_USE_3DCONNEXION )
add_library(3d-viewer_navlib STATIC add_library(3d-viewer_navlib STATIC
"nl_3d_viewer_plugin.cpp" "nl_3d_viewer_plugin.cpp"
"nl_3d_viewer_plugin_impl.cpp" "nl_3d_viewer_plugin_impl.cpp"
@ -23,9 +22,4 @@ if( KICAD_USE_3DCONNEXION )
$<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_LINK_LIBRARIES> $<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_LINK_LIBRARIES>
3DxWare::Navlib 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" #include "nl_3d_viewer_plugin.h"
#if defined( KICAD_USE_3DCONNEXION )
#include "nl_3d_viewer_plugin_impl.h" #include "nl_3d_viewer_plugin_impl.h"
#include <advanced_config.h>
NL_3D_VIEWER_PLUGIN::NL_3D_VIEWER_PLUGIN( EDA_3D_CANVAS* aViewport ) : NL_3D_VIEWER_PLUGIN::NL_3D_VIEWER_PLUGIN( EDA_3D_CANVAS* aViewport )
m_impl( new NL_3D_VIEWER_PLUGIN_IMPL( 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 ) void NL_3D_VIEWER_PLUGIN::SetFocus( bool focus )
{ {
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
m_impl->SetFocus( focus ); 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_actions.h>
#include <3d_viewer/tools/eda_3d_controller.h> #include <3d_viewer/tools/eda_3d_controller.h>
#include <3d_viewer/tools/eda_3d_conditions.h> #include <3d_viewer/tools/eda_3d_conditions.h>
#include <advanced_config.h>
#include <bitmaps.h> #include <bitmaps.h>
#include <board_design_settings.h> #include <board_design_settings.h>
#include <core/arraydim.h> #include <core/arraydim.h>
@ -56,9 +57,7 @@
#include <widgets/wx_infobar.h> #include <widgets/wx_infobar.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#if defined( KICAD_USE_3DCONNEXION )
#include <3d_navlib/nl_3d_viewer_plugin.h> #include <3d_navlib/nl_3d_viewer_plugin.h>
#endif
/** /**
* Flag to enable 3D viewer main frame window debug tracing. * Flag to enable 3D viewer main frame window debug tracing.
@ -166,7 +165,9 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
m_canvas->SetInfoBar( m_infoBar ); m_canvas->SetInfoBar( m_infoBar );
m_canvas->SetStatusBar( status_bar ); m_canvas->SetStatusBar( status_bar );
#if defined( KICAD_USE_3DCONNEXION )
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
{
try try
{ {
m_spaceMouse = new NL_3D_VIEWER_PLUGIN( m_canvas ); m_spaceMouse = new NL_3D_VIEWER_PLUGIN( m_canvas );
@ -175,7 +176,7 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
{ {
wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), e.what() ); wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), e.what() );
} }
#endif }
// Fixes bug in Windows (XP and possibly others) where the canvas requires the focus // 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 // 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() EDA_3D_VIEWER_FRAME::~EDA_3D_VIEWER_FRAME()
{ {
#if defined( KICAD_USE_3DCONNEXION )
if( m_spaceMouse != nullptr )
{
delete m_spaceMouse; delete m_spaceMouse;
}
#endif
Prj().GetProjectFile().m_Viewports3D = GetUserViewports(); Prj().GetProjectFile().m_Viewports3D = GetUserViewports();
@ -334,12 +330,11 @@ void EDA_3D_VIEWER_FRAME::handleIconizeEvent( wxIconizeEvent& aEvent )
{ {
KIWAY_PLAYER::handleIconizeEvent( 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 ); m_spaceMouse->SetFocus( false );
} }
#endif
} }
@ -655,12 +650,8 @@ void EDA_3D_VIEWER_FRAME::OnActivate( wxActivateEvent &aEvent )
m_canvas->SetFocus(); m_canvas->SetFocus();
} }
#if defined( KICAD_USE_3DCONNEXION ) if( m_spaceMouse != nullptr && ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
if( m_spaceMouse != nullptr )
{
m_spaceMouse->SetFocus( aEvent.GetActive() ); m_spaceMouse->SetFocus( aEvent.GetActive() );
}
#endif
aEvent.Skip(); // required under wxMAC aEvent.Skip(); // required under wxMAC
} }

View File

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

View File

@ -83,10 +83,6 @@ option( KICAD_USE_SENTRY
"Build KiCad with support for sentry app metrics" "Build KiCad with support for sentry app metrics"
OFF ) OFF )
option( KICAD_USE_3DCONNEXION
"Build KiCad with support for 3Dconnexion devices (Currently only for Mac/MSW)"
OFF )
option( KICAD_SIGNAL_INTEGRITY option( KICAD_SIGNAL_INTEGRITY
"Build tools for signal integrity analysis ( default ON )" "Build tools for signal integrity analysis ( default ON )"
ON ) ON )
@ -241,11 +237,6 @@ add_compile_definitions( $<$<BOOL:${KICAD_USE_VALGRIND}>:KICAD_USE_VALGRIND> )
add_compile_definitions( $<$<BOOL:${KICAD_GAL_PROFILE}>:KICAD_GAL_PROFILE> ) add_compile_definitions( $<$<BOOL:${KICAD_GAL_PROFILE}>:KICAD_GAL_PROFILE> )
add_compile_definitions( $<$<BOOL:${KICAD_WIN32_VERIFY_CODESIGN}>:KICAD_WIN32_VERIFY_CODESIGN> ) add_compile_definitions( $<$<BOOL:${KICAD_WIN32_VERIFY_CODESIGN}>:KICAD_WIN32_VERIFY_CODESIGN> )
# 3D mouse is only available on Windows and macOS
if( WIN32 OR APPLE )
add_compile_definitions( $<$<BOOL:${KICAD_USE_3DCONNEXION}>:KICAD_USE_3DCONNEXION> )
endif()
if( KICAD_USE_EGL ) if( KICAD_USE_EGL )
message( STATUS "Configuring KiCad for the wxGLCanvas EGL backend" ) message( STATUS "Configuring KiCad for the wxGLCanvas EGL backend" )
add_compile_definitions( KICAD_USE_EGL ) add_compile_definitions( KICAD_USE_EGL )

View File

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

View File

@ -62,6 +62,11 @@ namespace AC_STACK
namespace AC_KEYS 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 * 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. * 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_3DRT_BevelExtentFactor = 1.0 / 16.0;
m_UseClipper2 = true; m_UseClipper2 = true;
m_Use3DConnexionDriver = false;
loadFromConfigFile(); loadFromConfigFile();
} }
@ -463,6 +469,9 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::UseClipper2, configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::UseClipper2,
&m_UseClipper2, m_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 // Special case for trace mask setting...we just grab them and set them immediately

View File

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

View File

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

View File

@ -19,13 +19,15 @@
*/ */
#include "nl_schematic_plugin.h" #include "nl_schematic_plugin.h"
#if defined( KICAD_USE_3DCONNEXION ) #include <advanced_config.h>
#include "nl_schematic_plugin_impl.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 ) void NL_SCHEMATIC_PLUGIN::SetFocus( bool focus )
{ {
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
m_impl->SetFocus( focus ); m_impl->SetFocus( focus );
} }
void NL_SCHEMATIC_PLUGIN::SetCanvas( EDA_DRAW_PANEL_GAL* aViewport ) void NL_SCHEMATIC_PLUGIN::SetCanvas( EDA_DRAW_PANEL_GAL* aViewport )
{ {
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
m_impl->SetCanvas( aViewport ); 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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <advanced_config.h>
#include <base_units.h> #include <base_units.h>
#include <kiway.h> #include <kiway.h>
#include <lib_tree_model_adapter.h> #include <lib_tree_model_adapter.h>
@ -47,9 +48,7 @@
#include <wx/choicdlg.h> #include <wx/choicdlg.h>
#include <wx/log.h> #include <wx/log.h>
#if defined( KICAD_USE_3DCONNEXION )
#include <navlib/nl_schematic_plugin.h> #include <navlib/nl_schematic_plugin.h>
#endif
LIB_SYMBOL* SchGetLibSymbol( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable, LIB_SYMBOL* SchGetLibSymbol( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable,
SYMBOL_LIB* aCacheLib, wxWindow* aParent, bool aShowErrorMsg ) SYMBOL_LIB* aCacheLib, wxWindow* aParent, bool aShowErrorMsg )
@ -91,10 +90,7 @@ SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aWindo
const wxSize& aSize, long aStyle, const wxString& aFrameName ) : const wxSize& aSize, long aStyle, const wxString& aFrameName ) :
EDA_DRAW_FRAME( aKiway, aParent, aWindowType, aTitle, aPosition, aSize, aStyle, EDA_DRAW_FRAME( aKiway, aParent, aWindowType, aTitle, aPosition, aSize, aStyle,
aFrameName, schIUScale ), aFrameName, schIUScale ),
m_base_frame_defaults( nullptr, "base_Frame_defaults" ) m_base_frame_defaults( nullptr, "base_Frame_defaults" ), m_spaceMouse( nullptr )
#if defined( KICAD_USE_3DCONNEXION )
,m_spaceMouse( nullptr )
#endif
{ {
createCanvas(); createCanvas();
@ -116,10 +112,7 @@ SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aWindo
SCH_BASE_FRAME::~SCH_BASE_FRAME() SCH_BASE_FRAME::~SCH_BASE_FRAME()
{ {
#if defined( KICAD_USE_3DCONNEXION )
if( m_spaceMouse != nullptr )
delete m_spaceMouse; delete m_spaceMouse;
#endif
} }
@ -350,13 +343,12 @@ void SCH_BASE_FRAME::ActivateGalCanvas()
{ {
EDA_DRAW_FRAME::ActivateGalCanvas(); EDA_DRAW_FRAME::ActivateGalCanvas();
#if defined( KICAD_USE_3DCONNEXION ) if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
{
try try
{ {
if( !m_spaceMouse ) if( !m_spaceMouse )
{
m_spaceMouse = new NL_SCHEMATIC_PLUGIN(); m_spaceMouse = new NL_SCHEMATIC_PLUGIN();
}
m_spaceMouse->SetCanvas( GetCanvas() ); m_spaceMouse->SetCanvas( GetCanvas() );
} }
@ -364,7 +356,7 @@ void SCH_BASE_FRAME::ActivateGalCanvas()
{ {
wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), e.what() ); wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), e.what() );
} }
#endif }
} }
@ -543,12 +535,8 @@ void SCH_BASE_FRAME::handleActivateEvent( wxActivateEvent& aEvent )
{ {
EDA_DRAW_FRAME::handleActivateEvent( aEvent ); EDA_DRAW_FRAME::handleActivateEvent( aEvent );
#if defined( KICAD_USE_3DCONNEXION ) if( m_spaceMouse && ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
if( m_spaceMouse )
{
m_spaceMouse->SetFocus( aEvent.GetActive() ); m_spaceMouse->SetFocus( aEvent.GetActive() );
}
#endif
} }
@ -556,12 +544,8 @@ void SCH_BASE_FRAME::handleIconizeEvent( wxIconizeEvent& aEvent )
{ {
EDA_DRAW_FRAME::handleIconizeEvent( aEvent ); EDA_DRAW_FRAME::handleIconizeEvent( aEvent );
#if defined( KICAD_USE_3DCONNEXION ) if( m_spaceMouse && aEvent.IsIconized() && ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
if( m_spaceMouse && aEvent.IsIconized() )
{
m_spaceMouse->SetFocus( false ); m_spaceMouse->SetFocus( false );
}
#endif
} }

View File

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

View File

@ -247,6 +247,11 @@ public:
*/ */
bool m_UseClipper2; bool m_UseClipper2;
/**
* Use the 3DConnexion Driver
*/
bool m_Use3DConnexionDriver;
///@} ///@}

View File

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

View File

@ -19,14 +19,14 @@
*/ */
#include "nl_pcbnew_plugin.h" #include "nl_pcbnew_plugin.h"
#if defined( KICAD_USE_3DCONNEXION )
#include "nl_pcbnew_plugin_impl.h" #include "nl_pcbnew_plugin_impl.h"
#include <advanced_config.h>
NL_PCBNEW_PLUGIN::NL_PCBNEW_PLUGIN( PCB_DRAW_PANEL_GAL* aViewport ) : NL_PCBNEW_PLUGIN::NL_PCBNEW_PLUGIN( PCB_DRAW_PANEL_GAL* aViewport )
m_impl( new NL_PCBNEW_PLUGIN_IMPL( 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 ) void NL_PCBNEW_PLUGIN::SetFocus( bool focus )
{ {
if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
m_impl->SetFocus( focus ); 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,39 +33,39 @@
#include <boost/uuid/entropy_error.hpp> #include <boost/uuid/entropy_error.hpp>
#endif #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 <3d_viewer/eda_3d_viewer_frame.h> // To include VIEWER3D_FRAMENAME
#include <footprint_editor_settings.h> #include <advanced_config.h>
#include <pcbnew_settings.h> #include <base_units.h>
#include <fp_lib_table.h>
#include <pcbnew_id.h>
#include <board.h> #include <board.h>
#include <footprint.h> #include <cleanup_item.h>
#include <collectors.h> #include <collectors.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 <pcb_draw_panel_gal.h>
#include <pgm_base.h>
#include <zoom_defines.h>
#include <math/vector2d.h> #include <math/vector2d.h>
#include <math/vector2wx.h> #include <math/vector2wx.h>
#include <pcb_group.h> #include <widgets/msgpanel.h>
#include <pcb_painter.h>
#include <settings/settings_manager.h> #include <settings/settings_manager.h>
#include <settings/cvpcb_settings.h> #include <settings/cvpcb_settings.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <tool/tool_dispatcher.h> #include <tool/tool_dispatcher.h>
#include <tools/pcb_actions.h> #include <tools/pcb_actions.h>
#include <tool/grid_menu.h> #include <tool/grid_menu.h>
#include "cleanup_item.h"
#include <zoom_defines.h>
#include <ratsnest/ratsnest_view_item.h> #include <ratsnest/ratsnest_view_item.h>
#if defined( KICAD_USE_3DCONNEXION )
#include <navlib/nl_pcbnew_plugin.h> #include <navlib/nl_pcbnew_plugin.h>
#endif
using KIGFX::RENDER_SETTINGS; using KIGFX::RENDER_SETTINGS;
using KIGFX::PCB_RENDER_SETTINGS; using KIGFX::PCB_RENDER_SETTINGS;
@ -86,9 +86,8 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
PCB_BASE_FRAME::~PCB_BASE_FRAME() PCB_BASE_FRAME::~PCB_BASE_FRAME()
{ {
#if defined( KICAD_USE_3DCONNEXION )
delete m_spaceMouse; delete m_spaceMouse;
#endif m_spaceMouse = nullptr;
// Ensure m_canvasType is up to date, to save it in config // Ensure m_canvasType is up to date, to save it in config
m_canvasType = GetCanvas()->GetBackend(); m_canvasType = GetCanvas()->GetBackend();
@ -119,12 +118,8 @@ void PCB_BASE_FRAME::handleActivateEvent( wxActivateEvent& aEvent )
{ {
EDA_DRAW_FRAME::handleActivateEvent( aEvent ); EDA_DRAW_FRAME::handleActivateEvent( aEvent );
#if defined( KICAD_USE_3DCONNEXION ) if( m_spaceMouse != nullptr && ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
if( m_spaceMouse != nullptr )
{
m_spaceMouse->SetFocus( aEvent.GetActive() ); m_spaceMouse->SetFocus( aEvent.GetActive() );
}
#endif
} }
@ -132,12 +127,9 @@ void PCB_BASE_FRAME::handleIconizeEvent( wxIconizeEvent& aEvent )
{ {
EDA_DRAW_FRAME::handleIconizeEvent( 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 ); m_spaceMouse->SetFocus( false );
}
#endif
} }
@ -1084,8 +1076,10 @@ void PCB_BASE_FRAME::ActivateGalCanvas()
canvas->SetEventDispatcher( m_toolDispatcher ); canvas->SetEventDispatcher( m_toolDispatcher );
canvas->StartDrawing(); canvas->StartDrawing();
#if defined( KICAD_USE_3DCONNEXION ) if( ADVANCED_CFG::GetCfg().m_Use3DConnexionDriver )
{
try try
{ {
if( m_spaceMouse == nullptr ) if( m_spaceMouse == nullptr )
{ {
@ -1096,7 +1090,7 @@ void PCB_BASE_FRAME::ActivateGalCanvas()
{ {
wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), e.what() ); wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), e.what() );
} }
#endif }
} }