Code

make visibility icon in LPE stack dialog clickable
authorjohanengelen <johanengelen@users.sourceforge.net>
Sun, 20 Jul 2008 21:52:06 +0000 (21:52 +0000)
committerjohanengelen <johanengelen@users.sourceforge.net>
Sun, 20 Jul 2008 21:52:06 +0000 (21:52 +0000)
src/ui/dialog/livepatheffect-editor.cpp
src/ui/dialog/livepatheffect-editor.h

index 232f2ebfe7f0b40217602643d7990faa80d5f89e..f6b9975282cd6cd638747fc24783cddc783a3937 100644 (file)
@@ -135,8 +135,7 @@ LivePathEffectEditor::LivePathEffectEditor()
     //Add the visibility icon column:
     Inkscape::UI::Widget::ImageToggler *eyeRenderer = manage( new Inkscape::UI::Widget::ImageToggler("visible", "hidden") );
     int visibleColNum = effectlist_view.append_column("is_visible", *eyeRenderer) - 1;
-//    eyeRenderer->signal_pre_toggle().connect( sigc::mem_fun(*this, &LayersPanel::_preToggle) );
-//    eyeRenderer->signal_toggled().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_toggled), (int)COL_VISIBLE) );
+    eyeRenderer->signal_toggled().connect( sigc::mem_fun(*this, &LivePathEffectEditor::on_visibility_toggled) );
     eyeRenderer->property_activatable() = true;
     Gtk::TreeViewColumn* col = effectlist_view.get_column(visibleColNum);
     if ( col ) {
@@ -414,6 +413,23 @@ 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;
+
+    LivePathEffect::LPEObjectReference * lpeobjref = row[columns.lperef];
+
+    if ( lpeobjref ) {
+        bool newValue = !row[columns.col_visible];
+        row[columns.col_visible] = newValue;
+        /* FIXME: this explicit writing to SVG is wrong. The lpe_item should have a method to disable/enable an effect within its stack.
+         * So one can call:  lpe_item->setActive(lpeobjref->lpeobject); */
+        lpeobjref->lpeobject->lpe->getRepr()->setAttribute("is_visible", newValue ? "true" : "false");
+        sp_document_done( sp_desktop_document(current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
+                          _("Change path effect's visibility") );
+    }
+}
 
 } // namespace Dialog
 } // namespace UI
index 61378f329c6b5f3db01608f37c7055ed447a10d5..be636ba2a90d9aa42b89fae6c3149a4acd160276 100644 (file)
@@ -98,7 +98,9 @@ private:
     Gtk::TreeView effectlist_view;
     Glib::RefPtr<Gtk::ListStore> effectlist_store;
     Glib::RefPtr<Gtk::TreeSelection> effectlist_selection;
-    
+
+    void on_visibility_toggled( Glib::ustring const& str );
+
     Gtk::Toolbar toolbar;
     Gtk::ToolButton button_up;
     Gtk::ToolButton button_down;