From 1636c1dd1651780d01759676b194312529f211f7 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Sat, 25 Jun 2016 22:24:26 +0200 Subject: Moved next functions, added namespace, renamed range functions (bzr r14954.1.10) --- src/ui/tools/node-tool.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui/tools/node-tool.cpp') diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index 23aaf6bb1..f7a725794 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -407,7 +407,7 @@ void NodeTool::selection_changed(Inkscape::Selection *sel) { std::set shapes; - std::vector items=sel->itemList(); + std::vector items= sel->items(); for(std::vector::const_iterator i=items.begin();i!=items.end();++i){ SPObject *obj = *i; @@ -444,7 +444,7 @@ void NodeTool::selection_changed(Inkscape::Selection *sel) { } _previous_selection = _current_selection; - _current_selection = sel->itemList(); + _current_selection = sel->items(); this->_multipath->setItems(shapes); this->update_tip(NULL); -- cgit v1.2.3 From 9e210a6d1333c3366681547e3e81593ef69ff73e Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 14 Jul 2016 12:56:49 +0200 Subject: Last part of new SPObject children list (bzr r14954.1.20) --- src/ui/tools/node-tool.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui/tools/node-tool.cpp') diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index 736dafa50..3dfac5e3d 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -378,8 +378,8 @@ void gather_items(NodeTool *nt, SPItem *base, SPObject *obj, Inkscape::UI::Shape r.role = role; s.insert(r); } else if (role != SHAPE_ROLE_NORMAL && (SP_IS_GROUP(obj) || SP_IS_OBJECTGROUP(obj))) { - for (SPObject *c = obj->children; c; c = c->next) { - gather_items(nt, base, c, role, s); + for (auto& c: obj->_children) { + gather_items(nt, base, &c, role, s); } } else if (SP_IS_ITEM(obj)) { SPItem *item = static_cast(obj); -- cgit v1.2.3 From 24d3f50003ca3cec6a03a7f5267cc4fe5588c69f Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 14 Jul 2016 13:17:21 +0200 Subject: Renamed children list in SPObject (bzr r14954.1.21) --- src/ui/tools/node-tool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/tools/node-tool.cpp') diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index 3dfac5e3d..87b7bf7e3 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -378,7 +378,7 @@ void gather_items(NodeTool *nt, SPItem *base, SPObject *obj, Inkscape::UI::Shape r.role = role; s.insert(r); } else if (role != SHAPE_ROLE_NORMAL && (SP_IS_GROUP(obj) || SP_IS_OBJECTGROUP(obj))) { - for (auto& c: obj->_children) { + for (auto& c: obj->children) { gather_items(nt, base, &c, role, s); } } else if (SP_IS_ITEM(obj)) { -- cgit v1.2.3 From f35bb1f74a0ffeb5c6477a25e3c4cde87a97bcf1 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 28 Jul 2016 12:06:06 +0200 Subject: Removed unused includes, decrease compilation time (bzr r15025) --- src/ui/tools/node-tool.cpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src/ui/tools/node-tool.cpp') diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index 23aaf6bb1..bf18d4a2e 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -24,25 +24,19 @@ #include "message-context.h" #include "selection.h" #include "ui/shape-editor.h" // temporary! -#include "live_effects/effect.h" -#include "display/curve.h" #include "snap.h" #include "sp-namedview.h" #include "sp-clippath.h" #include "sp-item-group.h" #include "sp-mask.h" -#include "sp-object-group.h" -#include "sp-path.h" #include "sp-text.h" #include "ui/control-manager.h" #include "ui/tools/node-tool.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/event-utils.h" -#include "ui/tool/manipulator.h" #include "ui/tool/multi-path-manipulator.h" #include "ui/tool/path-manipulator.h" #include "ui/tool/selector.h" -#include "ui/tool/shape-record.h" #include "pixmaps/cursor-node.xpm" #include "pixmaps/cursor-node-d.xpm" -- cgit v1.2.3 From 43b49e325db73cc19b1731db6c69545664ee8fbe Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 28 Jul 2016 13:26:17 +0200 Subject: Reverted changes to r15024 after many building problems (bzr r15027) --- src/ui/tools/node-tool.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/ui/tools/node-tool.cpp') diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index bf18d4a2e..23aaf6bb1 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -24,19 +24,25 @@ #include "message-context.h" #include "selection.h" #include "ui/shape-editor.h" // temporary! +#include "live_effects/effect.h" +#include "display/curve.h" #include "snap.h" #include "sp-namedview.h" #include "sp-clippath.h" #include "sp-item-group.h" #include "sp-mask.h" +#include "sp-object-group.h" +#include "sp-path.h" #include "sp-text.h" #include "ui/control-manager.h" #include "ui/tools/node-tool.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/event-utils.h" +#include "ui/tool/manipulator.h" #include "ui/tool/multi-path-manipulator.h" #include "ui/tool/path-manipulator.h" #include "ui/tool/selector.h" +#include "ui/tool/shape-record.h" #include "pixmaps/cursor-node.xpm" #include "pixmaps/cursor-node-d.xpm" -- cgit v1.2.3 From 35830f456cadaecf8b8e3944e3031a1a93f6cb41 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 3 Aug 2016 15:29:38 +0200 Subject: Removed unused includes, decreased compilation time. Once again (bzr r15034) --- src/ui/tools/node-tool.cpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src/ui/tools/node-tool.cpp') diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index 23aaf6bb1..bf18d4a2e 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -24,25 +24,19 @@ #include "message-context.h" #include "selection.h" #include "ui/shape-editor.h" // temporary! -#include "live_effects/effect.h" -#include "display/curve.h" #include "snap.h" #include "sp-namedview.h" #include "sp-clippath.h" #include "sp-item-group.h" #include "sp-mask.h" -#include "sp-object-group.h" -#include "sp-path.h" #include "sp-text.h" #include "ui/control-manager.h" #include "ui/tools/node-tool.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/event-utils.h" -#include "ui/tool/manipulator.h" #include "ui/tool/multi-path-manipulator.h" #include "ui/tool/path-manipulator.h" #include "ui/tool/selector.h" -#include "ui/tool/shape-record.h" #include "pixmaps/cursor-node.xpm" #include "pixmaps/cursor-node-d.xpm" -- cgit v1.2.3 From e1a84ff6c44588f7847258b5eb5266365e0738e1 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 29 Aug 2016 15:27:55 +0200 Subject: Fixes to helper paths. evaluate backport to 0.92.x (bzr r15086) --- src/ui/tools/node-tool.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/ui/tools/node-tool.cpp') diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index f7f09610c..99c98476f 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -158,6 +158,9 @@ NodeTool::~NodeTool() { if (this->helperpath_tmpitem) { this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem); } + if (this->helperpath_tmpitem_highlight) { + this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem_highlight); + } this->_selection_changed_connection.disconnect(); //this->_selection_modified_connection.disconnect(); this->_mouseover_changed_connection.disconnect(); @@ -238,13 +241,13 @@ void NodeTool::setup() { ); this->helperpath_tmpitem = NULL; + this->helperpath_tmpitem_highlight = NULL; this->cursor_drag = false; this->show_transform_handles = true; this->single_node_transform_handles = false; this->flash_tempitem = NULL; this->flashed_item = NULL; this->_last_over = NULL; - this->helperpath_tmpitem = NULL; // read prefs before adding items to selection to prevent momentarily showing the outline sp_event_context_read(this, "show_handles"); @@ -271,7 +274,7 @@ void NodeTool::setup() { } this->desktop->emitToolSubselectionChanged(NULL); // sets the coord entry fields to inactive - this->update_helperpath(); + update_helperpath(); } // show helper paths of the applied LPE, if any @@ -282,6 +285,10 @@ void NodeTool::update_helperpath () { this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem); this->helperpath_tmpitem = NULL; } + if (this->helperpath_tmpitem_highlight) { + this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem_highlight); + this->helperpath_tmpitem_highlight = NULL; + } if (SP_IS_LPE_ITEM(selection->singleItem())) { Inkscape::LivePathEffect::Effect *lpe = SP_LPE_ITEM(selection->singleItem())->getCurrentLPE(); @@ -305,6 +312,11 @@ void NodeTool::update_helperpath () { cc->reset(); } if (!c->is_empty()) { + SPCanvasItem *helperpath_highlight = sp_canvas_bpath_new(this->desktop->getTempGroup(), c); + sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(helperpath_highlight), 0xffffff9A, 2.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); + sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(helperpath_highlight), 0, SP_WIND_RULE_NONZERO); + sp_canvas_item_affine_absolute(helperpath_highlight, selection->singleItem()->i2dt_affine()); + this->helperpath_tmpitem_highlight = this->desktop->add_temporary_canvasitem(helperpath_highlight, 0); SPCanvasItem *helperpath = sp_canvas_bpath_new(this->desktop->getTempGroup(), c); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(helperpath), 0x0000ff9A, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(helperpath), 0, SP_WIND_RULE_NONZERO); @@ -468,13 +480,10 @@ bool NodeTool::root_handler(GdkEvent* event) { if (this->_selected_nodes->event(this, event)) { return true; } - switch (event->type) { case GDK_MOTION_NOTIFY: { - this->update_helperpath(); combine_motion_events(desktop->canvas, event->motion, 0); - this->update_helperpath(); SPItem *over_item = sp_event_context_find_item (desktop, event_point(event->button), FALSE, TRUE); @@ -629,7 +638,6 @@ bool NodeTool::root_handler(GdkEvent* event) { void NodeTool::update_tip(GdkEvent *event) { using namespace Inkscape::UI; - if (event && (event->type == GDK_KEY_PRESS || event->type == GDK_KEY_RELEASE)) { unsigned new_state = state_after_event(event); -- cgit v1.2.3 From 3a70c702b97414c4508c6871462d1fa4f1433ad7 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 29 Aug 2016 18:15:30 +0200 Subject: Add comment and fix in helper paths (bzr r15087) --- src/ui/tools/node-tool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/tools/node-tool.cpp') diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index 99c98476f..c266db05c 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -274,7 +274,7 @@ void NodeTool::setup() { } this->desktop->emitToolSubselectionChanged(NULL); // sets the coord entry fields to inactive - update_helperpath(); + this->update_helperpath(); } // show helper paths of the applied LPE, if any -- cgit v1.2.3 From 1b8b972f1e0d6ee32c1f85514ec334c654d1e29c Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 29 Aug 2016 22:39:07 +0200 Subject: Partial fix for bug 172063 while we find a better solution for XOR in helper lines (bzr r15090) --- src/ui/tools/node-tool.cpp | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'src/ui/tools/node-tool.cpp') diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index c266db05c..b4fc569bb 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -158,9 +158,6 @@ NodeTool::~NodeTool() { if (this->helperpath_tmpitem) { this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem); } - if (this->helperpath_tmpitem_highlight) { - this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem_highlight); - } this->_selection_changed_connection.disconnect(); //this->_selection_modified_connection.disconnect(); this->_mouseover_changed_connection.disconnect(); @@ -241,7 +238,6 @@ void NodeTool::setup() { ); this->helperpath_tmpitem = NULL; - this->helperpath_tmpitem_highlight = NULL; this->cursor_drag = false; this->show_transform_handles = true; this->single_node_transform_handles = false; @@ -285,10 +281,6 @@ void NodeTool::update_helperpath () { this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem); this->helperpath_tmpitem = NULL; } - if (this->helperpath_tmpitem_highlight) { - this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem_highlight); - this->helperpath_tmpitem_highlight = NULL; - } if (SP_IS_LPE_ITEM(selection->singleItem())) { Inkscape::LivePathEffect::Effect *lpe = SP_LPE_ITEM(selection->singleItem())->getCurrentLPE(); @@ -312,12 +304,7 @@ void NodeTool::update_helperpath () { cc->reset(); } if (!c->is_empty()) { - SPCanvasItem *helperpath_highlight = sp_canvas_bpath_new(this->desktop->getTempGroup(), c); - sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(helperpath_highlight), 0xffffff9A, 2.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); - sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(helperpath_highlight), 0, SP_WIND_RULE_NONZERO); - sp_canvas_item_affine_absolute(helperpath_highlight, selection->singleItem()->i2dt_affine()); - this->helperpath_tmpitem_highlight = this->desktop->add_temporary_canvasitem(helperpath_highlight, 0); - SPCanvasItem *helperpath = sp_canvas_bpath_new(this->desktop->getTempGroup(), c); + SPCanvasItem *helperpath = sp_canvas_bpath_new(this->desktop->getTempGroup(), c, true); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(helperpath), 0x0000ff9A, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(helperpath), 0, SP_WIND_RULE_NONZERO); sp_canvas_item_affine_absolute(helperpath, selection->singleItem()->i2dt_affine()); -- cgit v1.2.3 From 5cb8c080df223593fbae945178da3e500fe762c6 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 29 Aug 2016 23:13:26 +0200 Subject: Add phantom bpath to helper (bzr r15092) --- src/ui/tools/node-tool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/tools/node-tool.cpp') diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index b4fc569bb..2bd4fdea3 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -523,7 +523,7 @@ bool NodeTool::root_handler(GdkEvent* event) { } c->transform(over_item->i2dt_affine()); - SPCanvasItem *flash = sp_canvas_bpath_new(desktop->getTempGroup(), c); + SPCanvasItem *flash = sp_canvas_bpath_new(desktop->getTempGroup(), c, true); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(flash), //prefs->getInt("/tools/nodes/highlight_color", 0xff0000ff), 1.0, -- cgit v1.2.3 From eb4b3b8d4823f7a9cef4e623080e3d1e4b7426eb Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Fri, 7 Oct 2016 20:03:23 +0200 Subject: Fix bug:1630821 on LPE selected nodes Fixed bugs: - https://launchpad.net/bugs/1630821 (bzr r15149) --- src/ui/tools/node-tool.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/ui/tools/node-tool.cpp') diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index 2bd4fdea3..f3679b40f 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -285,13 +285,11 @@ void NodeTool::update_helperpath () { if (SP_IS_LPE_ITEM(selection->singleItem())) { Inkscape::LivePathEffect::Effect *lpe = SP_LPE_ITEM(selection->singleItem())->getCurrentLPE(); if (lpe && lpe->isVisible()/* && lpe->showOrigPath()*/) { - Inkscape::UI::ControlPointSelection::Set &selectionNodes = _selected_nodes->allPoints(); + Inkscape::UI::ControlPointSelection *selectionNodes = _selected_nodes; std::vector selectedNodesPositions; - for (Inkscape::UI::ControlPointSelection::Set::iterator i = selectionNodes.begin(); i != selectionNodes.end(); ++i) { - if ((*i)->selected()) { - Inkscape::UI::Node *n = dynamic_cast(*i); - selectedNodesPositions.push_back(n->position()); - } + for (Inkscape::UI::ControlPointSelection::iterator i = selectionNodes->begin(); i != selectionNodes->end(); ++i) { + Inkscape::UI::Node *n = dynamic_cast(*i); + selectedNodesPositions.push_back(n->position()); } lpe->setSelectedNodePoints(selectedNodesPositions); lpe->setCurrentZoom(this->desktop->current_zoom()); @@ -470,6 +468,7 @@ bool NodeTool::root_handler(GdkEvent* event) { switch (event->type) { case GDK_MOTION_NOTIFY: { + update_helperpath(); combine_motion_events(desktop->canvas, event->motion, 0); SPItem *over_item = sp_event_context_find_item (desktop, event_point(event->button), FALSE, TRUE); -- cgit v1.2.3 From 5ba49eaa5621b2e232f8df179798a1b2b282890c Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 19 Dec 2016 19:00:54 +0100 Subject: Add update_helperpaths not member of nodetool class to easy call from outside (bzr r15335) --- src/ui/tools/node-tool.cpp | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) (limited to 'src/ui/tools/node-tool.cpp') diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index f3679b40f..668ebda27 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -32,6 +32,8 @@ #include "sp-text.h" #include "ui/control-manager.h" #include "ui/tools/node-tool.h" +#include "ui/tools-switch.h" +#include "ui/tools/tool-base.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/event-utils.h" #include "ui/tool/multi-path-manipulator.h" @@ -155,9 +157,7 @@ NodeTool::~NodeTool() { if (this->flash_tempitem) { this->desktop->remove_temporary_canvasitem(this->flash_tempitem); } - if (this->helperpath_tmpitem) { - this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem); - } + sp_update_helperpath(true); this->_selection_changed_connection.disconnect(); //this->_selection_modified_connection.disconnect(); this->_mouseover_changed_connection.disconnect(); @@ -237,7 +237,6 @@ void NodeTool::setup() { ))) ); - this->helperpath_tmpitem = NULL; this->cursor_drag = false; this->show_transform_handles = true; this->single_node_transform_handles = false; @@ -270,29 +269,36 @@ void NodeTool::setup() { } this->desktop->emitToolSubselectionChanged(NULL); // sets the coord entry fields to inactive - this->update_helperpath(); + sp_update_helperpath(); } // show helper paths of the applied LPE, if any -void NodeTool::update_helperpath () { - Inkscape::Selection *selection = this->desktop->getSelection(); - - if (this->helperpath_tmpitem) { - this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem); - this->helperpath_tmpitem = NULL; +void sp_update_helperpath(bool remove) { + SPDesktop * desktop = SP_ACTIVE_DESKTOP; + if (!desktop || !tools_isactive(desktop, TOOLS_NODES)) { + return; + } + Inkscape::Selection *selection = desktop->getSelection(); + static Inkscape::Display::TemporaryItem * helperpath_tmpitem; + if (helperpath_tmpitem) { + desktop->remove_temporary_canvasitem(helperpath_tmpitem); + helperpath_tmpitem = NULL; + } + if (remove) { + return; } - if (SP_IS_LPE_ITEM(selection->singleItem())) { Inkscape::LivePathEffect::Effect *lpe = SP_LPE_ITEM(selection->singleItem())->getCurrentLPE(); if (lpe && lpe->isVisible()/* && lpe->showOrigPath()*/) { - Inkscape::UI::ControlPointSelection *selectionNodes = _selected_nodes; + Inkscape::UI::Tools::NodeTool *nt = static_cast(desktop->event_context); + Inkscape::UI::ControlPointSelection *selectionNodes = nt->_selected_nodes; std::vector selectedNodesPositions; for (Inkscape::UI::ControlPointSelection::iterator i = selectionNodes->begin(); i != selectionNodes->end(); ++i) { Inkscape::UI::Node *n = dynamic_cast(*i); selectedNodesPositions.push_back(n->position()); } lpe->setSelectedNodePoints(selectedNodesPositions); - lpe->setCurrentZoom(this->desktop->current_zoom()); + lpe->setCurrentZoom(desktop->current_zoom()); SPCurve *c = new SPCurve(); SPCurve *cc = new SPCurve(); std::vector cs = lpe->getCanvasIndicators(SP_LPE_ITEM(selection->singleItem())); @@ -302,11 +308,11 @@ void NodeTool::update_helperpath () { cc->reset(); } if (!c->is_empty()) { - SPCanvasItem *helperpath = sp_canvas_bpath_new(this->desktop->getTempGroup(), c, true); + SPCanvasItem *helperpath = sp_canvas_bpath_new(desktop->getTempGroup(), c, true); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(helperpath), 0x0000ff9A, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(helperpath), 0, SP_WIND_RULE_NONZERO); sp_canvas_item_affine_absolute(helperpath, selection->singleItem()->i2dt_affine()); - this->helperpath_tmpitem = this->desktop->add_temporary_canvasitem(helperpath, 0); + helperpath_tmpitem = desktop->add_temporary_canvasitem(helperpath, 0); } c->unref(); cc->unref(); @@ -468,7 +474,7 @@ bool NodeTool::root_handler(GdkEvent* event) { switch (event->type) { case GDK_MOTION_NOTIFY: { - update_helperpath(); + sp_update_helperpath(); combine_motion_events(desktop->canvas, event->motion, 0); SPItem *over_item = sp_event_context_find_item (desktop, event_point(event->button), FALSE, TRUE); -- cgit v1.2.3 From c5b33e5041c6bd1f62ef550ac2b8e1bc739a40e2 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 19 Dec 2016 19:14:56 +0100 Subject: Remove unneeded static var from previous commit (bzr r15336) --- src/ui/tools/node-tool.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/ui/tools/node-tool.cpp') diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index 668ebda27..0c948c91c 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -157,7 +157,9 @@ NodeTool::~NodeTool() { if (this->flash_tempitem) { this->desktop->remove_temporary_canvasitem(this->flash_tempitem); } - sp_update_helperpath(true); + if (this->helperpath_tmpitem) { + this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem); + } this->_selection_changed_connection.disconnect(); //this->_selection_modified_connection.disconnect(); this->_mouseover_changed_connection.disconnect(); @@ -209,7 +211,7 @@ void NodeTool::setup() { this->_sizeUpdatedConn = ControlManager::getManager().connectCtrlSizeChanged( sigc::mem_fun(this, &NodeTool::handleControlUiStyleChange) ); - + this->helperpath_tmpitem = NULL; this->_selected_nodes = new Inkscape::UI::ControlPointSelection(this->desktop, this->_transform_handle_group); data.node_data.selection = this->_selected_nodes; @@ -273,24 +275,22 @@ void NodeTool::setup() { } // show helper paths of the applied LPE, if any -void sp_update_helperpath(bool remove) { +void sp_update_helperpath() { SPDesktop * desktop = SP_ACTIVE_DESKTOP; if (!desktop || !tools_isactive(desktop, TOOLS_NODES)) { return; } + Inkscape::UI::Tools::NodeTool *nt = static_cast(desktop->event_context); Inkscape::Selection *selection = desktop->getSelection(); - static Inkscape::Display::TemporaryItem * helperpath_tmpitem; - if (helperpath_tmpitem) { - desktop->remove_temporary_canvasitem(helperpath_tmpitem); - helperpath_tmpitem = NULL; - } - if (remove) { - return; + if (nt->helperpath_tmpitem) { + desktop->remove_temporary_canvasitem(nt->helperpath_tmpitem); + nt->helperpath_tmpitem = NULL; } + if (SP_IS_LPE_ITEM(selection->singleItem())) { Inkscape::LivePathEffect::Effect *lpe = SP_LPE_ITEM(selection->singleItem())->getCurrentLPE(); if (lpe && lpe->isVisible()/* && lpe->showOrigPath()*/) { - Inkscape::UI::Tools::NodeTool *nt = static_cast(desktop->event_context); + Inkscape::UI::ControlPointSelection *selectionNodes = nt->_selected_nodes; std::vector selectedNodesPositions; for (Inkscape::UI::ControlPointSelection::iterator i = selectionNodes->begin(); i != selectionNodes->end(); ++i) { @@ -312,7 +312,7 @@ void sp_update_helperpath(bool remove) { sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(helperpath), 0x0000ff9A, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(helperpath), 0, SP_WIND_RULE_NONZERO); sp_canvas_item_affine_absolute(helperpath, selection->singleItem()->i2dt_affine()); - helperpath_tmpitem = desktop->add_temporary_canvasitem(helperpath, 0); + nt->helperpath_tmpitem = desktop->add_temporary_canvasitem(helperpath, 0); } c->unref(); cc->unref(); -- cgit v1.2.3