diff --git a/common/gal/opengl/antialiasing.cpp b/common/gal/opengl/antialiasing.cpp index 276b4d0646..1a84516499 100644 --- a/common/gal/opengl/antialiasing.cpp +++ b/common/gal/opengl/antialiasing.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include "gl_builtin_shaders.h" @@ -138,7 +139,7 @@ bool ANTIALIASING_SUPERSAMPLING::Init() { if( mode == SUPERSAMPLING_MODE::X4 && !areShadersCreated ) { - x4_shader.reset( new SHADER() ); + x4_shader = std::make_unique( ); 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->Link(); @@ -315,7 +316,7 @@ uniform vec4 SMAA_RT_METRICS; // // Set up pass 1 Shader // - pass_1_shader.reset( new SHADER() ); + pass_1_shader = std::make_unique( ); pass_1_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_VERTEX, vert_preamble, quality_string, smaa_source, BUILTIN_SHADERS::smaa_pass_1_vertex_shader ); pass_1_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_FRAGMENT, frag_preamble, @@ -333,7 +334,7 @@ uniform vec4 SMAA_RT_METRICS; // // set up pass 2 shader // - pass_2_shader.reset( new SHADER() ); + pass_2_shader = std::make_unique( ); pass_2_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_VERTEX, vert_preamble, quality_string, smaa_source, BUILTIN_SHADERS::smaa_pass_2_vertex_shader ); pass_2_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_FRAGMENT, frag_preamble, @@ -355,7 +356,7 @@ uniform vec4 SMAA_RT_METRICS; // // set up pass 3 shader // - pass_3_shader.reset( new SHADER() ); + pass_3_shader = std::make_unique( ); pass_3_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_VERTEX, vert_preamble, quality_string, smaa_source, BUILTIN_SHADERS::smaa_pass_3_vertex_shader ); pass_3_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_FRAGMENT, frag_preamble, diff --git a/common/gal/opengl/opengl_compositor.cpp b/common/gal/opengl/opengl_compositor.cpp index 6fae6014f9..9098bac5a4 100644 --- a/common/gal/opengl/opengl_compositor.cpp +++ b/common/gal/opengl/opengl_compositor.cpp @@ -33,8 +33,9 @@ #include -#include #include +#include +#include using namespace KIGFX; @@ -43,7 +44,7 @@ OPENGL_COMPOSITOR::OPENGL_COMPOSITOR() : m_mainFbo( 0 ), m_depthBuffer( 0 ), m_curFbo( DIRECT_RENDERING ), m_currentAntialiasingMode( OPENGL_ANTIALIASING_MODE::NONE ) { - m_antialiasing.reset( new ANTIALIASING_NONE( this ) ); + m_antialiasing = std::make_unique( this ); } @@ -77,19 +78,19 @@ void OPENGL_COMPOSITOR::Initialize() switch( m_currentAntialiasingMode ) { case OPENGL_ANTIALIASING_MODE::NONE: - m_antialiasing.reset( new ANTIALIASING_NONE( this ) ); + m_antialiasing = std::make_unique( this ); break; case OPENGL_ANTIALIASING_MODE::SUBSAMPLE_HIGH: - m_antialiasing.reset( new ANTIALIASING_SMAA( this, SMAA_QUALITY::HIGH ) ); + m_antialiasing = std::make_unique( this, SMAA_QUALITY::HIGH ); break; case OPENGL_ANTIALIASING_MODE::SUBSAMPLE_ULTRA: - m_antialiasing.reset( new ANTIALIASING_SMAA( this, SMAA_QUALITY::ULTRA ) ); + m_antialiasing = std::make_unique( this, SMAA_QUALITY::ULTRA ); break; case OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X2: - m_antialiasing.reset( new ANTIALIASING_SUPERSAMPLING( this, SUPERSAMPLING_MODE::X2 ) ); + m_antialiasing = std::make_unique( this, SUPERSAMPLING_MODE::X2 ); break; case OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X4: - m_antialiasing.reset( new ANTIALIASING_SUPERSAMPLING( this, SUPERSAMPLING_MODE::X4 ) ); + m_antialiasing = std::make_unique( this, SUPERSAMPLING_MODE::X4 ); break; } diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index 3d8ed913eb..fba5d930bc 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -41,8 +41,9 @@ #include #endif /* __WXDEBUG__ */ -#include #include +#include +#include using namespace std::placeholders; using namespace KIGFX; @@ -226,7 +227,7 @@ OPENGL_GAL::OPENGL_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent, shader = new SHADER(); ++instanceCounter; - bitmapCache.reset( new GL_BITMAP_CACHE ); + bitmapCache = std::make_unique( ); compositor = new OPENGL_COMPOSITOR; compositor->SetAntialiasingMode( options.gl_antialiasing_mode ); @@ -1526,7 +1527,7 @@ void OPENGL_GAL::DeleteGroup( int aGroupNumber ) void OPENGL_GAL::ClearCache() { - bitmapCache.reset( new GL_BITMAP_CACHE ); + bitmapCache = std::make_unique( ); groups.clear(); diff --git a/gerbview/gerbview_draw_panel_gal.cpp b/gerbview/gerbview_draw_panel_gal.cpp index 450343c0d0..aef6f24f9b 100644 --- a/gerbview/gerbview_draw_panel_gal.cpp +++ b/gerbview/gerbview_draw_panel_gal.cpp @@ -32,6 +32,7 @@ #include #include +#include using namespace std::placeholders; @@ -44,7 +45,7 @@ EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aOptions, aGalTy m_view->SetGAL( m_gal ); 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( m_gal ); m_view->SetPainter( m_painter.get() ); m_viewControls = new KIGFX::WX_VIEW_CONTROLS( m_view, this ); diff --git a/include/lib_table_base.h b/include/lib_table_base.h index 80d18668f2..96c3941482 100644 --- a/include/lib_table_base.h +++ b/include/lib_table_base.h @@ -28,8 +28,9 @@ #include -#include #include +#include +#include #include #include @@ -189,7 +190,7 @@ protected: enabled( aRow.enabled ) { if( aRow.properties ) - properties.reset( new PROPERTIES( *aRow.properties.get() ) ); + properties = std::make_unique( *aRow.properties.get() ); else properties.reset(); } diff --git a/pagelayout_editor/pl_draw_panel_gal.cpp b/pagelayout_editor/pl_draw_panel_gal.cpp index f7d04dbbf5..13acc1eddb 100644 --- a/pagelayout_editor/pl_draw_panel_gal.cpp +++ b/pagelayout_editor/pl_draw_panel_gal.cpp @@ -30,6 +30,7 @@ #include #include +#include #include 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 */ ); - m_painter.reset( new KIGFX::WS_PAINTER( m_gal ) ); + m_painter = std::make_unique( m_gal ); m_view->SetPainter( m_painter.get() ); m_view->SetScaleLimits( 20.0, 0.05 ); // This fixes the zoom in and zoom out limits diff --git a/pcbnew/autorouter/ar_autoplacer.cpp b/pcbnew/autorouter/ar_autoplacer.cpp index 530dbba80e..9680a313af 100644 --- a/pcbnew/autorouter/ar_autoplacer.cpp +++ b/pcbnew/autorouter/ar_autoplacer.cpp @@ -41,9 +41,11 @@ #include #include #include -#include "ar_matrix.h" -#include "ar_cell.h" + #include "ar_autoplacer.h" +#include "ar_cell.h" +#include "ar_matrix.h" +#include #define AR_GAIN 16 #define AR_KEEPOUT_MARGIN 500 @@ -73,7 +75,7 @@ static const double OrientationPenalty[11] = AR_AUTOPLACER::AR_AUTOPLACER( BOARD* aBoard ) { m_board = aBoard; - m_connectivity.reset( new CONNECTIVITY_DATA ); + m_connectivity = std::make_unique( ); for( auto mod : m_board->Modules() ) m_connectivity->Add( mod ); diff --git a/pcbnew/connectivity/connectivity_items.h b/pcbnew/connectivity/connectivity_items.h index 3bc1d1134a..a59a3c010f 100644 --- a/pcbnew/connectivity/connectivity_items.h +++ b/pcbnew/connectivity/connectivity_items.h @@ -352,7 +352,7 @@ public: outline.SetClosed( true ); outline.Simplify(); - m_cachedPoly.reset( new POLY_GRID_PARTITION( outline, 16 ) ); + m_cachedPoly = std::make_unique( outline, 16 ); } int SubpolyIndex() const diff --git a/pcbnew/import_gfx/dialog_import_gfx.cpp b/pcbnew/import_gfx/dialog_import_gfx.cpp index 36a8d9533d..8607a4770b 100644 --- a/pcbnew/import_gfx/dialog_import_gfx.cpp +++ b/pcbnew/import_gfx/dialog_import_gfx.cpp @@ -32,6 +32,8 @@ #include #include +#include + // Configuration path (group) to store entry keys below. #define IMPORT_GFX_GROUP "ImportGraphics" @@ -61,9 +63,9 @@ DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX( PCB_BASE_FRAME* aParent, bool aImportAsFoo m_parent = aParent; if( aImportAsFootprintGraphic ) - m_importer.reset( new GRAPHICS_IMPORTER_MODULE( m_parent->GetBoard()->GetFirstModule() ) ); + m_importer = std::make_unique( m_parent->GetBoard()->GetFirstModule() ); else - m_importer.reset( new GRAPHICS_IMPORTER_BOARD( m_parent->GetBoard() ) ); + m_importer = std::make_unique( m_parent->GetBoard() ); // construct an import manager with options from config { diff --git a/pcbnew/import_gfx/graphics_importer_pcbnew.cpp b/pcbnew/import_gfx/graphics_importer_pcbnew.cpp index 7cc8f1ea4a..199b333b14 100644 --- a/pcbnew/import_gfx/graphics_importer_pcbnew.cpp +++ b/pcbnew/import_gfx/graphics_importer_pcbnew.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include "convert_to_biu.h" @@ -175,7 +176,7 @@ void GRAPHICS_IMPORTER_PCBNEW::AddSpline( const VECTOR2D& aStart, const VECTOR2D unique_ptr GRAPHICS_IMPORTER_BOARD::createDrawing() { - return unique_ptr( new DRAWSEGMENT( m_board ) ); + return std::make_unique( m_board ); } diff --git a/pcbnew/pcb_draw_panel_gal.cpp b/pcbnew/pcb_draw_panel_gal.cpp index 503caa0cea..94514532b4 100644 --- a/pcbnew/pcb_draw_panel_gal.cpp +++ b/pcbnew/pcb_draw_panel_gal.cpp @@ -42,6 +42,7 @@ #include #include +#include #include 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->SetGAL( m_gal ); - m_painter.reset( new KIGFX::PCB_PAINTER( m_gal ) ); + m_painter = std::make_unique( m_gal ); m_view->SetPainter( m_painter.get() ); setDefaultLayerOrder(); @@ -190,7 +191,7 @@ void PCB_DRAW_PANEL_GAL::DisplayBoard( BOARD* aBoard ) m_view->Add( zone ); // Ratsnest - m_ratsnest.reset( new KIGFX::RATSNEST_VIEWITEM( aBoard->GetConnectivity() ) ); + m_ratsnest = std::make_unique( aBoard->GetConnectivity() ); m_view->Add( m_ratsnest.get() ); } diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index 0d4566c013..23d8f1295f 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -46,6 +46,8 @@ #include #include +#include + #include "tools/pcb_tool_base.h" #include "pns_kicad_iface.h" @@ -1332,7 +1334,7 @@ void PNS_KICAD_IFACE::Commit() { EraseView(); m_commit->Push( _( "Added a track" ) ); - m_commit.reset( new BOARD_COMMIT( m_tool ) ); + m_commit = std::make_unique( m_tool ); } @@ -1378,7 +1380,7 @@ void PNS_KICAD_IFACE::SetRouter( PNS::ROUTER* aRouter ) void PNS_KICAD_IFACE::SetHostTool( PCB_TOOL_BASE* aTool ) { m_tool = aTool; - m_commit.reset( new BOARD_COMMIT( m_tool ) ); + m_commit = std::make_unique( m_tool ); } void PNS_KICAD_IFACE::SetDisplayOptions( const PCB_DISPLAY_OPTIONS* aDispOptions ) diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp index 85e6a5d7c7..9e2a1fd057 100644 --- a/pcbnew/router/pns_line_placer.cpp +++ b/pcbnew/router/pns_line_placer.cpp @@ -32,6 +32,8 @@ #include +#include + namespace PNS { LINE_PLACER::LINE_PLACER( ROUTER* aRouter ) : @@ -947,7 +949,7 @@ void LINE_PLACER::initPlacement() if( m_currentMode == RM_Shove || m_currentMode == RM_Smart ) { - m_shove.reset( new SHOVE( m_world->Branch(), Router() ) ); + m_shove = std::make_unique( m_world->Branch(), Router() ); } } diff --git a/pcbnew/router/pns_router.cpp b/pcbnew/router/pns_router.cpp index bbfc3bb432..2900691123 100644 --- a/pcbnew/router/pns_router.cpp +++ b/pcbnew/router/pns_router.cpp @@ -20,6 +20,7 @@ */ #include +#include #include #include @@ -90,7 +91,7 @@ void ROUTER::SyncWorld() { ClearWorld(); - m_world = std::unique_ptr( new NODE ); + m_world = std::make_unique( ); 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 ) ) return false; - m_placer.reset( new LINE_PLACER( this ) ); + m_placer = std::make_unique( this ); m_placer->Start( aP, aStartItem ); - m_dragger.reset( new DRAGGER( this ) ); + m_dragger = std::make_unique( this ); m_dragger->SetMode( aDragMode ); m_dragger->SetWorld( m_world.get() ); m_dragger->SetDebugDecorator ( m_iface->GetDebugDecorator () ); @@ -185,19 +186,19 @@ bool ROUTER::StartRouting( const VECTOR2I& aP, ITEM* aStartItem, int aLayer ) switch( m_mode ) { case PNS_MODE_ROUTE_SINGLE: - m_placer.reset( new LINE_PLACER( this ) ); + m_placer = std::make_unique( this ); break; case PNS_MODE_ROUTE_DIFF_PAIR: - m_placer.reset( new DIFF_PAIR_PLACER( this ) ); + m_placer = std::make_unique( this ); break; case PNS_MODE_TUNE_SINGLE: - m_placer.reset( new MEANDER_PLACER( this ) ); + m_placer = std::make_unique( this ); break; case PNS_MODE_TUNE_DIFF_PAIR: - m_placer.reset( new DP_MEANDER_PLACER( this ) ); + m_placer = std::make_unique( this ); break; case PNS_MODE_TUNE_DIFF_PAIR_SKEW: - m_placer.reset( new MEANDER_SKEW_PLACER( this ) ); + m_placer = std::make_unique( this ); break; default: diff --git a/pcbnew/tools/global_edit_tool.cpp b/pcbnew/tools/global_edit_tool.cpp index 655b2e78fb..6bec3874c5 100644 --- a/pcbnew/tools/global_edit_tool.cpp +++ b/pcbnew/tools/global_edit_tool.cpp @@ -33,6 +33,8 @@ #include #include +#include + GLOBAL_EDIT_TOOL::GLOBAL_EDIT_TOOL() : PCB_TOOL_BASE( "pcbnew.GlobalEdit" ) @@ -43,7 +45,7 @@ GLOBAL_EDIT_TOOL::GLOBAL_EDIT_TOOL() : void GLOBAL_EDIT_TOOL::Reset( RESET_REASON aReason ) { if( aReason != RUN ) - m_commit.reset( new BOARD_COMMIT( this ) ); + m_commit = std::make_unique( this ); } diff --git a/pcbnew/tools/pcb_editor_control.cpp b/pcbnew/tools/pcb_editor_control.cpp index a6968e0b7e..a346bfaec0 100644 --- a/pcbnew/tools/pcb_editor_control.cpp +++ b/pcbnew/tools/pcb_editor_control.cpp @@ -22,35 +22,36 @@ * or you may write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include #include "pcb_editor_control.h" -#include "pcb_actions.h" -#include -#include -#include -#include "selection_tool.h" #include "drawing_tool.h" +#include "pcb_actions.h" #include "pcbnew_picker_tool.h" -#include -#include -#include -#include +#include "selection_tool.h" +#include +#include #include -#include #include #include +#include #include -#include -#include -#include -#include -#include +#include #include -#include #include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include using namespace std::placeholders; @@ -140,8 +141,8 @@ PCB_EDITOR_CONTROL::PCB_EDITOR_CONTROL() : PCB_TOOL_BASE( "pcbnew.EditorControl" ), m_frame( nullptr ) { - m_placeOrigin.reset( new KIGFX::ORIGIN_VIEWITEM( KIGFX::COLOR4D( 0.8, 0.0, 0.0, 1.0 ), - KIGFX::ORIGIN_VIEWITEM::CIRCLE_CROSS ) ); + m_placeOrigin = std::make_unique( KIGFX::COLOR4D( 0.8, 0.0, 0.0, 1.0 ), + KIGFX::ORIGIN_VIEWITEM::CIRCLE_CROSS ); } diff --git a/pcbnew/tools/point_editor.cpp b/pcbnew/tools/point_editor.cpp index 9f3af52140..1a66ad9f00 100644 --- a/pcbnew/tools/point_editor.cpp +++ b/pcbnew/tools/point_editor.cpp @@ -23,6 +23,7 @@ */ #include +#include using namespace std::placeholders; #include #include @@ -240,7 +241,7 @@ void POINT_EDITOR::Reset( RESET_REASON aReason ) m_altConstraint.reset(); getViewControls()->SetAutoPan( false ); - m_statusPopup.reset( new STATUS_TEXT_POPUP( getEditFrame() ) ); + m_statusPopup = std::make_unique( getEditFrame() ); m_statusPopup->SetTextColor( wxColour( 255, 0, 0 ) ); m_statusPopup->SetText( _( "Self-intersecting polygons are not allowed." ) ); } diff --git a/pcbnew/tools/position_relative_tool.cpp b/pcbnew/tools/position_relative_tool.cpp index e019d210ef..2d84ed0216 100644 --- a/pcbnew/tools/position_relative_tool.cpp +++ b/pcbnew/tools/position_relative_tool.cpp @@ -22,6 +22,7 @@ */ #include +#include using namespace std::placeholders; #include "position_relative_tool.h" @@ -48,7 +49,7 @@ POSITION_RELATIVE_TOOL::POSITION_RELATIVE_TOOL() : void POSITION_RELATIVE_TOOL::Reset( RESET_REASON aReason ) { if( aReason != RUN ) - m_commit.reset( new BOARD_COMMIT( this ) ); + m_commit = std::make_unique( this ); } diff --git a/qa/qa_utils/pcb_test_frame.cpp b/qa/qa_utils/pcb_test_frame.cpp index 02fa0128d0..385585f11f 100644 --- a/qa/qa_utils/pcb_test_frame.cpp +++ b/qa/qa_utils/pcb_test_frame.cpp @@ -49,6 +49,7 @@ #include #include +#include #include #include @@ -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; - m_galPanel.reset( new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, - 0 ), wxDefaultSize, options, aGalType ) ); + m_galPanel = std::make_unique( this, -1, wxPoint( 0, + 0 ), wxDefaultSize, options, aGalType ); m_galPanel->SetEvtHandlerEnabled( true ); 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 ); #ifdef USE_TOOL_MANAGER - m_toolManager.reset( new TOOL_MANAGER ); + m_toolManager = std::make_unique( ); m_toolManager->SetEnvironment( m_board.get(), m_galPanel->GetView(), m_galPanel->GetViewControls(), nullptr ); - m_pcbActions.reset( new TEST_ACTIONS() ); - m_toolDispatcher.reset( new TOOL_DISPATCHER( m_toolManager.get(), m_pcbActions.get() ) ); + m_pcbActions = std::make_unique( ); + m_toolDispatcher = std::make_unique( m_toolManager.get(), m_pcbActions.get() ); m_toolManager->RegisterTool( new SELECTION_TOOL );