Commit 7272a214 authored by Sven Neumann's avatar Sven Neumann

made dnd work for brushes and patterns.


--Sven
parent 0e5bf722
......@@ -106,6 +106,10 @@ static void device_status_drag_color (GtkWidget *,
guchar *, guchar *, guchar *, gpointer);
static void device_status_drop_color (GtkWidget *,
guchar, guchar, guchar, gpointer);
static void device_status_drop_brush (GtkWidget *,
GdkDragContext *, gint, gint, guint, gpointer);
static void device_status_drop_pattern (GtkWidget *,
GdkDragContext *, gint, gint, guint, gpointer);
/* Global data */
......@@ -287,7 +291,7 @@ devices_restore (void)
if (device_info->brush)
select_brush (device_info->brush);
if (device_info->pattern)
select_pattern(device_info->pattern);
select_pattern (device_info->pattern);
}
suppress_update = FALSE;
......@@ -779,14 +783,14 @@ create_device_status (void)
gtk_preview_size (GTK_PREVIEW (deviceD->colors[i]), CELL_SIZE, CELL_SIZE);
/* dnd stuff */
gtk_drag_source_set (deviceD->colors[i],
GDK_BUTTON1_MASK | GDK_BUTTON3_MASK,
GDK_BUTTON1_MASK,
color_area_target_table, n_color_area_targets,
GDK_ACTION_COPY);
gimp_dnd_color_source_set (deviceD->colors[i], device_status_drag_color,
GUINT_TO_POINTER (device_info->device));
gtk_drag_dest_set (deviceD->colors[i],
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
color_area_target_table, n_color_area_targets,
GDK_ACTION_COPY);
......@@ -802,9 +806,12 @@ create_device_status (void)
gtk_drag_dest_set (deviceD->brushes[i],
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
GTK_DEST_DEFAULT_DROP,
brush_area_target_table, n_brush_area_targets,
GDK_ACTION_COPY);
GDK_ACTION_COPY);
gtk_signal_connect (GTK_OBJECT (deviceD->brushes[i]), "drag_drop",
GTK_SIGNAL_FUNC (device_status_drop_brush),
GUINT_TO_POINTER (device_info->device));
gtk_table_attach (GTK_TABLE(deviceD->table), deviceD->brushes[i],
3, 4, i, i+1,
0, 0, 2, 2);
......@@ -814,10 +821,13 @@ create_device_status (void)
FALSE, TRUE, TRUE);
gtk_drag_dest_set (deviceD->patterns[i],
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
pattern_area_target_table, n_pattern_area_targets,
GDK_ACTION_COPY);
gtk_signal_connect (GTK_OBJECT (deviceD->patterns[i]), "drag_drop",
GTK_SIGNAL_FUNC (device_status_drop_pattern),
GUINT_TO_POINTER (device_info->device));
gtk_table_attach (GTK_TABLE(deviceD->table), deviceD->patterns[i],
4, 5, i, i+1,
0, 0, 2, 2);
......@@ -1109,4 +1119,82 @@ device_status_drop_color (GtkWidget *widget,
}
}
static void
device_status_drop_brush (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
guint time,
gpointer data)
{
GtkWidget *src;
GimpBrush *brush;
guint32 deviceid;
GList *tmp_list;
DeviceInfo *device_info = NULL;
src = gtk_drag_get_source_widget (context);
if (!GIMP_IS_CONTEXT_PREVIEW (src) || !GIMP_CONTEXT_PREVIEW (src)->data)
return;
brush = GIMP_BRUSH (GIMP_CONTEXT_PREVIEW (src)->data);
deviceid = GPOINTER_TO_UINT (data);
tmp_list = devices_info;
while (tmp_list)
{
device_info = (DeviceInfo *)tmp_list->data;
if (device_info->device == deviceid)
break;
tmp_list = tmp_list->next;
}
if (device_info && device_info->is_present)
{
device_info->brush = brush;
if (device_info->device == current_device)
select_brush (device_info->brush);
else
device_status_update (device_info->device);
}
}
static void
device_status_drop_pattern (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
guint time,
gpointer data)
{
GtkWidget *src;
GPattern *pattern;
guint32 deviceid;
GList *tmp_list;
DeviceInfo *device_info = NULL;
src = gtk_drag_get_source_widget (context);
if (!GIMP_IS_CONTEXT_PREVIEW (src) || !GIMP_CONTEXT_PREVIEW (src)->data)
return;
pattern = (GPattern *)(GIMP_CONTEXT_PREVIEW (src)->data);
deviceid = GPOINTER_TO_UINT (data);
tmp_list = devices_info;
while (tmp_list)
{
device_info = (DeviceInfo *)tmp_list->data;
if (device_info->device == deviceid)
break;
tmp_list = tmp_list->next;
}
if (device_info && device_info->is_present)
{
device_info->pattern = pattern;
if (device_info->device == current_device)
select_pattern (device_info->pattern);
else
device_status_update (device_info->device);
}
}
......@@ -99,7 +99,6 @@ static gboolean gimp_context_preview_data_matches_type (GimpContextPreview *,
gpointer);
static void gimp_context_preview_drag_begin (GtkWidget *,
GdkDragContext *);
static void gimp_context_preview_draw_brush (GimpContextPreview *);
static void gimp_context_preview_draw_brush_popup (GimpContextPreview *);
static void gimp_context_preview_draw_brush_drag (GimpContextPreview *);
......@@ -234,7 +233,7 @@ gimp_context_preview_update (GimpContextPreview *gcp,
if (!gcp->data && gcp->drag_source) /* first call */
{
gtk_drag_source_set (GTK_WIDGET (gcp),
GDK_BUTTON1_MASK | GDK_BUTTON3_MASK,
GDK_BUTTON1_MASK,
context_preview_target_table[gcp->type], n_targets,
GDK_ACTION_COPY);
}
......@@ -463,7 +462,6 @@ gimp_context_preview_drag_begin (GtkWidget *widget,
{
gcp_drag_window = gtk_window_new (GTK_WINDOW_POPUP);
gtk_window_set_policy (GTK_WINDOW (gcp_drag_window), FALSE, FALSE, TRUE);
gtk_widget_realize (gcp_drag_window);
gtk_signal_connect (GTK_OBJECT (gcp_drag_window), "destroy",
gtk_widget_destroyed, &gcp_drag_window);
......@@ -472,6 +470,7 @@ gimp_context_preview_drag_begin (GtkWidget *widget,
gtk_widget_destroyed, &gcp_drag_preview);
gtk_container_add (GTK_CONTAINER (gcp_drag_window), gcp_drag_preview);
gtk_widget_show (gcp_drag_preview);
gtk_widget_realize (gcp_drag_window);
}
switch (gcp->type)
......
......@@ -106,6 +106,10 @@ static void device_status_drag_color (GtkWidget *,
guchar *, guchar *, guchar *, gpointer);
static void device_status_drop_color (GtkWidget *,
guchar, guchar, guchar, gpointer);
static void device_status_drop_brush (GtkWidget *,
GdkDragContext *, gint, gint, guint, gpointer);
static void device_status_drop_pattern (GtkWidget *,
GdkDragContext *, gint, gint, guint, gpointer);
/* Global data */
......@@ -287,7 +291,7 @@ devices_restore (void)
if (device_info->brush)
select_brush (device_info->brush);
if (device_info->pattern)
select_pattern(device_info->pattern);
select_pattern (device_info->pattern);
}
suppress_update = FALSE;
......@@ -779,14 +783,14 @@ create_device_status (void)
gtk_preview_size (GTK_PREVIEW (deviceD->colors[i]), CELL_SIZE, CELL_SIZE);
/* dnd stuff */
gtk_drag_source_set (deviceD->colors[i],
GDK_BUTTON1_MASK | GDK_BUTTON3_MASK,
GDK_BUTTON1_MASK,
color_area_target_table, n_color_area_targets,
GDK_ACTION_COPY);
gimp_dnd_color_source_set (deviceD->colors[i], device_status_drag_color,
GUINT_TO_POINTER (device_info->device));
gtk_drag_dest_set (deviceD->colors[i],
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
color_area_target_table, n_color_area_targets,
GDK_ACTION_COPY);
......@@ -802,9 +806,12 @@ create_device_status (void)
gtk_drag_dest_set (deviceD->brushes[i],
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
GTK_DEST_DEFAULT_DROP,
brush_area_target_table, n_brush_area_targets,
GDK_ACTION_COPY);
GDK_ACTION_COPY);
gtk_signal_connect (GTK_OBJECT (deviceD->brushes[i]), "drag_drop",
GTK_SIGNAL_FUNC (device_status_drop_brush),
GUINT_TO_POINTER (device_info->device));
gtk_table_attach (GTK_TABLE(deviceD->table), deviceD->brushes[i],
3, 4, i, i+1,
0, 0, 2, 2);
......@@ -814,10 +821,13 @@ create_device_status (void)
FALSE, TRUE, TRUE);
gtk_drag_dest_set (deviceD->patterns[i],
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
pattern_area_target_table, n_pattern_area_targets,
GDK_ACTION_COPY);
gtk_signal_connect (GTK_OBJECT (deviceD->patterns[i]), "drag_drop",
GTK_SIGNAL_FUNC (device_status_drop_pattern),
GUINT_TO_POINTER (device_info->device));
gtk_table_attach (GTK_TABLE(deviceD->table), deviceD->patterns[i],
4, 5, i, i+1,
0, 0, 2, 2);
......@@ -1109,4 +1119,82 @@ device_status_drop_color (GtkWidget *widget,
}
}
static void
device_status_drop_brush (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
guint time,
gpointer data)
{
GtkWidget *src;
GimpBrush *brush;
guint32 deviceid;
GList *tmp_list;
DeviceInfo *device_info = NULL;
src = gtk_drag_get_source_widget (context);
if (!GIMP_IS_CONTEXT_PREVIEW (src) || !GIMP_CONTEXT_PREVIEW (src)->data)
return;
brush = GIMP_BRUSH (GIMP_CONTEXT_PREVIEW (src)->data);
deviceid = GPOINTER_TO_UINT (data);
tmp_list = devices_info;
while (tmp_list)
{
device_info = (DeviceInfo *)tmp_list->data;
if (device_info->device == deviceid)
break;
tmp_list = tmp_list->next;
}
if (device_info && device_info->is_present)
{
device_info->brush = brush;
if (device_info->device == current_device)
select_brush (device_info->brush);
else
device_status_update (device_info->device);
}
}
static void
device_status_drop_pattern (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
guint time,
gpointer data)
{
GtkWidget *src;
GPattern *pattern;
guint32 deviceid;
GList *tmp_list;
DeviceInfo *device_info = NULL;
src = gtk_drag_get_source_widget (context);
if (!GIMP_IS_CONTEXT_PREVIEW (src) || !GIMP_CONTEXT_PREVIEW (src)->data)
return;
pattern = (GPattern *)(GIMP_CONTEXT_PREVIEW (src)->data);
deviceid = GPOINTER_TO_UINT (data);
tmp_list = devices_info;
while (tmp_list)
{
device_info = (DeviceInfo *)tmp_list->data;
if (device_info->device == deviceid)
break;
tmp_list = tmp_list->next;
}
if (device_info && device_info->is_present)
{
device_info->pattern = pattern;
if (device_info->device == current_device)
select_pattern (device_info->pattern);
else
device_status_update (device_info->device);
}
}
......@@ -21,6 +21,7 @@
#include "appenv.h"
#include "gimpbrushlist.h"
#include "gimpcontextpreview.h"
#include "gimpdnd.h"
#include "gradient.h"
#include "gradient_header.h"
#include "indicator_area.h"
......@@ -37,11 +38,20 @@ static GtkWidget *brush_preview;
static GtkWidget *pattern_preview;
static GtkWidget *gradient_preview;
/* dnd stuff */
static GtkTargetEntry brush_area_target_table[] =
{
GIMP_TARGET_BRUSH
};
static guint n_brush_area_targets = (sizeof (brush_area_target_table) /
sizeof (brush_area_target_table[0]));
static GtkTargetEntry pattern_area_target_table[] =
{
GIMP_TARGET_PATTERN
};
static guint n_pattern_area_targets = (sizeof (pattern_area_target_table) /
sizeof (pattern_area_target_table[0]));
/* The _area_update () functions should be called _preview_update(),
but I've left the old function names in for now since they are
called from devices.c
*/
void
brush_area_update ()
......@@ -67,6 +77,25 @@ brush_preview_clicked (GtkWidget *widget,
return TRUE;
}
static void
brush_preview_drag_drop (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
guint time,
gpointer data)
{
GtkWidget *src;
GimpBrush *brush;
src = gtk_drag_get_source_widget (context);
if (!GIMP_IS_CONTEXT_PREVIEW (src) || !GIMP_CONTEXT_PREVIEW (src)->data)
return;
brush = GIMP_BRUSH (GIMP_CONTEXT_PREVIEW (src)->data);
select_brush (brush);
}
void
pattern_area_update ()
{
......@@ -92,6 +121,25 @@ pattern_preview_clicked (GtkWidget *widget,
return TRUE;
}
static void
pattern_preview_drag_drop (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
guint time,
gpointer data)
{
GtkWidget *src;
GPattern *pattern;
src = gtk_drag_get_source_widget (context);
if (!GIMP_IS_CONTEXT_PREVIEW (src) || !GIMP_CONTEXT_PREVIEW (src)->data)
return;
pattern = (GPattern *)(GIMP_CONTEXT_PREVIEW (src)->data);
select_pattern (pattern);
}
void
gradient_area_update ()
{
......@@ -123,8 +171,17 @@ indicator_area_create ()
NULL);
gtk_signal_connect (GTK_OBJECT (brush_preview), "clicked",
(GtkSignalFunc) brush_preview_clicked, NULL);
gtk_drag_dest_set (brush_preview,
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
brush_area_target_table, n_brush_area_targets,
GDK_ACTION_COPY);
gtk_signal_connect (GTK_OBJECT (brush_preview), "drag_drop",
GTK_SIGNAL_FUNC (brush_preview_drag_drop),
NULL);
gtk_table_attach_defaults (GTK_TABLE(indicator_table), brush_preview,
0, 1, 0, 1);
0, 1, 0, 1);
pattern_preview = gimp_context_preview_new (GCP_PATTERN,
CELL_SIZE, CELL_SIZE,
......@@ -134,6 +191,15 @@ indicator_area_create ()
NULL);
gtk_signal_connect (GTK_OBJECT (pattern_preview), "clicked",
(GtkSignalFunc) pattern_preview_clicked, NULL);
gtk_drag_dest_set (pattern_preview,
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
pattern_area_target_table, n_pattern_area_targets,
GDK_ACTION_COPY);
gtk_signal_connect (GTK_OBJECT (pattern_preview), "drag_drop",
GTK_SIGNAL_FUNC (pattern_preview_drag_drop),
NULL);
gtk_table_attach_defaults (GTK_TABLE(indicator_table), pattern_preview,
1, 2, 0, 1);
......
......@@ -106,6 +106,10 @@ static void device_status_drag_color (GtkWidget *,
guchar *, guchar *, guchar *, gpointer);
static void device_status_drop_color (GtkWidget *,
guchar, guchar, guchar, gpointer);
static void device_status_drop_brush (GtkWidget *,
GdkDragContext *, gint, gint, guint, gpointer);
static void device_status_drop_pattern (GtkWidget *,
GdkDragContext *, gint, gint, guint, gpointer);
/* Global data */
......@@ -287,7 +291,7 @@ devices_restore (void)
if (device_info->brush)
select_brush (device_info->brush);
if (device_info->pattern)
select_pattern(device_info->pattern);
select_pattern (device_info->pattern);
}
suppress_update = FALSE;
......@@ -779,14 +783,14 @@ create_device_status (void)
gtk_preview_size (GTK_PREVIEW (deviceD->colors[i]), CELL_SIZE, CELL_SIZE);
/* dnd stuff */
gtk_drag_source_set (deviceD->colors[i],
GDK_BUTTON1_MASK | GDK_BUTTON3_MASK,
GDK_BUTTON1_MASK,
color_area_target_table, n_color_area_targets,
GDK_ACTION_COPY);
gimp_dnd_color_source_set (deviceD->colors[i], device_status_drag_color,
GUINT_TO_POINTER (device_info->device));
gtk_drag_dest_set (deviceD->colors[i],
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
color_area_target_table, n_color_area_targets,
GDK_ACTION_COPY);
......@@ -802,9 +806,12 @@ create_device_status (void)
gtk_drag_dest_set (deviceD->brushes[i],
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
GTK_DEST_DEFAULT_DROP,
brush_area_target_table, n_brush_area_targets,
GDK_ACTION_COPY);
GDK_ACTION_COPY);
gtk_signal_connect (GTK_OBJECT (deviceD->brushes[i]), "drag_drop",
GTK_SIGNAL_FUNC (device_status_drop_brush),
GUINT_TO_POINTER (device_info->device));
gtk_table_attach (GTK_TABLE(deviceD->table), deviceD->brushes[i],
3, 4, i, i+1,
0, 0, 2, 2);
......@@ -814,10 +821,13 @@ create_device_status (void)
FALSE, TRUE, TRUE);
gtk_drag_dest_set (deviceD->patterns[i],
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
pattern_area_target_table, n_pattern_area_targets,
GDK_ACTION_COPY);
gtk_signal_connect (GTK_OBJECT (deviceD->patterns[i]), "drag_drop",
GTK_SIGNAL_FUNC (device_status_drop_pattern),
GUINT_TO_POINTER (device_info->device));
gtk_table_attach (GTK_TABLE(deviceD->table), deviceD->patterns[i],
4, 5, i, i+1,
0, 0, 2, 2);
......@@ -1109,4 +1119,82 @@ device_status_drop_color (GtkWidget *widget,
}
}
static void
device_status_drop_brush (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
guint time,
gpointer data)
{
GtkWidget *src;
GimpBrush *brush;
guint32 deviceid;
GList *tmp_list;
DeviceInfo *device_info = NULL;
src = gtk_drag_get_source_widget (context);
if (!GIMP_IS_CONTEXT_PREVIEW (src) || !GIMP_CONTEXT_PREVIEW (src)->data)
return;
brush = GIMP_BRUSH (GIMP_CONTEXT_PREVIEW (src)->data);
deviceid = GPOINTER_TO_UINT (data);
tmp_list = devices_info;
while (tmp_list)
{
device_info = (DeviceInfo *)tmp_list->data;
if (device_info->device == deviceid)
break;
tmp_list = tmp_list->next;
}
if (device_info && device_info->is_present)
{
device_info->brush = brush;
if (device_info->device == current_device)
select_brush (device_info->brush);
else
device_status_update (device_info->device);
}
}
static void
device_status_drop_pattern (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
guint time,
gpointer data)
{
GtkWidget *src;
GPattern *pattern;
guint32 deviceid;
GList *tmp_list;
DeviceInfo *device_info = NULL;
src = gtk_drag_get_source_widget (context);
if (!GIMP_IS_CONTEXT_PREVIEW (src) || !GIMP_CONTEXT_PREVIEW (src)->data)
return;
pattern = (GPattern *)(GIMP_CONTEXT_PREVIEW (src)->data);
deviceid = GPOINTER_TO_UINT (data);
tmp_list = devices_info;
while (tmp_list)
{
device_info = (DeviceInfo *)tmp_list->data;
if (device_info->device == deviceid)
break;
tmp_list = tmp_list->next;
}
if (device_info && device_info->is_present)
{
device_info->pattern = pattern;
if (device_info->device == current_device)
select_pattern (device_info->pattern);
else
device_status_update (device_info->device);
}
}
......@@ -21,6 +21,7 @@
#include "appenv.h"
#include "gimpbrushlist.h"
#include "gimpcontextpreview.h"
#include "gimpdnd.h"
#include "gradient.h"
#include "gradient_header.h"
#include "indicator_area.h"
......@@ -37,11 +38,20 @@ static GtkWidget *brush_preview;
static GtkWidget *pattern_preview;
static GtkWidget *gradient_preview;
/* dnd stuff */
static GtkTargetEntry brush_area_target_table[] =
{
GIMP_TARGET_BRUSH
};
static guint n_brush_area_targets = (sizeof (brush_area_target_table) /
sizeof (brush_area_target_table[0]));
static GtkTargetEntry pattern_area_target_table[] =
{
GIMP_TARGET_PATTERN
};
static guint n_pattern_area_targets = (sizeof (pattern_area_target_table) /
sizeof (pattern_area_target_table[0]));
/* The _area_update () functions should be called _preview_update(),
but I've left the old function names in for now since they are
called from devices.c
*/
void
brush_area_update ()
......@@ -67,6 +77,25 @@ brush_preview_clicked (GtkWidget *widget,
return TRUE;
}
static void
brush_preview_drag_drop (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
guint time,
gpointer data)
{
GtkWidget *src;
GimpBrush *brush;
src = gtk_drag_get_source_widget (context);
if (!GIMP_IS_CONTEXT_PREVIEW (src) || !GIMP_CONTEXT_PREVIEW (src)->data)
return;
brush = GIMP_BRUSH (GIMP_CONTEXT_PREVIEW (src)->data);
select_brush (brush);
}
void
pattern_area_update ()
{
......@@ -92,6 +121,25 @@ pattern_preview_clicked (GtkWidget *widget,
return TRUE;
}
static void
pattern_preview_drag_drop (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
guint time,
gpointer data)
{
GtkWidget *src;
GPattern *pattern;
src = gtk_drag_get_source_widget (context);
if (!GIMP_IS_CONTEXT_PREVIEW (src) || !GIMP_CONTEXT_PREVIEW (src)->data)
return;
pattern = (GPattern *)(GIMP_CONTEXT_PREVIEW (src)->data);
select_pattern (pattern);
}
void
gradient_area_update ()
{
......@@ -123,8 +171,17 @@ indicator_area_create ()
NULL);
gtk_signal_connect (GTK_OBJECT (brush_preview), "clicked",
(GtkSignalFunc) brush_preview_clicked, NULL);
gtk_drag_dest_set (brush_preview,
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
brush_area_target_table, n_brush_area_targets,
GDK_ACTION_COPY);
gtk_signal_connect (GTK_OBJECT (brush_preview), "drag_drop",
GTK_SIGNAL_FUNC (brush_preview_drag_drop),
NULL);
gtk_table_attach_defaults (GTK_TABLE(indicator_table), brush_preview,
0, 1, 0, 1);
0, 1, 0, 1);
pattern_preview = gimp_context_preview_new (GCP_PATTERN,
CELL_SIZE, CELL_SIZE,
......@@ -134,6 +191,15 @@ indicator_area_create ()
NULL);
gtk_signal_connect (GTK_OBJECT (pattern_preview), "clicked",
(GtkSignalFunc) pattern_preview_clicked, NULL);
gtk_drag_dest_set (pattern_preview,
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
pattern_area_target_table, n_pattern_area_targets,
GDK_ACTION_COPY);
gtk_signal_connect (GTK_OBJECT (pattern_preview), "drag_drop",
GTK_SIGNAL_FUNC (pattern_preview_drag_drop),
NULL);
gtk_table_attach_defaults (GTK_TABLE(indicator_table), pattern_preview,
1, 2, 0, 1);
......
......@@ -106,6 +106,10 @@ static void device_status_drag_color (GtkWidget *,
guchar *, guchar *, guchar *, gpointer);
static void device_status_drop_color (GtkWidget *,
guchar, guchar, guchar, gpointer);
static void device_status_drop_brush (GtkWidget *,
GdkDragContext *, gint, gint, guint, gpointer);
static void device_status_drop_pattern (GtkWidget *,
GdkDragContext *, gint, gint, guint, gpointer);
/* Global data */
......@@ -287,7 +291,7 @@ devices_restore (void)
if (device_info->brush)
select_brush (device_info->brush);
if (device_info->pattern)
select_pattern(device_info->pattern);
select_pattern (device_info->pattern);
}
suppress_update = FALSE;
......@@ -779,14 +783,14 @@ create_device_status (void)
gtk_preview_size (GTK_PREVIEW (deviceD->colors[i]), CELL_SIZE, CELL_SIZE);
/* dnd stuff */
gtk_drag_source_set (deviceD->colors[i],
GDK_BUTTON1_MASK | GDK_BUTTON3_MASK,
GDK_BUTTON1_MASK,
color_area_target_table, n_color_area_targets,
GDK_ACTION_COPY);
gimp_dnd_color_source_set (deviceD->colors[i], device_status_drag_color,
GUINT_TO_POINTER (device_info->device));