From 5fd6657569a041c62ae92d274299fc3b38c3fd0f Mon Sep 17 00:00:00 2001 From: Jan Lingscheid Date: Tue, 12 Sep 2017 09:31:05 +0200 Subject: Remove usage of GString from tool/node.cpp --- src/ui/tool/node.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src/ui/tool') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index d6e491ac3..4f42400d4 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -559,14 +559,11 @@ Glib::ustring Handle::_getDragTip(GdkEventMotion */*event*/) const Inkscape::Util::Quantity x_q = Inkscape::Util::Quantity(dist[Geom::X], "px"); Inkscape::Util::Quantity y_q = Inkscape::Util::Quantity(dist[Geom::Y], "px"); Inkscape::Util::Quantity len_q = Inkscape::Util::Quantity(length(), "px"); - GString *x = g_string_new(x_q.string(_desktop->namedview->display_units).c_str()); - GString *y = g_string_new(y_q.string(_desktop->namedview->display_units).c_str()); - GString *len = g_string_new(len_q.string(_desktop->namedview->display_units).c_str()); + Glib::ustring x = x_q.string(_desktop->namedview->display_units); + Glib::ustring y = y_q.string(_desktop->namedview->display_units); + Glib::ustring len = len_q.string(_desktop->namedview->display_units); Glib::ustring ret = format_tip(C_("Path handle tip", - "Move handle by %s, %s; angle %.2f°, length %s"), x->str, y->str, angle, len->str); - g_string_free(x, TRUE); - g_string_free(y, TRUE); - g_string_free(len, TRUE); + "Move handle by %s, %s; angle %.2f°, length %s"), x.c_str(), y.c_str(), angle, len.c_str()); return ret; } @@ -1458,11 +1455,9 @@ Glib::ustring Node::_getDragTip(GdkEventMotion */*event*/) const Inkscape::Util::Quantity x_q = Inkscape::Util::Quantity(dist[Geom::X], "px"); Inkscape::Util::Quantity y_q = Inkscape::Util::Quantity(dist[Geom::Y], "px"); - GString *x = g_string_new(x_q.string(_desktop->namedview->display_units).c_str()); - GString *y = g_string_new(y_q.string(_desktop->namedview->display_units).c_str()); - Glib::ustring ret = format_tip(C_("Path node tip", "Move node by %s, %s"), x->str, y->str); - g_string_free(x, TRUE); - g_string_free(y, TRUE); + Glib::ustring x = x_q.string(_desktop->namedview->display_units); + Glib::ustring y = y_q.string(_desktop->namedview->display_units); + Glib::ustring ret = format_tip(C_("Path node tip", "Move node by %s, %s"), x.c_str(), y.c_str()); return ret; } -- cgit v1.2.3 From e0957537cd0938313803c290a2f3922a3889e6f1 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Sun, 1 Oct 2017 17:49:26 +0200 Subject: Removed all GSList occurences in .h files --- src/ui/tool/manipulator.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/ui/tool') diff --git a/src/ui/tool/manipulator.h b/src/ui/tool/manipulator.h index 07e01a656..0f26c6de1 100644 --- a/src/ui/tool/manipulator.h +++ b/src/ui/tool/manipulator.h @@ -98,16 +98,17 @@ public: bool empty() { return _mmap.empty(); } - void setItems(GSList const *list) { + + void setItems(std::vector list) { // this function is not called anywhere ... delete ? std::set to_remove; for (typename MapType::iterator mi = _mmap.begin(); mi != _mmap.end(); ++mi) { to_remove.insert(mi->first); } - for (GSList *i = const_cast(list); i; i = i->next) { - if (_isItemType(i->data)) { + for (auto i:list) { + if (_isItemType(i)) { // erase returns the number of items removed // if nothing was removed, it means this item did not have a manipulator - add it - if (!to_remove.erase(i->data)) addItem(i->data); + if (!to_remove.erase(i)) addItem(i); } } typedef typename std::set::iterator RmIter; -- cgit v1.2.3 From 525c6c0c7ea39c6bdb0013c546d08b6e94e51e61 Mon Sep 17 00:00:00 2001 From: Andrey Mozzhuhin Date: Fri, 6 Oct 2017 00:46:14 +0300 Subject: Rename get_group0_keyval to get_latin_keyval --- src/ui/tool/control-point.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/tool') diff --git a/src/ui/tool/control-point.cpp b/src/ui/tool/control-point.cpp index d9374c790..8ab9fcbd7 100644 --- a/src/ui/tool/control-point.cpp +++ b/src/ui/tool/control-point.cpp @@ -380,7 +380,7 @@ bool ControlPoint::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, G // update tips on modifier state change // TODO add ESC keybinding as drag cancel case GDK_KEY_PRESS: - switch (Inkscape::UI::Tools::get_group0_keyval(&event->key)) + switch (Inkscape::UI::Tools::get_latin_keyval(&event->key)) { case GDK_KEY_Escape: { // ignore Escape if this is not a drag -- cgit v1.2.3 From e1cb749aab3c773073b1adde1b4cd07b2a6ce93e Mon Sep 17 00:00:00 2001 From: Jan Lingscheid Date: Tue, 17 Oct 2017 08:31:32 +0200 Subject: Replace boost::shared_ptr Replace boost::shared_ptr with C++11 smartpointer and remove the boost/shared_ptr.hpp header. --- src/ui/tool/manipulator.h | 7 +++---- src/ui/tool/multi-path-manipulator.cpp | 5 ++--- src/ui/tool/multi-path-manipulator.h | 8 ++++---- src/ui/tool/node.h | 8 +++----- src/ui/tool/path-manipulator.h | 4 +--- 5 files changed, 13 insertions(+), 19 deletions(-) (limited to 'src/ui/tool') diff --git a/src/ui/tool/manipulator.h b/src/ui/tool/manipulator.h index 0f26c6de1..66b47ce98 100644 --- a/src/ui/tool/manipulator.h +++ b/src/ui/tool/manipulator.h @@ -17,7 +17,6 @@ #include #include #include -#include #include "ui/tools/tool-base.h" class SPDesktop; @@ -76,14 +75,14 @@ template class MultiManipulator : public PointManipulator { public: //typedef typename T::ItemType ItemType; - typedef typename std::pair > MapPair; - typedef typename std::map > MapType; + typedef typename std::pair > MapPair; + typedef typename std::map > MapType; MultiManipulator(SPDesktop *d, ControlPointSelection &sel) : PointManipulator(d, sel) {} void addItem(void *item) { - boost::shared_ptr m(_createManipulator(item)); + std::shared_ptr m(_createManipulator(item)); _mmap.insert(MapPair(item, m)); } void removeItem(void *item) { diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp index f30c7e349..9cfa4ed31 100644 --- a/src/ui/tool/multi-path-manipulator.cpp +++ b/src/ui/tool/multi-path-manipulator.cpp @@ -10,7 +10,6 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include #include "node.h" #include #include "desktop.h" @@ -161,7 +160,7 @@ void MultiPathManipulator::setItems(std::set const &s) if (sr.edit_transform != sr_new.edit_transform || sr.role != sr_new.role) { - boost::shared_ptr hold(i->second); + std::shared_ptr hold(i->second); if (sr.edit_transform != sr_new.edit_transform) hold->setControlsTransform(sr_new.edit_transform); if (sr.role != sr_new.role) { @@ -179,7 +178,7 @@ void MultiPathManipulator::setItems(std::set const &s) for (std::set::iterator i = shapes.begin(); i != shapes.end(); ++i) { ShapeRecord const &r = *i; if (!SP_IS_PATH(r.item) && !IS_LIVEPATHEFFECT(r.item)) continue; - boost::shared_ptr newpm(new PathManipulator(*this, (SPPath*) r.item, + std::shared_ptr newpm(new PathManipulator(*this, (SPPath*) r.item, r.edit_transform, _getOutlineColor(r.role, r.item), r.lpe_key)); newpm->showHandles(_show_handles); // always show outlines for clips and masks diff --git a/src/ui/tool/multi-path-manipulator.h b/src/ui/tool/multi-path-manipulator.h index 4f152e0a2..742c6d421 100644 --- a/src/ui/tool/multi-path-manipulator.h +++ b/src/ui/tool/multi-path-manipulator.h @@ -77,8 +77,8 @@ public: sigc::signal signal_coords_changed; /// Emitted whenever the coordinates /// shown in the status bar need updating private: - typedef std::pair > MapPair; - typedef std::map > MapType; + typedef std::pair > MapPair; + typedef std::map > MapType; template void invokeForAll(R (PathManipulator::*method)()) { @@ -88,11 +88,11 @@ private: // be a valid iterator and then assign i to it. MapType::iterator next_i = i; ++next_i; - // i->second is a boost::shared_ptr so try to hold on to it so + // i->second is a std::shared_ptr so try to hold on to it so // it won't get freed prematurely by the WriteXML() method or // whatever. See https://bugs.launchpad.net/inkscape/+bug/1617615 // Applicable to empty paths. - boost::shared_ptr hold(i->second); + std::shared_ptr hold(i->second); ((hold.get())->*method)(); i = next_i; } diff --git a/src/ui/tool/node.h b/src/ui/tool/node.h index a05f0e3b9..2964b66ca 100644 --- a/src/ui/tool/node.h +++ b/src/ui/tool/node.h @@ -22,8 +22,6 @@ #include #include -#include -#include #include "ui/tool/selectable-control-point.h" #include "snapped-point.h" #include "ui/tool/node-types.h" @@ -357,7 +355,7 @@ private: friend class NodeList; }; -class NodeList : ListNode, boost::noncopyable, public boost::enable_shared_from_this { +class NodeList : ListNode, boost::noncopyable { public: typedef std::size_t size_type; typedef Node &reference; @@ -465,9 +463,9 @@ private: * List of node lists. Represents an editable path. * Editable path composed of one or more subpaths. */ -class SubpathList : public std::list< boost::shared_ptr > { +class SubpathList : public std::list< std::shared_ptr > { public: - typedef std::list< boost::shared_ptr > list_type; + typedef std::list< std::shared_ptr > list_type; SubpathList(PathManipulator &pm) : _path_manipulator(pm) {} PathManipulator &pm() { return _path_manipulator; } diff --git a/src/ui/tool/path-manipulator.h b/src/ui/tool/path-manipulator.h index 283cb610a..5fa24c23b 100644 --- a/src/ui/tool/path-manipulator.h +++ b/src/ui/tool/path-manipulator.h @@ -15,8 +15,6 @@ #include #include <2geom/pathvector.h> #include <2geom/affine.h> -#include -#include #include "ui/tool/node.h" #include "ui/tool/manipulator.h" #include "live_effects/lpe-bspline.h" @@ -105,7 +103,7 @@ public: static bool is_item_type(void *item); private: typedef NodeList Subpath; - typedef boost::shared_ptr SubpathPtr; + typedef std::shared_ptr SubpathPtr; void _createControlPointsFromGeometry(); -- cgit v1.2.3 From 41b862f1c4eaea48bdd0d546e2bb31907f15857b Mon Sep 17 00:00:00 2001 From: Jan Lingscheid Date: Wed, 18 Oct 2017 16:03:34 +0200 Subject: Refactor Util::ptr_shared Util::ptr_shared was only used in its specialization, so it is now refactored into a non-template class. Using it with arbitary classes was dangerous anyway. --- src/ui/tool/path-manipulator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/tool') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index f2899dd01..2c99e7fc8 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -68,7 +68,7 @@ public: } virtual void notifyAttributeChanged(Inkscape::XML::Node &/*node*/, GQuark attr, - Util::ptr_shared, Util::ptr_shared) + Util::ptr_shared, Util::ptr_shared) { // do nothing if blocked if (_blocked) return; -- cgit v1.2.3 From 4636481acc66c8ac24aff6642257d09e562eedb5 Mon Sep 17 00:00:00 2001 From: Stefano Facchini Date: Mon, 16 Oct 2017 00:41:54 +0200 Subject: Remove unused util/accumulators.h --- src/ui/tool/control-point-selection.h | 1 - src/ui/tool/control-point.h | 12 ------------ 2 files changed, 13 deletions(-) (limited to 'src/ui/tool') diff --git a/src/ui/tool/control-point-selection.h b/src/ui/tool/control-point-selection.h index f122a468d..ec845b1b3 100644 --- a/src/ui/tool/control-point-selection.h +++ b/src/ui/tool/control-point-selection.h @@ -20,7 +20,6 @@ #include <2geom/forward.h> #include <2geom/point.h> #include <2geom/rect.h> -#include "util/accumulators.h" #include "util/unordered-containers.h" #include "ui/tool/commit-events.h" #include "ui/tool/manipulator.h" diff --git a/src/ui/tool/control-point.h b/src/ui/tool/control-point.h index 4a01b9f21..bc1f060cd 100644 --- a/src/ui/tool/control-point.h +++ b/src/ui/tool/control-point.h @@ -18,7 +18,6 @@ #include <2geom/point.h> #include "ui/control-types.h" -#include "util/accumulators.h" #include "display/sodipodi-ctrl.h" #include "enums.h" @@ -76,8 +75,6 @@ namespace UI { */ class ControlPoint : boost::noncopyable, public sigc::trackable { public: - typedef Inkscape::Util::ReverseInterruptible RInt; - typedef Inkscape::Util::Interruptible Int; /** * Enumeration representing the possible states of the control point, used to determine @@ -162,15 +159,6 @@ public: void transferGrab(ControlPoint *from, GdkEventMotion *event); /// @} - /// @name Receive notifications about control point events - /// @{ - /*sigc::signal signal_dragged; - sigc::signal::accumulated signal_clicked; - sigc::signal::accumulated signal_doubleclicked; - sigc::signal::accumulated signal_grabbed; - sigc::signal signal_ungrabbed;*/ - /// @} - /// @name Inspect the state of the control point /// @{ State state() const { return _state; } -- cgit v1.2.3