summaryrefslogtreecommitdiffstats
path: root/src/live_effects
diff options
context:
space:
mode:
authorJabiertxof <jtx@jtx>2017-01-24 00:39:06 +0000
committerJabiertxof <jtx@jtx>2017-01-24 00:39:06 +0000
commitda07c5edaeefe35a92662e42579b3e0b36621cbb (patch)
treebd783169733a4b06927601fca59ec569dc5317b5 /src/live_effects
parentUpdate to trunk (diff)
parentfix nodes reverting back during editing (diff)
downloadinkscape-da07c5edaeefe35a92662e42579b3e0b36621cbb.tar.gz
inkscape-da07c5edaeefe35a92662e42579b3e0b36621cbb.zip
Remove some code and make dependant of rotate copies
(bzr r15295.1.63)
Diffstat (limited to 'src/live_effects')
-rw-r--r--src/live_effects/effect.h15
-rw-r--r--src/live_effects/lpe-copy_rotate.cpp1
-rw-r--r--src/live_effects/lpe-measure-line.cpp9
-rw-r--r--src/live_effects/lpe-measure-line.h6
-rw-r--r--src/live_effects/lpe-mirror_symmetry.cpp69
-rw-r--r--src/live_effects/lpe-patternalongpath.cpp14
-rw-r--r--src/live_effects/lpe-perspective-envelope.cpp2
-rw-r--r--src/live_effects/parameter/bool.cpp3
-rw-r--r--src/live_effects/parameter/text.cpp3
-rw-r--r--src/live_effects/parameter/vector.cpp2
10 files changed, 66 insertions, 58 deletions
diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h
index 9a2d4c67d..1997ff0ca 100644
--- a/src/live_effects/effect.h
+++ b/src/live_effects/effect.h
@@ -19,7 +19,7 @@
class SPDocument;
class SPDesktop;
class SPItem;
-class LivePathEffectObject;
+class LivePathEffectObject;
class SPLPEItem;
class KnotHolder;
class KnotHolderEntity;
@@ -44,12 +44,6 @@ enum LPEPathFlashType {
DEFAULT
};
-enum LpeAction {
- LPE_ERASE = 0,
- LPE_TO_OBJECTS,
- LPE_VISIBILITY
-};
-
class Effect {
public:
static Effect* New(EffectType lpenr, LivePathEffectObject *lpeobj);
@@ -131,9 +125,7 @@ public:
bool apply_to_clippath_and_mask;
bool erase_extra_objects; // set this to false allow retain extra generated objects, see measure line LPE
bool upd_params;
- BoolParam is_visible;
- SPCurve * sp_curve;
- Geom::PathVector pathvector_before_effect;
+
protected:
Effect(LivePathEffectObject *lpeobject);
@@ -158,6 +150,7 @@ protected:
bool _provides_knotholder_entities;
int oncanvasedit_it;
+ BoolParam is_visible;
bool show_orig_path; // set this to true in derived effects to automatically have the original
// path displayed as helperpath
@@ -173,6 +166,8 @@ protected:
SPLPEItem * sp_lpe_item; // these get stored in doBeforeEffect_impl, and derived classes may do as they please with them.
double current_zoom;
std::vector<Geom::Point> selectedNodesPoints;
+ SPCurve * sp_curve;
+ Geom::PathVector pathvector_before_effect;
private:
bool provides_own_flash_paths; // if true, the standard flash path is suppressed
diff --git a/src/live_effects/lpe-copy_rotate.cpp b/src/live_effects/lpe-copy_rotate.cpp
index 250f6aa29..813f25d3d 100644
--- a/src/live_effects/lpe-copy_rotate.cpp
+++ b/src/live_effects/lpe-copy_rotate.cpp
@@ -125,6 +125,7 @@ void
LPECopyRotate::transform_multiply(Geom::Affine const& postmul, bool set)
{
// cycle through all parameters. Most parameters will not need transformation, but path and point params do.
+
for (std::vector<Parameter *>::iterator it = param_vector.begin(); it != param_vector.end(); ++it) {
Parameter * param = *it;
param->param_transform_multiply(postmul, set);
diff --git a/src/live_effects/lpe-measure-line.cpp b/src/live_effects/lpe-measure-line.cpp
index e07335e1c..af2a8e919 100644
--- a/src/live_effects/lpe-measure-line.cpp
+++ b/src/live_effects/lpe-measure-line.cpp
@@ -21,9 +21,7 @@
#include "svg/svg-color.h"
#include "svg/svg.h"
#include "display/curve.h"
-#include "helper/geom.h"
#include "2geom/affine.h"
-#include "path-chemistry.h"
#include "style.h"
#include "sp-root.h"
#include "sp-defs.h"
@@ -167,6 +165,12 @@ LPEMeasureLine::LPEMeasureLine(LivePathEffectObject *lpeobject) :
LPEMeasureLine::~LPEMeasureLine() {}
+void swap(Geom::Point &A, Geom::Point &B){
+ Geom::Point tmp = A;
+ A = B;
+ B = tmp;
+}
+
void
LPEMeasureLine::createArrowMarker(const char * mode)
{
@@ -664,7 +668,6 @@ LPEMeasureLine::doBeforeEffect (SPLPEItem const* lpeitem)
}
}
-//TODO: Migrate the tree next function to effect.cpp/h to avoid duplication
void
LPEMeasureLine::doOnVisibilityToggled(SPLPEItem const* /*lpeitem*/)
{
diff --git a/src/live_effects/lpe-measure-line.h b/src/live_effects/lpe-measure-line.h
index cb531affe..c69921a4d 100644
--- a/src/live_effects/lpe-measure-line.h
+++ b/src/live_effects/lpe-measure-line.h
@@ -35,6 +35,12 @@ enum OrientationMethod {
OM_END
};
+enum LpeAction {
+ LPE_ERASE = 0,
+ LPE_TO_OBJECTS,
+ LPE_VISIBILITY
+};
+
class LPEMeasureLine : public Effect {
public:
LPEMeasureLine(LivePathEffectObject *lpeobject);
diff --git a/src/live_effects/lpe-mirror_symmetry.cpp b/src/live_effects/lpe-mirror_symmetry.cpp
index 3e46422a0..e94ad496e 100644
--- a/src/live_effects/lpe-mirror_symmetry.cpp
+++ b/src/live_effects/lpe-mirror_symmetry.cpp
@@ -237,38 +237,42 @@ LPEMirrorSymmetry::toMirror(Geom::Affine transform)
phantom = elemref->getRepr();
} else {
phantom = sp_lpe_item->getRepr()->duplicate(xml_doc);
- phantom->setAttribute("inkscape:path-effect", NULL);
- phantom->setAttribute("inkscape:original-d", NULL);
- phantom->setAttribute("sodipodi:type", NULL);
- phantom->setAttribute("sodipodi:rx", NULL);
- phantom->setAttribute("sodipodi:ry", NULL);
- phantom->setAttribute("sodipodi:cx", NULL);
- phantom->setAttribute("sodipodi:cy", NULL);
- phantom->setAttribute("sodipodi:end", NULL);
- phantom->setAttribute("sodipodi:start", NULL);
- phantom->setAttribute("inkscape:flatsided", NULL);
- phantom->setAttribute("inkscape:randomized", NULL);
- phantom->setAttribute("inkscape:rounded", NULL);
- phantom->setAttribute("sodipodi:arg1", NULL);
- phantom->setAttribute("sodipodi:arg2", NULL);
- phantom->setAttribute("sodipodi:r1", NULL);
- phantom->setAttribute("sodipodi:r2", NULL);
- phantom->setAttribute("sodipodi:sides", NULL);
- phantom->setAttribute("inkscape:randomized", NULL);
- phantom->setAttribute("sodipodi:argument", NULL);
- phantom->setAttribute("sodipodi:expansion", NULL);
- phantom->setAttribute("sodipodi:radius", NULL);
- phantom->setAttribute("sodipodi:revolution", NULL);
- phantom->setAttribute("sodipodi:t0", NULL);
- phantom->setAttribute("inkscape:randomized", NULL);
- phantom->setAttribute("inkscape:randomized", NULL);
- phantom->setAttribute("inkscape:randomized", NULL);
- phantom->setAttribute("x", NULL);
- phantom->setAttribute("y", NULL);
- phantom->setAttribute("rx", NULL);
- phantom->setAttribute("ry", NULL);
- phantom->setAttribute("width", NULL);
- phantom->setAttribute("height", NULL);
+ std::vector<const char *> attrs;
+ attrs->push_back("inkscape:path-effect");
+ attrs->push_back("inkscape:original-d");
+ attrs->push_back("sodipodi:type");
+ attrs->push_back("sodipodi:rx");
+ attrs->push_back("sodipodi:ry");
+ attrs->push_back("sodipodi:cx");
+ attrs->push_back("sodipodi:cy");
+ attrs->push_back("sodipodi:end");
+ attrs->push_back("sodipodi:start");
+ attrs->push_back("inkscape:flatsided");
+ attrs->push_back("inkscape:randomized");
+ attrs->push_back("inkscape:rounded");
+ attrs->push_back("sodipodi:arg1");
+ attrs->push_back("sodipodi:arg2");
+ attrs->push_back("sodipodi:r1");
+ attrs->push_back("sodipodi:r2");
+ attrs->push_back("sodipodi:sides");
+ attrs->push_back("inkscape:randomized");
+ attrs->push_back("sodipodi:argument");
+ attrs->push_back("sodipodi:expansion");
+ attrs->push_back("sodipodi:radius");
+ attrs->push_back("sodipodi:revolution");
+ attrs->push_back("sodipodi:t0");
+ attrs->push_back("inkscape:randomized");
+ attrs->push_back("inkscape:randomized");
+ attrs->push_back("inkscape:randomized");
+ attrs->push_back("x");
+ attrs->push_back("y");
+ attrs->push_back("rx");
+ attrs->push_back("ry");
+ attrs->push_back("width");
+ attrs->push_back("height");
+ for(const char * attr : attrs) {
+ phantom->setAttribute(attr, NULL);
+ }
}
phantom->setAttribute("id", elemref_id);
if (!elemref) {
@@ -404,7 +408,6 @@ LPEMirrorSymmetry::transform_multiply(Geom::Affine const& postmul, bool set)
param->param_transform_multiply(postmul, set);
}
previous_center = Geom::middle_point((Geom::Point)start_point, (Geom::Point)end_point);
- sp_lpe_item_update_patheffect(sp_lpe_item, false, false);
}
void
diff --git a/src/live_effects/lpe-patternalongpath.cpp b/src/live_effects/lpe-patternalongpath.cpp
index c1853ef22..966e9020e 100644
--- a/src/live_effects/lpe-patternalongpath.cpp
+++ b/src/live_effects/lpe-patternalongpath.cpp
@@ -11,6 +11,7 @@
#include <2geom/bezier-to-sbasis.h>
#include "knotholder.h"
+#include <cmath>
#include <algorithm>
// TODO due to internal breakage in glibmm headers, this must be last:
#include <glibmm/i18n.h>
@@ -161,7 +162,7 @@ LPEPatternAlongPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > con
// spacing.param_set_range(-pattBndsX.extent()*.9, Geom::infinity());
// }
- y0+=noffset;
+ y0 += noffset;
std::vector<Geom::Piecewise<Geom::D2<Geom::SBasis> > > paths_in;
paths_in = split_at_discontinuities(pwd2_in);
@@ -197,7 +198,7 @@ LPEPatternAlongPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > con
case PAPCT_REPEATED_STRETCHED:
// if uskeleton is closed:
- if(path_i.segs.front().at0() == path_i.segs.back().at1()){
+ if (are_near(path_i.segs.front().at0(), path_i.segs.back().at1())){
nbCopies = std::max(1, static_cast<int>(std::floor((uskeleton.domain().extent() - toffset)/(pattBndsX->extent()+xspace))));
pattBndsX = Interval(pattBndsX->min(),pattBndsX->max()+xspace);
scaling = (uskeleton.domain().extent() - toffset)/(((double)nbCopies)*pattBndsX->extent());
@@ -213,11 +214,13 @@ LPEPatternAlongPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > con
return pwd2_in;
};
+ //Ceil to 6 decimals
+ scaling = ceil(scaling * 1000000) / 1000000;
double pattWidth = pattBndsX->extent() * scaling;
- x*=scaling;
+ x *= scaling;
if ( scale_y_rel.get_value() ) {
- y*=(scaling * prop_scale);
+ y *= prop_scale * scaling;
} else {
y *= prop_scale;
}
@@ -235,7 +238,7 @@ LPEPatternAlongPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > con
offs+=pattWidth;
}
}
- if (fuse_tolerance > 0){
+ if (fuse_tolerance > 0){
pre_output = fuse_nearby_ends(pre_output, fuse_tolerance);
for (unsigned i=0; i<pre_output.size(); i++){
output.concat(pre_output[i]);
@@ -264,7 +267,6 @@ LPEPatternAlongPath::transform_multiply(Geom::Affine const& postmul, bool set)
pattern.param_transform_multiply(postmul, set);
pattern.write_to_SVG();
}
- sp_lpe_item_update_patheffect (sp_lpe_item, false, true);
}
void
diff --git a/src/live_effects/lpe-perspective-envelope.cpp b/src/live_effects/lpe-perspective-envelope.cpp
index e0dac0687..18b5b724d 100644
--- a/src/live_effects/lpe-perspective-envelope.cpp
+++ b/src/live_effects/lpe-perspective-envelope.cpp
@@ -379,7 +379,7 @@ LPEPerspectiveEnvelope::newWidget()
hbox_down_handles->pack_start(*widg, true, true, 2);
}
if (tip) {
- widg->set_tooltip_text(*tip);
+ widg->set_tooltip_markup(*tip);
} else {
widg->set_tooltip_text("");
widg->set_has_tooltip(false);
diff --git a/src/live_effects/parameter/bool.cpp b/src/live_effects/parameter/bool.cpp
index 813c06b4e..af99ef362 100644
--- a/src/live_effects/parameter/bool.cpp
+++ b/src/live_effects/parameter/bool.cpp
@@ -72,7 +72,7 @@ BoolParam::param_newWidget()
checkwdg->setActive(value);
checkwdg->setProgrammatically = false;
checkwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change bool parameter"));
- param_effect->upd_params = false;
+
return dynamic_cast<Gtk::Widget *> (checkwdg);
} else {
return NULL;
@@ -82,7 +82,6 @@ BoolParam::param_newWidget()
void
BoolParam::param_setValue(bool newvalue)
{
- param_effect->upd_params = true;
value = newvalue;
}
diff --git a/src/live_effects/parameter/text.cpp b/src/live_effects/parameter/text.cpp
index 5c4cdf4c6..8cab68ad0 100644
--- a/src/live_effects/parameter/text.cpp
+++ b/src/live_effects/parameter/text.cpp
@@ -125,14 +125,13 @@ TextParam::param_newWidget()
rsu->setProgrammatically = false;
rsu->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change text parameter"));
- param_effect->upd_params = false;
+
return dynamic_cast<Gtk::Widget *> (rsu);
}
void
TextParam::param_setValue(const Glib::ustring newvalue)
{
- param_effect->upd_params = true;
value = newvalue;
if (!_hide_canvas_text) {
sp_canvastext_set_text (canvas_text, newvalue.c_str());
diff --git a/src/live_effects/parameter/vector.cpp b/src/live_effects/parameter/vector.cpp
index aa16a2b98..55b4d4b32 100644
--- a/src/live_effects/parameter/vector.cpp
+++ b/src/live_effects/parameter/vector.cpp
@@ -116,7 +116,7 @@ VectorParam::set_and_write_new_values(Geom::Point const &new_origin, Geom::Point
void
VectorParam::param_transform_multiply(Geom::Affine const& postmul, bool /*set*/)
{
- set_and_write_new_values( origin * postmul, vector * postmul.withoutTranslation() );
+ set_and_write_new_values( origin * postmul, vector * postmul.withoutTranslation() );
}