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 From af4950e7c9ceb863e8daba3928eca71e33234dae Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Sun, 31 Oct 2010 22:22:56 +0100 Subject: Only create / delete shape editors in the node tool when necessary. (bzr r9868) --- src/ui/tool/node-tool.cpp | 27 +++++++++++++++------------ 1 file changed, 15 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 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::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(r.item), si); } } -- cgit v1.2.3 From 144819c918dc761641c3cb5a490205fb73194ee3 Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Wed, 17 Nov 2010 13:12:56 +1100 Subject: Super duper mega (fun!) commit: replaced encoding=utf-8 with fileencoding=utf-8 in all 1074 Vim modelines. The reason for this is that (a) setting the encoding isn't nice, and (b) Vim 7.3 (with modeline enabled) disallows it and pops up an error whenever you open any file with it ("invalid modeline"). Also corrected five deviant modestrings: * src/ui/widget/dock.cpp and src/ui/widget/dock.h: missing colon at the end * src/ui/dialog/tile.cpp: removed gratuitous second colon at the end * src/helper/units-test.h: removed gratuitous space before a colon * share/extensions/export_gimp_palette.py: missing textwidth=99 That's my geekiest commit yet. (bzr r9900) --- src/ui/tool/node-tool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (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 b573ff3e3..57e57b711 100644 --- a/src/ui/tool/node-tool.cpp +++ b/src/ui/tool/node-tool.cpp @@ -662,4 +662,4 @@ void ink_node_tool_mouseover_changed(InkNodeTool *nt, Inkscape::UI::ControlPoint fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : -- cgit v1.2.3 From a6d9d1d88e4a31033d0a96bf2d9f7e93cbdf4534 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Thu, 18 Nov 2010 19:10:22 +0100 Subject: Fix four minor node tool regressions: * Inverted modifier for spatial/linear grow * PgDn/PgUp keyboard shortcuts for grow * Shift during drag disables snapping * Clicking on the background deselects first the nodes and then the path Fixed bugs: - https://launchpad.net/bugs/647498 - https://launchpad.net/bugs/588628 (bzr r9904) --- src/ui/tool/node-tool.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 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 57e57b711..8008d79eb 100644 --- a/src/ui/tool/node-tool.cpp +++ b/src/ui/tool/node-tool.cpp @@ -619,8 +619,14 @@ void ink_node_tool_select_point(InkNodeTool *nt, Geom::Point const &/*sel*/, Gdk if (item_clicked == NULL) { // nothing under cursor // if no Shift, deselect - if (!(event->state & GDK_SHIFT_MASK)) { - selection->clear(); + // if there are nodes selected, the first click should deselect the nodes + // and the second should deselect the items + if (!state_held_shift(event->state)) { + if (nt->_selected_nodes->empty()) { + selection->clear(); + } else { + nt->_selected_nodes->clear(); + } } } else { if (held_shift(*event)) { -- cgit v1.2.3