diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2010-10-31 18:26:58 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2010-10-31 18:26:58 +0000 |
| commit | 79286f0636cf258c4dcf0b465b6c1445ce0124cb (patch) | |
| tree | 529516639de95fa03cccf4e7d63a07d786477ef2 /src | |
| parent | - Constrained snap: proper implementation of the preference to snap the mouse... (diff) | |
| download | inkscape-79286f0636cf258c4dcf0b465b6c1445ce0124cb.tar.gz inkscape-79286f0636cf258c4dcf0b465b6c1445ce0124cb.zip | |
Fix pattern editing in the node editor. As a bonus, allow editing
of more than one non-path shape at once.
(bzr r9867)
Diffstat (limited to 'src')
| -rw-r--r-- | src/ui/tool/node-tool.cpp | 25 | ||||
| -rw-r--r-- | src/ui/tool/node-tool.h | 3 |
2 files changed, 16 insertions, 12 deletions
diff --git a/src/ui/tool/node-tool.cpp b/src/ui/tool/node-tool.cpp index 450ca96f0..f2b2426ae 100644 --- a/src/ui/tool/node-tool.cpp +++ b/src/ui/tool/node-tool.cpp @@ -164,6 +164,7 @@ void ink_node_tool_init(InkNodeTool *nt) new (&nt->_multipath) MultiPathPtr(); new (&nt->_selector) SelectorPtr(); new (&nt->_path_data) PathSharedDataPtr(); + new (&nt->_shape_editors) ShapeEditors(); } void ink_node_tool_dispose(GObject *object) @@ -178,6 +179,7 @@ void ink_node_tool_dispose(GObject *object) nt->_multipath.~MultiPathPtr(); nt->_selected_nodes.~CSelPtr(); nt->_selector.~SelectorPtr(); + nt->_shape_editors.~ShapeEditors(); Inkscape::UI::PathSharedData &data = *nt->_path_data; destroy_group(data.node_data.node_group); @@ -283,7 +285,7 @@ void ink_node_tool_setup(SPEventContext *ec) nt->_last_over = NULL; // TODO long term, fold ShapeEditor into MultiPathManipulator and rename MPM // to something better - nt->shape_editor = new ShapeEditor(nt->desktop); + //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"); @@ -403,22 +405,21 @@ void ink_node_tool_selection_changed(InkNodeTool *nt, Inkscape::Selection *sel) } } - // ugly hack: set the first editable non-path item for knotholder - // maybe use multiple ShapeEditors for now, to allow editing many shapes at once? - bool something_set = false; + nt->_shape_editors.clear(); + + // use multiple ShapeEditors for now, to allow editing many shapes at once + // needs to be rethought + for (std::set<ShapeRecord>::iterator i = shapes.begin(); i != shapes.end(); ++i) { ShapeRecord const &r = *i; - if (SP_IS_SHAPE(r.item) || - (SP_IS_PATH(r.item) && r.item->repr->attribute("inkscape:original-d") != NULL)) + if (SP_IS_SHAPE(r.item)) { - nt->shape_editor->set_item(r.item, SH_KNOTHOLDER); - something_set = true; - break; + 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); } } - if (!something_set) { - nt->shape_editor->unset_item(SH_KNOTHOLDER); - } nt->_multipath->setItems(shapes); ink_node_tool_update_tip(nt, NULL); diff --git a/src/ui/tool/node-tool.h b/src/ui/tool/node-tool.h index 641d064c1..11652b535 100644 --- a/src/ui/tool/node-tool.h +++ b/src/ui/tool/node-tool.h @@ -12,6 +12,7 @@ #define SEEN_UI_TOOL_NODE_TOOL_H #include <memory> +#include <boost/ptr_container/ptr_vector.hpp> #include <glib.h> #include <sigc++/sigc++.h> #include "event-context.h" @@ -41,6 +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; struct InkNodeTool : public SPEventContext { @@ -56,6 +58,7 @@ struct InkNodeTool : public SPEventContext PathSharedDataPtr _path_data; SPCanvasGroup *_transform_handle_group; SPItem *_last_over; + ShapeEditors _shape_editors; unsigned cursor_drag : 1; unsigned show_handles : 1; |
