app/gimpbrushpreview.c app/gimpgradientpreview.c app/gimppalettepreview.c

2001-03-04  Michael Natterer  <mitch@gimp.org>

	* app/gimpbrushpreview.c
	* app/gimpgradientpreview.c
	* app/gimppalettepreview.c
	* app/gimppatternpreview.c
	* app/gimptoolinfopreview.c: removed all dnd code ...

	* app/gimppreview.c: ... and put it where is belongs.

	* app/gimpcontext.c: use g_type_is_a() instead of comparing the
	types directly.

	* app/gimpdnd.[ch]: same g_type_is_a() fix here. New function
	gimp_dnd_viewable_source_unset().

	* app/gimpdrawablelistitem.c: gtk_signal_connect_while_alive() to
	GimpDrawable's "visibility_changed" fixes a crash here.

	* app/gimplayerlistitem.c: check more strictly if DND reordering
	of layers is allowed.

	* app/gimplistitem.c: more DND reordering checking.
	Start drawing the drop indicator at x = name_label->allocation.x
	(looks better IMHO).
This commit is contained in:
Michael Natterer 2001-03-04 22:07:19 +00:00 committed by Michael Natterer
parent 9860ad1b3d
commit a1778515e6
30 changed files with 602 additions and 444 deletions

View File

@ -1,3 +1,29 @@
2001-03-04 Michael Natterer <mitch@gimp.org>
* app/gimpbrushpreview.c
* app/gimpgradientpreview.c
* app/gimppalettepreview.c
* app/gimppatternpreview.c
* app/gimptoolinfopreview.c: removed all dnd code ...
* app/gimppreview.c: ... and put it where is belongs.
* app/gimpcontext.c: use g_type_is_a() instead of comparing the
types directly.
* app/gimpdnd.[ch]: same g_type_is_a() fix here. New function
gimp_dnd_viewable_source_unset().
* app/gimpdrawablelistitem.c: gtk_signal_connect_while_alive() to
GimpDrawable's "visibility_changed" fixes a crash here.
* app/gimplayerlistitem.c: check more strictly if DND reordering
of layers is allowed.
* app/gimplistitem.c: more DND reordering checking.
Start drawing the drop indicator at x = name_label->allocation.x
(looks better IMHO).
2001-03-04 Michael Natterer <mitch@gimp.org>
* app/Makefile.am

View File

@ -1044,7 +1044,7 @@ gimp_context_type_to_arg (GtkType type)
for (i = 0; i < GIMP_CONTEXT_NUM_ARGS; i++)
{
if (gimp_context_arg_types[i] == type)
if (gtk_type_is_a (type, gimp_context_arg_types[i]))
return i;
}

View File

@ -41,8 +41,6 @@ static GtkWidget * gimp_brush_preview_create_popup (GimpPreview *preview)
static gboolean gimp_brush_preview_needs_popup (GimpPreview *preview);
static gboolean gimp_brush_preview_render_timeout_func (GimpBrushPreview *preview);
static GimpViewable * gimp_brush_preview_drag_viewable (GtkWidget *widget,
gpointer data);
static GimpPreviewClass *parent_class = NULL;
@ -94,15 +92,6 @@ gimp_brush_preview_class_init (GimpBrushPreviewClass *klass)
static void
gimp_brush_preview_init (GimpBrushPreview *brush_preview)
{
gimp_gtk_drag_source_set_by_type (GTK_WIDGET (brush_preview),
GDK_BUTTON2_MASK,
GIMP_TYPE_BRUSH,
GDK_ACTION_COPY);
gimp_dnd_viewable_source_set (GTK_WIDGET (brush_preview),
GIMP_TYPE_BRUSH,
gimp_brush_preview_drag_viewable,
NULL);
brush_preview->pipe_timeout_id = 0;
brush_preview->pipe_animation_index = 0;
}
@ -372,10 +361,3 @@ gimp_brush_preview_render_timeout_func (GimpBrushPreview *brush_preview)
return TRUE;
}
static GimpViewable *
gimp_brush_preview_drag_viewable (GtkWidget *widget,
gpointer data)
{
return GIMP_PREVIEW (widget)->viewable;
}

View File

@ -1044,7 +1044,7 @@ gimp_context_type_to_arg (GtkType type)
for (i = 0; i < GIMP_CONTEXT_NUM_ARGS; i++)
{
if (gimp_context_arg_types[i] == type)
if (gtk_type_is_a (type, gimp_context_arg_types[i]))
return i;
}

View File

@ -488,6 +488,23 @@ gimp_dnd_data_source_set (GimpDndDataType data_type,
get_data_data);
}
static void
gimp_dnd_data_source_unset (GtkWidget *widget)
{
gboolean drag_connected;
drag_connected =
(gboolean) gtk_object_get_data (GTK_OBJECT (widget),
"gimp_dnd_drag_connected");
if (! drag_connected)
return;
gtk_object_set_data (GTK_OBJECT (widget), "gimp_dnd_get_data_type", NULL);
gtk_object_set_data (GTK_OBJECT (widget), "gimp_dnd_get_data_func", NULL);
gtk_object_set_data (GTK_OBJECT (widget), "gimp_dnd_get_data_data", NULL);
}
static void
gimp_dnd_data_dest_set (GimpDndDataType data_type,
GtkWidget *widget,
@ -738,49 +755,50 @@ gimp_gtk_drag_source_set_by_type (GtkWidget *widget,
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget));
if (type == GIMP_TYPE_LAYER)
if (gtk_type_is_a (type, GIMP_TYPE_LAYER))
{
target_table = layer_target_table;
n_targets = layer_n_targets;
}
else if (type == GIMP_TYPE_CHANNEL)
else if (gtk_type_is_a (type, GIMP_TYPE_CHANNEL))
{
target_table = channel_target_table;
n_targets = channel_n_targets;
}
else if (type == GIMP_TYPE_LAYER_MASK)
else if (gtk_type_is_a (type, GIMP_TYPE_LAYER_MASK))
{
target_table = layer_mask_target_table;
n_targets = layer_mask_n_targets;
}
else if (type == GIMP_TYPE_BRUSH)
else if (gtk_type_is_a (type, GIMP_TYPE_BRUSH))
{
target_table = brush_target_table;
n_targets = brush_n_targets;
}
else if (type == GIMP_TYPE_PATTERN)
else if (gtk_type_is_a (type, GIMP_TYPE_PATTERN))
{
target_table = pattern_target_table;
n_targets = pattern_n_targets;
}
else if (type == GIMP_TYPE_GRADIENT)
else if (gtk_type_is_a (type, GIMP_TYPE_GRADIENT))
{
target_table = gradient_target_table;
n_targets = gradient_n_targets;
}
else if (type == GIMP_TYPE_PALETTE)
else if (gtk_type_is_a (type, GIMP_TYPE_PALETTE))
{
target_table = palette_target_table;
n_targets = palette_n_targets;
}
else if (type == GIMP_TYPE_TOOL_INFO)
else if (gtk_type_is_a (type, GIMP_TYPE_TOOL_INFO))
{
target_table = tool_target_table;
n_targets = tool_n_targets;
}
else
{
g_warning ("%s(): unsupported GtkType", G_GNUC_FUNCTION);
g_warning ("%s(): unsupported GtkType \"%s\"",
G_GNUC_FUNCTION, gtk_type_name (type));
}
if (target_table && n_targets)
@ -805,49 +823,50 @@ gimp_gtk_drag_dest_set_by_type (GtkWidget *widget,
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget));
if (type == GIMP_TYPE_LAYER)
if (gtk_type_is_a (type, GIMP_TYPE_LAYER))
{
target_table = layer_target_table;
n_targets = layer_n_targets;
}
else if (type == GIMP_TYPE_CHANNEL)
else if (gtk_type_is_a (type, GIMP_TYPE_CHANNEL))
{
target_table = channel_target_table;
n_targets = channel_n_targets;
}
else if (type == GIMP_TYPE_LAYER_MASK)
else if (gtk_type_is_a (type, GIMP_TYPE_LAYER_MASK))
{
target_table = layer_mask_target_table;
n_targets = layer_mask_n_targets;
}
else if (type == GIMP_TYPE_BRUSH)
else if (gtk_type_is_a (type, GIMP_TYPE_BRUSH))
{
target_table = brush_target_table;
n_targets = brush_n_targets;
}
else if (type == GIMP_TYPE_PATTERN)
else if (gtk_type_is_a (type, GIMP_TYPE_PATTERN))
{
target_table = pattern_target_table;
n_targets = pattern_n_targets;
}
else if (type == GIMP_TYPE_GRADIENT)
else if (gtk_type_is_a (type, GIMP_TYPE_GRADIENT))
{
target_table = gradient_target_table;
n_targets = gradient_n_targets;
}
else if (type == GIMP_TYPE_PALETTE)
else if (gtk_type_is_a (type, GIMP_TYPE_PALETTE))
{
target_table = palette_target_table;
n_targets = palette_n_targets;
}
else if (type == GIMP_TYPE_TOOL_INFO)
else if (gtk_type_is_a (type, GIMP_TYPE_TOOL_INFO))
{
target_table = tool_target_table;
n_targets = tool_n_targets;
}
else
{
g_warning ("%s(): unsupported GtkType", G_GNUC_FUNCTION);
g_warning ("%s(): unsupported GtkType \"%s\"",
G_GNUC_FUNCTION, gtk_type_name (type));
}
if (target_table && n_targets)
@ -871,41 +890,42 @@ gimp_dnd_viewable_source_set (GtkWidget *widget,
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (get_viewable_func != NULL);
if (type == GIMP_TYPE_LAYER)
if (gtk_type_is_a (type, GIMP_TYPE_LAYER))
{
dnd_type = GIMP_DND_DATA_LAYER;
}
else if (type == GIMP_TYPE_CHANNEL)
else if (gtk_type_is_a (type, GIMP_TYPE_CHANNEL))
{
dnd_type = GIMP_DND_DATA_CHANNEL;
}
else if (type == GIMP_TYPE_LAYER_MASK)
else if (gtk_type_is_a (type, GIMP_TYPE_LAYER_MASK))
{
dnd_type = GIMP_DND_DATA_LAYER_MASK;
}
else if (type == GIMP_TYPE_BRUSH)
else if (gtk_type_is_a (type, GIMP_TYPE_BRUSH))
{
dnd_type = GIMP_DND_DATA_BRUSH;
}
else if (type == GIMP_TYPE_PATTERN)
else if (gtk_type_is_a (type, GIMP_TYPE_PATTERN))
{
dnd_type = GIMP_DND_DATA_PATTERN;
}
else if (type == GIMP_TYPE_GRADIENT)
else if (gtk_type_is_a (type, GIMP_TYPE_GRADIENT))
{
dnd_type = GIMP_DND_DATA_GRADIENT;
}
else if (type == GIMP_TYPE_PALETTE)
else if (gtk_type_is_a (type, GIMP_TYPE_PALETTE))
{
dnd_type = GIMP_DND_DATA_PALETTE;
}
else if (type == GIMP_TYPE_TOOL_INFO)
else if (gtk_type_is_a (type, GIMP_TYPE_TOOL_INFO))
{
dnd_type = GIMP_DND_DATA_TOOL;
}
else
{
g_warning ("%s(): unsupported GtkType", G_GNUC_FUNCTION);
g_warning ("%s(): unsupported GtkType \"%s\"",
G_GNUC_FUNCTION, gtk_type_name (type));
return;
}
@ -914,6 +934,57 @@ gimp_dnd_viewable_source_set (GtkWidget *widget,
data);
}
void
gimp_dnd_viewable_source_unset (GtkWidget *widget,
GtkType type)
{
GimpDndDataType dnd_type;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget));
if (gtk_type_is_a (type, GIMP_TYPE_LAYER))
{
dnd_type = GIMP_DND_DATA_LAYER;
}
else if (gtk_type_is_a (type, GIMP_TYPE_CHANNEL))
{
dnd_type = GIMP_DND_DATA_CHANNEL;
}
else if (gtk_type_is_a (type, GIMP_TYPE_LAYER_MASK))
{
dnd_type = GIMP_DND_DATA_LAYER_MASK;
}
else if (gtk_type_is_a (type, GIMP_TYPE_BRUSH))
{
dnd_type = GIMP_DND_DATA_BRUSH;
}
else if (gtk_type_is_a (type, GIMP_TYPE_PATTERN))
{
dnd_type = GIMP_DND_DATA_PATTERN;
}
else if (gtk_type_is_a (type, GIMP_TYPE_GRADIENT))
{
dnd_type = GIMP_DND_DATA_GRADIENT;
}
else if (gtk_type_is_a (type, GIMP_TYPE_PALETTE))
{
dnd_type = GIMP_DND_DATA_PALETTE;
}
else if (gtk_type_is_a (type, GIMP_TYPE_TOOL_INFO))
{
dnd_type = GIMP_DND_DATA_TOOL;
}
else
{
g_warning ("%s(): unsupported GtkType \"%s\"",
G_GNUC_FUNCTION, gtk_type_name (type));
return;
}
gimp_dnd_data_source_unset (widget);
}
void
gimp_dnd_viewable_dest_set (GtkWidget *widget,
GtkType type,
@ -926,41 +997,42 @@ gimp_dnd_viewable_dest_set (GtkWidget *widget,
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (set_viewable_func != NULL);
if (type == GIMP_TYPE_LAYER)
if (gtk_type_is_a (type, GIMP_TYPE_LAYER))
{
dnd_type = GIMP_DND_DATA_LAYER;
}
else if (type == GIMP_TYPE_CHANNEL)
else if (gtk_type_is_a (type, GIMP_TYPE_CHANNEL))
{
dnd_type = GIMP_DND_DATA_CHANNEL;
}
else if (type == GIMP_TYPE_LAYER_MASK)
else if (gtk_type_is_a (type, GIMP_TYPE_LAYER_MASK))
{
dnd_type = GIMP_DND_DATA_LAYER_MASK;
}
else if (type == GIMP_TYPE_BRUSH)
else if (gtk_type_is_a (type, GIMP_TYPE_BRUSH))
{
dnd_type = GIMP_DND_DATA_BRUSH;
}
else if (type == GIMP_TYPE_PATTERN)
else if (gtk_type_is_a (type, GIMP_TYPE_PATTERN))
{
dnd_type = GIMP_DND_DATA_PATTERN;
}
else if (type == GIMP_TYPE_GRADIENT)
else if (gtk_type_is_a (type, GIMP_TYPE_GRADIENT))
{
dnd_type = GIMP_DND_DATA_GRADIENT;
}
else if (type == GIMP_TYPE_PALETTE)
else if (gtk_type_is_a (type, GIMP_TYPE_PALETTE))
{
dnd_type = GIMP_DND_DATA_PALETTE;
}
else if (type == GIMP_TYPE_TOOL_INFO)
else if (gtk_type_is_a (type, GIMP_TYPE_TOOL_INFO))
{
dnd_type = GIMP_DND_DATA_TOOL;
}
else
{
g_warning ("%s(): unsupported GtkType", G_GNUC_FUNCTION);
g_warning ("%s(): unsupported GtkType \"%s\"",
G_GNUC_FUNCTION, gtk_type_name (type));
return;
}
@ -975,41 +1047,42 @@ gimp_dnd_viewable_dest_unset (GtkWidget *widget,
{
GimpDndDataType dnd_type;
if (type == GIMP_TYPE_LAYER)
if (gtk_type_is_a (type, GIMP_TYPE_LAYER))
{
dnd_type = GIMP_DND_DATA_LAYER;
}
else if (type == GIMP_TYPE_CHANNEL)
else if (gtk_type_is_a (type, GIMP_TYPE_CHANNEL))
{
dnd_type = GIMP_DND_DATA_CHANNEL;
}
else if (type == GIMP_TYPE_LAYER_MASK)
else if (gtk_type_is_a (type, GIMP_TYPE_LAYER_MASK))
{
dnd_type = GIMP_DND_DATA_LAYER_MASK;
}
else if (type == GIMP_TYPE_BRUSH)
else if (gtk_type_is_a (type, GIMP_TYPE_BRUSH))
{
dnd_type = GIMP_DND_DATA_BRUSH;
}
else if (type == GIMP_TYPE_PATTERN)
else if (gtk_type_is_a (type, GIMP_TYPE_PATTERN))
{
dnd_type = GIMP_DND_DATA_PATTERN;
}
else if (type == GIMP_TYPE_GRADIENT)
else if (gtk_type_is_a (type, GIMP_TYPE_GRADIENT))
{
dnd_type = GIMP_DND_DATA_GRADIENT;
}
else if (type == GIMP_TYPE_PALETTE)
else if (gtk_type_is_a (type, GIMP_TYPE_PALETTE))
{
dnd_type = GIMP_DND_DATA_PALETTE;
}
else if (type == GIMP_TYPE_TOOL_INFO)
else if (gtk_type_is_a (type, GIMP_TYPE_TOOL_INFO))
{
dnd_type = GIMP_DND_DATA_TOOL;
}
else
{
g_warning ("%s(): unsupported GtkType", G_GNUC_FUNCTION);
g_warning ("%s(): unsupported GtkType \"%s\"",
G_GNUC_FUNCTION, gtk_type_name (type));
return;
}

View File

@ -132,6 +132,8 @@ void gimp_dnd_viewable_source_set (GtkWidget *widget,
GtkType type,
GimpDndDragViewableFunc get_viewable_func,
gpointer data);
void gimp_dnd_viewable_source_unset (GtkWidget *widget,
GtkType type);
void gimp_dnd_viewable_dest_set (GtkWidget *widget,
GtkType type,
GimpDndDropViewableFunc set_viewable_func,

View File

@ -157,6 +157,8 @@ gimp_drawable_list_item_set_viewable (GimpListItem *list_item,
if (GIMP_LIST_ITEM_CLASS (parent_class)->set_viewable)
GIMP_LIST_ITEM_CLASS (parent_class)->set_viewable (list_item, viewable);
GIMP_PREVIEW (list_item->preview)->clickable = TRUE;
drawable_item = GIMP_DRAWABLE_LIST_ITEM (list_item);
drawable = GIMP_DRAWABLE (GIMP_PREVIEW (list_item->preview)->viewable);
visible = gimp_drawable_get_visible (drawable);
@ -180,9 +182,11 @@ gimp_drawable_list_item_set_viewable (GimpListItem *list_item,
GTK_SIGNAL_FUNC (gimp_drawable_list_item_eye_toggled),
list_item);
gtk_signal_connect (GTK_OBJECT (viewable), "visibility_changed",
GTK_SIGNAL_FUNC (gimp_drawable_list_item_visibility_changed),
list_item);
gtk_signal_connect_while_alive
(GTK_OBJECT (viewable), "visibility_changed",
GTK_SIGNAL_FUNC (gimp_drawable_list_item_visibility_changed),
list_item,
GTK_OBJECT (list_item));
}
static gboolean

View File

@ -25,7 +25,6 @@
#include "apptypes.h"
#include "gimpdnd.h"
#include "gimpgradient.h"
#include "gimpgradientpreview.h"
#include "temp_buf.h"
@ -34,16 +33,13 @@
static void gimp_gradient_preview_class_init (GimpGradientPreviewClass *klass);
static void gimp_gradient_preview_init (GimpGradientPreview *preview);
static void gimp_gradient_preview_render (GimpPreview *preview);
static void gimp_gradient_preview_get_size (GimpPreview *preview,
gint size,
gint *width,
gint *height);
static gboolean gimp_gradient_preview_needs_popup (GimpPreview *preview);
static GtkWidget * gimp_gradient_preview_create_popup (GimpPreview *preview);
static GimpViewable * gimp_gradient_preview_drag_viewable (GtkWidget *widget,
gpointer data);
static void gimp_gradient_preview_render (GimpPreview *preview);
static void gimp_gradient_preview_get_size (GimpPreview *preview,
gint size,
gint *width,
gint *height);
static gboolean gimp_gradient_preview_needs_popup (GimpPreview *preview);
static GtkWidget * gimp_gradient_preview_create_popup (GimpPreview *preview);
static GimpPreviewClass *parent_class = NULL;
@ -94,14 +90,6 @@ gimp_gradient_preview_class_init (GimpGradientPreviewClass *klass)
static void
gimp_gradient_preview_init (GimpGradientPreview *gradient_preview)
{
gimp_gtk_drag_source_set_by_type (GTK_WIDGET (gradient_preview),
GDK_BUTTON2_MASK,
GIMP_TYPE_GRADIENT,
GDK_ACTION_COPY);
gimp_dnd_viewable_source_set (GTK_WIDGET (gradient_preview),
GIMP_TYPE_GRADIENT,
gimp_gradient_preview_drag_viewable,
NULL);
}
static void
@ -174,10 +162,3 @@ gimp_gradient_preview_create_popup (GimpPreview *preview)
0,
TRUE, FALSE, FALSE);
}
static GimpViewable *
gimp_gradient_preview_drag_viewable (GtkWidget *widget,
gpointer data)
{
return GIMP_PREVIEW (widget)->viewable;
}

View File

@ -160,7 +160,9 @@ gimp_layer_list_item_drag_motion (GtkWidget *widget,
&drag_action,
&drop_type);
if (! gimp_drawable_has_alpha (GIMP_DRAWABLE (src_viewable)) ||
if (! src_viewable ||
! gimp_drawable_has_alpha (GIMP_DRAWABLE (src_viewable)) ||
! layer ||
! gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)))
{
drag_action = GDK_ACTION_DEFAULT;
@ -238,6 +240,7 @@ gimp_layer_list_item_mask_changed (GimpLayer *layer,
layer_item->mask_preview = gimp_preview_new (GIMP_VIEWABLE (mask),
list_item->preview_size,
1, FALSE);
GIMP_PREVIEW (layer_item->mask_preview)->clickable = TRUE;
gtk_box_pack_start (GTK_BOX (list_item->hbox), layer_item->mask_preview,
FALSE, FALSE, 0);
gtk_box_reorder_child (GTK_BOX (list_item->hbox),

View File

@ -165,7 +165,9 @@ gimp_list_item_draw (GtkWidget *widget,
if (list_item->drop_type != GIMP_DROP_NONE)
{
gint y;
gint x, y;
x = list_item->name_label->allocation.x;
y = ((list_item->drop_type == GIMP_DROP_ABOVE) ?
3 : widget->allocation.height - 4);
@ -174,7 +176,8 @@ gimp_list_item_draw (GtkWidget *widget,
GDK_CAP_BUTT, GDK_JOIN_MITER);
gdk_draw_line (widget->window, widget->style->black_gc,
2, y, widget->allocation.width - 3, y);
x, y,
widget->allocation.width - 3, y);
gdk_gc_set_line_attributes (widget->style->black_gc, 0, GDK_LINE_SOLID,
GDK_CAP_BUTT, GDK_JOIN_MITER);
@ -328,7 +331,7 @@ gimp_list_item_real_set_viewable (GimpListItem *list_item,
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (list_item),
GTK_DEST_DEFAULT_ALL,
GTK_OBJECT (viewable)->klass->type,
GDK_ACTION_MOVE);
GDK_ACTION_MOVE | GDK_ACTION_COPY);
}
void
@ -377,42 +380,45 @@ gimp_list_item_check_drag (GimpListItem *list_item,
my_src_viewable = gimp_dnd_get_drag_data (src_widget);
my_dest_viewable = GIMP_PREVIEW (list_item->preview)->viewable;
my_src_index =
gimp_container_get_child_index (list_item->container,
GIMP_OBJECT (my_src_viewable));
my_dest_index =
gimp_container_get_child_index (list_item->container,
GIMP_OBJECT (my_dest_viewable));
if (my_src_viewable && my_src_index != -1 &&
my_dest_viewable && my_dest_index != -1)
if (my_src_viewable && my_dest_viewable)
{
gint difference;
my_src_index =
gimp_container_get_child_index (list_item->container,
GIMP_OBJECT (my_src_viewable));
my_dest_index =
gimp_container_get_child_index (list_item->container,
GIMP_OBJECT (my_dest_viewable));
difference = my_dest_index - my_src_index;
if (y < GTK_WIDGET (list_item)->allocation.height / 2)
my_drop_type = GIMP_DROP_ABOVE;
else
my_drop_type = GIMP_DROP_BELOW;
if (difference < 0 && my_drop_type == GIMP_DROP_BELOW)
{
my_dest_index++;
}
else if (difference > 0 && my_drop_type == GIMP_DROP_ABOVE)
{
my_dest_index--;
}
if (my_src_index != my_dest_index)
if (my_src_viewable && my_src_index != -1 &&
my_dest_viewable && my_dest_index != -1)
{
my_drag_action = GDK_ACTION_MOVE;
return_val = TRUE;
}
else
{
my_drop_type = GIMP_DROP_NONE;
gint difference;
difference = my_dest_index - my_src_index;
if (y < GTK_WIDGET (list_item)->allocation.height / 2)
my_drop_type = GIMP_DROP_ABOVE;
else
my_drop_type = GIMP_DROP_BELOW;
if (difference < 0 && my_drop_type == GIMP_DROP_BELOW)
{
my_dest_index++;
}
else if (difference > 0 && my_drop_type == GIMP_DROP_ABOVE)
{
my_dest_index--;
}
if (my_src_index != my_dest_index)
{
my_drag_action = GDK_ACTION_MOVE;
return_val = TRUE;
}
else
{
my_drop_type = GIMP_DROP_NONE;
}
}
}
}

View File

@ -25,7 +25,6 @@
#include "apptypes.h"
#include "gimpdnd.h"
#include "gimppalette.h"
#include "gimppalettepreview.h"
#include "temp_buf.h"
@ -34,16 +33,13 @@
static void gimp_palette_preview_class_init (GimpPalettePreviewClass *klass);
static void gimp_palette_preview_init (GimpPalettePreview *preview);
static void gimp_palette_preview_get_size (GimpPreview *preview,
gint size,
gint *width,
gint *height);
static void gimp_palette_preview_render (GimpPreview *preview);
static GtkWidget * gimp_palette_preview_create_popup (GimpPreview *preview);
static gboolean gimp_palette_preview_needs_popup (GimpPreview *preview);
static GimpViewable * gimp_palette_preview_drag_viewable (GtkWidget *widget,
gpointer data);
static void gimp_palette_preview_get_size (GimpPreview *preview,
gint size,
gint *width,
gint *height);
static void gimp_palette_preview_render (GimpPreview *preview);
static GtkWidget * gimp_palette_preview_create_popup (GimpPreview *preview);
static gboolean gimp_palette_preview_needs_popup (GimpPreview *preview);
static GimpPreviewClass *parent_class = NULL;
@ -94,14 +90,6 @@ gimp_palette_preview_class_init (GimpPalettePreviewClass *klass)
static void
gimp_palette_preview_init (GimpPalettePreview *palette_preview)
{
gimp_gtk_drag_source_set_by_type (GTK_WIDGET (palette_preview),
GDK_BUTTON2_MASK,
GIMP_TYPE_PALETTE,
GDK_ACTION_COPY);
gimp_dnd_viewable_source_set (GTK_WIDGET (palette_preview),
GIMP_TYPE_PALETTE,
gimp_palette_preview_drag_viewable,
palette_preview);
}
static void
@ -182,10 +170,3 @@ gimp_palette_preview_needs_popup (GimpPreview *preview)
return FALSE;
}
static GimpViewable *
gimp_palette_preview_drag_viewable (GtkWidget *widget,
gpointer data)
{
return GIMP_PREVIEW (widget)->viewable;
}

View File

@ -25,7 +25,6 @@
#include "apptypes.h"
#include "gimpdnd.h"
#include "gimppattern.h"
#include "gimppatternpreview.h"
#include "temp_buf.h"
@ -34,12 +33,9 @@
static void gimp_pattern_preview_class_init (GimpPatternPreviewClass *klass);
static void gimp_pattern_preview_init (GimpPatternPreview *preview);
static void gimp_pattern_preview_render (GimpPreview *preview);
static GtkWidget * gimp_pattern_preview_create_popup (GimpPreview *preview);
static gboolean gimp_pattern_preview_needs_popup (GimpPreview *preview);
static GimpViewable * gimp_pattern_preview_drag_viewable (GtkWidget *widget,
gpointer data);
static void gimp_pattern_preview_render (GimpPreview *preview);
static GtkWidget * gimp_pattern_preview_create_popup (GimpPreview *preview);
static gboolean gimp_pattern_preview_needs_popup (GimpPreview *preview);
static GimpPreviewClass *parent_class = NULL;
@ -89,14 +85,6 @@ gimp_pattern_preview_class_init (GimpPatternPreviewClass *klass)
static void
gimp_pattern_preview_init (GimpPatternPreview *pattern_preview)
{
gimp_gtk_drag_source_set_by_type (GTK_WIDGET (pattern_preview),
GDK_BUTTON2_MASK,
GIMP_TYPE_PATTERN,
GDK_ACTION_COPY);
gimp_dnd_viewable_source_set (GTK_WIDGET (pattern_preview),
GIMP_TYPE_PATTERN,
gimp_pattern_preview_drag_viewable,
NULL);
}
static void
@ -177,10 +165,3 @@ gimp_pattern_preview_needs_popup (GimpPreview *preview)
return FALSE;
}
static GimpViewable *
gimp_pattern_preview_drag_viewable (GtkWidget *widget,
gpointer data)
{
return GIMP_PREVIEW (widget)->viewable;
}

View File

@ -33,6 +33,7 @@
#include "gimpbrush.h"
#include "gimpbrushpreview.h"
#include "gimpdnd.h"
#include "gimpdrawable.h"
#include "gimpdrawablepreview.h"
#include "gimpgradient.h"
@ -106,6 +107,8 @@ static void gimp_preview_popup_show (GimpPreview *preview,
static void gimp_preview_popup_hide (GimpPreview *preview);
static void gimp_preview_paint (GimpPreview *preview);
static gboolean gimp_preview_idle_paint (GimpPreview *preview);
static GimpViewable * gimp_preview_drag_viewable (GtkWidget *widget,
gpointer data);
static guint preview_signals[LAST_SIGNAL] = { 0 };
@ -455,6 +458,16 @@ gimp_preview_set_viewable (GimpPreview *preview,
if (preview->viewable)
{
if (! preview->is_popup)
{
GtkType type;
type = GTK_OBJECT (preview->viewable)->klass->type;
gtk_drag_source_unset (GTK_WIDGET (preview));
gimp_dnd_viewable_source_unset (GTK_WIDGET (preview), type);
}
gtk_signal_disconnect_by_func (GTK_OBJECT (preview->viewable),
gimp_preview_paint,
preview);
@ -468,6 +481,22 @@ gimp_preview_set_viewable (GimpPreview *preview,
if (preview->viewable)
{
if (! preview->is_popup)
{
GtkType type;
type = GTK_OBJECT (preview->viewable)->klass->type;
gimp_gtk_drag_source_set_by_type (GTK_WIDGET (preview),
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
type,
GDK_ACTION_COPY);
gimp_dnd_viewable_source_set (GTK_WIDGET (preview),
type,
gimp_preview_drag_viewable,
NULL);
}
gtk_signal_connect_object (GTK_OBJECT (preview->viewable),
"invalidate_preview",
GTK_SIGNAL_FUNC (gimp_preview_paint),
@ -1050,3 +1079,10 @@ gimp_preview_render_and_flush (GimpPreview *preview,
gtk_widget_queue_draw (GTK_WIDGET (preview));
}
static GimpViewable *
gimp_preview_drag_viewable (GtkWidget *widget,
gpointer data)
{
return GIMP_PREVIEW (widget)->viewable;
}

View File

@ -27,7 +27,6 @@
#include "tools/gimptoolinfo.h"
#include "gimpdnd.h"
#include "gimptoolinfopreview.h"
#include "temp_buf.h"
@ -37,17 +36,14 @@
#define TOOL_INFO_HEIGHT 22
static void gimp_tool_info_preview_class_init (GimpToolInfoPreviewClass *klass);
static void gimp_tool_info_preview_init (GimpToolInfoPreview *preview);
static void gimp_tool_info_preview_state_changed (GtkWidget *widget,
GtkStateType previous_state);
static void gimp_tool_info_preview_class_init (GimpToolInfoPreviewClass *klass);
static void gimp_tool_info_preview_init (GimpToolInfoPreview *preview);
static void gimp_tool_info_preview_render (GimpPreview *preview);
static GtkWidget * gimp_tool_info_preview_create_popup (GimpPreview *preview);
static gboolean gimp_tool_info_preview_needs_popup (GimpPreview *preview);
static GimpViewable * gimp_tool_info_preview_drag_viewable (GtkWidget *widget,
gpointer data);
static void gimp_tool_info_preview_state_changed (GtkWidget *widget,
GtkStateType previous_state);
static void gimp_tool_info_preview_render (GimpPreview *preview);
static GtkWidget * gimp_tool_info_preview_create_popup (GimpPreview *preview);
static gboolean gimp_tool_info_preview_needs_popup (GimpPreview *preview);
static GimpPreviewClass *parent_class = NULL;
@ -101,14 +97,6 @@ gimp_tool_info_preview_class_init (GimpToolInfoPreviewClass *klass)
static void
gimp_tool_info_preview_init (GimpToolInfoPreview *tool_info_preview)
{
gimp_gtk_drag_source_set_by_type (GTK_WIDGET (tool_info_preview),
GDK_BUTTON2_MASK,
GIMP_TYPE_TOOL_INFO,
GDK_ACTION_COPY);
gimp_dnd_viewable_source_set (GTK_WIDGET (tool_info_preview),
GIMP_TYPE_TOOL_INFO,
gimp_tool_info_preview_drag_viewable,
NULL);
}
static void
@ -228,10 +216,3 @@ gimp_tool_info_preview_needs_popup (GimpPreview *preview)
return FALSE;
}
static GimpViewable *
gimp_tool_info_preview_drag_viewable (GtkWidget *widget,
gpointer data)
{
return GIMP_PREVIEW (widget)->viewable;
}

View File

@ -41,8 +41,6 @@ static GtkWidget * gimp_brush_preview_create_popup (GimpPreview *preview)
static gboolean gimp_brush_preview_needs_popup (GimpPreview *preview);
static gboolean gimp_brush_preview_render_timeout_func (GimpBrushPreview *preview);
static GimpViewable * gimp_brush_preview_drag_viewable (GtkWidget *widget,
gpointer data);
static GimpPreviewClass *parent_class = NULL;
@ -94,15 +92,6 @@ gimp_brush_preview_class_init (GimpBrushPreviewClass *klass)
static void
gimp_brush_preview_init (GimpBrushPreview *brush_preview)
{
gimp_gtk_drag_source_set_by_type (GTK_WIDGET (brush_preview),
GDK_BUTTON2_MASK,
GIMP_TYPE_BRUSH,
GDK_ACTION_COPY);
gimp_dnd_viewable_source_set (GTK_WIDGET (brush_preview),
GIMP_TYPE_BRUSH,
gimp_brush_preview_drag_viewable,
NULL);
brush_preview->pipe_timeout_id = 0;
brush_preview->pipe_animation_index = 0;
}
@ -372,10 +361,3 @@ gimp_brush_preview_render_timeout_func (GimpBrushPreview *brush_preview)
return TRUE;
}
static GimpViewable *
gimp_brush_preview_drag_viewable (GtkWidget *widget,
gpointer data)
{
return GIMP_PREVIEW (widget)->viewable;
}

View File

@ -488,6 +488,23 @@ gimp_dnd_data_source_set (GimpDndDataType data_type,
get_data_data);
}
static void
gimp_dnd_data_source_unset (GtkWidget *widget)
{
gboolean drag_connected;
drag_connected =
(gboolean) gtk_object_get_data (GTK_OBJECT (widget),
"gimp_dnd_drag_connected");
if (! drag_connected)
return;
gtk_object_set_data (GTK_OBJECT (widget), "gimp_dnd_get_data_type", NULL);
gtk_object_set_data (GTK_OBJECT (widget), "gimp_dnd_get_data_func", NULL);
gtk_object_set_data (GTK_OBJECT (widget), "gimp_dnd_get_data_data", NULL);
}
static void
gimp_dnd_data_dest_set (GimpDndDataType data_type,
GtkWidget *widget,
@ -738,49 +755,50 @@ gimp_gtk_drag_source_set_by_type (GtkWidget *widget,
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget));
if (type == GIMP_TYPE_LAYER)
if (gtk_type_is_a (type, GIMP_TYPE_LAYER))
{
target_table = layer_target_table;
n_targets = layer_n_targets;
}
else if (type == GIMP_TYPE_CHANNEL)
else if (gtk_type_is_a (type, GIMP_TYPE_CHANNEL))
{
target_table = channel_target_table;
n_targets = channel_n_targets;
}
else if (type == GIMP_TYPE_LAYER_MASK)
else if (gtk_type_is_a (type, GIMP_TYPE_LAYER_MASK))
{
target_table = layer_mask_target_table;
n_targets = layer_mask_n_targets;
}
else if (type == GIMP_TYPE_BRUSH)
else if (gtk_type_is_a (type, GIMP_TYPE_BRUSH))
{
target_table = brush_target_table;
n_targets = brush_n_targets;
}
else if (type == GIMP_TYPE_PATTERN)
else if (gtk_type_is_a (type, GIMP_TYPE_PATTERN))
{
target_table = pattern_target_table;
n_targets = pattern_n_targets;
}
else if (type == GIMP_TYPE_GRADIENT)
else if (gtk_type_is_a (type, GIMP_TYPE_GRADIENT))
{
target_table = gradient_target_table;
n_targets = gradient_n_targets;
}
else if (type == GIMP_TYPE_PALETTE)
else if (gtk_type_is_a (type, GIMP_TYPE_PALETTE))
{
target_table = palette_target_table;
n_targets = palette_n_targets;
}
else if (type == GIMP_TYPE_TOOL_INFO)
else if (gtk_type_is_a (type, GIMP_TYPE_TOOL_INFO))
{
target_table = tool_target_table;
n_targets = tool_n_targets;
}
else
{
g_warning ("%s(): unsupported GtkType", G_GNUC_FUNCTION);
g_warning ("%s(): unsupported GtkType \"%s\"",
G_GNUC_FUNCTION, gtk_type_name (type));
}
if (target_table && n_targets)
@ -805,49 +823,50 @@ gimp_gtk_drag_dest_set_by_type (GtkWidget *widget,
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget));
if (type == GIMP_TYPE_LAYER)
if (gtk_type_is_a (type, GIMP_TYPE_LAYER))
{
target_table = layer_target_table;
n_targets = layer_n_targets;
}
else if (type == GIMP_TYPE_CHANNEL)
else if (gtk_type_is_a (type, GIMP_TYPE_CHANNEL))
{
target_table = channel_target_table;
n_targets = channel_n_targets;
}
else if (type == GIMP_TYPE_LAYER_MASK)
else if (gtk_type_is_a (type, GIMP_TYPE_LAYER_MASK))
{
target_table = layer_mask_target_table;
n_targets = layer_mask_n_targets;
}
else if (type == GIMP_TYPE_BRUSH)
else if (gtk_type_is_a (type, GIMP_TYPE_BRUSH))
{
target_table = brush_target_table;
n_targets = brush_n_targets;
}
else if (type == GIMP_TYPE_PATTERN)
else if (gtk_type_is_a (type, GIMP_TYPE_PATTERN))
{
target_table = pattern_target_table;
n_targets = pattern_n_targets;
}
else if (type == GIMP_TYPE_GRADIENT)
else if (gtk_type_is_a (type, GIMP_TYPE_GRADIENT))
{
target_table = gradient_target_table;
n_targets = gradient_n_targets;
}
else if (type == GIMP_TYPE_PALETTE)
else if (gtk_type_is_a (type, GIMP_TYPE_PALETTE))
{
target_table = palette_target_table;
n_targets = palette_n_targets;
}
else if (type == GIMP_TYPE_TOOL_INFO)
else if (gtk_type_is_a (type, GIMP_TYPE_TOOL_INFO))
{
target_table = tool_target_table;
n_targets = tool_n_targets;
}
else
{
g_warning ("%s(): unsupported GtkType", G_GNUC_FUNCTION);
g_warning ("%s(): unsupported GtkType \"%s\"",
G_GNUC_FUNCTION, gtk_type_name (type));
}
if (target_table && n_targets)
@ -871,41 +890,42 @@ gimp_dnd_viewable_source_set (GtkWidget *widget,
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (get_viewable_func != NULL);
if (type == GIMP_TYPE_LAYER)
if (gtk_type_is_a (type, GIMP_TYPE_LAYER))
{
dnd_type = GIMP_DND_DATA_LAYER;
}
else if (type == GIMP_TYPE_CHANNEL)
else if (gtk_type_is_a (type, GIMP_TYPE_CHANNEL))
{
dnd_type = GIMP_DND_DATA_CHANNEL;
}
else if (type == GIMP_TYPE_LAYER_MASK)
else if (gtk_type_is_a (type, GIMP_TYPE_LAYER_MASK))
{
dnd_type = GIMP_DND_DATA_LAYER_MASK;
}
else if (type == GIMP_TYPE_BRUSH)
else if (gtk_type_is_a (type, GIMP_TYPE_BRUSH))
{
dnd_type = GIMP_DND_DATA_BRUSH;
}
else if (type == GIMP_TYPE_PATTERN)
else if (gtk_type_is_a (type, GIMP_TYPE_PATTERN))
{
dnd_type = GIMP_DND_DATA_PATTERN;
}
else if (type == GIMP_TYPE_GRADIENT)
else if (gtk_type_is_a (type, GIMP_TYPE_GRADIENT))
{
dnd_type = GIMP_DND_DATA_GRADIENT;
}
else if (type == GIMP_TYPE_PALETTE)
else if (gtk_type_is_a (type, GIMP_TYPE_PALETTE))
{
dnd_type = GIMP_DND_DATA_PALETTE;
}
else if (type == GIMP_TYPE_TOOL_INFO)
else if (gtk_type_is_a (type, GIMP_TYPE_TOOL_INFO))
{
dnd_type = GIMP_DND_DATA_TOOL;
}
else
{
g_warning ("%s(): unsupported GtkType", G_GNUC_FUNCTION);
g_warning ("%s(): unsupported GtkType \"%s\"",
G_GNUC_FUNCTION, gtk_type_name (type));
return;
}
@ -914,6 +934,57 @@ gimp_dnd_viewable_source_set (GtkWidget *widget,
data);
}
void
gimp_dnd_viewable_source_unset (GtkWidget *widget,
GtkType type)
{
GimpDndDataType dnd_type;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget));
if (gtk_type_is_a (type, GIMP_TYPE_LAYER))
{
dnd_type = GIMP_DND_DATA_LAYER;
}
else if (gtk_type_is_a (type, GIMP_TYPE_CHANNEL))
{
dnd_type = GIMP_DND_DATA_CHANNEL;
}
else if (gtk_type_is_a (type, GIMP_TYPE_LAYER_MASK))
{
dnd_type = GIMP_DND_DATA_LAYER_MASK;
}
else if (gtk_type_is_a (type, GIMP_TYPE_BRUSH))
{
dnd_type = GIMP_DND_DATA_BRUSH;
}
else if (gtk_type_is_a (type, GIMP_TYPE_PATTERN))
{
dnd_type = GIMP_DND_DATA_PATTERN;
}
else if (gtk_type_is_a (type, GIMP_TYPE_GRADIENT))
{
dnd_type = GIMP_DND_DATA_GRADIENT;
}
else if (gtk_type_is_a (type, GIMP_TYPE_PALETTE))
{
dnd_type = GIMP_DND_DATA_PALETTE;
}
else if (gtk_type_is_a (type, GIMP_TYPE_TOOL_INFO))
{
dnd_type = GIMP_DND_DATA_TOOL;
}
else
{
g_warning ("%s(): unsupported GtkType \"%s\"",
G_GNUC_FUNCTION, gtk_type_name (type));
return;
}
gimp_dnd_data_source_unset (widget);
}
void
gimp_dnd_viewable_dest_set (GtkWidget *widget,
GtkType type,
@ -926,41 +997,42 @@ gimp_dnd_viewable_dest_set (GtkWidget *widget,
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (set_viewable_func != NULL);
if (type == GIMP_TYPE_LAYER)
if (gtk_type_is_a (type, GIMP_TYPE_LAYER))
{
dnd_type = GIMP_DND_DATA_LAYER;
}
else if (type == GIMP_TYPE_CHANNEL)
else if (gtk_type_is_a (type, GIMP_TYPE_CHANNEL))
{
dnd_type = GIMP_DND_DATA_CHANNEL;
}
else if (type == GIMP_TYPE_LAYER_MASK)
else if (gtk_type_is_a (type, GIMP_TYPE_LAYER_MASK))
{
dnd_type = GIMP_DND_DATA_LAYER_MASK;
}
else if (type == GIMP_TYPE_BRUSH)
else if (gtk_type_is_a (type, GIMP_TYPE_BRUSH))
{
dnd_type = GIMP_DND_DATA_BRUSH;
}
else if (type == GIMP_TYPE_PATTERN)
else if (gtk_type_is_a (type, GIMP_TYPE_PATTERN))
{
dnd_type = GIMP_DND_DATA_PATTERN;
}
else if (type == GIMP_TYPE_GRADIENT)
else if (gtk_type_is_a (type, GIMP_TYPE_GRADIENT))
{
dnd_type = GIMP_DND_DATA_GRADIENT;
}
else if (type == GIMP_TYPE_PALETTE)
else if (gtk_type_is_a (type, GIMP_TYPE_PALETTE))
{
dnd_type = GIMP_DND_DATA_PALETTE;
}
else if (type == GIMP_TYPE_TOOL_INFO)
else if (gtk_type_is_a (type, GIMP_TYPE_TOOL_INFO))
{
dnd_type = GIMP_DND_DATA_TOOL;
}
else
{
g_warning ("%s(): unsupported GtkType", G_GNUC_FUNCTION);
g_warning ("%s(): unsupported GtkType \"%s\"",
G_GNUC_FUNCTION, gtk_type_name (type));
return;
}
@ -975,41 +1047,42 @@ gimp_dnd_viewable_dest_unset (GtkWidget *widget,
{
GimpDndDataType dnd_type;
if (type == GIMP_TYPE_LAYER)
if (gtk_type_is_a (type, GIMP_TYPE_LAYER))
{
dnd_type = GIMP_DND_DATA_LAYER;
}
else if (type == GIMP_TYPE_CHANNEL)
else if (gtk_type_is_a (type, GIMP_TYPE_CHANNEL))
{
dnd_type = GIMP_DND_DATA_CHANNEL;
}
else if (type == GIMP_TYPE_LAYER_MASK)
else if (gtk_type_is_a (type, GIMP_TYPE_LAYER_MASK))
{
dnd_type = GIMP_DND_DATA_LAYER_MASK;
}
else if (type == GIMP_TYPE_BRUSH)
else if (gtk_type_is_a (type, GIMP_TYPE_BRUSH))
{
dnd_type = GIMP_DND_DATA_BRUSH;
}
else if (type == GIMP_TYPE_PATTERN)
else if (gtk_type_is_a (type, GIMP_TYPE_PATTERN))
{
dnd_type = GIMP_DND_DATA_PATTERN;
}
else if (type == GIMP_TYPE_GRADIENT)
else if (gtk_type_is_a (type, GIMP_TYPE_GRADIENT))
{
dnd_type = GIMP_DND_DATA_GRADIENT;
}
else if (type == GIMP_TYPE_PALETTE)
else if (gtk_type_is_a (type, GIMP_TYPE_PALETTE))
{
dnd_type = GIMP_DND_DATA_PALETTE;
}
else if (type == GIMP_TYPE_TOOL_INFO)
else if (gtk_type_is_a (type, GIMP_TYPE_TOOL_INFO))
{
dnd_type = GIMP_DND_DATA_TOOL;
}
else
{
g_warning ("%s(): unsupported GtkType", G_GNUC_FUNCTION);
g_warning ("%s(): unsupported GtkType \"%s\"",
G_GNUC_FUNCTION, gtk_type_name (type));
return;
}

View File

@ -132,6 +132,8 @@ void gimp_dnd_viewable_source_set (GtkWidget *widget,
GtkType type,
GimpDndDragViewableFunc get_viewable_func,
gpointer data);
void gimp_dnd_viewable_source_unset (GtkWidget *widget,
GtkType type);
void gimp_dnd_viewable_dest_set (GtkWidget *widget,
GtkType type,
GimpDndDropViewableFunc set_viewable_func,

View File

@ -157,6 +157,8 @@ gimp_drawable_list_item_set_viewable (GimpListItem *list_item,
if (GIMP_LIST_ITEM_CLASS (parent_class)->set_viewable)
GIMP_LIST_ITEM_CLASS (parent_class)->set_viewable (list_item, viewable);
GIMP_PREVIEW (list_item->preview)->clickable = TRUE;
drawable_item = GIMP_DRAWABLE_LIST_ITEM (list_item);
drawable = GIMP_DRAWABLE (GIMP_PREVIEW (list_item->preview)->viewable);
visible = gimp_drawable_get_visible (drawable);
@ -180,9 +182,11 @@ gimp_drawable_list_item_set_viewable (GimpListItem *list_item,
GTK_SIGNAL_FUNC (gimp_drawable_list_item_eye_toggled),
list_item);
gtk_signal_connect (GTK_OBJECT (viewable), "visibility_changed",
GTK_SIGNAL_FUNC (gimp_drawable_list_item_visibility_changed),
list_item);
gtk_signal_connect_while_alive
(GTK_OBJECT (viewable), "visibility_changed",
GTK_SIGNAL_FUNC (gimp_drawable_list_item_visibility_changed),
list_item,
GTK_OBJECT (list_item));
}
static gboolean

View File

@ -25,7 +25,6 @@
#include "apptypes.h"
#include "gimpdnd.h"
#include "gimpgradient.h"
#include "gimpgradientpreview.h"
#include "temp_buf.h"
@ -34,16 +33,13 @@
static void gimp_gradient_preview_class_init (GimpGradientPreviewClass *klass);
static void gimp_gradient_preview_init (GimpGradientPreview *preview);
static void gimp_gradient_preview_render (GimpPreview *preview);
static void gimp_gradient_preview_get_size (GimpPreview *preview,
gint size,
gint *width,
gint *height);
static gboolean gimp_gradient_preview_needs_popup (GimpPreview *preview);
static GtkWidget * gimp_gradient_preview_create_popup (GimpPreview *preview);
static GimpViewable * gimp_gradient_preview_drag_viewable (GtkWidget *widget,
gpointer data);
static void gimp_gradient_preview_render (GimpPreview *preview);
static void gimp_gradient_preview_get_size (GimpPreview *preview,
gint size,
gint *width,
gint *height);
static gboolean gimp_gradient_preview_needs_popup (GimpPreview *preview);
static GtkWidget * gimp_gradient_preview_create_popup (GimpPreview *preview);
static GimpPreviewClass *parent_class = NULL;
@ -94,14 +90,6 @@ gimp_gradient_preview_class_init (GimpGradientPreviewClass *klass)
static void
gimp_gradient_preview_init (GimpGradientPreview *gradient_preview)
{
gimp_gtk_drag_source_set_by_type (GTK_WIDGET (gradient_preview),
GDK_BUTTON2_MASK,
GIMP_TYPE_GRADIENT,
GDK_ACTION_COPY);
gimp_dnd_viewable_source_set (GTK_WIDGET (gradient_preview),
GIMP_TYPE_GRADIENT,
gimp_gradient_preview_drag_viewable,
NULL);
}
static void
@ -174,10 +162,3 @@ gimp_gradient_preview_create_popup (GimpPreview *preview)
0,
TRUE, FALSE, FALSE);
}
static GimpViewable *
gimp_gradient_preview_drag_viewable (GtkWidget *widget,
gpointer data)
{
return GIMP_PREVIEW (widget)->viewable;
}

View File

@ -160,7 +160,9 @@ gimp_layer_list_item_drag_motion (GtkWidget *widget,
&drag_action,
&drop_type);
if (! gimp_drawable_has_alpha (GIMP_DRAWABLE (src_viewable)) ||
if (! src_viewable ||
! gimp_drawable_has_alpha (GIMP_DRAWABLE (src_viewable)) ||
! layer ||
! gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)))
{
drag_action = GDK_ACTION_DEFAULT;
@ -238,6 +240,7 @@ gimp_layer_list_item_mask_changed (GimpLayer *layer,
layer_item->mask_preview = gimp_preview_new (GIMP_VIEWABLE (mask),
list_item->preview_size,
1, FALSE);
GIMP_PREVIEW (layer_item->mask_preview)->clickable = TRUE;
gtk_box_pack_start (GTK_BOX (list_item->hbox), layer_item->mask_preview,
FALSE, FALSE, 0);
gtk_box_reorder_child (GTK_BOX (list_item->hbox),

View File

@ -165,7 +165,9 @@ gimp_list_item_draw (GtkWidget *widget,
if (list_item->drop_type != GIMP_DROP_NONE)
{
gint y;
gint x, y;
x = list_item->name_label->allocation.x;
y = ((list_item->drop_type == GIMP_DROP_ABOVE) ?
3 : widget->allocation.height - 4);
@ -174,7 +176,8 @@ gimp_list_item_draw (GtkWidget *widget,
GDK_CAP_BUTT, GDK_JOIN_MITER);
gdk_draw_line (widget->window, widget->style->black_gc,
2, y, widget->allocation.width - 3, y);
x, y,
widget->allocation.width - 3, y);
gdk_gc_set_line_attributes (widget->style->black_gc, 0, GDK_LINE_SOLID,
GDK_CAP_BUTT, GDK_JOIN_MITER);
@ -328,7 +331,7 @@ gimp_list_item_real_set_viewable (GimpListItem *list_item,
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (list_item),
GTK_DEST_DEFAULT_ALL,
GTK_OBJECT (viewable)->klass->type,
GDK_ACTION_MOVE);
GDK_ACTION_MOVE | GDK_ACTION_COPY);
}
void
@ -377,42 +380,45 @@ gimp_list_item_check_drag (GimpListItem *list_item,
my_src_viewable = gimp_dnd_get_drag_data (src_widget);
my_dest_viewable = GIMP_PREVIEW (list_item->preview)->viewable;
my_src_index =
gimp_container_get_child_index (list_item->container,
GIMP_OBJECT (my_src_viewable));
my_dest_index =
gimp_container_get_child_index (list_item->container,
GIMP_OBJECT (my_dest_viewable));
if (my_src_viewable && my_src_index != -1 &&
my_dest_viewable && my_dest_index != -1)
if (my_src_viewable && my_dest_viewable)
{
gint difference;
my_src_index =
gimp_container_get_child_index (list_item->container,
GIMP_OBJECT (my_src_viewable));
my_dest_index =
gimp_container_get_child_index (list_item->container,
GIMP_OBJECT (my_dest_viewable));
difference = my_dest_index - my_src_index;
if (y < GTK_WIDGET (list_item)->allocation.height / 2)
my_drop_type = GIMP_DROP_ABOVE;
else
my_drop_type = GIMP_DROP_BELOW;
if (difference < 0 && my_drop_type == GIMP_DROP_BELOW)
{
my_dest_index++;
}
else if (difference > 0 && my_drop_type == GIMP_DROP_ABOVE)
{
my_dest_index--;
}
if (my_src_index != my_dest_index)
if (my_src_viewable && my_src_index != -1 &&
my_dest_viewable && my_dest_index != -1)
{
my_drag_action = GDK_ACTION_MOVE;
return_val = TRUE;
}
else
{
my_drop_type = GIMP_DROP_NONE;
gint difference;
difference = my_dest_index - my_src_index;
if (y < GTK_WIDGET (list_item)->allocation.height / 2)
my_drop_type = GIMP_DROP_ABOVE;
else
my_drop_type = GIMP_DROP_BELOW;
if (difference < 0 && my_drop_type == GIMP_DROP_BELOW)
{
my_dest_index++;
}
else if (difference > 0 && my_drop_type == GIMP_DROP_ABOVE)
{
my_dest_index--;
}
if (my_src_index != my_dest_index)
{
my_drag_action = GDK_ACTION_MOVE;
return_val = TRUE;
}
else
{
my_drop_type = GIMP_DROP_NONE;
}
}
}
}

View File

@ -25,7 +25,6 @@
#include "apptypes.h"
#include "gimpdnd.h"
#include "gimppalette.h"
#include "gimppalettepreview.h"
#include "temp_buf.h"
@ -34,16 +33,13 @@
static void gimp_palette_preview_class_init (GimpPalettePreviewClass *klass);
static void gimp_palette_preview_init (GimpPalettePreview *preview);
static void gimp_palette_preview_get_size (GimpPreview *preview,
gint size,
gint *width,
gint *height);
static void gimp_palette_preview_render (GimpPreview *preview);
static GtkWidget * gimp_palette_preview_create_popup (GimpPreview *preview);
static gboolean gimp_palette_preview_needs_popup (GimpPreview *preview);
static GimpViewable * gimp_palette_preview_drag_viewable (GtkWidget *widget,
gpointer data);
static void gimp_palette_preview_get_size (GimpPreview *preview,
gint size,
gint *width,
gint *height);
static void gimp_palette_preview_render (GimpPreview *preview);
static GtkWidget * gimp_palette_preview_create_popup (GimpPreview *preview);
static gboolean gimp_palette_preview_needs_popup (GimpPreview *preview);
static GimpPreviewClass *parent_class = NULL;
@ -94,14 +90,6 @@ gimp_palette_preview_class_init (GimpPalettePreviewClass *klass)
static void
gimp_palette_preview_init (GimpPalettePreview *palette_preview)
{
gimp_gtk_drag_source_set_by_type (GTK_WIDGET (palette_preview),
GDK_BUTTON2_MASK,
GIMP_TYPE_PALETTE,
GDK_ACTION_COPY);
gimp_dnd_viewable_source_set (GTK_WIDGET (palette_preview),
GIMP_TYPE_PALETTE,
gimp_palette_preview_drag_viewable,
palette_preview);
}
static void
@ -182,10 +170,3 @@ gimp_palette_preview_needs_popup (GimpPreview *preview)
return FALSE;
}
static GimpViewable *
gimp_palette_preview_drag_viewable (GtkWidget *widget,
gpointer data)
{
return GIMP_PREVIEW (widget)->viewable;
}

View File

@ -25,7 +25,6 @@
#include "apptypes.h"
#include "gimpdnd.h"
#include "gimppattern.h"
#include "gimppatternpreview.h"
#include "temp_buf.h"
@ -34,12 +33,9 @@
static void gimp_pattern_preview_class_init (GimpPatternPreviewClass *klass);
static void gimp_pattern_preview_init (GimpPatternPreview *preview);
static void gimp_pattern_preview_render (GimpPreview *preview);
static GtkWidget * gimp_pattern_preview_create_popup (GimpPreview *preview);
static gboolean gimp_pattern_preview_needs_popup (GimpPreview *preview);
static GimpViewable * gimp_pattern_preview_drag_viewable (GtkWidget *widget,
gpointer data);
static void gimp_pattern_preview_render (GimpPreview *preview);
static GtkWidget * gimp_pattern_preview_create_popup (GimpPreview *preview);
static gboolean gimp_pattern_preview_needs_popup (GimpPreview *preview);
static GimpPreviewClass *parent_class = NULL;
@ -89,14 +85,6 @@ gimp_pattern_preview_class_init (GimpPatternPreviewClass *klass)
static void
gimp_pattern_preview_init (GimpPatternPreview *pattern_preview)
{
gimp_gtk_drag_source_set_by_type (GTK_WIDGET (pattern_preview),
GDK_BUTTON2_MASK,
GIMP_TYPE_PATTERN,
GDK_ACTION_COPY);
gimp_dnd_viewable_source_set (GTK_WIDGET (pattern_preview),
GIMP_TYPE_PATTERN,
gimp_pattern_preview_drag_viewable,
NULL);
}
static void
@ -177,10 +165,3 @@ gimp_pattern_preview_needs_popup (GimpPreview *preview)
return FALSE;
}
static GimpViewable *
gimp_pattern_preview_drag_viewable (GtkWidget *widget,
gpointer data)
{
return GIMP_PREVIEW (widget)->viewable;
}

View File

@ -33,6 +33,7 @@
#include "gimpbrush.h"
#include "gimpbrushpreview.h"
#include "gimpdnd.h"
#include "gimpdrawable.h"
#include "gimpdrawablepreview.h"
#include "gimpgradient.h"
@ -106,6 +107,8 @@ static void gimp_preview_popup_show (GimpPreview *preview,
static void gimp_preview_popup_hide (GimpPreview *preview);
static void gimp_preview_paint (GimpPreview *preview);
static gboolean gimp_preview_idle_paint (GimpPreview *preview);
static GimpViewable * gimp_preview_drag_viewable (GtkWidget *widget,
gpointer data);
static guint preview_signals[LAST_SIGNAL] = { 0 };
@ -455,6 +458,16 @@ gimp_preview_set_viewable (GimpPreview *preview,
if (preview->viewable)
{
if (! preview->is_popup)
{
GtkType type;
type = GTK_OBJECT (preview->viewable)->klass->type;
gtk_drag_source_unset (GTK_WIDGET (preview));
gimp_dnd_viewable_source_unset (GTK_WIDGET (preview), type);
}
gtk_signal_disconnect_by_func (GTK_OBJECT (preview->viewable),
gimp_preview_paint,
preview);
@ -468,6 +481,22 @@ gimp_preview_set_viewable (GimpPreview *preview,
if (preview->viewable)
{
if (! preview->is_popup)
{
GtkType type;
type = GTK_OBJECT (preview->viewable)->klass->type;
gimp_gtk_drag_source_set_by_type (GTK_WIDGET (preview),
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
type,
GDK_ACTION_COPY);
gimp_dnd_viewable_source_set (GTK_WIDGET (preview),
type,
gimp_preview_drag_viewable,
NULL);
}
gtk_signal_connect_object (GTK_OBJECT (preview->viewable),
"invalidate_preview",
GTK_SIGNAL_FUNC (gimp_preview_paint),
@ -1050,3 +1079,10 @@ gimp_preview_render_and_flush (GimpPreview *preview,
gtk_widget_queue_draw (GTK_WIDGET (preview));
}
static GimpViewable *
gimp_preview_drag_viewable (GtkWidget *widget,
gpointer data)
{
return GIMP_PREVIEW (widget)->viewable;
}

View File

@ -33,6 +33,7 @@
#include "gimpbrush.h"
#include "gimpbrushpreview.h"
#include "gimpdnd.h"
#include "gimpdrawable.h"
#include "gimpdrawablepreview.h"
#include "gimpgradient.h"
@ -106,6 +107,8 @@ static void gimp_preview_popup_show (GimpPreview *preview,
static void gimp_preview_popup_hide (GimpPreview *preview);
static void gimp_preview_paint (GimpPreview *preview);
static gboolean gimp_preview_idle_paint (GimpPreview *preview);
static GimpViewable * gimp_preview_drag_viewable (GtkWidget *widget,
gpointer data);
static guint preview_signals[LAST_SIGNAL] = { 0 };
@ -455,6 +458,16 @@ gimp_preview_set_viewable (GimpPreview *preview,
if (preview->viewable)
{
if (! preview->is_popup)
{
GtkType type;
type = GTK_OBJECT (preview->viewable)->klass->type;
gtk_drag_source_unset (GTK_WIDGET (preview));
gimp_dnd_viewable_source_unset (GTK_WIDGET (preview), type);
}
gtk_signal_disconnect_by_func (GTK_OBJECT (preview->viewable),
gimp_preview_paint,
preview);
@ -468,6 +481,22 @@ gimp_preview_set_viewable (GimpPreview *preview,
if (preview->viewable)
{
if (! preview->is_popup)
{
GtkType type;
type = GTK_OBJECT (preview->viewable)->klass->type;
gimp_gtk_drag_source_set_by_type (GTK_WIDGET (preview),
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
type,
GDK_ACTION_COPY);
gimp_dnd_viewable_source_set (GTK_WIDGET (preview),
type,
gimp_preview_drag_viewable,
NULL);
}
gtk_signal_connect_object (GTK_OBJECT (preview->viewable),
"invalidate_preview",
GTK_SIGNAL_FUNC (gimp_preview_paint),
@ -1050,3 +1079,10 @@ gimp_preview_render_and_flush (GimpPreview *preview,
gtk_widget_queue_draw (GTK_WIDGET (preview));
}
static GimpViewable *
gimp_preview_drag_viewable (GtkWidget *widget,
gpointer data)
{
return GIMP_PREVIEW (widget)->viewable;
}

View File

@ -41,8 +41,6 @@ static GtkWidget * gimp_brush_preview_create_popup (GimpPreview *preview)
static gboolean gimp_brush_preview_needs_popup (GimpPreview *preview);
static gboolean gimp_brush_preview_render_timeout_func (GimpBrushPreview *preview);
static GimpViewable * gimp_brush_preview_drag_viewable (GtkWidget *widget,
gpointer data);
static GimpPreviewClass *parent_class = NULL;
@ -94,15 +92,6 @@ gimp_brush_preview_class_init (GimpBrushPreviewClass *klass)
static void
gimp_brush_preview_init (GimpBrushPreview *brush_preview)
{
gimp_gtk_drag_source_set_by_type (GTK_WIDGET (brush_preview),
GDK_BUTTON2_MASK,
GIMP_TYPE_BRUSH,
GDK_ACTION_COPY);
gimp_dnd_viewable_source_set (GTK_WIDGET (brush_preview),
GIMP_TYPE_BRUSH,
gimp_brush_preview_drag_viewable,
NULL);
brush_preview->pipe_timeout_id = 0;
brush_preview->pipe_animation_index = 0;
}
@ -372,10 +361,3 @@ gimp_brush_preview_render_timeout_func (GimpBrushPreview *brush_preview)
return TRUE;
}
static GimpViewable *
gimp_brush_preview_drag_viewable (GtkWidget *widget,
gpointer data)
{
return GIMP_PREVIEW (widget)->viewable;
}

View File

@ -27,7 +27,6 @@
#include "tools/gimptoolinfo.h"
#include "gimpdnd.h"
#include "gimptoolinfopreview.h"
#include "temp_buf.h"
@ -37,17 +36,14 @@
#define TOOL_INFO_HEIGHT 22
static void gimp_tool_info_preview_class_init (GimpToolInfoPreviewClass *klass);
static void gimp_tool_info_preview_init (GimpToolInfoPreview *preview);
static void gimp_tool_info_preview_state_changed (GtkWidget *widget,
GtkStateType previous_state);
static void gimp_tool_info_preview_class_init (GimpToolInfoPreviewClass *klass);
static void gimp_tool_info_preview_init (GimpToolInfoPreview *preview);
static void gimp_tool_info_preview_render (GimpPreview *preview);
static GtkWidget * gimp_tool_info_preview_create_popup (GimpPreview *preview);
static gboolean gimp_tool_info_preview_needs_popup (GimpPreview *preview);
static GimpViewable * gimp_tool_info_preview_drag_viewable (GtkWidget *widget,
gpointer data);
static void gimp_tool_info_preview_state_changed (GtkWidget *widget,
GtkStateType previous_state);
static void gimp_tool_info_preview_render (GimpPreview *preview);
static GtkWidget * gimp_tool_info_preview_create_popup (GimpPreview *preview);
static gboolean gimp_tool_info_preview_needs_popup (GimpPreview *preview);
static GimpPreviewClass *parent_class = NULL;
@ -101,14 +97,6 @@ gimp_tool_info_preview_class_init (GimpToolInfoPreviewClass *klass)
static void
gimp_tool_info_preview_init (GimpToolInfoPreview *tool_info_preview)
{
gimp_gtk_drag_source_set_by_type (GTK_WIDGET (tool_info_preview),
GDK_BUTTON2_MASK,
GIMP_TYPE_TOOL_INFO,
GDK_ACTION_COPY);
gimp_dnd_viewable_source_set (GTK_WIDGET (tool_info_preview),
GIMP_TYPE_TOOL_INFO,
gimp_tool_info_preview_drag_viewable,
NULL);
}
static void
@ -228,10 +216,3 @@ gimp_tool_info_preview_needs_popup (GimpPreview *preview)
return FALSE;
}
static GimpViewable *
gimp_tool_info_preview_drag_viewable (GtkWidget *widget,
gpointer data)
{
return GIMP_PREVIEW (widget)->viewable;
}

View File

@ -33,6 +33,7 @@
#include "gimpbrush.h"
#include "gimpbrushpreview.h"
#include "gimpdnd.h"
#include "gimpdrawable.h"
#include "gimpdrawablepreview.h"
#include "gimpgradient.h"
@ -106,6 +107,8 @@ static void gimp_preview_popup_show (GimpPreview *preview,
static void gimp_preview_popup_hide (GimpPreview *preview);
static void gimp_preview_paint (GimpPreview *preview);
static gboolean gimp_preview_idle_paint (GimpPreview *preview);
static GimpViewable * gimp_preview_drag_viewable (GtkWidget *widget,
gpointer data);
static guint preview_signals[LAST_SIGNAL] = { 0 };
@ -455,6 +458,16 @@ gimp_preview_set_viewable (GimpPreview *preview,
if (preview->viewable)
{
if (! preview->is_popup)
{
GtkType type;
type = GTK_OBJECT (preview->viewable)->klass->type;
gtk_drag_source_unset (GTK_WIDGET (preview));
gimp_dnd_viewable_source_unset (GTK_WIDGET (preview), type);
}
gtk_signal_disconnect_by_func (GTK_OBJECT (preview->viewable),
gimp_preview_paint,
preview);
@ -468,6 +481,22 @@ gimp_preview_set_viewable (GimpPreview *preview,
if (preview->viewable)
{
if (! preview->is_popup)
{
GtkType type;
type = GTK_OBJECT (preview->viewable)->klass->type;
gimp_gtk_drag_source_set_by_type (GTK_WIDGET (preview),
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
type,
GDK_ACTION_COPY);
gimp_dnd_viewable_source_set (GTK_WIDGET (preview),
type,
gimp_preview_drag_viewable,
NULL);
}
gtk_signal_connect_object (GTK_OBJECT (preview->viewable),
"invalidate_preview",
GTK_SIGNAL_FUNC (gimp_preview_paint),
@ -1050,3 +1079,10 @@ gimp_preview_render_and_flush (GimpPreview *preview,
gtk_widget_queue_draw (GTK_WIDGET (preview));
}
static GimpViewable *
gimp_preview_drag_viewable (GtkWidget *widget,
gpointer data)
{
return GIMP_PREVIEW (widget)->viewable;
}

View File

@ -33,6 +33,7 @@
#include "gimpbrush.h"
#include "gimpbrushpreview.h"
#include "gimpdnd.h"
#include "gimpdrawable.h"
#include "gimpdrawablepreview.h"
#include "gimpgradient.h"
@ -106,6 +107,8 @@ static void gimp_preview_popup_show (GimpPreview *preview,
static void gimp_preview_popup_hide (GimpPreview *preview);
static void gimp_preview_paint (GimpPreview *preview);
static gboolean gimp_preview_idle_paint (GimpPreview *preview);
static GimpViewable * gimp_preview_drag_viewable (GtkWidget *widget,
gpointer data);
static guint preview_signals[LAST_SIGNAL] = { 0 };
@ -455,6 +458,16 @@ gimp_preview_set_viewable (GimpPreview *preview,
if (preview->viewable)
{
if (! preview->is_popup)
{
GtkType type;
type = GTK_OBJECT (preview->viewable)->klass->type;
gtk_drag_source_unset (GTK_WIDGET (preview));
gimp_dnd_viewable_source_unset (GTK_WIDGET (preview), type);
}
gtk_signal_disconnect_by_func (GTK_OBJECT (preview->viewable),
gimp_preview_paint,
preview);
@ -468,6 +481,22 @@ gimp_preview_set_viewable (GimpPreview *preview,
if (preview->viewable)
{
if (! preview->is_popup)
{
GtkType type;
type = GTK_OBJECT (preview->viewable)->klass->type;
gimp_gtk_drag_source_set_by_type (GTK_WIDGET (preview),
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
type,
GDK_ACTION_COPY);
gimp_dnd_viewable_source_set (GTK_WIDGET (preview),
type,
gimp_preview_drag_viewable,
NULL);
}
gtk_signal_connect_object (GTK_OBJECT (preview->viewable),
"invalidate_preview",
GTK_SIGNAL_FUNC (gimp_preview_paint),
@ -1050,3 +1079,10 @@ gimp_preview_render_and_flush (GimpPreview *preview,
gtk_widget_queue_draw (GTK_WIDGET (preview));
}
static GimpViewable *
gimp_preview_drag_viewable (GtkWidget *widget,
gpointer data)
{
return GIMP_PREVIEW (widget)->viewable;
}

View File

@ -41,8 +41,6 @@ static GtkWidget * gimp_brush_preview_create_popup (GimpPreview *preview)
static gboolean gimp_brush_preview_needs_popup (GimpPreview *preview);
static gboolean gimp_brush_preview_render_timeout_func (GimpBrushPreview *preview);
static GimpViewable * gimp_brush_preview_drag_viewable (GtkWidget *widget,
gpointer data);
static GimpPreviewClass *parent_class = NULL;
@ -94,15 +92,6 @@ gimp_brush_preview_class_init (GimpBrushPreviewClass *klass)
static void
gimp_brush_preview_init (GimpBrushPreview *brush_preview)
{
gimp_gtk_drag_source_set_by_type (GTK_WIDGET (brush_preview),
GDK_BUTTON2_MASK,
GIMP_TYPE_BRUSH,
GDK_ACTION_COPY);
gimp_dnd_viewable_source_set (GTK_WIDGET (brush_preview),
GIMP_TYPE_BRUSH,
gimp_brush_preview_drag_viewable,
NULL);
brush_preview->pipe_timeout_id = 0;
brush_preview->pipe_animation_index = 0;
}
@ -372,10 +361,3 @@ gimp_brush_preview_render_timeout_func (GimpBrushPreview *brush_preview)
return TRUE;
}
static GimpViewable *
gimp_brush_preview_drag_viewable (GtkWidget *widget,
gpointer data)
{
return GIMP_PREVIEW (widget)->viewable;
}