mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-14 13:09:35 +00:00
Move all nlnav to unique_ptrs
7daded7c60
moved them to bare pointers but
this was not required to allow forward declarations. We only need to
place the CTOR/DTOR fully in the cpp file where the nlnav headers are
included
This commit is contained in:
parent
bbde2900e9
commit
fbbb642c0c
3d-viewer
3d_viewer
dialogs
eeschema
include
pcbnew
@ -94,8 +94,7 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
|
||||
m_mainToolBar( nullptr ),
|
||||
m_canvas( nullptr ),
|
||||
m_currentCamera( m_trackBallCamera ),
|
||||
m_trackBallCamera( 2 * RANGE_SCALE_3D ),
|
||||
m_spaceMouse( nullptr )
|
||||
m_trackBallCamera( 2 * RANGE_SCALE_3D )
|
||||
{
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME %s" ), aTitle );
|
||||
|
||||
@ -187,7 +186,7 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
|
||||
|
||||
try
|
||||
{
|
||||
m_spaceMouse = new NL_3D_VIEWER_PLUGIN( m_canvas );
|
||||
m_spaceMouse = std::make_unique<NL_3D_VIEWER_PLUGIN>( m_canvas );
|
||||
}
|
||||
catch( const std::system_error& e )
|
||||
{
|
||||
@ -203,8 +202,6 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent
|
||||
|
||||
EDA_3D_VIEWER_FRAME::~EDA_3D_VIEWER_FRAME()
|
||||
{
|
||||
delete m_spaceMouse;
|
||||
|
||||
Prj().GetProjectFile().m_Viewports3D = m_appearancePanel->GetUserViewports();
|
||||
|
||||
m_canvas->SetEventDispatcher( nullptr );
|
||||
|
@ -180,7 +180,7 @@ private:
|
||||
|
||||
bool m_disable_ray_tracing;
|
||||
|
||||
NL_3D_VIEWER_PLUGIN* m_spaceMouse;
|
||||
std::unique_ptr<NL_3D_VIEWER_PLUGIN> m_spaceMouse;
|
||||
|
||||
/**
|
||||
* Trace mask used to enable or disable the trace output of this class.
|
||||
|
@ -130,8 +130,15 @@ PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL( wxWindow* aParent, PCB_BASE_FRAM
|
||||
m_boardAdapter, m_currentCamera,
|
||||
PROJECT_PCB::Get3DCacheManager( &aFrame->Prj() ) );
|
||||
|
||||
m_spaceMouse = new NL_FOOTPRINT_PROPERTIES_PLUGIN( m_previewPane );
|
||||
m_spaceMouse->SetFocus( true );
|
||||
try
|
||||
{
|
||||
m_spaceMouse = std::make_unique<NL_FOOTPRINT_PROPERTIES_PLUGIN>( m_previewPane );
|
||||
m_spaceMouse->SetFocus( true );
|
||||
}
|
||||
catch( const std::system_error& e )
|
||||
{
|
||||
wxLogTrace( wxT( "KI_TRACE_NAVLIB" ), e.what() );
|
||||
}
|
||||
|
||||
m_boardAdapter.SetBoard( m_dummyBoard );
|
||||
m_boardAdapter.m_IsBoardView = false;
|
||||
@ -180,7 +187,6 @@ PANEL_PREVIEW_3D_MODEL::~PANEL_PREVIEW_3D_MODEL()
|
||||
if( m_boardAdapter.m_Cfg )
|
||||
m_boardAdapter.m_Cfg->m_Render = m_initialRender;
|
||||
|
||||
delete m_spaceMouse;
|
||||
delete m_dummyBoard;
|
||||
delete m_previewPane;
|
||||
}
|
||||
@ -625,7 +631,7 @@ void PANEL_PREVIEW_3D_MODEL::onUnitsChanged( wxCommandEvent& aEvent )
|
||||
|
||||
void PANEL_PREVIEW_3D_MODEL::onPanelShownEvent( wxCommandEvent& aEvent )
|
||||
{
|
||||
if( m_spaceMouse != nullptr )
|
||||
if( m_spaceMouse )
|
||||
{
|
||||
m_spaceMouse->SetFocus( static_cast<bool>( aEvent.GetInt() ) );
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ private:
|
||||
/// The 3d viewer Render initial settings (must be saved and restored)
|
||||
EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS m_initialRender;
|
||||
|
||||
NL_FOOTPRINT_PROPERTIES_PLUGIN* m_spaceMouse;
|
||||
std::unique_ptr<NL_FOOTPRINT_PROPERTIES_PLUGIN> m_spaceMouse;
|
||||
};
|
||||
|
||||
#endif // PANEL_PREVIEW_3D_MODEL_H
|
||||
|
@ -99,8 +99,7 @@ SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aWindo
|
||||
EDA_DRAW_FRAME( aKiway, aParent, aWindowType, aTitle, aPosition, aSize, aStyle,
|
||||
aFrameName, schIUScale ),
|
||||
m_base_frame_defaults( nullptr, "base_Frame_defaults" ),
|
||||
m_selectionFilterPanel( nullptr ),
|
||||
m_spaceMouse( nullptr )
|
||||
m_selectionFilterPanel( nullptr )
|
||||
{
|
||||
if( ( aStyle & wxFRAME_NO_TASKBAR ) == 0 )
|
||||
createCanvas();
|
||||
@ -123,10 +122,9 @@ SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aWindo
|
||||
}
|
||||
|
||||
|
||||
/// Needs to be in the cpp file to encode the sizeof() for std::unique_ptr
|
||||
SCH_BASE_FRAME::~SCH_BASE_FRAME()
|
||||
{
|
||||
delete m_spaceMouse;
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
SCH_SCREEN* SCH_BASE_FRAME::GetScreen() const
|
||||
@ -377,7 +375,7 @@ void SCH_BASE_FRAME::ActivateGalCanvas()
|
||||
try
|
||||
{
|
||||
if( !m_spaceMouse )
|
||||
m_spaceMouse = new NL_SCHEMATIC_PLUGIN();
|
||||
m_spaceMouse = std::make_unique<NL_SCHEMATIC_PLUGIN>();
|
||||
|
||||
m_spaceMouse->SetCanvas( GetCanvas() );
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ private:
|
||||
wxDateTime m_watcherLastModified;
|
||||
wxTimer m_watcherDebounceTimer;
|
||||
|
||||
NL_SCHEMATIC_PLUGIN* m_spaceMouse;
|
||||
std::unique_ptr<NL_SCHEMATIC_PLUGIN> m_spaceMouse;
|
||||
};
|
||||
|
||||
#endif // SCH_BASE_FRAME_H_
|
||||
|
@ -428,7 +428,7 @@ protected:
|
||||
PCB_ORIGIN_TRANSFORMS m_originTransforms;
|
||||
|
||||
private:
|
||||
NL_PCBNEW_PLUGIN* m_spaceMouse;
|
||||
std::unique_ptr<NL_PCBNEW_PLUGIN> m_spaceMouse;
|
||||
|
||||
std::unique_ptr<wxFileSystemWatcher> m_watcher;
|
||||
wxFileName m_watcherFileName;
|
||||
|
@ -81,8 +81,7 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
|
||||
EDA_DRAW_FRAME( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName,
|
||||
pcbIUScale ),
|
||||
m_pcb( nullptr ),
|
||||
m_originTransforms( *this ),
|
||||
m_spaceMouse( nullptr )
|
||||
m_originTransforms( *this )
|
||||
{
|
||||
m_watcherDebounceTimer.Bind( wxEVT_TIMER, &PCB_BASE_FRAME::OnFpChangeDebounceTimer, this );
|
||||
}
|
||||
@ -90,9 +89,6 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
|
||||
|
||||
PCB_BASE_FRAME::~PCB_BASE_FRAME()
|
||||
{
|
||||
delete m_spaceMouse;
|
||||
m_spaceMouse = nullptr;
|
||||
|
||||
// Ensure m_canvasType is up to date, to save it in config
|
||||
if( GetCanvas() )
|
||||
m_canvasType = GetCanvas()->GetBackend();
|
||||
@ -132,7 +128,7 @@ void PCB_BASE_FRAME::handleIconizeEvent( wxIconizeEvent& aEvent )
|
||||
{
|
||||
EDA_DRAW_FRAME::handleIconizeEvent( aEvent );
|
||||
|
||||
if( m_spaceMouse != nullptr && aEvent.IsIconized() )
|
||||
if( m_spaceMouse && aEvent.IsIconized() )
|
||||
m_spaceMouse->SetFocus( false );
|
||||
}
|
||||
|
||||
@ -1040,9 +1036,9 @@ void PCB_BASE_FRAME::ActivateGalCanvas()
|
||||
try
|
||||
|
||||
{
|
||||
if( m_spaceMouse == nullptr )
|
||||
if( !m_spaceMouse )
|
||||
{
|
||||
m_spaceMouse = new NL_PCBNEW_PLUGIN( GetCanvas() );
|
||||
m_spaceMouse = std::make_unique<NL_PCBNEW_PLUGIN>( GetCanvas() );
|
||||
}
|
||||
}
|
||||
catch( const std::system_error& e )
|
||||
|
Loading…
Reference in New Issue
Block a user