Code

Keep swatch status messages visible while hovering
authorjohncoswell <johncoswell@users.sourceforge.net>
Tue, 22 Apr 2008 23:09:01 +0000 (23:09 +0000)
committerjohncoswell <johncoswell@users.sourceforge.net>
Tue, 22 Apr 2008 23:09:01 +0000 (23:09 +0000)
src/dialogs/swatches.cpp

index 3b62f018620ffca16d3444d6295b0f6885cd4937..667149916790fe3c4a91c610e2544a88e20cb892 100644 (file)
@@ -26,7 +26,7 @@
 #include <gdkmm/pixbuf.h>
 #include "inkscape.h"
 #include "desktop.h"
-#include "message-stack.h"
+#include "message-context.h"
 #include "document.h"
 #include "desktop-handles.h"
 #include "extension/db.h"
@@ -245,10 +245,12 @@ static gboolean handleEnterNotify( GtkWidget* widget, GdkEventCrossing* event, g
     if ( item ) {
         SPDesktop *desktop = SP_ACTIVE_DESKTOP;
         if ( desktop ) {
-            desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, g_strconcat(
+            desktop->tipsMessageContext()->set(Inkscape::INFORMATION_MESSAGE, g_strconcat(
               _("Swatch info: <b>"),
               item->def.descr.c_str(),
               _("</b>"),
+              _(" - "),
+              _("<b>Click</b> to set fill, <b>Shift+click</b> to set stroke"),
               NULL
             ));
         }
@@ -256,6 +258,17 @@ static gboolean handleEnterNotify( GtkWidget* widget, GdkEventCrossing* event, g
     return FALSE;
 }
 
+static gboolean handleLeaveNotify( GtkWidget* widget, GdkEventCrossing* event, gpointer callback_data ) {
+    ColorItem* item = reinterpret_cast<ColorItem*>(callback_data);
+    if ( item ) {
+        SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+        if ( desktop ) {
+            desktop->tipsMessageContext()->clear();
+        }
+    }
+    return FALSE;
+}
+
 static GtkWidget* popupMenu = 0;
 static ColorItem* bounceTarget = 0;
 
@@ -610,6 +623,11 @@ Gtk::Widget* ColorItem::getPreview(PreviewStyle style, ViewType view, ::PreviewS
                           G_CALLBACK(handleEnterNotify),
                           this);
 
+        g_signal_connect( G_OBJECT(newBlot->gobj()),
+                          "leave-notify-event",
+                          G_CALLBACK(handleLeaveNotify),
+                          this);
+
 //         g_signal_connect( G_OBJECT(newBlot->gobj()),
 //                           "drag-drop",
 //                           G_CALLBACK(dragDropColorData),