summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/livepatheffect-editor.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2016-07-24 16:49:11 +0000
committerjabiertxof <info@marker.es>2016-07-24 16:49:11 +0000
commita5d6c9a27683820be3d84eea73c2d6f161ce0e8e (patch)
treeb9ba6c20747c4d6d7b4479d229b9daf8eea5c5bd /src/ui/dialog/livepatheffect-editor.cpp
parentThis for you CR ยท Measure line, show the distance on rect lines CAD like wit... (diff)
downloadinkscape-a5d6c9a27683820be3d84eea73c2d6f161ce0e8e.tar.gz
inkscape-a5d6c9a27683820be3d84eea73c2d6f161ce0e8e.zip
Add Text tag and update widgets code
(bzr r15017.1.2)
Diffstat (limited to 'src/ui/dialog/livepatheffect-editor.cpp')
-rw-r--r--src/ui/dialog/livepatheffect-editor.cpp31
1 files changed, 25 insertions, 6 deletions
diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp
index 422ec10ae..7205beaa8 100644
--- a/src/ui/dialog/livepatheffect-editor.cpp
+++ b/src/ui/dialog/livepatheffect-editor.cpp
@@ -61,7 +61,7 @@ void lpeeditor_selection_changed (Inkscape::Selection * selection, gpointer data
{
LivePathEffectEditor *lpeeditor = static_cast<LivePathEffectEditor *>(data);
lpeeditor->lpe_list_locked = false;
- lpeeditor->onSelectionChanged(selection);
+ lpeeditor->onSelectionChanged(selection, true);
}
static void lpeeditor_selection_modified (Inkscape::Selection * selection, guint /*flags*/, gpointer data)
@@ -98,7 +98,8 @@ LivePathEffectEditor::LivePathEffectEditor()
button_up(),
button_down(),
current_desktop(NULL),
- current_lpeitem(NULL)
+ current_lpeitem(NULL),
+ current_lperef(NULL)
{
Gtk::Box *contents = _getContents();
contents->set_spacing(4);
@@ -206,6 +207,10 @@ LivePathEffectEditor::~LivePathEffectEditor()
void
LivePathEffectEditor::showParams(LivePathEffect::Effect& effect)
{
+ if ( ! effect.upd_params ) {
+ return;
+ }
+
if (effectwidget) {
effectcontrol_vbox.remove(*effectwidget);
delete effectwidget;
@@ -265,9 +270,8 @@ LivePathEffectEditor::set_sensitize_all(bool sensitive)
button_down.set_sensitive(sensitive);
}
-
void
-LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel)
+LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel, bool upd_params)
{
if (lpe_list_locked) {
// this was triggered by selecting a row in the list, so skip reloading
@@ -291,6 +295,9 @@ LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel)
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);
@@ -494,6 +501,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);
DocumentUndo::done( current_desktop->getDocument(), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
@@ -548,11 +561,17 @@ void LivePathEffectEditor::on_effect_selection_changed()
Gtk::TreeModel::iterator it = sel->get_selected();
LivePathEffect::LPEObjectReference * lperef = (*it)[columns.lperef];
- if (lperef && current_lpeitem) {
+ if (lperef && current_lpeitem && current_lperef != lperef) {
+ //The last condition ignore Gtk::TreeModel may occasionally be changed emitted when nothing has happened
if (lperef->lpeobject->get_lpe()) {
lpe_list_locked = true; // prevent reload of the list which would lose selection
current_lpeitem->setCurrentPathEffect(lperef);
- showParams(*lperef->lpeobject->get_lpe());
+ current_lperef = lperef;
+ LivePathEffect::Effect * effect = lperef->lpeobject->get_lpe();
+ if (effect) {
+ effect->upd_params = true;
+ showParams(*effect);
+ }
}
}
}