mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Enable 3D mouse support in Footprint viewer.
The 3D mouse support is moved from PCB_EDIT_FRAME to PCB_BASE_FRAME. This allows all PCB_BASE_FRAME derived windows to have 3D mouse enabled 2D navigation support.
This commit is contained in:
parent
8e43409d27
commit
b263e89dfe
@ -62,9 +62,9 @@ class FP_LIB_TABLE;
|
|||||||
class PCBNEW_SETTINGS;
|
class PCBNEW_SETTINGS;
|
||||||
class FOOTPRINT_EDITOR_SETTINGS;
|
class FOOTPRINT_EDITOR_SETTINGS;
|
||||||
struct MAGNETIC_SETTINGS;
|
struct MAGNETIC_SETTINGS;
|
||||||
|
class NL_PCBNEW_PLUGIN;
|
||||||
class PROGRESS_REPORTER;
|
class PROGRESS_REPORTER;
|
||||||
|
|
||||||
|
|
||||||
wxDECLARE_EVENT( BOARD_CHANGED, wxCommandEvent );
|
wxDECLARE_EVENT( BOARD_CHANGED, wxCommandEvent );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -384,6 +384,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
bool canCloseWindow( wxCloseEvent& aCloseEvent ) override;
|
bool canCloseWindow( wxCloseEvent& aCloseEvent ) override;
|
||||||
|
|
||||||
|
void handleActivateEvent( wxActivateEvent& aEvent ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to load \a aFootprintId from the footprint library table.
|
* Attempts to load \a aFootprintId from the footprint library table.
|
||||||
*
|
*
|
||||||
@ -402,6 +404,9 @@ protected:
|
|||||||
PCB_DISPLAY_OPTIONS m_displayOptions;
|
PCB_DISPLAY_OPTIONS m_displayOptions;
|
||||||
PCB_ORIGIN_TRANSFORMS m_originTransforms;
|
PCB_ORIGIN_TRANSFORMS m_originTransforms;
|
||||||
PCBNEW_SETTINGS* m_settings; // No ownership, just a shortcut
|
PCBNEW_SETTINGS* m_settings; // No ownership, just a shortcut
|
||||||
|
|
||||||
|
private:
|
||||||
|
NL_PCBNEW_PLUGIN* m_spaceMouse;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PCB_BASE_FRAME_H
|
#endif // PCB_BASE_FRAME_H
|
||||||
|
@ -59,6 +59,10 @@
|
|||||||
#include "cleanup_item.h"
|
#include "cleanup_item.h"
|
||||||
#include <zoom_defines.h>
|
#include <zoom_defines.h>
|
||||||
|
|
||||||
|
#if defined( KICAD_USE_3DCONNEXION )
|
||||||
|
#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;
|
||||||
|
|
||||||
@ -66,10 +70,9 @@ wxDEFINE_EVENT( BOARD_CHANGED, wxCommandEvent );
|
|||||||
|
|
||||||
PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
|
PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
|
||||||
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
||||||
long aStyle, const wxString & aFrameName ) :
|
long aStyle, const wxString& aFrameName ) :
|
||||||
EDA_DRAW_FRAME( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName ),
|
EDA_DRAW_FRAME( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName ),
|
||||||
m_pcb( nullptr ),
|
m_pcb( nullptr ), m_originTransforms( *this ), m_spaceMouse( nullptr )
|
||||||
m_originTransforms( *this )
|
|
||||||
{
|
{
|
||||||
m_settings = static_cast<PCBNEW_SETTINGS*>( Kiface().KifaceSettings() );
|
m_settings = static_cast<PCBNEW_SETTINGS*>( Kiface().KifaceSettings() );
|
||||||
}
|
}
|
||||||
@ -77,6 +80,11 @@ 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 )
|
||||||
|
if( m_spaceMouse != nullptr )
|
||||||
|
delete m_spaceMouse;
|
||||||
|
#endif
|
||||||
|
|
||||||
// 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();
|
||||||
|
|
||||||
@ -97,6 +105,19 @@ bool PCB_BASE_FRAME::canCloseWindow( wxCloseEvent& aEvent )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PCB_BASE_FRAME::handleActivateEvent( wxActivateEvent& aEvent )
|
||||||
|
{
|
||||||
|
EDA_DRAW_FRAME::handleActivateEvent( aEvent );
|
||||||
|
|
||||||
|
#if defined( KICAD_USE_3DCONNEXION )
|
||||||
|
if( m_spaceMouse != nullptr )
|
||||||
|
{
|
||||||
|
m_spaceMouse->SetFocus( aEvent.GetActive() );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
EDA_3D_VIEWER_FRAME* PCB_BASE_FRAME::Get3DViewerFrame()
|
EDA_3D_VIEWER_FRAME* PCB_BASE_FRAME::Get3DViewerFrame()
|
||||||
{
|
{
|
||||||
wxWindow* frame = FindWindowByName( QUALIFIED_VIEWER3D_FRAMENAME( this ) );
|
wxWindow* frame = FindWindowByName( QUALIFIED_VIEWER3D_FRAMENAME( this ) );
|
||||||
@ -919,6 +940,20 @@ void PCB_BASE_FRAME::ActivateGalCanvas()
|
|||||||
view->RecacheAllItems();
|
view->RecacheAllItems();
|
||||||
canvas->SetEventDispatcher( m_toolDispatcher );
|
canvas->SetEventDispatcher( m_toolDispatcher );
|
||||||
canvas->StartDrawing();
|
canvas->StartDrawing();
|
||||||
|
|
||||||
|
#if defined( KICAD_USE_3DCONNEXION )
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if( m_spaceMouse == nullptr )
|
||||||
|
{
|
||||||
|
m_spaceMouse = new NL_PCBNEW_PLUGIN( GetCanvas() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch( const std::system_error& e )
|
||||||
|
{
|
||||||
|
wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), e.what() );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -108,17 +108,13 @@
|
|||||||
|
|
||||||
#include <wx/filedlg.h>
|
#include <wx/filedlg.h>
|
||||||
|
|
||||||
#if defined( KICAD_USE_3DCONNEXION )
|
|
||||||
#include <navlib/nl_pcbnew_plugin.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace std::placeholders;
|
using namespace std::placeholders;
|
||||||
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
|
BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
|
||||||
EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV, PCB_EDIT_FRAME::OnSockRequestServer )
|
EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV, PCB_EDIT_FRAME::OnSockRequestServer )
|
||||||
EVT_SOCKET( ID_EDA_SOCKET_EVENT, PCB_EDIT_FRAME::OnSockRequest )
|
EVT_SOCKET( ID_EDA_SOCKET_EVENT, PCB_EDIT_FRAME::OnSockRequest )
|
||||||
EVT_ACTIVATE( PCB_EDIT_FRAME::OnActivate )
|
|
||||||
|
|
||||||
EVT_CHOICE( ID_ON_ZOOM_SELECT, PCB_EDIT_FRAME::OnSelectZoom )
|
EVT_CHOICE( ID_ON_ZOOM_SELECT, PCB_EDIT_FRAME::OnSelectZoom )
|
||||||
EVT_CHOICE( ID_ON_GRID_SELECT, PCB_EDIT_FRAME::OnSelectGrid )
|
EVT_CHOICE( ID_ON_GRID_SELECT, PCB_EDIT_FRAME::OnSelectGrid )
|
||||||
@ -182,7 +178,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||||||
PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_PCB_EDITOR, _( "PCB Editor" ),
|
PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_PCB_EDITOR, _( "PCB Editor" ),
|
||||||
wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE,
|
wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE,
|
||||||
PCB_EDIT_FRAME_NAME ),
|
PCB_EDIT_FRAME_NAME ),
|
||||||
m_exportNetlistAction( nullptr ), m_findDialog( nullptr ), m_spaceMouse( nullptr )
|
m_exportNetlistAction( nullptr ), m_findDialog( nullptr )
|
||||||
{
|
{
|
||||||
m_maximizeByDefault = true;
|
m_maximizeByDefault = true;
|
||||||
m_showBorderAndTitleBlock = true; // true to display sheet references
|
m_showBorderAndTitleBlock = true; // true to display sheet references
|
||||||
@ -372,17 +368,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||||||
// if( !appK2S.FileExists() )
|
// if( !appK2S.FileExists() )
|
||||||
// GetMenuBar()->FindItem( ID_GEN_EXPORT_FILE_STEP )->Enable( false );
|
// GetMenuBar()->FindItem( ID_GEN_EXPORT_FILE_STEP )->Enable( false );
|
||||||
|
|
||||||
#if defined( KICAD_USE_3DCONNEXION )
|
|
||||||
try
|
|
||||||
{
|
|
||||||
m_spaceMouse = new NL_PCBNEW_PLUGIN( canvas );
|
|
||||||
}
|
|
||||||
catch( const std::system_error& e )
|
|
||||||
{
|
|
||||||
wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), e.what() );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// AUI doesn't refresh properly on wxMac after changes in eb7dc6dd, so force it to
|
// AUI doesn't refresh properly on wxMac after changes in eb7dc6dd, so force it to
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
if( Kiface().IsSingle() )
|
if( Kiface().IsSingle() )
|
||||||
@ -427,11 +412,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||||||
|
|
||||||
PCB_EDIT_FRAME::~PCB_EDIT_FRAME()
|
PCB_EDIT_FRAME::~PCB_EDIT_FRAME()
|
||||||
{
|
{
|
||||||
#if defined( KICAD_USE_3DCONNEXION )
|
|
||||||
if( m_spaceMouse != nullptr )
|
|
||||||
delete m_spaceMouse;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( ADVANCED_CFG::GetCfg().m_ShowEventCounters )
|
if( ADVANCED_CFG::GetCfg().m_ShowEventCounters )
|
||||||
{
|
{
|
||||||
// Stop the timer during destruction early to avoid potential event race conditions (that do happen on windows)
|
// Stop the timer during destruction early to avoid potential event race conditions (that do happen on windows)
|
||||||
@ -1261,19 +1241,6 @@ void PCB_EDIT_FRAME::OnDisplayOptionsChanged()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_EDIT_FRAME::OnActivate( wxActivateEvent& aEvent )
|
|
||||||
{
|
|
||||||
#if defined( KICAD_USE_3DCONNEXION )
|
|
||||||
if( m_spaceMouse != nullptr )
|
|
||||||
{
|
|
||||||
m_spaceMouse->SetFocus( aEvent.GetActive() );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
aEvent.Skip(); // required under wxMAC
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool PCB_EDIT_FRAME::IsElementVisible( GAL_LAYER_ID aElement ) const
|
bool PCB_EDIT_FRAME::IsElementVisible( GAL_LAYER_ID aElement ) const
|
||||||
{
|
{
|
||||||
return GetBoard()->IsElementVisible( aElement );
|
return GetBoard()->IsElementVisible( aElement );
|
||||||
|
@ -57,7 +57,6 @@ class FP_LIB_TABLE;
|
|||||||
class BOARD_NETLIST_UPDATER;
|
class BOARD_NETLIST_UPDATER;
|
||||||
class ACTION_MENU;
|
class ACTION_MENU;
|
||||||
class TOOL_ACTION;
|
class TOOL_ACTION;
|
||||||
class NL_PCBNEW_PLUGIN;
|
|
||||||
|
|
||||||
enum LAST_PATH_TYPE : unsigned int;
|
enum LAST_PATH_TYPE : unsigned int;
|
||||||
|
|
||||||
@ -738,13 +737,6 @@ protected:
|
|||||||
*/
|
*/
|
||||||
void OnActionPluginMenu( wxCommandEvent& aEvent);
|
void OnActionPluginMenu( wxCommandEvent& aEvent);
|
||||||
|
|
||||||
/**
|
|
||||||
* Sent when a window or application is being activated or deactivated.
|
|
||||||
*
|
|
||||||
* @param aEvent sent by wx
|
|
||||||
*/
|
|
||||||
void OnActivate( wxActivateEvent& aEvent );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Launched by the button when an action is called.
|
* Launched by the button when an action is called.
|
||||||
*
|
*
|
||||||
@ -825,7 +817,6 @@ private:
|
|||||||
|
|
||||||
wxTimer* m_eventCounterTimer;
|
wxTimer* m_eventCounterTimer;
|
||||||
|
|
||||||
NL_PCBNEW_PLUGIN* m_spaceMouse;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __PCB_EDIT_FRAME_H__
|
#endif // __PCB_EDIT_FRAME_H__
|
||||||
|
Loading…
x
Reference in New Issue
Block a user