index 01aab97b759f29efa95aa3d7401ea400cad58d65..7bc6adf38e454da21c871e2f9f283015919b9d6f 100644 (file)
* Authors:
* MenTaLguY <mental@rydia.net>
* bulia byak <buliabyak@users.sf.net>
+ * Abhishek Sharma
*
* Copyright (C) 2004-2006 Authors
*
type2term(GType type)
{
if (type == SP_TYPE_ANCHOR)
- { return _("Link"); }
+ //TRANSLATORS: "Link" means internet link (anchor)
+ { return C_("Web", "Link"); }
if (type == SP_TYPE_CIRCLE)
{ return _("Circle"); }
if (type == SP_TYPE_ELLIPSE)
{ return _("Polyline"); }
if (type == SP_TYPE_RECT)
{ return _("Rectangle"); }
- if (type == SP_TYPE_3DBOX)
+ if (type == SP_TYPE_BOX3D)
{ return _("3D Box"); }
if (type == SP_TYPE_TEXT)
{ return _("Text"); }
- // TRANSLATORS: only translate "string" in "context|string".
- // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS
if (type == SP_TYPE_USE)
- { return Q_("object|Clone"); }
+ // TRANSLATORS: "Clone" is a noun, type of object
+ { return C_("Object", "Clone"); }
if (type == SP_TYPE_ARC)
{ return _("Ellipse"); }
if (type == SP_TYPE_OFFSET)
namespace Inkscape {
-SelectionDescriber::SelectionDescriber(Inkscape::Selection *selection, MessageStack *stack)
-: _context(stack)
+SelectionDescriber::SelectionDescriber(Inkscape::Selection *selection, MessageStack *stack, char *when_selected, char *when_nothing)
+ : _context(stack),
+ _when_selected (when_selected),
+ _when_nothing (when_nothing)
+{
+ _selection_changed_connection = new sigc::connection (
+ selection->connectChanged(
+ sigc::mem_fun(*this, &SelectionDescriber::_updateMessageFromSelection)));
+ _selection_modified_connection = new sigc::connection (
+ selection->connectModified(
+ sigc::mem_fun(*this, &SelectionDescriber::_selectionModified)));
+ _updateMessageFromSelection(selection);
+}
+
+SelectionDescriber::~SelectionDescriber()
+{
+ _selection_changed_connection->disconnect();
+ _selection_modified_connection->disconnect();
+ delete _selection_changed_connection;
+ delete _selection_modified_connection;
+}
+
+void SelectionDescriber::_selectionModified(Inkscape::Selection *selection, guint /*flags*/)
{
- selection->connectChanged(sigc::mem_fun(*this, &SelectionDescriber::_updateMessageFromSelection));
_updateMessageFromSelection(selection);
}
void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *selection) {
GSList const *items = selection->itemList();
- char const *when_selected = _("Click selection to toggle scale/rotation handles");
if (!items) { // no items
- _context.set(Inkscape::NORMAL_MESSAGE, _("No objects selected. Click, Shift+click, or drag around objects to select."));
+ _context.set(Inkscape::NORMAL_MESSAGE, _when_nothing);
} else {
SPItem *item = SP_ITEM(items->data);
SPObject *layer = selection->desktop()->layerForObject (SP_OBJECT (item));
@@ -135,7 +155,7 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select
// Parent name
SPObject *parent = SP_OBJECT_PARENT (item);
- gchar *parent_label = SP_OBJECT_ID(parent);
+ gchar const *parent_label = parent->getId();
char *quoted_parent_label = xml_quote_strdup(parent_label);
gchar *parent_name = g_strdup_printf(_("<i>%s</i>"), quoted_parent_label);
g_free(quoted_parent_label);
@@ -159,22 +179,22 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select
g_free (parent_name);
if (!items->next) { // one item
- char *item_desc = sp_item_description(item);
+ char *item_desc = item->description();
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 <b>Shift+D</b> to look up original"), when_selected);
+ _("Use <b>Shift+D</b> 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 <b>Shift+D</b> to look up path"), when_selected);
+ _("Use <b>Shift+D</b> 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 <b>Shift+D</b> to look up frame"), when_selected);
+ _("Use <b>Shift+D</b> to look up frame"), _when_selected);
} else {
_context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s.",
- item_desc, in_phrase, when_selected);
+ item_desc, in_phrase, _when_selected);
}
g_free(item_desc);
} else { // multiple items
@@ -211,7 +231,7 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select
}
g_slist_free (terms);
- _context.setF(Inkscape::NORMAL_MESSAGE, _("%s%s. %s."), objects_str, in_phrase, when_selected);
+ _context.setF(Inkscape::NORMAL_MESSAGE, _("%s%s. %s."), objects_str, in_phrase, _when_selected);
if (objects_str)
g_free ((gchar *) objects_str);
@@ -232,4 +252,4 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select
fill-column:99
End:
*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :