summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2016-08-29 13:27:55 +0000
committerjabiertxof <info@marker.es>2016-08-29 13:27:55 +0000
commite1a84ff6c44588f7847258b5eb5266365e0738e1 (patch)
treea010330ad00515131508de4c2a6323a657d58df2 /src
parentDon't write out sodipodi:line-spacing. Don't read if 'line-height' already set. (diff)
downloadinkscape-e1a84ff6c44588f7847258b5eb5266365e0738e1.tar.gz
inkscape-e1a84ff6c44588f7847258b5eb5266365e0738e1.zip
Fixes to helper paths. evaluate backport to 0.92.x
(bzr r15086)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/effect.cpp13
-rw-r--r--src/live_effects/effect.h1
-rw-r--r--src/ui/tools/node-tool.cpp20
-rw-r--r--src/ui/tools/node-tool.h1
4 files changed, 29 insertions, 6 deletions
diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp
index ef807d586..033eb8955 100644
--- a/src/live_effects/effect.cpp
+++ b/src/live_effects/effect.cpp
@@ -66,6 +66,7 @@
#include "message-stack.h"
#include "document-private.h"
#include "ui/tools/pen-tool.h"
+#include "ui/tools/node-tool.h"
#include "ui/tools-switch.h"
#include "knotholder.h"
#include "live_effects/lpeobject.h"
@@ -454,6 +455,7 @@ void Effect::doBeforeEffect_impl(SPLPEItem const* lpeitem)
sp_lpe_item->apply_to_clippath(sp_lpe_item);
sp_lpe_item->apply_to_mask(sp_lpe_item);
}
+ update_helperpath();
}
/**
@@ -643,6 +645,17 @@ Effect::addCanvasIndicators(SPLPEItem const*/*lpeitem*/, std::vector<Geom::PathV
{
}
+void
+Effect::update_helperpath() {
+ using namespace Inkscape::UI;
+ SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+ if (desktop) {
+ if (tools_isactive(desktop, TOOLS_NODES)) {
+ Inkscape::UI::Tools::NodeTool *nt = static_cast<Inkscape::UI::Tools::NodeTool*>(desktop->event_context);
+ nt->update_helperpath();
+ }
+ }
+}
/**
* This *creates* a new widget, management of deletion should be done by the caller
diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h
index 898e089b7..840f723fa 100644
--- a/src/live_effects/effect.h
+++ b/src/live_effects/effect.h
@@ -102,6 +102,7 @@ public:
virtual LPEPathFlashType pathFlashType() const { return DEFAULT; }
void addHandles(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item);
std::vector<Geom::PathVector> getCanvasIndicators(SPLPEItem const* lpeitem);
+ void update_helperpath();
inline bool providesOwnFlashPaths() const {
return provides_own_flash_paths || show_orig_path;
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);
diff --git a/src/ui/tools/node-tool.h b/src/ui/tools/node-tool.h
index 8342d66a6..bebb26dfc 100644
--- a/src/ui/tools/node-tool.h
+++ b/src/ui/tools/node-tool.h
@@ -69,6 +69,7 @@ private:
SPItem *flashed_item;
Inkscape::Display::TemporaryItem *helperpath_tmpitem;
+ Inkscape::Display::TemporaryItem *helperpath_tmpitem_highlight;
Inkscape::Display::TemporaryItem *flash_tempitem;
Inkscape::UI::Selector* _selector;
Inkscape::UI::PathSharedData* _path_data;