Comment 7 for bug 942330

Revision history for this message
David Mathog (mathog) wrote : Re: glitchy SVG, render differences in inkscape versions

Here are some changes that result in the selected object(s) showing "<count> filtered", so long as count >=1 and the number selected is >1. However, this code does not drill down within a Group to see if some grouped objects are filtered. So the selected group itself is filtered, then "filtered" shows up, but if the group is composed of objects, and some of those are filtered, then it does not trigger the "filtered" message. It doesn't try to keep track of what type of filtered, as
in a complex drawing there might be many, many different filters in use at once, which would overfill the status line.

Changes relative to trunk (2/29/2012):

 diff sp-item.h.dist sp-item.h
194a195
> int ifilt();

diff sp-item.cpp sp-item.cpp.dist
966,978d965
< * Returns 1 if the item is filtered, 0 otherwise. Used with groups/lists to determine how many, or if any, are filtered
< *
< */
< int SPItem::ifilt()
< {
< int retval=0;
< if (((SPItemClass *) G_OBJECT_GET_CLASS(this))->description) {
< if ( style && style->filter.href && style->filter.href->getObject() ) { retval=1; }
< }
< return retval;
< }
<
< /**

 diff selection-describer.cpp selection-describer.cpp.dist
94,105d93
< // Returns the number of filtered items in the list
< int count_filtered (GSList *items)
< {
< int count=0;
< SPItem *item=NULL;
< for (GSList *i = items; i != NULL; i = i->next) {
< item = SP_ITEM(i->data);
< count += item->ifilt();
< }
< return count;
< }
<
245a234
> _context.setF(Inkscape::NORMAL_MESSAGE, _("%s%s. %s."), objects_str, in_phrase, _when_selected);
247,257d235
< // indicate all, some, or none filtered
< const gchar *filt_str =NULL;
< int n_filt = count_filtered ((GSList *)items); //all filtered
< if(n_filt){
< filt_str = g_strdup_printf (_("; <i>%d filtered</i> "),n_filt);
< }
< else {
< filt_str = g_strdup_printf ("");
< }
<
< _context.setF(Inkscape::NORMAL_MESSAGE, _("%s%s%s. %s."), objects_str, filt_str, in_phrase, _when_selected);
260,261d237
< if (filt_str)
< g_free ((gchar *) filt_str);

In the attached screen shot there are two filtered individual objects and one pair of objects grouped which was then filtered. That counts as 3 filtered, which is what is shown in the message at the bottom.