summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/effect.cpp102
-rw-r--r--src/live_effects/effect.h6
-rw-r--r--src/live_effects/lpe-measure-line.cpp152
-rw-r--r--src/live_effects/lpe-measure-line.h1
-rw-r--r--src/live_effects/parameter/array.h2
-rw-r--r--src/live_effects/parameter/bool.cpp6
-rw-r--r--src/live_effects/parameter/bool.h2
-rw-r--r--src/live_effects/parameter/enum.h10
-rw-r--r--src/live_effects/parameter/filletchamferpointarray.h1
-rw-r--r--src/live_effects/parameter/fontbutton.cpp7
-rw-r--r--src/live_effects/parameter/fontbutton.h6
-rw-r--r--src/live_effects/parameter/item.cpp4
-rw-r--r--src/live_effects/parameter/item.h1
-rw-r--r--src/live_effects/parameter/originalpatharray.h3
-rw-r--r--src/live_effects/parameter/parameter.cpp10
-rw-r--r--src/live_effects/parameter/parameter.h6
-rw-r--r--src/live_effects/parameter/path.cpp4
-rw-r--r--src/live_effects/parameter/path.h1
-rw-r--r--src/live_effects/parameter/point.cpp13
-rw-r--r--src/live_effects/parameter/point.h2
-rw-r--r--src/live_effects/parameter/powerstrokepointarray.h2
-rw-r--r--src/live_effects/parameter/random.cpp14
-rw-r--r--src/live_effects/parameter/random.h4
-rw-r--r--src/live_effects/parameter/text.cpp4
-rw-r--r--src/live_effects/parameter/text.h6
-rw-r--r--src/live_effects/parameter/togglebutton.cpp14
-rw-r--r--src/live_effects/parameter/togglebutton.h2
-rw-r--r--src/live_effects/parameter/transformedpoint.cpp19
-rw-r--r--src/live_effects/parameter/transformedpoint.h4
-rw-r--r--src/live_effects/parameter/unit.cpp4
-rw-r--r--src/live_effects/parameter/unit.h5
-rw-r--r--src/live_effects/parameter/vector.cpp19
-rw-r--r--src/live_effects/parameter/vector.h3
-rw-r--r--src/preferences.cpp29
-rw-r--r--src/ui/dialog/livepatheffect-editor.cpp19
35 files changed, 351 insertions, 136 deletions
diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp
index bfcca422e..37694f32f 100644
--- a/src/live_effects/effect.cpp
+++ b/src/live_effects/effect.cpp
@@ -73,6 +73,7 @@
#include "path-chemistry.h"
#include "xml/sp-css-attr.h"
#include "live_effects/lpeobject.h"
+#include <pangomm/layout.h>
#include "display/curve.h"
#include <stdio.h>
#include <string.h>
@@ -80,7 +81,7 @@
namespace Inkscape {
namespace LivePathEffect {
-const Glib::ustring DEFAULT_PREF_VALUE = "--default";
+
const Util::EnumData<EffectType> LPETypeData[] = {
// {constant defined in effect-enum.h, N_("name of your effect"), "name of your effect in SVG"}
#ifdef LPE_ENABLE_TEST_EFFECTS
@@ -645,6 +646,7 @@ void
Effect::readallParameters(Inkscape::XML::Node const* repr)
{
std::vector<Parameter *>::iterator it = param_vector.begin();
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
while (it != param_vector.end()) {
Parameter * param = *it;
const gchar * key = param->param_key.c_str();
@@ -655,10 +657,17 @@ Effect::readallParameters(Inkscape::XML::Node const* repr)
g_warning("Effect::readallParameters - '%s' not accepted for %s", value, key);
}
} else {
- // set default value
- param->param_set_default();
+ Glib::ustring pref_path = (Glib::ustring)"/live_effects/" +
+ (Glib::ustring)LPETypeConverter.get_key(effectType()).c_str() +
+ (Glib::ustring)"/" +
+ (Glib::ustring)key;
+ bool valid = prefs->getEntry(pref_path).isValid();
+ if(valid){
+ param->param_update_default(prefs->getString(pref_path).c_str());
+ } else {
+ param->param_set_default();
+ }
}
-
++it;
}
}
@@ -777,6 +786,91 @@ Effect::newWidget()
return dynamic_cast<Gtk::Widget *>(vbox);
}
+/**
+ * This *creates* a new widget, with default values setter
+ */
+Gtk::Widget *
+Effect::defaultParamSet()
+{
+ // use manage here, because after deletion of Effect object, others might still be pointing to this widget.
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ Gtk::VBox * vbox = Gtk::manage( new Gtk::VBox() );
+
+ vbox->set_border_width(5);
+ Gtk::VBox * vbox_expander = Gtk::manage( new Gtk::VBox() );
+ vbox_expander->set_border_width(10);
+ vbox_expander->set_spacing(2);
+ Glib::ustring effectname = (Glib::ustring)Inkscape::LivePathEffect::LPETypeConverter.get_label(effectType());
+ Glib::ustring effectkey = (Glib::ustring)Inkscape::LivePathEffect::LPETypeConverter.get_key(effectType());
+ std::vector<Parameter *>::iterator it = param_vector.begin();
+ Inkscape::UI::Widget::Registry * wr;
+ while (it != param_vector.end()) {
+ if ((*it)->widget_is_visible) {
+ Parameter * param = *it;
+ Glib::ustring * tip = param->param_getTooltip();
+ const gchar * key = param->param_key.c_str();
+ const gchar * value = param->param_label.c_str();
+ const gchar * tooltip_extra = _(". Change custom values for this parameter");
+ Glib::ustring tooltip = param->param_tooltip + (Glib::ustring)tooltip_extra;
+ Glib::ustring pref_path = (Glib::ustring)"/live_effects/" +
+ effectkey +
+ (Glib::ustring)"/" +
+ (Glib::ustring)key;
+ bool valid = prefs->getEntry(pref_path).isValid();
+ const gchar * set_or_upd;
+ if (valid) {
+ set_or_upd = _("Update");
+ } else {
+ set_or_upd = _("Set");
+ }
+ Gtk::HBox * vbox_param = Gtk::manage( new Gtk::HBox(true) );
+ Gtk::Label *parameter_label = Gtk::manage(new Gtk::Label(value, Gtk::ALIGN_START));
+ parameter_label->set_use_markup(true);
+ parameter_label->set_use_underline (true);
+ parameter_label->set_ellipsize(Pango::ELLIPSIZE_END);
+ vbox_param->pack_start(*parameter_label, true, true, 2);
+ Gtk::Button *set = Gtk::manage(new Gtk::Button((Glib::ustring)set_or_upd));
+ Gtk::Button *unset = Gtk::manage(new Gtk::Button(Glib::ustring(_("Unset"))));
+ unset->signal_clicked().connect(sigc::bind<Glib::ustring, Gtk::Button *, Gtk::Button *>(sigc::mem_fun(*this, &Effect::unsetDefaultParam), pref_path, set, unset));
+ set->signal_clicked().connect(sigc::bind<Glib::ustring, gchar *, Gtk::Button *, Gtk::Button *>(sigc::mem_fun(*this, &Effect::setDefaultParam), pref_path, param->param_getSVGValue(), set, unset));
+ if (!valid) {
+ unset->set_sensitive(false);
+ }
+ vbox_param->pack_start(*set, true, true, 2);
+ vbox_param->pack_start(*unset, true, true, 2);
+
+ vbox_expander->pack_start(*vbox_param, true, true, 2);
+ }
+ ++it;
+ }
+ Glib::ustring tip = "<b>" + effectname + (Glib::ustring)_("</b>: Set default parameters to current values");
+ Gtk::Expander * expander = Gtk::manage(new Gtk::Expander(tip));
+ expander->set_use_markup(true);
+ expander->add(*vbox_expander);
+ expander->set_expanded(false);
+ vbox->pack_start(*dynamic_cast<Gtk::Widget *> (expander), true, true, 2);
+ return dynamic_cast<Gtk::Widget *>(vbox);
+}
+
+void
+Effect::setDefaultParam(Glib::ustring pref_path, gchar * value, Gtk::Button *set , Gtk::Button *unset)
+{
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ prefs->setString(pref_path, (Glib::ustring)value);
+ gchar * label = _("Update");
+ set->set_label((Glib::ustring)label);
+ unset->set_sensitive(true);
+}
+
+void
+Effect::unsetDefaultParam(Glib::ustring pref_path, Gtk::Button *set, Gtk::Button *unset)
+{
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ prefs->remove(pref_path);
+ gchar * label = _("Set");
+ set->set_label((Glib::ustring)label);
+ unset->set_sensitive(false);
+}
Inkscape::XML::Node *Effect::getRepr()
{
diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h
index f5e41d50e..c34c391c0 100644
--- a/src/live_effects/effect.h
+++ b/src/live_effects/effect.h
@@ -94,7 +94,7 @@ public:
virtual void doEffect (SPCurve * curve);
virtual Gtk::Widget * newWidget();
-
+ virtual Gtk::Widget * defaultParamSet();
/**
* Sets all parameters to their default values and writes them to SVG.
*/
@@ -172,13 +172,15 @@ protected:
// this boolean defaults to false, it concatenates the input path to one pwd2,
// instead of normally 'splitting' the path into continuous pwd2 paths and calling doEffect_pwd2 for each.
bool concatenate_before_pwd2;
-
SPLPEItem * sp_lpe_item; // these get stored in doBeforeEffect_impl, and derived classes may do as they please with them.
SPShape * sp_shape; // these get stored in doBeforeEffect_impl before doEffect chain, or in performPathEffects on groups, and derived classes may do as they please with them.
std::vector<const char *> items;
double current_zoom;
std::vector<Geom::Point> selectedNodesPoints;
+
private:
+ void setDefaultParam(Glib::ustring pref_path, gchar * value, Gtk::Button *set , Gtk::Button *unset);
+ void unsetDefaultParam(Glib::ustring pref_path, Gtk::Button *set , Gtk::Button *unset);
bool provides_own_flash_paths; // if true, the standard flash path is suppressed
bool is_ready;
diff --git a/src/live_effects/lpe-measure-line.cpp b/src/live_effects/lpe-measure-line.cpp
index 86d72615c..52aa56fa0 100644
--- a/src/live_effects/lpe-measure-line.cpp
+++ b/src/live_effects/lpe-measure-line.cpp
@@ -49,32 +49,33 @@ static const Util::EnumDataConverter<OrientationMethod> OMConverter(OrientationM
LPEMeasureLine::LPEMeasureLine(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
- unit(_("Unit*"), _("Unit"), "unit", &wr, this, "px"),
- fontbutton(_("Font*"), _("Font Selector"), "fontbutton", &wr, this),
+ unit(_("Unit"), _("Unit"), "unit", &wr, this, "px"),
+ fontbutton(_("Font"), _("Font Selector"), "fontbutton", &wr, this),
orientation(_("Orientation"), _("Orientation method"), "orientation", OMConverter, &wr, this, OM_PARALLEL, false),
curve_linked(_("Curve on origin"), _("Curve on origin, set 0 to start/end"), "curve_linked", &wr, this, 1),
- precision(_("Precision*"), _("Precision"), "precision", &wr, this, 2),
- position(_("Position*"), _("Position"), "position", &wr, this, 5),
- text_top_bottom(_("Text top/bottom*"), _("Text top/bottom"), "text_top_bottom", &wr, this, 0),
- text_right_left(_("Text right/left*"), _("Text right/left"), "text_right_left", &wr, this, 0),
- helpline_distance(_("Helpline distance*"), _("Helpline distance"), "helpline_distance", &wr, this, 0.0),
- helpline_overlap(_("Helpline overlap*"), _("Helpline overlap"), "helpline_overlap", &wr, this, 2.0),
- scale(_("Scale*"), _("Scaling factor"), "scale", &wr, this, 1.0),
- format(_("Format*"), _("Format the number ex:{measure} {unit}, return to save"), "format", &wr, this,"{measure}{unit}"),
+ precision(_("Precision"), _("Precision"), "precision", &wr, this, 2),
+ position(_("Position"), _("Position"), "position", &wr, this, 5),
+ text_top_bottom(_("Text top/bottom"), _("Text top/bottom"), "text_top_bottom", &wr, this, 0),
+ text_right_left(_("Text right/left"), _("Text right/left"), "text_right_left", &wr, this, 0),
+ helpline_distance(_("Helpline distance"), _("Helpline distance"), "helpline_distance", &wr, this, 0.0),
+ helpline_overlap(_("Helpline overlap"), _("Helpline overlap"), "helpline_overlap", &wr, this, 2.0),
+ scale(_("Scale"), _("Scaling factor"), "scale", &wr, this, 1.0),
+ format(_("Format"), _("Format the number ex:{measure} {unit}, return to save"), "format", &wr, this,"{measure}{unit}"),
id_origin("id_origin", "id_origin", "id_origin", &wr, this,""),
arrows_outside(_("Arrows outside"), _("Arrows outside"), "arrows_outside", &wr, this, false),
- flip_side(_("Flip side*"), _("Flip side"), "flip_side", &wr, this, false),
- scale_sensitive(_("Scale sensitive*"), _("Costrained scale sensitive to transformed containers"), "scale_sensitive", &wr, this, true),
- local_locale(_("Local Number Format*"), _("Local number format"), "local_locale", &wr, this, true),
- line_group_05(_("Line Group 0.5*"), _("Line Group 0.5, from 0.7"), "line_group_05", &wr, this, true),
- rotate_anotation(_("Rotate Anotation*"), _("Rotate Anotation"), "rotate_anotation", &wr, this, true),
- hide_back(_("Hide if label over*"), _("Hide DIN line if label over"), "hide_back", &wr, this, true),
- dimline_format(_("CSS DIN line*"), _("Override CSS to DIN line, return to save, empty to reset to DIM"), "dimline_format", &wr, this,""),
- helperlines_format(_("CSS helpers*"), _("Override CSS to helper lines, return to save, empty to reset to DIM"), "helperlines_format", &wr, this,""),
- anotation_format(_("CSS anotation*"), _("Override CSS to anotation text, return to save, empty to reset to DIM"), "anotation_format", &wr, this,""),
- arrows_format(_("CSS arrows*"), _("Override CSS to arrows, return to save, empty to reset DIM"), "arrows_format", &wr, this,""),
+ flip_side(_("Flip side"), _("Flip side"), "flip_side", &wr, this, false),
+ scale_sensitive(_("Scale sensitive"), _("Costrained scale sensitive to transformed containers"), "scale_sensitive", &wr, this, true),
+ local_locale(_("Local Number Format"), _("Local number format"), "local_locale", &wr, this, true),
+ line_group_05(_("Line Group 0.5"), _("Line Group 0.5, from 0.7"), "line_group_05", &wr, this, true),
+ rotate_anotation(_("Rotate Anotation"), _("Rotate Anotation"), "rotate_anotation", &wr, this, true),
+ hide_back(_("Hide if label over"), _("Hide DIN line if label over"), "hide_back", &wr, this, true),
+ dimline_format(_("CSS DIN line"), _("Override CSS to DIN line, return to save, empty to reset to DIM"), "dimline_format", &wr, this,""),
+ helperlines_format(_("CSS helpers"), _("Override CSS to helper lines, return to save, empty to reset to DIM"), "helperlines_format", &wr, this,""),
+ anotation_format(_("CSS anotation"), _("Override CSS to anotation text, return to save, empty to reset to DIM"), "anotation_format", &wr, this,""),
+ arrows_format(_("CSS arrows"), _("Override CSS to arrows, return to save, empty to reset DIM"), "arrows_format", &wr, this,""),
expanded(false)
{
+ //set to true the parameters you want to be changed his default values
registerParameter(&unit);
registerParameter(&fontbutton);
registerParameter(&orientation);
@@ -99,39 +100,16 @@ LPEMeasureLine::LPEMeasureLine(LivePathEffectObject *lpeobject) :
registerParameter(&anotation_format);
registerParameter(&arrows_format);
registerParameter(&id_origin);
+
id_origin.param_hide_canvas_text();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- Glib::ustring fontbutton_value = prefs->getString("/live_effects/measure-line/fontbutton");
- if(fontbutton_value.empty()){
- fontbutton_value = "Sans 10";
- }
- fontbutton.param_update_default(fontbutton_value);
- scale.param_update_default(prefs->getDouble("/live_effects/measure-line/scale", 1.0));
- precision.param_update_default(prefs->getInt("/live_effects/measure-line/precision", 2));
- position.param_update_default(prefs->getDouble("/live_effects/measure-line/position", 10.0));
- text_top_bottom.param_update_default(prefs->getDouble("/live_effects/measure-line/text_top_bottom", 5.0));
- helpline_distance.param_update_default(prefs->getDouble("/live_effects/measure-line/helpline_distance", 0.0));
- helpline_overlap.param_update_default(prefs->getDouble("/live_effects/measure-line/helpline_overlap", 0.0));
- Glib::ustring unit_value = prefs->getString("/live_effects/measure-line/unit");
- if(unit_value.empty()){
- unit_value = "px";
- }
- unit.param_update_default(unit_value);
+
Glib::ustring format_value = prefs->getString("/live_effects/measure-line/format");
if(format_value.empty()){
format_value = "{measure}{unit}";
}
- format.param_update_default(format_value);
- dimline_format.param_update_default(prefs->getString("/live_effects/measure-line/dimline_format"));
- helperlines_format.param_update_default(prefs->getString("/live_effects/measure-line/helperlines_format"));
- anotation_format.param_update_default(prefs->getString("/live_effects/measure-line/anotation_format"));
- arrows_format.param_update_default(prefs->getString("/live_effects/measure-line/arrows_format"));
- flip_side.param_update_default(prefs->getBool("/live_effects/measure-line/flip_side"));
- scale_sensitive.param_update_default(prefs->getBool("/live_effects/measure-line/scale_sensitive"));
- local_locale.param_update_default(prefs->getBool("/live_effects/measure-line/local_locale"));
- line_group_05.param_update_default(prefs->getBool("/live_effects/measure-line/line_group_05"));
- rotate_anotation.param_update_default(prefs->getBool("/live_effects/measure-line/rotate_anotation"));
- hide_back.param_update_default(prefs->getBool("/live_effects/measure-line/hide_back"));
+ format.param_update_default(format_value.c_str());
+
format.param_hide_canvas_text();
dimline_format.param_hide_canvas_text();
helperlines_format.param_hide_canvas_text();
@@ -375,7 +353,7 @@ LPEMeasureLine::createTextLabel(Geom::Point pos, double length, Geom::Coord angl
items.push_back(id);
Geom::OptRect bounds = SP_ITEM(elemref)->bounds(SPItem::GEOMETRIC_BBOX);
if (bounds) {
- anotation_width = bounds->width() * 1.4;
+ anotation_width = bounds->width() * 1.15;
}
}
@@ -405,8 +383,14 @@ LPEMeasureLine::createLine(Geom::Point start,Geom::Point end, const char * id, b
k = (Geom::distance(start,end)/2.0) - arrow_gap - (anotation_width/2.0);
}
if (Geom::distance(start,end) < anotation_width){
- return;
+ if ((elemref = document->getObjectById(id))) {
+ if (remove) {
+ elemref->deleteObject();
+ }
+ return;
+ }
}
+ //k = std::max(k , arrow_gap -1);
Geom::Ray ray(end, start);
Geom::Coord angle = ray.angle();
line_path.start(start);
@@ -622,6 +606,9 @@ LPEMeasureLine::doBeforeEffect (SPLPEItem const* lpeitem)
}
bool overflow = false;
const char * downline = g_strdup(Glib::ustring("downline-").append(this->getRepr()->attribute("id")).c_str());
+ //delete residual lines if exist
+ createLine(Geom::Point(),Geom::Point(), downline, true, overflow, true, false);
+ //Create it
if ((anotation_width/2) + std::abs(text_right_left) > Geom::distance(start,end)/2.0) {
Geom::Point sstart = end - Point::polar(angle_cross, position);
Geom::Point send = end - Point::polar(angle_cross, position);
@@ -645,9 +632,6 @@ LPEMeasureLine::doBeforeEffect (SPLPEItem const* lpeitem)
}
overflow = true;
createLine(sstart, prog_end, downline, true, overflow, false, false);
- } else {
- //erase it
- createLine(Geom::Point(),Geom::Point(), downline, true, overflow, true, false);
}
//LINE
arrow_gap = 8 * Inkscape::Util::Quantity::convert(0.35 / doc_scale, "mm", display_unit.c_str());
@@ -708,44 +692,41 @@ Gtk::Widget *LPEMeasureLine::newWidget()
vbox->set_spacing(2);
std::vector<Parameter *>::iterator it = param_vector.begin();
- Gtk::HBox * button1 = Gtk::manage(new Gtk::HBox(true,0));
Gtk::VBox * vbox_expander = Gtk::manage( new Gtk::VBox(Effect::newWidget()) );
vbox_expander->set_border_width(0);
vbox_expander->set_spacing(2);
while (it != param_vector.end()) {
if ((*it)->widget_is_visible) {
Parameter *param = *it;
- Gtk::Widget *widg = dynamic_cast<Gtk::Widget *>(param->param_newWidget());
- Glib::ustring *tip = param->param_getTooltip();
- if (widg) {
- if (param->param_key != "dimline_format" &&
- param->param_key != "helperlines_format" &&
- param->param_key != "arrows_format" &&
- param->param_key != "anotation_format") {
- vbox->pack_start(*widg, true, true, 2);
- } else {
- vbox_expander->pack_start(*widg, true, true, 2);
- }
- if (tip) {
- widg->set_tooltip_text(*tip);
- } else {
- widg->set_tooltip_text("");
- widg->set_has_tooltip(false);
+ if (param->param_key != "id_origin") {
+ Gtk::Widget *widg = dynamic_cast<Gtk::Widget *>(param->param_newWidget());
+ Glib::ustring *tip = param->param_getTooltip();
+ if (widg) {
+ if (param->param_key != "dimline_format" &&
+ param->param_key != "helperlines_format" &&
+ param->param_key != "arrows_format" &&
+ param->param_key != "anotation_format") {
+ vbox->pack_start(*widg, true, true, 2);
+ } else {
+ vbox_expander->pack_start(*widg, true, true, 2);
+ }
+ if (tip) {
+ widg->set_tooltip_text(*tip);
+ } else {
+ widg->set_tooltip_text("");
+ widg->set_has_tooltip(false);
+ }
}
}
}
++it;
}
- Gtk::Button *save_default = Gtk::manage(new Gtk::Button(Glib::ustring(_("Save '*' as default"))));
- save_default->signal_clicked().connect(sigc::mem_fun(*this, &LPEMeasureLine::saveDefault));
- button1->pack_start(*save_default, true, true, 2);
expander = Gtk::manage(new Gtk::Expander(Glib::ustring(_("Show DIM CSS style override"))));
expander->add(*vbox_expander);
expander->set_expanded(expanded);
expander->property_expanded().signal_changed().connect(sigc::mem_fun(*this, &LPEMeasureLine::onExpanderChanged) );
vbox->pack_start(*expander, true, true, 2);
- vbox->pack_start(*button1, true, true, 2);
return dynamic_cast<Gtk::Widget *>(vbox);
}
@@ -766,31 +747,6 @@ LPEMeasureLine::doEffect_path(Geom::PathVector const &path_in)
return path_in;
}
-void
-LPEMeasureLine::saveDefault()
-{
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->setString("/live_effects/measure-line/fontbutton", Glib::ustring(fontbutton.param_getSVGValue()));
- prefs->setDouble("/live_effects/measure-line/scale", scale);
- prefs->setInt("/live_effects/measure-line/precision", precision);
- prefs->setDouble("/live_effects/measure-line/position", position);
- prefs->setDouble("/live_effects/measure-line/text_top_bottom", text_top_bottom);
- prefs->setDouble("/live_effects/measure-line/helpline_distance", helpline_distance);
- prefs->setDouble("/live_effects/measure-line/helpline_overlap", helpline_overlap);
- prefs->setString("/live_effects/measure-line/unit", Glib::ustring(unit.get_abbreviation()));
- prefs->setString("/live_effects/measure-line/format", Glib::ustring(format.param_getSVGValue()));
- prefs->setString("/live_effects/measure-line/dimline_format", Glib::ustring(dimline_format.param_getSVGValue()));
- prefs->setString("/live_effects/measure-line/helperlines_format", Glib::ustring(helperlines_format.param_getSVGValue()));
- prefs->setString("/live_effects/measure-line/anotation_format", Glib::ustring(anotation_format.param_getSVGValue()));
- prefs->setString("/live_effects/measure-line/arrows_format", Glib::ustring(arrows_format.param_getSVGValue()));
- prefs->setBool("/live_effects/measure-line/flip_side", flip_side);
- prefs->setBool("/live_effects/measure-line/scale_sensitive", scale_sensitive);
- prefs->setBool("/live_effects/measure-line/local_locale", local_locale);
- prefs->setBool("/live_effects/measure-line/line_group_05", line_group_05);
- prefs->setBool("/live_effects/measure-line/rotate_anotation", rotate_anotation);
- prefs->setBool("/live_effects/measure-line/hide_back", hide_back);
-}
-
}; //namespace LivePathEffect
}; /* namespace Inkscape */
diff --git a/src/live_effects/lpe-measure-line.h b/src/live_effects/lpe-measure-line.h
index 724c0d924..b42f7cfd5 100644
--- a/src/live_effects/lpe-measure-line.h
+++ b/src/live_effects/lpe-measure-line.h
@@ -49,7 +49,6 @@ public:
void createTextLabel(Geom::Point pos, double length, Geom::Coord angle, bool remove, bool valid);
void onExpanderChanged();
void createArrowMarker(const char * mode);
- void saveDefault();
virtual Gtk::Widget *newWidget();
private:
UnitParam unit;
diff --git a/src/live_effects/parameter/array.h b/src/live_effects/parameter/array.h
index a600f0257..fa08e1f91 100644
--- a/src/live_effects/parameter/array.h
+++ b/src/live_effects/parameter/array.h
@@ -59,7 +59,7 @@ public:
g_strfreev (strarray);
return true;
}
-
+ virtual void param_update_default(const gchar * default_value){};
virtual gchar * param_getSVGValue() const {
Inkscape::SVGOStringStream os;
writesvg(os, _vector);
diff --git a/src/live_effects/parameter/bool.cpp b/src/live_effects/parameter/bool.cpp
index 813c06b4e..fafa71368 100644
--- a/src/live_effects/parameter/bool.cpp
+++ b/src/live_effects/parameter/bool.cpp
@@ -42,6 +42,12 @@ BoolParam::param_update_default(bool const default_value)
defvalue = default_value;
}
+void
+BoolParam::param_update_default(const gchar * default_value)
+{
+ param_update_default(helperfns_read_bool(default_value, defvalue));
+}
+
bool
BoolParam::param_readSVGValue(const gchar * strvalue)
{
diff --git a/src/live_effects/parameter/bool.h b/src/live_effects/parameter/bool.h
index 7ad8a9368..39f328eaa 100644
--- a/src/live_effects/parameter/bool.h
+++ b/src/live_effects/parameter/bool.h
@@ -37,8 +37,8 @@ public:
void param_setValue(bool newvalue);
virtual void param_set_default();
void param_update_default(bool const default_value);
+ virtual void param_update_default(const gchar * default_value);
bool get_value() const { return value; };
-
inline operator bool() const { return value; };
private:
diff --git a/src/live_effects/parameter/enum.h b/src/live_effects/parameter/enum.h
index dbfc68623..0bb2d89b2 100644
--- a/src/live_effects/parameter/enum.h
+++ b/src/live_effects/parameter/enum.h
@@ -76,7 +76,15 @@ public:
void param_set_default() {
param_set_value(defvalue);
}
-
+
+ void param_update_default(E default_value) {
+ defvalue = default_value;
+ }
+
+ virtual void param_update_default(const gchar * default_value) {
+ param_update_default(enumdataconv->get_id_from_key(Glib::ustring(default_value)));
+ }
+
void param_set_value(E val) {
value = val;
}
diff --git a/src/live_effects/parameter/filletchamferpointarray.h b/src/live_effects/parameter/filletchamferpointarray.h
index b81339a69..4e4268703 100644
--- a/src/live_effects/parameter/filletchamferpointarray.h
+++ b/src/live_effects/parameter/filletchamferpointarray.h
@@ -55,6 +55,7 @@ public:
virtual void set_chamfer_steps(int value_chamfer_steps);
virtual void addCanvasIndicators(SPLPEItem const *lpeitem,
std::vector<Geom::PathVector> &hp_vec);
+ virtual void param_update_default(const gchar * default_value){};
virtual bool providesKnotHolderEntities() const {
return true;
}
diff --git a/src/live_effects/parameter/fontbutton.cpp b/src/live_effects/parameter/fontbutton.cpp
index 64c203093..5ec98df8c 100644
--- a/src/live_effects/parameter/fontbutton.cpp
+++ b/src/live_effects/parameter/fontbutton.cpp
@@ -33,9 +33,11 @@ FontButtonParam::param_set_default()
{
param_setValue(defvalue);
}
+
void
-FontButtonParam::param_update_default(const Glib::ustring default_value){
- defvalue = default_value;
+FontButtonParam::param_update_default(const gchar * default_value)
+{
+ defvalue = (Glib::ustring)strdup(default_value);
}
bool
@@ -76,6 +78,7 @@ FontButtonParam::param_setValue(const Glib::ustring newvalue)
value = newvalue;
}
+
} /* namespace LivePathEffect */
} /* namespace Inkscape */
diff --git a/src/live_effects/parameter/fontbutton.h b/src/live_effects/parameter/fontbutton.h
index df47251a2..60e1aa46e 100644
--- a/src/live_effects/parameter/fontbutton.h
+++ b/src/live_effects/parameter/fontbutton.h
@@ -21,15 +21,15 @@ public:
const Glib::ustring& key,
Inkscape::UI::Widget::Registry* wr,
Effect* effect,
- const Glib::ustring default_value = "");
+ const Glib::ustring default_value = "Sans 10");
virtual ~FontButtonParam() {}
virtual Gtk::Widget * param_newWidget();
virtual bool param_readSVGValue(const gchar * strvalue);
- void param_update_default(const Glib::ustring defvalue);
+ void param_update_default(const gchar * default_value);
virtual gchar * param_getSVGValue() const;
- void param_setValue(const Glib::ustring newvalue);
+ void param_setValue(Glib::ustring newvalue);
virtual void param_set_default();
diff --git a/src/live_effects/parameter/item.cpp b/src/live_effects/parameter/item.cpp
index 93cf2b15f..7b40f4540 100644
--- a/src/live_effects/parameter/item.cpp
+++ b/src/live_effects/parameter/item.cpp
@@ -60,6 +60,10 @@ ItemParam::param_set_default()
param_readSVGValue(defvalue);
}
+void
+ItemParam::param_update_default(const gchar * default_value){
+ defvalue = strdup(default_value);
+}
void
ItemParam::param_set_and_write_default()
diff --git a/src/live_effects/parameter/item.h b/src/live_effects/parameter/item.h
index 6c719d451..89c32f9bd 100644
--- a/src/live_effects/parameter/item.h
+++ b/src/live_effects/parameter/item.h
@@ -36,6 +36,7 @@ public:
virtual gchar * param_getSVGValue() const;
virtual void param_set_default();
+ virtual void param_update_default(const gchar * default_value);
void param_set_and_write_default();
virtual void addCanvasIndicators(SPLPEItem const* lpeitem, std::vector<Geom::PathVector> &hp_vec);
diff --git a/src/live_effects/parameter/originalpatharray.h b/src/live_effects/parameter/originalpatharray.h
index 296c0f7f7..fe9371644 100644
--- a/src/live_effects/parameter/originalpatharray.h
+++ b/src/live_effects/parameter/originalpatharray.h
@@ -65,12 +65,11 @@ public:
virtual bool param_readSVGValue(const gchar * strvalue);
virtual gchar * param_getSVGValue() const;
virtual void param_set_default();
-
+ virtual void param_update_default(const gchar * default_value){};
/** Disable the canvas indicators of parent class by overriding this method */
virtual void param_editOncanvas(SPItem * /*item*/, SPDesktop * /*dt*/) {};
/** Disable the canvas indicators of parent class by overriding this method */
virtual void addCanvasIndicators(SPLPEItem const* /*lpeitem*/, std::vector<Geom::PathVector> & /*hp_vec*/) {};
-
std::vector<PathAndDirection*> _vector;
protected:
diff --git a/src/live_effects/parameter/parameter.cpp b/src/live_effects/parameter/parameter.cpp
index befac4df1..15c81d543 100644
--- a/src/live_effects/parameter/parameter.cpp
+++ b/src/live_effects/parameter/parameter.cpp
@@ -107,6 +107,16 @@ ScalarParam::param_update_default(gdouble default_value)
defvalue = default_value;
}
+void
+ScalarParam::param_update_default(const gchar * default_value)
+{
+ double newval;
+ unsigned int success = sp_svg_number_read_d(default_value, &newval);
+ if (success == 1) {
+ param_update_default(newval);
+ }
+}
+
void
ScalarParam::param_set_value(gdouble val)
{
diff --git a/src/live_effects/parameter/parameter.h b/src/live_effects/parameter/parameter.h
index 6cf10710c..ee1d2d547 100644
--- a/src/live_effects/parameter/parameter.h
+++ b/src/live_effects/parameter/parameter.h
@@ -60,7 +60,7 @@ public:
void write_to_SVG();
virtual void param_set_default() = 0;
-
+ virtual void param_update_default(const gchar * default_value) = 0;
// This creates a new widget (newed with Gtk::manage(new ...);)
virtual Gtk::Widget * param_newWidget() = 0;
@@ -77,6 +77,7 @@ public:
virtual void param_transform_multiply(Geom::Affine const& /*postmul*/, bool /*set*/) {};
Glib::ustring param_key;
+ Glib::ustring param_tooltip;
Inkscape::UI::Widget::Registry * param_wr;
Glib::ustring param_label;
@@ -84,7 +85,6 @@ public:
bool widget_is_visible;
protected:
- Glib::ustring param_tooltip;
Effect* param_effect;
@@ -112,6 +112,7 @@ public:
virtual void param_set_default();
void param_update_default(gdouble default_value);
+ virtual void param_update_default(const gchar * default_value);
void param_set_value(gdouble val);
void param_make_integer(bool yes = true);
void param_set_range(gdouble min, gdouble max);
@@ -120,7 +121,6 @@ public:
void addSlider(bool add_slider_widget) { add_slider = add_slider_widget; };
double param_get_max() { return max; };
double param_get_min() { return min; };
-
void param_overwrite_widget(bool overwrite_widget);
virtual Gtk::Widget * param_newWidget();
diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp
index dafc6d406..aa87508ab 100644
--- a/src/live_effects/parameter/path.cpp
+++ b/src/live_effects/parameter/path.cpp
@@ -439,6 +439,10 @@ PathParam::linked_modified_callback(SPObject *linked_obj, guint /*flags*/)
SP_OBJECT(param_effect->getLPEObj())->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
+void
+PathParam::param_update_default(const gchar * default_value){
+ defvalue = strdup(default_value);
+}
/* CALLBACK FUNCTIONS FOR THE BUTTONS */
void
diff --git a/src/live_effects/parameter/path.h b/src/live_effects/parameter/path.h
index d2dddbe97..5381a6b36 100644
--- a/src/live_effects/parameter/path.h
+++ b/src/live_effects/parameter/path.h
@@ -40,6 +40,7 @@ public:
virtual gchar * param_getSVGValue() const;
virtual void param_set_default();
+ virtual void param_update_default(const gchar * default_value);
void param_set_and_write_default();
void set_new_value (Geom::PathVector const &newpath, bool write_to_svg);
void set_new_value (Geom::Piecewise<Geom::D2<Geom::SBasis> > const &newpath, bool write_to_svg);
diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp
index db768090a..561f1b34c 100644
--- a/src/live_effects/parameter/point.cpp
+++ b/src/live_effects/parameter/point.cpp
@@ -64,6 +64,19 @@ PointParam::param_update_default(Geom::Point default_point)
}
void
+PointParam::param_update_default(const gchar * default_point)
+{
+ gchar ** strarray = g_strsplit(default_point, ",", 2);
+ double newx, newy;
+ unsigned int success = sp_svg_number_read_d(strarray[0], &newx);
+ success += sp_svg_number_read_d(strarray[1], &newy);
+ g_strfreev (strarray);
+ if (success == 2) {
+ param_update_default( Geom::Point(newx, newy) );
+ }
+}
+
+void
PointParam::param_setValue(Geom::Point newpoint, bool write)
{
*dynamic_cast<Geom::Point *>( this ) = newpoint;
diff --git a/src/live_effects/parameter/point.h b/src/live_effects/parameter/point.h
index 5d145a81a..a5153ad80 100644
--- a/src/live_effects/parameter/point.h
+++ b/src/live_effects/parameter/point.h
@@ -44,6 +44,8 @@ public:
Geom::Point param_get_default() const;
void param_set_liveupdate(bool live_update);
void param_update_default(Geom::Point default_point);
+
+ virtual void param_update_default(const gchar * default_point);
virtual void param_transform_multiply(Geom::Affine const& /*postmul*/, bool /*set*/);
void set_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color);
diff --git a/src/live_effects/parameter/powerstrokepointarray.h b/src/live_effects/parameter/powerstrokepointarray.h
index 56a609fa8..a34163ca1 100644
--- a/src/live_effects/parameter/powerstrokepointarray.h
+++ b/src/live_effects/parameter/powerstrokepointarray.h
@@ -39,13 +39,13 @@ public:
virtual bool providesKnotHolderEntities() const { return true; }
virtual void addKnotHolderEntities(KnotHolder *knotholder, SPItem *item);
+ virtual void param_update_default(const gchar * default_value){};
void set_pwd2(Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in, Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_normal_in);
Geom::Piecewise<Geom::D2<Geom::SBasis> > const & get_pwd2() const { return last_pwd2; }
Geom::Piecewise<Geom::D2<Geom::SBasis> > const & get_pwd2_normal() const { return last_pwd2_normal; }
void recalculate_controlpoints_for_new_pwd2(Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
-
friend class PowerStrokePointArrayParamKnotHolderEntity;
private:
diff --git a/src/live_effects/parameter/random.cpp b/src/live_effects/parameter/random.cpp
index 075e85ee1..90e53ca0e 100644
--- a/src/live_effects/parameter/random.cpp
+++ b/src/live_effects/parameter/random.cpp
@@ -78,6 +78,20 @@ RandomParam::param_set_default()
}
void
+RandomParam::param_update_default(gdouble default_value){
+ defvalue = default_value;
+}
+
+void
+RandomParam::param_update_default(const gchar * default_value){
+ double newval;
+ unsigned int success = sp_svg_number_read_d(default_value, &newval);
+ if (success == 1) {
+ param_update_default(newval);
+ }
+}
+
+void
RandomParam::param_set_value(gdouble val, long newseed)
{
value = val;
diff --git a/src/live_effects/parameter/random.h b/src/live_effects/parameter/random.h
index ca4440336..5fb6027ac 100644
--- a/src/live_effects/parameter/random.h
+++ b/src/live_effects/parameter/random.h
@@ -38,9 +38,9 @@ public:
void param_set_value(gdouble val, long newseed);
void param_make_integer(bool yes = true);
void param_set_range(gdouble min, gdouble max);
-
+ void param_update_default(gdouble default_value);
+ virtual void param_update_default(const gchar * default_value);
void resetRandomizer();
-
operator gdouble();
inline gdouble get_value() { return value; } ;
diff --git a/src/live_effects/parameter/text.cpp b/src/live_effects/parameter/text.cpp
index 5c4cdf4c6..84603149e 100644
--- a/src/live_effects/parameter/text.cpp
+++ b/src/live_effects/parameter/text.cpp
@@ -50,9 +50,9 @@ TextParam::param_set_default()
}
void
-TextParam::param_update_default(Glib::ustring default_value)
+TextParam::param_update_default(const gchar * default_value)
{
- defvalue = default_value;
+ defvalue = (Glib::ustring)default_value;
}
void
diff --git a/src/live_effects/parameter/text.h b/src/live_effects/parameter/text.h
index 553c84c0a..137f3ee02 100644
--- a/src/live_effects/parameter/text.h
+++ b/src/live_effects/parameter/text.h
@@ -39,16 +39,16 @@ public:
virtual bool param_readSVGValue(const gchar * strvalue);
virtual gchar * param_getSVGValue() const;
- void param_setValue(const Glib::ustring newvalue);
+ void param_setValue(Glib::ustring newvalue);
void param_hide_canvas_text();
virtual void param_set_default();
- void param_update_default(Glib::ustring default_value);
+ virtual void param_update_default(const gchar * default_value);
void setPos(Geom::Point pos);
void setPosAndAnchor(const Geom::Piecewise<Geom::D2<Geom::SBasis> > &pwd2,
const double t, const double length, bool use_curvature = false);
void setAnchor(double x_value, double y_value);
- const Glib::ustring get_value() const { return defvalue; };
+ const Glib::ustring get_value() const { return value; };
private:
TextParam(const TextParam&);
diff --git a/src/live_effects/parameter/togglebutton.cpp b/src/live_effects/parameter/togglebutton.cpp
index b3f6442bb..b8058e9c8 100644
--- a/src/live_effects/parameter/togglebutton.cpp
+++ b/src/live_effects/parameter/togglebutton.cpp
@@ -60,6 +60,18 @@ ToggleButtonParam::param_getSVGValue() const
return str;
}
+void
+ToggleButtonParam::param_update_default(bool default_value)
+{
+ defvalue = default_value;
+}
+
+void
+ToggleButtonParam::param_update_default(const gchar * default_value)
+{
+ param_update_default(helperfns_read_bool(default_value, defvalue));
+}
+
Gtk::Widget *
ToggleButtonParam::param_newWidget()
{
@@ -68,7 +80,7 @@ ToggleButtonParam::param_newWidget()
}
checkwdg = Gtk::manage(
- new Inkscape::UI::Widget::RegisteredToggleButton( param_label,
+ new Inkscape::UI::Widget::RegisteredToggleButton(param_label,
param_tooltip,
param_key,
*param_wr,
diff --git a/src/live_effects/parameter/togglebutton.h b/src/live_effects/parameter/togglebutton.h
index 8390fec86..d6ca15e75 100644
--- a/src/live_effects/parameter/togglebutton.h
+++ b/src/live_effects/parameter/togglebutton.h
@@ -51,6 +51,8 @@ public:
sigc::signal<void>& signal_toggled() { return _signal_toggled; }
virtual void toggled();
+ void param_update_default(bool default_value);
+ virtual void param_update_default(const gchar * default_value);
private:
ToggleButtonParam(const ToggleButtonParam&);
diff --git a/src/live_effects/parameter/transformedpoint.cpp b/src/live_effects/parameter/transformedpoint.cpp
index 0d03432c3..22d5ba3a4 100644
--- a/src/live_effects/parameter/transformedpoint.cpp
+++ b/src/live_effects/parameter/transformedpoint.cpp
@@ -82,6 +82,25 @@ TransformedPointParam::param_getSVGValue() const
return str;
}
+void
+TransformedPointParam::param_update_default(Geom::Point default_point)
+{
+ defvalue = default_point;
+}
+
+void
+TransformedPointParam::param_update_default(const gchar * default_point)
+{
+ gchar ** strarray = g_strsplit(default_point, ",", 2);
+ double newx, newy;
+ unsigned int success = sp_svg_number_read_d(strarray[0], &newx);
+ success += sp_svg_number_read_d(strarray[1], &newy);
+ g_strfreev (strarray);
+ if (success == 2) {
+ param_update_default( Geom::Point(newx, newy) );
+ }
+}
+
Gtk::Widget *
TransformedPointParam::param_newWidget()
{
diff --git a/src/live_effects/parameter/transformedpoint.h b/src/live_effects/parameter/transformedpoint.h
index c96bedb53..269cc508e 100644
--- a/src/live_effects/parameter/transformedpoint.h
+++ b/src/live_effects/parameter/transformedpoint.h
@@ -51,7 +51,9 @@ public:
void set_vector_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color);
void set_oncanvas_color(guint32 color);
-
+ Geom::Point param_get_default() { return defvalue; }
+ void param_update_default(Geom::Point default_point);
+ virtual void param_update_default(const gchar * default_point);
virtual bool providesKnotHolderEntities() const { return true; }
virtual void addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item);
diff --git a/src/live_effects/parameter/unit.cpp b/src/live_effects/parameter/unit.cpp
index b6ea99bfe..b78b75dbf 100644
--- a/src/live_effects/parameter/unit.cpp
+++ b/src/live_effects/parameter/unit.cpp
@@ -55,9 +55,9 @@ UnitParam::param_set_default()
}
void
-UnitParam::param_update_default(const Glib::ustring default_unit)
+UnitParam::param_update_default(const gchar * default_unit)
{
- defunit = unit_table.getUnit(default_unit);
+ defunit = unit_table.getUnit((Glib::ustring)default_unit);
}
void
diff --git a/src/live_effects/parameter/unit.h b/src/live_effects/parameter/unit.h
index ae58cf956..c662b6edc 100644
--- a/src/live_effects/parameter/unit.h
+++ b/src/live_effects/parameter/unit.h
@@ -33,11 +33,10 @@ public:
virtual gchar * param_getSVGValue() const;
virtual void param_set_default();
void param_set_value(Inkscape::Util::Unit const &val);
- void param_update_default(const Glib::ustring default_unit);
+ virtual void param_update_default(const gchar * default_unit);
const gchar *get_abbreviation() const;
-
virtual Gtk::Widget * param_newWidget();
-
+
operator Inkscape::Util::Unit const *() const { return unit; }
private:
diff --git a/src/live_effects/parameter/vector.cpp b/src/live_effects/parameter/vector.cpp
index 55b4d4b32..470fa9c2d 100644
--- a/src/live_effects/parameter/vector.cpp
+++ b/src/live_effects/parameter/vector.cpp
@@ -48,6 +48,25 @@ VectorParam::param_set_default()
setVector(defvalue);
}
+void
+VectorParam::param_update_default(Geom::Point default_point)
+{
+ defvalue = default_point;
+}
+
+void
+VectorParam::param_update_default(const gchar * default_point)
+{
+ gchar ** strarray = g_strsplit(default_point, ",", 2);
+ double newx, newy;
+ unsigned int success = sp_svg_number_read_d(strarray[0], &newx);
+ success += sp_svg_number_read_d(strarray[1], &newy);
+ g_strfreev (strarray);
+ if (success == 2) {
+ param_update_default( Geom::Point(newx, newy) );
+ }
+}
+
bool
VectorParam::param_readSVGValue(const gchar * strvalue)
{
diff --git a/src/live_effects/parameter/vector.h b/src/live_effects/parameter/vector.h
index edee4ff4d..d270e9f43 100644
--- a/src/live_effects/parameter/vector.h
+++ b/src/live_effects/parameter/vector.h
@@ -51,7 +51,8 @@ public:
void set_vector_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color);
void set_origin_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color);
void set_oncanvas_color(guint32 color);
-
+ void param_update_default(Geom::Point default_point);
+ virtual void param_update_default(const gchar * default_point);
virtual bool providesKnotHolderEntities() const { return true; }
virtual void addKnotHolderEntities(KnotHolder *knotholder, SPItem *item);
diff --git a/src/preferences.cpp b/src/preferences.cpp
index 4d522a1d8..2849fe068 100644
--- a/src/preferences.cpp
+++ b/src/preferences.cpp
@@ -512,6 +512,35 @@ void Preferences::remove(Glib::ustring const &pref_path)
Inkscape::XML::Node *node = _getNode(pref_path, false);
if (node && node->parent()) {
node->parent()->removeChild(node);
+ } else { //Handle to remove also attributes in path not only the container node
+ // verify path
+ g_assert( pref_path.at(0) == '/' );
+ if (_prefs_doc == NULL){
+ return;
+ }
+ node = _prefs_doc->root();
+ Inkscape::XML::Node *child = NULL;
+ gchar **splits = g_strsplit(pref_path.c_str(), "/", 0);
+ if ( splits ) {
+ for (int part_i = 0; splits[part_i]; ++part_i) {
+ // skip empty path segments
+ if (!splits[part_i][0]) {
+ continue;
+ }
+ if (!node->firstChild()) {
+ node->setAttribute(splits[part_i], NULL);
+ g_strfreev(splits);
+ return;
+ }
+ for (child = node->firstChild(); child; child = child->next()) {
+ if (!strcmp(splits[part_i], child->attribute("id"))) {
+ break;
+ }
+ }
+ node = child;
+ }
+ }
+ g_strfreev(splits);
}
}
diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp
index e5becdb5c..455c12bc3 100644
--- a/src/ui/dialog/livepatheffect-editor.cpp
+++ b/src/ui/dialog/livepatheffect-editor.cpp
@@ -19,7 +19,7 @@
#include "livepatheffect-editor.h"
#include "desktop.h"
-
+#include <gtkmm/expander.h>
#include "document.h"
#include "document-undo.h"
#include "helper/action.h"
@@ -193,8 +193,14 @@ LivePathEffectEditor::showParams(LivePathEffect::Effect& effect)
if ( ! effect.upd_params ) {
return;
}
-
+ bool expanderopen = false;
if (effectwidget) {
+ Gtk::Expander * expander = NULL;
+ std::vector<Gtk::Widget *> childs = dynamic_cast<Gtk::Box *> (effectwidget)->get_children();
+ std::vector<Gtk::Widget *> childs_default = dynamic_cast<Gtk::Box *> (childs[childs.size()-1])->get_children();
+ if ((expander = dynamic_cast<Gtk::Expander *>(childs_default[childs_default.size()-1]))){
+ expanderopen = expander->get_expanded();
+ }
effectcontrol_vbox.remove(*effectwidget);
delete effectwidget;
effectwidget = NULL;
@@ -204,6 +210,15 @@ LivePathEffectEditor::showParams(LivePathEffect::Effect& effect)
effectwidget = effect.newWidget();
if (effectwidget) {
+ Gtk::Widget * defaultswidget = effect.defaultParamSet();
+ if (defaultswidget) {
+ Gtk::Expander * expander = NULL;
+ std::vector<Gtk::Widget *> childs_default = dynamic_cast<Gtk::Box *> (defaultswidget)->get_children();
+ if ((expander = dynamic_cast<Gtk::Expander *>(childs_default[childs_default.size()-1]))){
+ expander->set_expanded(expanderopen);
+ }
+ dynamic_cast<Gtk::Box *> (effectwidget)->pack_start(*defaultswidget, true, true);
+ }
effectcontrol_vbox.pack_start(*effectwidget, true, true);
}
button_remove.show();