summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNicolas Dufour <nicoduf@yahoo.fr>2012-05-11 13:02:16 +0000
committerJazzyNico <nicoduf@yahoo.fr>2012-05-11 13:02:16 +0000
commit956c2cb14b2dd3d57936f0325d07abf6a408154b (patch)
tree0c08bc17e651768d62e9fe81795745daacfe71d5 /src
parentFix for 169759 : HIG compliant Edit menu (diff)
downloadinkscape-956c2cb14b2dd3d57936f0325d07abf6a408154b.tar.gz
inkscape-956c2cb14b2dd3d57936f0325d07abf6a408154b.zip
UI. Filtered objects count (patch by David Mathog).
Translations. Inkscape.pot and French translation update. (bzr r11355)
Diffstat (limited to 'src')
-rw-r--r--src/selection-describer.cpp27
-rw-r--r--src/sp-item.cpp13
-rw-r--r--src/sp-item.h1
3 files changed, 40 insertions, 1 deletions
diff --git a/src/selection-describer.cpp b/src/selection-describer.cpp
index 5d6f9288d..2fa7d078b 100644
--- a/src/selection-describer.cpp
+++ b/src/selection-describer.cpp
@@ -91,6 +91,18 @@ GSList *collect_terms (GSList *items)
return r;
}
+// 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;
+}
+
namespace Inkscape {
@@ -231,10 +243,23 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select
}
g_slist_free (terms);
- _context.setF(Inkscape::NORMAL_MESSAGE, _("%s%s. %s."), objects_str, in_phrase, _when_selected);
+ // 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 (ngettext("; <i>%d filtered object</i> ",
+ "; <i>%d filtered objects</i> ", n_filt), 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);
if (objects_str)
g_free ((gchar *) objects_str);
+ if (filt_str)
+ g_free ((gchar *) filt_str);
}
g_free(in_phrase);
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index e0a9b97f2..d182c7d07 100644
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -967,6 +967,19 @@ gchar *SPItem::description()
}
/**
+ * 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;
+}
+
+/**
* Allocates unique integer keys.
* \param numkeys Number of keys required.
* \return First allocated key; hence if the returned key is n
diff --git a/src/sp-item.h b/src/sp-item.h
index 5cfd49446..62bde616a 100644
--- a/src/sp-item.h
+++ b/src/sp-item.h
@@ -192,6 +192,7 @@ public:
unsigned pos_in_parent();
gchar *description();
+ int ifilt();
void invoke_print(SPPrintContext *ctx);
static unsigned int display_key_new(unsigned int numkeys);
Inkscape::DrawingItem *invoke_show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags);