diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2010-10-31 21:22:56 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2010-10-31 21:22:56 +0000 |
| commit | af4950e7c9ceb863e8daba3928eca71e33234dae (patch) | |
| tree | 75af2dd3fca698dfa59d42f0fbb4406fac8760a4 /src | |
| parent | Fix pattern editing in the node editor. As a bonus, allow editing (diff) | |
| download | inkscape-af4950e7c9ceb863e8daba3928eca71e33234dae.tar.gz inkscape-af4950e7c9ceb863e8daba3928eca71e33234dae.zip | |
Only create / delete shape editors in the node tool when necessary.
(bzr r9868)
Diffstat (limited to 'src')
| -rw-r--r-- | src/ui/tool/node-tool.cpp | 27 | ||||
| -rw-r--r-- | src/ui/tool/node-tool.h | 4 |
2 files changed, 17 insertions, 14 deletions
diff --git a/src/ui/tool/node-tool.cpp b/src/ui/tool/node-tool.cpp index f2b2426ae..b573ff3e3 100644 --- a/src/ui/tool/node-tool.cpp +++ b/src/ui/tool/node-tool.cpp @@ -25,6 +25,7 @@ #include "sp-mask.h" #include "sp-object-group.h" #include "sp-path.h" +#include "sp-text.h" #include "ui/tool/node-tool.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/curve-drag-point.h" @@ -197,10 +198,6 @@ void ink_node_tool_dispose(GObject *object) if (nt->_node_message_context) { delete nt->_node_message_context; } - if (nt->shape_editor) { - nt->shape_editor->unset_item(SH_KNOTHOLDER); - delete nt->shape_editor; - } G_OBJECT_CLASS(g_type_class_peek(g_type_parent(INK_TYPE_NODE_TOOL)))->dispose(object); } @@ -283,9 +280,6 @@ void ink_node_tool_setup(SPEventContext *ec) nt->flash_tempitem = NULL; nt->flashed_item = NULL; nt->_last_over = NULL; - // TODO long term, fold ShapeEditor into MultiPathManipulator and rename MPM - // to something better - //nt->shape_editor = new ShapeEditor(nt->desktop); // read prefs before adding items to selection to prevent momentarily showing the outline sp_event_context_read(nt, "show_handles"); @@ -405,19 +399,28 @@ void ink_node_tool_selection_changed(InkNodeTool *nt, Inkscape::Selection *sel) } } - nt->_shape_editors.clear(); - // use multiple ShapeEditors for now, to allow editing many shapes at once // needs to be rethought + for (ShapeEditors::iterator i = nt->_shape_editors.begin(); + i != nt->_shape_editors.end(); ) + { + ShapeRecord s; + s.item = i->first; + if (shapes.find(s) == shapes.end()) { + nt->_shape_editors.erase(i++); + } else { + ++i; + } + } for (std::set<ShapeRecord>::iterator i = shapes.begin(); i != shapes.end(); ++i) { ShapeRecord const &r = *i; - if (SP_IS_SHAPE(r.item)) + if ((SP_IS_SHAPE(r.item) || SP_IS_TEXT(r.item)) && + nt->_shape_editors.find(r.item) == nt->_shape_editors.end()) { ShapeEditor *si = new ShapeEditor(nt->desktop); si->set_item(r.item, SH_KNOTHOLDER); - nt->_shape_editors.push_back(si); - //nt->shape_editor->set_item(r.item, SH_KNOTHOLDER); + nt->_shape_editors.insert(const_cast<SPItem*&>(r.item), si); } } diff --git a/src/ui/tool/node-tool.h b/src/ui/tool/node-tool.h index 11652b535..39d04a183 100644 --- a/src/ui/tool/node-tool.h +++ b/src/ui/tool/node-tool.h @@ -12,7 +12,7 @@ #define SEEN_UI_TOOL_NODE_TOOL_H #include <memory> -#include <boost/ptr_container/ptr_vector.hpp> +#include <boost/ptr_container/ptr_map.hpp> #include <glib.h> #include <sigc++/sigc++.h> #include "event-context.h" @@ -42,7 +42,7 @@ typedef std::auto_ptr<Inkscape::UI::MultiPathManipulator> MultiPathPtr; typedef std::auto_ptr<Inkscape::UI::ControlPointSelection> CSelPtr; typedef std::auto_ptr<Inkscape::UI::Selector> SelectorPtr; typedef std::auto_ptr<Inkscape::UI::PathSharedData> PathSharedDataPtr; -typedef boost::ptr_vector<ShapeEditor> ShapeEditors; +typedef boost::ptr_map<SPItem*, ShapeEditor> ShapeEditors; struct InkNodeTool : public SPEventContext { |
