From: Krzysztof KosiƄski Date: Thu, 14 Jan 2010 22:38:54 +0000 (+0100) Subject: Replace std::tr1::unordered_(map|set) with __gnu_cxx::hash_(map|set), X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=de4c26a5923c9f2e707ac8aa9bf4d395fa214aac;p=inkscape.git Replace std::tr1::unordered_(map|set) with __gnu_cxx::hash_(map|set), to work around broken headers in some GCC versions. --- diff --git a/src/libnrtype/FontFactory.cpp b/src/libnrtype/FontFactory.cpp index a63f70d75..afce4d849 100644 --- a/src/libnrtype/FontFactory.cpp +++ b/src/libnrtype/FontFactory.cpp @@ -26,10 +26,11 @@ /* Freetype2 */ # include -#include +//#include +#include -typedef std::tr1::unordered_map FaceMapType; +typedef __gnu_cxx::hash_map FaceMapType; // need to avoid using the size field size_t font_descr_hash::operator()( PangoFontDescription *const &x) const { diff --git a/src/libnrtype/FontInstance.cpp b/src/libnrtype/FontInstance.cpp index 6b0725b34..8b8eb8bbe 100644 --- a/src/libnrtype/FontInstance.cpp +++ b/src/libnrtype/FontInstance.cpp @@ -29,7 +29,8 @@ # include FT_TRUETYPE_TABLES_H # include -#include +//#include +#include // the various raster_font in use at a given time are held in a hash_map whose indices are the @@ -43,7 +44,7 @@ struct font_style_equal : public std::binary_function StyleMap; +typedef __gnu_cxx::hash_map StyleMap; diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index 90fc85757..0c58a05f4 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -113,7 +113,7 @@ static char const preferences_skeleton[] = " font_sample=\"AaBbCcIiPpQq12369$\342\202\254\302\242?.;/()\"\n" " show_sample_in_list=\"1\"\n" " style=\"fill:black;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;font-style:normal;font-weight:normal;font-size:40px;\" selcue=\"1\"/>\n" -" \n" +" \n" " \n" " \n" " \n" 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; diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp index 3ae7e4d24..818bdaedc 100644 --- a/src/ui/tool/multi-path-manipulator.cpp +++ b/src/ui/tool/multi-path-manipulator.cpp @@ -8,7 +8,8 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include +//#include +#include #include #include #include @@ -25,7 +26,16 @@ #include "ui/tool/multi-path-manipulator.h" #include "ui/tool/path-manipulator.h" -namespace std { using namespace tr1; } +namespace std { using namespace __gnu_cxx; } + +namespace __gnu_cxx { +template<> +struct hash { + size_t operator()(Inkscape::UI::NodeList::iterator const &n) const { + return reinterpret_cast(n.ptr()); + } +}; +} namespace Inkscape { namespace UI { @@ -33,7 +43,7 @@ namespace UI { namespace { typedef std::pair IterPair; typedef std::vector IterPairList; -typedef std::unordered_set IterSet; +typedef std::hash_set IterSet; typedef std::multimap DistanceMap; typedef std::pair DistanceMapItem; diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 9889eb787..9eabd8992 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1157,17 +1157,24 @@ bool PathManipulator::_nodeClicked(Node *n, GdkEventButton *event) { // cycle between node types on ctrl+click if (event->button != 1 || !held_control(*event)) return false; - if (n->isEndNode()) { - if (n->type() == NODE_CUSP) { - n->setType(NODE_SMOOTH); + /*if (held_alt(*event)) { + // TODO delete nodes with Ctrl+Alt+click + n->list()->erase(NodeList::get_iterator(n)); + update(); + _commit(_("Delete node")); + } else*/ { + if (n->isEndNode()) { + if (n->type() == NODE_CUSP) { + n->setType(NODE_SMOOTH); + } else { + n->setType(NODE_CUSP); + } } else { - n->setType(NODE_CUSP); + n->setType(static_cast((n->type() + 1) % NODE_LAST_REAL_TYPE)); } - } else { - n->setType(static_cast((n->type() + 1) % NODE_LAST_REAL_TYPE)); + update(); + _commit(_("Cycle node type")); } - update(); - _commit(_("Cycle node type")); return true; } diff --git a/src/util/hash.h b/src/util/hash.h index d5abeff5a..33af9222d 100644 --- a/src/util/hash.h +++ b/src/util/hash.h @@ -13,8 +13,7 @@ #include -namespace std { -namespace tr1 { +namespace __gnu_cxx { /** Hash function for Boost shared pointers */ template @@ -24,8 +23,7 @@ struct hash< boost::shared_ptr > : public std::unary_function