mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-19 06:14:03 +00:00
libgimp/gimpdrawablecombobox.c accept DND of image / drawable IDs.
2005-03-26 Sven Neumann <sven@gimp.org> * libgimp/gimpdrawablecombobox.c * libgimp/gimpimagecombobox.c: accept DND of image / drawable IDs.
This commit is contained in:
parent
deb8eaeac9
commit
bf8759df06
|
@ -1,3 +1,8 @@
|
|||
2005-03-26 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* libgimp/gimpdrawablecombobox.c
|
||||
* libgimp/gimpimagecombobox.c: accept DND of image / drawable IDs.
|
||||
|
||||
2005-03-26 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/widgets/gimptoolbox-image-area.c: added a hint about XDS to
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
@ -43,6 +45,21 @@ static gint gimp_drawable_combo_box_model_add (GtkListStore *stor
|
|||
GimpDrawableConstraintFunc constraint,
|
||||
gpointer data);
|
||||
|
||||
static void gimp_drawable_combo_box_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
GtkSelectionData *selection,
|
||||
guint info,
|
||||
guint time);
|
||||
|
||||
|
||||
static const GtkTargetEntry targets[] =
|
||||
{
|
||||
{ "application/x-gimp-channel-id", 0 },
|
||||
{ "application/x-gimp-layer-id", 0 }
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* gimp_drawable_combo_box_new:
|
||||
|
@ -108,6 +125,17 @@ gimp_drawable_combo_box_new (GimpDrawableConstraintFunc constraint,
|
|||
if (gtk_tree_model_get_iter_first (model, &iter))
|
||||
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_box), &iter);
|
||||
|
||||
gtk_drag_dest_set (combo_box,
|
||||
GTK_DEST_DEFAULT_HIGHLIGHT |
|
||||
GTK_DEST_DEFAULT_MOTION |
|
||||
GTK_DEST_DEFAULT_DROP,
|
||||
targets, 2,
|
||||
GDK_ACTION_COPY);
|
||||
|
||||
g_signal_connect (combo_box, "drag-data-received",
|
||||
G_CALLBACK (gimp_drawable_combo_box_drag_data_received),
|
||||
NULL);
|
||||
|
||||
return combo_box;
|
||||
}
|
||||
|
||||
|
@ -161,6 +189,17 @@ gimp_channel_combo_box_new (GimpDrawableConstraintFunc constraint,
|
|||
if (gtk_tree_model_get_iter_first (model, &iter))
|
||||
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_box), &iter);
|
||||
|
||||
gtk_drag_dest_set (combo_box,
|
||||
GTK_DEST_DEFAULT_HIGHLIGHT |
|
||||
GTK_DEST_DEFAULT_MOTION |
|
||||
GTK_DEST_DEFAULT_DROP,
|
||||
targets, 1,
|
||||
GDK_ACTION_COPY);
|
||||
|
||||
g_signal_connect (combo_box, "drag-data-received",
|
||||
G_CALLBACK (gimp_drawable_combo_box_drag_data_received),
|
||||
NULL);
|
||||
|
||||
return combo_box;
|
||||
}
|
||||
|
||||
|
@ -214,6 +253,17 @@ gimp_layer_combo_box_new (GimpDrawableConstraintFunc constraint,
|
|||
if (gtk_tree_model_get_iter_first (model, &iter))
|
||||
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_box), &iter);
|
||||
|
||||
gtk_drag_dest_set (combo_box,
|
||||
GTK_DEST_DEFAULT_HIGHLIGHT |
|
||||
GTK_DEST_DEFAULT_MOTION |
|
||||
GTK_DEST_DEFAULT_DROP,
|
||||
targets + 1, 1,
|
||||
GDK_ACTION_COPY);
|
||||
|
||||
g_signal_connect (combo_box, "drag-data-received",
|
||||
G_CALLBACK (gimp_drawable_combo_box_drag_data_received),
|
||||
NULL);
|
||||
|
||||
return combo_box;
|
||||
}
|
||||
|
||||
|
@ -266,3 +316,28 @@ gimp_drawable_combo_box_model_add (GtkListStore *store,
|
|||
|
||||
return added;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_combo_box_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
GtkSelectionData *selection,
|
||||
guint info,
|
||||
guint time)
|
||||
{
|
||||
gchar *id;
|
||||
gint ID;
|
||||
|
||||
if ((selection->format != 8) || (selection->length < 1))
|
||||
{
|
||||
g_warning ("Received invalid drawable ID data!");
|
||||
return;
|
||||
}
|
||||
|
||||
id = g_strndup (selection->data, selection->length);
|
||||
ID = atoi (id);
|
||||
g_free (id);
|
||||
|
||||
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (widget), ID);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
@ -42,6 +44,17 @@ static void gimp_image_combo_box_model_add (GtkListStore *store,
|
|||
GimpImageConstraintFunc constraint,
|
||||
gpointer data);
|
||||
|
||||
static void gimp_image_combo_box_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
GtkSelectionData *selection,
|
||||
guint info,
|
||||
guint time);
|
||||
|
||||
|
||||
static const GtkTargetEntry target = { "application/x-gimp-image-id", 0 };
|
||||
|
||||
|
||||
/**
|
||||
* gimp_image_combo_box_new:
|
||||
|
@ -89,6 +102,17 @@ gimp_image_combo_box_new (GimpImageConstraintFunc constraint,
|
|||
if (gtk_tree_model_get_iter_first (model, &iter))
|
||||
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_box), &iter);
|
||||
|
||||
gtk_drag_dest_set (combo_box,
|
||||
GTK_DEST_DEFAULT_HIGHLIGHT |
|
||||
GTK_DEST_DEFAULT_MOTION |
|
||||
GTK_DEST_DEFAULT_DROP,
|
||||
&target, 1,
|
||||
GDK_ACTION_COPY);
|
||||
|
||||
g_signal_connect (combo_box, "drag-data-received",
|
||||
G_CALLBACK (gimp_image_combo_box_drag_data_received),
|
||||
NULL);
|
||||
|
||||
return combo_box;
|
||||
}
|
||||
|
||||
|
@ -132,3 +156,28 @@ gimp_image_combo_box_model_add (GtkListStore *store,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_image_combo_box_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
GtkSelectionData *selection,
|
||||
guint info,
|
||||
guint time)
|
||||
{
|
||||
gchar *id;
|
||||
gint ID;
|
||||
|
||||
if ((selection->format != 8) || (selection->length < 1))
|
||||
{
|
||||
g_warning ("Received invalid image ID data!");
|
||||
return;
|
||||
}
|
||||
|
||||
id = g_strndup (selection->data, selection->length);
|
||||
ID = atoi (id);
|
||||
g_free (id);
|
||||
|
||||
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (widget), ID);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
@ -43,6 +45,21 @@ static gint gimp_drawable_combo_box_model_add (GtkListStore *stor
|
|||
GimpDrawableConstraintFunc constraint,
|
||||
gpointer data);
|
||||
|
||||
static void gimp_drawable_combo_box_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
GtkSelectionData *selection,
|
||||
guint info,
|
||||
guint time);
|
||||
|
||||
|
||||
static const GtkTargetEntry targets[] =
|
||||
{
|
||||
{ "application/x-gimp-channel-id", 0 },
|
||||
{ "application/x-gimp-layer-id", 0 }
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* gimp_drawable_combo_box_new:
|
||||
|
@ -108,6 +125,17 @@ gimp_drawable_combo_box_new (GimpDrawableConstraintFunc constraint,
|
|||
if (gtk_tree_model_get_iter_first (model, &iter))
|
||||
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_box), &iter);
|
||||
|
||||
gtk_drag_dest_set (combo_box,
|
||||
GTK_DEST_DEFAULT_HIGHLIGHT |
|
||||
GTK_DEST_DEFAULT_MOTION |
|
||||
GTK_DEST_DEFAULT_DROP,
|
||||
targets, 2,
|
||||
GDK_ACTION_COPY);
|
||||
|
||||
g_signal_connect (combo_box, "drag-data-received",
|
||||
G_CALLBACK (gimp_drawable_combo_box_drag_data_received),
|
||||
NULL);
|
||||
|
||||
return combo_box;
|
||||
}
|
||||
|
||||
|
@ -161,6 +189,17 @@ gimp_channel_combo_box_new (GimpDrawableConstraintFunc constraint,
|
|||
if (gtk_tree_model_get_iter_first (model, &iter))
|
||||
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_box), &iter);
|
||||
|
||||
gtk_drag_dest_set (combo_box,
|
||||
GTK_DEST_DEFAULT_HIGHLIGHT |
|
||||
GTK_DEST_DEFAULT_MOTION |
|
||||
GTK_DEST_DEFAULT_DROP,
|
||||
targets, 1,
|
||||
GDK_ACTION_COPY);
|
||||
|
||||
g_signal_connect (combo_box, "drag-data-received",
|
||||
G_CALLBACK (gimp_drawable_combo_box_drag_data_received),
|
||||
NULL);
|
||||
|
||||
return combo_box;
|
||||
}
|
||||
|
||||
|
@ -214,6 +253,17 @@ gimp_layer_combo_box_new (GimpDrawableConstraintFunc constraint,
|
|||
if (gtk_tree_model_get_iter_first (model, &iter))
|
||||
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_box), &iter);
|
||||
|
||||
gtk_drag_dest_set (combo_box,
|
||||
GTK_DEST_DEFAULT_HIGHLIGHT |
|
||||
GTK_DEST_DEFAULT_MOTION |
|
||||
GTK_DEST_DEFAULT_DROP,
|
||||
targets + 1, 1,
|
||||
GDK_ACTION_COPY);
|
||||
|
||||
g_signal_connect (combo_box, "drag-data-received",
|
||||
G_CALLBACK (gimp_drawable_combo_box_drag_data_received),
|
||||
NULL);
|
||||
|
||||
return combo_box;
|
||||
}
|
||||
|
||||
|
@ -266,3 +316,28 @@ gimp_drawable_combo_box_model_add (GtkListStore *store,
|
|||
|
||||
return added;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_combo_box_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
GtkSelectionData *selection,
|
||||
guint info,
|
||||
guint time)
|
||||
{
|
||||
gchar *id;
|
||||
gint ID;
|
||||
|
||||
if ((selection->format != 8) || (selection->length < 1))
|
||||
{
|
||||
g_warning ("Received invalid drawable ID data!");
|
||||
return;
|
||||
}
|
||||
|
||||
id = g_strndup (selection->data, selection->length);
|
||||
ID = atoi (id);
|
||||
g_free (id);
|
||||
|
||||
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (widget), ID);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue