summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexander Valavanis <valavanisalex@gmail.com>2019-02-05 13:26:44 +0000
committerAlexander Valavanis <valavanisalex@gmail.com>2019-02-05 13:26:44 +0000
commitecb291432621a803830a362a1508a057706321db (patch)
tree531377a903b053827b4874fa2d832a6d26723efa /src
parentNodeToolbar: GtkAction migration (diff)
downloadinkscape-ecb291432621a803830a362a1508a057706321db.tar.gz
inkscape-ecb291432621a803830a362a1508a057706321db.zip
PencilToolbar: GtkAction migration
Diffstat (limited to 'src')
-rw-r--r--src/display/curve.h9
-rw-r--r--src/live_effects/effect.h5
-rw-r--r--src/live_effects/lpe-bspline.h6
-rw-r--r--src/live_effects/lpe-powerstroke.h5
-rw-r--r--src/live_effects/lpe-simplify.h6
-rw-r--r--src/live_effects/lpe-spiro.h6
-rw-r--r--src/live_effects/parameter/bool.h5
-rw-r--r--src/live_effects/parameter/enum.h5
-rw-r--r--src/live_effects/parameter/parameter.h13
-rw-r--r--src/live_effects/parameter/powerstrokepointarray.h6
-rw-r--r--src/live_effects/parameter/togglebutton.h5
-rw-r--r--src/ui/selected-color.h9
-rw-r--r--src/ui/toolbar/pencil-toolbar.cpp509
-rw-r--r--src/ui/toolbar/pencil-toolbar.h60
-rw-r--r--src/widgets/toolbox.cpp6
15 files changed, 281 insertions, 374 deletions
diff --git a/src/display/curve.h b/src/display/curve.h
index e9c58e610..c6ddb4cb8 100644
--- a/src/display/curve.h
+++ b/src/display/curve.h
@@ -32,6 +32,10 @@ public:
virtual ~SPCurve();
+ // Don't implement these:
+ SPCurve(const SPCurve&) = delete;
+ SPCurve& operator=(const SPCurve&) = delete;
+
void set_pathvector(Geom::PathVector const & new_pathv);
Geom::PathVector const & get_pathvector() const;
@@ -86,11 +90,6 @@ protected:
size_t _refcount;
Geom::PathVector _pathv;
-
-private:
- // Don't implement these:
- SPCurve(const SPCurve&) = delete;
- SPCurve& operator=(const SPCurve&) = delete;
};
#endif // !SEEN_DISPLAY_CURVE_H
diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h
index d21240b72..57d6b4425 100644
--- a/src/live_effects/effect.h
+++ b/src/live_effects/effect.h
@@ -59,6 +59,8 @@ public:
static void createAndApply(EffectType type, SPDocument *doc, SPItem *item);
virtual ~Effect();
+ Effect(const Effect&) = delete;
+ Effect& operator=(const Effect&) = delete;
EffectType effectType() const;
@@ -187,9 +189,6 @@ private:
bool is_ready;
bool defaultsopen;
-
- Effect(const Effect&) = delete;
- Effect& operator=(const Effect&) = delete;
};
} //namespace LivePathEffect
diff --git a/src/live_effects/lpe-bspline.h b/src/live_effects/lpe-bspline.h
index 7aebb0826..9d0850fdc 100644
--- a/src/live_effects/lpe-bspline.h
+++ b/src/live_effects/lpe-bspline.h
@@ -18,6 +18,8 @@ class LPEBSpline : public Effect {
public:
LPEBSpline(LivePathEffectObject *lpeobject);
~LPEBSpline() override;
+ LPEBSpline(const LPEBSpline &) = delete;
+ LPEBSpline &operator=(const LPEBSpline &) = delete;
LPEPathFlashType pathFlashType() const override
{
@@ -43,10 +45,6 @@ private:
BoolParam apply_with_weight;
BoolParam only_selected;
ScalarParam weight;
-
- LPEBSpline(const LPEBSpline &) = delete;
- LPEBSpline &operator=(const LPEBSpline &) = delete;
-
};
void sp_bspline_do_effect(SPCurve *curve, double helper_size);
diff --git a/src/live_effects/lpe-powerstroke.h b/src/live_effects/lpe-powerstroke.h
index 21b024581..96ee2a192 100644
--- a/src/live_effects/lpe-powerstroke.h
+++ b/src/live_effects/lpe-powerstroke.h
@@ -25,7 +25,8 @@ class LPEPowerStroke : public Effect {
public:
LPEPowerStroke(LivePathEffectObject *lpeobject);
~LPEPowerStroke() override;
-
+ LPEPowerStroke(const LPEPowerStroke&) = delete;
+ LPEPowerStroke& operator=(const LPEPowerStroke&) = delete;
Geom::PathVector doEffect_path (Geom::PathVector const & path_in) override;
void doBeforeEffect(SPLPEItem const *lpeItem) override;
@@ -46,8 +47,6 @@ private:
EnumParam<unsigned> linejoin_type;
ScalarParam miter_limit;
EnumParam<unsigned> end_linecap_type;
- LPEPowerStroke(const LPEPowerStroke&) = delete;
- LPEPowerStroke& operator=(const LPEPowerStroke&) = delete;
};
} //namespace LivePathEffect
diff --git a/src/live_effects/lpe-simplify.h b/src/live_effects/lpe-simplify.h
index 2477e97cf..a04fff76c 100644
--- a/src/live_effects/lpe-simplify.h
+++ b/src/live_effects/lpe-simplify.h
@@ -19,6 +19,8 @@ class LPESimplify : public Effect , GroupBBoxEffect {
public:
LPESimplify(LivePathEffectObject *lpeobject);
~LPESimplify() override;
+ LPESimplify(const LPESimplify &) = delete;
+ LPESimplify &operator=(const LPESimplify &) = delete;
void doEffect(SPCurve *curve) override;
@@ -48,10 +50,6 @@ private:
double radius_helper_nodes;
Geom::PathVector hp;
Geom::OptRect bbox;
-
- LPESimplify(const LPESimplify &) = delete;
- LPESimplify &operator=(const LPESimplify &) = delete;
-
};
}; //namespace LivePathEffect
diff --git a/src/live_effects/lpe-spiro.h b/src/live_effects/lpe-spiro.h
index 9b1ae76c3..ce07de854 100644
--- a/src/live_effects/lpe-spiro.h
+++ b/src/live_effects/lpe-spiro.h
@@ -18,14 +18,12 @@ class LPESpiro : public Effect {
public:
LPESpiro(LivePathEffectObject *lpeobject);
~LPESpiro() override;
+ LPESpiro(const LPESpiro&) = delete;
+ LPESpiro& operator=(const LPESpiro&) = delete;
LPEPathFlashType pathFlashType() const override { return SUPPRESS_FLASH; }
void doEffect(SPCurve * curve) override;
-
-private:
- LPESpiro(const LPESpiro&) = delete;
- LPESpiro& operator=(const LPESpiro&) = delete;
};
void sp_spiro_do_effect(SPCurve *curve);
diff --git a/src/live_effects/parameter/bool.h b/src/live_effects/parameter/bool.h
index 557511979..c66626cbd 100644
--- a/src/live_effects/parameter/bool.h
+++ b/src/live_effects/parameter/bool.h
@@ -28,6 +28,8 @@ public:
Effect* effect,
bool default_value = false);
~BoolParam() override;
+ BoolParam(const BoolParam&) = delete;
+ BoolParam& operator=(const BoolParam&) = delete;
Gtk::Widget * param_newWidget() override;
@@ -43,9 +45,6 @@ public:
inline operator bool() const { return value; };
private:
- BoolParam(const BoolParam&) = delete;
- BoolParam& operator=(const BoolParam&) = delete;
-
bool value;
bool defvalue;
};
diff --git a/src/live_effects/parameter/enum.h b/src/live_effects/parameter/enum.h
index dcf42f258..b7964d988 100644
--- a/src/live_effects/parameter/enum.h
+++ b/src/live_effects/parameter/enum.h
@@ -39,6 +39,8 @@ public:
};
~EnumParam() override = default;;
+ EnumParam(const EnumParam&) = delete;
+ EnumParam& operator=(const EnumParam&) = delete;
Gtk::Widget * param_newWidget() override {
Inkscape::UI::Widget::RegisteredEnum<E> *regenum = Gtk::manage (
@@ -98,9 +100,6 @@ public:
}
private:
- EnumParam(const EnumParam&) = delete;
- EnumParam& operator=(const EnumParam&) = delete;
-
E value;
E defvalue;
bool sorted;
diff --git a/src/live_effects/parameter/parameter.h b/src/live_effects/parameter/parameter.h
index 82250f652..4ef31427e 100644
--- a/src/live_effects/parameter/parameter.h
+++ b/src/live_effects/parameter/parameter.h
@@ -56,6 +56,9 @@ public:
Effect* effect);
virtual ~Parameter() = default;;
+ Parameter(const Parameter&) = delete;
+ Parameter& operator=(const Parameter&) = delete;
+
virtual bool param_readSVGValue(const gchar * strvalue) = 0; // returns true if new value is valid / accepted.
virtual gchar * param_getSVGValue() const = 0;
virtual gchar * param_getDefaultSVGValue() const = 0;
@@ -92,10 +95,6 @@ protected:
Effect* param_effect;
void param_write_to_repr(const char * svgd);
-
-private:
- Parameter(const Parameter&) = delete;
- Parameter& operator=(const Parameter&) = delete;
};
@@ -108,6 +107,8 @@ public:
Effect* effect,
gdouble default_value = 1.0);
~ScalarParam() override;
+ ScalarParam(const ScalarParam&) = delete;
+ ScalarParam& operator=(const ScalarParam&) = delete;
bool param_readSVGValue(const gchar * strvalue) override;
gchar * param_getSVGValue() const override;
@@ -140,10 +141,6 @@ protected:
double inc_page;
bool add_slider;
bool _set_undo;
-
-private:
- ScalarParam(const ScalarParam&) = delete;
- ScalarParam& operator=(const ScalarParam&) = delete;
};
} //namespace LivePathEffect
diff --git a/src/live_effects/parameter/powerstrokepointarray.h b/src/live_effects/parameter/powerstrokepointarray.h
index 51c94ae7a..bb655ed96 100644
--- a/src/live_effects/parameter/powerstrokepointarray.h
+++ b/src/live_effects/parameter/powerstrokepointarray.h
@@ -30,6 +30,9 @@ public:
Effect* effect);
~PowerStrokePointArrayParam() override;
+ PowerStrokePointArrayParam(const PowerStrokePointArrayParam&) = delete;
+ PowerStrokePointArrayParam& operator=(const PowerStrokePointArrayParam&) = delete;
+
Gtk::Widget * param_newWidget() override;
void param_transform_multiply(Geom::Affine const& postmul, bool /*set*/) override;
@@ -54,9 +57,6 @@ public:
friend class PowerStrokePointArrayParamKnotHolderEntity;
private:
- PowerStrokePointArrayParam(const PowerStrokePointArrayParam&) = delete;
- PowerStrokePointArrayParam& operator=(const PowerStrokePointArrayParam&) = delete;
-
SPKnotShapeType knot_shape;
SPKnotModeType knot_mode;
guint32 knot_color;
diff --git a/src/live_effects/parameter/togglebutton.h b/src/live_effects/parameter/togglebutton.h
index 3cae69f1d..d1845de5b 100644
--- a/src/live_effects/parameter/togglebutton.h
+++ b/src/live_effects/parameter/togglebutton.h
@@ -36,6 +36,8 @@ public:
char const * icon_inactive = nullptr,
GtkIconSize icon_size = GTK_ICON_SIZE_SMALL_TOOLBAR);
~ToggleButtonParam() override;
+ ToggleButtonParam(const ToggleButtonParam&) = delete;
+ ToggleButtonParam& operator=(const ToggleButtonParam&) = delete;
Gtk::Widget * param_newWidget() override;
@@ -56,9 +58,6 @@ public:
void param_update_default(const gchar * default_value) override;
private:
- ToggleButtonParam(const ToggleButtonParam&) = delete;
- ToggleButtonParam& operator=(const ToggleButtonParam&) = delete;
-
void refresh_button();
bool value;
bool defvalue;
diff --git a/src/ui/selected-color.h b/src/ui/selected-color.h
index f2dae7735..6bb426b7f 100644
--- a/src/ui/selected-color.h
+++ b/src/ui/selected-color.h
@@ -30,6 +30,10 @@ public:
SelectedColor();
virtual ~SelectedColor();
+ // By default, disallow copy constructor and assignment operator
+ SelectedColor(SelectedColor const &obj) = delete;
+ SelectedColor& operator=(SelectedColor const &obj) = delete;
+
void setColor(SPColor const &color);
SPColor color() const;
@@ -50,11 +54,8 @@ public:
sigc::signal<void> signal_dragged;
sigc::signal<void> signal_released;
sigc::signal<void> signal_changed;
-private:
- // By default, disallow copy constructor and assignment operator
- SelectedColor(SelectedColor const &obj) = delete;
- SelectedColor& operator=(SelectedColor const &obj) = delete;
+private:
SPColor _color;
/**
* Color alpha value guaranteed to be in [0, 1].
diff --git a/src/ui/toolbar/pencil-toolbar.cpp b/src/ui/toolbar/pencil-toolbar.cpp
index 165977a86..32e93e64d 100644
--- a/src/ui/toolbar/pencil-toolbar.cpp
+++ b/src/ui/toolbar/pencil-toolbar.cpp
@@ -33,10 +33,6 @@
#include "desktop.h"
#include "selection.h"
-#include "widgets/ink-action.h"
-#include "widgets/ink-toggle-action.h"
-#include "widgets/toolbox.h"
-
#include "live_effects/lpe-bspline.h"
#include "live_effects/lpe-powerstroke.h"
#include "live_effects/lpe-simplify.h"
@@ -51,16 +47,15 @@
#include "ui/icon-names.h"
#include "ui/tools-switch.h"
#include "ui/tools/pen-tool.h"
+
+#include "ui/widget/label-tool-item.h"
+#include "ui/widget/spin-button-tool-item.h"
+
#include "ui/uxmanager.h"
-#include "ui/widget/ink-select-one-action.h"
-#include "widgets/ege-adjustment-action.h"
#include "widgets/spinbutton-events.h"
-
using Inkscape::UI::UXManager;
-using Inkscape::UI::ToolboxFactory;
-
/*
class PencilToleranceObserver : public Inkscape::Preferences::Observer {
@@ -95,141 +90,129 @@ private:
namespace Inkscape {
namespace UI {
namespace Toolbar {
-
-GtkWidget *
-PencilToolbar::prep_pencil(SPDesktop *desktop, GtkActionGroup* mainActions)
+PencilToolbar::PencilToolbar(SPDesktop *desktop,
+ bool pencil_mode)
+ : Toolbar(desktop),
+ _repr(nullptr),
+ _freeze(false),
+ _flatten_simplify(nullptr),
+ _simplify(nullptr)
{
- auto toolbar = new PencilToolbar(desktop);
- toolbar->add_freehand_mode_toggle(mainActions, true);
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
-
- /* min pressure */
- {
- toolbar->_minpressure = create_adjustment_action( "MinPressureAction",
- _("Min pressure"), _("Min:"), _("Min percent of pressure"),
- "/tools/freehand/pencil/minpressure", 0,
- FALSE, nullptr,
- 0, 100, 1, 0,
- nullptr, nullptr, 0,
- nullptr, 0 ,0);
-
- ege_adjustment_action_set_focuswidget(toolbar->_minpressure, GTK_WIDGET(desktop->canvas));
- toolbar->_minpressure_adj = Glib::wrap(ege_adjustment_action_get_adjustment(toolbar->_minpressure));
- toolbar->_minpressure_adj->signal_value_changed().connect(sigc::mem_fun(*toolbar, &PencilToolbar::minpressure_value_changed));
- gtk_action_group_add_action( mainActions, GTK_ACTION(toolbar->_minpressure) );
- if (prefs->getInt("/tools/freehand/pencil/freehand-mode", 0) == 3) {
- gtk_action_set_visible( GTK_ACTION(toolbar->_minpressure), true );
- } else {
- gtk_action_set_visible( GTK_ACTION(toolbar->_minpressure), false );
+ auto prefs = Inkscape::Preferences::get();
+
+ add_freehand_mode_toggle(pencil_mode);
+
+ add(* Gtk::manage(new Gtk::SeparatorToolItem()));
+
+ if (pencil_mode) {
+ /* min pressure */
+ {
+ auto minpressure_val = prefs->getDouble("/tools/freehand/pencil/minpressure", 0);
+ _minpressure_adj = Gtk::Adjustment::create(minpressure_val, 0, 100, 1, 0);
+ _minpressure = Gtk::manage(new UI::Widget::SpinButtonToolItem("pencil-minpressure", _("Min:"), _minpressure_adj, 0, 0));
+ _minpressure->set_tooltip_text(_("Min percent of pressure"));
+ _minpressure->set_focus_widget(Glib::wrap(GTK_WIDGET(desktop->canvas)));
+ _minpressure_adj->signal_value_changed().connect(sigc::mem_fun(*this, &PencilToolbar::minpressure_value_changed));
+ if (prefs->getInt("/tools/freehand/pencil/freehand-mode", 0) == 3) {
+ _minpressure->set_visible(true);
+ } else {
+ _minpressure->set_visible(false);
+ }
}
- }
- /* max pressure */
- {
- toolbar->_maxpressure = create_adjustment_action( "MaxPressureAction",
- _("Max pressure"), _("Max:"), _("Max percent of pressure"),
- "/tools/freehand/pencil/maxpressure", 100,
- FALSE, nullptr,
- 0, 100, 1, 0,
- nullptr, nullptr, 0,
- nullptr, 0 ,0);
- ege_adjustment_action_set_focuswidget(toolbar->_maxpressure, GTK_WIDGET(desktop->canvas));
- toolbar->_maxpressure_adj = Glib::wrap(ege_adjustment_action_get_adjustment(toolbar->_maxpressure));
- toolbar->_maxpressure_adj->signal_value_changed().connect(sigc::mem_fun(*toolbar, &PencilToolbar::maxpressure_value_changed));
- gtk_action_group_add_action( mainActions, GTK_ACTION(toolbar->_maxpressure) );
- if (prefs->getInt("/tools/freehand/pencil/freehand-mode", 0) == 3) {
- gtk_action_set_visible( GTK_ACTION(toolbar->_maxpressure), true );
- } else {
- gtk_action_set_visible( GTK_ACTION(toolbar->_maxpressure), false );
+ /* max pressure */
+ {
+ auto maxpressure_val = prefs->getDouble("/tools/freehand/pencil/maxpressure", 100);
+ _maxpressure_adj = Gtk::Adjustment::create(maxpressure_val, 0, 100, 1, 0);
+ _maxpressure = Gtk::manage(new UI::Widget::SpinButtonToolItem("pencil-maxpressure", _("Max:"), _maxpressure_adj, 0, 0));
+ _maxpressure->set_tooltip_text(_("Max percent of pressure"));
+ _maxpressure->set_focus_widget(Glib::wrap(GTK_WIDGET(desktop->canvas)));
+ _maxpressure_adj->signal_value_changed().connect(sigc::mem_fun(*this, &PencilToolbar::maxpressure_value_changed));
+ if (prefs->getInt("/tools/freehand/pencil/freehand-mode", 0) == 3) {
+ _maxpressure->set_visible(true);
+ } else {
+ _maxpressure->set_visible(false);
+ }
}
- }
- /* Use pressure */
- {
- InkToggleAction* itact = ink_toggle_action_new( "PencilPressureAction",
- _("Use pressure input"),
- _("Use pressure input"),
- INKSCAPE_ICON("draw-use-pressure"),
- GTK_ICON_SIZE_SMALL_TOOLBAR );
- bool pressure = prefs->getBool(toolbar->freehand_tool_name() + "/pressure", false);
- gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(itact), pressure );
- g_signal_connect_after( G_OBJECT(itact), "toggled", G_CALLBACK(PencilToolbar::use_pencil_pressure), toolbar);
- gtk_action_group_add_action( mainActions, GTK_ACTION(itact) );
- if (pressure) {
- gtk_action_set_visible( GTK_ACTION( toolbar->_minpressure ), true );
- gtk_action_set_visible( GTK_ACTION( toolbar->_maxpressure ), true );
- } else {
- gtk_action_set_visible( GTK_ACTION( toolbar->_minpressure ), false );
- gtk_action_set_visible( GTK_ACTION( toolbar->_maxpressure ), false );
+
+ /* Use pressure */
+ {
+ _pressure_item = add_toggle_button(_("Use pressure input"),
+ _("Use pressure input"));
+ _pressure_item->set_icon_name(INKSCAPE_ICON("draw-use-pressure"));
+ bool pressure = prefs->getBool(freehand_tool_name() + "/pressure", false);
+ _pressure_item->set_active(pressure);
+ _pressure_item->signal_toggled().connect(sigc::mem_fun(*this, &PencilToolbar::use_pencil_pressure));
+
+ add(*_minpressure);
+ add(*_maxpressure);
+ if (pressure) {
+ _minpressure->set_visible(true);
+ _maxpressure->set_visible(true);
+ } else {
+ _minpressure->set_visible(false);
+ _maxpressure->set_visible(false);
+ }
}
- }
- /* Tolerance */
- {
- gchar const* labels[] = {_("(many nodes, rough)"), _("(default)"), nullptr, nullptr, nullptr, nullptr, _("(few nodes, smooth)")};
- gdouble values[] = {1, 10, 20, 30, 50, 75, 100};
- EgeAdjustmentAction *eact = create_adjustment_action( "PencilToleranceAction",
- _("Smoothing:"), _("Smoothing: "),
- _("How much smoothing (simplifying) is applied to the line"),
- "/tools/freehand/pencil/tolerance",
- 3.0,
- TRUE, "altx-pencil",
- 1, 100.0, 0.5, 1.0,
- labels, values, G_N_ELEMENTS(labels),
- nullptr /*unit tracker*/,
- 1, 2);
- ege_adjustment_action_set_focuswidget(eact, GTK_WIDGET(desktop->canvas));
-
- toolbar->_tolerance_adj = Glib::wrap(ege_adjustment_action_get_adjustment(eact));
- toolbar->_tolerance_adj->signal_value_changed().connect(sigc::mem_fun(*toolbar, &PencilToolbar::tolerance_value_changed));
- ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT );
- gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
- }
- /* advanced shape options */
- toolbar->freehand_add_advanced_shape_options(mainActions, true);
+ add(* Gtk::manage(new Gtk::SeparatorToolItem()));
+
+ /* Tolerance */
+ {
+ std::vector<Glib::ustring> labels = {_("(many nodes, rough)"), _("(default)"), "", "", "", "", _("(few nodes, smooth)")};
+ std::vector<double> values = { 1, 10, 20, 30, 50, 75, 100};
+ auto tolerance_val = prefs->getDouble("/tools/freehand/pencil/tolerance", 3.0);
+ _tolerance_adj = Gtk::Adjustment::create(tolerance_val, 1, 100.0, 0.5, 1.0);
+ auto tolerance_item = Gtk::manage(new UI::Widget::SpinButtonToolItem("pencil-tolerance", _("Smoothing:"), _tolerance_adj, 1, 2));
+ tolerance_item->set_tooltip_text(_("How much smoothing (simplifying) is applied to the line"));
+ tolerance_item->set_custom_numeric_menu_data(values, labels);
+ tolerance_item->set_focus_widget(Glib::wrap(GTK_WIDGET(desktop->canvas)));
+ _tolerance_adj->signal_value_changed().connect(sigc::mem_fun(*this, &PencilToolbar::tolerance_value_changed));
+ //ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT );
+ add(*tolerance_item);
+ }
- /* Reset */
- {
- InkAction* inky = ink_action_new( "PencilResetAction",
- _("Defaults"),
- _("Reset pencil parameters to defaults (use Inkscape Preferences > Tools to change defaults)"),
- INKSCAPE_ICON("edit-clear"),
- GTK_ICON_SIZE_SMALL_TOOLBAR );
- g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(PencilToolbar::defaults), toolbar );
- gtk_action_group_add_action( mainActions, GTK_ACTION(inky) );
- }
- /* LPE simplify based tolerance */
- {
- toolbar->_simplify = ink_toggle_action_new( "PencilLpeSimplify",
- _("LPE based interactive simplify"),
- _("LPE based interactive simplify"),
- INKSCAPE_ICON("interactive_simplify"),
- GTK_ICON_SIZE_SMALL_TOOLBAR );
- gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(toolbar->_simplify), prefs->getInt("/tools/freehand/pencil/simplify", 0) );
- g_signal_connect_after( G_OBJECT(toolbar->_simplify), "toggled", G_CALLBACK(PencilToolbar::freehand_simplify_lpe), toolbar) ;
- gtk_action_group_add_action( mainActions, GTK_ACTION(toolbar->_simplify) );
- guint freehandMode = prefs->getInt("/tools/freehand/pencil/freehand-mode", 0);
- if (freehandMode == 2) {
- gtk_action_set_visible( GTK_ACTION( toolbar->_simplify ), false );
- } else {
- gtk_action_set_visible( GTK_ACTION( toolbar->_simplify ), true );
+ /* LPE simplify based tolerance */
+ {
+ _simplify = add_toggle_button(_("LPE based interactive simplify"),
+ _("LPE based interactive simplify"));
+ _simplify->set_icon_name(INKSCAPE_ICON("interactive_simplify"));
+ _simplify->set_active(prefs->getInt("/tools/freehand/pencil/simplify", 0));
+ _simplify->signal_toggled().connect(sigc::mem_fun(*this, &PencilToolbar::simplify_lpe));
+ guint freehandMode = prefs->getInt("/tools/freehand/pencil/freehand-mode", 0);
+ if (freehandMode == 2) {
+ _simplify->set_visible(false);
+ } else {
+ _simplify->set_visible(true);
+ }
}
- }
- /* LPE simplify flatten */
- {
- toolbar->_flatten_simplify = ink_action_new( "PencilLpeSimplifyFlatten",
- _("LPE simplify flatten"),
- _("LPE simplify flatten"),
- INKSCAPE_ICON("flatten"),
- GTK_ICON_SIZE_SMALL_TOOLBAR );
- g_signal_connect_after( G_OBJECT(toolbar->_flatten_simplify), "activate", G_CALLBACK(PencilToolbar::simplify_flatten), toolbar );
- gtk_action_group_add_action( mainActions, GTK_ACTION(toolbar->_flatten_simplify) );
- guint freehandMode = prefs->getInt("/tools/freehand/pencil/freehand-mode", 0);
- if (freehandMode == 2 || !prefs->getInt("/tools/freehand/pencil/simplify", 0)) {
- gtk_action_set_visible( GTK_ACTION(toolbar->_flatten_simplify), false );
- } else {
- gtk_action_set_visible( GTK_ACTION(toolbar->_flatten_simplify), true );
+ /* LPE simplify flatten */
+ {
+ _flatten_simplify = Gtk::manage(new Gtk::ToolButton(_("LPE simplify flatten")));
+ _flatten_simplify->set_tooltip_text(_("LPE simplify flatten"));
+ _flatten_simplify->set_icon_name(INKSCAPE_ICON("flatten"));
+ _flatten_simplify->signal_clicked().connect(sigc::mem_fun(*this, &PencilToolbar::simplify_flatten));
+ add(*_flatten_simplify);
+ guint freehandMode = prefs->getInt("/tools/freehand/pencil/freehand-mode", 0);
+ if (freehandMode == 2 || !prefs->getInt("/tools/freehand/pencil/simplify", 0)) {
+ _flatten_simplify->set_visible(false);
+ } else {
+ _flatten_simplify->set_visible(true);
+ }
}
+
+ add(* Gtk::manage(new Gtk::SeparatorToolItem()));
}
+ /* advanced shape options */
+ add_advanced_shape_options(pencil_mode);
+
+ show_all();
+}
+
+GtkWidget *
+PencilToolbar::create_pencil(SPDesktop *desktop)
+{
+ auto toolbar = new PencilToolbar(desktop, true);
return GTK_WIDGET(toolbar->gobj());
}
@@ -243,25 +226,25 @@ PencilToolbar::~PencilToolbar()
}
void
-PencilToolbar::freehand_mode_changed(int mode)
+PencilToolbar::mode_changed(int mode)
{
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ auto prefs = Inkscape::Preferences::get();
prefs->setInt(freehand_tool_name() + "/freehand-mode", mode);
if (mode == 1 || mode == 2) {
- gtk_action_set_visible( GTK_ACTION( _flatten_spiro_bspline ), true );
+ _flatten_spiro_bspline->set_visible(true);
} else {
- gtk_action_set_visible( GTK_ACTION( _flatten_spiro_bspline ), false );
+ _flatten_spiro_bspline->set_visible(false);
}
bool visible = (mode != 2);
if (_flatten_simplify) {
- gtk_action_set_visible(GTK_ACTION(_flatten_simplify), visible);
+ _flatten_simplify->set_visible(visible);
}
if (_simplify) {
- gtk_action_set_visible(GTK_ACTION(_simplify), visible);
+ _simplify->set_visible(visible);
}
}
@@ -275,86 +258,69 @@ PencilToolbar::freehand_tool_name()
}
void
-PencilToolbar::add_freehand_mode_toggle(GtkActionGroup* mainActions,
- bool tool_is_pencil)
+PencilToolbar::add_freehand_mode_toggle(bool tool_is_pencil)
{
- /* Freehand mode toggle buttons */
+ auto label = Gtk::manage(new UI::Widget::LabelToolItem(_("Mode:")));
+ label->set_tooltip_text(_("Mode of new lines drawn by this tool"));
+ add(*label);
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- guint freehandMode = prefs->getInt(( tool_is_pencil ?
- "/tools/freehand/pencil/freehand-mode" :
- "/tools/freehand/pen/freehand-mode" ), 0);
- GtkIconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
-
- InkSelectOneActionColumns columns;
-
- Glib::RefPtr<Gtk::ListStore> store = Gtk::ListStore::create(columns);
-
- Gtk::TreeModel::Row row;
+ /* Freehand mode toggle buttons */
+ Gtk::RadioToolButton::Group mode_group;
- row = *(store->append());
- row[columns.col_label ] = _("Bezier");
- row[columns.col_tooltip ] = _("Create regular Bezier path");
- row[columns.col_icon ] = INKSCAPE_ICON("path-mode-bezier");
- row[columns.col_sensitive] = true;
+ auto bezier_mode_btn = Gtk::manage(new Gtk::RadioToolButton(mode_group, _("Bezier")));
+ bezier_mode_btn->set_tooltip_text(_("Create regular Bezier path"));
+ bezier_mode_btn->set_icon_name(INKSCAPE_ICON("path-mode-bezier"));
+ _mode_buttons.push_back(bezier_mode_btn);
- row = *(store->append());
- row[columns.col_label ] = _("Spiro");
- row[columns.col_tooltip ] = _("Create Spiro path");
- row[columns.col_icon ] = INKSCAPE_ICON("path-mode-spiro");
- row[columns.col_sensitive] = true;
+ auto spiro_mode_btn = Gtk::manage(new Gtk::RadioToolButton(mode_group, _("Spiro")));
+ spiro_mode_btn->set_tooltip_text(_("Create Spiro path"));
+ spiro_mode_btn->set_icon_name(INKSCAPE_ICON("path-mode-spiro"));
+ _mode_buttons.push_back(spiro_mode_btn);
- row = *(store->append());
- row[columns.col_label ] = _("BSpline");
- row[columns.col_tooltip ] = _("Create BSpline path");
- row[columns.col_icon ] = INKSCAPE_ICON("path-mode-bspline");
- row[columns.col_sensitive] = true;
+ auto bspline_mode_btn = Gtk::manage(new Gtk::RadioToolButton(mode_group, _("BSpline")));
+ bspline_mode_btn->set_tooltip_text(_("Create BSpline path"));
+ bspline_mode_btn->set_icon_name(INKSCAPE_ICON("path-mode-bspline"));
+ _mode_buttons.push_back(bspline_mode_btn);
if (!tool_is_pencil) {
- row = *(store->append());
- row[columns.col_label ] = _("Zigzag");
- row[columns.col_tooltip ] = _("Create a sequence of straight line segments");
- row[columns.col_icon ] = INKSCAPE_ICON("path-mode-polyline");
- row[columns.col_sensitive] = true;
-
- row = *(store->append());
- row[columns.col_label ] = _("Paraxial");
- row[columns.col_tooltip ] = _("Create a sequence of paraxial line segments");
- row[columns.col_icon ] = INKSCAPE_ICON("path-mode-polyline-paraxial");
- row[columns.col_sensitive] = true;
+ auto zigzag_mode_btn = Gtk::manage(new Gtk::RadioToolButton(mode_group, _("Zigzag")));
+ zigzag_mode_btn->set_tooltip_text(_("Create a sequence of straight line segments"));
+ zigzag_mode_btn->set_icon_name(INKSCAPE_ICON("path-mode-polyline"));
+ _mode_buttons.push_back(zigzag_mode_btn);
+
+ auto paraxial_mode_btn = Gtk::manage(new Gtk::RadioToolButton(mode_group, _("Paraxial")));
+ paraxial_mode_btn->set_tooltip_text(_("Create a sequence of paraxial line segments"));
+ paraxial_mode_btn->set_icon_name(INKSCAPE_ICON("path-mode-polyline-paraxial"));
+ _mode_buttons.push_back(paraxial_mode_btn);
}
- InkSelectOneAction* act =
- InkSelectOneAction::create( tool_is_pencil ?
- "FreehandModeActionPencil" :
- "FreehandModeActionPen",
- _("Mode"), // Label
- _("Mode of new lines drawn by this tool"), // Tooltip
- "Not Used", // Icon
- store ); // Tree store
- act->use_radio( true );
- act->use_label( true );
- act->set_active( freehandMode );
+ int btn_idx = 0;
+ for (auto btn : _mode_buttons) {
+ btn->set_sensitive(true);
+ add(*btn);
+ btn->signal_clicked().connect(sigc::bind(sigc::mem_fun(*this, &PencilToolbar::mode_changed), btn_idx++));
+ }
- gtk_action_group_add_action( mainActions, GTK_ACTION( act->gobj() ));
- // g_object_set_data( dataKludge, "flat_action", act );
+ auto prefs = Inkscape::Preferences::get();
+ guint freehandMode = prefs->getInt(( tool_is_pencil ?
+ "/tools/freehand/pencil/freehand-mode" :
+ "/tools/freehand/pen/freehand-mode" ), 0);
- act->signal_changed().connect(sigc::mem_fun(*this, &PencilToolbar::freehand_mode_changed));
+ add(* Gtk::manage(new Gtk::SeparatorToolItem()));
/* LPE bspline spiro flatten */
- _flatten_spiro_bspline = ink_action_new( tool_is_pencil ? "FlattenSpiroBsplinePencil" :
- "FlattenSpiroBsplinePen",
- _("LPE spiro or bspline flatten"),
- _("LPE spiro or bspline flatten"),
- INKSCAPE_ICON("flatten"),
- GTK_ICON_SIZE_SMALL_TOOLBAR );
- g_signal_connect_after( G_OBJECT(_flatten_spiro_bspline), "activate", G_CALLBACK(PencilToolbar::flatten_spiro_bspline), this);
- gtk_action_group_add_action( mainActions, GTK_ACTION(_flatten_spiro_bspline) );
+ _flatten_spiro_bspline = Gtk::manage(new Gtk::ToolButton(_("LPE spiro or bspline flatten")));
+ _flatten_spiro_bspline->set_tooltip_text(_("LPE spiro or bspline flatten"));
+ _flatten_spiro_bspline->set_icon_name(INKSCAPE_ICON("flatten"));
+ _flatten_spiro_bspline->signal_clicked().connect(sigc::mem_fun(*this, &PencilToolbar::flatten_spiro_bspline));
+ add(*_flatten_spiro_bspline);
+
+ _mode_buttons[freehandMode]->set_active();
if (freehandMode == 1 || freehandMode == 2) {
- gtk_action_set_visible( GTK_ACTION( _flatten_spiro_bspline ), true );
+ _flatten_spiro_bspline->set_visible(true);
} else {
- gtk_action_set_visible( GTK_ACTION( _flatten_spiro_bspline ), false );
+ _flatten_spiro_bspline->set_visible(false);
}
}
@@ -383,29 +349,36 @@ PencilToolbar::maxpressure_value_changed()
}
void
-PencilToolbar::use_pencil_pressure(InkToggleAction* itact, gpointer data) {
- auto toolbar = reinterpret_cast<PencilToolbar *>(data);
-
- bool pressure = gtk_toggle_action_get_active( GTK_TOGGLE_ACTION(itact) );
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->setBool(toolbar->freehand_tool_name() + "/pressure", pressure);
+PencilToolbar::use_pencil_pressure() {
+ bool pressure = _pressure_item->get_active();
+ auto prefs = Inkscape::Preferences::get();
+ prefs->setBool(freehand_tool_name() + "/pressure", pressure);
if (pressure) {
- gtk_action_set_visible( GTK_ACTION( toolbar->_minpressure ), true );
- gtk_action_set_visible( GTK_ACTION( toolbar->_maxpressure ), true );
- toolbar->_shape_action->set_visible (false);
+ _minpressure->set_visible(true);
+ _maxpressure->set_visible(true);
+ _shape_item->set_visible (false);
} else {
- gtk_action_set_visible( GTK_ACTION( toolbar->_minpressure ), false );
- gtk_action_set_visible( GTK_ACTION( toolbar->_maxpressure ), false );
- toolbar->_shape_action->set_visible (true);
+ _minpressure->set_visible(false);
+ _maxpressure->set_visible(false);
+ _shape_item->set_visible (true);
}
}
void
-PencilToolbar::freehand_add_advanced_shape_options(GtkActionGroup* mainActions, bool tool_is_pencil)
+PencilToolbar::add_advanced_shape_options(bool tool_is_pencil)
{
/*advanced shape options */
+ _shape_item = Gtk::manage(new Gtk::ToolItem());
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ auto hbox = Gtk::manage(new Gtk::Box());
+ _shape_item->add(*hbox);
+
+ auto label = Gtk::manage(new UI::Widget::LabelToolItem(_("Shape:")));
+ hbox->add(*label);
+
+ _shape_combo = Gtk::manage(new Gtk::ComboBoxText());
+
+ auto prefs = Inkscape::Preferences::get();
std::vector<gchar*> freehand_shape_dropdown_items_list = {
const_cast<gchar *>(C_("Freehand shape", "None")),
@@ -417,92 +390,48 @@ PencilToolbar::freehand_add_advanced_shape_options(GtkActionGroup* mainActions,
_("Last applied")
};
- InkSelectOneActionColumns columns;
-
- Glib::RefPtr<Gtk::ListStore> store = Gtk::ListStore::create(columns);
-
- Gtk::TreeModel::Row row;
for (auto item:freehand_shape_dropdown_items_list) {
-
- row = *(store->append());
- row[columns.col_label ] = item;
- row[columns.col_tooltip ] = ("");
- row[columns.col_icon ] = "NotUsed";
- row[columns.col_sensitive] = true;
+ _shape_combo->append(item);
}
- _shape_action =
- InkSelectOneAction::create( tool_is_pencil ?
- "SetPencilShapeAction" :
- "SetPenShapeAction", // Name
- _("Shape"), // Label
- _("Shape of new paths drawn by this tool"), // Tooltip
- "Not Used", // Icon
- store ); // Tree store
-
- _shape_action->use_radio( false );
- _shape_action->use_icon( false );
- _shape_action->use_label( true );
- _shape_action->use_group_label( true );
+ _shape_combo->set_tooltip_text(_("Shape of new paths drawn by this tool"));
int shape = prefs->getInt( (tool_is_pencil ?
"/tools/freehand/pencil/shape" :
"/tools/freehand/pen/shape" ), 0);
- _shape_action->set_active( shape );
+ _shape_combo->set_active( shape );
- gtk_action_group_add_action( mainActions, GTK_ACTION( _shape_action->gobj() ));
+ hbox->add(*_shape_combo);
bool hide = prefs->getInt("/tools/freehand/pencil/freehand-mode", 0) == 3 ||
(tool_is_pencil && prefs->getBool("/tools/freehand/pencil/pressure", false));
- _shape_action->set_visible( !hide );
+ _shape_item->set_visible( !hide );
- _shape_action->signal_changed().connect(sigc::mem_fun(*this, &PencilToolbar::freehand_change_shape));
-}
+ _shape_combo->signal_changed().connect(sigc::mem_fun(*this, &PencilToolbar::change_shape));
-void
-PencilToolbar::freehand_change_shape(int shape) {
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->setInt(freehand_tool_name() + "/shape", shape);
+ add(*_shape_item);
}
void
-PencilToolbar::defaults(GtkWidget * /*widget*/, GObject *obj)
-{
- auto toolbar = reinterpret_cast<PencilToolbar *>(obj);
-
- // fixme: make settable
- gdouble tolerance = 4;
-
- toolbar->_tolerance_adj->set_value(tolerance);
-
-#if !GTK_CHECK_VERSION(3,18,0)
- toolbar->_tolerance_adj->value_changed();
-#endif
-
- if(toolbar->_desktop->canvas) gtk_widget_grab_focus(GTK_WIDGET(toolbar->_desktop->canvas));
+PencilToolbar::change_shape() {
+ auto prefs = Inkscape::Preferences::get();
+ auto shape = _shape_combo->get_active_row_number();
+ prefs->setInt(freehand_tool_name() + "/shape", shape);
}
void
-PencilToolbar::freehand_simplify_lpe(InkToggleAction* itact, GObject *data)
+PencilToolbar::simplify_lpe()
{
- auto toolbar = reinterpret_cast<PencilToolbar *>(data);
-
- bool simplify = gtk_toggle_action_get_active( GTK_TOGGLE_ACTION(itact) );
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->setBool(toolbar->freehand_tool_name() + "/simplify", simplify);
- gtk_action_set_visible( GTK_ACTION( toolbar->_flatten_simplify ), simplify );
- if (simplify) {
- gtk_action_set_visible( GTK_ACTION( toolbar->_flatten_simplify ), true );
- } else {
- gtk_action_set_visible( GTK_ACTION( toolbar->_flatten_simplify ), false );
- }
+ bool simplify = _simplify->get_active();
+ auto prefs = Inkscape::Preferences::get();
+ prefs->setBool(freehand_tool_name() + "/simplify", simplify);
+ _flatten_simplify->set_visible(simplify);
}
void
-PencilToolbar::simplify_flatten(GtkWidget * /*widget*/, GObject *data)
+PencilToolbar::simplify_flatten()
{
- auto toolbar = reinterpret_cast<PencilToolbar *>(data);
- auto selected = toolbar->_desktop->getSelection()->items();
+ auto selected = _desktop->getSelection()->items();
SPLPEItem* lpeitem = nullptr;
for (auto it(selected.begin()); it != selected.end(); ++it){
lpeitem = dynamic_cast<SPLPEItem*>(*it);
@@ -534,18 +463,18 @@ PencilToolbar::simplify_flatten(GtkWidget * /*widget*/, GObject *data)
}
}
if (lpeitem) {
- toolbar->_desktop->getSelection()->remove(lpeitem->getRepr());
- toolbar->_desktop->getSelection()->add(lpeitem->getRepr());
+ _desktop->getSelection()->remove(lpeitem->getRepr());
+ _desktop->getSelection()->add(lpeitem->getRepr());
sp_lpe_item_update_patheffect(lpeitem, false, false);
}
}
void
-PencilToolbar::flatten_spiro_bspline(GtkWidget * /*widget*/, gpointer data)
+PencilToolbar::flatten_spiro_bspline()
{
- auto toolbar = reinterpret_cast<PencilToolbar *>(data);
- auto selected = toolbar->_desktop->getSelection()->items();
+ auto selected = _desktop->getSelection()->items();
SPLPEItem* lpeitem = nullptr;
+
for (auto it(selected.begin()); it != selected.end(); ++it){
lpeitem = dynamic_cast<SPLPEItem*>(*it);
if (lpeitem && lpeitem->hasPathEffect()){
@@ -578,18 +507,16 @@ PencilToolbar::flatten_spiro_bspline(GtkWidget * /*widget*/, gpointer data)
}
}
if (lpeitem) {
- toolbar->_desktop->getSelection()->remove(lpeitem->getRepr());
- toolbar->_desktop->getSelection()->add(lpeitem->getRepr());
+ _desktop->getSelection()->remove(lpeitem->getRepr());
+ _desktop->getSelection()->add(lpeitem->getRepr());
sp_lpe_item_update_patheffect(lpeitem, false, false);
}
}
GtkWidget *
-PencilToolbar::prep_pen(SPDesktop *desktop, GtkActionGroup* mainActions)
+PencilToolbar::create_pen(SPDesktop *desktop)
{
- auto toolbar = new PencilToolbar(desktop);
- toolbar->add_freehand_mode_toggle(mainActions, false);
- toolbar->freehand_add_advanced_shape_options(mainActions, false);
+ auto toolbar = new PencilToolbar(desktop, false);
return GTK_WIDGET(toolbar->gobj());
}
diff --git a/src/ui/toolbar/pencil-toolbar.h b/src/ui/toolbar/pencil-toolbar.h
index 5ac1d2154..35129212f 100644
--- a/src/ui/toolbar/pencil-toolbar.h
+++ b/src/ui/toolbar/pencil-toolbar.h
@@ -32,33 +32,36 @@
#include <gtkmm/adjustment.h>
-class InkSelectOneAction;
class SPDesktop;
-typedef struct _EgeAdjustmentAction EgeAdjustmentAction;
-typedef struct _GtkActionGroup GtkActionGroup;
-typedef struct _InkAction InkAction;
-typedef struct _InkToggleAction InkToggleAction;
-
namespace Inkscape {
namespace XML {
class Node;
}
namespace UI {
+namespace Widget {
+class LabelToolItem;
+class SpinButtonToolItem;
+}
+
namespace Toolbar {
class PencilToolbar : public Toolbar {
private:
- EgeAdjustmentAction *_minpressure;
- EgeAdjustmentAction *_maxpressure;
+ std::vector<Gtk::RadioToolButton *> _mode_buttons;
+
+ Gtk::ToggleToolButton *_pressure_item;
+ UI::Widget::SpinButtonToolItem *_minpressure;
+ UI::Widget::SpinButtonToolItem *_maxpressure;
XML::Node *_repr;
- InkAction *_flatten_spiro_bspline;
- InkAction *_flatten_simplify;
+ Gtk::ToolButton *_flatten_spiro_bspline;
+ Gtk::ToolButton *_flatten_simplify;
- InkSelectOneAction *_shape_action;
+ Gtk::ToolItem *_shape_item;
+ Gtk::ComboBoxText *_shape_combo;
- InkToggleAction *_simplify;
+ Gtk::ToggleToolButton *_simplify;
bool _freeze;
@@ -66,36 +69,27 @@ private:
Glib::RefPtr<Gtk::Adjustment> _maxpressure_adj;
Glib::RefPtr<Gtk::Adjustment> _tolerance_adj;
- void add_freehand_mode_toggle(GtkActionGroup* mainActions,
- bool tool_is_pencil);
- void freehand_mode_changed(int mode);
+ void add_freehand_mode_toggle(bool tool_is_pencil);
+ void mode_changed(int mode);
Glib::ustring const freehand_tool_name();
void minpressure_value_changed();
void maxpressure_value_changed();
- static void use_pencil_pressure(InkToggleAction *itact,
- gpointer data);
+ void use_pencil_pressure();
void tolerance_value_changed();
- void freehand_add_advanced_shape_options(GtkActionGroup* mainActions, bool tool_is_pencil);
- void freehand_change_shape(int shape);
- static void defaults(GtkWidget *widget, GObject *obj);
- static void freehand_simplify_lpe(InkToggleAction* itact, GObject *data);
- static void simplify_flatten(GtkWidget *widget, GObject *data);
- static void flatten_spiro_bspline(GtkWidget *widget, gpointer data);
+ void add_advanced_shape_options(bool tool_is_pencil);
+ void change_shape();
+ void simplify_lpe();
+ void simplify_flatten();
+ void flatten_spiro_bspline();
protected:
- PencilToolbar(SPDesktop *desktop)
- : Toolbar(desktop),
- _repr(nullptr),
- _freeze(false),
- _flatten_simplify(nullptr),
- _simplify(nullptr)
- {}
-
+ PencilToolbar(SPDesktop *desktop,
+ bool pencil_mode);
~PencilToolbar() override;
public:
- static GtkWidget * prep_pencil(SPDesktop *desktop, GtkActionGroup* mainActions);
- static GtkWidget * prep_pen(SPDesktop *desktop, GtkActionGroup* mainActions);
+ static GtkWidget * create_pencil(SPDesktop *desktop);
+ static GtkWidget * create_pen(SPDesktop *desktop);
};
}
}
diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp
index 2de668561..918f60c8a 100644
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
@@ -211,9 +211,9 @@ static struct {
SP_VERB_CONTEXT_ARC_PREFS, "/tools/shapes/arc", N_("Style of new ellipses")},
{ "/tools/shapes/spiral", "spiral_toolbox", Inkscape::UI::Toolbar::SpiralToolbar::create, nullptr, "SpiralToolbar",
SP_VERB_CONTEXT_SPIRAL_PREFS, "/tools/shapes/spiral", N_("Style of new spirals")},
- { "/tools/freehand/pencil", "pencil_toolbox", nullptr, Inkscape::UI::Toolbar::PencilToolbar::prep_pencil, "PencilToolbar",
+ { "/tools/freehand/pencil", "pencil_toolbox", Inkscape::UI::Toolbar::PencilToolbar::create_pencil, nullptr, "PencilToolbar",
SP_VERB_CONTEXT_PENCIL_PREFS, "/tools/freehand/pencil", N_("Style of new paths created by Pencil")},
- { "/tools/freehand/pen", "pen_toolbox", nullptr, Inkscape::UI::Toolbar::PencilToolbar::prep_pen, "PenToolbar",
+ { "/tools/freehand/pen", "pen_toolbox", Inkscape::UI::Toolbar::PencilToolbar::create_pen, nullptr, "PenToolbar",
SP_VERB_CONTEXT_PEN_PREFS, "/tools/freehand/pen", N_("Style of new paths created by Pen")},
{ "/tools/calligraphic", "calligraphy_toolbox", nullptr, Inkscape::UI::Toolbar::CalligraphyToolbar::prep,"CalligraphyToolbar",
SP_VERB_CONTEXT_CALLIGRAPHIC_PREFS, "/tools/calligraphic", N_("Style of new calligraphic strokes")},
@@ -236,7 +236,7 @@ static struct {
{ "/tools/paintbucket", "paintbucket_toolbox", Inkscape::UI::Toolbar::PaintbucketToolbar::create, nullptr, "PaintbucketToolbar",
SP_VERB_CONTEXT_PAINTBUCKET_PREFS, "/tools/paintbucket", N_("Style of Paint Bucket fill objects")},
#else
- { "/tools/paintbucket", "paintbucket_toolbox", 0, NULL, "PaintbucketToolbar", SP_VERB_NONE, "/tools/paintbucket", N_("Disabled")},
+ { "/tools/paintbucket", "paintbucket_toolbox", nullptr, nullptr, "PaintbucketToolbar", SP_VERB_NONE, "/tools/paintbucket", N_("Disabled")},
#endif
{ nullptr, nullptr, nullptr, nullptr, nullptr, SP_VERB_INVALID, nullptr, nullptr }
};