=== modified file 'src/sp-filter.cpp' --- src/sp-filter.cpp 2015-04-26 09:44:42 +0000 +++ src/sp-filter.cpp 2015-05-03 21:07:11 +0000 @@ -79,6 +79,7 @@ this->readAttr( "height" ); this->readAttr( "filterRes" ); this->readAttr( "xlink:href" ); + this->_refcount = 0; SPObject::build(document, repr); @@ -190,6 +191,15 @@ } } + +/** + * Returns the number of references to the filter. + */ +guint SPFilter::getRefCount() { + // NOTE: this is currently updated by sp_style_filter_ref_changed() in style.cpp + return _refcount; +} + /** * Receives update notifications. */ === modified file 'src/sp-filter.h' --- src/sp-filter.h 2014-10-08 02:22:03 +0000 +++ src/sp-filter.h 2015-05-03 21:04:04 +0000 @@ -54,6 +54,9 @@ NumberOptNumber filterRes; SPFilterReference *href; sigc::connection modified_connection; + + guint getRefCount(); + guint _refcount; Inkscape::Filters::Filter *_renderer; === modified file 'src/style.cpp' --- src/style.cpp 2015-05-04 10:57:06 +0000 +++ src/style.cpp 2015-05-04 16:17:32 +0000 @@ -1177,10 +1177,12 @@ sp_style_filter_ref_changed(SPObject *old_ref, SPObject *ref, SPStyle *style) { if (old_ref) { + (dynamic_cast( old_ref ))->_refcount--; style->filter_modified_connection.disconnect(); } if ( SP_IS_FILTER(ref)) { + (dynamic_cast( ref ))->_refcount++; style->filter_modified_connection = ref->connectModified(sigc::bind(sigc::ptr_fun(&sp_style_filter_ref_modified), style)); } === modified file 'src/ui/dialog/filter-effects-dialog.cpp' --- src/ui/dialog/filter-effects-dialog.cpp 2015-04-26 09:46:39 +0000 +++ src/ui/dialog/filter-effects-dialog.cpp 2015-05-04 17:52:37 +0000 @@ -1360,8 +1361,15 @@ ((Gtk::CellRendererText*)_list.get_column(1)->get_first_cell())-> signal_edited().connect(sigc::mem_fun(*this, &FilterEffectsDialog::FilterModifier::on_name_edited)); + _list.append_column("#", _columns.count); + _list.get_column(2)->set_sizing(Gtk::TREE_VIEW_COLUMN_AUTOSIZE); + _list.get_column(2)->set_expand(false); + sw->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); _list.get_column(1)->set_resizable(true); + _list.get_column(1)->set_sizing(Gtk::TREE_VIEW_COLUMN_FIXED); + _list.get_column(1)->set_expand(true); + _list.set_reorderable(true); _list.enable_model_drag_dest (Gdk::ACTION_MOVE); @@ -1494,6 +1502,7 @@ (*iter)[_columns.sel] = 0; } } + update_counts(); } void FilterEffectsDialog::FilterModifier::on_filter_selection_changed() @@ -1565,6 +1574,15 @@ } } + +void FilterEffectsDialog::FilterModifier::update_counts() +{ + for(Gtk::TreeModel::iterator i = _model->children().begin(); i != _model->children().end(); ++i) { + SPFilter* f = SP_FILTER((*i)[_columns.filter]); + (*i)[_columns.count] = f->getRefCount(); + } +} + /* Add all filters in the document to the combobox. Keeps the same selection if possible, otherwise selects the first element */ void FilterEffectsDialog::FilterModifier::update_filters() @@ -2752,20 +2769,22 @@ Gtk::ScrolledWindow* sw_infobox = Gtk::manage(new Gtk::ScrolledWindow); Gtk::HBox* infobox = Gtk::manage(new Gtk::HBox(/*homogeneous:*/false, /*spacing:*/4)); Gtk::HBox* hb_prims = Gtk::manage(new Gtk::HBox); + Gtk::VBox* vb_prims = Gtk::manage(new Gtk::VBox); _getContents()->add(*hpaned); hpaned->pack1(_filter_modifier); hpaned->pack2(_primitive_box); _primitive_box.pack_start(*sw_prims); - _primitive_box.pack_start(*hb_prims, false, false); _primitive_box.pack_start(*sw_infobox, false, false); sw_prims->add(_primitive_list); - sw_infobox->add(*infobox); + sw_infobox->add(*vb_prims); infobox->pack_start(_infobox_icon, false, false); infobox->pack_start(_infobox_desc, false, false); _infobox_desc.set_line_wrap(true); - _infobox_desc.set_size_request(200, -1); + _infobox_desc.set_size_request(250, -1); + vb_prims->pack_start(*hb_prims); + vb_prims->pack_start(*infobox); hb_prims->pack_start(_add_primitive, false, false); hb_prims->pack_start(_add_primitive_type, false, false); === modified file 'src/ui/dialog/filter-effects-dialog.h' --- src/ui/dialog/filter-effects-dialog.h 2014-03-27 01:33:44 +0000 +++ src/ui/dialog/filter-effects-dialog.h 2015-05-04 17:51:02 +0000 @@ -69,11 +70,13 @@ add(filter); add(label); add(sel); + add(count); } Gtk::TreeModelColumn filter; Gtk::TreeModelColumn label; Gtk::TreeModelColumn sel; + Gtk::TreeModelColumn count; }; void setTargetDesktop(SPDesktop *desktop); @@ -89,6 +92,7 @@ bool on_filter_move(const Glib::RefPtr& /*context*/, int x, int y, guint /*time*/); void on_selection_toggled(const Glib::ustring&); + void update_counts(); void update_filters(); void filter_list_button_release(GdkEventButton*); void add_filter();