From 4fd60580e1dd021f5a16845ff9e580044835cbb0 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Wed, 14 May 2014 18:57:01 +0200 Subject: i18n. Fix for Bug #1318929 (untranslatable string in trunk-r13370). Translations. PO template update. Translations. French translation update. (bzr r13374) --- src/selection-describer.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'src/selection-describer.cpp') diff --git a/src/selection-describer.cpp b/src/selection-describer.cpp index 88450dfdf..1cb96fed0 100644 --- a/src/selection-describer.cpp +++ b/src/selection-describer.cpp @@ -56,6 +56,21 @@ char* collect_terms (GSList *items) return g_strdup(ss.str().c_str()); } +// Returns the number of terms in the list +static int count_terms (GSList *items) +{ + GSList *check = NULL; + int count=0; + for (GSList *i = (GSList *)items; i != NULL; i = i->next) { + const char *term = SP_ITEM(i->data)->displayName(); + if (term != NULL && g_slist_find (check, term) == NULL) { + check = g_slist_prepend (check, (void *) term); + count++; + } + } + return count; +} + // Returns the number of filtered items in the list static int count_filtered (GSList *items) { @@ -194,9 +209,12 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select } else { // multiple items int objcount = g_slist_length((GSList *)items); char *terms = collect_terms ((GSList *)items); - - gchar *objects_str = g_strdup_printf( - "%i objects selected of types %s", objcount, terms); + int n_terms = count_terms((GSList *)items); + + gchar *objects_str = g_strdup_printf(ngettext( + "%i objects selected of type %s", + "%i objects selected of types %s", n_terms), + objcount, terms); g_free(terms); -- cgit v1.2.3 From e179290f049d5c34ae2b9c05fdfeab830b7c39e7 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Mon, 10 Nov 2014 09:39:33 -0800 Subject: Removed SP_USE/SP_IS_USE Gtk-ish macros and cleaned affected files. (bzr r13700) --- src/selection-describer.cpp | 77 ++++++++++++++++++++++++++++----------------- 1 file changed, 49 insertions(+), 28 deletions(-) (limited to 'src/selection-describer.cpp') diff --git a/src/selection-describer.cpp b/src/selection-describer.cpp index 1cb96fed0..f7814fd57 100644 --- a/src/selection-describer.cpp +++ b/src/selection-describer.cpp @@ -5,6 +5,7 @@ * MenTaLguY * bulia byak * Abhishek Sharma + * Jon A. Cruz * * Copyright (C) 2004-2006 Authors * @@ -46,11 +47,14 @@ char* collect_terms (GSList *items) bool first = true; for (GSList *i = (GSList *)items; i != NULL; i = i->next) { - const char *term = SP_ITEM(i->data)->displayName(); - if (term != NULL && g_slist_find (check, term) == NULL) { - check = g_slist_prepend (check, (void *) term); - ss << (first ? "" : ", ") << "" << term << ""; - first = false; + SPItem *item = dynamic_cast(reinterpret_cast(i->data)); + if (item) { + const char *term = item->displayName(); + if (term != NULL && g_slist_find (check, term) == NULL) { + check = g_slist_prepend (check, (void *) term); + ss << (first ? "" : ", ") << "" << term << ""; + first = false; + } } } return g_strdup(ss.str().c_str()); @@ -62,10 +66,13 @@ static int count_terms (GSList *items) GSList *check = NULL; int count=0; for (GSList *i = (GSList *)items; i != NULL; i = i->next) { - const char *term = SP_ITEM(i->data)->displayName(); - if (term != NULL && g_slist_find (check, term) == NULL) { - check = g_slist_prepend (check, (void *) term); - count++; + SPItem *item = dynamic_cast(reinterpret_cast(i->data)); + if (item) { + const char *term = item->displayName(); + if (term != NULL && g_slist_find (check, term) == NULL) { + check = g_slist_prepend (check, (void *) term); + count++; + } } } return count; @@ -76,8 +83,10 @@ static int count_filtered (GSList *items) { int count=0; for (GSList *i = items; i != NULL; i = i->next) { - SPItem *item = SP_ITEM(i->data); - count += item->isFiltered(); + SPItem *item = dynamic_cast(reinterpret_cast((i->data))); + if (item) { + count += item->isFiltered(); + } } return count; } @@ -118,7 +127,8 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select if (!items) { // no items _context.set(Inkscape::NORMAL_MESSAGE, _when_nothing); } else { - SPItem *item = SP_ITEM(items->data); + SPItem *item = dynamic_cast(reinterpret_cast(items->data)); + g_assert(item != NULL); SPObject *layer = selection->layers()->layerForObject(item); SPObject *root = selection->layers()->currentRoot(); @@ -181,30 +191,41 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select if (!items->next) { // one item char *item_desc = item->detailedDescription(); - if (SP_IS_USE(item) && SP_IS_SYMBOL(item->firstChild())) { + bool isUse = dynamic_cast(item) != NULL; + if (isUse && dynamic_cast(item->firstChild())) { _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s. %s.", item_desc, in_phrase, _("Convert symbol to group to edit"), _when_selected); - } else if (SP_IS_SYMBOL(item)) { + } else if (dynamic_cast(item)) { _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s.", item_desc, in_phrase, _("Remove from symbols tray to edit symbol")); - } else if (SP_IS_USE(item) || (SP_IS_OFFSET(item) && SP_OFFSET(item)->sourceHref)) { - _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s. %s.", - item_desc, in_phrase, - _("Use Shift+D to look up original"), _when_selected); - } else if (SP_IS_TEXT_TEXTPATH(item)) { - _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s. %s.", - item_desc, in_phrase, - _("Use Shift+D to look up path"), _when_selected); - } else if (SP_IS_FLOWTEXT(item) && !SP_FLOWTEXT(item)->has_internal_frame()) { - _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s. %s.", - item_desc, in_phrase, - _("Use Shift+D to look up frame"), _when_selected); } else { - _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s.", - item_desc, in_phrase, _when_selected); + SPOffset *offset = (isUse) ? NULL : dynamic_cast(item); + if (isUse || (offset && offset->sourceHref)) { + _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s. %s.", + item_desc, in_phrase, + _("Use Shift+D to look up original"), _when_selected); + } else { + SPText *text = dynamic_cast(item); + if (text && text->firstChild() && dynamic_cast(text->firstChild())) { + _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s. %s.", + item_desc, in_phrase, + _("Use Shift+D to look up path"), _when_selected); + } else { + SPFlowtext *flowtext = dynamic_cast(item); + if (flowtext && !flowtext->has_internal_frame()) { + _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s. %s.", + item_desc, in_phrase, + _("Use Shift+D to look up frame"), _when_selected); + } else { + _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s.", + item_desc, in_phrase, _when_selected); + } + } + } } + g_free(item_desc); } else { // multiple items int objcount = g_slist_length((GSList *)items); -- cgit v1.2.3