From 21ea5cde2e9fc96322f2c0b654273b0ec1c45819 Mon Sep 17 00:00:00 2001 From: joncruz Date: Fri, 10 Mar 2006 09:29:33 +0000 Subject: [PATCH] Changed color dragging to have a color preview. --- ChangeLog | 5 +++++ src/dialogs/swatches.cpp | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/ChangeLog b/ChangeLog index 95ed6e187..d34c6cccb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-03-10 Jon A. Cruz + * src/dialogs/swatches.cpp: + + Changed color dragging to have a color preview. + 2006-03-09 Jon A. Cruz * src/interface.cpp: diff --git a/src/dialogs/swatches.cpp b/src/dialogs/swatches.cpp index 3063e2280..5ed09b3e0 100644 --- a/src/dialogs/swatches.cpp +++ b/src/dialogs/swatches.cpp @@ -18,6 +18,7 @@ #include #include +#include #include "inkscape.h" #include "document.h" #include "desktop-handles.h" @@ -114,6 +115,21 @@ static void dragGetColorData( GtkWidget *widget, } } +static void dragBegin( GtkWidget *widget, GdkDragContext* dc, gpointer data ) +{ + ColorItem* item = reinterpret_cast(data); + if ( item ) + { + Glib::RefPtr thumb = Gdk::Pixbuf::create( Gdk::COLORSPACE_RGB, false, 8, 32, 24 ); + guint32 fillWith = (0xff000000 & (item->_r << 24)) + | (0x00ff0000 & (item->_g << 16)) + | (0x0000ff00 & (item->_b << 8)); + thumb->fill( fillWith ); + gtk_drag_set_icon_pixbuf( dc, thumb->gobj(), 0, 0 ); + } + +} + //"drag-drop" gboolean dragDropColorData( GtkWidget *widget, GdkDragContext *drag_context, @@ -206,6 +222,11 @@ Gtk::Widget* ColorItem::getPreview(PreviewStyle style, ViewType view, Gtk::Built G_CALLBACK(dragGetColorData), this); + g_signal_connect( G_OBJECT(newBlot->gobj()), + "drag-begin", + G_CALLBACK(dragBegin), + this ); + g_signal_connect( G_OBJECT(newBlot->gobj()), "drag-drop", G_CALLBACK(dragDropColorData), -- 2.30.2