summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabiertxof <jtx@jtx>2017-05-01 01:15:26 +0000
committerJabiertxof <jtx@jtx>2017-05-01 01:15:26 +0000
commita3d1689c18ebf132acb7ae0501ec419a71e48a85 (patch)
treeb87e51c096928abb77f590986e5101ae0ac65d1a /src
parentRelax any hardcoded limit from the libxml2 parser when creating documents fro... (diff)
downloadinkscape-a3d1689c18ebf132acb7ae0501ec419a71e48a85.tar.gz
inkscape-a3d1689c18ebf132acb7ae0501ec419a71e48a85.zip
Fix erase lpe in multi LPE mode
Improve rendering widgets, simplify the code, redraw widgets each time not only on odd iterations (bzr r15655)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/effect.cpp2
-rw-r--r--src/live_effects/effect.h1
-rw-r--r--src/live_effects/lpe-clone-original.cpp1
-rw-r--r--src/live_effects/lpe-copy_rotate.cpp6
-rw-r--r--src/live_effects/lpe-measure-line.cpp1
-rw-r--r--src/live_effects/lpe-mirror_symmetry.cpp1
-rw-r--r--src/live_effects/parameter/bool.cpp2
-rw-r--r--src/live_effects/parameter/fontbutton.cpp1
-rw-r--r--src/live_effects/parameter/parameter.cpp6
-rw-r--r--src/live_effects/parameter/point.cpp2
-rw-r--r--src/live_effects/parameter/text.cpp2
-rw-r--r--src/live_effects/parameter/togglebutton.cpp3
-rw-r--r--src/sp-lpe-item.cpp2
-rw-r--r--src/ui/dialog/livepatheffect-editor.cpp39
-rw-r--r--src/ui/dialog/livepatheffect-editor.h4
15 files changed, 17 insertions, 56 deletions
diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp
index bfcca422e..326225e0c 100644
--- a/src/live_effects/effect.cpp
+++ b/src/live_effects/effect.cpp
@@ -358,7 +358,6 @@ Effect::Effect(LivePathEffectObject *lpeobject)
concatenate_before_pwd2(false),
sp_lpe_item(NULL),
current_zoom(1),
- upd_params(true),
sp_shape(NULL),
sp_curve(NULL),
provides_own_flash_paths(true), // is automatically set to false if providesOwnFlashPaths() is not overridden
@@ -773,7 +772,6 @@ Effect::newWidget()
++it;
}
- upd_params = false;
return dynamic_cast<Gtk::Widget *>(vbox);
}
diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h
index f5e41d50e..973516133 100644
--- a/src/live_effects/effect.h
+++ b/src/live_effects/effect.h
@@ -133,7 +133,6 @@ public:
void editNextParamOncanvas(SPItem * item, SPDesktop * desktop);
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;
diff --git a/src/live_effects/lpe-clone-original.cpp b/src/live_effects/lpe-clone-original.cpp
index 47fb6a04e..d97a990af 100644
--- a/src/live_effects/lpe-clone-original.cpp
+++ b/src/live_effects/lpe-clone-original.cpp
@@ -318,7 +318,6 @@ LPECloneOriginal::newWidget()
expander->set_expanded(expanded);
expander->property_expanded().signal_changed().connect(sigc::mem_fun(*this, &LPECloneOriginal::onExpanderChanged) );
vbox->pack_start(*expander, true, true, 2);
- this->upd_params = false;
return dynamic_cast<Gtk::Widget *>(vbox);
}
diff --git a/src/live_effects/lpe-copy_rotate.cpp b/src/live_effects/lpe-copy_rotate.cpp
index 4869e8279..900fc8b67 100644
--- a/src/live_effects/lpe-copy_rotate.cpp
+++ b/src/live_effects/lpe-copy_rotate.cpp
@@ -362,23 +362,19 @@ LPECopyRotate::doBeforeEffect (SPLPEItem const* lpeitem)
using namespace Geom;
original_bbox(lpeitem);
if (copies_to_360 && num_copies > 2) {
- this->upd_params = true;
rotation_angle.param_set_value(360.0/(double)num_copies);
}
if ((method == RM_KALEIDOSCOPE || method == RM_FUSE) && rotation_angle * num_copies > 360.1 && rotation_angle > 0) {
- this->upd_params = true;
num_copies.param_set_value(floor(360/rotation_angle));
}
if ((method == RM_KALEIDOSCOPE || method == RM_FUSE) && mirror_copies && copies_to_360) {
- this->upd_params = true;
num_copies.param_set_increments(2.0,10.0);
if ((int)num_copies%2 !=0) {
num_copies.param_set_value(num_copies+1);
rotation_angle.param_set_value(360.0/(double)num_copies);
}
} else {
- this->upd_params = true;
num_copies.param_set_increments(1.0, 10.0);
}
@@ -392,7 +388,6 @@ LPECopyRotate::doBeforeEffect (SPLPEItem const* lpeitem)
// likely due to SVG's choice of coordinate system orientation (max)
bool near = Geom::are_near(previous_start_point, (Geom::Point)starting_point, 0.01);
if (!near) {
- this->upd_params = true;
starting_angle.param_set_value(deg_from_rad(-angle_between(dir, starting_point - origin)));
if (GDK_SHIFT_MASK) {
dist_angle_handle = L2(B - A);
@@ -407,7 +402,6 @@ LPECopyRotate::doBeforeEffect (SPLPEItem const* lpeitem)
rot_pos = origin + dir * Rotate(-rad_from_deg(rotation_angle+starting_angle)) * dist_angle_handle;
near = Geom::are_near(start_pos, (Geom::Point)starting_point, 0.01);
if (!near) {
- this->upd_params = true;
starting_point.param_setValue(start_pos, true);
}
previous_start_point = (Geom::Point)starting_point;
diff --git a/src/live_effects/lpe-measure-line.cpp b/src/live_effects/lpe-measure-line.cpp
index 86d72615c..63d60da3f 100644
--- a/src/live_effects/lpe-measure-line.cpp
+++ b/src/live_effects/lpe-measure-line.cpp
@@ -527,7 +527,6 @@ LPEMeasureLine::doBeforeEffect (SPLPEItem const* lpeitem)
pathvector *= writed_transform;
if ((Glib::ustring(format.param_getSVGValue()).empty())) {
format.param_setValue(Glib::ustring("{measure}{unit}"));
- this->upd_params = true;
}
size_t ncurves = pathvector.curveCount();
if (ncurves != (size_t)curve_linked.param_get_max()) {
diff --git a/src/live_effects/lpe-mirror_symmetry.cpp b/src/live_effects/lpe-mirror_symmetry.cpp
index 97015c34d..b411bd699 100644
--- a/src/live_effects/lpe-mirror_symmetry.cpp
+++ b/src/live_effects/lpe-mirror_symmetry.cpp
@@ -335,7 +335,6 @@ LPEMirrorSymmetry::newWidget()
++it;
}
- this->upd_params = false;
return dynamic_cast<Gtk::Widget *>(vbox);
}
diff --git a/src/live_effects/parameter/bool.cpp b/src/live_effects/parameter/bool.cpp
index 813c06b4e..1bd5f96ad 100644
--- a/src/live_effects/parameter/bool.cpp
+++ b/src/live_effects/parameter/bool.cpp
@@ -72,7 +72,6 @@ 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 +81,6 @@ BoolParam::param_newWidget()
void
BoolParam::param_setValue(bool newvalue)
{
- param_effect->upd_params = true;
value = newvalue;
}
diff --git a/src/live_effects/parameter/fontbutton.cpp b/src/live_effects/parameter/fontbutton.cpp
index 64c203093..baf24d77c 100644
--- a/src/live_effects/parameter/fontbutton.cpp
+++ b/src/live_effects/parameter/fontbutton.cpp
@@ -66,7 +66,6 @@ FontButtonParam::param_newWidget()
Glib::ustring fontspec = param_getSVGValue();
fontbuttonwdg->setValue( fontspec);
fontbuttonwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change font button parameter"));
- param_effect->upd_params = false;
return dynamic_cast<Gtk::Widget *> (fontbuttonwdg);
}
diff --git a/src/live_effects/parameter/parameter.cpp b/src/live_effects/parameter/parameter.cpp
index befac4df1..26a563909 100644
--- a/src/live_effects/parameter/parameter.cpp
+++ b/src/live_effects/parameter/parameter.cpp
@@ -110,7 +110,6 @@ ScalarParam::param_update_default(gdouble default_value)
void
ScalarParam::param_set_value(gdouble val)
{
- param_effect->upd_params = true;
value = val;
if (integer)
value = round(value);
@@ -128,7 +127,6 @@ ScalarParam::param_set_range(gdouble min, gdouble max)
// Once again, in gtk2, this is not a problem. But in gtk3,
// widgets get allocated the amount of size they ask for,
// leading to excessively long widgets.
- param_effect->upd_params = true;
if (min >= -SCALARPARAM_G_MAXDOUBLE) {
this->min = min;
} else {
@@ -145,7 +143,6 @@ ScalarParam::param_set_range(gdouble min, gdouble max)
void
ScalarParam::param_make_integer(bool yes)
{
- param_effect->upd_params = true;
integer = yes;
digits = 0;
inc_step = 1;
@@ -176,7 +173,6 @@ ScalarParam::param_newWidget()
if(!overwrite_widget){
rsu->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change scalar parameter"));
}
- param_effect->upd_params = false;
return dynamic_cast<Gtk::Widget *> (rsu);
} else {
return NULL;
@@ -186,14 +182,12 @@ ScalarParam::param_newWidget()
void
ScalarParam::param_set_digits(unsigned digits)
{
- param_effect->upd_params = true;
this->digits = digits;
}
void
ScalarParam::param_set_increments(double step, double page)
{
- param_effect->upd_params = true;
inc_step = step;
inc_page = page;
}
diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp
index db768090a..55dc79fe8 100644
--- a/src/live_effects/parameter/point.cpp
+++ b/src/live_effects/parameter/point.cpp
@@ -77,7 +77,6 @@ PointParam::param_setValue(Geom::Point newpoint, bool write)
if(knoth && liveupdate){
knoth->update_knots();
}
- param_effect->upd_params = true;
}
bool
@@ -130,7 +129,6 @@ PointParam::param_newWidget()
Gtk::HBox * hbox = Gtk::manage( new Gtk::HBox() );
static_cast<Gtk::HBox*>(hbox)->pack_start(*pointwdg, true, true);
static_cast<Gtk::HBox*>(hbox)->show_all_children();
- param_effect->upd_params = false;
return dynamic_cast<Gtk::Widget *> (hbox);
}
diff --git a/src/live_effects/parameter/text.cpp b/src/live_effects/parameter/text.cpp
index 5c4cdf4c6..47fbd39af 100644
--- a/src/live_effects/parameter/text.cpp
+++ b/src/live_effects/parameter/text.cpp
@@ -125,14 +125,12 @@ 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/togglebutton.cpp b/src/live_effects/parameter/togglebutton.cpp
index b3f6442bb..f7042b6d1 100644
--- a/src/live_effects/parameter/togglebutton.cpp
+++ b/src/live_effects/parameter/togglebutton.cpp
@@ -112,7 +112,6 @@ ToggleButtonParam::param_newWidget()
checkwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change togglebutton parameter"));
_toggled_connection = checkwdg->signal_toggled().connect(sigc::mem_fun(*this, &ToggleButtonParam::toggled));
- param_effect->upd_params = false;
return checkwdg;
}
@@ -159,8 +158,6 @@ ToggleButtonParam::param_setValue(bool newvalue)
void
ToggleButtonParam::toggled() {
- //Force redraw for update widgets
- param_effect->upd_params = true;
if (SP_ACTIVE_DESKTOP) {
Inkscape::Selection *selection = SP_ACTIVE_DESKTOP->getSelection();
selection->emitModified();
diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp
index ca0f78a00..b5c89b69d 100644
--- a/src/sp-lpe-item.cpp
+++ b/src/sp-lpe-item.cpp
@@ -493,8 +493,8 @@ void SPLPEItem::removeCurrentPathEffect(bool keep_paths)
}
PathEffectList new_list = *this->path_effect_list;
new_list.remove(lperef); //current lpe ref is always our 'own' pointer from the path_effect_list
+ *this->path_effect_list = new_list;
this->getRepr()->setAttribute("inkscape:path-effect", patheffectlist_svg_string(new_list));
-
if (!keep_paths) {
// Make sure that ellipse is stored as <svg:circle> or <svg:ellipse> if possible.
if( SP_IS_GENERICELLIPSE(this)) {
diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp
index e5becdb5c..d81ab6e6c 100644
--- a/src/ui/dialog/livepatheffect-editor.cpp
+++ b/src/ui/dialog/livepatheffect-editor.cpp
@@ -47,17 +47,18 @@ namespace Dialog {
/*####################
* Callback functions
*/
+
+
void lpeeditor_selection_changed (Inkscape::Selection * selection, gpointer data)
{
LivePathEffectEditor *lpeeditor = static_cast<LivePathEffectEditor *>(data);
lpeeditor->lpe_list_locked = false;
- lpeeditor->onSelectionChanged(selection, true);
+ lpeeditor->onSelectionChanged(selection);
}
-static void lpeeditor_selection_modified (Inkscape::Selection * selection, guint /*flags*/, gpointer data)
+void lpeeditor_selection_modified (Inkscape::Selection * selection, guint /*flags*/, gpointer data)
{
- LivePathEffectEditor *lpeeditor = static_cast<LivePathEffectEditor *>(data);
- lpeeditor->onSelectionChanged(selection);
+ lpeeditor_selection_changed (selection, data);
}
static void lpe_style_button(Gtk::Button& btn, char const* iconName)
@@ -184,16 +185,13 @@ LivePathEffectEditor::~LivePathEffectEditor()
if (current_desktop) {
selection_changed_connection.disconnect();
selection_modified_connection.disconnect();
+ selection_moved_connection.disconnect();
}
}
void
LivePathEffectEditor::showParams(LivePathEffect::Effect& effect)
{
- if ( ! effect.upd_params ) {
- return;
- }
-
if (effectwidget) {
effectcontrol_vbox.remove(*effectwidget);
delete effectwidget;
@@ -254,16 +252,15 @@ LivePathEffectEditor::set_sensitize_all(bool sensitive)
}
void
-LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel, bool upd_params)
+LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel)
{
if (lpe_list_locked) {
// this was triggered by selecting a row in the list, so skip reloading
lpe_list_locked = false;
return;
}
-
- effectlist_store->clear();
current_lpeitem = NULL;
+ effectlist_store->clear();
if ( sel && !sel->isEmpty() ) {
SPItem *item = sel->singleItem();
@@ -278,9 +275,6 @@ LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel, bool upd_para
if ( lpeitem->hasPathEffect() ) {
Inkscape::LivePathEffect::Effect *lpe = lpeitem->getCurrentLPE();
if (lpe) {
- if (upd_params) {
- lpe->upd_params = true;
- }
showParams(*lpe);
lpe_list_locked = true;
selectInList(lpe);
@@ -484,18 +478,12 @@ LivePathEffectEditor::onRemove()
SPItem *item = sel->singleItem();
SPLPEItem *lpeitem = dynamic_cast<SPLPEItem *>(item);
if ( lpeitem ) {
- if (current_lperef && current_lperef->lpeobject) {
- LivePathEffect::Effect * effect = current_lperef->lpeobject->get_lpe();
- if (effect) {
- effect->upd_params = true;
- }
- }
lpeitem->removeCurrentPathEffect(false);
-
+ current_lperef = NULL;
DocumentUndo::done( current_desktop->getDocument(), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
_("Remove path effect") );
-
- effect_list_reload(lpeitem);
+ lpe_list_locked = false;
+ onSelectionChanged(sel);
}
}
@@ -512,7 +500,7 @@ void LivePathEffectEditor::onUp()
DocumentUndo::done( current_desktop->getDocument(), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
_("Move path effect up") );
-
+
effect_list_reload(lpeitem);
}
}
@@ -529,7 +517,6 @@ void LivePathEffectEditor::onDown()
DocumentUndo::done( current_desktop->getDocument(), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
_("Move path effect down") );
-
effect_list_reload(lpeitem);
}
}
@@ -554,7 +541,6 @@ void LivePathEffectEditor::on_effect_selection_changed()
current_lperef = lperef;
LivePathEffect::Effect * effect = lperef->lpeobject->get_lpe();
if (effect) {
- effect->upd_params = true;
showParams(*effect);
}
}
@@ -563,6 +549,7 @@ void LivePathEffectEditor::on_effect_selection_changed()
void LivePathEffectEditor::on_visibility_toggled( Glib::ustring const& str )
{
+
Gtk::TreeModel::Children::iterator iter = effectlist_view.get_model()->get_iter(str);
Gtk::TreeModel::Row row = *iter;
diff --git a/src/ui/dialog/livepatheffect-editor.h b/src/ui/dialog/livepatheffect-editor.h
index a7c749ef3..e9769ffea 100644
--- a/src/ui/dialog/livepatheffect-editor.h
+++ b/src/ui/dialog/livepatheffect-editor.h
@@ -45,7 +45,7 @@ public:
static LivePathEffectEditor &getInstance() { return *new LivePathEffectEditor(); }
- void onSelectionChanged(Inkscape::Selection *sel, bool upd_params = false);
+ void onSelectionChanged(Inkscape::Selection *sel);
void onSelectionModified(Inkscape::Selection *sel);
virtual void on_effect_selection_changed();
void setDesktop(SPDesktop *desktop);
@@ -63,6 +63,7 @@ private:
sigc::connection desktopChangeConn;
sigc::connection selection_changed_connection;
sigc::connection selection_modified_connection;
+ sigc::connection selection_moved_connection;
// void add_entry(const char* name );
void effect_list_reload(SPLPEItem *lpeitem);
@@ -126,6 +127,7 @@ private:
LivePathEffect::LPEObjectReference * current_lperef;
friend void lpeeditor_selection_changed (Inkscape::Selection * selection, gpointer data);
+ friend void lpeeditor_selection_modified (Inkscape::Selection * selection, guint /*flags*/, gpointer data);
LivePathEffectEditor(LivePathEffectEditor const &d);
LivePathEffectEditor& operator=(LivePathEffectEditor const &d);