diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2016-01-17 19:18:53 +0000 |
|---|---|---|
| committer | jabiertxof <info@marker.es> | 2016-01-17 19:18:53 +0000 |
| commit | b3719f65d1bb2ee5ab7fd3bc67f92a657732580d (patch) | |
| tree | 8f428bb289b37f2f2e902f254b17b3cc8f0ba4a0 /src | |
| parent | Latvian translation update (diff) | |
| download | inkscape-b3719f65d1bb2ee5ab7fd3bc67f92a657732580d.tar.gz inkscape-b3719f65d1bb2ee5ab7fd3bc67f92a657732580d.zip | |
Add option to Lattice2 to update LPE only on release knot.
This could be useful if item is too complex, making previous knots unusable
This can be used in other LPE if anyone want or ping me to it. Maybe could be usefull add similar thing to path parameter,
Same slow item become tooooo slow with bend path.
(bzr r14604)
Diffstat (limited to 'src')
| -rw-r--r-- | src/live_effects/lpe-lattice2.cpp | 37 | ||||
| -rw-r--r-- | src/live_effects/lpe-lattice2.h | 1 | ||||
| -rw-r--r-- | src/live_effects/parameter/point.cpp | 16 | ||||
| -rw-r--r-- | src/live_effects/parameter/point.h | 7 |
4 files changed, 50 insertions, 11 deletions
diff --git a/src/live_effects/lpe-lattice2.cpp b/src/live_effects/lpe-lattice2.cpp index 8c7f46cbd..b749370fa 100644 --- a/src/live_effects/lpe-lattice2.cpp +++ b/src/live_effects/lpe-lattice2.cpp @@ -46,6 +46,7 @@ LPELattice2::LPELattice2(LivePathEffectObject *lpeobject) : Effect(lpeobject), horizontal_mirror(_("Mirror movements in horizontal"), _("Mirror movements in horizontal"), "horizontal_mirror", &wr, this, false), vertical_mirror(_("Mirror movements in vertical"), _("Mirror movements in vertical"), "vertical_mirror", &wr, this, false), + live_update(_("Update while moving knots (maybe slow)"), _("Update while moving knots (maybe slow)"), "live_update", &wr, this, true), grid_point_0(_("Control 0:"), _("Control 0 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint0", &wr, this), grid_point_1(_("Control 1:"), _("Control 1 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint1", &wr, this), grid_point_2(_("Control 2:"), _("Control 2 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint2", &wr, this), @@ -76,6 +77,7 @@ LPELattice2::LPELattice2(LivePathEffectObject *lpeobject) : // register all your parameters here, so Inkscape knows which parameters this effect has: registerParameter(&horizontal_mirror); registerParameter(&vertical_mirror); + registerParameter(&live_update); registerParameter(&grid_point_0); registerParameter(&grid_point_1); registerParameter(&grid_point_2); @@ -248,7 +250,7 @@ LPELattice2::newWidget() } Glib::ustring * tip = param->param_getTooltip(); if (widg) { - if (param->param_key == "horizontal_mirror" || param->param_key == "vertical_mirror") { + if (param->param_key == "horizontal_mirror" || param->param_key == "vertical_mirror" || param->param_key == "live_update") { vbox->pack_start(*widg, true, true, 2); } else { vbox_expander->pack_start(*widg, true, true, 2); @@ -300,8 +302,8 @@ LPELattice2::vertical(PointParam ¶m_one, PointParam ¶m_two, Geom::Line v } A[Geom::X] = nearest[Geom::X] - distance_middle; B[Geom::X] = nearest[Geom::X] + distance_middle; - param_one.param_setValue(A, true); - param_two.param_setValue(B, true); + param_one.param_setValue(A, live_update); + param_two.param_setValue(B, live_update); } void @@ -321,8 +323,8 @@ LPELattice2::horizontal(PointParam ¶m_one, PointParam ¶m_two, Geom::Line } A[Geom::Y] = nearest[Geom::Y] - distance_middle; B[Geom::Y] = nearest[Geom::Y] + distance_middle; - param_one.param_setValue(A, true); - param_two.param_setValue(B, true); + param_one.param_setValue(A, live_update); + param_two.param_setValue(B, live_update); } void @@ -464,6 +466,31 @@ LPELattice2::setDefaults() grid_point_28x30.param_update_default(gp28x30); grid_point_29x31.param_update_default(gp29x31); grid_point_32x33x34x35.param_update_default(gp32x33x34x35); + grid_point_0.param_set_liveupdate(live_update); + grid_point_1.param_set_liveupdate(live_update); + grid_point_2.param_set_liveupdate(live_update); + grid_point_3.param_set_liveupdate(live_update); + grid_point_4.param_set_liveupdate(live_update); + grid_point_5.param_set_liveupdate(live_update); + grid_point_6.param_set_liveupdate(live_update); + grid_point_7.param_set_liveupdate(live_update); + grid_point_8x9.param_set_liveupdate(live_update); + grid_point_10x11.param_set_liveupdate(live_update); + grid_point_12.param_set_liveupdate(live_update); + grid_point_13.param_set_liveupdate(live_update); + grid_point_14.param_set_liveupdate(live_update); + grid_point_15.param_set_liveupdate(live_update); + grid_point_16.param_set_liveupdate(live_update); + grid_point_17.param_set_liveupdate(live_update); + grid_point_18.param_set_liveupdate(live_update); + grid_point_19.param_set_liveupdate(live_update); + grid_point_20x21.param_set_liveupdate(live_update); + grid_point_22x23.param_set_liveupdate(live_update); + grid_point_24x26.param_set_liveupdate(live_update); + grid_point_25x27.param_set_liveupdate(live_update); + grid_point_28x30.param_set_liveupdate(live_update); + grid_point_29x31.param_set_liveupdate(live_update); + grid_point_32x33x34x35.param_set_liveupdate(live_update); } void diff --git a/src/live_effects/lpe-lattice2.h b/src/live_effects/lpe-lattice2.h index b32903c9e..8d0c18a3a 100644 --- a/src/live_effects/lpe-lattice2.h +++ b/src/live_effects/lpe-lattice2.h @@ -63,6 +63,7 @@ private: BoolParam horizontal_mirror; BoolParam vertical_mirror; + BoolParam live_update; PointParam grid_point_0; PointParam grid_point_1; PointParam grid_point_2; diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp index 4c4d2cd9c..ca3471b29 100644 --- a/src/live_effects/parameter/point.cpp +++ b/src/live_effects/parameter/point.cpp @@ -25,9 +25,11 @@ namespace LivePathEffect { PointParam::PointParam( const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Inkscape::UI::Widget::Registry* wr, - Effect* effect, const gchar *htip, Geom::Point default_value) + Effect* effect, const gchar *htip, Geom::Point default_value, + bool live_update ) : Parameter(label, tip, key, wr, effect), defvalue(default_value), + liveupdate(live_update), knoth(NULL) { knot_shape = SP_KNOT_SHAPE_DIAMOND; @@ -48,6 +50,12 @@ PointParam::param_set_default() param_setValue(defvalue,true); } +void +PointParam::param_set_liveupdate( bool live_update) +{ + liveupdate = live_update; +} + Geom::Point PointParam::param_get_default() const{ return defvalue; @@ -70,7 +78,7 @@ PointParam::param_setValue(Geom::Point newpoint, bool write) param_write_to_repr(str); g_free(str); } - if(knoth){ + if(knoth && liveupdate){ knoth->update_knots(); } } @@ -166,9 +174,9 @@ PointParamKnotHolderEntity::knot_set(Geom::Point const &p, Geom::Point const &or s = A; } } - pparam->param_setValue(s, true); + pparam->param_setValue(s, this->pparam->liveupdate); SPLPEItem * splpeitem = dynamic_cast<SPLPEItem *>(item); - if(splpeitem){ + if(splpeitem && this->pparam->liveupdate){ sp_lpe_item_update_patheffect(splpeitem, false, false); } } diff --git a/src/live_effects/parameter/point.h b/src/live_effects/parameter/point.h index 471fbc993..4329e0bcd 100644 --- a/src/live_effects/parameter/point.h +++ b/src/live_effects/parameter/point.h @@ -29,8 +29,9 @@ public: const Glib::ustring& key, Inkscape::UI::Widget::Registry* wr, Effect* effect, - const gchar *handle_tip = NULL, - Geom::Point default_value = Geom::Point(0,0) ); // tip for automatically associated on-canvas handle + const gchar *handle_tip = NULL,// tip for automatically associated on-canvas handle + Geom::Point default_value = Geom::Point(0,0), + bool live_update = true ); virtual ~PointParam(); virtual Gtk::Widget * param_newWidget(); @@ -41,6 +42,7 @@ public: void param_setValue(Geom::Point newpoint, bool write = false); void param_set_default(); Geom::Point param_get_default() const; + void param_set_liveupdate(bool live_update); void param_update_default(Geom::Point newpoint); virtual void param_transform_multiply(Geom::Affine const& /*postmul*/, bool /*set*/); @@ -54,6 +56,7 @@ private: PointParam(const PointParam&); PointParam& operator=(const PointParam&); Geom::Point defvalue; + bool liveupdate; KnotHolder *knoth; SPKnotShapeType knot_shape; SPKnotModeType knot_mode; |
