summaryrefslogtreecommitdiffstats
path: root/src/live_effects/parameter
diff options
context:
space:
mode:
authorJabiertxof <jabier.arraiza@marker.es>2019-11-02 23:15:56 +0000
committerJabiertxof <jabier.arraiza@marker.es>2019-11-02 23:15:56 +0000
commit0175d30778b93a1b79e9dedc53f037e81de729b7 (patch)
treec651f299480ba4374efa1436dd4ffc0a409fa3a2 /src/live_effects/parameter
parentAllow forking on powermask (diff)
downloadinkscape-0175d30778b93a1b79e9dedc53f037e81de729b7.tar.gz
inkscape-0175d30778b93a1b79e9dedc53f037e81de729b7.zip
Improve speed of LPE's updating widgets on release knots instead when value change
Diffstat (limited to 'src/live_effects/parameter')
-rw-r--r--src/live_effects/parameter/bool.cpp2
-rw-r--r--src/live_effects/parameter/enum.h4
-rw-r--r--src/live_effects/parameter/fontbutton.cpp2
-rw-r--r--src/live_effects/parameter/message.cpp2
-rw-r--r--src/live_effects/parameter/point.cpp10
-rw-r--r--src/live_effects/parameter/powerstrokepointarray.cpp8
-rw-r--r--src/live_effects/parameter/powerstrokepointarray.h2
-rw-r--r--src/live_effects/parameter/random.cpp2
-rw-r--r--src/live_effects/parameter/satellitesarray.cpp7
-rw-r--r--src/live_effects/parameter/satellitesarray.h2
-rw-r--r--src/live_effects/parameter/text.cpp2
-rw-r--r--src/live_effects/parameter/togglebutton.cpp2
-rw-r--r--src/live_effects/parameter/transformedpoint.cpp6
-rw-r--r--src/live_effects/parameter/unit.cpp2
-rw-r--r--src/live_effects/parameter/vector.cpp12
15 files changed, 40 insertions, 25 deletions
diff --git a/src/live_effects/parameter/bool.cpp b/src/live_effects/parameter/bool.cpp
index 26d27ebab..b02d0c22f 100644
--- a/src/live_effects/parameter/bool.cpp
+++ b/src/live_effects/parameter/bool.cpp
@@ -92,7 +92,7 @@ void
BoolParam::param_setValue(bool newvalue)
{
if (value != newvalue) {
- param_effect->upd_params = true;
+ param_effect->refresh_widgets = true;
}
value = newvalue;
}
diff --git a/src/live_effects/parameter/enum.h b/src/live_effects/parameter/enum.h
index b7964d988..c0c372366 100644
--- a/src/live_effects/parameter/enum.h
+++ b/src/live_effects/parameter/enum.h
@@ -54,9 +54,7 @@ public:
return dynamic_cast<Gtk::Widget *> (regenum);
};
- void _on_change_combo() {
- param_effect->upd_params = true;
- }
+ void _on_change_combo() { param_effect->refresh_widgets = true; }
bool param_readSVGValue(const gchar * strvalue) override {
if (!strvalue) {
param_set_default();
diff --git a/src/live_effects/parameter/fontbutton.cpp b/src/live_effects/parameter/fontbutton.cpp
index 038a58fc6..3c48d8945 100644
--- a/src/live_effects/parameter/fontbutton.cpp
+++ b/src/live_effects/parameter/fontbutton.cpp
@@ -84,7 +84,7 @@ void
FontButtonParam::param_setValue(const Glib::ustring newvalue)
{
if (value != newvalue) {
- param_effect->upd_params = true;
+ param_effect->refresh_widgets = true;
}
value = newvalue;
}
diff --git a/src/live_effects/parameter/message.cpp b/src/live_effects/parameter/message.cpp
index 22ca479d9..a832f1f3a 100644
--- a/src/live_effects/parameter/message.cpp
+++ b/src/live_effects/parameter/message.cpp
@@ -105,7 +105,7 @@ void
MessageParam::param_setValue(const gchar * strvalue)
{
if (strcmp(strvalue, message) != 0) {
- param_effect->upd_params = true;
+ param_effect->refresh_widgets = true;
}
message = strvalue;
}
diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp
index 7ccd187ea..7c7e12c3f 100644
--- a/src/live_effects/parameter/point.cpp
+++ b/src/live_effects/parameter/point.cpp
@@ -170,7 +170,7 @@ PointParam::param_newWidget()
}
bool PointParam::on_button_release(GdkEventButton* button_event) {
- param_effect->upd_params = true;
+ param_effect->refresh_widgets = true;
return false;
}
@@ -189,7 +189,7 @@ public:
void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state) override;
Geom::Point knot_get() const override;
- void knot_ungrabbed(Geom::Point const &p, Geom::Point const &origin, guint state) override {};
+ void knot_ungrabbed(Geom::Point const &p, Geom::Point const &origin, guint state) override;
void knot_click(guint state) override;
private:
@@ -211,7 +211,6 @@ PointParamKnotHolderEntity::knot_set(Geom::Point const &p, Geom::Point const &or
s = A;
}
}
- pparam->param_effect->upd_params = true;
if(this->pparam->liveupdate){
pparam->param_setValue(s, true);
} else {
@@ -236,6 +235,11 @@ PointParamKnotHolderEntity::knot_click(guint state)
}
}
+void PointParamKnotHolderEntity::knot_ungrabbed(Geom::Point const &p, Geom::Point const &origin, guint state)
+{
+ pparam->param_effect->refresh_widgets = true;
+}
+
void
PointParam::addKnotHolderEntities(KnotHolder *knotholder, SPItem *item)
{
diff --git a/src/live_effects/parameter/powerstrokepointarray.cpp b/src/live_effects/parameter/powerstrokepointarray.cpp
index a39c872cd..3441b8bae 100644
--- a/src/live_effects/parameter/powerstrokepointarray.cpp
+++ b/src/live_effects/parameter/powerstrokepointarray.cpp
@@ -180,7 +180,6 @@ PowerStrokePointArrayParamKnotHolderEntity::knot_set(Geom::Point const &p, Geom:
if (!valid_index(_index)) {
return;
}
- _pparam->param_effect->upd_params = true;
/// @todo how about item transforms???
Piecewise<D2<SBasis> > const & pwd2 = _pparam->get_pwd2();
Piecewise<D2<SBasis> > const & n = _pparam->get_pwd2_normal();
@@ -217,9 +216,14 @@ PowerStrokePointArrayParamKnotHolderEntity::knot_get() const
return canvas_point;
}
+void PowerStrokePointArrayParamKnotHolderEntity::knot_ungrabbed(Geom::Point const &p, Geom::Point const &origin,
+ guint state)
+{
+ _pparam->param_effect->refresh_widgets = true;
+}
+
void PowerStrokePointArrayParamKnotHolderEntity::knot_set_offset(Geom::Point offset)
{
- _pparam->param_effect->upd_params = true;
_pparam->_vector.at(_index) = Geom::Point(offset.x(), offset.y() / 2);
this->parent_holder->knot_ungrabbed_handler(this->knot, 0);
}
diff --git a/src/live_effects/parameter/powerstrokepointarray.h b/src/live_effects/parameter/powerstrokepointarray.h
index fff41200a..36c44322b 100644
--- a/src/live_effects/parameter/powerstrokepointarray.h
+++ b/src/live_effects/parameter/powerstrokepointarray.h
@@ -71,7 +71,7 @@ public:
~PowerStrokePointArrayParamKnotHolderEntity() override = default;
void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state) override;
- void knot_ungrabbed(Geom::Point const &p, Geom::Point const &origin, guint state) override {};
+ void knot_ungrabbed(Geom::Point const &p, Geom::Point const &origin, guint state) override;
Geom::Point knot_get() const override;
virtual void knot_set_offset(Geom::Point offset);
void knot_click(guint state) override;
diff --git a/src/live_effects/parameter/random.cpp b/src/live_effects/parameter/random.cpp
index 176790c65..b02a8fe5e 100644
--- a/src/live_effects/parameter/random.cpp
+++ b/src/live_effects/parameter/random.cpp
@@ -159,7 +159,7 @@ RandomParam::param_newWidget()
}
bool RandomParam::on_button_release(GdkEventButton* button_event) {
- param_effect->upd_params = true;
+ param_effect->refresh_widgets = true;
return false;
}
diff --git a/src/live_effects/parameter/satellitesarray.cpp b/src/live_effects/parameter/satellitesarray.cpp
index 311f1e0ce..c80271c4c 100644
--- a/src/live_effects/parameter/satellitesarray.cpp
+++ b/src/live_effects/parameter/satellitesarray.cpp
@@ -231,6 +231,11 @@ FilletChamferKnotHolderEntity::FilletChamferKnotHolderEntity(
SatellitesArrayParam *p, size_t index)
: _pparam(p), _index(index) {}
+void FilletChamferKnotHolderEntity::knot_ungrabbed(Geom::Point const &p, Geom::Point const &origin, guint state)
+{
+ _pparam->param_effect->refresh_widgets = true;
+}
+
void FilletChamferKnotHolderEntity::knot_set(Geom::Point const &p,
Geom::Point const &/*origin*/,
guint state)
@@ -238,7 +243,6 @@ void FilletChamferKnotHolderEntity::knot_set(Geom::Point const &p,
if (!_pparam->_last_pathvector_satellites) {
return;
}
- _pparam->param_effect->upd_params = true;
size_t total_satellites = _pparam->_last_pathvector_satellites->getTotalSatellites();
bool is_mirror = false;
size_t index = _index;
@@ -457,7 +461,6 @@ void FilletChamferKnotHolderEntity::knot_set_offset(Satellite satellite)
if (!_pparam->_last_pathvector_satellites) {
return;
}
- _pparam->param_effect->upd_params = true;
size_t total_satellites = _pparam->_last_pathvector_satellites->getTotalSatellites();
bool is_mirror = false;
size_t index = _index;
diff --git a/src/live_effects/parameter/satellitesarray.h b/src/live_effects/parameter/satellitesarray.h
index 1e2dfc2eb..855f2fc91 100644
--- a/src/live_effects/parameter/satellitesarray.h
+++ b/src/live_effects/parameter/satellitesarray.h
@@ -92,7 +92,7 @@ public:
guint state) override;
Geom::Point knot_get() const override;
void knot_click(guint state) override;
- void knot_ungrabbed(Geom::Point const &p, Geom::Point const &origin, guint state) override {};
+ void knot_ungrabbed(Geom::Point const &p, Geom::Point const &origin, guint state) override;
void knot_set_offset(Satellite);
/** Checks whether the index falls within the size of the parameter's vector
*/
diff --git a/src/live_effects/parameter/text.cpp b/src/live_effects/parameter/text.cpp
index 6f9896981..7feb2e6a7 100644
--- a/src/live_effects/parameter/text.cpp
+++ b/src/live_effects/parameter/text.cpp
@@ -155,7 +155,7 @@ void
TextParam::param_setValue(const Glib::ustring newvalue)
{
if (value != newvalue) {
- param_effect->upd_params = true;
+ param_effect->refresh_widgets = true;
}
value = newvalue;
if (!_hide_canvas_text) {
diff --git a/src/live_effects/parameter/togglebutton.cpp b/src/live_effects/parameter/togglebutton.cpp
index 6d92a8b76..f2cbdf121 100644
--- a/src/live_effects/parameter/togglebutton.cpp
+++ b/src/live_effects/parameter/togglebutton.cpp
@@ -179,7 +179,7 @@ void
ToggleButtonParam::param_setValue(bool newvalue)
{
if (value != newvalue) {
- param_effect->upd_params = true;
+ param_effect->refresh_widgets = true;
}
value = newvalue;
refresh_button();
diff --git a/src/live_effects/parameter/transformedpoint.cpp b/src/live_effects/parameter/transformedpoint.cpp
index a5fefc709..7f842e3d6 100644
--- a/src/live_effects/parameter/transformedpoint.cpp
+++ b/src/live_effects/parameter/transformedpoint.cpp
@@ -167,14 +167,16 @@ public:
~TransformedPointParamKnotHolderEntity_Vector() override = default;
void knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/) override {
- param->param_effect->upd_params = true;
Geom::Point const s = p - param->origin;
/// @todo implement angle snapping when holding CTRL
param->setVector(s);
param->set_and_write_new_values(param->origin, param->vector);
sp_lpe_item_update_patheffect(SP_LPE_ITEM(item), false, false);
};
- void knot_ungrabbed(Geom::Point const &p, Geom::Point const &origin, guint state) override {};
+ void knot_ungrabbed(Geom::Point const &p, Geom::Point const &origin, guint state) override
+ {
+ param->param_effect->refresh_widgets = true;
+ };
Geom::Point knot_get() const override{
return param->origin + param->vector;
};
diff --git a/src/live_effects/parameter/unit.cpp b/src/live_effects/parameter/unit.cpp
index 109d7fced..7a9ccdd4b 100644
--- a/src/live_effects/parameter/unit.cpp
+++ b/src/live_effects/parameter/unit.cpp
@@ -69,7 +69,7 @@ UnitParam::param_update_default(const gchar * default_unit)
void
UnitParam::param_set_value(Inkscape::Util::Unit const &val)
{
- param_effect->upd_params = true;
+ param_effect->refresh_widgets = true;
unit = new Inkscape::Util::Unit(val);
}
diff --git a/src/live_effects/parameter/vector.cpp b/src/live_effects/parameter/vector.cpp
index 63aca130e..636ef7a9e 100644
--- a/src/live_effects/parameter/vector.cpp
+++ b/src/live_effects/parameter/vector.cpp
@@ -174,7 +174,6 @@ public:
~VectorParamKnotHolderEntity_Origin() override = default;
void knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) override {
- param->param_effect->upd_params = true;
Geom::Point const s = snap_knot_position(p, state);
param->setOrigin(s);
param->set_and_write_new_values(param->origin, param->vector);
@@ -183,7 +182,10 @@ public:
Geom::Point knot_get() const override {
return param->origin;
};
- void knot_ungrabbed(Geom::Point const &p, Geom::Point const &origin, guint state) override {};
+ void knot_ungrabbed(Geom::Point const &p, Geom::Point const &origin, guint state) override
+ {
+ param->param_effect->refresh_widgets = true;
+ };
void knot_click(guint /*state*/) override{
g_print ("This is the origin handle associated to parameter '%s'\n", param->param_key.c_str());
};
@@ -199,7 +201,6 @@ public:
void knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/) override {
Geom::Point const s = p - param->origin;
- param->param_effect->upd_params = true;
/// @todo implement angle snapping when holding CTRL
param->setVector(s);
param->set_and_write_new_values(param->origin, param->vector);
@@ -208,7 +209,10 @@ public:
Geom::Point knot_get() const override {
return param->origin + param->vector;
};
- void knot_ungrabbed(Geom::Point const &p, Geom::Point const &origin, guint state) override {};
+ void knot_ungrabbed(Geom::Point const &p, Geom::Point const &origin, guint state) override
+ {
+ param->param_effect->refresh_widgets = true;
+ };
void knot_click(guint /*state*/) override{
g_print ("This is the vector handle associated to parameter '%s'\n", param->param_key.c_str());
};