summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Valavanis <valavanisalex@gmail.com>2019-01-26 12:47:11 +0000
committerAlexander Valavanis <valavanisalex@gmail.com>2019-01-26 12:47:11 +0000
commit446e7f8587cc990df79c0c5626f26276800b01d6 (patch)
treed18d1fa910d85d2c893e131db021277d620e5640
parentFix inverted up/down when moving last point placed by pen tool (diff)
downloadinkscape-446e7f8587cc990df79c0c5626f26276800b01d6.tar.gz
inkscape-446e7f8587cc990df79c0c5626f26276800b01d6.zip
RectToolbar: GtkAction migration (first pass)
-rw-r--r--share/ui/select-toolbar.ui2
-rw-r--r--src/ui/CMakeLists.txt2
-rw-r--r--src/ui/toolbar/rect-toolbar.cpp241
-rw-r--r--src/ui/toolbar/rect-toolbar.h23
-rw-r--r--src/ui/widget/label-tool-item.cpp66
-rw-r--r--src/ui/widget/label-tool-item.h51
-rw-r--r--src/ui/widget/spin-button-tool-item.h2
-rw-r--r--src/widgets/toolbox.cpp2
8 files changed, 257 insertions, 132 deletions
diff --git a/share/ui/select-toolbar.ui b/share/ui/select-toolbar.ui
index 1c8c1efc3..c55daac23 100644
--- a/share/ui/select-toolbar.ui
+++ b/share/ui/select-toolbar.ui
@@ -118,6 +118,7 @@
<toolitem action='StarResetAction' />
</toolbar>
+<!--
<toolbar name='RectToolbar'>
<toolitem action='RectStateAction' />
<toolitem action='RectWidthAction' />
@@ -128,6 +129,7 @@
<separator />
<toolitem action='RectResetAction' />
</toolbar>
+-->
<toolbar name='3DBoxToolbar'>
<toolitem action='3DBoxAngleXAction' />
diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt
index 46978d87a..e3291f6de 100644
--- a/src/ui/CMakeLists.txt
+++ b/src/ui/CMakeLists.txt
@@ -180,6 +180,7 @@ set(ui_SRC
widget/ink-select-one-action.cpp
widget/ink-spinscale.cpp
widget/insertordericon.cpp
+ widget/label-tool-item.cpp
widget/labelled.cpp
widget/layer-selector.cpp
widget/layertypeicon.cpp
@@ -411,6 +412,7 @@ set(ui_SRC
widget/ink-flow-box.h
widget/ink-select-one-action.h
widget/ink-spinscale.h
+ widget/label-tool-item.h
widget/labelled.h
widget/layer-selector.h
widget/layertypeicon.h
diff --git a/src/ui/toolbar/rect-toolbar.cpp b/src/ui/toolbar/rect-toolbar.cpp
index e97e7c8ee..7841f182e 100644
--- a/src/ui/toolbar/rect-toolbar.cpp
+++ b/src/ui/toolbar/rect-toolbar.cpp
@@ -25,15 +25,16 @@
* Released under GNU GPL v2+, read the file 'COPYING' for more information.
*/
-#include <gtk/gtk.h>
+#include "rect-toolbar.h"
+
#include <glibmm/i18n.h>
-#include "rect-toolbar.h"
+#include <gtkmm/separatortoolitem.h>
+#include <gtkmm/toolbutton.h>
#include "desktop.h"
#include "document-undo.h"
#include "inkscape.h"
-#include "widgets/toolbox.h"
#include "verbs.h"
#include "object/sp-namedview.h"
@@ -43,10 +44,11 @@
#include "ui/tools/rect-tool.h"
#include "ui/uxmanager.h"
#include "ui/widget/ink-select-one-action.h"
+#include "ui/widget/label-tool-item.h"
+#include "ui/widget/spin-button-tool-item.h"
#include "ui/widget/unit-tracker.h"
#include "widgets/ege-adjustment-action.h"
-#include "widgets/ege-output-action.h"
#include "widgets/ink-action.h"
#include "widgets/widget-sizes.h"
@@ -55,7 +57,6 @@
using Inkscape::UI::Widget::UnitTracker;
using Inkscape::UI::UXManager;
using Inkscape::DocumentUndo;
-using Inkscape::UI::ToolboxFactory;
using Inkscape::Util::Unit;
using Inkscape::Util::Quantity;
using Inkscape::Util::unit_table;
@@ -76,143 +77,143 @@ RectToolbar::RectToolbar(SPDesktop *desktop)
: Toolbar(desktop),
_tracker(new UnitTracker(Inkscape::Util::UNIT_TYPE_LINEAR)),
_freeze(false),
- _single(true)
+ _single(true),
+ _repr(nullptr),
+ _mode_item(Gtk::manage(new UI::Widget::LabelToolItem(_("<b>New:</b>"))))
{
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+
// rx/ry units menu: create
//tracker->addUnit( SP_UNIT_PERCENT, 0 );
// fixme: add % meaning per cent of the width/height
_tracker->setActiveUnit(unit_table.getUnit("px"));
-}
-
-RectToolbar::~RectToolbar()
-{
- if (_repr) { // remove old listener
- _repr->removeListenerByData(this);
- Inkscape::GC::release(_repr);
- _repr = nullptr;
- }
-}
-
-GtkWidget *
-RectToolbar::prep(SPDesktop *desktop, GtkActionGroup* mainActions)
-{
- auto holder = new RectToolbar(desktop);
-
- EgeAdjustmentAction* eact = nullptr;
- GtkIconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
-
- {
- holder->_mode_action = ege_output_action_new( "RectStateAction", _("<b>New:</b>"), "", nullptr );
- ege_output_action_set_use_markup( holder->_mode_action, TRUE );
- gtk_action_group_add_action( mainActions, GTK_ACTION( holder->_mode_action ) );
- }
+ _mode_item->set_use_markup(true);
/* W */
{
+ auto width_val = prefs->getDouble("/tools/shapes/rect/width", 0);
+ _width_adj = Gtk::Adjustment::create(width_val, 0, 1e6, SPIN_STEP, SPIN_PAGE_STEP);
+ _width_item = Gtk::manage(new UI::Widget::SpinButtonToolItem("rect-width", _("W:"), _width_adj));
+ _width_item->set_focus_widget(Glib::wrap(GTK_WIDGET(_desktop->canvas)));
+ _width_item->set_all_tooltip_text(_("Width of rectangle"));
+
+ _width_adj->signal_value_changed().connect(sigc::bind(sigc::mem_fun(*this, &RectToolbar::value_changed),
+ _width_adj,
+ "width",
+ &SPRect::setVisibleWidth));
+ _tracker->addAdjustment(_width_adj->gobj());
+ _width_item->set_sensitive(false);
+
gchar const* labels[] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr};
gdouble values[] = {1, 2, 3, 5, 10, 20, 50, 100, 200, 500};
- holder->_width_action = create_adjustment_action( "RectWidthAction",
- _("Width"), _("W:"), _("Width of rectangle"),
- "/tools/shapes/rect/width", 0,
- TRUE, "altx-rect",
- 0, 1e6, SPIN_STEP, SPIN_PAGE_STEP,
- labels, values, G_N_ELEMENTS(labels),
- holder->_tracker);
- ege_adjustment_action_set_focuswidget(holder->_width_action, GTK_WIDGET(desktop->canvas));
-
- holder->_width_adj = Glib::wrap(ege_adjustment_action_get_adjustment(holder->_width_action));
- holder->_width_adj->signal_value_changed().connect(sigc::bind(sigc::mem_fun(*holder, &RectToolbar::value_changed),
- holder->_width_adj,
- "width",
- &SPRect::setVisibleWidth));
- gtk_action_set_sensitive( GTK_ACTION(holder->_width_action), FALSE );
- gtk_action_group_add_action( mainActions, GTK_ACTION(holder->_width_action) );
+
+ // holder->_width_action = create_adjustment_action( "RectWidthAction",
+ // _("Width"), _("W:"),
+ // TRUE, "altx-rect",
+ // labels, values, G_N_ELEMENTS(labels),
}
/* H */
{
+ auto height_val = prefs->getDouble("/tools/shapes/rect/height", 0);
+
+ _height_adj = Gtk::Adjustment::create(height_val, 0, 1e6, SPIN_STEP, SPIN_PAGE_STEP);
+ _height_adj->signal_value_changed().connect(sigc::bind(sigc::mem_fun(*this, &RectToolbar::value_changed),
+ _height_adj,
+ "height",
+ &SPRect::setVisibleHeight));
+ _tracker->addAdjustment(_height_adj->gobj());
+
gchar const* labels[] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr};
gdouble values[] = {1, 2, 3, 5, 10, 20, 50, 100, 200, 500};
- holder->_height_action = create_adjustment_action( "RectHeightAction",
- _("Height"), _("H:"), _("Height of rectangle"),
- "/tools/shapes/rect/height", 0,
- FALSE, nullptr,
- 0, 1e6, SPIN_STEP, SPIN_PAGE_STEP,
- labels, values, G_N_ELEMENTS(labels),
- holder->_tracker);
- ege_adjustment_action_set_focuswidget(holder->_height_action, GTK_WIDGET(desktop->canvas));
- holder->_height_adj = Glib::wrap(ege_adjustment_action_get_adjustment(holder->_height_action));
- holder->_height_adj->signal_value_changed().connect(sigc::bind(sigc::mem_fun(*holder, &RectToolbar::value_changed),
- holder->_height_adj,
- "height",
- &SPRect::setVisibleHeight));
- gtk_action_set_sensitive( GTK_ACTION(holder->_height_action), FALSE );
- gtk_action_group_add_action( mainActions, GTK_ACTION(holder->_height_action) );
+ _height_item = Gtk::manage(new UI::Widget::SpinButtonToolItem("rect-height", _("H:"), _height_adj));
+ _height_item->set_all_tooltip_text(_("Height of rectangle"));
+ _height_item->set_focus_widget(Glib::wrap(GTK_WIDGET(desktop->canvas)));
+ _height_item->set_sensitive(false);
+
+// holder->_height_action = create_adjustment_action( "RectHeightAction",
+ // FALSE, nullptr,
+ // labels, values, G_N_ELEMENTS(labels),
}
/* rx */
{
gchar const* labels[] = {_("not rounded"), nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr};
gdouble values[] = {0.5, 1, 2, 3, 5, 10, 20, 50, 100};
- eact = create_adjustment_action( "RadiusXAction",
- _("Horizontal radius"), _("Rx:"), _("Horizontal radius of rounded corners"),
- "/tools/shapes/rect/rx", 0,
- FALSE, nullptr,
- 0, 1e6, SPIN_STEP, SPIN_PAGE_STEP,
- labels, values, G_N_ELEMENTS(labels),
- holder->_tracker);
- ege_adjustment_action_set_focuswidget(eact, GTK_WIDGET(desktop->canvas));
- holder->_rx_adj = Glib::wrap(ege_adjustment_action_get_adjustment(eact));
- holder->_rx_adj->signal_value_changed().connect(sigc::bind(sigc::mem_fun(*holder, &RectToolbar::value_changed),
- holder->_rx_adj,
- "rx",
- &SPRect::setVisibleRx));
- gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
+ auto rx_val = prefs->getDouble("/tools/shapes/rect/rx", 0);
+ _rx_adj = Gtk::Adjustment::create(rx_val, 0, 1e6, SPIN_STEP, SPIN_PAGE_STEP);
+ _rx_adj->signal_value_changed().connect(sigc::bind(sigc::mem_fun(*this, &RectToolbar::value_changed),
+ _rx_adj,
+ "rx",
+ &SPRect::setVisibleRx));
+ _tracker->addAdjustment(_rx_adj->gobj());
+ _rx_item = Gtk::manage(new UI::Widget::SpinButtonToolItem("rect-rx", _("Rx:"), _rx_adj));
+ _rx_item->set_all_tooltip_text(_("Horizontal radius of rounded corners"));
+ _rx_item->set_focus_widget(Glib::wrap(GTK_WIDGET(_desktop->canvas)));
+// eact = create_adjustment_action( "RadiusXAction",
+// labels, values, G_N_ELEMENTS(labels),
}
/* ry */
{
gchar const* labels[] = {_("not rounded"), nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr};
gdouble values[] = {0.5, 1, 2, 3, 5, 10, 20, 50, 100};
- eact = create_adjustment_action( "RadiusYAction",
- _("Vertical radius"), _("Ry:"), _("Vertical radius of rounded corners"),
- "/tools/shapes/rect/ry", 0,
- FALSE, nullptr,
- 0, 1e6, SPIN_STEP, SPIN_PAGE_STEP,
- labels, values, G_N_ELEMENTS(labels),
- holder->_tracker);
- ege_adjustment_action_set_focuswidget(eact, GTK_WIDGET(desktop->canvas));
- holder->_ry_adj = Glib::wrap(ege_adjustment_action_get_adjustment(eact));
- holder->_ry_adj->signal_value_changed().connect(sigc::bind(sigc::mem_fun(*holder, &RectToolbar::value_changed),
- holder->_ry_adj,
- "ry",
- &SPRect::setVisibleRy));
- gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
+ auto ry_val = prefs->getDouble("/tools/shapes/rect/ry", 0);
+ _ry_adj = Gtk::Adjustment::create(ry_val, 0, 1e6, SPIN_STEP, SPIN_PAGE_STEP);
+ _ry_adj->signal_value_changed().connect(sigc::bind(sigc::mem_fun(*this, &RectToolbar::value_changed),
+ _ry_adj,
+ "ry",
+ &SPRect::setVisibleRy));
+ _tracker->addAdjustment(_ry_adj->gobj());
+ _ry_item = Gtk::manage(new UI::Widget::SpinButtonToolItem("rect-ry", _("Ry:"), _ry_adj));
+ _ry_item->set_all_tooltip_text(_("Vertical radius of rounded corners"));
+ _ry_item->set_focus_widget(Glib::wrap(GTK_WIDGET(_desktop->canvas)));
+ //eact = create_adjustment_action( "RadiusYAction",
+ // labels, values, G_N_ELEMENTS(labels),
}
// add the units menu
- {
- InkSelectOneAction* act = holder->_tracker->createAction( "RectUnitsAction", _("Units"), ("") );
- gtk_action_group_add_action( mainActions, act->gobj() );
- }
+ auto unit_menu = _tracker->createAction( "RectUnitsAction", _("Units"), ("") );
+ auto unit_menu_ti = unit_menu->create_tool_item();
/* Reset */
{
- holder->_not_rounded = ink_action_new( "RectResetAction",
- _("Not rounded"),
- _("Make corners sharp"),
- INKSCAPE_ICON("rectangle-make-corners-sharp"),
- secondarySize );
- g_signal_connect_after( G_OBJECT(holder->_not_rounded), "activate", G_CALLBACK(&RectToolbar::defaults), holder );
- gtk_action_group_add_action( mainActions, GTK_ACTION(holder->_not_rounded) );
- gtk_action_set_sensitive( GTK_ACTION(holder->_not_rounded), TRUE );
+ _not_rounded = Gtk::manage(new Gtk::ToolButton(_("Not rounded")));
+ _not_rounded->set_tooltip_text(_("Make corners sharp"));
+ _not_rounded->set_icon_name(INKSCAPE_ICON("rectangle-make-corners-sharp"));
+ _not_rounded->signal_clicked().connect(sigc::mem_fun(*this, &RectToolbar::defaults));
+ _not_rounded->set_sensitive(true);
}
- holder->sensitivize();
+ add(*_mode_item);
+ add(*_width_item);
+ add(*_height_item);
+ add(*_rx_item);
+ add(*_ry_item);
+ add(*unit_menu_ti);
+ add(* Gtk::manage(new Gtk::SeparatorToolItem()));
+ add(*_not_rounded);
+ show_all();
+
+ sensitivize();
- desktop->connectEventContextChanged(sigc::mem_fun(*holder, &RectToolbar::watch_ec));
+ _desktop->connectEventContextChanged(sigc::mem_fun(*this, &RectToolbar::watch_ec));
+}
- return GTK_WIDGET(holder->gobj());
+RectToolbar::~RectToolbar()
+{
+ if (_repr) { // remove old listener
+ _repr->removeListenerByData(this);
+ Inkscape::GC::release(_repr);
+ _repr = nullptr;
+ }
+}
+
+GtkWidget *
+RectToolbar::create(SPDesktop *desktop)
+{
+ auto toolbar = new RectToolbar(desktop);
+ return GTK_WIDGET(toolbar->gobj());
}
void
@@ -265,27 +266,25 @@ void
RectToolbar::sensitivize()
{
if (_rx_adj->get_value() == 0 && _ry_adj->get_value() == 0 && _single) { // only for a single selected rect (for now)
- gtk_action_set_sensitive( GTK_ACTION(_not_rounded), FALSE );
+ _not_rounded->set_sensitive(false);
} else {
- gtk_action_set_sensitive( GTK_ACTION(_not_rounded), TRUE );
+ _not_rounded->set_sensitive(true);
}
}
void
-RectToolbar::defaults( GtkWidget * /*widget*/, GObject *obj)
+RectToolbar::defaults()
{
- auto toolbar = reinterpret_cast<RectToolbar*>(obj);
-
- toolbar->_rx_adj->set_value(0.0);
- toolbar->_ry_adj->set_value(0.0);
+ _rx_adj->set_value(0.0);
+ _ry_adj->set_value(0.0);
#if !GTK_CHECK_VERSION(3,18,0)
// this is necessary if the previous value was 0, but we still need to run the callback to change all selected objects
- toolbar->_rx_adj->value_changed();
- toolbar->_ry_adj->value_changed();
+ _rx_adj->value_changed();
+ _ry_adj->value_changed();
#endif
- toolbar->sensitivize();
+ sensitivize();
}
void
@@ -344,14 +343,14 @@ RectToolbar::selection_changed(Inkscape::Selection *selection)
_single = false;
if (n_selected == 0) {
- gtk_action_set_label(GTK_ACTION(_mode_action), _("<b>New:</b>"));
- gtk_action_set_sensitive(GTK_ACTION(_width_action), FALSE);
- gtk_action_set_sensitive(GTK_ACTION(_height_action), FALSE);
+ _mode_item->set_markup(_("<b>New:</b>"));
+ _width_item->set_sensitive(false);
+ _height_item->set_sensitive(false);
} else if (n_selected == 1) {
- gtk_action_set_label(GTK_ACTION(_mode_action), _("<b>Change:</b>"));
+ _mode_item->set_markup(_("<b>Change:</b>"));
_single = true;
- gtk_action_set_sensitive(GTK_ACTION(_width_action), TRUE);
- gtk_action_set_sensitive(GTK_ACTION(_height_action), TRUE);
+ _width_item->set_sensitive(true);
+ _height_item->set_sensitive(true);
if (repr) {
_repr = repr;
@@ -363,7 +362,7 @@ RectToolbar::selection_changed(Inkscape::Selection *selection)
} else {
// FIXME: implement averaging of all parameters for multiple selected
//gtk_label_set_markup(GTK_LABEL(l), _("<b>Average:</b>"));
- gtk_action_set_label(GTK_ACTION(_mode_action), _("<b>Change:</b>"));
+ _mode_item->set_markup(_("<b>Change:</b>"));
sensitivize();
}
}
diff --git a/src/ui/toolbar/rect-toolbar.h b/src/ui/toolbar/rect-toolbar.h
index 058054d78..3aee3b563 100644
--- a/src/ui/toolbar/rect-toolbar.h
+++ b/src/ui/toolbar/rect-toolbar.h
@@ -38,9 +38,12 @@ class SPRect;
typedef struct _EgeAdjustmentAction EgeAdjustmentAction;
typedef struct _EgeOutputAction EgeOutputAction;
-typedef struct _GtkActionGroup GtkActionGroup;
typedef struct _InkAction InkAction;
+namespace Gtk {
+class Toolbutton;
+}
+
namespace Inkscape {
class Selection;
@@ -54,22 +57,25 @@ class ToolBase;
}
namespace Widget {
+class LabelToolItem;
+class SpinButtonToolItem;
class UnitTracker;
}
namespace Toolbar {
class RectToolbar : public Toolbar {
private:
- EgeOutputAction *_mode_action;
-
UI::Widget::UnitTracker *_tracker;
XML::Node *_repr;
SPItem *_item;
- EgeAdjustmentAction *_width_action;
- EgeAdjustmentAction *_height_action;
- InkAction *_not_rounded;
+ UI::Widget::LabelToolItem *_mode_item;
+ UI::Widget::SpinButtonToolItem *_width_item;
+ UI::Widget::SpinButtonToolItem *_height_item;
+ UI::Widget::SpinButtonToolItem *_rx_item;
+ UI::Widget::SpinButtonToolItem *_ry_item;
+ Gtk::ToolButton *_not_rounded;
Glib::RefPtr<Gtk::Adjustment> _width_adj;
Glib::RefPtr<Gtk::Adjustment> _height_adj;
@@ -84,8 +90,7 @@ private:
void (SPRect::*setter)(gdouble));
void sensitivize();
- static void defaults(GtkWidget *widget,
- GObject *obj);
+ void defaults();
void watch_ec(SPDesktop* desktop, Inkscape::UI::Tools::ToolBase* ec);
void selection_changed(Inkscape::Selection *selection);
@@ -94,7 +99,7 @@ protected:
~RectToolbar() override;
public:
- static GtkWidget * prep(SPDesktop *desktop, GtkActionGroup* mainActions);
+ static GtkWidget * create(SPDesktop *desktop);
static void event_attr_changed(Inkscape::XML::Node *repr,
gchar const *name,
diff --git a/src/ui/widget/label-tool-item.cpp b/src/ui/widget/label-tool-item.cpp
new file mode 100644
index 000000000..979cfa235
--- /dev/null
+++ b/src/ui/widget/label-tool-item.cpp
@@ -0,0 +1,66 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/** @file
+ * A label that can be added to a toolbar
+ *//*
+ * Authors: see git history
+ *
+ * Copyright (C) 2018 Authors
+ * Released under GNU GPL v2+, read the file 'COPYING' for more information.
+ */
+
+#include "label-tool-item.h"
+
+#include <gtkmm/label.h>
+
+namespace Inkscape {
+namespace UI {
+namespace Widget {
+
+/**
+ * \brief Create a tool-item containing a label
+ *
+ * \param[in] label The text to display in the label
+ * \param[in] mnemonic True if text should use a mnemonic
+ */
+LabelToolItem::LabelToolItem(const Glib::ustring& label, bool mnemonic)
+ : _label(Gtk::manage(new Gtk::Label(label, mnemonic)))
+{
+ add(*_label);
+ show_all();
+}
+
+/**
+ * \brief Set the markup text in the label
+ *
+ * \param[in] str The markup text
+ */
+void
+LabelToolItem::set_markup(const Glib::ustring& str)
+{
+ _label->set_markup(str);
+}
+
+/**
+ * \brief Sets whether label uses Pango markup
+ *
+ * \param[in] setting true if the label text should be parsed for markup
+ */
+void
+LabelToolItem::set_use_markup(bool setting)
+{
+ _label->set_use_markup(setting);
+}
+
+}
+}
+}
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --git a/src/ui/widget/label-tool-item.h b/src/ui/widget/label-tool-item.h
new file mode 100644
index 000000000..1fe689206
--- /dev/null
+++ b/src/ui/widget/label-tool-item.h
@@ -0,0 +1,51 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/** @file
+ * A label that can be added to a toolbar
+ *//*
+ * Authors: see git history
+ *
+ * Copyright (C) 2018 Authors
+ * Released under GNU GPL v2+, read the file 'COPYING' for more information.
+ */
+
+#ifndef SEEN_LABEL_TOOL_ITEM_H
+#define SEEN_LABEL_TOOL_ITEM_H
+
+#include <gtkmm/toolitem.h>
+
+namespace Gtk {
+class Label;
+}
+
+namespace Inkscape {
+namespace UI {
+namespace Widget {
+
+/**
+ * \brief A label that can be added to a toolbar
+ */
+class LabelToolItem : public Gtk::ToolItem {
+private:
+ Gtk::Label *_label;
+
+public:
+ LabelToolItem(const Glib::ustring& label, bool mnemonic = false);
+
+ void set_markup(const Glib::ustring& str);
+ void set_use_markup(bool setting = true);
+};
+}
+}
+}
+
+#endif
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --git a/src/ui/widget/spin-button-tool-item.h b/src/ui/widget/spin-button-tool-item.h
index e5e7fc296..cc48e453b 100644
--- a/src/ui/widget/spin-button-tool-item.h
+++ b/src/ui/widget/spin-button-tool-item.h
@@ -51,7 +51,7 @@ protected:
bool on_create_menu_proxy() override;
public:
- SpinButtonToolItem(const Glib::ustring name,
+ SpinButtonToolItem(const Glib::ustring name,
const Glib::ustring& label_text,
Glib::RefPtr<Gtk::Adjustment>& adjustment,
double climb_rate = 0.1,
diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp
index 3199e25ef..2487cc534 100644
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
@@ -203,7 +203,7 @@ static struct {
SP_VERB_INVALID, nullptr, nullptr},
{ "/tools/shapes/star", "star_toolbox", nullptr, Inkscape::UI::Toolbar::StarToolbar::prep, "StarToolbar",
SP_VERB_CONTEXT_STAR_PREFS, "/tools/shapes/star", N_("Style of new stars")},
- { "/tools/shapes/rect", "rect_toolbox", nullptr, Inkscape::UI::Toolbar::RectToolbar::prep, "RectToolbar",
+ { "/tools/shapes/rect", "rect_toolbox", Inkscape::UI::Toolbar::RectToolbar::create, nullptr, "RectToolbar",
SP_VERB_CONTEXT_RECT_PREFS, "/tools/shapes/rect", N_("Style of new rectangles")},
{ "/tools/shapes/3dbox", "3dbox_toolbox", nullptr, Inkscape::UI::Toolbar::Box3DToolbar::prep, "3DBoxToolbar",
SP_VERB_CONTEXT_3DBOX_PREFS, "/tools/shapes/3dbox", N_("Style of new 3D boxes")},