diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2016-06-11 11:51:02 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2016-06-11 11:51:02 +0000 |
| commit | 0a08d7714145c5fc355d086ed7d45dd285bd5d59 (patch) | |
| tree | 0c29be3eace620797158f7b3a83c2210e6d15623 /src | |
| parent | [Bug 1588983] Finish up German tutorials for 0.92 - part 3. (diff) | |
| download | inkscape-0a08d7714145c5fc355d086ed7d45dd285bd5d59.tar.gz inkscape-0a08d7714145c5fc355d086ed7d45dd285bd5d59.zip | |
fix-bugs #540591 #1287996 and #456503 related to undo in path parameters of LPE
Fixed bugs:
- https://launchpad.net/bugs/540591
- https://launchpad.net/bugs/1287996
- https://launchpad.net/bugs/456503
(bzr r14975)
Diffstat (limited to 'src')
| -rw-r--r-- | src/live_effects/effect.cpp | 1 | ||||
| -rw-r--r-- | src/live_effects/parameter/path.cpp | 28 |
2 files changed, 27 insertions, 2 deletions
diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 732c67304..1868ca43b 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -714,6 +714,7 @@ Effect::getParameter(const char * key) { Glib::ustring stringkey(key); + if (param_vector.empty()) return NULL; std::vector<Parameter *>::iterator it = param_vector.begin(); while (it != param_vector.end()) { Parameter * param = *it; diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp index 7ea1d465c..bed191e83 100644 --- a/src/live_effects/parameter/path.cpp +++ b/src/live_effects/parameter/path.cpp @@ -73,7 +73,21 @@ PathParam::PathParam( const Glib::ustring& label, const Glib::ustring& tip, PathParam::~PathParam() { remove_link(); - + using namespace Inkscape::UI; + SPDesktop *desktop = SP_ACTIVE_DESKTOP; + if (desktop) { + if (tools_isactive(desktop, TOOLS_NODES)) { + SPItem * item = SP_ACTIVE_DESKTOP->getSelection()->singleItem(); + if (item != NULL) { + Inkscape::UI::Tools::NodeTool *nt = static_cast<Inkscape::UI::Tools::NodeTool*>(desktop->event_context); + std::set<ShapeRecord> shapes; + ShapeRecord r; + r.item = item; + shapes.insert(r); + nt->_multipath->setItems(shapes); + } + } + } g_free(defvalue); } @@ -207,6 +221,9 @@ PathParam::param_newWidget() void PathParam::param_editOncanvas(SPItem *item, SPDesktop * dt) { + SPDocument *document = dt->getDocument(); + bool saved = DocumentUndo::getUndoSensitive(document); + DocumentUndo::setUndoSensitive(document, false); using namespace Inkscape::UI; // TODO remove the tools_switch atrocity. @@ -220,14 +237,20 @@ PathParam::param_editOncanvas(SPItem *item, SPDesktop * dt) r.role = SHAPE_ROLE_LPE_PARAM; r.edit_transform = item->i2dt_affine(); // TODO is it right? + r.edit_transform *= item->transform.inverse(); if (!href) { r.item = reinterpret_cast<SPItem*>(param_effect->getLPEObj()); r.lpe_key = param_key; + Geom::PathVector stored_pv = _pathvector; + param_write_to_repr("M0,0 L1,0"); + const char *svgd = sp_svg_write_path(stored_pv); + param_write_to_repr(svgd); } else { r.item = ref.getObject(); } shapes.insert(r); nt->_multipath->setItems(shapes); + DocumentUndo::setUndoSensitive(document, saved); } void @@ -435,7 +458,8 @@ PathParam::paste_param_path(const char *svgd) SPItem * item = SP_ACTIVE_DESKTOP->getSelection()->singleItem(); if (item != NULL) { Geom::PathVector path_clipboard = sp_svg_read_pathv(svgd); - path_clipboard *= item->i2doc_affine().inverse(); + path_clipboard *= item->i2doc_affine().inverse() * item->transform; + path_clipboard *= Geom::Translate(path_clipboard.initialPoint() - _pathvector.initialPoint()).inverse(); svgd = sp_svg_write_path( path_clipboard ); } |
