From 955ce1d8047673f3a17aa06f5f0f0f1563cf19b5 Mon Sep 17 00:00:00 2001 From: Alexander Valavanis Date: Tue, 22 Jan 2019 00:58:29 +0000 Subject: NodeToolbar: Fix initialisation --- src/ui/toolbar/eraser-toolbar.cpp | 7 +------ src/ui/toolbar/eraser-toolbar.h | 4 +--- src/ui/toolbar/mesh-toolbar.cpp | 14 +++----------- src/ui/toolbar/mesh-toolbar.h | 8 +++----- src/ui/toolbar/spray-toolbar.cpp | 10 ++-------- src/ui/toolbar/spray-toolbar.h | 6 ++---- 6 files changed, 12 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/ui/toolbar/eraser-toolbar.cpp b/src/ui/toolbar/eraser-toolbar.cpp index 496623d1e..f5631f362 100644 --- a/src/ui/toolbar/eraser-toolbar.cpp +++ b/src/ui/toolbar/eraser-toolbar.cpp @@ -52,11 +52,6 @@ using Inkscape::UI::PrefPusher; namespace Inkscape { namespace UI { namespace Toolbar { -EraserToolbar::~EraserToolbar() -{ - if(_pressure_pusher) delete _pressure_pusher; -} - GtkWidget * EraserToolbar::prep(SPDesktop *desktop, GtkActionGroup* mainActions) { @@ -136,7 +131,7 @@ EraserToolbar::prep(SPDesktop *desktop, GtkActionGroup* mainActions) INKSCAPE_ICON("draw-use-pressure"), GTK_ICON_SIZE_MENU ); gtk_action_group_add_action( mainActions, GTK_ACTION( toolbar->_usepressure ) ); - toolbar->_pressure_pusher = new PrefPusher(GTK_TOGGLE_ACTION(toolbar->_usepressure), "/tools/eraser/usepressure", update_presets_list, (gpointer)toolbar); + toolbar->_pressure_pusher.reset(new PrefPusher(GTK_TOGGLE_ACTION(toolbar->_usepressure), "/tools/eraser/usepressure", update_presets_list, (gpointer)toolbar)); } diff --git a/src/ui/toolbar/eraser-toolbar.h b/src/ui/toolbar/eraser-toolbar.h index 2addf0dd1..de083830b 100644 --- a/src/ui/toolbar/eraser-toolbar.h +++ b/src/ui/toolbar/eraser-toolbar.h @@ -62,7 +62,7 @@ private: Glib::RefPtr _cap_rounding_adj; Glib::RefPtr _tremor_adj; - PrefPusher *_pressure_pusher; + std::unique_ptr _pressure_pusher; bool _freeze; @@ -83,8 +83,6 @@ protected: _freeze(false) {} - ~EraserToolbar() override; - public: static GtkWidget * prep(SPDesktop *desktop, GtkActionGroup* mainActions); }; diff --git a/src/ui/toolbar/mesh-toolbar.cpp b/src/ui/toolbar/mesh-toolbar.cpp index 846582907..045d7c11a 100644 --- a/src/ui/toolbar/mesh-toolbar.cpp +++ b/src/ui/toolbar/mesh-toolbar.cpp @@ -191,14 +191,6 @@ static void mesh_toolbox_watch_ec(SPDesktop* dt, Inkscape::UI::Tools::ToolBase* namespace Inkscape { namespace UI { namespace Toolbar { - -MeshToolbar::~MeshToolbar() -{ - if(_edit_fill_pusher) delete _edit_fill_pusher; - if(_edit_stroke_pusher) delete _edit_stroke_pusher; - if(_show_handles_pusher) delete _show_handles_pusher; -} - /** * Mesh auxiliary toolbar construction and setup. * Don't forget to add to XML in widgets/toolbox.cpp! @@ -335,7 +327,7 @@ MeshToolbar::prep(SPDesktop * desktop, GtkActionGroup* mainActions) INKSCAPE_ICON("object-fill"), secondarySize ); gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); - toolbar->_edit_fill_pusher = new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/mesh/edit_fill"); + toolbar->_edit_fill_pusher.reset(new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/mesh/edit_fill")); g_signal_connect_after( G_OBJECT(act), "activate", G_CALLBACK(toggle_fill_stroke), (gpointer)toolbar); } @@ -347,7 +339,7 @@ MeshToolbar::prep(SPDesktop * desktop, GtkActionGroup* mainActions) INKSCAPE_ICON("object-stroke"), secondarySize ); gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); - toolbar->_edit_stroke_pusher = new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/mesh/edit_stroke"); + toolbar->_edit_stroke_pusher.reset(new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/mesh/edit_stroke")); g_signal_connect_after( G_OBJECT(act), "activate", G_CALLBACK(toggle_fill_stroke), (gpointer)toolbar); } @@ -359,7 +351,7 @@ MeshToolbar::prep(SPDesktop * desktop, GtkActionGroup* mainActions) INKSCAPE_ICON("show-node-handles"), secondarySize ); gtk_action_group_add_action( mainActions, GTK_ACTION( act ) ); - toolbar->_show_handles_pusher = new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/mesh/show_handles"); + toolbar->_show_handles_pusher.reset(new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/mesh/show_handles")); g_signal_connect_after( G_OBJECT(act), "activate", G_CALLBACK(toggle_handles), nullptr); } diff --git a/src/ui/toolbar/mesh-toolbar.h b/src/ui/toolbar/mesh-toolbar.h index 534720b56..76d031f25 100644 --- a/src/ui/toolbar/mesh-toolbar.h +++ b/src/ui/toolbar/mesh-toolbar.h @@ -46,9 +46,9 @@ private: Glib::RefPtr _row_adj; Glib::RefPtr _col_adj; - UI::PrefPusher *_edit_fill_pusher; - UI::PrefPusher *_edit_stroke_pusher; - UI::PrefPusher *_show_handles_pusher; + std::unique_ptr _edit_fill_pusher; + std::unique_ptr _edit_stroke_pusher; + std::unique_ptr _show_handles_pusher; sigc::connection c_selection_changed; sigc::connection c_selection_modified; @@ -77,8 +77,6 @@ protected: _edit_fill_pusher(nullptr) {} - ~MeshToolbar() override; - public: static GtkWidget * prep(SPDesktop *desktop, GtkActionGroup* mainActions); }; diff --git a/src/ui/toolbar/spray-toolbar.cpp b/src/ui/toolbar/spray-toolbar.cpp index 3656aae26..f38aee05e 100644 --- a/src/ui/toolbar/spray-toolbar.cpp +++ b/src/ui/toolbar/spray-toolbar.cpp @@ -72,12 +72,6 @@ Inkscape::UI::Dialog::CloneTiler *get_clone_tiler_panel(SPDesktop *desktop) namespace Inkscape { namespace UI { namespace Toolbar { -SprayToolbar::~SprayToolbar() -{ - delete _usepressurewidth_pusher; - delete _usepressurepopulation_pusher; -} - GtkWidget * SprayToolbar::prep(SPDesktop *desktop, GtkActionGroup* mainActions) { @@ -112,7 +106,7 @@ SprayToolbar::prep(SPDesktop *desktop, GtkActionGroup* mainActions) INKSCAPE_ICON("draw-use-pressure"), GTK_ICON_SIZE_MENU ); gtk_action_group_add_action( mainActions, GTK_ACTION(act) ); - holder->_usepressurewidth_pusher = new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/spray/usepressurewidth"); + holder->_usepressurewidth_pusher.reset(new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/spray/usepressurewidth")); } { @@ -229,7 +223,7 @@ SprayToolbar::prep(SPDesktop *desktop, GtkActionGroup* mainActions) INKSCAPE_ICON("draw-use-pressure"), GTK_ICON_SIZE_MENU ); gtk_action_group_add_action( mainActions, GTK_ACTION(act) ); - holder->_usepressurepopulation_pusher = new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/spray/usepressurepopulation"); + holder->_usepressurepopulation_pusher.reset(new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/spray/usepressurepopulation")); } { /* Rotation */ diff --git a/src/ui/toolbar/spray-toolbar.h b/src/ui/toolbar/spray-toolbar.h index 7c4bee695..5f0065680 100644 --- a/src/ui/toolbar/spray-toolbar.h +++ b/src/ui/toolbar/spray-toolbar.h @@ -54,8 +54,8 @@ private: Glib::RefPtr _offset_adj; Glib::RefPtr _scale_adj; - PrefPusher *_usepressurewidth_pusher; - PrefPusher *_usepressurepopulation_pusher; + std::unique_ptr _usepressurewidth_pusher; + std::unique_ptr _usepressurepopulation_pusher; InkSelectOneAction *_spray_tool_mode; EgeAdjustmentAction *_spray_population; @@ -109,8 +109,6 @@ protected: Toolbar(desktop) {} - ~SprayToolbar() override; - public: static GtkWidget * prep(SPDesktop *desktop, GtkActionGroup* mainActions); }; -- cgit v1.2.3