added DND source functions which work by GtkType.

2001-02-18  Michael Natterer  <mitch@gimp.org>

	* app/gimpdnd.[ch]: added DND source functions which work by
	GtkType.

	* app/commands.c
	* app/brush_select.c
	* app/gradient_select.[ch]
	* app/pattern_select.c: removed the DND code here because it's all
	done by the GimpContainerView now.

	* app/gimpbrushpreview.c
	* app/gimpgradientpreview.c
	* app/gimppalettepreview.c
	* app/gimppatternpreview.c: use the DND by-type connect functions.

	* app/gimpbrushgenerated.c: implemented "duplicate", cleanup.

	* app/gimpcontainergridview.c
	* app/gimpcontainerlistview.c
	* app/gimpcontainerview.[ch]: added a "activate_item" signal
	method which is emitted by the subclasses to indicate double click.

	* app/gimpdatafactoryview.c: connect to "activate_item" and show
	the editor.

	* app/convert.c
	* app/gimppalette.[ch]
	* app/palette.c
	* app/paletteP.h
	* app/palette_import.c
	* app/palette_select.[ch]: major cleanup: Behaves like the other
	datatypes now: DND, context stuff, GimpContainerListViews in
	the dialogs etc. Mostly just removal of code.

	* app/gradient_editor.c: fixed signal blocking/unblocking.

	* plug-ins/script-fu/scripts/Makefile.am: install the "Test Sphere"
	script again.
This commit is contained in:
Michael Natterer 2001-02-18 19:44:28 +00:00 committed by Michael Natterer
parent 2f6f9bdd0b
commit a80dd4d071
65 changed files with 3070 additions and 4296 deletions

View File

@ -1,3 +1,43 @@
2001-02-18 Michael Natterer <mitch@gimp.org>
* app/gimpdnd.[ch]: added DND source functions which work by
GtkType.
* app/commands.c
* app/brush_select.c
* app/gradient_select.[ch]
* app/pattern_select.c: removed the DND code here because it's all
done by the GimpContainerView now.
* app/gimpbrushpreview.c
* app/gimpgradientpreview.c
* app/gimppalettepreview.c
* app/gimppatternpreview.c: use the DND by-type connect functions.
* app/gimpbrushgenerated.c: implemented "duplicate", cleanup.
* app/gimpcontainergridview.c
* app/gimpcontainerlistview.c
* app/gimpcontainerview.[ch]: added a "activate_item" signal
method which is emitted by the subclasses to indicate double click.
* app/gimpdatafactoryview.c: connect to "activate_item" and show
the editor.
* app/convert.c
* app/gimppalette.[ch]
* app/palette.c
* app/paletteP.h
* app/palette_import.c
* app/palette_select.[ch]: major cleanup: Behaves like the other
datatypes now: DND, context stuff, GimpContainerListViews in
the dialogs etc. Mostly just removal of code.
* app/gradient_editor.c: fixed signal blocking/unblocking.
* plug-ins/script-fu/scripts/Makefile.am: install the "Test Sphere"
script again.
2001-02-17 Michael Natterer <mitch@gimp.org>
* app/gimpcontainer.[ch]

View File

@ -83,7 +83,6 @@
#include "gimpcontainergridview.h"
#include "gimpdatafactory.h"
#include "gimpdatafactoryview.h"
#include "gimpdnd.h"
#include "gimppreview.h"
@ -1335,108 +1334,38 @@ container_view_scale_callback (GtkAdjustment *adj,
gimp_container_view_set_preview_size (view, ROUND (adj->value));
}
static void
drop_viewable_callback (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
GimpContainerView *view;
view = GIMP_CONTAINER_VIEW (widget);
gimp_context_set_by_type (view->context,
view->container->children_type,
GIMP_OBJECT (viewable));
}
static void
brushes_callback (GtkWidget *widget,
GimpContainerView *view)
{
gtk_drag_dest_unset (GTK_WIDGET (view));
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_brush_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
view->container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (view),
view->container->children_type,
drop_viewable_callback,
NULL);
}
static void
patterns_callback (GtkWidget *widget,
GimpContainerView *view)
{
gtk_drag_dest_unset (GTK_WIDGET (view));
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_pattern_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
view->container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (view),
view->container->children_type,
drop_viewable_callback,
NULL);
}
static void
gradients_callback (GtkWidget *widget,
GimpContainerView *view)
{
gtk_drag_dest_unset (GTK_WIDGET (view));
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_gradient_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
view->container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (view),
view->container->children_type,
drop_viewable_callback,
NULL);
}
static void
palettes_callback (GtkWidget *widget,
GimpContainerView *view)
{
gtk_drag_dest_unset (GTK_WIDGET (view));
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_palette_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
view->container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (view),
view->container->children_type,
drop_viewable_callback,
NULL);
}
static void
images_callback (GtkWidget *widget,
GimpContainerView *view)
{
gtk_drag_dest_unset (GTK_WIDGET (view));
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, image_context);
}
@ -1585,15 +1514,6 @@ container_multi_view_new (gboolean list,
5, 5);
}
gimp_gtk_drag_dest_set_by_type (view,
GTK_DEST_DEFAULT_ALL,
container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (view),
GIMP_CONTAINER_VIEW (view)->container->children_type,
drop_viewable_callback,
NULL);
dialog = gimp_dialog_new (title, "test",
gimp_standard_help_func,
NULL,
@ -1772,7 +1692,7 @@ dialogs_test_gradient_container_list_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Gradient List",
global_gradient_factory,
gradient_editor_set_gradient,
NULL,
gimp_context_get_user (),
24);
}
@ -1820,7 +1740,7 @@ dialogs_test_gradient_container_grid_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Gradient Grid",
global_gradient_factory,
gradient_editor_set_gradient,
NULL,
gimp_context_get_user (),
24);
}

View File

@ -37,7 +37,6 @@
#include "gimpcontext.h"
#include "gimpdata.h"
#include "gimpdatafactory.h"
#include "gimpdnd.h"
#include "gimprc.h"
#include "session.h"
#include "temp_buf.h"
@ -58,9 +57,6 @@
static void brush_select_change_callbacks (BrushSelect *bsp,
gboolean closing);
static void brush_select_drop_brush (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
static void brush_select_brush_changed (GimpContext *context,
GimpBrush *brush,
BrushSelect *bsp);
@ -93,8 +89,9 @@ GSList *brush_active_dialogs = NULL;
/* the main brush selection dialog */
BrushSelect *brush_select_dialog = NULL;
/* Brush editor dialog */
static BrushEditGeneratedWindow *brush_edit_generated_dialog;
/* the main brush editor dialog */
static BrushEditGeneratedWindow *brush_edit_generated_dialog = NULL;
/* public functions */
@ -246,15 +243,6 @@ brush_select_new (gchar *title,
TRUE, TRUE, 0);
gtk_widget_show (bsp->view);
gimp_gtk_drag_dest_set_by_type (bsp->view,
GTK_DEST_DEFAULT_ALL,
GIMP_TYPE_BRUSH,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (bsp->view),
GIMP_TYPE_BRUSH,
brush_select_drop_brush,
bsp);
gtk_widget_show (bsp->brush_selection_box);
gtk_widget_show (bsp->left_box);
@ -264,6 +252,7 @@ brush_select_new (gchar *title,
/* Create the active brush label */
util_box = gtk_hbox_new (FALSE, 0);
gtk_container_set_resize_mode (GTK_CONTAINER (util_box), GTK_RESIZE_QUEUE);
gtk_box_pack_start (GTK_BOX (bsp->options_box), util_box, FALSE, FALSE, 2);
bsp->brush_name = gtk_label_new (_("No Brushes available"));
@ -535,18 +524,6 @@ brush_select_dialogs_check (void)
* Local functions
*/
static void
brush_select_drop_brush (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
BrushSelect *bsp;
bsp = (BrushSelect *) data;
gimp_context_set_brush (bsp->context, GIMP_BRUSH (viewable));
}
static void
brush_select_brush_changed (GimpContext *context,
GimpBrush *brush,
@ -556,6 +533,9 @@ brush_select_brush_changed (GimpContext *context,
{
brush_select_update_active_brush_field (bsp);
gtk_widget_set_sensitive (GIMP_DATA_FACTORY_VIEW (bsp->view)->edit_button,
GIMP_IS_BRUSH_GENERATED (brush));
if (bsp->callback_name)
brush_select_change_callbacks (bsp, FALSE);
}

View File

@ -83,7 +83,6 @@
#include "gimpcontainergridview.h"
#include "gimpdatafactory.h"
#include "gimpdatafactoryview.h"
#include "gimpdnd.h"
#include "gimppreview.h"
@ -1335,108 +1334,38 @@ container_view_scale_callback (GtkAdjustment *adj,
gimp_container_view_set_preview_size (view, ROUND (adj->value));
}
static void
drop_viewable_callback (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
GimpContainerView *view;
view = GIMP_CONTAINER_VIEW (widget);
gimp_context_set_by_type (view->context,
view->container->children_type,
GIMP_OBJECT (viewable));
}
static void
brushes_callback (GtkWidget *widget,
GimpContainerView *view)
{
gtk_drag_dest_unset (GTK_WIDGET (view));
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_brush_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
view->container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (view),
view->container->children_type,
drop_viewable_callback,
NULL);
}
static void
patterns_callback (GtkWidget *widget,
GimpContainerView *view)
{
gtk_drag_dest_unset (GTK_WIDGET (view));
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_pattern_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
view->container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (view),
view->container->children_type,
drop_viewable_callback,
NULL);
}
static void
gradients_callback (GtkWidget *widget,
GimpContainerView *view)
{
gtk_drag_dest_unset (GTK_WIDGET (view));
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_gradient_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
view->container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (view),
view->container->children_type,
drop_viewable_callback,
NULL);
}
static void
palettes_callback (GtkWidget *widget,
GimpContainerView *view)
{
gtk_drag_dest_unset (GTK_WIDGET (view));
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_palette_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
view->container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (view),
view->container->children_type,
drop_viewable_callback,
NULL);
}
static void
images_callback (GtkWidget *widget,
GimpContainerView *view)
{
gtk_drag_dest_unset (GTK_WIDGET (view));
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, image_context);
}
@ -1585,15 +1514,6 @@ container_multi_view_new (gboolean list,
5, 5);
}
gimp_gtk_drag_dest_set_by_type (view,
GTK_DEST_DEFAULT_ALL,
container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (view),
GIMP_CONTAINER_VIEW (view)->container->children_type,
drop_viewable_callback,
NULL);
dialog = gimp_dialog_new (title, "test",
gimp_standard_help_func,
NULL,
@ -1772,7 +1692,7 @@ dialogs_test_gradient_container_list_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Gradient List",
global_gradient_factory,
gradient_editor_set_gradient,
NULL,
gimp_context_get_user (),
24);
}
@ -1820,7 +1740,7 @@ dialogs_test_gradient_container_grid_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Gradient Grid",
global_gradient_factory,
gradient_editor_set_gradient,
NULL,
gimp_context_get_user (),
24);
}

View File

@ -949,29 +949,23 @@ indexed_palette_select_destroy_callback (GtkWidget *widget,
}
static gint
indexed_palette_select_row_callback (GtkCList *clist,
gint row,
gint column,
GdkEventButton *event,
gpointer data)
indexed_palette_select_palette (GimpContext *context,
GimpPalette *palette,
gpointer data)
{
IndexedDialog *dialog = (IndexedDialog *)data;
GimpPalette *palette;
IndexedDialog *dialog;
palette = (GimpPalette *) gtk_clist_get_row_data (clist, row);
dialog = (IndexedDialog *) data;
if (palette)
{
if (palette->n_colors <= 256)
{
theCustomPalette = palette;
gtk_label_set_text (GTK_LABEL (GTK_BIN (dialog->custom_palette_button)->child),
GIMP_OBJECT (theCustomPalette)->name);
}
else
{
gtk_clist_unselect_row (clist, row, column);
}
}
return FALSE;
@ -993,8 +987,9 @@ indexed_custom_palette_button_callback (GtkWidget *widget,
gtk_signal_connect (GTK_OBJECT (dialog->palette_select->shell), "destroy",
GTK_SIGNAL_FUNC (indexed_palette_select_destroy_callback),
dialog);
gtk_signal_connect (GTK_OBJECT (dialog->palette_select->clist), "select_row",
GTK_SIGNAL_FUNC (indexed_palette_select_row_callback),
gtk_signal_connect (GTK_OBJECT (dialog->palette_select->context),
"palette_changed",
GTK_SIGNAL_FUNC (indexed_palette_select_palette),
dialog);
}
else

View File

@ -48,12 +48,13 @@
/* local function prototypes */
static void gimp_brush_generated_class_init (GimpBrushGeneratedClass *klass);
static void gimp_brush_generated_init (GimpBrushGenerated *brush);
static void gimp_brush_generated_destroy (GtkObject *object);
static gboolean gimp_brush_generated_save (GimpData *data);
static void gimp_brush_generated_dirty (GimpData *data);
static gchar * gimp_brush_generated_get_extension (GimpData *data);
static void gimp_brush_generated_class_init (GimpBrushGeneratedClass *klass);
static void gimp_brush_generated_init (GimpBrushGenerated *brush);
static void gimp_brush_generated_destroy (GtkObject *object);
static gboolean gimp_brush_generated_save (GimpData *data);
static void gimp_brush_generated_dirty (GimpData *data);
static gchar * gimp_brush_generated_get_extension (GimpData *data);
static GimpData * gimp_brush_generated_duplicate (GimpData *data);
static GimpBrushClass *parent_class = NULL;
@ -100,6 +101,7 @@ gimp_brush_generated_class_init (GimpBrushGeneratedClass *klass)
data_class->save = gimp_brush_generated_save;
data_class->dirty = gimp_brush_generated_dirty;
data_class->get_extension = gimp_brush_generated_get_extension;
data_class->duplicate = gimp_brush_generated_duplicate;
}
static void
@ -172,6 +174,19 @@ gimp_brush_generated_get_extension (GimpData *data)
return GIMP_BRUSH_GENERATED_FILE_EXTENSION;
}
static GimpData *
gimp_brush_generated_duplicate (GimpData *data)
{
GimpBrushGenerated *brush;
brush = GIMP_BRUSH_GENERATED (data);
return gimp_brush_generated_new (brush->radius,
brush->hardness,
brush->angle,
brush->aspect_ratio);
}
static double
gauss (gdouble f)
{

View File

@ -48,12 +48,13 @@
/* local function prototypes */
static void gimp_brush_generated_class_init (GimpBrushGeneratedClass *klass);
static void gimp_brush_generated_init (GimpBrushGenerated *brush);
static void gimp_brush_generated_destroy (GtkObject *object);
static gboolean gimp_brush_generated_save (GimpData *data);
static void gimp_brush_generated_dirty (GimpData *data);
static gchar * gimp_brush_generated_get_extension (GimpData *data);
static void gimp_brush_generated_class_init (GimpBrushGeneratedClass *klass);
static void gimp_brush_generated_init (GimpBrushGenerated *brush);
static void gimp_brush_generated_destroy (GtkObject *object);
static gboolean gimp_brush_generated_save (GimpData *data);
static void gimp_brush_generated_dirty (GimpData *data);
static gchar * gimp_brush_generated_get_extension (GimpData *data);
static GimpData * gimp_brush_generated_duplicate (GimpData *data);
static GimpBrushClass *parent_class = NULL;
@ -100,6 +101,7 @@ gimp_brush_generated_class_init (GimpBrushGeneratedClass *klass)
data_class->save = gimp_brush_generated_save;
data_class->dirty = gimp_brush_generated_dirty;
data_class->get_extension = gimp_brush_generated_get_extension;
data_class->duplicate = gimp_brush_generated_duplicate;
}
static void
@ -172,6 +174,19 @@ gimp_brush_generated_get_extension (GimpData *data)
return GIMP_BRUSH_GENERATED_FILE_EXTENSION;
}
static GimpData *
gimp_brush_generated_duplicate (GimpData *data)
{
GimpBrushGenerated *brush;
brush = GIMP_BRUSH_GENERATED (data);
return gimp_brush_generated_new (brush->radius,
brush->hardness,
brush->angle,
brush->aspect_ratio);
}
static double
gauss (gdouble f)
{

View File

@ -48,12 +48,13 @@
/* local function prototypes */
static void gimp_brush_generated_class_init (GimpBrushGeneratedClass *klass);
static void gimp_brush_generated_init (GimpBrushGenerated *brush);
static void gimp_brush_generated_destroy (GtkObject *object);
static gboolean gimp_brush_generated_save (GimpData *data);
static void gimp_brush_generated_dirty (GimpData *data);
static gchar * gimp_brush_generated_get_extension (GimpData *data);
static void gimp_brush_generated_class_init (GimpBrushGeneratedClass *klass);
static void gimp_brush_generated_init (GimpBrushGenerated *brush);
static void gimp_brush_generated_destroy (GtkObject *object);
static gboolean gimp_brush_generated_save (GimpData *data);
static void gimp_brush_generated_dirty (GimpData *data);
static gchar * gimp_brush_generated_get_extension (GimpData *data);
static GimpData * gimp_brush_generated_duplicate (GimpData *data);
static GimpBrushClass *parent_class = NULL;
@ -100,6 +101,7 @@ gimp_brush_generated_class_init (GimpBrushGeneratedClass *klass)
data_class->save = gimp_brush_generated_save;
data_class->dirty = gimp_brush_generated_dirty;
data_class->get_extension = gimp_brush_generated_get_extension;
data_class->duplicate = gimp_brush_generated_duplicate;
}
static void
@ -172,6 +174,19 @@ gimp_brush_generated_get_extension (GimpData *data)
return GIMP_BRUSH_GENERATED_FILE_EXTENSION;
}
static GimpData *
gimp_brush_generated_duplicate (GimpData *data)
{
GimpBrushGenerated *brush;
brush = GIMP_BRUSH_GENERATED (data);
return gimp_brush_generated_new (brush->radius,
brush->hardness,
brush->angle,
brush->aspect_ratio);
}
static double
gauss (gdouble f)
{

View File

@ -949,29 +949,23 @@ indexed_palette_select_destroy_callback (GtkWidget *widget,
}
static gint
indexed_palette_select_row_callback (GtkCList *clist,
gint row,
gint column,
GdkEventButton *event,
gpointer data)
indexed_palette_select_palette (GimpContext *context,
GimpPalette *palette,
gpointer data)
{
IndexedDialog *dialog = (IndexedDialog *)data;
GimpPalette *palette;
IndexedDialog *dialog;
palette = (GimpPalette *) gtk_clist_get_row_data (clist, row);
dialog = (IndexedDialog *) data;
if (palette)
{
if (palette->n_colors <= 256)
{
theCustomPalette = palette;
gtk_label_set_text (GTK_LABEL (GTK_BIN (dialog->custom_palette_button)->child),
GIMP_OBJECT (theCustomPalette)->name);
}
else
{
gtk_clist_unselect_row (clist, row, column);
}
}
return FALSE;
@ -993,8 +987,9 @@ indexed_custom_palette_button_callback (GtkWidget *widget,
gtk_signal_connect (GTK_OBJECT (dialog->palette_select->shell), "destroy",
GTK_SIGNAL_FUNC (indexed_palette_select_destroy_callback),
dialog);
gtk_signal_connect (GTK_OBJECT (dialog->palette_select->clist), "select_row",
GTK_SIGNAL_FUNC (indexed_palette_select_row_callback),
gtk_signal_connect (GTK_OBJECT (dialog->palette_select->context),
"palette_changed",
GTK_SIGNAL_FUNC (indexed_palette_select_palette),
dialog);
}
else

View File

@ -115,8 +115,6 @@ gimp_palette_init (GimpPalette *palette)
palette->n_colors = 0;
palette->n_columns = 0;
palette->pixmap = NULL;
}
static void
@ -139,9 +137,6 @@ gimp_palette_destroy (GtkObject *object)
g_list_free (palette->colors);
if (palette->pixmap)
gdk_pixmap_unref (palette->pixmap);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
@ -555,70 +550,6 @@ gimp_palette_delete_entry (GimpPalette *palette,
}
}
void
gimp_palette_update_preview (GimpPalette *palette,
GdkGC *gc)
{
GimpPaletteEntry *entry;
guchar rgb_buf[SM_PREVIEW_WIDTH * SM_PREVIEW_HEIGHT * 3];
GList *list;
gint index;
g_return_if_fail (palette != NULL);
g_return_if_fail (GIMP_IS_PALETTE (palette));
g_return_if_fail (gc != NULL);
memset (rgb_buf, 0x0, sizeof (rgb_buf));
gdk_draw_rgb_image (palette->pixmap,
gc,
0,
0,
SM_PREVIEW_WIDTH,
SM_PREVIEW_HEIGHT,
GDK_RGB_DITHER_NORMAL,
rgb_buf,
SM_PREVIEW_WIDTH * 3);
index = 0;
for (list = palette->colors; list; list = g_list_next (list))
{
guchar cell[3 * 3 * 3];
gint loop;
entry = (GimpPaletteEntry *) list->data;
gimp_rgb_get_uchar (&entry->color,
&cell[0],
&cell[1],
&cell[2]);
for (loop = 3; loop < 27 ; loop += 3)
{
cell[0 + loop] = cell[0];
cell[1 + loop] = cell[1];
cell[2 + loop] = cell[2];
}
gdk_draw_rgb_image (palette->pixmap,
gc,
1 + (index % ((SM_PREVIEW_WIDTH-2) / 3)) * 3,
1 + (index / ((SM_PREVIEW_WIDTH-2) / 3)) * 3,
3,
3,
GDK_RGB_DITHER_NORMAL,
cell,
3);
index++;
if (index >= (((SM_PREVIEW_WIDTH - 2) * (SM_PREVIEW_HEIGHT - 2)) / 9))
break;
}
}
static void
gimp_palette_entry_free (GimpPaletteEntry *entry)
{

View File

@ -115,8 +115,6 @@ gimp_palette_init (GimpPalette *palette)
palette->n_colors = 0;
palette->n_columns = 0;
palette->pixmap = NULL;
}
static void
@ -139,9 +137,6 @@ gimp_palette_destroy (GtkObject *object)
g_list_free (palette->colors);
if (palette->pixmap)
gdk_pixmap_unref (palette->pixmap);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
@ -555,70 +550,6 @@ gimp_palette_delete_entry (GimpPalette *palette,
}
}
void
gimp_palette_update_preview (GimpPalette *palette,
GdkGC *gc)
{
GimpPaletteEntry *entry;
guchar rgb_buf[SM_PREVIEW_WIDTH * SM_PREVIEW_HEIGHT * 3];
GList *list;
gint index;
g_return_if_fail (palette != NULL);
g_return_if_fail (GIMP_IS_PALETTE (palette));
g_return_if_fail (gc != NULL);
memset (rgb_buf, 0x0, sizeof (rgb_buf));
gdk_draw_rgb_image (palette->pixmap,
gc,
0,
0,
SM_PREVIEW_WIDTH,
SM_PREVIEW_HEIGHT,
GDK_RGB_DITHER_NORMAL,
rgb_buf,
SM_PREVIEW_WIDTH * 3);
index = 0;
for (list = palette->colors; list; list = g_list_next (list))
{
guchar cell[3 * 3 * 3];
gint loop;
entry = (GimpPaletteEntry *) list->data;
gimp_rgb_get_uchar (&entry->color,
&cell[0],
&cell[1],
&cell[2]);
for (loop = 3; loop < 27 ; loop += 3)
{
cell[0 + loop] = cell[0];
cell[1 + loop] = cell[1];
cell[2 + loop] = cell[2];
}
gdk_draw_rgb_image (palette->pixmap,
gc,
1 + (index % ((SM_PREVIEW_WIDTH-2) / 3)) * 3,
1 + (index / ((SM_PREVIEW_WIDTH-2) / 3)) * 3,
3,
3,
GDK_RGB_DITHER_NORMAL,
cell,
3);
index++;
if (index >= (((SM_PREVIEW_WIDTH - 2) * (SM_PREVIEW_HEIGHT - 2)) / 9))
break;
}
}
static void
gimp_palette_entry_free (GimpPaletteEntry *entry)
{

View File

@ -115,8 +115,6 @@ gimp_palette_init (GimpPalette *palette)
palette->n_colors = 0;
palette->n_columns = 0;
palette->pixmap = NULL;
}
static void
@ -139,9 +137,6 @@ gimp_palette_destroy (GtkObject *object)
g_list_free (palette->colors);
if (palette->pixmap)
gdk_pixmap_unref (palette->pixmap);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
@ -555,70 +550,6 @@ gimp_palette_delete_entry (GimpPalette *palette,
}
}
void
gimp_palette_update_preview (GimpPalette *palette,
GdkGC *gc)
{
GimpPaletteEntry *entry;
guchar rgb_buf[SM_PREVIEW_WIDTH * SM_PREVIEW_HEIGHT * 3];
GList *list;
gint index;
g_return_if_fail (palette != NULL);
g_return_if_fail (GIMP_IS_PALETTE (palette));
g_return_if_fail (gc != NULL);
memset (rgb_buf, 0x0, sizeof (rgb_buf));
gdk_draw_rgb_image (palette->pixmap,
gc,
0,
0,
SM_PREVIEW_WIDTH,
SM_PREVIEW_HEIGHT,
GDK_RGB_DITHER_NORMAL,
rgb_buf,
SM_PREVIEW_WIDTH * 3);
index = 0;
for (list = palette->colors; list; list = g_list_next (list))
{
guchar cell[3 * 3 * 3];
gint loop;
entry = (GimpPaletteEntry *) list->data;
gimp_rgb_get_uchar (&entry->color,
&cell[0],
&cell[1],
&cell[2]);
for (loop = 3; loop < 27 ; loop += 3)
{
cell[0 + loop] = cell[0];
cell[1 + loop] = cell[1];
cell[2 + loop] = cell[2];
}
gdk_draw_rgb_image (palette->pixmap,
gc,
1 + (index % ((SM_PREVIEW_WIDTH-2) / 3)) * 3,
1 + (index / ((SM_PREVIEW_WIDTH-2) / 3)) * 3,
3,
3,
GDK_RGB_DITHER_NORMAL,
cell,
3);
index++;
if (index >= (((SM_PREVIEW_WIDTH - 2) * (SM_PREVIEW_HEIGHT - 2)) / 9))
break;
}
}
static void
gimp_palette_entry_free (GimpPaletteEntry *entry)
{

View File

@ -55,9 +55,6 @@ struct _GimpPalette
gint n_colors;
gint n_columns;
/* EEK */
GdkPixmap *pixmap;
};
struct _GimpPaletteClass

View File

@ -573,8 +573,6 @@ palette_import_create_from_grad (gchar *name)
gimp_container_add (global_palette_factory->container,
GIMP_OBJECT (palette));
palette_insert_all (palette);
}
}
@ -758,8 +756,6 @@ palette_import_image_make_palette (GHashTable *h_array,
g_slist_free (sorted_list);
gimp_container_add (global_palette_factory->container, GIMP_OBJECT (palette));
palette_insert_all (palette);
}
static void
@ -874,8 +870,6 @@ palette_import_create_from_indexed (GImage *gimage,
}
gimp_container_add (global_palette_factory->container, GIMP_OBJECT (palette));
palette_insert_all (palette);
}
/* the palette import action area callbacks ********************************/

View File

@ -48,12 +48,13 @@
/* local function prototypes */
static void gimp_brush_generated_class_init (GimpBrushGeneratedClass *klass);
static void gimp_brush_generated_init (GimpBrushGenerated *brush);
static void gimp_brush_generated_destroy (GtkObject *object);
static gboolean gimp_brush_generated_save (GimpData *data);
static void gimp_brush_generated_dirty (GimpData *data);
static gchar * gimp_brush_generated_get_extension (GimpData *data);
static void gimp_brush_generated_class_init (GimpBrushGeneratedClass *klass);
static void gimp_brush_generated_init (GimpBrushGenerated *brush);
static void gimp_brush_generated_destroy (GtkObject *object);
static gboolean gimp_brush_generated_save (GimpData *data);
static void gimp_brush_generated_dirty (GimpData *data);
static gchar * gimp_brush_generated_get_extension (GimpData *data);
static GimpData * gimp_brush_generated_duplicate (GimpData *data);
static GimpBrushClass *parent_class = NULL;
@ -100,6 +101,7 @@ gimp_brush_generated_class_init (GimpBrushGeneratedClass *klass)
data_class->save = gimp_brush_generated_save;
data_class->dirty = gimp_brush_generated_dirty;
data_class->get_extension = gimp_brush_generated_get_extension;
data_class->duplicate = gimp_brush_generated_duplicate;
}
static void
@ -172,6 +174,19 @@ gimp_brush_generated_get_extension (GimpData *data)
return GIMP_BRUSH_GENERATED_FILE_EXTENSION;
}
static GimpData *
gimp_brush_generated_duplicate (GimpData *data)
{
GimpBrushGenerated *brush;
brush = GIMP_BRUSH_GENERATED (data);
return gimp_brush_generated_new (brush->radius,
brush->hardness,
brush->angle,
brush->aspect_ratio);
}
static double
gauss (gdouble f)
{

View File

@ -41,8 +41,8 @@ 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 GimpBrush * gimp_brush_preview_drag_brush (GtkWidget *widget,
gpointer data);
static GimpViewable * gimp_brush_preview_drag_viewable (GtkWidget *widget,
gpointer data);
static GimpPreviewClass *parent_class = NULL;
@ -94,20 +94,14 @@ gimp_brush_preview_class_init (GimpBrushPreviewClass *klass)
static void
gimp_brush_preview_init (GimpBrushPreview *brush_preview)
{
static GtkTargetEntry preview_target_table[] =
{
GIMP_TARGET_BRUSH
};
static guint preview_n_targets = (sizeof (preview_target_table) /
sizeof (preview_target_table[0]));
gtk_drag_source_set (GTK_WIDGET (brush_preview),
GDK_BUTTON2_MASK,
preview_target_table, preview_n_targets,
GDK_ACTION_COPY);
gimp_dnd_brush_source_set (GTK_WIDGET (brush_preview),
gimp_brush_preview_drag_brush,
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;
@ -379,13 +373,9 @@ gimp_brush_preview_render_timeout_func (GimpBrushPreview *brush_preview)
return TRUE;
}
static GimpBrush *
gimp_brush_preview_drag_brush (GtkWidget *widget,
gpointer data)
static GimpViewable *
gimp_brush_preview_drag_viewable (GtkWidget *widget,
gpointer data)
{
GimpPreview *preview;
preview = GIMP_PREVIEW (data);
return GIMP_BRUSH (preview->viewable);
return GIMP_PREVIEW (widget)->viewable;
}

View File

@ -54,6 +54,8 @@ static void gimp_container_grid_view_clear_items (GimpContainerView *v
static void gimp_container_grid_view_set_preview_size (GimpContainerView *view);
static void gimp_container_grid_view_item_selected (GtkWidget *widget,
gpointer data);
static void gimp_container_grid_view_item_activate (GtkWidget *widget,
gpointer data);
static void gimp_container_grid_view_highlight_item (GimpContainerView *view,
GimpViewable *viewable,
gpointer insert_data);
@ -237,6 +239,10 @@ gimp_container_grid_view_insert_item (GimpContainerView *view,
GTK_SIGNAL_FUNC (gimp_container_grid_view_item_selected),
view);
gtk_signal_connect (GTK_OBJECT (preview), "double_clicked",
GTK_SIGNAL_FUNC (gimp_container_grid_view_item_activate),
view);
return (gpointer) preview;
}
@ -338,6 +344,14 @@ gimp_container_grid_view_item_selected (GtkWidget *widget,
GIMP_PREVIEW (widget)->viewable);
}
static void
gimp_container_grid_view_item_activate (GtkWidget *widget,
gpointer data)
{
gimp_container_view_item_activate (GIMP_CONTAINER_VIEW (data),
GIMP_PREVIEW (widget)->viewable);
}
static void
gimp_container_grid_view_highlight_item (GimpContainerView *view,
GimpViewable *viewable,

View File

@ -28,6 +28,7 @@
#include "gimpcontainer.h"
#include "gimpcontainerlistview.h"
#include "gimpcontext.h"
#include "gimpdnd.h"
#include "gimplist.h"
#include "gimppreview.h"
@ -57,6 +58,11 @@ static void gimp_container_list_view_name_changed (GimpViewable *v
static void gimp_container_list_view_item_selected (GtkWidget *widget,
GtkWidget *child,
gpointer data);
static gint gimp_container_list_view_item_activate (GtkWidget *widget,
GdkEventButton *bevent,
gpointer data);
static GimpViewable * gimp_container_list_view_drag_viewable (GtkWidget *widget,
gpointer data);
static GimpContainerViewClass *parent_class = NULL;
@ -236,6 +242,19 @@ gimp_container_list_view_insert_item (GimpContainerView *view,
label,
GTK_OBJECT (list_view));
gtk_signal_connect (GTK_OBJECT (list_item), "button_press_event",
GTK_SIGNAL_FUNC (gimp_container_list_view_item_activate),
list_view);
gimp_gtk_drag_source_set_by_type (list_item,
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
view->container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_source_set (GTK_WIDGET (list_item),
view->container->children_type,
gimp_container_list_view_drag_viewable,
list_view);
gtk_widget_show (list_item);
list = g_list_prepend (NULL, list_item);
@ -417,6 +436,35 @@ gimp_container_list_view_item_selected (GtkWidget *widget,
viewable = GIMP_PREVIEW (gtk_object_get_data (GTK_OBJECT (child),
"preview"))->viewable;
gimp_container_view_item_selected (GIMP_CONTAINER_VIEW (data),
viewable);
gimp_container_view_item_selected (GIMP_CONTAINER_VIEW (data), viewable);
}
static gint
gimp_container_list_view_item_activate (GtkWidget *widget,
GdkEventButton *bevent,
gpointer data)
{
if (bevent->type == GDK_2BUTTON_PRESS)
{
GimpViewable *viewable;
viewable = GIMP_PREVIEW (gtk_object_get_data (GTK_OBJECT (widget),
"preview"))->viewable;
gimp_container_view_item_activate (GIMP_CONTAINER_VIEW (data), viewable);
}
return FALSE;
}
static GimpViewable *
gimp_container_list_view_drag_viewable (GtkWidget *widget,
gpointer data)
{
GimpViewable *viewable;
viewable = GIMP_PREVIEW (gtk_object_get_data (GTK_OBJECT (widget),
"preview"))->viewable;
return viewable;
}

View File

@ -25,6 +25,7 @@
#include "gimpcontainer.h"
#include "gimpcontainerview.h"
#include "gimpcontext.h"
#include "gimpdnd.h"
#include "gimpmarshal.h"
#include "gimpviewable.h"
@ -35,6 +36,7 @@ enum
REMOVE_ITEM,
REORDER_ITEM,
SELECT_ITEM,
ACTIVATE_ITEM,
CLEAR_ITEMS,
SET_PREVIEW_SIZE,
LAST_SIGNAL
@ -64,6 +66,9 @@ static void gimp_container_view_reorder (GimpContainerView *view,
static void gimp_container_view_context_changed (GimpContext *context,
GimpViewable *viewable,
GimpContainerView *view);
static void gimp_container_view_drop_viewable_callback (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
static guint view_signals[LAST_SIGNAL] = { 0 };
@ -150,6 +155,17 @@ gimp_container_view_class_init (GimpContainerViewClass *klass)
GIMP_TYPE_OBJECT,
GTK_TYPE_POINTER);
view_signals[ACTIVATE_ITEM] =
gtk_signal_new ("activate_item",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpContainerViewClass,
activate_item),
gtk_marshal_NONE__POINTER_POINTER,
GTK_TYPE_NONE, 2,
GIMP_TYPE_OBJECT,
GTK_TYPE_POINTER);
view_signals[CLEAR_ITEMS] =
gtk_signal_new ("clear_items",
GTK_RUN_FIRST,
@ -176,6 +192,7 @@ gimp_container_view_class_init (GimpContainerViewClass *klass)
klass->remove_item = NULL;
klass->reorder_item = NULL;
klass->select_item = NULL;
klass->activate_item = NULL;
klass->clear_items = gimp_container_view_real_clear_items;
klass->set_preview_size = NULL;
}
@ -244,6 +261,10 @@ gimp_container_view_set_container (GimpContainerView *view,
gtk_signal_disconnect_by_func (GTK_OBJECT (view->context),
gimp_container_view_context_changed,
view);
gtk_drag_dest_unset (GTK_WIDGET (view));
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
}
}
@ -285,6 +306,15 @@ gimp_container_view_set_container (GimpContainerView *view,
gimp_container_view_select_item (view,
object ? GIMP_VIEWABLE (object): NULL);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
view->container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (view),
view->container->children_type,
gimp_container_view_drop_viewable_callback,
NULL);
}
}
}
@ -305,6 +335,10 @@ gimp_container_view_set_context (GimpContainerView *view,
gtk_signal_disconnect_by_func (GTK_OBJECT (view->context),
gimp_container_view_context_changed,
view);
gtk_drag_dest_unset (GTK_WIDGET (view));
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
}
view->context = context;
@ -326,6 +360,15 @@ gimp_container_view_set_context (GimpContainerView *view,
gimp_container_view_select_item (view,
object ? GIMP_VIEWABLE (object) : NULL);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
view->container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (view),
view->container->children_type,
gimp_container_view_drop_viewable_callback,
NULL);
}
}
@ -358,6 +401,23 @@ gimp_container_view_select_item (GimpContainerView *view,
viewable, insert_data);
}
void
gimp_container_view_activate_item (GimpContainerView *view,
GimpViewable *viewable)
{
gpointer insert_data;
g_return_if_fail (view != NULL);
g_return_if_fail (GIMP_IS_CONTAINER_VIEW (view));
g_return_if_fail (viewable != NULL);
g_return_if_fail (GIMP_IS_VIEWABLE (viewable));
insert_data = g_hash_table_lookup (view->hash_table, viewable);
gtk_signal_emit (GTK_OBJECT (view), view_signals[ACTIVATE_ITEM],
viewable, insert_data);
}
void
gimp_container_view_item_selected (GimpContainerView *view,
GimpViewable *viewable)
@ -375,6 +435,18 @@ gimp_container_view_item_selected (GimpContainerView *view,
GIMP_OBJECT (viewable));
}
void
gimp_container_view_item_activate (GimpContainerView *view,
GimpViewable *viewable)
{
g_return_if_fail (view != NULL);
g_return_if_fail (GIMP_IS_CONTAINER_VIEW (view));
g_return_if_fail (viewable != NULL);
g_return_if_fail (GIMP_IS_VIEWABLE (viewable));
gimp_container_view_activate_item (view, viewable);
}
static void
gimp_container_view_clear_items (GimpContainerView *view)
{
@ -465,3 +537,17 @@ gimp_container_view_context_changed (GimpContext *context,
gtk_signal_emit (GTK_OBJECT (view), view_signals[SELECT_ITEM],
viewable, insert_data);
}
static void
gimp_container_view_drop_viewable_callback (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
GimpContainerView *view;
view = GIMP_CONTAINER_VIEW (widget);
gimp_context_set_by_type (view->context,
view->container->children_type,
GIMP_OBJECT (viewable));
}

View File

@ -61,6 +61,9 @@ struct _GimpContainerViewClass
void (* select_item) (GimpContainerView *view,
GimpViewable *object,
gpointer insert_data);
void (* activate_item) (GimpContainerView *view,
GimpViewable *object,
gpointer insert_data);
void (* clear_items) (GimpContainerView *view);
void (* set_preview_size) (GimpContainerView *view);
};
@ -76,12 +79,16 @@ void gimp_container_view_set_preview_size (GimpContainerView *view,
gint preview_size);
void gimp_container_view_select_item (GimpContainerView *view,
GimpViewable *viewable);
void gimp_container_view_activate_item (GimpContainerView *view,
GimpViewable *viewable);
/* private */
void gimp_container_view_item_selected (GimpContainerView *view,
GimpViewable *item);
void gimp_container_view_item_activate (GimpContainerView *view,
GimpViewable *item);
#endif /* __GIMP_CONTAINER_VIEW_H__ */

View File

@ -32,6 +32,7 @@
#include "gimpcontainergridview.h"
#include "gimpcontainerlistview.h"
#include "gimpcontext.h"
#include "gimpdnd.h"
#include "gimpmarshal.h"
#include "gimpviewable.h"
@ -52,16 +53,29 @@ static void gimp_data_factory_view_new_clicked (GtkWidget *wid
GimpDataFactoryView *view);
static void gimp_data_factory_view_duplicate_clicked (GtkWidget *widget,
GimpDataFactoryView *view);
static void gimp_data_factory_view_duplicate_dropped (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
static void gimp_data_factory_view_edit_clicked (GtkWidget *widget,
GimpDataFactoryView *view);
static void gimp_data_factory_view_edit_dropped (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
static void gimp_data_factory_view_delete_clicked (GtkWidget *widget,
GimpDataFactoryView *view);
static void gimp_data_factory_view_delete_dropped (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
static void gimp_data_factory_view_refresh_clicked (GtkWidget *widget,
GimpDataFactoryView *view);
static void gimp_data_factory_view_data_changed (GimpContext *context,
GimpData *data,
GimpDataFactoryView *view);
static void gimp_data_factory_view_data_activate (GtkWidget *context,
GimpData *data,
gpointer insert_data,
GimpDataFactoryView *view);
static GtkVBoxClass *parent_class = NULL;
@ -277,6 +291,42 @@ gimp_data_factory_view_new (GimpViewType view_type,
factory_view,
GTK_OBJECT (factory_view));
gtk_signal_connect_while_alive
(GTK_OBJECT (factory_view->view), "activate_item",
GTK_SIGNAL_FUNC (gimp_data_factory_view_data_activate),
factory_view,
GTK_OBJECT (factory_view));
/* drop to "duplicate" */
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (factory_view->duplicate_button),
GTK_DEST_DEFAULT_ALL,
factory_view->factory->container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (factory_view->duplicate_button),
factory_view->factory->container->children_type,
gimp_data_factory_view_duplicate_dropped,
factory_view);
/* drop to "edit" */
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (factory_view->edit_button),
GTK_DEST_DEFAULT_ALL,
factory_view->factory->container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (factory_view->edit_button),
factory_view->factory->container->children_type,
gimp_data_factory_view_edit_dropped,
factory_view);
/* drop to "delete" */
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (factory_view->delete_button),
GTK_DEST_DEFAULT_ALL,
factory_view->factory->container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (factory_view->delete_button),
factory_view->factory->container->children_type,
gimp_data_factory_view_delete_dropped,
factory_view);
/* set button sensitivity */
gimp_data_factory_view_data_changed
(context,
@ -346,6 +396,26 @@ gimp_data_factory_view_duplicate_clicked (GtkWidget *widget,
}
}
static void
gimp_data_factory_view_duplicate_dropped (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
GimpDataFactoryView *view;
view = (GimpDataFactoryView *) data;
if (viewable && gimp_container_have (view->factory->container,
GIMP_OBJECT (viewable)))
{
gimp_context_set_by_type (view->view->context,
view->factory->container->children_type,
GIMP_OBJECT (viewable));
gimp_data_factory_view_duplicate_clicked (NULL, data);
}
}
static void
gimp_data_factory_view_edit_clicked (GtkWidget *widget,
GimpDataFactoryView *view)
@ -365,6 +435,26 @@ gimp_data_factory_view_edit_clicked (GtkWidget *widget,
}
}
static void
gimp_data_factory_view_edit_dropped (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
GimpDataFactoryView *view;
view = (GimpDataFactoryView *) data;
if (viewable && gimp_container_have (view->factory->container,
GIMP_OBJECT (viewable)))
{
gimp_context_set_by_type (view->view->context,
view->factory->container->children_type,
GIMP_OBJECT (viewable));
gimp_data_factory_view_edit_clicked (NULL, data);
}
}
typedef struct _GimpDataDeleteData GimpDataDeleteData;
@ -444,6 +534,26 @@ gimp_data_factory_view_delete_clicked (GtkWidget *widget,
}
}
static void
gimp_data_factory_view_delete_dropped (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
GimpDataFactoryView *view;
view = (GimpDataFactoryView *) data;
if (viewable && gimp_container_have (view->factory->container,
GIMP_OBJECT (viewable)))
{
gimp_context_set_by_type (view->view->context,
view->factory->container->children_type,
GIMP_OBJECT (viewable));
gimp_data_factory_view_delete_clicked (NULL, data);
}
}
static void
gimp_data_factory_view_refresh_clicked (GtkWidget *widget,
GimpDataFactoryView *view)
@ -466,11 +576,24 @@ gimp_data_factory_view_data_changed (GimpContext *context,
duplicate_sensitive =
(GIMP_DATA_CLASS (GTK_OBJECT (data)->klass)->duplicate != NULL);
edit_sensitive = (view->data_edit_func != NULL);
delete_sensitive = TRUE; /* TODO: check permissions */
edit_sensitive = (view->data_edit_func != NULL);
delete_sensitive = TRUE; /* TODO: check permissions */
}
gtk_widget_set_sensitive (view->duplicate_button, duplicate_sensitive);
gtk_widget_set_sensitive (view->edit_button, edit_sensitive);
gtk_widget_set_sensitive (view->delete_button, delete_sensitive);
}
static void
gimp_data_factory_view_data_activate (GtkWidget *widget,
GimpData *data,
gpointer insert_data,
GimpDataFactoryView *view)
{
if (data && gimp_container_have (view->factory->container,
GIMP_OBJECT (data)))
{
gimp_data_factory_view_edit_clicked (NULL, view);
}
}

View File

@ -624,6 +624,79 @@ gimp_dnd_color_dest_unset (GtkWidget *widget)
/* GimpViewable (by GtkType) dnd functions */
/*********************************************/
static const GtkTargetEntry brush_target_table[] =
{
GIMP_TARGET_BRUSH
};
static const guint brush_n_targets = (sizeof (brush_target_table) /
sizeof (brush_target_table[0]));
static const GtkTargetEntry pattern_target_table[] =
{
GIMP_TARGET_PATTERN
};
static const guint pattern_n_targets = (sizeof (pattern_target_table) /
sizeof (pattern_target_table[0]));
static const GtkTargetEntry gradient_target_table[] =
{
GIMP_TARGET_GRADIENT
};
static const guint gradient_n_targets = (sizeof (gradient_target_table) /
sizeof (gradient_target_table[0]));
static const GtkTargetEntry palette_target_table[] =
{
GIMP_TARGET_PALETTE
};
static const guint palette_n_targets = (sizeof (palette_target_table) /
sizeof (palette_target_table[0]));
void
gimp_gtk_drag_source_set_by_type (GtkWidget *widget,
GdkModifierType start_button_mask,
GtkType type,
GdkDragAction actions)
{
const GtkTargetEntry *target_table = NULL;
guint n_targets = 0;
if (type == GIMP_TYPE_BRUSH)
{
target_table = brush_target_table;
n_targets = brush_n_targets;
}
else if (type == GIMP_TYPE_PATTERN)
{
target_table = pattern_target_table;
n_targets = pattern_n_targets;
}
else if (type == GIMP_TYPE_GRADIENT)
{
target_table = gradient_target_table;
n_targets = gradient_n_targets;
}
else if (type == GIMP_TYPE_PALETTE)
{
target_table = palette_target_table;
n_targets = palette_n_targets;
}
else
{
g_warning ("%s(): unsupported GtkType", G_GNUC_FUNCTION);
}
if (target_table && n_targets)
{
gtk_drag_source_set (widget, start_button_mask,
target_table,
n_targets,
actions);
}
}
void
gimp_gtk_drag_dest_set_by_type (GtkWidget *widget,
GtkDestDefaults flags,
@ -633,34 +706,6 @@ gimp_gtk_drag_dest_set_by_type (GtkWidget *widget,
const GtkTargetEntry *target_table = NULL;
guint n_targets = 0;
static const GtkTargetEntry brush_target_table[] =
{
GIMP_TARGET_BRUSH
};
static const guint brush_n_targets = (sizeof (brush_target_table) /
sizeof (brush_target_table[0]));
static const GtkTargetEntry pattern_target_table[] =
{
GIMP_TARGET_PATTERN
};
static const guint pattern_n_targets = (sizeof (pattern_target_table) /
sizeof (pattern_target_table[0]));
static const GtkTargetEntry gradient_target_table[] =
{
GIMP_TARGET_GRADIENT
};
static const guint gradient_n_targets = (sizeof (gradient_target_table) /
sizeof (gradient_target_table[0]));
static const GtkTargetEntry palette_target_table[] =
{
GIMP_TARGET_PALETTE
};
static const guint palette_n_targets = (sizeof (palette_target_table) /
sizeof (palette_target_table[0]));
if (type == GIMP_TYPE_BRUSH)
{
target_table = brush_target_table;
@ -695,6 +740,42 @@ gimp_gtk_drag_dest_set_by_type (GtkWidget *widget,
}
}
void
gimp_dnd_viewable_source_set (GtkWidget *widget,
GtkType type,
GimpDndDragViewableFunc get_viewable_func,
gpointer data)
{
if (type == GIMP_TYPE_BRUSH)
{
gimp_dnd_brush_source_set (widget,
(GimpDndDragBrushFunc) get_viewable_func,
data);
}
else if (type == GIMP_TYPE_PATTERN)
{
gimp_dnd_pattern_source_set (widget,
(GimpDndDragPatternFunc) get_viewable_func,
data);
}
else if (type == GIMP_TYPE_GRADIENT)
{
gimp_dnd_gradient_source_set (widget,
(GimpDndDragGradientFunc) get_viewable_func,
data);
}
else if (type == GIMP_TYPE_PALETTE)
{
gimp_dnd_palette_source_set (widget,
(GimpDndDragPaletteFunc) get_viewable_func,
data);
}
else
{
g_warning ("%s(): unsupported GtkType", G_GNUC_FUNCTION);
}
}
void
gimp_dnd_viewable_dest_set (GtkWidget *widget,
GtkType type,

View File

@ -113,20 +113,31 @@ void gimp_dnd_color_dest_unset (GtkWidget *widget);
/* GimpViewable (by GtkType) dnd functions */
typedef void (* GimpDndDropViewableFunc) (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
typedef void (* GimpDndDropViewableFunc) (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
typedef GimpViewable * (* GimpDndDragViewableFunc) (GtkWidget *widget,
gpointer data);
void gimp_gtk_drag_dest_set_by_type (GtkWidget *widget,
GtkDestDefaults flags,
GtkType type,
GdkDragAction actions);
void gimp_dnd_viewable_dest_set (GtkWidget *widget,
GtkType type,
GimpDndDropViewableFunc set_viewable_func,
gpointer data);
void gimp_dnd_viewable_dest_unset (GtkWidget *widget,
GtkType type);
void gimp_gtk_drag_source_set_by_type (GtkWidget *widget,
GdkModifierType start_button_mask,
GtkType type,
GdkDragAction actions);
void gimp_gtk_drag_dest_set_by_type (GtkWidget *widget,
GtkDestDefaults flags,
GtkType type,
GdkDragAction actions);
void gimp_dnd_viewable_source_set (GtkWidget *widget,
GtkType type,
GimpDndDragViewableFunc get_viewable_func,
gpointer data);
void gimp_dnd_viewable_dest_set (GtkWidget *widget,
GtkType type,
GimpDndDropViewableFunc set_viewable_func,
gpointer data);
void gimp_dnd_viewable_dest_unset (GtkWidget *widget,
GtkType type);
/* brush dnd functions */

View File

@ -42,7 +42,7 @@ static void gimp_gradient_preview_get_size (GimpPreview *preview,
static gboolean gimp_gradient_preview_needs_popup (GimpPreview *preview);
static GtkWidget * gimp_gradient_preview_create_popup (GimpPreview *preview);
static GimpGradient * gimp_gradient_preview_drag_gradient (GtkWidget *widget,
static GimpViewable * gimp_gradient_preview_drag_viewable (GtkWidget *widget,
gpointer data);
@ -94,20 +94,14 @@ gimp_gradient_preview_class_init (GimpGradientPreviewClass *klass)
static void
gimp_gradient_preview_init (GimpGradientPreview *gradient_preview)
{
static GtkTargetEntry preview_target_table[] =
{
GIMP_TARGET_GRADIENT
};
static guint preview_n_targets = (sizeof (preview_target_table) /
sizeof (preview_target_table[0]));
gtk_drag_source_set (GTK_WIDGET (gradient_preview),
GDK_BUTTON2_MASK,
preview_target_table, preview_n_targets,
GDK_ACTION_COPY);
gimp_dnd_gradient_source_set (GTK_WIDGET (gradient_preview),
gimp_gradient_preview_drag_gradient,
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
@ -181,13 +175,9 @@ gimp_gradient_preview_create_popup (GimpPreview *preview)
TRUE, FALSE, FALSE);
}
static GimpGradient *
gimp_gradient_preview_drag_gradient (GtkWidget *widget,
static GimpViewable *
gimp_gradient_preview_drag_viewable (GtkWidget *widget,
gpointer data)
{
GimpPreview *preview;
preview = GIMP_PREVIEW (data);
return GIMP_GRADIENT (preview->viewable);
return GIMP_PREVIEW (widget)->viewable;
}

View File

@ -949,29 +949,23 @@ indexed_palette_select_destroy_callback (GtkWidget *widget,
}
static gint
indexed_palette_select_row_callback (GtkCList *clist,
gint row,
gint column,
GdkEventButton *event,
gpointer data)
indexed_palette_select_palette (GimpContext *context,
GimpPalette *palette,
gpointer data)
{
IndexedDialog *dialog = (IndexedDialog *)data;
GimpPalette *palette;
IndexedDialog *dialog;
palette = (GimpPalette *) gtk_clist_get_row_data (clist, row);
dialog = (IndexedDialog *) data;
if (palette)
{
if (palette->n_colors <= 256)
{
theCustomPalette = palette;
gtk_label_set_text (GTK_LABEL (GTK_BIN (dialog->custom_palette_button)->child),
GIMP_OBJECT (theCustomPalette)->name);
}
else
{
gtk_clist_unselect_row (clist, row, column);
}
}
return FALSE;
@ -993,8 +987,9 @@ indexed_custom_palette_button_callback (GtkWidget *widget,
gtk_signal_connect (GTK_OBJECT (dialog->palette_select->shell), "destroy",
GTK_SIGNAL_FUNC (indexed_palette_select_destroy_callback),
dialog);
gtk_signal_connect (GTK_OBJECT (dialog->palette_select->clist), "select_row",
GTK_SIGNAL_FUNC (indexed_palette_select_row_callback),
gtk_signal_connect (GTK_OBJECT (dialog->palette_select->context),
"palette_changed",
GTK_SIGNAL_FUNC (indexed_palette_select_palette),
dialog);
}
else

View File

@ -115,8 +115,6 @@ gimp_palette_init (GimpPalette *palette)
palette->n_colors = 0;
palette->n_columns = 0;
palette->pixmap = NULL;
}
static void
@ -139,9 +137,6 @@ gimp_palette_destroy (GtkObject *object)
g_list_free (palette->colors);
if (palette->pixmap)
gdk_pixmap_unref (palette->pixmap);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
@ -555,70 +550,6 @@ gimp_palette_delete_entry (GimpPalette *palette,
}
}
void
gimp_palette_update_preview (GimpPalette *palette,
GdkGC *gc)
{
GimpPaletteEntry *entry;
guchar rgb_buf[SM_PREVIEW_WIDTH * SM_PREVIEW_HEIGHT * 3];
GList *list;
gint index;
g_return_if_fail (palette != NULL);
g_return_if_fail (GIMP_IS_PALETTE (palette));
g_return_if_fail (gc != NULL);
memset (rgb_buf, 0x0, sizeof (rgb_buf));
gdk_draw_rgb_image (palette->pixmap,
gc,
0,
0,
SM_PREVIEW_WIDTH,
SM_PREVIEW_HEIGHT,
GDK_RGB_DITHER_NORMAL,
rgb_buf,
SM_PREVIEW_WIDTH * 3);
index = 0;
for (list = palette->colors; list; list = g_list_next (list))
{
guchar cell[3 * 3 * 3];
gint loop;
entry = (GimpPaletteEntry *) list->data;
gimp_rgb_get_uchar (&entry->color,
&cell[0],
&cell[1],
&cell[2]);
for (loop = 3; loop < 27 ; loop += 3)
{
cell[0 + loop] = cell[0];
cell[1 + loop] = cell[1];
cell[2 + loop] = cell[2];
}
gdk_draw_rgb_image (palette->pixmap,
gc,
1 + (index % ((SM_PREVIEW_WIDTH-2) / 3)) * 3,
1 + (index / ((SM_PREVIEW_WIDTH-2) / 3)) * 3,
3,
3,
GDK_RGB_DITHER_NORMAL,
cell,
3);
index++;
if (index >= (((SM_PREVIEW_WIDTH - 2) * (SM_PREVIEW_HEIGHT - 2)) / 9))
break;
}
}
static void
gimp_palette_entry_free (GimpPaletteEntry *entry)
{

View File

@ -55,9 +55,6 @@ struct _GimpPalette
gint n_colors;
gint n_columns;
/* EEK */
GdkPixmap *pixmap;
};
struct _GimpPaletteClass

View File

@ -38,8 +38,8 @@ 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 GimpPalette * gimp_palette_preview_drag_palette (GtkWidget *widget,
gpointer data);
static GimpViewable * gimp_palette_preview_drag_viewable (GtkWidget *widget,
gpointer data);
static GimpPreviewClass *parent_class = NULL;
@ -89,20 +89,14 @@ gimp_palette_preview_class_init (GimpPalettePreviewClass *klass)
static void
gimp_palette_preview_init (GimpPalettePreview *palette_preview)
{
static GtkTargetEntry preview_target_table[] =
{
GIMP_TARGET_PALETTE
};
static guint preview_n_targets = (sizeof (preview_target_table) /
sizeof (preview_target_table[0]));
gtk_drag_source_set (GTK_WIDGET (palette_preview),
GDK_BUTTON2_MASK,
preview_target_table, preview_n_targets,
GDK_ACTION_COPY);
gimp_dnd_palette_source_set (GTK_WIDGET (palette_preview),
gimp_palette_preview_drag_palette,
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
@ -176,13 +170,9 @@ gimp_palette_preview_needs_popup (GimpPreview *preview)
return FALSE;
}
static GimpPalette *
gimp_palette_preview_drag_palette (GtkWidget *widget,
gpointer data)
static GimpViewable *
gimp_palette_preview_drag_viewable (GtkWidget *widget,
gpointer data)
{
GimpPreview *preview;
preview = GIMP_PREVIEW (data);
return GIMP_PALETTE (preview->viewable);
return GIMP_PREVIEW (widget)->viewable;
}

View File

@ -34,12 +34,12 @@
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 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 GimpPattern * gimp_pattern_preview_drag_pattern (GtkWidget *widget,
gpointer data);
static GimpViewable * gimp_pattern_preview_drag_viewable (GtkWidget *widget,
gpointer data);
static GimpPreviewClass *parent_class = NULL;
@ -89,20 +89,14 @@ gimp_pattern_preview_class_init (GimpPatternPreviewClass *klass)
static void
gimp_pattern_preview_init (GimpPatternPreview *pattern_preview)
{
static GtkTargetEntry preview_target_table[] =
{
GIMP_TARGET_PATTERN
};
static guint preview_n_targets = (sizeof (preview_target_table) /
sizeof (preview_target_table[0]));
gtk_drag_source_set (GTK_WIDGET (pattern_preview),
GDK_BUTTON2_MASK,
preview_target_table, preview_n_targets,
GDK_ACTION_COPY);
gimp_dnd_pattern_source_set (GTK_WIDGET (pattern_preview),
gimp_pattern_preview_drag_pattern,
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
@ -184,13 +178,9 @@ gimp_pattern_preview_needs_popup (GimpPreview *preview)
return FALSE;
}
static GimpPattern *
gimp_pattern_preview_drag_pattern (GtkWidget *widget,
gpointer data)
static GimpViewable *
gimp_pattern_preview_drag_viewable (GtkWidget *widget,
gpointer data)
{
GimpPreview *preview;
preview = GIMP_PREVIEW (data);
return GIMP_PATTERN (preview->viewable);
return GIMP_PREVIEW (widget)->viewable;
}

View File

@ -2933,7 +2933,8 @@ cpopup_adjust_blending_menu (GradientEditor *gradient_editor)
for (i = 0; i < num_items; i++)
gtk_signal_handler_block_by_data
(GTK_OBJECT (gradient_editor->control_blending_items[i]), (gpointer) i);
(GTK_OBJECT (gradient_editor->control_blending_items[i]),
gradient_editor);
/* Set state */
if (equal)
@ -2949,7 +2950,8 @@ cpopup_adjust_blending_menu (GradientEditor *gradient_editor)
/* Unblock signals */
for (i = 0; i < num_items; i++)
gtk_signal_handler_unblock_by_data (GTK_OBJECT (gradient_editor->control_blending_items[i]), (gpointer) i);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (gradient_editor->control_blending_items[i]),
gradient_editor);
}
static void
@ -2968,7 +2970,8 @@ cpopup_adjust_coloring_menu (GradientEditor *gradient_editor)
coloring = (int) gradient_editor->control_sel_l->color;
for (i = 0; i < num_items; i++)
gtk_signal_handler_block_by_data (GTK_OBJECT (gradient_editor->control_coloring_items[i]), (gpointer) i);
gtk_signal_handler_block_by_data (GTK_OBJECT (gradient_editor->control_coloring_items[i]),
gradient_editor);
/* Set state */
if (equal)
@ -2984,7 +2987,8 @@ cpopup_adjust_coloring_menu (GradientEditor *gradient_editor)
/* Unblock signals */
for (i = 0; i < num_items; i++)
gtk_signal_handler_unblock_by_data (GTK_OBJECT (gradient_editor->control_coloring_items[i]), (gpointer) i);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (gradient_editor->control_coloring_items[i]),
gradient_editor);
}
static void

View File

@ -34,7 +34,6 @@
#include "gimpdatafactoryview.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpdnd.h"
#include "gimpgradient.h"
#include "gradient_editor.h"
#include "gradient_select.h"
@ -47,9 +46,6 @@
static void gradient_select_change_callbacks (GradientSelect *gsp,
gboolean closing);
static void gradient_select_drop_gradient (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
static void gradient_select_gradient_changed (GimpContext *context,
GimpGradient *gradient,
GradientSelect *gsp);
@ -62,10 +58,11 @@ static void gradient_select_edit_gradient (GimpData *data);
GSList *gradient_active_dialogs = NULL;
/* the main gradient selection dialog */
GradientSelect *gradient_select_dialog = NULL;
GradientSelect *gradient_select_dialog = NULL;
/* gradient editor dialog */
static GradientEditor *gradient_editor_dialog;
/* the main gradient editor dialog */
static GradientEditor *gradient_editor_dialog = NULL;
/* public functions */
@ -179,15 +176,6 @@ gradient_select_new (gchar *title,
gtk_box_pack_start (GTK_BOX (vbox), gsp->view, TRUE, TRUE, 0);
gtk_widget_show (gsp->view);
gimp_gtk_drag_dest_set_by_type (gsp->view,
GTK_DEST_DEFAULT_ALL,
GIMP_TYPE_GRADIENT,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (gsp->view),
GIMP_TYPE_GRADIENT,
gradient_select_drop_gradient,
gsp);
gtk_widget_show (vbox);
gtk_widget_show (gsp->shell);
@ -322,18 +310,6 @@ gradient_select_dialogs_check (void)
}
}
static void
gradient_select_drop_gradient (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
GradientSelect *gsp;
gsp = (GradientSelect *) data;
gimp_context_set_gradient (gsp->context, GIMP_GRADIENT (viewable));
}
static void
gradient_select_gradient_changed (GimpContext *context,
GimpGradient *gradient,

View File

@ -37,7 +37,7 @@ struct _GradientSelect
};
/* list of active dialogs */
/* list of active dialogs */
extern GSList *gradient_active_dialogs;
/* the main gradient selection dialog */

View File

@ -37,7 +37,6 @@
#include "gimpcontext.h"
#include "gimpdata.h"
#include "gimpdatafactory.h"
#include "gimpdnd.h"
#include "gimprc.h"
#include "session.h"
#include "temp_buf.h"
@ -58,9 +57,6 @@
static void brush_select_change_callbacks (BrushSelect *bsp,
gboolean closing);
static void brush_select_drop_brush (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
static void brush_select_brush_changed (GimpContext *context,
GimpBrush *brush,
BrushSelect *bsp);
@ -93,8 +89,9 @@ GSList *brush_active_dialogs = NULL;
/* the main brush selection dialog */
BrushSelect *brush_select_dialog = NULL;
/* Brush editor dialog */
static BrushEditGeneratedWindow *brush_edit_generated_dialog;
/* the main brush editor dialog */
static BrushEditGeneratedWindow *brush_edit_generated_dialog = NULL;
/* public functions */
@ -246,15 +243,6 @@ brush_select_new (gchar *title,
TRUE, TRUE, 0);
gtk_widget_show (bsp->view);
gimp_gtk_drag_dest_set_by_type (bsp->view,
GTK_DEST_DEFAULT_ALL,
GIMP_TYPE_BRUSH,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (bsp->view),
GIMP_TYPE_BRUSH,
brush_select_drop_brush,
bsp);
gtk_widget_show (bsp->brush_selection_box);
gtk_widget_show (bsp->left_box);
@ -264,6 +252,7 @@ brush_select_new (gchar *title,
/* Create the active brush label */
util_box = gtk_hbox_new (FALSE, 0);
gtk_container_set_resize_mode (GTK_CONTAINER (util_box), GTK_RESIZE_QUEUE);
gtk_box_pack_start (GTK_BOX (bsp->options_box), util_box, FALSE, FALSE, 2);
bsp->brush_name = gtk_label_new (_("No Brushes available"));
@ -535,18 +524,6 @@ brush_select_dialogs_check (void)
* Local functions
*/
static void
brush_select_drop_brush (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
BrushSelect *bsp;
bsp = (BrushSelect *) data;
gimp_context_set_brush (bsp->context, GIMP_BRUSH (viewable));
}
static void
brush_select_brush_changed (GimpContext *context,
GimpBrush *brush,
@ -556,6 +533,9 @@ brush_select_brush_changed (GimpContext *context,
{
brush_select_update_active_brush_field (bsp);
gtk_widget_set_sensitive (GIMP_DATA_FACTORY_VIEW (bsp->view)->edit_button,
GIMP_IS_BRUSH_GENERATED (brush));
if (bsp->callback_name)
brush_select_change_callbacks (bsp, FALSE);
}

View File

@ -83,7 +83,6 @@
#include "gimpcontainergridview.h"
#include "gimpdatafactory.h"
#include "gimpdatafactoryview.h"
#include "gimpdnd.h"
#include "gimppreview.h"
@ -1335,108 +1334,38 @@ container_view_scale_callback (GtkAdjustment *adj,
gimp_container_view_set_preview_size (view, ROUND (adj->value));
}
static void
drop_viewable_callback (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
GimpContainerView *view;
view = GIMP_CONTAINER_VIEW (widget);
gimp_context_set_by_type (view->context,
view->container->children_type,
GIMP_OBJECT (viewable));
}
static void
brushes_callback (GtkWidget *widget,
GimpContainerView *view)
{
gtk_drag_dest_unset (GTK_WIDGET (view));
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_brush_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
view->container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (view),
view->container->children_type,
drop_viewable_callback,
NULL);
}
static void
patterns_callback (GtkWidget *widget,
GimpContainerView *view)
{
gtk_drag_dest_unset (GTK_WIDGET (view));
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_pattern_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
view->container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (view),
view->container->children_type,
drop_viewable_callback,
NULL);
}
static void
gradients_callback (GtkWidget *widget,
GimpContainerView *view)
{
gtk_drag_dest_unset (GTK_WIDGET (view));
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_gradient_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
view->container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (view),
view->container->children_type,
drop_viewable_callback,
NULL);
}
static void
palettes_callback (GtkWidget *widget,
GimpContainerView *view)
{
gtk_drag_dest_unset (GTK_WIDGET (view));
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_palette_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
view->container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (view),
view->container->children_type,
drop_viewable_callback,
NULL);
}
static void
images_callback (GtkWidget *widget,
GimpContainerView *view)
{
gtk_drag_dest_unset (GTK_WIDGET (view));
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, image_context);
}
@ -1585,15 +1514,6 @@ container_multi_view_new (gboolean list,
5, 5);
}
gimp_gtk_drag_dest_set_by_type (view,
GTK_DEST_DEFAULT_ALL,
container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (view),
GIMP_CONTAINER_VIEW (view)->container->children_type,
drop_viewable_callback,
NULL);
dialog = gimp_dialog_new (title, "test",
gimp_standard_help_func,
NULL,
@ -1772,7 +1692,7 @@ dialogs_test_gradient_container_list_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Gradient List",
global_gradient_factory,
gradient_editor_set_gradient,
NULL,
gimp_context_get_user (),
24);
}
@ -1820,7 +1740,7 @@ dialogs_test_gradient_container_grid_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Gradient Grid",
global_gradient_factory,
gradient_editor_set_gradient,
NULL,
gimp_context_get_user (),
24);
}

View File

@ -2933,7 +2933,8 @@ cpopup_adjust_blending_menu (GradientEditor *gradient_editor)
for (i = 0; i < num_items; i++)
gtk_signal_handler_block_by_data
(GTK_OBJECT (gradient_editor->control_blending_items[i]), (gpointer) i);
(GTK_OBJECT (gradient_editor->control_blending_items[i]),
gradient_editor);
/* Set state */
if (equal)
@ -2949,7 +2950,8 @@ cpopup_adjust_blending_menu (GradientEditor *gradient_editor)
/* Unblock signals */
for (i = 0; i < num_items; i++)
gtk_signal_handler_unblock_by_data (GTK_OBJECT (gradient_editor->control_blending_items[i]), (gpointer) i);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (gradient_editor->control_blending_items[i]),
gradient_editor);
}
static void
@ -2968,7 +2970,8 @@ cpopup_adjust_coloring_menu (GradientEditor *gradient_editor)
coloring = (int) gradient_editor->control_sel_l->color;
for (i = 0; i < num_items; i++)
gtk_signal_handler_block_by_data (GTK_OBJECT (gradient_editor->control_coloring_items[i]), (gpointer) i);
gtk_signal_handler_block_by_data (GTK_OBJECT (gradient_editor->control_coloring_items[i]),
gradient_editor);
/* Set state */
if (equal)
@ -2984,7 +2987,8 @@ cpopup_adjust_coloring_menu (GradientEditor *gradient_editor)
/* Unblock signals */
for (i = 0; i < num_items; i++)
gtk_signal_handler_unblock_by_data (GTK_OBJECT (gradient_editor->control_coloring_items[i]), (gpointer) i);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (gradient_editor->control_coloring_items[i]),
gradient_editor);
}
static void

View File

@ -34,7 +34,6 @@
#include "gimpdatafactoryview.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpdnd.h"
#include "gimpgradient.h"
#include "gradient_editor.h"
#include "gradient_select.h"
@ -47,9 +46,6 @@
static void gradient_select_change_callbacks (GradientSelect *gsp,
gboolean closing);
static void gradient_select_drop_gradient (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
static void gradient_select_gradient_changed (GimpContext *context,
GimpGradient *gradient,
GradientSelect *gsp);
@ -62,10 +58,11 @@ static void gradient_select_edit_gradient (GimpData *data);
GSList *gradient_active_dialogs = NULL;
/* the main gradient selection dialog */
GradientSelect *gradient_select_dialog = NULL;
GradientSelect *gradient_select_dialog = NULL;
/* gradient editor dialog */
static GradientEditor *gradient_editor_dialog;
/* the main gradient editor dialog */
static GradientEditor *gradient_editor_dialog = NULL;
/* public functions */
@ -179,15 +176,6 @@ gradient_select_new (gchar *title,
gtk_box_pack_start (GTK_BOX (vbox), gsp->view, TRUE, TRUE, 0);
gtk_widget_show (gsp->view);
gimp_gtk_drag_dest_set_by_type (gsp->view,
GTK_DEST_DEFAULT_ALL,
GIMP_TYPE_GRADIENT,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (gsp->view),
GIMP_TYPE_GRADIENT,
gradient_select_drop_gradient,
gsp);
gtk_widget_show (vbox);
gtk_widget_show (gsp->shell);
@ -322,18 +310,6 @@ gradient_select_dialogs_check (void)
}
}
static void
gradient_select_drop_gradient (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
GradientSelect *gsp;
gsp = (GradientSelect *) data;
gimp_context_set_gradient (gsp->context, GIMP_GRADIENT (viewable));
}
static void
gradient_select_gradient_changed (GimpContext *context,
GimpGradient *gradient,

View File

@ -37,7 +37,7 @@ struct _GradientSelect
};
/* list of active dialogs */
/* list of active dialogs */
extern GSList *gradient_active_dialogs;
/* the main gradient selection dialog */

View File

@ -83,7 +83,6 @@
#include "gimpcontainergridview.h"
#include "gimpdatafactory.h"
#include "gimpdatafactoryview.h"
#include "gimpdnd.h"
#include "gimppreview.h"
@ -1335,108 +1334,38 @@ container_view_scale_callback (GtkAdjustment *adj,
gimp_container_view_set_preview_size (view, ROUND (adj->value));
}
static void
drop_viewable_callback (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
GimpContainerView *view;
view = GIMP_CONTAINER_VIEW (widget);
gimp_context_set_by_type (view->context,
view->container->children_type,
GIMP_OBJECT (viewable));
}
static void
brushes_callback (GtkWidget *widget,
GimpContainerView *view)
{
gtk_drag_dest_unset (GTK_WIDGET (view));
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_brush_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
view->container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (view),
view->container->children_type,
drop_viewable_callback,
NULL);
}
static void
patterns_callback (GtkWidget *widget,
GimpContainerView *view)
{
gtk_drag_dest_unset (GTK_WIDGET (view));
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_pattern_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
view->container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (view),
view->container->children_type,
drop_viewable_callback,
NULL);
}
static void
gradients_callback (GtkWidget *widget,
GimpContainerView *view)
{
gtk_drag_dest_unset (GTK_WIDGET (view));
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_gradient_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
view->container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (view),
view->container->children_type,
drop_viewable_callback,
NULL);
}
static void
palettes_callback (GtkWidget *widget,
GimpContainerView *view)
{
gtk_drag_dest_unset (GTK_WIDGET (view));
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_palette_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
view->container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (view),
view->container->children_type,
drop_viewable_callback,
NULL);
}
static void
images_callback (GtkWidget *widget,
GimpContainerView *view)
{
gtk_drag_dest_unset (GTK_WIDGET (view));
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, image_context);
}
@ -1585,15 +1514,6 @@ container_multi_view_new (gboolean list,
5, 5);
}
gimp_gtk_drag_dest_set_by_type (view,
GTK_DEST_DEFAULT_ALL,
container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (view),
GIMP_CONTAINER_VIEW (view)->container->children_type,
drop_viewable_callback,
NULL);
dialog = gimp_dialog_new (title, "test",
gimp_standard_help_func,
NULL,
@ -1772,7 +1692,7 @@ dialogs_test_gradient_container_list_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Gradient List",
global_gradient_factory,
gradient_editor_set_gradient,
NULL,
gimp_context_get_user (),
24);
}
@ -1820,7 +1740,7 @@ dialogs_test_gradient_container_grid_view_cmd_callback (GtkWidget *widget,
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Gradient Grid",
global_gradient_factory,
gradient_editor_set_gradient,
NULL,
gimp_context_get_user (),
24);
}

File diff suppressed because it is too large Load Diff

View File

@ -573,8 +573,6 @@ palette_import_create_from_grad (gchar *name)
gimp_container_add (global_palette_factory->container,
GIMP_OBJECT (palette));
palette_insert_all (palette);
}
}
@ -758,8 +756,6 @@ palette_import_image_make_palette (GHashTable *h_array,
g_slist_free (sorted_list);
gimp_container_add (global_palette_factory->container, GIMP_OBJECT (palette));
palette_insert_all (palette);
}
static void
@ -874,8 +870,6 @@ palette_import_create_from_indexed (GImage *gimage,
}
gimp_container_add (global_palette_factory->container, GIMP_OBJECT (palette));
palette_insert_all (palette);
}
/* the palette import action area callbacks ********************************/

View File

@ -27,31 +27,39 @@
#include "apptypes.h"
#include "appenv.h"
#include "context_manager.h"
#include "dialog_handler.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimpdatafactoryview.h"
#include "gimpdatafactory.h"
#include "gimpdnd.h"
#include "gimppalette.h"
#include "palette_select.h"
#include "palette.h"
#include "paletteP.h"
#include "session.h"
#include "libgimp/gimpintl.h"
#define STD_PALETTE_COLUMNS 6
#define STD_PALETTE_ROWS 5
/* local function prototypes */
static gint palette_select_button_press (GtkWidget *widget,
GdkEventButton *bevent,
static void palette_select_drop_palette (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
static void palette_select_close_callback (GtkWidget *widget,
gpointer data);
static void palette_select_edit_callback (GtkWidget *widget,
gpointer data);
static void palette_select_edit_palette (GimpData *data);
/* list of active dialogs */
static GSList *active_dialogs = NULL;
static GSList *palette_active_dialogs = NULL;
/* public functions */
@ -60,17 +68,14 @@ PaletteSelect *
palette_select_new (const gchar *title,
const gchar *initial_palette)
{
GimpPalette *palette;
PaletteSelect *psp;
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *scrolled_win;
gchar *titles[3];
gint select_pos = -1;
GimpPalette *active = NULL;
palette_select_palette_init ();
static gboolean first_call = TRUE;
psp = g_new0 (PaletteSelect, 1);
psp = g_new (PaletteSelect, 1);
psp->callback_name = NULL;
/* The shell and main vbox */
@ -81,182 +86,99 @@ palette_select_new (const gchar *title,
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
_("Edit"), palette_select_edit_callback,
psp, NULL, NULL, TRUE, FALSE,
_("Close"), palette_select_close_callback,
"_delete_event_", palette_select_close_callback,
psp, NULL, NULL, FALSE, TRUE,
NULL);
vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 1);
gtk_widget_hide (GTK_WIDGET (g_list_nth_data (gtk_container_children (GTK_CONTAINER (GTK_DIALOG (psp->shell)->vbox)), 0)));
gtk_widget_hide (GTK_DIALOG (psp->shell)->action_area);
if (title)
{
psp->context = gimp_context_new (title, NULL);
}
else
{
psp->context = gimp_context_get_user ();
/*
session_set_window_geometry (psp->shell, &palette_select_session_info,
TRUE);
*/
dialog_register (psp->shell);
}
if (no_data && first_call)
gimp_data_factory_data_init (global_palette_factory, FALSE);
first_call = FALSE;
if (title && initial_palette && strlen (initial_palette))
{
active = (GimpPalette *)
gimp_container_get_child_by_name (global_palette_factory->container,
initial_palette);
}
else
{
active = gimp_context_get_palette (gimp_context_get_user ());
}
if (!active)
active = gimp_context_get_palette (gimp_context_get_standard ());
if (title)
gimp_context_set_palette (psp->context, active);
/* The main vbox */
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (psp->shell)->vbox), vbox);
hbox = gtk_hbox_new (FALSE, 8);
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
gtk_widget_show (hbox);
/* The Palette List */
psp->view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_LIST,
global_palette_factory,
palette_select_edit_palette,
psp->context,
64, /* FIXME: SM_PREVIEW_WIDTH */
3, /* FIXME: STD_PALETTE_COLUMNS */
3); /* FIXME: STD_PALETTE_ROWS */
gtk_box_pack_start (GTK_BOX (vbox), psp->view, TRUE, TRUE, 0);
gtk_widget_show (psp->view);
/* clist preview of gradients */
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_ALWAYS);
gtk_box_pack_start (GTK_BOX (hbox), scrolled_win, TRUE, TRUE, 0);
gtk_widget_show (scrolled_win);
gimp_gtk_drag_dest_set_by_type (psp->view,
GTK_DEST_DEFAULT_ALL,
GIMP_TYPE_PALETTE,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (psp->view),
GIMP_TYPE_PALETTE,
palette_select_drop_palette,
psp);
titles[0] = _("Palette");
titles[1] = _("Ncols");
titles[2] = _("Name");
psp->clist = gtk_clist_new_with_titles (3, titles);
gtk_clist_set_shadow_type (GTK_CLIST (psp->clist), GTK_SHADOW_IN);
gtk_clist_set_row_height (GTK_CLIST (psp->clist), SM_PREVIEW_HEIGHT + 2);
gtk_clist_set_use_drag_icons (GTK_CLIST (psp->clist), FALSE);
gtk_clist_column_titles_passive (GTK_CLIST (psp->clist));
gtk_widget_set_usize (psp->clist, 203, 200);
gtk_clist_set_column_width (GTK_CLIST (psp->clist), 0, SM_PREVIEW_WIDTH + 2);
gtk_container_add (GTK_CONTAINER (scrolled_win), psp->clist);
gtk_widget_show (psp->clist);
palette = (GimpPalette *)
gimp_container_get_child_by_name (global_palette_factory->container,
initial_palette);
if (palette)
select_pos = gimp_container_get_child_index (global_palette_factory->container,
GIMP_OBJECT (palette));
gtk_widget_realize (psp->shell);
psp->gc = gdk_gc_new (psp->shell->window);
palette_clist_init (psp->clist, psp->shell, psp->gc);
gtk_signal_connect (GTK_OBJECT (psp->clist), "button_press_event",
GTK_SIGNAL_FUNC (palette_select_button_press),
(gpointer) psp);
/* Now show the dialog */
gtk_widget_show (vbox);
gtk_widget_show (psp->shell);
if (select_pos != -1)
{
gtk_clist_select_row (GTK_CLIST (psp->clist), select_pos, -1);
gtk_clist_moveto (GTK_CLIST (psp->clist), select_pos, 0, 0.0, 0.0);
}
else
gtk_clist_select_row (GTK_CLIST (psp->clist), 0, -1);
active_dialogs = g_slist_append (active_dialogs, psp);
palette_active_dialogs = g_slist_append (palette_active_dialogs, psp);
return psp;
}
void
palette_select_clist_insert_all (GimpPalette *entries)
{
PaletteSelect *psp;
GSList *list;
gint pos;
pos = gimp_container_get_child_index (global_palette_factory->container,
GIMP_OBJECT (entries));
for (list = active_dialogs; list; list = g_slist_next (list))
{
psp = (PaletteSelect *) list->data;
gtk_clist_freeze (GTK_CLIST (psp->clist));
palette_clist_insert (psp->clist, psp->shell, psp->gc, entries, pos);
gtk_clist_thaw (GTK_CLIST (psp->clist));
}
}
void
palette_select_set_text_all (GimpPalette *entries)
{
PaletteSelect *psp;
GSList *list;
gchar *num_buf;
gint pos;
pos = gimp_container_get_child_index (global_palette_factory->container,
GIMP_OBJECT (entries));
num_buf = g_strdup_printf ("%d", entries->n_colors);
for (list = active_dialogs; list; list = g_slist_next (list))
{
psp = (PaletteSelect *) list->data;
gtk_clist_set_text (GTK_CLIST (psp->clist), pos, 1, num_buf);
}
g_free (num_buf);
}
void
palette_select_refresh_all (void)
{
PaletteSelect *psp;
GSList *list;
for (list = active_dialogs; list; list = g_slist_next (list))
{
psp = (PaletteSelect *) list->data;
gtk_clist_freeze (GTK_CLIST (psp->clist));
gtk_clist_clear (GTK_CLIST (psp->clist));
palette_clist_init (psp->clist, psp->shell, psp->gc);
gtk_clist_thaw (GTK_CLIST (psp->clist));
}
}
/* local functions */
static gint
palette_select_button_press (GtkWidget *widget,
GdkEventButton *bevent,
gpointer data)
{
PaletteSelect *psp;
psp = (PaletteSelect *) data;
if (bevent->button == 1 && bevent->type == GDK_2BUTTON_PRESS)
{
palette_select_edit_callback (widget, data);
return TRUE;
}
return FALSE;
}
static void
palette_select_edit_callback (GtkWidget *widget,
gpointer data)
palette_select_drop_palette (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
GimpPalette *p_entries = NULL;
PaletteSelect *psp;
GList *sel_list;
psp = (PaletteSelect *) data;
sel_list = GTK_CLIST (psp->clist)->selection;
while (sel_list)
{
gint row;
row = GPOINTER_TO_INT (sel_list->data);
p_entries =
(GimpPalette *) gtk_clist_get_row_data (GTK_CLIST (psp->clist), row);
palette_create_edit (p_entries);
/* One only */
return;
}
gimp_context_set_palette (psp->context, GIMP_PALETTE (viewable));
}
static void
@ -270,7 +192,7 @@ palette_select_free (PaletteSelect *psp)
*/
/* remove from active list */
active_dialogs = g_slist_remove (active_dialogs, psp);
palette_active_dialogs = g_slist_remove (palette_active_dialogs, psp);
g_free (psp);
}
@ -290,3 +212,13 @@ palette_select_close_callback (GtkWidget *widget,
gtk_widget_destroy (psp->shell);
palette_select_free (psp);
}
static void
palette_select_edit_palette (GimpData *data)
{
GimpPalette *palette;
palette = GIMP_PALETTE (data);
palette_create_edit (palette);
}

View File

@ -28,19 +28,17 @@ typedef struct _PaletteSelect PaletteSelect;
struct _PaletteSelect
{
GtkWidget *shell;
GtkWidget *clist;
GdkGC *gc;
gchar *callback_name;
GtkWidget *shell;
GtkWidget *view;
gchar *callback_name;
GimpContext *context;
};
PaletteSelect * palette_select_new (const gchar *title,
const gchar *initial_palette);
void palette_select_clist_insert_all (GimpPalette *palette);
void palette_select_set_text_all (GimpPalette *palette);
void palette_select_refresh_all (void);
#endif /* __PALETTE_SELECT_H__ */

View File

@ -30,10 +30,9 @@
#include "context_manager.h"
#include "dialog_handler.h"
#include "gimpcontainer.h"
#include "gimpdatafactoryview.h"
#include "gimpcontext.h"
#include "gimpdatafactoryview.h"
#include "gimpdatafactory.h"
#include "gimpdnd.h"
#include "gimppattern.h"
#include "pattern_select.h"
#include "session.h"
@ -53,9 +52,6 @@
static void pattern_select_change_callbacks (PatternSelect *psp,
gboolean closing);
static void pattern_select_drop_pattern (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
static void pattern_select_pattern_changed (GimpContext *context,
GimpPattern *pattern,
PatternSelect *psp);
@ -209,15 +205,6 @@ pattern_select_new (gchar *title,
gtk_box_pack_start (GTK_BOX (vbox), psp->view, TRUE, TRUE, 0);
gtk_widget_show (psp->view);
gimp_gtk_drag_dest_set_by_type (psp->view,
GTK_DEST_DEFAULT_ALL,
GIMP_TYPE_PATTERN,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (psp->view),
GIMP_TYPE_PATTERN,
pattern_select_drop_pattern,
psp);
gtk_widget_show (vbox);
/* add callbacks to keep the display area current */
@ -353,19 +340,6 @@ pattern_select_dialogs_check (void)
* Local functions
*/
static void
pattern_select_drop_pattern (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
PatternSelect *psp;
psp = (PatternSelect *) data;
gimp_context_set_pattern (psp->context, GIMP_PATTERN (viewable));
}
static void
pattern_select_pattern_changed (GimpContext *context,
GimpPattern *pattern,

File diff suppressed because it is too large Load Diff

View File

@ -20,19 +20,8 @@
#define __PALETTE_P_H__
void palette_clist_init (GtkWidget *clist,
GtkWidget *shell,
GdkGC *gc);
void palette_clist_insert (GtkWidget *clist,
GtkWidget *shell,
GdkGC *gc,
GimpPalette *palette,
gint pos);
void palette_select_palette_init (void);
void palette_create_edit (GimpPalette *palette);
void palette_insert_all (GimpPalette *palette);
#endif /* __PALETTE_P_H__ */

View File

@ -573,8 +573,6 @@ palette_import_create_from_grad (gchar *name)
gimp_container_add (global_palette_factory->container,
GIMP_OBJECT (palette));
palette_insert_all (palette);
}
}
@ -758,8 +756,6 @@ palette_import_image_make_palette (GHashTable *h_array,
g_slist_free (sorted_list);
gimp_container_add (global_palette_factory->container, GIMP_OBJECT (palette));
palette_insert_all (palette);
}
static void
@ -874,8 +870,6 @@ palette_import_create_from_indexed (GImage *gimage,
}
gimp_container_add (global_palette_factory->container, GIMP_OBJECT (palette));
palette_insert_all (palette);
}
/* the palette import action area callbacks ********************************/

View File

@ -27,31 +27,39 @@
#include "apptypes.h"
#include "appenv.h"
#include "context_manager.h"
#include "dialog_handler.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimpdatafactoryview.h"
#include "gimpdatafactory.h"
#include "gimpdnd.h"
#include "gimppalette.h"
#include "palette_select.h"
#include "palette.h"
#include "paletteP.h"
#include "session.h"
#include "libgimp/gimpintl.h"
#define STD_PALETTE_COLUMNS 6
#define STD_PALETTE_ROWS 5
/* local function prototypes */
static gint palette_select_button_press (GtkWidget *widget,
GdkEventButton *bevent,
static void palette_select_drop_palette (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
static void palette_select_close_callback (GtkWidget *widget,
gpointer data);
static void palette_select_edit_callback (GtkWidget *widget,
gpointer data);
static void palette_select_edit_palette (GimpData *data);
/* list of active dialogs */
static GSList *active_dialogs = NULL;
static GSList *palette_active_dialogs = NULL;
/* public functions */
@ -60,17 +68,14 @@ PaletteSelect *
palette_select_new (const gchar *title,
const gchar *initial_palette)
{
GimpPalette *palette;
PaletteSelect *psp;
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *scrolled_win;
gchar *titles[3];
gint select_pos = -1;
GimpPalette *active = NULL;
palette_select_palette_init ();
static gboolean first_call = TRUE;
psp = g_new0 (PaletteSelect, 1);
psp = g_new (PaletteSelect, 1);
psp->callback_name = NULL;
/* The shell and main vbox */
@ -81,182 +86,99 @@ palette_select_new (const gchar *title,
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
_("Edit"), palette_select_edit_callback,
psp, NULL, NULL, TRUE, FALSE,
_("Close"), palette_select_close_callback,
"_delete_event_", palette_select_close_callback,
psp, NULL, NULL, FALSE, TRUE,
NULL);
vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 1);
gtk_widget_hide (GTK_WIDGET (g_list_nth_data (gtk_container_children (GTK_CONTAINER (GTK_DIALOG (psp->shell)->vbox)), 0)));
gtk_widget_hide (GTK_DIALOG (psp->shell)->action_area);
if (title)
{
psp->context = gimp_context_new (title, NULL);
}
else
{
psp->context = gimp_context_get_user ();
/*
session_set_window_geometry (psp->shell, &palette_select_session_info,
TRUE);
*/
dialog_register (psp->shell);
}
if (no_data && first_call)
gimp_data_factory_data_init (global_palette_factory, FALSE);
first_call = FALSE;
if (title && initial_palette && strlen (initial_palette))
{
active = (GimpPalette *)
gimp_container_get_child_by_name (global_palette_factory->container,
initial_palette);
}
else
{
active = gimp_context_get_palette (gimp_context_get_user ());
}
if (!active)
active = gimp_context_get_palette (gimp_context_get_standard ());
if (title)
gimp_context_set_palette (psp->context, active);
/* The main vbox */
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (psp->shell)->vbox), vbox);
hbox = gtk_hbox_new (FALSE, 8);
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
gtk_widget_show (hbox);
/* The Palette List */
psp->view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_LIST,
global_palette_factory,
palette_select_edit_palette,
psp->context,
64, /* FIXME: SM_PREVIEW_WIDTH */
3, /* FIXME: STD_PALETTE_COLUMNS */
3); /* FIXME: STD_PALETTE_ROWS */
gtk_box_pack_start (GTK_BOX (vbox), psp->view, TRUE, TRUE, 0);
gtk_widget_show (psp->view);
/* clist preview of gradients */
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_ALWAYS);
gtk_box_pack_start (GTK_BOX (hbox), scrolled_win, TRUE, TRUE, 0);
gtk_widget_show (scrolled_win);
gimp_gtk_drag_dest_set_by_type (psp->view,
GTK_DEST_DEFAULT_ALL,
GIMP_TYPE_PALETTE,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (psp->view),
GIMP_TYPE_PALETTE,
palette_select_drop_palette,
psp);
titles[0] = _("Palette");
titles[1] = _("Ncols");
titles[2] = _("Name");
psp->clist = gtk_clist_new_with_titles (3, titles);
gtk_clist_set_shadow_type (GTK_CLIST (psp->clist), GTK_SHADOW_IN);
gtk_clist_set_row_height (GTK_CLIST (psp->clist), SM_PREVIEW_HEIGHT + 2);
gtk_clist_set_use_drag_icons (GTK_CLIST (psp->clist), FALSE);
gtk_clist_column_titles_passive (GTK_CLIST (psp->clist));
gtk_widget_set_usize (psp->clist, 203, 200);
gtk_clist_set_column_width (GTK_CLIST (psp->clist), 0, SM_PREVIEW_WIDTH + 2);
gtk_container_add (GTK_CONTAINER (scrolled_win), psp->clist);
gtk_widget_show (psp->clist);
palette = (GimpPalette *)
gimp_container_get_child_by_name (global_palette_factory->container,
initial_palette);
if (palette)
select_pos = gimp_container_get_child_index (global_palette_factory->container,
GIMP_OBJECT (palette));
gtk_widget_realize (psp->shell);
psp->gc = gdk_gc_new (psp->shell->window);
palette_clist_init (psp->clist, psp->shell, psp->gc);
gtk_signal_connect (GTK_OBJECT (psp->clist), "button_press_event",
GTK_SIGNAL_FUNC (palette_select_button_press),
(gpointer) psp);
/* Now show the dialog */
gtk_widget_show (vbox);
gtk_widget_show (psp->shell);
if (select_pos != -1)
{
gtk_clist_select_row (GTK_CLIST (psp->clist), select_pos, -1);
gtk_clist_moveto (GTK_CLIST (psp->clist), select_pos, 0, 0.0, 0.0);
}
else
gtk_clist_select_row (GTK_CLIST (psp->clist), 0, -1);
active_dialogs = g_slist_append (active_dialogs, psp);
palette_active_dialogs = g_slist_append (palette_active_dialogs, psp);
return psp;
}
void
palette_select_clist_insert_all (GimpPalette *entries)
{
PaletteSelect *psp;
GSList *list;
gint pos;
pos = gimp_container_get_child_index (global_palette_factory->container,
GIMP_OBJECT (entries));
for (list = active_dialogs; list; list = g_slist_next (list))
{
psp = (PaletteSelect *) list->data;
gtk_clist_freeze (GTK_CLIST (psp->clist));
palette_clist_insert (psp->clist, psp->shell, psp->gc, entries, pos);
gtk_clist_thaw (GTK_CLIST (psp->clist));
}
}
void
palette_select_set_text_all (GimpPalette *entries)
{
PaletteSelect *psp;
GSList *list;
gchar *num_buf;
gint pos;
pos = gimp_container_get_child_index (global_palette_factory->container,
GIMP_OBJECT (entries));
num_buf = g_strdup_printf ("%d", entries->n_colors);
for (list = active_dialogs; list; list = g_slist_next (list))
{
psp = (PaletteSelect *) list->data;
gtk_clist_set_text (GTK_CLIST (psp->clist), pos, 1, num_buf);
}
g_free (num_buf);
}
void
palette_select_refresh_all (void)
{
PaletteSelect *psp;
GSList *list;
for (list = active_dialogs; list; list = g_slist_next (list))
{
psp = (PaletteSelect *) list->data;
gtk_clist_freeze (GTK_CLIST (psp->clist));
gtk_clist_clear (GTK_CLIST (psp->clist));
palette_clist_init (psp->clist, psp->shell, psp->gc);
gtk_clist_thaw (GTK_CLIST (psp->clist));
}
}
/* local functions */
static gint
palette_select_button_press (GtkWidget *widget,
GdkEventButton *bevent,
gpointer data)
{
PaletteSelect *psp;
psp = (PaletteSelect *) data;
if (bevent->button == 1 && bevent->type == GDK_2BUTTON_PRESS)
{
palette_select_edit_callback (widget, data);
return TRUE;
}
return FALSE;
}
static void
palette_select_edit_callback (GtkWidget *widget,
gpointer data)
palette_select_drop_palette (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
GimpPalette *p_entries = NULL;
PaletteSelect *psp;
GList *sel_list;
psp = (PaletteSelect *) data;
sel_list = GTK_CLIST (psp->clist)->selection;
while (sel_list)
{
gint row;
row = GPOINTER_TO_INT (sel_list->data);
p_entries =
(GimpPalette *) gtk_clist_get_row_data (GTK_CLIST (psp->clist), row);
palette_create_edit (p_entries);
/* One only */
return;
}
gimp_context_set_palette (psp->context, GIMP_PALETTE (viewable));
}
static void
@ -270,7 +192,7 @@ palette_select_free (PaletteSelect *psp)
*/
/* remove from active list */
active_dialogs = g_slist_remove (active_dialogs, psp);
palette_active_dialogs = g_slist_remove (palette_active_dialogs, psp);
g_free (psp);
}
@ -290,3 +212,13 @@ palette_select_close_callback (GtkWidget *widget,
gtk_widget_destroy (psp->shell);
palette_select_free (psp);
}
static void
palette_select_edit_palette (GimpData *data)
{
GimpPalette *palette;
palette = GIMP_PALETTE (data);
palette_create_edit (palette);
}

View File

@ -28,19 +28,17 @@ typedef struct _PaletteSelect PaletteSelect;
struct _PaletteSelect
{
GtkWidget *shell;
GtkWidget *clist;
GdkGC *gc;
gchar *callback_name;
GtkWidget *shell;
GtkWidget *view;
gchar *callback_name;
GimpContext *context;
};
PaletteSelect * palette_select_new (const gchar *title,
const gchar *initial_palette);
void palette_select_clist_insert_all (GimpPalette *palette);
void palette_select_set_text_all (GimpPalette *palette);
void palette_select_refresh_all (void);
#endif /* __PALETTE_SELECT_H__ */

View File

@ -30,10 +30,9 @@
#include "context_manager.h"
#include "dialog_handler.h"
#include "gimpcontainer.h"
#include "gimpdatafactoryview.h"
#include "gimpcontext.h"
#include "gimpdatafactoryview.h"
#include "gimpdatafactory.h"
#include "gimpdnd.h"
#include "gimppattern.h"
#include "pattern_select.h"
#include "session.h"
@ -53,9 +52,6 @@
static void pattern_select_change_callbacks (PatternSelect *psp,
gboolean closing);
static void pattern_select_drop_pattern (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
static void pattern_select_pattern_changed (GimpContext *context,
GimpPattern *pattern,
PatternSelect *psp);
@ -209,15 +205,6 @@ pattern_select_new (gchar *title,
gtk_box_pack_start (GTK_BOX (vbox), psp->view, TRUE, TRUE, 0);
gtk_widget_show (psp->view);
gimp_gtk_drag_dest_set_by_type (psp->view,
GTK_DEST_DEFAULT_ALL,
GIMP_TYPE_PATTERN,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (psp->view),
GIMP_TYPE_PATTERN,
pattern_select_drop_pattern,
psp);
gtk_widget_show (vbox);
/* add callbacks to keep the display area current */
@ -353,19 +340,6 @@ pattern_select_dialogs_check (void)
* Local functions
*/
static void
pattern_select_drop_pattern (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
PatternSelect *psp;
psp = (PatternSelect *) data;
gimp_context_set_pattern (psp->context, GIMP_PATTERN (viewable));
}
static void
pattern_select_pattern_changed (GimpContext *context,
GimpPattern *pattern,

View File

@ -41,8 +41,8 @@ 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 GimpBrush * gimp_brush_preview_drag_brush (GtkWidget *widget,
gpointer data);
static GimpViewable * gimp_brush_preview_drag_viewable (GtkWidget *widget,
gpointer data);
static GimpPreviewClass *parent_class = NULL;
@ -94,20 +94,14 @@ gimp_brush_preview_class_init (GimpBrushPreviewClass *klass)
static void
gimp_brush_preview_init (GimpBrushPreview *brush_preview)
{
static GtkTargetEntry preview_target_table[] =
{
GIMP_TARGET_BRUSH
};
static guint preview_n_targets = (sizeof (preview_target_table) /
sizeof (preview_target_table[0]));
gtk_drag_source_set (GTK_WIDGET (brush_preview),
GDK_BUTTON2_MASK,
preview_target_table, preview_n_targets,
GDK_ACTION_COPY);
gimp_dnd_brush_source_set (GTK_WIDGET (brush_preview),
gimp_brush_preview_drag_brush,
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;
@ -379,13 +373,9 @@ gimp_brush_preview_render_timeout_func (GimpBrushPreview *brush_preview)
return TRUE;
}
static GimpBrush *
gimp_brush_preview_drag_brush (GtkWidget *widget,
gpointer data)
static GimpViewable *
gimp_brush_preview_drag_viewable (GtkWidget *widget,
gpointer data)
{
GimpPreview *preview;
preview = GIMP_PREVIEW (data);
return GIMP_BRUSH (preview->viewable);
return GIMP_PREVIEW (widget)->viewable;
}

View File

@ -54,6 +54,8 @@ static void gimp_container_grid_view_clear_items (GimpContainerView *v
static void gimp_container_grid_view_set_preview_size (GimpContainerView *view);
static void gimp_container_grid_view_item_selected (GtkWidget *widget,
gpointer data);
static void gimp_container_grid_view_item_activate (GtkWidget *widget,
gpointer data);
static void gimp_container_grid_view_highlight_item (GimpContainerView *view,
GimpViewable *viewable,
gpointer insert_data);
@ -237,6 +239,10 @@ gimp_container_grid_view_insert_item (GimpContainerView *view,
GTK_SIGNAL_FUNC (gimp_container_grid_view_item_selected),
view);
gtk_signal_connect (GTK_OBJECT (preview), "double_clicked",
GTK_SIGNAL_FUNC (gimp_container_grid_view_item_activate),
view);
return (gpointer) preview;
}
@ -338,6 +344,14 @@ gimp_container_grid_view_item_selected (GtkWidget *widget,
GIMP_PREVIEW (widget)->viewable);
}
static void
gimp_container_grid_view_item_activate (GtkWidget *widget,
gpointer data)
{
gimp_container_view_item_activate (GIMP_CONTAINER_VIEW (data),
GIMP_PREVIEW (widget)->viewable);
}
static void
gimp_container_grid_view_highlight_item (GimpContainerView *view,
GimpViewable *viewable,

View File

@ -28,6 +28,7 @@
#include "gimpcontainer.h"
#include "gimpcontainerlistview.h"
#include "gimpcontext.h"
#include "gimpdnd.h"
#include "gimplist.h"
#include "gimppreview.h"
@ -57,6 +58,11 @@ static void gimp_container_list_view_name_changed (GimpViewable *v
static void gimp_container_list_view_item_selected (GtkWidget *widget,
GtkWidget *child,
gpointer data);
static gint gimp_container_list_view_item_activate (GtkWidget *widget,
GdkEventButton *bevent,
gpointer data);
static GimpViewable * gimp_container_list_view_drag_viewable (GtkWidget *widget,
gpointer data);
static GimpContainerViewClass *parent_class = NULL;
@ -236,6 +242,19 @@ gimp_container_list_view_insert_item (GimpContainerView *view,
label,
GTK_OBJECT (list_view));
gtk_signal_connect (GTK_OBJECT (list_item), "button_press_event",
GTK_SIGNAL_FUNC (gimp_container_list_view_item_activate),
list_view);
gimp_gtk_drag_source_set_by_type (list_item,
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
view->container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_source_set (GTK_WIDGET (list_item),
view->container->children_type,
gimp_container_list_view_drag_viewable,
list_view);
gtk_widget_show (list_item);
list = g_list_prepend (NULL, list_item);
@ -417,6 +436,35 @@ gimp_container_list_view_item_selected (GtkWidget *widget,
viewable = GIMP_PREVIEW (gtk_object_get_data (GTK_OBJECT (child),
"preview"))->viewable;
gimp_container_view_item_selected (GIMP_CONTAINER_VIEW (data),
viewable);
gimp_container_view_item_selected (GIMP_CONTAINER_VIEW (data), viewable);
}
static gint
gimp_container_list_view_item_activate (GtkWidget *widget,
GdkEventButton *bevent,
gpointer data)
{
if (bevent->type == GDK_2BUTTON_PRESS)
{
GimpViewable *viewable;
viewable = GIMP_PREVIEW (gtk_object_get_data (GTK_OBJECT (widget),
"preview"))->viewable;
gimp_container_view_item_activate (GIMP_CONTAINER_VIEW (data), viewable);
}
return FALSE;
}
static GimpViewable *
gimp_container_list_view_drag_viewable (GtkWidget *widget,
gpointer data)
{
GimpViewable *viewable;
viewable = GIMP_PREVIEW (gtk_object_get_data (GTK_OBJECT (widget),
"preview"))->viewable;
return viewable;
}

View File

@ -25,6 +25,7 @@
#include "gimpcontainer.h"
#include "gimpcontainerview.h"
#include "gimpcontext.h"
#include "gimpdnd.h"
#include "gimpmarshal.h"
#include "gimpviewable.h"
@ -35,6 +36,7 @@ enum
REMOVE_ITEM,
REORDER_ITEM,
SELECT_ITEM,
ACTIVATE_ITEM,
CLEAR_ITEMS,
SET_PREVIEW_SIZE,
LAST_SIGNAL
@ -64,6 +66,9 @@ static void gimp_container_view_reorder (GimpContainerView *view,
static void gimp_container_view_context_changed (GimpContext *context,
GimpViewable *viewable,
GimpContainerView *view);
static void gimp_container_view_drop_viewable_callback (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
static guint view_signals[LAST_SIGNAL] = { 0 };
@ -150,6 +155,17 @@ gimp_container_view_class_init (GimpContainerViewClass *klass)
GIMP_TYPE_OBJECT,
GTK_TYPE_POINTER);
view_signals[ACTIVATE_ITEM] =
gtk_signal_new ("activate_item",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpContainerViewClass,
activate_item),
gtk_marshal_NONE__POINTER_POINTER,
GTK_TYPE_NONE, 2,
GIMP_TYPE_OBJECT,
GTK_TYPE_POINTER);
view_signals[CLEAR_ITEMS] =
gtk_signal_new ("clear_items",
GTK_RUN_FIRST,
@ -176,6 +192,7 @@ gimp_container_view_class_init (GimpContainerViewClass *klass)
klass->remove_item = NULL;
klass->reorder_item = NULL;
klass->select_item = NULL;
klass->activate_item = NULL;
klass->clear_items = gimp_container_view_real_clear_items;
klass->set_preview_size = NULL;
}
@ -244,6 +261,10 @@ gimp_container_view_set_container (GimpContainerView *view,
gtk_signal_disconnect_by_func (GTK_OBJECT (view->context),
gimp_container_view_context_changed,
view);
gtk_drag_dest_unset (GTK_WIDGET (view));
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
}
}
@ -285,6 +306,15 @@ gimp_container_view_set_container (GimpContainerView *view,
gimp_container_view_select_item (view,
object ? GIMP_VIEWABLE (object): NULL);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
view->container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (view),
view->container->children_type,
gimp_container_view_drop_viewable_callback,
NULL);
}
}
}
@ -305,6 +335,10 @@ gimp_container_view_set_context (GimpContainerView *view,
gtk_signal_disconnect_by_func (GTK_OBJECT (view->context),
gimp_container_view_context_changed,
view);
gtk_drag_dest_unset (GTK_WIDGET (view));
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
}
view->context = context;
@ -326,6 +360,15 @@ gimp_container_view_set_context (GimpContainerView *view,
gimp_container_view_select_item (view,
object ? GIMP_VIEWABLE (object) : NULL);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
view->container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (view),
view->container->children_type,
gimp_container_view_drop_viewable_callback,
NULL);
}
}
@ -358,6 +401,23 @@ gimp_container_view_select_item (GimpContainerView *view,
viewable, insert_data);
}
void
gimp_container_view_activate_item (GimpContainerView *view,
GimpViewable *viewable)
{
gpointer insert_data;
g_return_if_fail (view != NULL);
g_return_if_fail (GIMP_IS_CONTAINER_VIEW (view));
g_return_if_fail (viewable != NULL);
g_return_if_fail (GIMP_IS_VIEWABLE (viewable));
insert_data = g_hash_table_lookup (view->hash_table, viewable);
gtk_signal_emit (GTK_OBJECT (view), view_signals[ACTIVATE_ITEM],
viewable, insert_data);
}
void
gimp_container_view_item_selected (GimpContainerView *view,
GimpViewable *viewable)
@ -375,6 +435,18 @@ gimp_container_view_item_selected (GimpContainerView *view,
GIMP_OBJECT (viewable));
}
void
gimp_container_view_item_activate (GimpContainerView *view,
GimpViewable *viewable)
{
g_return_if_fail (view != NULL);
g_return_if_fail (GIMP_IS_CONTAINER_VIEW (view));
g_return_if_fail (viewable != NULL);
g_return_if_fail (GIMP_IS_VIEWABLE (viewable));
gimp_container_view_activate_item (view, viewable);
}
static void
gimp_container_view_clear_items (GimpContainerView *view)
{
@ -465,3 +537,17 @@ gimp_container_view_context_changed (GimpContext *context,
gtk_signal_emit (GTK_OBJECT (view), view_signals[SELECT_ITEM],
viewable, insert_data);
}
static void
gimp_container_view_drop_viewable_callback (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
GimpContainerView *view;
view = GIMP_CONTAINER_VIEW (widget);
gimp_context_set_by_type (view->context,
view->container->children_type,
GIMP_OBJECT (viewable));
}

View File

@ -61,6 +61,9 @@ struct _GimpContainerViewClass
void (* select_item) (GimpContainerView *view,
GimpViewable *object,
gpointer insert_data);
void (* activate_item) (GimpContainerView *view,
GimpViewable *object,
gpointer insert_data);
void (* clear_items) (GimpContainerView *view);
void (* set_preview_size) (GimpContainerView *view);
};
@ -76,12 +79,16 @@ void gimp_container_view_set_preview_size (GimpContainerView *view,
gint preview_size);
void gimp_container_view_select_item (GimpContainerView *view,
GimpViewable *viewable);
void gimp_container_view_activate_item (GimpContainerView *view,
GimpViewable *viewable);
/* private */
void gimp_container_view_item_selected (GimpContainerView *view,
GimpViewable *item);
void gimp_container_view_item_activate (GimpContainerView *view,
GimpViewable *item);
#endif /* __GIMP_CONTAINER_VIEW_H__ */

View File

@ -32,6 +32,7 @@
#include "gimpcontainergridview.h"
#include "gimpcontainerlistview.h"
#include "gimpcontext.h"
#include "gimpdnd.h"
#include "gimpmarshal.h"
#include "gimpviewable.h"
@ -52,16 +53,29 @@ static void gimp_data_factory_view_new_clicked (GtkWidget *wid
GimpDataFactoryView *view);
static void gimp_data_factory_view_duplicate_clicked (GtkWidget *widget,
GimpDataFactoryView *view);
static void gimp_data_factory_view_duplicate_dropped (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
static void gimp_data_factory_view_edit_clicked (GtkWidget *widget,
GimpDataFactoryView *view);
static void gimp_data_factory_view_edit_dropped (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
static void gimp_data_factory_view_delete_clicked (GtkWidget *widget,
GimpDataFactoryView *view);
static void gimp_data_factory_view_delete_dropped (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
static void gimp_data_factory_view_refresh_clicked (GtkWidget *widget,
GimpDataFactoryView *view);
static void gimp_data_factory_view_data_changed (GimpContext *context,
GimpData *data,
GimpDataFactoryView *view);
static void gimp_data_factory_view_data_activate (GtkWidget *context,
GimpData *data,
gpointer insert_data,
GimpDataFactoryView *view);
static GtkVBoxClass *parent_class = NULL;
@ -277,6 +291,42 @@ gimp_data_factory_view_new (GimpViewType view_type,
factory_view,
GTK_OBJECT (factory_view));
gtk_signal_connect_while_alive
(GTK_OBJECT (factory_view->view), "activate_item",
GTK_SIGNAL_FUNC (gimp_data_factory_view_data_activate),
factory_view,
GTK_OBJECT (factory_view));
/* drop to "duplicate" */
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (factory_view->duplicate_button),
GTK_DEST_DEFAULT_ALL,
factory_view->factory->container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (factory_view->duplicate_button),
factory_view->factory->container->children_type,
gimp_data_factory_view_duplicate_dropped,
factory_view);
/* drop to "edit" */
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (factory_view->edit_button),
GTK_DEST_DEFAULT_ALL,
factory_view->factory->container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (factory_view->edit_button),
factory_view->factory->container->children_type,
gimp_data_factory_view_edit_dropped,
factory_view);
/* drop to "delete" */
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (factory_view->delete_button),
GTK_DEST_DEFAULT_ALL,
factory_view->factory->container->children_type,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (GTK_WIDGET (factory_view->delete_button),
factory_view->factory->container->children_type,
gimp_data_factory_view_delete_dropped,
factory_view);
/* set button sensitivity */
gimp_data_factory_view_data_changed
(context,
@ -346,6 +396,26 @@ gimp_data_factory_view_duplicate_clicked (GtkWidget *widget,
}
}
static void
gimp_data_factory_view_duplicate_dropped (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
GimpDataFactoryView *view;
view = (GimpDataFactoryView *) data;
if (viewable && gimp_container_have (view->factory->container,
GIMP_OBJECT (viewable)))
{
gimp_context_set_by_type (view->view->context,
view->factory->container->children_type,
GIMP_OBJECT (viewable));
gimp_data_factory_view_duplicate_clicked (NULL, data);
}
}
static void
gimp_data_factory_view_edit_clicked (GtkWidget *widget,
GimpDataFactoryView *view)
@ -365,6 +435,26 @@ gimp_data_factory_view_edit_clicked (GtkWidget *widget,
}
}
static void
gimp_data_factory_view_edit_dropped (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
GimpDataFactoryView *view;
view = (GimpDataFactoryView *) data;
if (viewable && gimp_container_have (view->factory->container,
GIMP_OBJECT (viewable)))
{
gimp_context_set_by_type (view->view->context,
view->factory->container->children_type,
GIMP_OBJECT (viewable));
gimp_data_factory_view_edit_clicked (NULL, data);
}
}
typedef struct _GimpDataDeleteData GimpDataDeleteData;
@ -444,6 +534,26 @@ gimp_data_factory_view_delete_clicked (GtkWidget *widget,
}
}
static void
gimp_data_factory_view_delete_dropped (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
GimpDataFactoryView *view;
view = (GimpDataFactoryView *) data;
if (viewable && gimp_container_have (view->factory->container,
GIMP_OBJECT (viewable)))
{
gimp_context_set_by_type (view->view->context,
view->factory->container->children_type,
GIMP_OBJECT (viewable));
gimp_data_factory_view_delete_clicked (NULL, data);
}
}
static void
gimp_data_factory_view_refresh_clicked (GtkWidget *widget,
GimpDataFactoryView *view)
@ -466,11 +576,24 @@ gimp_data_factory_view_data_changed (GimpContext *context,
duplicate_sensitive =
(GIMP_DATA_CLASS (GTK_OBJECT (data)->klass)->duplicate != NULL);
edit_sensitive = (view->data_edit_func != NULL);
delete_sensitive = TRUE; /* TODO: check permissions */
edit_sensitive = (view->data_edit_func != NULL);
delete_sensitive = TRUE; /* TODO: check permissions */
}
gtk_widget_set_sensitive (view->duplicate_button, duplicate_sensitive);
gtk_widget_set_sensitive (view->edit_button, edit_sensitive);
gtk_widget_set_sensitive (view->delete_button, delete_sensitive);
}
static void
gimp_data_factory_view_data_activate (GtkWidget *widget,
GimpData *data,
gpointer insert_data,
GimpDataFactoryView *view)
{
if (data && gimp_container_have (view->factory->container,
GIMP_OBJECT (data)))
{
gimp_data_factory_view_edit_clicked (NULL, view);
}
}

View File

@ -624,6 +624,79 @@ gimp_dnd_color_dest_unset (GtkWidget *widget)
/* GimpViewable (by GtkType) dnd functions */
/*********************************************/
static const GtkTargetEntry brush_target_table[] =
{
GIMP_TARGET_BRUSH
};
static const guint brush_n_targets = (sizeof (brush_target_table) /
sizeof (brush_target_table[0]));
static const GtkTargetEntry pattern_target_table[] =
{
GIMP_TARGET_PATTERN
};
static const guint pattern_n_targets = (sizeof (pattern_target_table) /
sizeof (pattern_target_table[0]));
static const GtkTargetEntry gradient_target_table[] =
{
GIMP_TARGET_GRADIENT
};
static const guint gradient_n_targets = (sizeof (gradient_target_table) /
sizeof (gradient_target_table[0]));
static const GtkTargetEntry palette_target_table[] =
{
GIMP_TARGET_PALETTE
};
static const guint palette_n_targets = (sizeof (palette_target_table) /
sizeof (palette_target_table[0]));
void
gimp_gtk_drag_source_set_by_type (GtkWidget *widget,
GdkModifierType start_button_mask,
GtkType type,
GdkDragAction actions)
{
const GtkTargetEntry *target_table = NULL;
guint n_targets = 0;
if (type == GIMP_TYPE_BRUSH)
{
target_table = brush_target_table;
n_targets = brush_n_targets;
}
else if (type == GIMP_TYPE_PATTERN)
{
target_table = pattern_target_table;
n_targets = pattern_n_targets;
}
else if (type == GIMP_TYPE_GRADIENT)
{
target_table = gradient_target_table;
n_targets = gradient_n_targets;
}
else if (type == GIMP_TYPE_PALETTE)
{
target_table = palette_target_table;
n_targets = palette_n_targets;
}
else
{
g_warning ("%s(): unsupported GtkType", G_GNUC_FUNCTION);
}
if (target_table && n_targets)
{
gtk_drag_source_set (widget, start_button_mask,
target_table,
n_targets,
actions);
}
}
void
gimp_gtk_drag_dest_set_by_type (GtkWidget *widget,
GtkDestDefaults flags,
@ -633,34 +706,6 @@ gimp_gtk_drag_dest_set_by_type (GtkWidget *widget,
const GtkTargetEntry *target_table = NULL;
guint n_targets = 0;
static const GtkTargetEntry brush_target_table[] =
{
GIMP_TARGET_BRUSH
};
static const guint brush_n_targets = (sizeof (brush_target_table) /
sizeof (brush_target_table[0]));
static const GtkTargetEntry pattern_target_table[] =
{
GIMP_TARGET_PATTERN
};
static const guint pattern_n_targets = (sizeof (pattern_target_table) /
sizeof (pattern_target_table[0]));
static const GtkTargetEntry gradient_target_table[] =
{
GIMP_TARGET_GRADIENT
};
static const guint gradient_n_targets = (sizeof (gradient_target_table) /
sizeof (gradient_target_table[0]));
static const GtkTargetEntry palette_target_table[] =
{
GIMP_TARGET_PALETTE
};
static const guint palette_n_targets = (sizeof (palette_target_table) /
sizeof (palette_target_table[0]));
if (type == GIMP_TYPE_BRUSH)
{
target_table = brush_target_table;
@ -695,6 +740,42 @@ gimp_gtk_drag_dest_set_by_type (GtkWidget *widget,
}
}
void
gimp_dnd_viewable_source_set (GtkWidget *widget,
GtkType type,
GimpDndDragViewableFunc get_viewable_func,
gpointer data)
{
if (type == GIMP_TYPE_BRUSH)
{
gimp_dnd_brush_source_set (widget,
(GimpDndDragBrushFunc) get_viewable_func,
data);
}
else if (type == GIMP_TYPE_PATTERN)
{
gimp_dnd_pattern_source_set (widget,
(GimpDndDragPatternFunc) get_viewable_func,
data);
}
else if (type == GIMP_TYPE_GRADIENT)
{
gimp_dnd_gradient_source_set (widget,
(GimpDndDragGradientFunc) get_viewable_func,
data);
}
else if (type == GIMP_TYPE_PALETTE)
{
gimp_dnd_palette_source_set (widget,
(GimpDndDragPaletteFunc) get_viewable_func,
data);
}
else
{
g_warning ("%s(): unsupported GtkType", G_GNUC_FUNCTION);
}
}
void
gimp_dnd_viewable_dest_set (GtkWidget *widget,
GtkType type,

View File

@ -113,20 +113,31 @@ void gimp_dnd_color_dest_unset (GtkWidget *widget);
/* GimpViewable (by GtkType) dnd functions */
typedef void (* GimpDndDropViewableFunc) (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
typedef void (* GimpDndDropViewableFunc) (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
typedef GimpViewable * (* GimpDndDragViewableFunc) (GtkWidget *widget,
gpointer data);
void gimp_gtk_drag_dest_set_by_type (GtkWidget *widget,
GtkDestDefaults flags,
GtkType type,
GdkDragAction actions);
void gimp_dnd_viewable_dest_set (GtkWidget *widget,
GtkType type,
GimpDndDropViewableFunc set_viewable_func,
gpointer data);
void gimp_dnd_viewable_dest_unset (GtkWidget *widget,
GtkType type);
void gimp_gtk_drag_source_set_by_type (GtkWidget *widget,
GdkModifierType start_button_mask,
GtkType type,
GdkDragAction actions);
void gimp_gtk_drag_dest_set_by_type (GtkWidget *widget,
GtkDestDefaults flags,
GtkType type,
GdkDragAction actions);
void gimp_dnd_viewable_source_set (GtkWidget *widget,
GtkType type,
GimpDndDragViewableFunc get_viewable_func,
gpointer data);
void gimp_dnd_viewable_dest_set (GtkWidget *widget,
GtkType type,
GimpDndDropViewableFunc set_viewable_func,
gpointer data);
void gimp_dnd_viewable_dest_unset (GtkWidget *widget,
GtkType type);
/* brush dnd functions */

View File

@ -2933,7 +2933,8 @@ cpopup_adjust_blending_menu (GradientEditor *gradient_editor)
for (i = 0; i < num_items; i++)
gtk_signal_handler_block_by_data
(GTK_OBJECT (gradient_editor->control_blending_items[i]), (gpointer) i);
(GTK_OBJECT (gradient_editor->control_blending_items[i]),
gradient_editor);
/* Set state */
if (equal)
@ -2949,7 +2950,8 @@ cpopup_adjust_blending_menu (GradientEditor *gradient_editor)
/* Unblock signals */
for (i = 0; i < num_items; i++)
gtk_signal_handler_unblock_by_data (GTK_OBJECT (gradient_editor->control_blending_items[i]), (gpointer) i);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (gradient_editor->control_blending_items[i]),
gradient_editor);
}
static void
@ -2968,7 +2970,8 @@ cpopup_adjust_coloring_menu (GradientEditor *gradient_editor)
coloring = (int) gradient_editor->control_sel_l->color;
for (i = 0; i < num_items; i++)
gtk_signal_handler_block_by_data (GTK_OBJECT (gradient_editor->control_coloring_items[i]), (gpointer) i);
gtk_signal_handler_block_by_data (GTK_OBJECT (gradient_editor->control_coloring_items[i]),
gradient_editor);
/* Set state */
if (equal)
@ -2984,7 +2987,8 @@ cpopup_adjust_coloring_menu (GradientEditor *gradient_editor)
/* Unblock signals */
for (i = 0; i < num_items; i++)
gtk_signal_handler_unblock_by_data (GTK_OBJECT (gradient_editor->control_coloring_items[i]), (gpointer) i);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (gradient_editor->control_coloring_items[i]),
gradient_editor);
}
static void

View File

@ -42,7 +42,7 @@ static void gimp_gradient_preview_get_size (GimpPreview *preview,
static gboolean gimp_gradient_preview_needs_popup (GimpPreview *preview);
static GtkWidget * gimp_gradient_preview_create_popup (GimpPreview *preview);
static GimpGradient * gimp_gradient_preview_drag_gradient (GtkWidget *widget,
static GimpViewable * gimp_gradient_preview_drag_viewable (GtkWidget *widget,
gpointer data);
@ -94,20 +94,14 @@ gimp_gradient_preview_class_init (GimpGradientPreviewClass *klass)
static void
gimp_gradient_preview_init (GimpGradientPreview *gradient_preview)
{
static GtkTargetEntry preview_target_table[] =
{
GIMP_TARGET_GRADIENT
};
static guint preview_n_targets = (sizeof (preview_target_table) /
sizeof (preview_target_table[0]));
gtk_drag_source_set (GTK_WIDGET (gradient_preview),
GDK_BUTTON2_MASK,
preview_target_table, preview_n_targets,
GDK_ACTION_COPY);
gimp_dnd_gradient_source_set (GTK_WIDGET (gradient_preview),
gimp_gradient_preview_drag_gradient,
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
@ -181,13 +175,9 @@ gimp_gradient_preview_create_popup (GimpPreview *preview)
TRUE, FALSE, FALSE);
}
static GimpGradient *
gimp_gradient_preview_drag_gradient (GtkWidget *widget,
static GimpViewable *
gimp_gradient_preview_drag_viewable (GtkWidget *widget,
gpointer data)
{
GimpPreview *preview;
preview = GIMP_PREVIEW (data);
return GIMP_GRADIENT (preview->viewable);
return GIMP_PREVIEW (widget)->viewable;
}

File diff suppressed because it is too large Load Diff

View File

@ -38,8 +38,8 @@ 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 GimpPalette * gimp_palette_preview_drag_palette (GtkWidget *widget,
gpointer data);
static GimpViewable * gimp_palette_preview_drag_viewable (GtkWidget *widget,
gpointer data);
static GimpPreviewClass *parent_class = NULL;
@ -89,20 +89,14 @@ gimp_palette_preview_class_init (GimpPalettePreviewClass *klass)
static void
gimp_palette_preview_init (GimpPalettePreview *palette_preview)
{
static GtkTargetEntry preview_target_table[] =
{
GIMP_TARGET_PALETTE
};
static guint preview_n_targets = (sizeof (preview_target_table) /
sizeof (preview_target_table[0]));
gtk_drag_source_set (GTK_WIDGET (palette_preview),
GDK_BUTTON2_MASK,
preview_target_table, preview_n_targets,
GDK_ACTION_COPY);
gimp_dnd_palette_source_set (GTK_WIDGET (palette_preview),
gimp_palette_preview_drag_palette,
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
@ -176,13 +170,9 @@ gimp_palette_preview_needs_popup (GimpPreview *preview)
return FALSE;
}
static GimpPalette *
gimp_palette_preview_drag_palette (GtkWidget *widget,
gpointer data)
static GimpViewable *
gimp_palette_preview_drag_viewable (GtkWidget *widget,
gpointer data)
{
GimpPreview *preview;
preview = GIMP_PREVIEW (data);
return GIMP_PALETTE (preview->viewable);
return GIMP_PREVIEW (widget)->viewable;
}

View File

@ -34,12 +34,12 @@
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 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 GimpPattern * gimp_pattern_preview_drag_pattern (GtkWidget *widget,
gpointer data);
static GimpViewable * gimp_pattern_preview_drag_viewable (GtkWidget *widget,
gpointer data);
static GimpPreviewClass *parent_class = NULL;
@ -89,20 +89,14 @@ gimp_pattern_preview_class_init (GimpPatternPreviewClass *klass)
static void
gimp_pattern_preview_init (GimpPatternPreview *pattern_preview)
{
static GtkTargetEntry preview_target_table[] =
{
GIMP_TARGET_PATTERN
};
static guint preview_n_targets = (sizeof (preview_target_table) /
sizeof (preview_target_table[0]));
gtk_drag_source_set (GTK_WIDGET (pattern_preview),
GDK_BUTTON2_MASK,
preview_target_table, preview_n_targets,
GDK_ACTION_COPY);
gimp_dnd_pattern_source_set (GTK_WIDGET (pattern_preview),
gimp_pattern_preview_drag_pattern,
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
@ -184,13 +178,9 @@ gimp_pattern_preview_needs_popup (GimpPreview *preview)
return FALSE;
}
static GimpPattern *
gimp_pattern_preview_drag_pattern (GtkWidget *widget,
gpointer data)
static GimpViewable *
gimp_pattern_preview_drag_viewable (GtkWidget *widget,
gpointer data)
{
GimpPreview *preview;
preview = GIMP_PREVIEW (data);
return GIMP_PATTERN (preview->viewable);
return GIMP_PREVIEW (widget)->viewable;
}

View File

@ -41,8 +41,8 @@ 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 GimpBrush * gimp_brush_preview_drag_brush (GtkWidget *widget,
gpointer data);
static GimpViewable * gimp_brush_preview_drag_viewable (GtkWidget *widget,
gpointer data);
static GimpPreviewClass *parent_class = NULL;
@ -94,20 +94,14 @@ gimp_brush_preview_class_init (GimpBrushPreviewClass *klass)
static void
gimp_brush_preview_init (GimpBrushPreview *brush_preview)
{
static GtkTargetEntry preview_target_table[] =
{
GIMP_TARGET_BRUSH
};
static guint preview_n_targets = (sizeof (preview_target_table) /
sizeof (preview_target_table[0]));
gtk_drag_source_set (GTK_WIDGET (brush_preview),
GDK_BUTTON2_MASK,
preview_target_table, preview_n_targets,
GDK_ACTION_COPY);
gimp_dnd_brush_source_set (GTK_WIDGET (brush_preview),
gimp_brush_preview_drag_brush,
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;
@ -379,13 +373,9 @@ gimp_brush_preview_render_timeout_func (GimpBrushPreview *brush_preview)
return TRUE;
}
static GimpBrush *
gimp_brush_preview_drag_brush (GtkWidget *widget,
gpointer data)
static GimpViewable *
gimp_brush_preview_drag_viewable (GtkWidget *widget,
gpointer data)
{
GimpPreview *preview;
preview = GIMP_PREVIEW (data);
return GIMP_BRUSH (preview->viewable);
return GIMP_PREVIEW (widget)->viewable;
}

View File

@ -41,8 +41,8 @@ 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 GimpBrush * gimp_brush_preview_drag_brush (GtkWidget *widget,
gpointer data);
static GimpViewable * gimp_brush_preview_drag_viewable (GtkWidget *widget,
gpointer data);
static GimpPreviewClass *parent_class = NULL;
@ -94,20 +94,14 @@ gimp_brush_preview_class_init (GimpBrushPreviewClass *klass)
static void
gimp_brush_preview_init (GimpBrushPreview *brush_preview)
{
static GtkTargetEntry preview_target_table[] =
{
GIMP_TARGET_BRUSH
};
static guint preview_n_targets = (sizeof (preview_target_table) /
sizeof (preview_target_table[0]));
gtk_drag_source_set (GTK_WIDGET (brush_preview),
GDK_BUTTON2_MASK,
preview_target_table, preview_n_targets,
GDK_ACTION_COPY);
gimp_dnd_brush_source_set (GTK_WIDGET (brush_preview),
gimp_brush_preview_drag_brush,
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;
@ -379,13 +373,9 @@ gimp_brush_preview_render_timeout_func (GimpBrushPreview *brush_preview)
return TRUE;
}
static GimpBrush *
gimp_brush_preview_drag_brush (GtkWidget *widget,
gpointer data)
static GimpViewable *
gimp_brush_preview_drag_viewable (GtkWidget *widget,
gpointer data)
{
GimpPreview *preview;
preview = GIMP_PREVIEW (data);
return GIMP_BRUSH (preview->viewable);
return GIMP_PREVIEW (widget)->viewable;
}

View File

@ -97,11 +97,12 @@ scriptdata_DATA = \
unsharp-mask.scm \
waves-anim.scm \
weave.scm \
xach-effect.scm
EXTRA_DIST = $(scriptdata_DATA) \
xach-effect.scm \
\
test-sphere.scm
EXTRA_DIST = $(scriptdata_DATA)
files:
@files=`ls $(DISTFILES) 2> /dev/null`; for p in $$files; do \
echo $$p; \