From 79286f0636cf258c4dcf0b465b6c1445ce0124cb Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Sun, 31 Oct 2010 19:26:58 +0100 Subject: Fix pattern editing in the node editor. As a bonus, allow editing of more than one non-path shape at once. (bzr r9867) --- src/ui/tool/node-tool.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'src/ui/tool/node-tool.cpp') 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::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); -- cgit v1.2.3