summaryrefslogtreecommitdiffstats
path: root/src/ui/tools/node-tool.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2014-08-01 14:28:31 +0000
committerLiam P. White <inkscapebrony@gmail.com>2014-08-01 14:28:31 +0000
commita0acffb60236ee6d8c6f8ccc2f29d36b5aa02dda (patch)
treec3ebcc82e43885c59301794a11839cc75045924e /src/ui/tools/node-tool.cpp
parentFix for #1348385 (filtered shape losing filter on conversion) (diff)
downloadinkscape-a0acffb60236ee6d8c6f8ccc2f29d36b5aa02dda.tar.gz
inkscape-a0acffb60236ee6d8c6f8ccc2f29d36b5aa02dda.zip
Fix for #906794, #1246550 (live effects not showing helper paths)
Fixed bugs: - https://launchpad.net/bugs/1246550 - https://launchpad.net/bugs/906794 (bzr r13487)
Diffstat (limited to '')
-rw-r--r--src/ui/tools/node-tool.cpp46
1 files changed, 45 insertions, 1 deletions
diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp
index b1e11bd66..0778e3f3f 100644
--- a/src/ui/tools/node-tool.cpp
+++ b/src/ui/tools/node-tool.cpp
@@ -19,6 +19,7 @@
#include "display/curve.h"
#include "display/sp-canvas.h"
#include "document.h"
+#include "live_effects/effect.h"
#include "live_effects/lpeobject.h"
#include "message-context.h"
#include "selection.h"
@@ -166,6 +167,9 @@ 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);
+ }
this->_selection_changed_connection.disconnect();
//this->_selection_modified_connection.disconnect();
@@ -246,6 +250,7 @@ void NodeTool::setup() {
)))
);
+ this->helperpath_tmpitem = NULL;
this->cursor_drag = false;
this->show_transform_handles = true;
this->single_node_transform_handles = false;
@@ -278,6 +283,44 @@ void NodeTool::setup() {
}
this->desktop->emitToolSubselectionChanged(NULL); // sets the coord entry fields to inactive
+ this->update_helperpath();
+}
+
+// show helper paths of the applied LPE, if any
+void NodeTool::update_helperpath () {
+ Inkscape::Selection *selection = sp_desktop_selection (this->desktop);
+
+ if (this->helperpath_tmpitem) {
+ this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem);
+ this->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()*/) {
+ if (lpe) {
+ SPCurve *c = new SPCurve();
+ SPCurve *cc = new SPCurve();
+ std::vector<Geom::PathVector> cs = lpe->getCanvasIndicators(SP_LPE_ITEM(selection->singleItem()));
+ for (std::vector<Geom::PathVector>::iterator p = cs.begin(); p != cs.end(); ++p) {
+ cc->set_pathvector(*p);
+ c->append(cc, false);
+ cc->reset();
+ }
+ if (!c->is_empty()) {
+ c->transform(selection->singleItem()->i2dt_affine());
+ SPCanvasItem *helperpath = sp_canvas_bpath_new(sp_desktop_tempgroup(this->desktop), 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);
+ this->helperpath_tmpitem = this->desktop->add_temporary_canvasitem(helperpath,0);
+ }
+ c->unref();
+ cc->unref();
+ }
+ }
+ }
}
void NodeTool::set(const Inkscape::Preferences::Entry& value) {
@@ -392,7 +435,7 @@ void NodeTool::selection_changed(Inkscape::Selection *sel) {
for (std::set<ShapeRecord>::iterator i = shapes.begin(); i != shapes.end(); ++i) {
ShapeRecord const &r = *i;
- if ((SP_IS_SHAPE(r.item) || SP_IS_TEXT(r.item)) &&
+ if ((SP_IS_SHAPE(r.item) || SP_IS_TEXT(r.item) || SP_IS_GROUP(r.item) || SP_IS_OBJECTGROUP(r.item)) &&
this->_shape_editors.find(r.item) == this->_shape_editors.end())
{
ShapeEditor *si = new ShapeEditor(this->desktop);
@@ -432,6 +475,7 @@ bool NodeTool::root_handler(GdkEvent* event) {
switch (event->type)
{
case GDK_MOTION_NOTIFY: {
+ this->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);