summaryrefslogtreecommitdiffstats
path: root/src/live_effects/parameter
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2018-03-03 00:12:41 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2018-03-26 17:48:34 +0000
commit95b1c7b549605d7c6ce6623cc4cd121ed7c51a64 (patch)
tree1c38b4fe6baabbf45c55e0929516dd825f7d6847 /src/live_effects/parameter
parentAllow building with USE_PANGO_WIN32. (diff)
downloadinkscape-95b1c7b549605d7c6ce6623cc4cd121ed7c51a64.tar.gz
inkscape-95b1c7b549605d7c6ce6623cc4cd121ed7c51a64.zip
Base LPE refactor
Diffstat (limited to 'src/live_effects/parameter')
-rw-r--r--src/live_effects/parameter/array.h3
-rw-r--r--src/live_effects/parameter/bool.cpp6
-rw-r--r--src/live_effects/parameter/enum.h6
-rw-r--r--src/live_effects/parameter/hidden.cpp6
-rw-r--r--src/live_effects/parameter/message.cpp12
-rw-r--r--src/live_effects/parameter/message.h4
-rw-r--r--src/live_effects/parameter/originalitemarray.cpp3
-rw-r--r--src/live_effects/parameter/originalpath.cpp2
-rw-r--r--src/live_effects/parameter/originalpatharray.cpp9
-rw-r--r--src/live_effects/parameter/parameter.cpp9
-rw-r--r--src/live_effects/parameter/path.cpp2
-rw-r--r--src/live_effects/parameter/point.cpp19
-rw-r--r--src/live_effects/parameter/random.cpp6
-rw-r--r--src/live_effects/parameter/text.cpp6
-rw-r--r--src/live_effects/parameter/togglebutton.cpp6
-rw-r--r--src/live_effects/parameter/transformedpoint.cpp6
-rw-r--r--src/live_effects/parameter/vector.cpp6
17 files changed, 44 insertions, 67 deletions
diff --git a/src/live_effects/parameter/array.h b/src/live_effects/parameter/array.h
index c66d53266..b5ee8b5cf 100644
--- a/src/live_effects/parameter/array.h
+++ b/src/live_effects/parameter/array.h
@@ -64,8 +64,7 @@ public:
virtual gchar * param_getSVGValue() const {
Inkscape::SVGOStringStream os;
writesvg(os, _vector);
- gchar * str = g_strdup(os.str().c_str());
- return str;
+ return g_strdup(os.str().c_str());
}
virtual gchar * param_getDefaultSVGValue() const {
diff --git a/src/live_effects/parameter/bool.cpp b/src/live_effects/parameter/bool.cpp
index 1a01f269b..bfbda2bfd 100644
--- a/src/live_effects/parameter/bool.cpp
+++ b/src/live_effects/parameter/bool.cpp
@@ -57,15 +57,13 @@ BoolParam::param_readSVGValue(const gchar * strvalue)
gchar *
BoolParam::param_getSVGValue() const
{
- gchar * str = g_strdup(value ? "true" : "false");
- return str;
+ return g_strdup(value ? "true" : "false");
}
gchar *
BoolParam::param_getDefaultSVGValue() const
{
- gchar * str = g_strdup(defvalue ? "true" : "false");
- return str;
+ return g_strdup(defvalue ? "true" : "false");
}
Gtk::Widget *
diff --git a/src/live_effects/parameter/enum.h b/src/live_effects/parameter/enum.h
index ca237c0f7..82eaa6d43 100644
--- a/src/live_effects/parameter/enum.h
+++ b/src/live_effects/parameter/enum.h
@@ -61,13 +61,11 @@ public:
return true;
};
gchar * param_getSVGValue() const {
- gchar * str = g_strdup( enumdataconv->get_key(value).c_str() );
- return str;
+ return g_strdup( enumdataconv->get_key(value).c_str() );
};
gchar * param_getDefaultSVGValue() const {
- gchar * str = g_strdup( enumdataconv->get_key(defvalue).c_str() );
- return str;
+ return g_strdup( enumdataconv->get_key(defvalue).c_str() );
};
E get_value() const {
diff --git a/src/live_effects/parameter/hidden.cpp b/src/live_effects/parameter/hidden.cpp
index e08881f6d..5a21f572b 100644
--- a/src/live_effects/parameter/hidden.cpp
+++ b/src/live_effects/parameter/hidden.cpp
@@ -55,8 +55,7 @@ HiddenParam::param_getSVGValue() const
{
Inkscape::SVGOStringStream os;
os << value;
- gchar * str = g_strdup(os.str().c_str());
- return str;
+ return g_strdup(os.str().c_str());
}
gchar *
@@ -64,8 +63,7 @@ HiddenParam::param_getDefaultSVGValue() const
{
Inkscape::SVGOStringStream os;
os << defvalue;
- gchar * str = g_strdup(os.str().c_str());
- return str;
+ return g_strdup(os.str().c_str());
}
Gtk::Widget *
diff --git a/src/live_effects/parameter/message.cpp b/src/live_effects/parameter/message.cpp
index 1e2c9ec50..03eb2219f 100644
--- a/src/live_effects/parameter/message.cpp
+++ b/src/live_effects/parameter/message.cpp
@@ -17,8 +17,8 @@ MessageParam::MessageParam( const Glib::ustring& label, const Glib::ustring& tip
const Glib::ustring& key, Inkscape::UI::Widget::Registry* wr,
Effect* effect, const gchar * default_message )
: Parameter(label, tip, key, wr, effect),
- message(g_strdup(default_message)),
- defmessage(g_strdup(default_message))
+ message(default_message),
+ defmessage(default_message)
{
_label = NULL;
_min_height = -1;
@@ -33,7 +33,7 @@ MessageParam::param_set_default()
void
MessageParam::param_update_default(const gchar * default_message)
{
- defmessage = g_strdup(default_message);
+ defmessage = default_message;
}
bool
@@ -46,13 +46,13 @@ MessageParam::param_readSVGValue(const gchar * strvalue)
gchar *
MessageParam::param_getSVGValue() const
{
- return message;
+ return g_strdup(message);
}
gchar *
MessageParam::param_getDefaultSVGValue() const
{
- return defmessage;
+ return g_strdup(defmessage);
}
void
@@ -106,7 +106,7 @@ MessageParam::param_setValue(const gchar * strvalue)
if (strcmp(strvalue, message) != 0) {
param_effect->upd_params = true;
}
- message = g_strdup(strvalue);
+ message = strvalue;
}
diff --git a/src/live_effects/parameter/message.h b/src/live_effects/parameter/message.h
index 2ac2c791a..fd850a767 100644
--- a/src/live_effects/parameter/message.h
+++ b/src/live_effects/parameter/message.h
@@ -41,8 +41,8 @@ private:
int _min_height;
MessageParam(const MessageParam&);
MessageParam& operator=(const MessageParam&);
- gchar * message;
- gchar * defmessage;
+ const gchar * message;
+ const gchar * defmessage;
};
} //namespace LivePathEffect
diff --git a/src/live_effects/parameter/originalitemarray.cpp b/src/live_effects/parameter/originalitemarray.cpp
index fe2dc0c8d..b89485e2d 100644
--- a/src/live_effects/parameter/originalitemarray.cpp
+++ b/src/live_effects/parameter/originalitemarray.cpp
@@ -438,8 +438,7 @@ gchar * OriginalItemArrayParam::param_getSVGValue() const
}
os << (*iter)->href << "," << ((*iter)->actived ? "1" : "0");
}
- gchar * str = g_strdup(os.str().c_str());
- return str;
+ return g_strdup(os.str().c_str());
}
gchar * OriginalItemArrayParam::param_getDefaultSVGValue() const
diff --git a/src/live_effects/parameter/originalpath.cpp b/src/live_effects/parameter/originalpath.cpp
index b6a90671e..018e1e69e 100644
--- a/src/live_effects/parameter/originalpath.cpp
+++ b/src/live_effects/parameter/originalpath.cpp
@@ -93,7 +93,7 @@ OriginalPathParam::linked_modified_callback(SPObject *linked_obj, guint /*flags*
SPCurve *curve = NULL;
if (SP_IS_SHAPE(linked_obj)) {
if (_from_original_d) {
- curve = SP_SHAPE(linked_obj)->getCurveBeforeLPE();
+ curve = SP_SHAPE(linked_obj)->getCurveForEdit();
} else {
curve = SP_SHAPE(linked_obj)->getCurve();
}
diff --git a/src/live_effects/parameter/originalpatharray.cpp b/src/live_effects/parameter/originalpatharray.cpp
index caec74a8b..928bf2976 100644
--- a/src/live_effects/parameter/originalpatharray.cpp
+++ b/src/live_effects/parameter/originalpatharray.cpp
@@ -428,9 +428,9 @@ void OriginalPathArrayParam::setPathVector(SPObject *linked_obj, guint /*flags*/
if (SP_IS_SHAPE(linked_obj)) {
SPLPEItem * lpe_item = SP_LPE_ITEM(linked_obj);
if (_from_original_d) {
- curve = SP_SHAPE(linked_obj)->getCurveBeforeLPE();
+ curve = SP_SHAPE(linked_obj)->getCurveForEdit();
} else if (_allow_only_bspline_spiro && lpe_item && lpe_item->hasPathEffect()){
- curve = SP_SHAPE(linked_obj)->getCurveBeforeLPE();
+ curve = SP_SHAPE(linked_obj)->getCurveForEdit();
PathEffectList lpelist = lpe_item->getEffectList();
PathEffectList::iterator i;
for (i = lpelist.begin(); i != lpelist.end(); ++i) {
@@ -524,13 +524,12 @@ gchar * OriginalPathArrayParam::param_getSVGValue() const
}
os << (*iter)->href << "," << ((*iter)->reversed ? "1" : "0") << "," << ((*iter)->visibled ? "1" : "0");
}
- gchar * str = g_strdup(os.str().c_str());
- return str;
+ return g_strdup(os.str().c_str());
}
gchar * OriginalPathArrayParam::param_getDefaultSVGValue() const
{
- return "";
+ return g_strdup("");
}
void OriginalPathArrayParam::update()
diff --git a/src/live_effects/parameter/parameter.cpp b/src/live_effects/parameter/parameter.cpp
index 497113e03..a175359f0 100644
--- a/src/live_effects/parameter/parameter.cpp
+++ b/src/live_effects/parameter/parameter.cpp
@@ -91,8 +91,7 @@ ScalarParam::param_getSVGValue() const
{
Inkscape::SVGOStringStream os;
os << value;
- gchar * str = g_strdup(os.str().c_str());
- return str;
+ return g_strdup(os.str().c_str());
}
gchar *
@@ -100,8 +99,7 @@ ScalarParam::param_getDefaultSVGValue() const
{
Inkscape::SVGOStringStream os;
os << defvalue;
- gchar * str = g_strdup(os.str().c_str());
- return str;
+ return g_strdup(os.str().c_str());
}
void
@@ -129,6 +127,9 @@ ScalarParam::param_update_default(const gchar * default_value)
void
ScalarParam::param_set_value(gdouble val)
{
+ if (value != val) {
+ param_effect->upd_params = true;
+ }
value = val;
if (integer)
value = round(value);
diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp
index 02075ee8e..ab385daa6 100644
--- a/src/live_effects/parameter/path.cpp
+++ b/src/live_effects/parameter/path.cpp
@@ -460,7 +460,7 @@ PathParam::linked_modified_callback(SPObject *linked_obj, guint /*flags*/)
SPCurve *curve = NULL;
if (SP_IS_SHAPE(linked_obj)) {
if (_from_original_d) {
- curve = SP_SHAPE(linked_obj)->getCurveBeforeLPE();
+ curve = SP_SHAPE(linked_obj)->getCurveForEdit();
} else {
curve = SP_SHAPE(linked_obj)->getCurve();
}
diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp
index 9b4723da3..b811b7f2b 100644
--- a/src/live_effects/parameter/point.cpp
+++ b/src/live_effects/parameter/point.cpp
@@ -128,8 +128,7 @@ PointParam::param_getSVGValue() const
{
Inkscape::SVGOStringStream os;
os << *dynamic_cast<Geom::Point const *>( this );
- gchar * str = g_strdup(os.str().c_str());
- return str;
+ return g_strdup(os.str().c_str());
}
gchar *
@@ -137,8 +136,7 @@ PointParam::param_getDefaultSVGValue() const
{
Inkscape::SVGOStringStream os;
os << defvalue;
- gchar * str = g_strdup(os.str().c_str());
- return str;
+ return g_strdup(os.str().c_str());
}
void
@@ -212,10 +210,10 @@ PointParamKnotHolderEntity::knot_set(Geom::Point const &p, Geom::Point const &or
s = A;
}
}
- pparam->param_setValue(s);
- SPLPEItem * splpeitem = dynamic_cast<SPLPEItem *>(item);
- if(splpeitem && this->pparam->liveupdate){
- sp_lpe_item_update_patheffect(splpeitem, true, true);
+ if(this->pparam->liveupdate){
+ pparam->param_setValue(s, true);
+ } else {
+ pparam->param_setValue(s);
}
}
@@ -231,10 +229,7 @@ PointParamKnotHolderEntity::knot_click(guint state)
if (state & GDK_CONTROL_MASK) {
if (state & GDK_MOD1_MASK) {
this->pparam->param_set_default();
- SPLPEItem * splpeitem = dynamic_cast<SPLPEItem *>(item);
- if(splpeitem){
- sp_lpe_item_update_patheffect(splpeitem, true, true);
- }
+ pparam->param_setValue(*pparam,true);
}
}
}
diff --git a/src/live_effects/parameter/random.cpp b/src/live_effects/parameter/random.cpp
index 4afa43c6e..23912bedb 100644
--- a/src/live_effects/parameter/random.cpp
+++ b/src/live_effects/parameter/random.cpp
@@ -67,8 +67,7 @@ RandomParam::param_getSVGValue() const
{
Inkscape::SVGOStringStream os;
os << value << ';' << startseed;
- gchar * str = g_strdup(os.str().c_str());
- return str;
+ return g_strdup(os.str().c_str());
}
gchar *
@@ -76,8 +75,7 @@ RandomParam::param_getDefaultSVGValue() const
{
Inkscape::SVGOStringStream os;
os << defvalue << ';' << defseed;
- gchar * str = g_strdup(os.str().c_str());
- return str;
+ return g_strdup(os.str().c_str());
}
void
diff --git a/src/live_effects/parameter/text.cpp b/src/live_effects/parameter/text.cpp
index 7e56b2c75..37ae3a1d7 100644
--- a/src/live_effects/parameter/text.cpp
+++ b/src/live_effects/parameter/text.cpp
@@ -112,8 +112,7 @@ TextParam::param_getSVGValue() const
{
Inkscape::SVGOStringStream os;
os << value;
- gchar * str = g_strdup(os.str().c_str());
- return str;
+ return g_strdup(os.str().c_str());
}
gchar *
@@ -121,8 +120,7 @@ TextParam::param_getDefaultSVGValue() const
{
Inkscape::SVGOStringStream os;
os << defvalue;
- gchar * str = g_strdup(os.str().c_str());
- return str;
+ return g_strdup(os.str().c_str());
}
void
diff --git a/src/live_effects/parameter/togglebutton.cpp b/src/live_effects/parameter/togglebutton.cpp
index e26884d6a..bb9d9a90e 100644
--- a/src/live_effects/parameter/togglebutton.cpp
+++ b/src/live_effects/parameter/togglebutton.cpp
@@ -55,15 +55,13 @@ ToggleButtonParam::param_readSVGValue(const gchar * strvalue)
gchar *
ToggleButtonParam::param_getSVGValue() const
{
- gchar * str = g_strdup(value ? "true" : "false");
- return str;
+ return g_strdup(value ? "true" : "false");
}
gchar *
ToggleButtonParam::param_getDefaultSVGValue() const
{
- gchar * str = g_strdup(defvalue ? "true" : "false");
- return str;
+ return g_strdup(defvalue ? "true" : "false");
}
void
diff --git a/src/live_effects/parameter/transformedpoint.cpp b/src/live_effects/parameter/transformedpoint.cpp
index a010faf27..ab66e7256 100644
--- a/src/live_effects/parameter/transformedpoint.cpp
+++ b/src/live_effects/parameter/transformedpoint.cpp
@@ -78,8 +78,7 @@ TransformedPointParam::param_getSVGValue() const
{
Inkscape::SVGOStringStream os;
os << origin << " , " << vector;
- gchar * str = g_strdup(os.str().c_str());
- return str;
+ return g_strdup(os.str().c_str());
}
gchar *
@@ -87,8 +86,7 @@ TransformedPointParam::param_getDefaultSVGValue() const
{
Inkscape::SVGOStringStream os;
os << defvalue;
- gchar * str = g_strdup(os.str().c_str());
- return str;
+ return g_strdup(os.str().c_str());
}
void
diff --git a/src/live_effects/parameter/vector.cpp b/src/live_effects/parameter/vector.cpp
index ced93ef0d..1207a05da 100644
--- a/src/live_effects/parameter/vector.cpp
+++ b/src/live_effects/parameter/vector.cpp
@@ -97,8 +97,7 @@ VectorParam::param_getSVGValue() const
{
Inkscape::SVGOStringStream os;
os << origin << " , " << vector;
- gchar * str = g_strdup(os.str().c_str());
- return str;
+ return g_strdup(os.str().c_str());
}
gchar *
@@ -106,8 +105,7 @@ VectorParam::param_getDefaultSVGValue() const
{
Inkscape::SVGOStringStream os;
os << defvalue;
- gchar * str = g_strdup(os.str().c_str());
- return str;
+ return g_strdup(os.str().c_str());
}
Gtk::Widget *