Code

make when_selected and when_nothing customizable strings, settable via selection...
authorbuliabyak <>
Fri, 5 Feb 2010 18:54:54 +0000 (14:54 -0400)
committerbuliabyak <>
Fri, 5 Feb 2010 18:54:54 +0000 (14:54 -0400)
src/select-context.cpp
src/selection-describer.cpp
src/selection-describer.h

index 606934ca6f3d9f451fb9854e19a1db9b94ef177e..74f54e9af7a117398209aa369ac491bce348edc9 100644 (file)
@@ -172,7 +172,12 @@ sp_select_context_setup(SPEventContext *ec)
 
     SPDesktop *desktop = ec->desktop;
 
-    select_context->_describer = new Inkscape::SelectionDescriber(desktop->selection, desktop->messageStack());
+    select_context->_describer = new Inkscape::SelectionDescriber(
+                desktop->selection, 
+                desktop->messageStack(),
+                _("Click selection to toggle scale/rotation handles"),
+                _("No objects selected. Click, Shift+click, or drag around objects to select.")
+        );
 
     select_context->_seltrans = new Inkscape::SelTrans(desktop);
 
@@ -362,7 +367,7 @@ sp_select_context_item_handler(SPEventContext *event_context, SPItem *item, GdkE
         case GDK_ENTER_NOTIFY:
         {
             if (!desktop->isWaitingCursor()) {
-                GdkCursor *cursor = gdk_cursor_new(GDK_FLEUR);
+                GdkCursor *cursor = gdk_cursor_new(GDK_CENTER_PTR);
                 gdk_window_set_cursor(GTK_WIDGET(sp_desktop_canvas(desktop))->window, cursor);
                 gdk_cursor_destroy(cursor);
             }
@@ -723,7 +728,7 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
                                                 _("<b>Alt</b>: click to select under; drag to move selected or select by touch"));
                     // if Alt and nonempty selection, show moving cursor ("move selected"):
                     if (alt && !selection->isEmpty() && !desktop->isWaitingCursor()) {
-                        GdkCursor *cursor = gdk_cursor_new(GDK_FLEUR);
+                        GdkCursor *cursor = gdk_cursor_new(GDK_CENTER_PTR);
                         gdk_window_set_cursor(GTK_WIDGET(sp_desktop_canvas(desktop))->window, cursor);
                         gdk_cursor_destroy(cursor);
                     }
index 27dd8413a25a7f22b5e4abd43a0705a580f1d7e7..78cf9be33b537e48f0b3462d7ce5b935ccad77ea 100644 (file)
@@ -97,8 +97,10 @@ GSList *collect_terms (GSList *items)
 
 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(
@@ -125,9 +127,8 @@ void SelectionDescriber::_selectionModified(Inkscape::Selection *selection, guin
 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));
@@ -185,18 +186,18 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select
             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
@@ -233,7 +234,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);
index 0c4c9b9c4c10be4c709a79bb331fcb68ac9bc93d..4b0e3d8c716df6542f9f2abc6222a93d810e37b9 100644 (file)
@@ -23,7 +23,7 @@ class MessageStack;
 
 class SelectionDescriber : public sigc::trackable {
 public:
-    SelectionDescriber(Inkscape::Selection *selection, MessageStack *stack);
+    SelectionDescriber(Inkscape::Selection *selection, MessageStack *stack, char *when_selected, char *when_nothing);
     ~SelectionDescriber();
 
 private:
@@ -34,6 +34,9 @@ private:
     sigc::connection *_selection_modified_connection;
 
     MessageContext _context;
+
+    char *_when_selected;
+    char *_when_nothing;
 };
 
 }