Unified update to C++14 std::make_unique

This update replaces the existing uses of unique pointer creation with
the C++14 std::make_unique call that provides proper memory release in
event of an exception.
This commit is contained in:
Seth Hillbrand 2019-12-05 05:43:55 -08:00
parent 4dc82ff76f
commit a2edf9c442
19 changed files with 89 additions and 66 deletions

View File

@ -26,6 +26,7 @@
#include <gal/opengl/utils.h> #include <gal/opengl/utils.h>
#include <gal/color4d.h> #include <gal/color4d.h>
#include <memory>
#include <tuple> #include <tuple>
#include "gl_builtin_shaders.h" #include "gl_builtin_shaders.h"
@ -138,7 +139,7 @@ bool ANTIALIASING_SUPERSAMPLING::Init()
{ {
if( mode == SUPERSAMPLING_MODE::X4 && !areShadersCreated ) if( mode == SUPERSAMPLING_MODE::X4 && !areShadersCreated )
{ {
x4_shader.reset( new SHADER() ); x4_shader = std::make_unique<SHADER>( );
x4_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_VERTEX, BUILTIN_SHADERS::ssaa_x4_vertex_shader ); x4_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_VERTEX, BUILTIN_SHADERS::ssaa_x4_vertex_shader );
x4_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_FRAGMENT, BUILTIN_SHADERS::ssaa_x4_fragment_shader ); x4_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_FRAGMENT, BUILTIN_SHADERS::ssaa_x4_fragment_shader );
x4_shader->Link(); x4_shader->Link();
@ -315,7 +316,7 @@ uniform vec4 SMAA_RT_METRICS;
// //
// Set up pass 1 Shader // Set up pass 1 Shader
// //
pass_1_shader.reset( new SHADER() ); pass_1_shader = std::make_unique<SHADER>( );
pass_1_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_VERTEX, vert_preamble, pass_1_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_VERTEX, vert_preamble,
quality_string, smaa_source, BUILTIN_SHADERS::smaa_pass_1_vertex_shader ); quality_string, smaa_source, BUILTIN_SHADERS::smaa_pass_1_vertex_shader );
pass_1_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_FRAGMENT, frag_preamble, pass_1_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_FRAGMENT, frag_preamble,
@ -333,7 +334,7 @@ uniform vec4 SMAA_RT_METRICS;
// //
// set up pass 2 shader // set up pass 2 shader
// //
pass_2_shader.reset( new SHADER() ); pass_2_shader = std::make_unique<SHADER>( );
pass_2_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_VERTEX, vert_preamble, pass_2_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_VERTEX, vert_preamble,
quality_string, smaa_source, BUILTIN_SHADERS::smaa_pass_2_vertex_shader ); quality_string, smaa_source, BUILTIN_SHADERS::smaa_pass_2_vertex_shader );
pass_2_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_FRAGMENT, frag_preamble, pass_2_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_FRAGMENT, frag_preamble,
@ -355,7 +356,7 @@ uniform vec4 SMAA_RT_METRICS;
// //
// set up pass 3 shader // set up pass 3 shader
// //
pass_3_shader.reset( new SHADER() ); pass_3_shader = std::make_unique<SHADER>( );
pass_3_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_VERTEX, vert_preamble, pass_3_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_VERTEX, vert_preamble,
quality_string, smaa_source, BUILTIN_SHADERS::smaa_pass_3_vertex_shader ); quality_string, smaa_source, BUILTIN_SHADERS::smaa_pass_3_vertex_shader );
pass_3_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_FRAGMENT, frag_preamble, pass_3_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_FRAGMENT, frag_preamble,

View File

@ -33,8 +33,9 @@
#include <gal/color4d.h> #include <gal/color4d.h>
#include <stdexcept>
#include <cassert> #include <cassert>
#include <memory>
#include <stdexcept>
using namespace KIGFX; using namespace KIGFX;
@ -43,7 +44,7 @@ OPENGL_COMPOSITOR::OPENGL_COMPOSITOR() :
m_mainFbo( 0 ), m_depthBuffer( 0 ), m_curFbo( DIRECT_RENDERING ), m_mainFbo( 0 ), m_depthBuffer( 0 ), m_curFbo( DIRECT_RENDERING ),
m_currentAntialiasingMode( OPENGL_ANTIALIASING_MODE::NONE ) m_currentAntialiasingMode( OPENGL_ANTIALIASING_MODE::NONE )
{ {
m_antialiasing.reset( new ANTIALIASING_NONE( this ) ); m_antialiasing = std::make_unique<ANTIALIASING_NONE>( this );
} }
@ -77,19 +78,19 @@ void OPENGL_COMPOSITOR::Initialize()
switch( m_currentAntialiasingMode ) switch( m_currentAntialiasingMode )
{ {
case OPENGL_ANTIALIASING_MODE::NONE: case OPENGL_ANTIALIASING_MODE::NONE:
m_antialiasing.reset( new ANTIALIASING_NONE( this ) ); m_antialiasing = std::make_unique<ANTIALIASING_NONE>( this );
break; break;
case OPENGL_ANTIALIASING_MODE::SUBSAMPLE_HIGH: case OPENGL_ANTIALIASING_MODE::SUBSAMPLE_HIGH:
m_antialiasing.reset( new ANTIALIASING_SMAA( this, SMAA_QUALITY::HIGH ) ); m_antialiasing = std::make_unique<ANTIALIASING_SMAA>( this, SMAA_QUALITY::HIGH );
break; break;
case OPENGL_ANTIALIASING_MODE::SUBSAMPLE_ULTRA: case OPENGL_ANTIALIASING_MODE::SUBSAMPLE_ULTRA:
m_antialiasing.reset( new ANTIALIASING_SMAA( this, SMAA_QUALITY::ULTRA ) ); m_antialiasing = std::make_unique<ANTIALIASING_SMAA>( this, SMAA_QUALITY::ULTRA );
break; break;
case OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X2: case OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X2:
m_antialiasing.reset( new ANTIALIASING_SUPERSAMPLING( this, SUPERSAMPLING_MODE::X2 ) ); m_antialiasing = std::make_unique<ANTIALIASING_SUPERSAMPLING>( this, SUPERSAMPLING_MODE::X2 );
break; break;
case OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X4: case OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X4:
m_antialiasing.reset( new ANTIALIASING_SUPERSAMPLING( this, SUPERSAMPLING_MODE::X4 ) ); m_antialiasing = std::make_unique<ANTIALIASING_SUPERSAMPLING>( this, SUPERSAMPLING_MODE::X4 );
break; break;
} }

View File

@ -41,8 +41,9 @@
#include <wx/log.h> #include <wx/log.h>
#endif /* __WXDEBUG__ */ #endif /* __WXDEBUG__ */
#include <limits>
#include <functional> #include <functional>
#include <limits>
#include <memory>
using namespace std::placeholders; using namespace std::placeholders;
using namespace KIGFX; using namespace KIGFX;
@ -226,7 +227,7 @@ OPENGL_GAL::OPENGL_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent,
shader = new SHADER(); shader = new SHADER();
++instanceCounter; ++instanceCounter;
bitmapCache.reset( new GL_BITMAP_CACHE ); bitmapCache = std::make_unique<GL_BITMAP_CACHE>( );
compositor = new OPENGL_COMPOSITOR; compositor = new OPENGL_COMPOSITOR;
compositor->SetAntialiasingMode( options.gl_antialiasing_mode ); compositor->SetAntialiasingMode( options.gl_antialiasing_mode );
@ -1526,7 +1527,7 @@ void OPENGL_GAL::DeleteGroup( int aGroupNumber )
void OPENGL_GAL::ClearCache() void OPENGL_GAL::ClearCache()
{ {
bitmapCache.reset( new GL_BITMAP_CACHE ); bitmapCache = std::make_unique<GL_BITMAP_CACHE>( );
groups.clear(); groups.clear();

View File

@ -32,6 +32,7 @@
#include <gerber_file_image_list.h> #include <gerber_file_image_list.h>
#include <functional> #include <functional>
#include <memory>
using namespace std::placeholders; using namespace std::placeholders;
@ -44,7 +45,7 @@ EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aOptions, aGalTy
m_view->SetGAL( m_gal ); m_view->SetGAL( m_gal );
GetGAL()->SetWorldUnitLength( 1.0/IU_PER_MM /* 10 nm */ / 25.4 /* 1 inch in mm */ ); GetGAL()->SetWorldUnitLength( 1.0/IU_PER_MM /* 10 nm */ / 25.4 /* 1 inch in mm */ );
m_painter.reset( new KIGFX::GERBVIEW_PAINTER( m_gal ) ); m_painter = std::make_unique<KIGFX::GERBVIEW_PAINTER>( m_gal );
m_view->SetPainter( m_painter.get() ); m_view->SetPainter( m_painter.get() );
m_viewControls = new KIGFX::WX_VIEW_CONTROLS( m_view, this ); m_viewControls = new KIGFX::WX_VIEW_CONTROLS( m_view, this );

View File

@ -28,8 +28,9 @@
#include <map> #include <map>
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
#include <memory>
#include <project.h> #include <project.h>
#include <properties.h> #include <properties.h>
@ -189,7 +190,7 @@ protected:
enabled( aRow.enabled ) enabled( aRow.enabled )
{ {
if( aRow.properties ) if( aRow.properties )
properties.reset( new PROPERTIES( *aRow.properties.get() ) ); properties = std::make_unique<PROPERTIES>( *aRow.properties.get() );
else else
properties.reset(); properties.reset();
} }

View File

@ -30,6 +30,7 @@
#include <gal/graphics_abstraction_layer.h> #include <gal/graphics_abstraction_layer.h>
#include <functional> #include <functional>
#include <memory>
#include <tools/pl_selection_tool.h> #include <tools/pl_selection_tool.h>
using namespace std::placeholders; using namespace std::placeholders;
@ -45,7 +46,7 @@ PL_DRAW_PANEL_GAL::PL_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWindo
GetGAL()->SetWorldUnitLength( 1.0/IU_PER_MM /* 10 nm */ / 25.4 /* 1 inch in mm */ ); GetGAL()->SetWorldUnitLength( 1.0/IU_PER_MM /* 10 nm */ / 25.4 /* 1 inch in mm */ );
m_painter.reset( new KIGFX::WS_PAINTER( m_gal ) ); m_painter = std::make_unique<KIGFX::WS_PAINTER>( m_gal );
m_view->SetPainter( m_painter.get() ); m_view->SetPainter( m_painter.get() );
m_view->SetScaleLimits( 20.0, 0.05 ); // This fixes the zoom in and zoom out limits m_view->SetScaleLimits( 20.0, 0.05 ); // This fixes the zoom in and zoom out limits

View File

@ -41,9 +41,11 @@
#include <connectivity/connectivity_data.h> #include <connectivity/connectivity_data.h>
#include <ratsnest_data.h> #include <ratsnest_data.h>
#include <widgets/progress_reporter.h> #include <widgets/progress_reporter.h>
#include "ar_matrix.h"
#include "ar_cell.h"
#include "ar_autoplacer.h" #include "ar_autoplacer.h"
#include "ar_cell.h"
#include "ar_matrix.h"
#include <memory>
#define AR_GAIN 16 #define AR_GAIN 16
#define AR_KEEPOUT_MARGIN 500 #define AR_KEEPOUT_MARGIN 500
@ -73,7 +75,7 @@ static const double OrientationPenalty[11] =
AR_AUTOPLACER::AR_AUTOPLACER( BOARD* aBoard ) AR_AUTOPLACER::AR_AUTOPLACER( BOARD* aBoard )
{ {
m_board = aBoard; m_board = aBoard;
m_connectivity.reset( new CONNECTIVITY_DATA ); m_connectivity = std::make_unique<CONNECTIVITY_DATA>( );
for( auto mod : m_board->Modules() ) for( auto mod : m_board->Modules() )
m_connectivity->Add( mod ); m_connectivity->Add( mod );

View File

@ -352,7 +352,7 @@ public:
outline.SetClosed( true ); outline.SetClosed( true );
outline.Simplify(); outline.Simplify();
m_cachedPoly.reset( new POLY_GRID_PARTITION( outline, 16 ) ); m_cachedPoly = std::make_unique<POLY_GRID_PARTITION>( outline, 16 );
} }
int SubpolyIndex() const int SubpolyIndex() const

View File

@ -32,6 +32,8 @@
#include <class_edge_mod.h> #include <class_edge_mod.h>
#include <class_text_mod.h> #include <class_text_mod.h>
#include <memory>
// Configuration path (group) to store entry keys below. // Configuration path (group) to store entry keys below.
#define IMPORT_GFX_GROUP "ImportGraphics" #define IMPORT_GFX_GROUP "ImportGraphics"
@ -61,9 +63,9 @@ DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX( PCB_BASE_FRAME* aParent, bool aImportAsFoo
m_parent = aParent; m_parent = aParent;
if( aImportAsFootprintGraphic ) if( aImportAsFootprintGraphic )
m_importer.reset( new GRAPHICS_IMPORTER_MODULE( m_parent->GetBoard()->GetFirstModule() ) ); m_importer = std::make_unique<GRAPHICS_IMPORTER_MODULE>( m_parent->GetBoard()->GetFirstModule() );
else else
m_importer.reset( new GRAPHICS_IMPORTER_BOARD( m_parent->GetBoard() ) ); m_importer = std::make_unique<GRAPHICS_IMPORTER_BOARD>( m_parent->GetBoard() );
// construct an import manager with options from config // construct an import manager with options from config
{ {

View File

@ -29,6 +29,7 @@
#include <class_edge_mod.h> #include <class_edge_mod.h>
#include <class_pcb_text.h> #include <class_pcb_text.h>
#include <class_text_mod.h> #include <class_text_mod.h>
#include <memory>
#include <tuple> #include <tuple>
#include "convert_to_biu.h" #include "convert_to_biu.h"
@ -175,7 +176,7 @@ void GRAPHICS_IMPORTER_PCBNEW::AddSpline( const VECTOR2D& aStart, const VECTOR2D
unique_ptr<DRAWSEGMENT> GRAPHICS_IMPORTER_BOARD::createDrawing() unique_ptr<DRAWSEGMENT> GRAPHICS_IMPORTER_BOARD::createDrawing()
{ {
return unique_ptr<DRAWSEGMENT>( new DRAWSEGMENT( m_board ) ); return std::make_unique<DRAWSEGMENT>( m_board );
} }

View File

@ -42,6 +42,7 @@
#include <gal/graphics_abstraction_layer.h> #include <gal/graphics_abstraction_layer.h>
#include <functional> #include <functional>
#include <memory>
#include <thread> #include <thread>
using namespace std::placeholders; using namespace std::placeholders;
@ -111,7 +112,7 @@ PCB_DRAW_PANEL_GAL::PCB_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
m_view = new KIGFX::PCB_VIEW( true ); m_view = new KIGFX::PCB_VIEW( true );
m_view->SetGAL( m_gal ); m_view->SetGAL( m_gal );
m_painter.reset( new KIGFX::PCB_PAINTER( m_gal ) ); m_painter = std::make_unique<KIGFX::PCB_PAINTER>( m_gal );
m_view->SetPainter( m_painter.get() ); m_view->SetPainter( m_painter.get() );
setDefaultLayerOrder(); setDefaultLayerOrder();
@ -190,7 +191,7 @@ void PCB_DRAW_PANEL_GAL::DisplayBoard( BOARD* aBoard )
m_view->Add( zone ); m_view->Add( zone );
// Ratsnest // Ratsnest
m_ratsnest.reset( new KIGFX::RATSNEST_VIEWITEM( aBoard->GetConnectivity() ) ); m_ratsnest = std::make_unique<KIGFX::RATSNEST_VIEWITEM>( aBoard->GetConnectivity() );
m_view->Add( m_ratsnest.get() ); m_view->Add( m_ratsnest.get() );
} }

View File

@ -46,6 +46,8 @@
#include <geometry/shape_circle.h> #include <geometry/shape_circle.h>
#include <geometry/shape_arc.h> #include <geometry/shape_arc.h>
#include <memory>
#include "tools/pcb_tool_base.h" #include "tools/pcb_tool_base.h"
#include "pns_kicad_iface.h" #include "pns_kicad_iface.h"
@ -1332,7 +1334,7 @@ void PNS_KICAD_IFACE::Commit()
{ {
EraseView(); EraseView();
m_commit->Push( _( "Added a track" ) ); m_commit->Push( _( "Added a track" ) );
m_commit.reset( new BOARD_COMMIT( m_tool ) ); m_commit = std::make_unique<BOARD_COMMIT>( m_tool );
} }
@ -1378,7 +1380,7 @@ void PNS_KICAD_IFACE::SetRouter( PNS::ROUTER* aRouter )
void PNS_KICAD_IFACE::SetHostTool( PCB_TOOL_BASE* aTool ) void PNS_KICAD_IFACE::SetHostTool( PCB_TOOL_BASE* aTool )
{ {
m_tool = aTool; m_tool = aTool;
m_commit.reset( new BOARD_COMMIT( m_tool ) ); m_commit = std::make_unique<BOARD_COMMIT>( m_tool );
} }
void PNS_KICAD_IFACE::SetDisplayOptions( const PCB_DISPLAY_OPTIONS* aDispOptions ) void PNS_KICAD_IFACE::SetDisplayOptions( const PCB_DISPLAY_OPTIONS* aDispOptions )

View File

@ -32,6 +32,8 @@
#include <class_board_item.h> #include <class_board_item.h>
#include <memory>
namespace PNS { namespace PNS {
LINE_PLACER::LINE_PLACER( ROUTER* aRouter ) : LINE_PLACER::LINE_PLACER( ROUTER* aRouter ) :
@ -947,7 +949,7 @@ void LINE_PLACER::initPlacement()
if( m_currentMode == RM_Shove || m_currentMode == RM_Smart ) if( m_currentMode == RM_Shove || m_currentMode == RM_Smart )
{ {
m_shove.reset( new SHOVE( m_world->Branch(), Router() ) ); m_shove = std::make_unique<SHOVE>( m_world->Branch(), Router() );
} }
} }

View File

@ -20,6 +20,7 @@
*/ */
#include <cstdio> #include <cstdio>
#include <memory>
#include <vector> #include <vector>
#include <view/view.h> #include <view/view.h>
@ -90,7 +91,7 @@ void ROUTER::SyncWorld()
{ {
ClearWorld(); ClearWorld();
m_world = std::unique_ptr<NODE>( new NODE ); m_world = std::make_unique<NODE>( );
m_iface->SyncWorld( m_world.get() ); m_iface->SyncWorld( m_world.get() );
} }
@ -133,10 +134,10 @@ bool ROUTER::StartDragging( const VECTOR2I& aP, ITEM* aStartItem, int aDragMode
if( !aStartItem || aStartItem->OfKind( ITEM::SOLID_T ) ) if( !aStartItem || aStartItem->OfKind( ITEM::SOLID_T ) )
return false; return false;
m_placer.reset( new LINE_PLACER( this ) ); m_placer = std::make_unique<LINE_PLACER>( this );
m_placer->Start( aP, aStartItem ); m_placer->Start( aP, aStartItem );
m_dragger.reset( new DRAGGER( this ) ); m_dragger = std::make_unique<DRAGGER>( this );
m_dragger->SetMode( aDragMode ); m_dragger->SetMode( aDragMode );
m_dragger->SetWorld( m_world.get() ); m_dragger->SetWorld( m_world.get() );
m_dragger->SetDebugDecorator ( m_iface->GetDebugDecorator () ); m_dragger->SetDebugDecorator ( m_iface->GetDebugDecorator () );
@ -185,19 +186,19 @@ bool ROUTER::StartRouting( const VECTOR2I& aP, ITEM* aStartItem, int aLayer )
switch( m_mode ) switch( m_mode )
{ {
case PNS_MODE_ROUTE_SINGLE: case PNS_MODE_ROUTE_SINGLE:
m_placer.reset( new LINE_PLACER( this ) ); m_placer = std::make_unique<LINE_PLACER>( this );
break; break;
case PNS_MODE_ROUTE_DIFF_PAIR: case PNS_MODE_ROUTE_DIFF_PAIR:
m_placer.reset( new DIFF_PAIR_PLACER( this ) ); m_placer = std::make_unique<DIFF_PAIR_PLACER>( this );
break; break;
case PNS_MODE_TUNE_SINGLE: case PNS_MODE_TUNE_SINGLE:
m_placer.reset( new MEANDER_PLACER( this ) ); m_placer = std::make_unique<MEANDER_PLACER>( this );
break; break;
case PNS_MODE_TUNE_DIFF_PAIR: case PNS_MODE_TUNE_DIFF_PAIR:
m_placer.reset( new DP_MEANDER_PLACER( this ) ); m_placer = std::make_unique<DP_MEANDER_PLACER>( this );
break; break;
case PNS_MODE_TUNE_DIFF_PAIR_SKEW: case PNS_MODE_TUNE_DIFF_PAIR_SKEW:
m_placer.reset( new MEANDER_SKEW_PLACER( this ) ); m_placer = std::make_unique<MEANDER_SKEW_PLACER>( this );
break; break;
default: default:

View File

@ -33,6 +33,8 @@
#include <tools/global_edit_tool.h> #include <tools/global_edit_tool.h>
#include <board_commit.h> #include <board_commit.h>
#include <memory>
GLOBAL_EDIT_TOOL::GLOBAL_EDIT_TOOL() : GLOBAL_EDIT_TOOL::GLOBAL_EDIT_TOOL() :
PCB_TOOL_BASE( "pcbnew.GlobalEdit" ) PCB_TOOL_BASE( "pcbnew.GlobalEdit" )
@ -43,7 +45,7 @@ GLOBAL_EDIT_TOOL::GLOBAL_EDIT_TOOL() :
void GLOBAL_EDIT_TOOL::Reset( RESET_REASON aReason ) void GLOBAL_EDIT_TOOL::Reset( RESET_REASON aReason )
{ {
if( aReason != RUN ) if( aReason != RUN )
m_commit.reset( new BOARD_COMMIT( this ) ); m_commit = std::make_unique<BOARD_COMMIT>( this );
} }

View File

@ -22,35 +22,36 @@
* or you may write to the Free Software Foundation, Inc., * or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <cstdint>
#include <functional>
#include "pcb_editor_control.h" #include "pcb_editor_control.h"
#include "pcb_actions.h"
#include <tool/tool_manager.h>
#include <tools/tool_event_utils.h>
#include <ws_proxy_undo_item.h>
#include "selection_tool.h"
#include "drawing_tool.h" #include "drawing_tool.h"
#include "pcb_actions.h"
#include "pcbnew_picker_tool.h" #include "pcbnew_picker_tool.h"
#include <painter.h> #include "selection_tool.h"
#include <project.h> #include <bitmaps.h>
#include <pcbnew_id.h> #include <board_commit.h>
#include <pcb_edit_frame.h>
#include <class_board.h> #include <class_board.h>
#include <class_zone.h>
#include <class_module.h> #include <class_module.h>
#include <class_pcb_target.h> #include <class_pcb_target.h>
#include <class_zone.h>
#include <collectors.h> #include <collectors.h>
#include <board_commit.h> #include <cstdint>
#include <bitmaps.h>
#include <view/view_group.h>
#include <view/view_controls.h>
#include <origin_viewitem.h>
#include <dialogs/dialog_page_settings.h> #include <dialogs/dialog_page_settings.h>
#include <netlist_reader/pcb_netlist.h>
#include <dialogs/dialog_update_pcb.h> #include <dialogs/dialog_update_pcb.h>
#include <functional>
#include <gestfich.h> #include <gestfich.h>
#include <memory>
#include <netlist_reader/pcb_netlist.h>
#include <origin_viewitem.h>
#include <painter.h>
#include <pcb_edit_frame.h>
#include <pcbnew_id.h>
#include <project.h>
#include <tool/tool_manager.h>
#include <tools/tool_event_utils.h>
#include <view/view_controls.h>
#include <view/view_group.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#include <ws_proxy_undo_item.h>
using namespace std::placeholders; using namespace std::placeholders;
@ -140,8 +141,8 @@ PCB_EDITOR_CONTROL::PCB_EDITOR_CONTROL() :
PCB_TOOL_BASE( "pcbnew.EditorControl" ), PCB_TOOL_BASE( "pcbnew.EditorControl" ),
m_frame( nullptr ) m_frame( nullptr )
{ {
m_placeOrigin.reset( new KIGFX::ORIGIN_VIEWITEM( KIGFX::COLOR4D( 0.8, 0.0, 0.0, 1.0 ), m_placeOrigin = std::make_unique<KIGFX::ORIGIN_VIEWITEM>( KIGFX::COLOR4D( 0.8, 0.0, 0.0, 1.0 ),
KIGFX::ORIGIN_VIEWITEM::CIRCLE_CROSS ) ); KIGFX::ORIGIN_VIEWITEM::CIRCLE_CROSS );
} }

View File

@ -23,6 +23,7 @@
*/ */
#include <functional> #include <functional>
#include <memory>
using namespace std::placeholders; using namespace std::placeholders;
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <view/view_controls.h> #include <view/view_controls.h>
@ -240,7 +241,7 @@ void POINT_EDITOR::Reset( RESET_REASON aReason )
m_altConstraint.reset(); m_altConstraint.reset();
getViewControls()->SetAutoPan( false ); getViewControls()->SetAutoPan( false );
m_statusPopup.reset( new STATUS_TEXT_POPUP( getEditFrame<PCB_BASE_EDIT_FRAME>() ) ); m_statusPopup = std::make_unique<STATUS_TEXT_POPUP>( getEditFrame<PCB_BASE_EDIT_FRAME>() );
m_statusPopup->SetTextColor( wxColour( 255, 0, 0 ) ); m_statusPopup->SetTextColor( wxColour( 255, 0, 0 ) );
m_statusPopup->SetText( _( "Self-intersecting polygons are not allowed." ) ); m_statusPopup->SetText( _( "Self-intersecting polygons are not allowed." ) );
} }

View File

@ -22,6 +22,7 @@
*/ */
#include <functional> #include <functional>
#include <memory>
using namespace std::placeholders; using namespace std::placeholders;
#include "position_relative_tool.h" #include "position_relative_tool.h"
@ -48,7 +49,7 @@ POSITION_RELATIVE_TOOL::POSITION_RELATIVE_TOOL() :
void POSITION_RELATIVE_TOOL::Reset( RESET_REASON aReason ) void POSITION_RELATIVE_TOOL::Reset( RESET_REASON aReason )
{ {
if( aReason != RUN ) if( aReason != RUN )
m_commit.reset( new BOARD_COMMIT( this ) ); m_commit = std::make_unique<BOARD_COMMIT>( this );
} }

View File

@ -49,6 +49,7 @@
#include <connectivity/connectivity_data.h> #include <connectivity/connectivity_data.h>
#include <io_mgr.h> #include <io_mgr.h>
#include <memory>
#include <set> #include <set>
#include <tool/actions.h> #include <tool/actions.h>
@ -180,8 +181,8 @@ PCB_TEST_FRAME::PCB_TEST_FRAME( wxFrame* frame, const wxString& title, const wxP
options.gl_antialiasing_mode = KIGFX::OPENGL_ANTIALIASING_MODE::NONE; //SUPERSAMPLING_X4; options.gl_antialiasing_mode = KIGFX::OPENGL_ANTIALIASING_MODE::NONE; //SUPERSAMPLING_X4;
m_galPanel.reset( new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, m_galPanel = std::make_unique<PCB_DRAW_PANEL_GAL>( this, -1, wxPoint( 0,
0 ), wxDefaultSize, options, aGalType ) ); 0 ), wxDefaultSize, options, aGalType );
m_galPanel->SetEvtHandlerEnabled( true ); m_galPanel->SetEvtHandlerEnabled( true );
m_galPanel->SetFocus(); m_galPanel->SetFocus();
@ -201,12 +202,12 @@ PCB_TEST_FRAME::PCB_TEST_FRAME( wxFrame* frame, const wxString& title, const wxP
m_galPanel->GetViewControls()->ShowCursor( true ); m_galPanel->GetViewControls()->ShowCursor( true );
#ifdef USE_TOOL_MANAGER #ifdef USE_TOOL_MANAGER
m_toolManager.reset( new TOOL_MANAGER ); m_toolManager = std::make_unique<TOOL_MANAGER>( );
m_toolManager->SetEnvironment( m_board.get(), m_galPanel->GetView(), m_toolManager->SetEnvironment( m_board.get(), m_galPanel->GetView(),
m_galPanel->GetViewControls(), nullptr ); m_galPanel->GetViewControls(), nullptr );
m_pcbActions.reset( new TEST_ACTIONS() ); m_pcbActions = std::make_unique<TEST_ACTIONS>( );
m_toolDispatcher.reset( new TOOL_DISPATCHER( m_toolManager.get(), m_pcbActions.get() ) ); m_toolDispatcher = std::make_unique<TOOL_DISPATCHER>( m_toolManager.get(), m_pcbActions.get() );
m_toolManager->RegisterTool( new SELECTION_TOOL ); m_toolManager->RegisterTool( new SELECTION_TOOL );