From 31bb8269c26a781036448ed8f8cd93cc84fb2118 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Sun, 29 Nov 2009 16:33:18 +0100 Subject: First GSoC node tool commit to Bazaar (bzr r8846.1.1) --- src/ui/tool/control-point-selection.h | 140 ++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 src/ui/tool/control-point-selection.h (limited to 'src/ui/tool/control-point-selection.h') diff --git a/src/ui/tool/control-point-selection.h b/src/ui/tool/control-point-selection.h new file mode 100644 index 000000000..0f0daffaa --- /dev/null +++ b/src/ui/tool/control-point-selection.h @@ -0,0 +1,140 @@ +/** @file + * Node selection - stores a set of nodes and applies transformations + * to them + */ +/* Authors: + * Krzysztof KosiƄski + * + * Copyright (C) 2009 Authors + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#ifndef SEEN_UI_TOOL_NODE_SELECTION_H +#define SEEN_UI_TOOL_NODE_SELECTION_H + +#include +#include +#include +#include +#include +#include +#include <2geom/forward.h> +#include <2geom/point.h> +#include "display/display-forward.h" +#include "util/accumulators.h" +#include "util/hash.h" +#include "ui/tool/commit-events.h" +#include "ui/tool/manipulator.h" + +namespace std { using namespace tr1; } + +class SPDesktop; + +namespace Inkscape { +namespace UI { + +class TransformHandleSet; +class SelectableControlPoint; + +class ControlPointSelection : public Manipulator { +public: + ControlPointSelection(SPDesktop *d, SPCanvasGroup *th_group); + ~ControlPointSelection(); + typedef std::list connlist_type; + typedef std::unordered_map< SelectableControlPoint *, + boost::shared_ptr > map_type; + + // boilerplate typedefs + typedef map_type::iterator iterator; + typedef map_type::const_iterator const_iterator; + typedef map_type::size_type size_type; + + typedef SelectableControlPoint *value_type; + typedef SelectableControlPoint *key_type; + + // size + bool empty() { return _points.empty(); } + size_type size() { return _points.size(); } + + // iterators + iterator begin() { return _points.begin(); } + const_iterator begin() const { return _points.begin(); } + iterator end() { return _points.end(); } + const_iterator end() const { return _points.end(); } + + // insert + std::pair insert(const value_type& x); + template + void insert(InputIterator first, InputIterator last) { + for (; first != last; ++first) { + insert(*first); + } + } + + // erase + void clear(); + void erase(iterator pos); + size_type erase(const key_type& k); + void erase(iterator first, iterator last); + + // find + iterator find(const key_type &k) { return _points.find(k); } + + virtual bool event(GdkEvent *); + + void transform(Geom::Matrix const &m); + void align(Geom::Dim2 d); + void distribute(Geom::Dim2 d); + + Geom::OptRect pointwiseBounds(); + Geom::OptRect bounds(); + + void showTransformHandles(bool v, bool one_node); + // the two methods below do not modify the state; they are for use in manipulators + // that need to temporarily hide the handles + void hideTransformHandles(); + void restoreTransformHandles(); + + // TODO this is really only applicable to nodes... maybe derive a NodeSelection? + void setSculpting(bool v) { _sculpt_enabled = v; } + + sigc::signal signal_update; + sigc::signal signal_point_changed; + sigc::signal signal_commit; +private: + void _selectionGrabbed(SelectableControlPoint *, GdkEventMotion *); + void _selectionDragged(Geom::Point const &, Geom::Point &, GdkEventMotion *); + void _selectionUngrabbed(); + void _updateTransformHandles(bool preserve_center); + bool _keyboardMove(GdkEventKey const &, Geom::Point const &); + bool _keyboardRotate(GdkEventKey const &, int); + bool _keyboardScale(GdkEventKey const &, int); + bool _keyboardFlip(Geom::Dim2); + void _keyboardTransform(Geom::Matrix const &); + void _commitTransform(CommitEvent ce); + map_type _points; + boost::optional _rot_radius; + TransformHandleSet *_handles; + SelectableControlPoint *_grabbed_point; + unsigned _dragging : 1; + unsigned _handles_visible : 1; + unsigned _one_node_handles : 1; + unsigned _sculpt_enabled : 1; + unsigned _sculpting : 1; +}; + +} // namespace UI +} // namespace Inkscape + +#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:encoding=utf-8:textwidth=99 : -- cgit v1.2.3 From b52865a71a9f83da9719a3ec5f50a4a2cd7cdace Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Sun, 10 Jan 2010 01:46:28 +0100 Subject: * Implement node snapping. * Fix minor bug in linear grow. * Add --fixes. * Move some node selection-related functions to ControlPointSelection. Fixed bugs: - https://launchpad.net/bugs/170561 - https://launchpad.net/bugs/171893 - https://launchpad.net/bugs/182585 - https://launchpad.net/bugs/446773 (bzr r8846.2.9) --- src/ui/tool/control-point-selection.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/ui/tool/control-point-selection.h') diff --git a/src/ui/tool/control-point-selection.h b/src/ui/tool/control-point-selection.h index 0f0daffaa..38df5c7e5 100644 --- a/src/ui/tool/control-point-selection.h +++ b/src/ui/tool/control-point-selection.h @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -43,12 +44,12 @@ public: typedef std::list connlist_type; typedef std::unordered_map< SelectableControlPoint *, boost::shared_ptr > map_type; + typedef std::unordered_set< SelectableControlPoint * > set_type; + typedef set_type Set; // convenience alias - // boilerplate typedefs typedef map_type::iterator iterator; typedef map_type::const_iterator const_iterator; typedef map_type::size_type size_type; - typedef SelectableControlPoint *value_type; typedef SelectableControlPoint *key_type; @@ -80,6 +81,15 @@ public: // find iterator find(const key_type &k) { return _points.find(k); } + // Sometimes it is very useful to keep a list of all selectable points. + set_type const &allPoints() const { return _all_points; } + set_type &allPoints() { return _all_points; } + // ...for example in these methods. Another useful case is snapping. + void selectAll(); + void selectArea(Geom::Rect const &); + void invertSelection(); + void spatialGrow(SelectableControlPoint *origin, int dir); + virtual bool event(GdkEvent *); void transform(Geom::Matrix const &m); @@ -113,6 +123,7 @@ private: void _keyboardTransform(Geom::Matrix const &); void _commitTransform(CommitEvent ce); map_type _points; + set_type _all_points; boost::optional _rot_radius; TransformHandleSet *_handles; SelectableControlPoint *_grabbed_point; -- cgit v1.2.3 From 13b341b68636dbc621daf94f6efa229489b7fd70 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Thu, 14 Jan 2010 18:45:20 +0100 Subject: * Add "show transform handles" toggle button. * Transform handle mode switching similar to selector tool, when node transform handles are visible. (bzr r8846.2.18) --- src/ui/tool/control-point-selection.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src/ui/tool/control-point-selection.h') diff --git a/src/ui/tool/control-point-selection.h b/src/ui/tool/control-point-selection.h index 38df5c7e5..7a83b5290 100644 --- a/src/ui/tool/control-point-selection.h +++ b/src/ui/tool/control-point-selection.h @@ -101,20 +101,23 @@ public: void showTransformHandles(bool v, bool one_node); // the two methods below do not modify the state; they are for use in manipulators - // that need to temporarily hide the handles + // that need to temporarily hide the handles, for example when moving a node void hideTransformHandles(); void restoreTransformHandles(); - - // TODO this is really only applicable to nodes... maybe derive a NodeSelection? - void setSculpting(bool v) { _sculpt_enabled = v; } + void toggleTransformHandlesMode(); sigc::signal signal_update; sigc::signal signal_point_changed; sigc::signal signal_commit; private: - void _selectionGrabbed(SelectableControlPoint *, GdkEventMotion *); - void _selectionDragged(Geom::Point const &, Geom::Point &, GdkEventMotion *); - void _selectionUngrabbed(); + // The functions below are invoked from SelectableControlPoint. + // Previously they were connected to handlers when selecting, but this + // creates problems when dragging a point that was not selected. + void _pointGrabbed(); + void _pointDragged(Geom::Point const &, Geom::Point &, GdkEventMotion *); + void _pointUngrabbed(); + bool _pointClicked(SelectableControlPoint *, GdkEventButton *); + void _updateTransformHandles(bool preserve_center); bool _keyboardMove(GdkEventKey const &, Geom::Point const &); bool _keyboardRotate(GdkEventKey const &, int); @@ -130,8 +133,8 @@ private: unsigned _dragging : 1; unsigned _handles_visible : 1; unsigned _one_node_handles : 1; - unsigned _sculpt_enabled : 1; - unsigned _sculpting : 1; + + friend class SelectableControlPoint; }; } // namespace UI -- cgit v1.2.3 From 4756aa99f5756a6cac199c1aae6c37514cf1c562 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Thu, 14 Jan 2010 23:38:54 +0100 Subject: Replace std::tr1::unordered_(map|set) with __gnu_cxx::hash_(map|set), to work around broken headers in some GCC versions. (bzr r8980) --- src/ui/tool/control-point-selection.h | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'src/ui/tool/control-point-selection.h') diff --git a/src/ui/tool/control-point-selection.h b/src/ui/tool/control-point-selection.h index 7a83b5290..dce685575 100644 --- a/src/ui/tool/control-point-selection.h +++ b/src/ui/tool/control-point-selection.h @@ -13,8 +13,11 @@ #define SEEN_UI_TOOL_NODE_SELECTION_H #include -#include -#include +// those are broken beyond hope on OSX. +//#include +//#include +#include +#include #include #include #include @@ -27,24 +30,37 @@ #include "ui/tool/commit-events.h" #include "ui/tool/manipulator.h" -namespace std { using namespace tr1; } +namespace std { using namespace __gnu_cxx; } class SPDesktop; namespace Inkscape { namespace UI { - class TransformHandleSet; class SelectableControlPoint; +} +} + +namespace __gnu_cxx { +template<> +struct hash { + size_t operator()(Inkscape::UI::SelectableControlPoint *p) const { + return reinterpret_cast(p); + } +}; +} // namespace __gnu_cxx + +namespace Inkscape { +namespace UI { class ControlPointSelection : public Manipulator { public: ControlPointSelection(SPDesktop *d, SPCanvasGroup *th_group); ~ControlPointSelection(); typedef std::list connlist_type; - typedef std::unordered_map< SelectableControlPoint *, + typedef std::hash_map< SelectableControlPoint *, boost::shared_ptr > map_type; - typedef std::unordered_set< SelectableControlPoint * > set_type; + typedef std::hash_set< SelectableControlPoint * > set_type; typedef set_type Set; // convenience alias typedef map_type::iterator iterator; -- cgit v1.2.3 From 906f78949458732f138e4e2b79843c75e9d52f87 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Wed, 20 Jan 2010 20:31:57 +0100 Subject: Go back to using TR1 unordered containers to fix warnings. Add configure code to detect the broken header and display Wiki page URL. (bzr r9006) --- src/ui/tool/control-point-selection.h | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) (limited to 'src/ui/tool/control-point-selection.h') diff --git a/src/ui/tool/control-point-selection.h b/src/ui/tool/control-point-selection.h index dce685575..54d724f00 100644 --- a/src/ui/tool/control-point-selection.h +++ b/src/ui/tool/control-point-selection.h @@ -13,11 +13,8 @@ #define SEEN_UI_TOOL_NODE_SELECTION_H #include -// those are broken beyond hope on OSX. -//#include -//#include -#include -#include +#include +#include #include #include #include @@ -30,8 +27,6 @@ #include "ui/tool/commit-events.h" #include "ui/tool/manipulator.h" -namespace std { using namespace __gnu_cxx; } - class SPDesktop; namespace Inkscape { @@ -41,15 +36,6 @@ class SelectableControlPoint; } } -namespace __gnu_cxx { -template<> -struct hash { - size_t operator()(Inkscape::UI::SelectableControlPoint *p) const { - return reinterpret_cast(p); - } -}; -} // namespace __gnu_cxx - namespace Inkscape { namespace UI { @@ -58,9 +44,9 @@ public: ControlPointSelection(SPDesktop *d, SPCanvasGroup *th_group); ~ControlPointSelection(); typedef std::list connlist_type; - typedef std::hash_map< SelectableControlPoint *, + typedef std::tr1::unordered_map< SelectableControlPoint *, boost::shared_ptr > map_type; - typedef std::hash_set< SelectableControlPoint * > set_type; + typedef std::tr1::unordered_set< SelectableControlPoint * > set_type; typedef set_type Set; // convenience alias typedef map_type::iterator iterator; -- cgit v1.2.3 From 7ce8847f2410a24a6bce4ca8a43ad7ebdb4839eb Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Thu, 4 Feb 2010 03:14:09 +0100 Subject: Reduce libsigc++ usage to partially fix performance regressions in the new node tool. (bzr r9044) --- src/ui/tool/control-point-selection.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/ui/tool/control-point-selection.h') diff --git a/src/ui/tool/control-point-selection.h b/src/ui/tool/control-point-selection.h index 54d724f00..025f9bb61 100644 --- a/src/ui/tool/control-point-selection.h +++ b/src/ui/tool/control-point-selection.h @@ -44,14 +44,12 @@ public: ControlPointSelection(SPDesktop *d, SPCanvasGroup *th_group); ~ControlPointSelection(); typedef std::list connlist_type; - typedef std::tr1::unordered_map< SelectableControlPoint *, - boost::shared_ptr > map_type; typedef std::tr1::unordered_set< SelectableControlPoint * > set_type; typedef set_type Set; // convenience alias - typedef map_type::iterator iterator; - typedef map_type::const_iterator const_iterator; - typedef map_type::size_type size_type; + typedef set_type::iterator iterator; + typedef set_type::const_iterator const_iterator; + typedef set_type::size_type size_type; typedef SelectableControlPoint *value_type; typedef SelectableControlPoint *key_type; @@ -127,7 +125,7 @@ private: bool _keyboardFlip(Geom::Dim2); void _keyboardTransform(Geom::Matrix const &); void _commitTransform(CommitEvent ce); - map_type _points; + set_type _points; set_type _all_points; boost::optional _rot_radius; TransformHandleSet *_handles; -- cgit v1.2.3 From 9d9e9264afc4e6f83d59bd25ccae505eadb739d8 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Sat, 6 Feb 2010 22:45:14 +0100 Subject: Fix performance regressions in the node tool and a stupid crash bug when deleting more than one stretch of selected nodes (bzr r9061) --- src/ui/tool/control-point-selection.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/ui/tool/control-point-selection.h') diff --git a/src/ui/tool/control-point-selection.h b/src/ui/tool/control-point-selection.h index 025f9bb61..93fba56f5 100644 --- a/src/ui/tool/control-point-selection.h +++ b/src/ui/tool/control-point-selection.h @@ -15,8 +15,6 @@ #include #include #include -#include -#include #include #include #include <2geom/forward.h> @@ -43,7 +41,6 @@ class ControlPointSelection : public Manipulator { public: ControlPointSelection(SPDesktop *d, SPCanvasGroup *th_group); ~ControlPointSelection(); - typedef std::list connlist_type; typedef std::tr1::unordered_set< SelectableControlPoint * > set_type; typedef set_type Set; // convenience alias -- cgit v1.2.3 From 81f88ca0856da56bdf426cd065ff0acd3414567f Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Tue, 9 Feb 2010 03:20:18 +0100 Subject: Fix multiple minor problems in the node tool (bzr r9070) --- src/ui/tool/control-point-selection.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/ui/tool/control-point-selection.h') diff --git a/src/ui/tool/control-point-selection.h b/src/ui/tool/control-point-selection.h index 93fba56f5..48c25c285 100644 --- a/src/ui/tool/control-point-selection.h +++ b/src/ui/tool/control-point-selection.h @@ -19,6 +19,7 @@ #include #include <2geom/forward.h> #include <2geom/point.h> +#include <2geom/rect.h> #include "display/display-forward.h" #include "util/accumulators.h" #include "util/hash.h" @@ -96,6 +97,7 @@ public: Geom::OptRect pointwiseBounds(); Geom::OptRect bounds(); + bool transformHandlesEnabled() { return _handles_visible; } void showTransformHandles(bool v, bool one_node); // the two methods below do not modify the state; they are for use in manipulators // that need to temporarily hide the handles, for example when moving a node @@ -114,17 +116,24 @@ private: void _pointDragged(Geom::Point const &, Geom::Point &, GdkEventMotion *); void _pointUngrabbed(); bool _pointClicked(SelectableControlPoint *, GdkEventButton *); + void _pointChanged(SelectableControlPoint *, bool); + void _mouseoverChanged(); void _updateTransformHandles(bool preserve_center); + void _updateBounds(); bool _keyboardMove(GdkEventKey const &, Geom::Point const &); bool _keyboardRotate(GdkEventKey const &, int); bool _keyboardScale(GdkEventKey const &, int); bool _keyboardFlip(Geom::Dim2); void _keyboardTransform(Geom::Matrix const &); - void _commitTransform(CommitEvent ce); + void _commitHandlesTransform(CommitEvent ce); + double _rotationRadius(Geom::Point const &); + set_type _points; set_type _all_points; boost::optional _rot_radius; + boost::optional _mouseover_rot_radius; + Geom::OptRect _bounds; TransformHandleSet *_handles; SelectableControlPoint *_grabbed_point; unsigned _dragging : 1; -- cgit v1.2.3 From 0fd4ff04adaf544d34a58b62e8fc9d9a9f06534a Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Thu, 18 Feb 2010 01:22:55 +0100 Subject: Make ControlPointSelection trackable to prevent random crashes in the node tool (bzr r9095) --- src/ui/tool/control-point-selection.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/tool/control-point-selection.h') diff --git a/src/ui/tool/control-point-selection.h b/src/ui/tool/control-point-selection.h index 48c25c285..d982d6bec 100644 --- a/src/ui/tool/control-point-selection.h +++ b/src/ui/tool/control-point-selection.h @@ -38,7 +38,7 @@ class SelectableControlPoint; namespace Inkscape { namespace UI { -class ControlPointSelection : public Manipulator { +class ControlPointSelection : public Manipulator, public sigc::trackable { public: ControlPointSelection(SPDesktop *d, SPCanvasGroup *th_group); ~ControlPointSelection(); -- cgit v1.2.3 From 84fc09c9c921a31ac826c53e419d4ea61584f8a9 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Tue, 2 Mar 2010 23:52:32 +0100 Subject: Use Boost unordeed containers instead of TR1 to minimize pain when using Apple compilers. (bzr r9129) --- src/ui/tool/control-point-selection.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/ui/tool/control-point-selection.h') diff --git a/src/ui/tool/control-point-selection.h b/src/ui/tool/control-point-selection.h index d982d6bec..dde9ef218 100644 --- a/src/ui/tool/control-point-selection.h +++ b/src/ui/tool/control-point-selection.h @@ -13,16 +13,14 @@ #define SEEN_UI_TOOL_NODE_SELECTION_H #include -#include -#include #include +#include #include #include <2geom/forward.h> #include <2geom/point.h> #include <2geom/rect.h> #include "display/display-forward.h" #include "util/accumulators.h" -#include "util/hash.h" #include "ui/tool/commit-events.h" #include "ui/tool/manipulator.h" @@ -42,7 +40,7 @@ class ControlPointSelection : public Manipulator, public sigc::trackable { public: ControlPointSelection(SPDesktop *d, SPCanvasGroup *th_group); ~ControlPointSelection(); - typedef std::tr1::unordered_set< SelectableControlPoint * > set_type; + typedef boost::unordered_set< SelectableControlPoint * > set_type; typedef set_type Set; // convenience alias typedef set_type::iterator iterator; -- cgit v1.2.3 From 7f5277e2c7722d2375fc7108f8d3b796f26aaccd Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Wed, 3 Mar 2010 01:10:54 +0100 Subject: Node tool: implement sculpting (bzr r9131) --- src/ui/tool/control-point-selection.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/ui/tool/control-point-selection.h') diff --git a/src/ui/tool/control-point-selection.h b/src/ui/tool/control-point-selection.h index dde9ef218..b3c2f422b 100644 --- a/src/ui/tool/control-point-selection.h +++ b/src/ui/tool/control-point-selection.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #include <2geom/forward.h> #include <2geom/point.h> @@ -110,8 +111,8 @@ private: // The functions below are invoked from SelectableControlPoint. // Previously they were connected to handlers when selecting, but this // creates problems when dragging a point that was not selected. - void _pointGrabbed(); - void _pointDragged(Geom::Point const &, Geom::Point &, GdkEventMotion *); + void _pointGrabbed(SelectableControlPoint *); + void _pointDragged(Geom::Point &, GdkEventMotion *); void _pointUngrabbed(); bool _pointClicked(SelectableControlPoint *, GdkEventButton *); void _pointChanged(SelectableControlPoint *, bool); @@ -129,11 +130,12 @@ private: set_type _points; set_type _all_points; + boost::unordered_map _original_positions; boost::optional _rot_radius; boost::optional _mouseover_rot_radius; Geom::OptRect _bounds; TransformHandleSet *_handles; - SelectableControlPoint *_grabbed_point; + SelectableControlPoint *_grabbed_point, *_farthest_point; unsigned _dragging : 1; unsigned _handles_visible : 1; unsigned _one_node_handles : 1; -- cgit v1.2.3 From 46fd0e8c49da44226151096546905589819bbdf5 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Thu, 4 Mar 2010 00:44:53 -0800 Subject: Fixing build breakage with more proper autoconf usage. (bzr r9138) --- src/ui/tool/control-point-selection.h | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'src/ui/tool/control-point-selection.h') diff --git a/src/ui/tool/control-point-selection.h b/src/ui/tool/control-point-selection.h index b3c2f422b..6efb63b67 100644 --- a/src/ui/tool/control-point-selection.h +++ b/src/ui/tool/control-point-selection.h @@ -14,8 +14,7 @@ #include #include -#include -#include +#include "util/set-types.h" #include #include <2geom/forward.h> #include <2geom/point.h> @@ -34,6 +33,17 @@ class SelectableControlPoint; } } +#ifdef USE_GNU_HASHES +namespace __gnu_cxx { +template<> +struct hash { + size_t operator()(Inkscape::UI::SelectableControlPoint *p) const { + return reinterpret_cast(p); + } +}; +} // namespace __gnu_cxx +#endif // USE_GNU_HASHES + namespace Inkscape { namespace UI { @@ -41,7 +51,7 @@ class ControlPointSelection : public Manipulator, public sigc::trackable { public: ControlPointSelection(SPDesktop *d, SPCanvasGroup *th_group); ~ControlPointSelection(); - typedef boost::unordered_set< SelectableControlPoint * > set_type; + typedef optim_set< SelectableControlPoint * > set_type; typedef set_type Set; // convenience alias typedef set_type::iterator iterator; @@ -76,7 +86,9 @@ public: void erase(iterator first, iterator last); // find - iterator find(const key_type &k) { return _points.find(k); } + iterator find(const key_type &k) { + return _points.find(k); + } // Sometimes it is very useful to keep a list of all selectable points. set_type const &allPoints() const { return _all_points; } @@ -130,7 +142,7 @@ private: set_type _points; set_type _all_points; - boost::unordered_map _original_positions; + optim_map _original_positions; boost::optional _rot_radius; boost::optional _mouseover_rot_radius; Geom::OptRect _bounds; -- cgit v1.2.3 From 91b1b6cec4776d8c2e48b54e16d698abcea6bbfe Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Thu, 4 Mar 2010 22:54:38 +0100 Subject: Clean up the unordered containers fix. (bzr r9142) --- src/ui/tool/control-point-selection.h | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'src/ui/tool/control-point-selection.h') diff --git a/src/ui/tool/control-point-selection.h b/src/ui/tool/control-point-selection.h index 6efb63b67..514ecb2e3 100644 --- a/src/ui/tool/control-point-selection.h +++ b/src/ui/tool/control-point-selection.h @@ -14,13 +14,13 @@ #include #include -#include "util/set-types.h" #include #include <2geom/forward.h> #include <2geom/point.h> #include <2geom/rect.h> #include "display/display-forward.h" #include "util/accumulators.h" +#include "util/unordered-containers.h" #include "ui/tool/commit-events.h" #include "ui/tool/manipulator.h" @@ -33,17 +33,6 @@ class SelectableControlPoint; } } -#ifdef USE_GNU_HASHES -namespace __gnu_cxx { -template<> -struct hash { - size_t operator()(Inkscape::UI::SelectableControlPoint *p) const { - return reinterpret_cast(p); - } -}; -} // namespace __gnu_cxx -#endif // USE_GNU_HASHES - namespace Inkscape { namespace UI { @@ -51,7 +40,7 @@ class ControlPointSelection : public Manipulator, public sigc::trackable { public: ControlPointSelection(SPDesktop *d, SPCanvasGroup *th_group); ~ControlPointSelection(); - typedef optim_set< SelectableControlPoint * > set_type; + typedef INK_UNORDERED_SET set_type; typedef set_type Set; // convenience alias typedef set_type::iterator iterator; @@ -142,7 +131,7 @@ private: set_type _points; set_type _all_points; - optim_map _original_positions; + INK_UNORDERED_MAP _original_positions; boost::optional _rot_radius; boost::optional _mouseover_rot_radius; Geom::OptRect _bounds; -- cgit v1.2.3