Code

Show the name of the swatch that is currently under the pointer in the status bar...
authorjohncoswell <johncoswell@users.sourceforge.net>
Mon, 21 Apr 2008 22:26:43 +0000 (22:26 +0000)
committerjohncoswell <johncoswell@users.sourceforge.net>
Mon, 21 Apr 2008 22:26:43 +0000 (22:26 +0000)
src/dialogs/swatches.cpp

index ea89be30f702b1e7ddb5f0aeb5003fc158c8ebfc..72a85a43bace82bc14e50daac58a16e7d8f5b8c1 100644 (file)
@@ -3,8 +3,10 @@
  *
  * Authors:
  *   Jon A. Cruz
+ *   John Bintz
  *
  * Copyright (C) 2005 Jon A. Cruz
+ * Copyright (C) 2008 John Bintz
  *
  * Released under GNU GPL, read the file 'COPYING' for more information
  */
@@ -23,6 +25,8 @@
 #include <glibmm/i18n.h>
 #include <gdkmm/pixbuf.h>
 #include "inkscape.h"
+#include "desktop.h"
+#include "message-stack.h"
 #include "document.h"
 #include "desktop-handles.h"
 #include "extension/db.h"
@@ -236,6 +240,21 @@ static void handleSecondaryClick( GtkWidget* widget, gint arg1, gpointer callbac
     }
 }
 
+static void handleEnterNotify( GtkWidget* widget, GdkEventCrossing* event, gpointer callback_data ) {
+    ColorItem* item = reinterpret_cast<ColorItem*>(callback_data);
+    if ( item ) {
+        SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+        if ( desktop ) {
+            desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, g_strconcat(
+              _("Swatch info: <b>"),
+              item->def.descr.c_str(),
+              _("</b>"),
+              NULL
+            ));
+        }
+    }
+}
+
 static GtkWidget* popupMenu = 0;
 static ColorItem* bounceTarget = 0;
 
@@ -585,6 +604,11 @@ Gtk::Widget* ColorItem::getPreview(PreviewStyle style, ViewType view, ::PreviewS
                           G_CALLBACK(dragBegin),
                           this );
 
+        g_signal_connect( G_OBJECT(newBlot->gobj()),
+                          "enter-notify-event",
+                          G_CALLBACK(handleEnterNotify),
+                          this);
+
 //         g_signal_connect( G_OBJECT(newBlot->gobj()),
 //                           "drag-drop",
 //                           G_CALLBACK(dragDropColorData),