summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabiertxof <jtx@jtx>2017-04-25 22:52:24 +0000
committerJabiertxof <jtx@jtx>2017-04-25 22:52:24 +0000
commit4420145b9b14f7f752f704b450b9a162dc8a640a (patch)
treead891ba551691754d7f9f979e2288d919e4c496f /src
parentLittle UX tweak (diff)
downloadinkscape-4420145b9b14f7f752f704b450b9a162dc8a640a.tar.gz
inkscape-4420145b9b14f7f752f704b450b9a162dc8a640a.zip
Improve 0.92 support for Clone Original LPE
(bzr r15645)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/lpe-clone-original.cpp39
-rw-r--r--src/live_effects/lpe-clone-original.h3
2 files changed, 18 insertions, 24 deletions
diff --git a/src/live_effects/lpe-clone-original.cpp b/src/live_effects/lpe-clone-original.cpp
index c41b1ef95..47fb6a04e 100644
--- a/src/live_effects/lpe-clone-original.cpp
+++ b/src/live_effects/lpe-clone-original.cpp
@@ -20,8 +20,7 @@ namespace LivePathEffect {
LPECloneOriginal::LPECloneOriginal(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
- linked_path("LEGACY FALLBACK", "LEGACY FALLBACK", "linkedpath", &wr, this),
- linked_item(_("Linked Item:"), _("Item from which to take the original data"), "linked_item", &wr, this),
+ linkeditem(_("Linked Item:"), _("Item from which to take the original data"), "linkeditem", &wr, this),
scale(_("Scale %"), _("Scale item %"), "scale", &wr, this, 100.0),
preserve_position(_("Preserve position"), _("Preserve position"), "preserve_position", &wr, this, false),
inverse(_("Inverse clone"), _("Use LPE item as origin"), "inverse", &wr, this, false),
@@ -37,8 +36,15 @@ LPECloneOriginal::LPECloneOriginal(LivePathEffectObject *lpeobject) :
expanded(false),
origin(Geom::Point(0,0))
{
- registerParameter(&linked_path);
- registerParameter(&linked_item);
+ //0.92 compatibility
+ const gchar * linkedpath = this->getRepr()->attribute("linkedpath");
+ if (linkedpath && strcmp(linkedpath, "") != 0){
+ this->getRepr()->setAttribute("linkeditem", linkedpath);
+ this->getRepr()->setAttribute("linkedpath", NULL);
+ this->getRepr()->setAttribute("transform", "false");
+ };
+
+ registerParameter(&linkeditem);
registerParameter(&scale);
registerParameter(&attributes);
registerParameter(&style_attributes);
@@ -208,19 +214,8 @@ LPECloneOriginal::cloneAttrbutes(SPObject *origin, SPObject *dest, bool live, co
void
LPECloneOriginal::doBeforeEffect (SPLPEItem const* lpeitem){
- if (linked_path.linksToPath()) { //Legacy staff
- Glib::ustring attributes_value("d");
- attributes.param_setValue(attributes_value);
- attributes.write_to_SVG();
- Glib::ustring style_attributes_value("");
- style_attributes.param_setValue(style_attributes_value);
- style_attributes.write_to_SVG();
- linked_item.param_readSVGValue(linked_path.param_getSVGValue());
- linked_path.param_readSVGValue("");
- }
-
- if (linked_item.linksToItem()) {
- linked_item.setInverse(inverse);
+ if (linkeditem.linksToItem()) {
+ linkeditem.setInverse(inverse);
if ( preserve_position_changed != preserve_position ) {
if (!preserve_position) {
sp_svg_transform_read(SP_ITEM(sp_lpe_item)->getAttribute("transform"), &preserve_affine);
@@ -262,8 +257,8 @@ LPECloneOriginal::doBeforeEffect (SPLPEItem const* lpeitem){
}
style_attr.append(Glib::ustring(style_attributes.param_getSVGValue()).append(","));
- SPItem * from = inverse ? SP_ITEM(sp_lpe_item) : SP_ITEM(linked_item.getObject());
- SPItem * to = !inverse ? SP_ITEM(sp_lpe_item) : SP_ITEM(linked_item.getObject());
+ SPItem * from = inverse ? SP_ITEM(sp_lpe_item) : SP_ITEM(linkeditem.getObject());
+ SPItem * to = !inverse ? SP_ITEM(sp_lpe_item) : SP_ITEM(linkeditem.getObject());
cloneAttrbutes(from, to, true, g_strdup(attr.c_str()), g_strdup(style_attr.c_str()), true);
Geom::OptRect bbox = from->geometricBounds();
if (bbox && preserve_position && origin != Geom::Point(0,0)) {
@@ -346,15 +341,15 @@ LPECloneOriginal::~LPECloneOriginal()
void
LPECloneOriginal::transform_multiply(Geom::Affine const& postmul, bool set)
{
- if (linked_item.linksToItem()) {
- linked_item.getObject()->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ if (linkeditem.linksToItem()) {
+ linkeditem.getObject()->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
}
void
LPECloneOriginal::doEffect (SPCurve * curve)
{
- if (linked_item.linksToItem() && !inverse) {
+ if (linkeditem.linksToItem() && !inverse) {
SPShape * shape = getCurrentShape();
if(shape){
curve->set_pathvector(shape->getCurve()->get_pathvector());
diff --git a/src/live_effects/lpe-clone-original.h b/src/live_effects/lpe-clone-original.h
index e4328c169..9bab8553f 100644
--- a/src/live_effects/lpe-clone-original.h
+++ b/src/live_effects/lpe-clone-original.h
@@ -32,8 +32,7 @@ public:
void cloneAttrbutes(SPObject *origin, SPObject *dest, bool live, const char * attributes, const char * style_attributes, bool root);
private:
- OriginalPathParam linked_path;
- OriginalItemParam linked_item;
+ OriginalItemParam linkeditem;
ScalarParam scale;
BoolParam preserve_position;
BoolParam inverse;