2000-05-09 01:45:16 +08:00
|
|
|
/* LIBGIMP - The GIMP Library
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
1998-01-25 18:26:47 +08:00
|
|
|
*
|
2000-05-31 14:15:06 +08:00
|
|
|
* gimpmenu.c
|
|
|
|
*
|
1998-01-25 18:26:47 +08:00
|
|
|
* This library is free software; you can redistribute it and/or
|
1999-11-18 05:13:50 +08:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1998-01-25 18:26:47 +08:00
|
|
|
* License as published by the Free Software Foundation; either
|
2000-05-09 01:45:16 +08:00
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
1998-01-25 18:26:47 +08:00
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
1999-11-18 05:13:50 +08:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
1998-04-13 13:44:11 +08:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
2000-05-09 01:45:16 +08:00
|
|
|
*/
|
|
|
|
|
2002-05-13 21:21:55 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#include <string.h>
|
|
|
|
|
2002-01-30 22:54:27 +08:00
|
|
|
#ifdef __GNUC__
|
|
|
|
#warning GTK_DISABLE_DEPRECATED
|
|
|
|
#endif
|
|
|
|
#undef GTK_DISABLE_DEPRECATED
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "gimp.h"
|
|
|
|
#include "gimpui.h"
|
|
|
|
|
2002-05-13 21:21:55 +08:00
|
|
|
#include "libgimp-intl.h"
|
2002-01-30 22:54:27 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
#define MENU_THUMBNAIL_WIDTH 24
|
|
|
|
#define MENU_THUMBNAIL_HEIGHT 24
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-09-21 07:04:33 +08:00
|
|
|
/* Copy data from temp_PDB call */
|
2000-05-09 01:45:16 +08:00
|
|
|
struct _GimpBrushData
|
|
|
|
{
|
2000-05-31 14:15:06 +08:00
|
|
|
gboolean busy;
|
|
|
|
gchar *bname;
|
|
|
|
gdouble opacity;
|
|
|
|
gint spacing;
|
|
|
|
gint paint_mode;
|
|
|
|
gint width;
|
|
|
|
gint height;
|
|
|
|
gchar *brush_mask_data;
|
|
|
|
GimpRunBrushCallback callback;
|
|
|
|
gboolean closing;
|
|
|
|
gpointer data;
|
1998-09-21 07:04:33 +08:00
|
|
|
};
|
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
typedef struct _GimpBrushData GimpBrushData;
|
1998-09-21 07:04:33 +08:00
|
|
|
|
1998-10-02 06:09:01 +08:00
|
|
|
/* Copy data from temp_PDB call */
|
2000-05-09 01:45:16 +08:00
|
|
|
struct _GimpPatternData
|
|
|
|
{
|
2000-05-31 14:15:06 +08:00
|
|
|
gboolean busy;
|
|
|
|
gchar *pname;
|
|
|
|
gint width;
|
|
|
|
gint height;
|
|
|
|
gint bytes;
|
|
|
|
gchar *pattern_mask_data;
|
|
|
|
GimpRunPatternCallback callback;
|
|
|
|
gboolean closing;
|
|
|
|
gpointer data;
|
1998-10-02 06:09:01 +08:00
|
|
|
};
|
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
typedef struct _GimpPatternData GimpPatternData;
|
1998-09-21 07:04:33 +08:00
|
|
|
|
1998-11-01 00:22:37 +08:00
|
|
|
/* Copy data from temp_PDB call */
|
2000-05-09 01:45:16 +08:00
|
|
|
struct _GimpGradientData
|
|
|
|
{
|
2000-05-31 14:15:06 +08:00
|
|
|
gboolean busy;
|
|
|
|
gchar *gname;
|
|
|
|
gint width;
|
|
|
|
gdouble *gradient_data;
|
|
|
|
GimpRunGradientCallback callback;
|
|
|
|
gboolean closing;
|
|
|
|
gpointer data;
|
1998-11-01 00:22:37 +08:00
|
|
|
};
|
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
typedef struct _GimpGradientData GimpGradientData;
|
|
|
|
|
2000-05-31 14:15:06 +08:00
|
|
|
static void gimp_menu_callback (GtkWidget *widget,
|
|
|
|
gint32 *id);
|
|
|
|
static void do_brush_callback (GimpBrushData *bdata);
|
|
|
|
static gint idle_test_brush (GimpBrushData *bdata);
|
|
|
|
static gint idle_test_pattern (GimpPatternData *pdata);
|
|
|
|
static gint idle_test_gradient (GimpGradientData *gdata);
|
|
|
|
static void temp_brush_invoker (gchar *name,
|
|
|
|
gint nparams,
|
|
|
|
GimpParam *param,
|
|
|
|
gint *nreturn_vals,
|
|
|
|
GimpParam **return_vals);
|
|
|
|
static gboolean input_callback (GIOChannel *channel,
|
|
|
|
GIOCondition condition,
|
|
|
|
gpointer data);
|
2000-05-09 01:45:16 +08:00
|
|
|
static void gimp_setup_callbacks (void);
|
2000-05-31 14:15:06 +08:00
|
|
|
static gchar * gen_temp_plugin_name (void);
|
|
|
|
static void fill_preview_with_thumb (GtkWidget *widget,
|
|
|
|
gint32 drawable_ID,
|
|
|
|
gint width,
|
|
|
|
gint height);
|
|
|
|
|
1998-09-21 07:04:33 +08:00
|
|
|
/* From gimp.c */
|
|
|
|
void gimp_run_temp (void);
|
|
|
|
|
2000-05-31 14:15:06 +08:00
|
|
|
static GHashTable *gbrush_ht = NULL;
|
|
|
|
static GHashTable *gpattern_ht = NULL;
|
|
|
|
static GHashTable *ggradient_ht = NULL;
|
|
|
|
static GimpBrushData *active_brush_pdb = NULL;
|
|
|
|
static GimpPatternData *active_pattern_pdb = NULL;
|
2000-05-09 01:45:16 +08:00
|
|
|
static GimpGradientData *active_gradient_pdb = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-05-31 14:15:06 +08:00
|
|
|
GtkWidget *
|
1997-11-25 06:05:25 +08:00
|
|
|
gimp_image_menu_new (GimpConstraintFunc constraint,
|
|
|
|
GimpMenuCallback callback,
|
|
|
|
gpointer data,
|
|
|
|
gint32 active_image)
|
|
|
|
{
|
|
|
|
GtkWidget *menu;
|
|
|
|
GtkWidget *menuitem;
|
2002-05-13 21:21:55 +08:00
|
|
|
gchar *name;
|
2001-08-30 01:48:28 +08:00
|
|
|
gchar *label;
|
|
|
|
gint32 *images;
|
|
|
|
gint nimages;
|
|
|
|
gint i, k;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
menu = gtk_menu_new ();
|
2001-07-31 20:10:14 +08:00
|
|
|
g_object_set_data (G_OBJECT (menu), "gimp_callback", (gpointer) callback);
|
|
|
|
g_object_set_data (G_OBJECT (menu), "gimp_callback_data", data);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-08-03 09:35:28 +08:00
|
|
|
images = gimp_image_list (&nimages);
|
1997-11-25 06:05:25 +08:00
|
|
|
for (i = 0, k = 0; i < nimages; i++)
|
|
|
|
if (!constraint || (* constraint) (images[i], -1, data))
|
|
|
|
{
|
2002-05-13 21:21:55 +08:00
|
|
|
name = gimp_image_get_name (images[i]);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-05-13 21:21:55 +08:00
|
|
|
label = g_strdup_printf ("%s-%d", name, images[i]);
|
2001-08-30 01:48:28 +08:00
|
|
|
|
2002-05-13 21:21:55 +08:00
|
|
|
g_free (name);
|
2001-08-30 01:48:28 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
menuitem = gtk_menu_item_new_with_label (label);
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (menuitem, "activate",
|
2001-07-31 20:10:14 +08:00
|
|
|
G_CALLBACK (gimp_menu_callback),
|
|
|
|
&images[i]);
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (menuitem);
|
|
|
|
|
|
|
|
g_free (label);
|
|
|
|
|
|
|
|
if (images[i] == active_image)
|
|
|
|
gtk_menu_set_active (GTK_MENU (menu), k);
|
|
|
|
|
|
|
|
k += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (k == 0)
|
|
|
|
{
|
2002-05-13 21:21:55 +08:00
|
|
|
menuitem = gtk_menu_item_new_with_label (_("None"));
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_set_sensitive (menuitem, FALSE);
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (menuitem);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (images)
|
|
|
|
{
|
|
|
|
if (active_image == -1)
|
|
|
|
active_image = images[0];
|
|
|
|
(* callback) (active_image, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2000-05-31 14:15:06 +08:00
|
|
|
GtkWidget *
|
1997-11-25 06:05:25 +08:00
|
|
|
gimp_layer_menu_new (GimpConstraintFunc constraint,
|
|
|
|
GimpMenuCallback callback,
|
|
|
|
gpointer data,
|
|
|
|
gint32 active_layer)
|
|
|
|
{
|
|
|
|
GtkWidget *menu;
|
|
|
|
GtkWidget *menuitem;
|
2001-08-30 01:48:28 +08:00
|
|
|
gchar *name;
|
|
|
|
gchar *image_label;
|
|
|
|
gchar *label;
|
|
|
|
gint32 *images;
|
|
|
|
gint32 *layers;
|
|
|
|
gint32 layer;
|
|
|
|
gint nimages;
|
|
|
|
gint nlayers;
|
|
|
|
gint i, j, k;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
menu = gtk_menu_new ();
|
2001-07-31 20:10:14 +08:00
|
|
|
g_object_set_data (G_OBJECT (menu), "gimp_callback", callback);
|
|
|
|
g_object_set_data (G_OBJECT (menu), "gimp_callback_data", data);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
layer = -1;
|
|
|
|
|
2000-08-03 09:35:28 +08:00
|
|
|
images = gimp_image_list (&nimages);
|
1997-11-25 06:05:25 +08:00
|
|
|
for (i = 0, k = 0; i < nimages; i++)
|
|
|
|
if (!constraint || (* constraint) (images[i], -1, data))
|
|
|
|
{
|
2002-05-13 21:21:55 +08:00
|
|
|
name = gimp_image_get_name (images[i]);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-05-13 21:21:55 +08:00
|
|
|
image_label = g_strdup_printf ("%s-%d", name, images[i]);
|
2001-08-30 01:48:28 +08:00
|
|
|
|
2002-05-13 21:21:55 +08:00
|
|
|
g_free (name);
|
2001-08-30 01:48:28 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
layers = gimp_image_get_layers (images[i], &nlayers);
|
|
|
|
for (j = 0; j < nlayers; j++)
|
|
|
|
if (!constraint || (* constraint) (images[i], layers[j], data))
|
|
|
|
{
|
1999-06-24 07:01:14 +08:00
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *wcolor_box;
|
|
|
|
GtkWidget *wlabel;
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
name = gimp_layer_get_name (layers[j]);
|
2000-05-31 14:15:06 +08:00
|
|
|
label = g_strdup_printf ("%s/%s", image_label, name);
|
1997-11-25 06:05:25 +08:00
|
|
|
g_free (name);
|
|
|
|
|
1999-06-24 07:01:14 +08:00
|
|
|
menuitem = gtk_menu_item_new();
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (menuitem, "activate",
|
2001-07-31 20:10:14 +08:00
|
|
|
G_CALLBACK (gimp_menu_callback),
|
|
|
|
&layers[j]);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
hbox = gtk_hbox_new (FALSE, 0);
|
|
|
|
gtk_container_add (GTK_CONTAINER (menuitem), hbox);
|
|
|
|
gtk_widget_show (hbox);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
vbox = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (vbox);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
wcolor_box = gtk_preview_new (GTK_PREVIEW_COLOR);
|
2002-05-13 21:21:55 +08:00
|
|
|
gtk_preview_set_dither (GTK_PREVIEW (wcolor_box),
|
|
|
|
GDK_RGB_DITHER_MAX);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2000-05-31 14:15:06 +08:00
|
|
|
fill_preview_with_thumb (wcolor_box,
|
|
|
|
layers[j],
|
|
|
|
MENU_THUMBNAIL_WIDTH,
|
|
|
|
MENU_THUMBNAIL_HEIGHT);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2001-12-29 21:26:29 +08:00
|
|
|
gtk_widget_set_size_request (GTK_WIDGET (wcolor_box),
|
|
|
|
MENU_THUMBNAIL_WIDTH,
|
|
|
|
MENU_THUMBNAIL_HEIGHT);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2000-05-31 14:15:06 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (vbox), wcolor_box);
|
|
|
|
gtk_widget_show (wcolor_box);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2000-05-31 14:15:06 +08:00
|
|
|
wlabel = gtk_label_new (label);
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (wlabel), 0.0, 0.5);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), wlabel, TRUE, TRUE, 4);
|
|
|
|
gtk_widget_show (wlabel);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (menuitem);
|
|
|
|
|
|
|
|
g_free (label);
|
|
|
|
|
|
|
|
if (layers[j] == active_layer)
|
|
|
|
{
|
|
|
|
layer = active_layer;
|
|
|
|
gtk_menu_set_active (GTK_MENU (menu), k);
|
|
|
|
}
|
|
|
|
else if (layer == -1)
|
|
|
|
layer = layers[j];
|
|
|
|
|
|
|
|
k += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free (image_label);
|
|
|
|
}
|
|
|
|
g_free (images);
|
|
|
|
|
|
|
|
if (k == 0)
|
|
|
|
{
|
2002-05-13 21:21:55 +08:00
|
|
|
menuitem = gtk_menu_item_new_with_label (_("None"));
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_set_sensitive (menuitem, FALSE);
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (menuitem);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (layer != -1)
|
|
|
|
(* callback) (layer, data);
|
|
|
|
|
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
2000-05-31 14:15:06 +08:00
|
|
|
GtkWidget *
|
1997-11-25 06:05:25 +08:00
|
|
|
gimp_channel_menu_new (GimpConstraintFunc constraint,
|
|
|
|
GimpMenuCallback callback,
|
|
|
|
gpointer data,
|
|
|
|
gint32 active_channel)
|
|
|
|
{
|
|
|
|
GtkWidget *menu;
|
|
|
|
GtkWidget *menuitem;
|
2001-08-30 01:48:28 +08:00
|
|
|
gchar *name;
|
|
|
|
gchar *image_label;
|
|
|
|
gchar *label;
|
|
|
|
gint32 *images;
|
|
|
|
gint32 *channels;
|
|
|
|
gint32 channel;
|
|
|
|
gint nimages;
|
|
|
|
gint nchannels;
|
|
|
|
gint i, j, k;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
menu = gtk_menu_new ();
|
2001-07-31 20:10:14 +08:00
|
|
|
g_object_set_data (G_OBJECT (menu), "gimp_callback", callback);
|
|
|
|
g_object_set_data (G_OBJECT (menu), "gimp_callback_data", data);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
channel = -1;
|
|
|
|
|
2000-08-03 09:35:28 +08:00
|
|
|
images = gimp_image_list (&nimages);
|
1997-11-25 06:05:25 +08:00
|
|
|
for (i = 0, k = 0; i < nimages; i++)
|
|
|
|
if (!constraint || (* constraint) (images[i], -1, data))
|
|
|
|
{
|
2002-05-13 21:21:55 +08:00
|
|
|
name = gimp_image_get_name (images[i]);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-05-13 21:21:55 +08:00
|
|
|
image_label = g_strdup_printf ("%s-%d", name, images[i]);
|
2001-08-30 01:48:28 +08:00
|
|
|
|
2002-05-13 21:21:55 +08:00
|
|
|
g_free (name);
|
2001-08-30 01:48:28 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
channels = gimp_image_get_channels (images[i], &nchannels);
|
|
|
|
for (j = 0; j < nchannels; j++)
|
|
|
|
if (!constraint || (* constraint) (images[i], channels[j], data))
|
|
|
|
{
|
1999-06-24 07:01:14 +08:00
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *wcolor_box;
|
|
|
|
GtkWidget *wlabel;
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
name = gimp_channel_get_name (channels[j]);
|
2000-05-31 14:15:06 +08:00
|
|
|
label = g_strdup_printf ("%s/%s", image_label, name);
|
1997-11-25 06:05:25 +08:00
|
|
|
g_free (name);
|
|
|
|
|
2000-05-31 14:15:06 +08:00
|
|
|
menuitem = gtk_menu_item_new ();
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (menuitem, "activate",
|
2001-07-31 20:10:14 +08:00
|
|
|
G_CALLBACK (gimp_menu_callback),
|
|
|
|
&channels[j]);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2000-05-31 14:15:06 +08:00
|
|
|
hbox = gtk_hbox_new (FALSE, 0);
|
|
|
|
gtk_container_add (GTK_CONTAINER (menuitem), hbox);
|
|
|
|
gtk_widget_show (hbox);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2000-05-31 14:15:06 +08:00
|
|
|
vbox = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
|
|
|
wcolor_box = gtk_preview_new (GTK_PREVIEW_COLOR);
|
|
|
|
gtk_preview_set_dither (GTK_PREVIEW (wcolor_box),
|
|
|
|
GDK_RGB_DITHER_MAX);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2000-05-31 14:15:06 +08:00
|
|
|
fill_preview_with_thumb (wcolor_box,
|
|
|
|
channels[j],
|
|
|
|
MENU_THUMBNAIL_WIDTH,
|
|
|
|
MENU_THUMBNAIL_HEIGHT);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2001-12-29 21:26:29 +08:00
|
|
|
gtk_widget_set_size_request (GTK_WIDGET (wcolor_box),
|
|
|
|
MENU_THUMBNAIL_WIDTH,
|
|
|
|
MENU_THUMBNAIL_HEIGHT);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2000-05-31 14:15:06 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER(vbox), wcolor_box);
|
|
|
|
gtk_widget_show (wcolor_box);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2000-05-31 14:15:06 +08:00
|
|
|
wlabel = gtk_label_new (label);
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (wlabel), 0.0, 0.5);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), wlabel, TRUE, TRUE, 4);
|
|
|
|
gtk_widget_show (wlabel);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (menuitem);
|
|
|
|
|
|
|
|
g_free (label);
|
|
|
|
|
|
|
|
if (channels[j] == active_channel)
|
|
|
|
{
|
|
|
|
channel = active_channel;
|
|
|
|
gtk_menu_set_active (GTK_MENU (menu), k);
|
|
|
|
}
|
|
|
|
else if (channel == -1)
|
|
|
|
channel = channels[j];
|
|
|
|
|
|
|
|
k += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free (image_label);
|
|
|
|
}
|
|
|
|
g_free (images);
|
|
|
|
|
|
|
|
if (k == 0)
|
|
|
|
{
|
2002-05-13 21:21:55 +08:00
|
|
|
menuitem = gtk_menu_item_new_with_label (_("None"));
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_set_sensitive (menuitem, FALSE);
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (menuitem);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (channel != -1)
|
|
|
|
(* callback) (channel, data);
|
|
|
|
|
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
2000-05-31 14:15:06 +08:00
|
|
|
GtkWidget *
|
1997-11-25 06:05:25 +08:00
|
|
|
gimp_drawable_menu_new (GimpConstraintFunc constraint,
|
|
|
|
GimpMenuCallback callback,
|
|
|
|
gpointer data,
|
|
|
|
gint32 active_drawable)
|
|
|
|
{
|
|
|
|
GtkWidget *menu;
|
|
|
|
GtkWidget *menuitem;
|
2001-08-30 01:48:28 +08:00
|
|
|
gchar *name;
|
|
|
|
gchar *image_label;
|
|
|
|
gchar *label;
|
|
|
|
gint32 *images;
|
|
|
|
gint32 *layers;
|
|
|
|
gint32 *channels;
|
|
|
|
gint32 drawable;
|
|
|
|
gint nimages;
|
|
|
|
gint nlayers;
|
|
|
|
gint nchannels;
|
|
|
|
gint i, j, k;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
menu = gtk_menu_new ();
|
2001-07-31 20:10:14 +08:00
|
|
|
g_object_set_data (G_OBJECT (menu), "gimp_callback", callback);
|
|
|
|
g_object_set_data (G_OBJECT (menu), "gimp_callback_data", data);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
drawable = -1;
|
|
|
|
|
2000-08-03 09:35:28 +08:00
|
|
|
images = gimp_image_list (&nimages);
|
2000-05-09 01:45:16 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
for (i = 0, k = 0; i < nimages; i++)
|
|
|
|
if (!constraint || (* constraint) (images[i], -1, data))
|
|
|
|
{
|
2002-05-13 21:21:55 +08:00
|
|
|
name = gimp_image_get_name (images[i]);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-05-13 21:21:55 +08:00
|
|
|
image_label = g_strdup_printf ("%s-%d", name, images[i]);
|
2001-08-30 01:48:28 +08:00
|
|
|
|
2002-05-13 21:21:55 +08:00
|
|
|
g_free (name);
|
2001-08-30 01:48:28 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
layers = gimp_image_get_layers (images[i], &nlayers);
|
2000-05-09 01:45:16 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
for (j = 0; j < nlayers; j++)
|
|
|
|
if (!constraint || (* constraint) (images[i], layers[j], data))
|
|
|
|
{
|
1999-06-24 07:01:14 +08:00
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *wcolor_box;
|
|
|
|
GtkWidget *wlabel;
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
name = gimp_layer_get_name (layers[j]);
|
2000-05-31 14:15:06 +08:00
|
|
|
label = g_strdup_printf ("%s/%s", image_label, name);
|
1997-11-25 06:05:25 +08:00
|
|
|
g_free (name);
|
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
menuitem = gtk_menu_item_new ();
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (menuitem, "activate",
|
2001-07-31 20:10:14 +08:00
|
|
|
G_CALLBACK (gimp_menu_callback),
|
|
|
|
&layers[j]);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
hbox = gtk_hbox_new (FALSE, 0);
|
|
|
|
gtk_container_add (GTK_CONTAINER(menuitem), hbox);
|
|
|
|
gtk_widget_show (hbox);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
vbox = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (vbox);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
wcolor_box = gtk_preview_new (GTK_PREVIEW_COLOR);
|
1999-06-24 07:01:14 +08:00
|
|
|
gtk_preview_set_dither (GTK_PREVIEW (wcolor_box), GDK_RGB_DITHER_MAX);
|
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
fill_preview_with_thumb (wcolor_box,
|
|
|
|
layers[j],
|
|
|
|
MENU_THUMBNAIL_WIDTH,
|
|
|
|
MENU_THUMBNAIL_HEIGHT);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2001-12-29 21:26:29 +08:00
|
|
|
gtk_widget_set_size_request (GTK_WIDGET (wcolor_box),
|
|
|
|
MENU_THUMBNAIL_WIDTH ,
|
|
|
|
MENU_THUMBNAIL_HEIGHT);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER(vbox), wcolor_box);
|
|
|
|
gtk_widget_show (wcolor_box);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
wlabel = gtk_label_new (label);
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (wlabel), 0.0, 0.5);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), wlabel, TRUE, TRUE, 4);
|
|
|
|
gtk_widget_show (wlabel);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (menuitem);
|
|
|
|
|
|
|
|
g_free (label);
|
|
|
|
|
|
|
|
if (layers[j] == active_drawable)
|
|
|
|
{
|
|
|
|
drawable = active_drawable;
|
|
|
|
gtk_menu_set_active (GTK_MENU (menu), k);
|
|
|
|
}
|
|
|
|
else if (drawable == -1)
|
|
|
|
drawable = layers[j];
|
|
|
|
|
|
|
|
k += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
channels = gimp_image_get_channels (images[i], &nchannels);
|
2000-05-09 01:45:16 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
for (j = 0; j < nchannels; j++)
|
|
|
|
if (!constraint || (* constraint) (images[i], channels[j], data))
|
|
|
|
{
|
1999-06-24 07:01:14 +08:00
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *wcolor_box;
|
|
|
|
GtkWidget *wlabel;
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
name = gimp_channel_get_name (channels[j]);
|
2000-05-31 14:15:06 +08:00
|
|
|
label = g_strdup_printf ("%s/%s", image_label, name);
|
1997-11-25 06:05:25 +08:00
|
|
|
g_free (name);
|
|
|
|
|
2000-05-31 14:15:06 +08:00
|
|
|
menuitem = gtk_menu_item_new ();
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (menuitem, "activate",
|
2001-07-31 20:10:14 +08:00
|
|
|
G_CALLBACK (gimp_menu_callback),
|
|
|
|
&channels[j]);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
hbox = gtk_hbox_new (FALSE, 0);
|
|
|
|
gtk_container_add (GTK_CONTAINER (menuitem), hbox);
|
|
|
|
gtk_widget_show (hbox);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
vbox = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (vbox);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
wcolor_box = gtk_preview_new (GTK_PREVIEW_COLOR);
|
2000-05-31 14:15:06 +08:00
|
|
|
gtk_preview_set_dither (GTK_PREVIEW (wcolor_box),
|
|
|
|
GDK_RGB_DITHER_MAX);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
fill_preview_with_thumb (wcolor_box,
|
|
|
|
channels[j],
|
|
|
|
MENU_THUMBNAIL_WIDTH,
|
|
|
|
MENU_THUMBNAIL_HEIGHT);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2001-12-29 21:26:29 +08:00
|
|
|
gtk_widget_set_size_request (GTK_WIDGET (wcolor_box),
|
|
|
|
MENU_THUMBNAIL_WIDTH ,
|
|
|
|
MENU_THUMBNAIL_HEIGHT);
|
2000-05-09 01:45:16 +08:00
|
|
|
|
|
|
|
gtk_container_add (GTK_CONTAINER (vbox), wcolor_box);
|
|
|
|
gtk_widget_show (wcolor_box);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
wlabel = gtk_label_new (label);
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (wlabel), 0.0, 0.5);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), wlabel, TRUE, TRUE, 4);
|
|
|
|
gtk_widget_show (wlabel);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (menuitem);
|
|
|
|
|
|
|
|
g_free (label);
|
|
|
|
|
|
|
|
if (channels[j] == active_drawable)
|
|
|
|
{
|
|
|
|
drawable = active_drawable;
|
|
|
|
gtk_menu_set_active (GTK_MENU (menu), k);
|
|
|
|
}
|
|
|
|
else if (drawable == -1)
|
|
|
|
drawable = channels[j];
|
|
|
|
|
|
|
|
k += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free (image_label);
|
|
|
|
}
|
|
|
|
g_free (images);
|
|
|
|
|
|
|
|
if (k == 0)
|
|
|
|
{
|
2002-05-13 21:21:55 +08:00
|
|
|
menuitem = gtk_menu_item_new_with_label (_("None"));
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_set_sensitive (menuitem, FALSE);
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (menuitem);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (drawable != -1)
|
|
|
|
(* callback) (drawable, data);
|
|
|
|
|
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2000-05-09 01:45:16 +08:00
|
|
|
gimp_menu_callback (GtkWidget *widget,
|
1997-11-25 06:05:25 +08:00
|
|
|
gint32 *id)
|
|
|
|
{
|
|
|
|
GimpMenuCallback callback;
|
2000-05-09 01:45:16 +08:00
|
|
|
gpointer callback_data;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-07-31 20:10:14 +08:00
|
|
|
callback = (GimpMenuCallback) g_object_get_data (G_OBJECT (widget->parent),
|
|
|
|
"gimp_callback");
|
|
|
|
callback_data = g_object_get_data (G_OBJECT (widget->parent),
|
|
|
|
"gimp_callback_data");
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
(* callback) (*id, callback_data);
|
|
|
|
}
|
1998-09-19 08:40:27 +08:00
|
|
|
|
1999-06-24 07:01:14 +08:00
|
|
|
static void
|
2000-05-09 01:45:16 +08:00
|
|
|
fill_preview_with_thumb (GtkWidget *widget,
|
|
|
|
gint32 drawable_ID,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1999-06-24 07:01:14 +08:00
|
|
|
{
|
1999-07-07 05:19:34 +08:00
|
|
|
guchar *drawable_data;
|
|
|
|
gint bpp;
|
2000-05-09 01:45:16 +08:00
|
|
|
gint x, y;
|
1999-07-07 05:19:34 +08:00
|
|
|
guchar *src;
|
|
|
|
gdouble r, g, b, a;
|
|
|
|
gdouble c0, c1;
|
2000-05-09 01:45:16 +08:00
|
|
|
guchar *p0, *p1, *even, *odd;
|
1999-06-24 07:01:14 +08:00
|
|
|
|
|
|
|
bpp = 0; /* Only returned */
|
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
drawable_data =
|
|
|
|
gimp_drawable_get_thumbnail_data (drawable_ID, &width, &height, &bpp);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
gtk_preview_size (GTK_PREVIEW (widget), width, height);
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
even = g_malloc (width * 3);
|
|
|
|
odd = g_malloc (width * 3);
|
|
|
|
src = drawable_data;
|
1999-07-07 05:19:34 +08:00
|
|
|
|
|
|
|
for (y = 0; y < height; y++)
|
1999-06-24 07:01:14 +08:00
|
|
|
{
|
1999-07-07 05:19:34 +08:00
|
|
|
p0 = even;
|
|
|
|
p1 = odd;
|
1999-06-24 07:01:14 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
for (x = 0; x < width; x++)
|
|
|
|
{
|
2000-05-31 14:15:06 +08:00
|
|
|
if (bpp == 4)
|
2000-05-09 01:45:16 +08:00
|
|
|
{
|
2000-05-31 14:15:06 +08:00
|
|
|
r = ((gdouble) src[x*4+0]) / 255.0;
|
|
|
|
g = ((gdouble) src[x*4+1]) / 255.0;
|
|
|
|
b = ((gdouble) src[x*4+2]) / 255.0;
|
|
|
|
a = ((gdouble) src[x*4+3]) / 255.0;
|
2000-05-09 01:45:16 +08:00
|
|
|
}
|
2000-05-31 14:15:06 +08:00
|
|
|
else if (bpp == 3)
|
2000-05-09 01:45:16 +08:00
|
|
|
{
|
2000-05-31 14:15:06 +08:00
|
|
|
r = ((gdouble) src[x*3+0]) / 255.0;
|
|
|
|
g = ((gdouble) src[x*3+1]) / 255.0;
|
|
|
|
b = ((gdouble) src[x*3+2]) / 255.0;
|
1999-07-07 05:19:34 +08:00
|
|
|
a = 1.0;
|
2000-05-09 01:45:16 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-05-31 14:15:06 +08:00
|
|
|
r = ((gdouble) src[x*bpp+0]) / 255.0;
|
2000-05-09 01:45:16 +08:00
|
|
|
g = b = r;
|
2000-05-31 14:15:06 +08:00
|
|
|
if (bpp == 2)
|
|
|
|
a = ((gdouble) src[x*bpp+1]) / 255.0;
|
2000-05-09 01:45:16 +08:00
|
|
|
else
|
|
|
|
a = 1.0;
|
|
|
|
}
|
2000-05-31 14:15:06 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
if ((x / GIMP_CHECK_SIZE_SM) & 1)
|
|
|
|
{
|
|
|
|
c0 = GIMP_CHECK_LIGHT;
|
|
|
|
c1 = GIMP_CHECK_DARK;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
c0 = GIMP_CHECK_DARK;
|
|
|
|
c1 = GIMP_CHECK_LIGHT;
|
|
|
|
}
|
1999-07-07 05:19:34 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
*p0++ = (c0 + (r - c0) * a) * 255.0;
|
|
|
|
*p0++ = (c0 + (g - c0) * a) * 255.0;
|
|
|
|
*p0++ = (c0 + (b - c0) * a) * 255.0;
|
2000-05-31 14:15:06 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
*p1++ = (c1 + (r - c1) * a) * 255.0;
|
|
|
|
*p1++ = (c1 + (g - c1) * a) * 255.0;
|
|
|
|
*p1++ = (c1 + (b - c1) * a) * 255.0;
|
1999-07-07 05:19:34 +08:00
|
|
|
}
|
2000-05-09 01:45:16 +08:00
|
|
|
|
|
|
|
if ((y / GIMP_CHECK_SIZE_SM) & 1)
|
2000-05-31 14:15:06 +08:00
|
|
|
gtk_preview_draw_row (GTK_PREVIEW (widget), (guchar *)odd, 0, y, width);
|
1999-07-07 05:19:34 +08:00
|
|
|
else
|
2000-05-09 01:45:16 +08:00
|
|
|
gtk_preview_draw_row (GTK_PREVIEW (widget), (guchar *)even, 0, y, width);
|
|
|
|
|
1999-07-07 05:19:34 +08:00
|
|
|
src += width * bpp;
|
1999-06-24 07:01:14 +08:00
|
|
|
}
|
2000-05-09 01:45:16 +08:00
|
|
|
|
|
|
|
g_free (even);
|
|
|
|
g_free (odd);
|
1999-06-24 07:01:14 +08:00
|
|
|
}
|
|
|
|
|
1998-09-19 08:40:27 +08:00
|
|
|
|
|
|
|
/* These functions allow the callback PDB work with gtk
|
|
|
|
* ALT.
|
|
|
|
* Note that currently PDB calls in libgimp are completely deterministic.
|
|
|
|
* There is always one call followed by a reply.
|
|
|
|
* If we are in the main gdk wait routine we can cannot get a reply
|
|
|
|
* to a wire message, only the request for a new PDB proc to be run.
|
|
|
|
* we will restrict this to a temp PDB function we have registered.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
2000-05-09 01:45:16 +08:00
|
|
|
do_brush_callback (GimpBrushData *bdata)
|
1998-09-19 08:40:27 +08:00
|
|
|
{
|
2000-05-09 01:45:16 +08:00
|
|
|
if (!bdata->busy)
|
1998-09-19 08:40:27 +08:00
|
|
|
return;
|
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
if (bdata->callback)
|
|
|
|
bdata->callback (bdata->bname,
|
|
|
|
bdata->opacity,
|
|
|
|
bdata->spacing,
|
|
|
|
bdata->paint_mode,
|
|
|
|
bdata->width,
|
|
|
|
bdata->height,
|
|
|
|
bdata->brush_mask_data,
|
|
|
|
bdata->closing,
|
|
|
|
bdata->data);
|
|
|
|
|
|
|
|
if (bdata->bname)
|
|
|
|
g_free (bdata->bname);
|
1998-09-19 08:40:27 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
if (bdata->brush_mask_data)
|
|
|
|
g_free (bdata->brush_mask_data);
|
1998-09-19 08:40:27 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
bdata->busy = FALSE;
|
|
|
|
bdata->bname = NULL;
|
|
|
|
bdata->brush_mask_data = NULL;
|
1998-09-19 08:40:27 +08:00
|
|
|
}
|
|
|
|
|
1998-10-02 06:09:01 +08:00
|
|
|
static void
|
2000-05-09 01:45:16 +08:00
|
|
|
do_pattern_callback (GimpPatternData *pdata)
|
1998-10-02 06:09:01 +08:00
|
|
|
{
|
2000-05-09 01:45:16 +08:00
|
|
|
if (!pdata->busy)
|
1998-10-02 06:09:01 +08:00
|
|
|
return;
|
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
if (pdata->callback)
|
|
|
|
pdata->callback (pdata->pname,
|
|
|
|
pdata->width,
|
|
|
|
pdata->height,
|
|
|
|
pdata->bytes,
|
|
|
|
pdata->pattern_mask_data,
|
|
|
|
pdata->closing,
|
|
|
|
pdata->data);
|
1998-10-02 06:09:01 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
if (pdata->pname)
|
|
|
|
g_free (pdata->pname);
|
|
|
|
|
|
|
|
if (pdata->pattern_mask_data)
|
|
|
|
g_free (pdata->pattern_mask_data);
|
1998-10-02 06:09:01 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
pdata->busy = FALSE;
|
|
|
|
pdata->pname = NULL;
|
|
|
|
pdata->pattern_mask_data = NULL;
|
1998-10-02 06:09:01 +08:00
|
|
|
}
|
|
|
|
|
1998-11-01 00:22:37 +08:00
|
|
|
static void
|
2000-05-09 01:45:16 +08:00
|
|
|
do_gradient_callback (GimpGradientData *gdata)
|
1998-11-01 00:22:37 +08:00
|
|
|
{
|
2000-05-09 01:45:16 +08:00
|
|
|
if (!gdata->busy)
|
1998-11-01 00:22:37 +08:00
|
|
|
return;
|
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
if (gdata->callback)
|
|
|
|
gdata->callback (gdata->gname,
|
|
|
|
gdata->width,
|
|
|
|
gdata->gradient_data,
|
|
|
|
gdata->closing,
|
|
|
|
gdata->data);
|
1998-11-01 00:22:37 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
if (gdata->gname)
|
|
|
|
g_free (gdata->gname);
|
1998-11-01 00:22:37 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
if (gdata->gradient_data)
|
|
|
|
g_free (gdata->gradient_data);
|
1998-11-01 00:22:37 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
gdata->busy = FALSE;
|
1998-11-01 00:22:37 +08:00
|
|
|
gdata->gname = NULL;
|
|
|
|
gdata->gradient_data = NULL;
|
|
|
|
}
|
|
|
|
|
1998-09-19 08:40:27 +08:00
|
|
|
static gint
|
2000-05-09 01:45:16 +08:00
|
|
|
idle_test_brush (GimpBrushData *bdata)
|
1998-09-19 08:40:27 +08:00
|
|
|
{
|
2000-05-09 01:45:16 +08:00
|
|
|
do_brush_callback (bdata);
|
|
|
|
|
1998-09-19 08:40:27 +08:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-10-02 06:09:01 +08:00
|
|
|
static gint
|
2000-05-09 01:45:16 +08:00
|
|
|
idle_test_pattern (GimpPatternData *pdata)
|
1998-10-02 06:09:01 +08:00
|
|
|
{
|
2000-05-09 01:45:16 +08:00
|
|
|
do_pattern_callback (pdata);
|
|
|
|
|
1998-10-02 06:09:01 +08:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1998-11-01 00:22:37 +08:00
|
|
|
static gint
|
2000-05-09 01:45:16 +08:00
|
|
|
idle_test_gradient (GimpGradientData *gdata)
|
1998-11-01 00:22:37 +08:00
|
|
|
{
|
2000-05-09 01:45:16 +08:00
|
|
|
do_gradient_callback (gdata);
|
|
|
|
|
1998-11-01 00:22:37 +08:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1998-09-19 08:40:27 +08:00
|
|
|
static void
|
2000-05-31 14:15:06 +08:00
|
|
|
temp_brush_invoker (gchar *name,
|
|
|
|
gint nparams,
|
|
|
|
GimpParam *param,
|
|
|
|
gint *nreturn_vals,
|
|
|
|
GimpParam **return_vals)
|
1998-09-19 08:40:27 +08:00
|
|
|
{
|
2000-05-31 14:15:06 +08:00
|
|
|
static GimpParam values[1];
|
2000-08-03 09:35:28 +08:00
|
|
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
2000-05-09 01:45:16 +08:00
|
|
|
GimpBrushData *bdata;
|
1998-09-19 08:40:27 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
bdata = (GimpBrushData *) g_hash_table_lookup (gbrush_ht, name);
|
|
|
|
|
|
|
|
if (!bdata)
|
|
|
|
g_warning("Can't find internal brush data");
|
1998-09-19 08:40:27 +08:00
|
|
|
else
|
2000-05-09 01:45:16 +08:00
|
|
|
if(!bdata->busy)
|
|
|
|
{
|
|
|
|
bdata->bname = g_strdup (param[0].data.d_string);
|
|
|
|
bdata->opacity = (gdouble)param[1].data.d_float;
|
|
|
|
bdata->spacing = param[2].data.d_int32;
|
|
|
|
bdata->paint_mode = param[3].data.d_int32;
|
|
|
|
bdata->width = param[4].data.d_int32;
|
|
|
|
bdata->height = param[5].data.d_int32;
|
|
|
|
bdata->brush_mask_data = g_malloc(param[6].data.d_int32);
|
|
|
|
g_memmove (bdata->brush_mask_data,
|
|
|
|
param[7].data.d_int8array, param[6].data.d_int32);
|
|
|
|
bdata->closing = param[8].data.d_int32;
|
|
|
|
active_brush_pdb = bdata;
|
|
|
|
bdata->busy = TRUE;
|
|
|
|
|
|
|
|
gtk_idle_add ((GtkFunction)idle_test_brush, active_brush_pdb);
|
|
|
|
}
|
1998-10-02 06:09:01 +08:00
|
|
|
|
|
|
|
*nreturn_vals = 1;
|
|
|
|
*return_vals = values;
|
|
|
|
|
2000-08-03 09:35:28 +08:00
|
|
|
values[0].type = GIMP_PDB_STATUS;
|
1998-10-02 06:09:01 +08:00
|
|
|
values[0].data.d_status = status;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-05-31 14:15:06 +08:00
|
|
|
temp_pattern_invoker (gchar *name,
|
|
|
|
gint nparams,
|
|
|
|
GimpParam *param,
|
|
|
|
gint *nreturn_vals,
|
|
|
|
GimpParam **return_vals)
|
1998-10-02 06:09:01 +08:00
|
|
|
{
|
2000-05-31 14:15:06 +08:00
|
|
|
static GimpParam values[1];
|
2000-08-03 09:35:28 +08:00
|
|
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
2000-05-09 01:45:16 +08:00
|
|
|
GimpPatternData *pdata;
|
1998-10-02 06:09:01 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
pdata = (GimpPatternData *)g_hash_table_lookup (gpattern_ht, name);
|
1998-10-02 06:09:01 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
if (!pdata)
|
|
|
|
g_warning ("Can't find internal pattern data");
|
|
|
|
else
|
|
|
|
if (!pdata->busy)
|
|
|
|
{
|
|
|
|
pdata->pname = g_strdup(param[0].data.d_string);
|
|
|
|
pdata->width = param[1].data.d_int32;
|
|
|
|
pdata->height = param[2].data.d_int32;
|
|
|
|
pdata->bytes = param[3].data.d_int32;
|
|
|
|
pdata->pattern_mask_data = g_malloc(param[4].data.d_int32);
|
|
|
|
g_memmove (pdata->pattern_mask_data,
|
|
|
|
param[5].data.d_int8array, param[4].data.d_int32);
|
|
|
|
pdata->closing = param[6].data.d_int32;
|
|
|
|
active_pattern_pdb = pdata;
|
|
|
|
pdata->busy = TRUE;
|
|
|
|
|
|
|
|
gtk_idle_add ((GtkFunction)idle_test_pattern, active_pattern_pdb);
|
|
|
|
}
|
1998-09-19 08:40:27 +08:00
|
|
|
|
|
|
|
*nreturn_vals = 1;
|
|
|
|
*return_vals = values;
|
|
|
|
|
2000-08-03 09:35:28 +08:00
|
|
|
values[0].type = GIMP_PDB_STATUS;
|
1998-09-19 08:40:27 +08:00
|
|
|
values[0].data.d_status = status;
|
|
|
|
}
|
|
|
|
|
1998-11-01 00:22:37 +08:00
|
|
|
static void
|
2000-05-31 14:15:06 +08:00
|
|
|
temp_gradient_invoker (gchar *name,
|
|
|
|
gint nparams,
|
|
|
|
GimpParam *param,
|
|
|
|
gint *nreturn_vals,
|
|
|
|
GimpParam **return_vals)
|
1998-11-01 00:22:37 +08:00
|
|
|
{
|
2000-05-31 14:15:06 +08:00
|
|
|
static GimpParam values[1];
|
2000-08-03 09:35:28 +08:00
|
|
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
2000-05-09 01:45:16 +08:00
|
|
|
GimpGradientData *gdata;
|
1998-11-01 00:22:37 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
gdata = (GimpGradientData *) g_hash_table_lookup (ggradient_ht, name);
|
|
|
|
|
|
|
|
if (!gdata)
|
1998-11-01 00:22:37 +08:00
|
|
|
g_warning("Can't find internal gradient data");
|
|
|
|
else
|
|
|
|
{
|
2000-05-09 01:45:16 +08:00
|
|
|
if (!gdata->busy)
|
1998-11-01 00:22:37 +08:00
|
|
|
{
|
2000-05-09 01:45:16 +08:00
|
|
|
gint i;
|
|
|
|
gdouble *pv;
|
|
|
|
gdouble *values;
|
|
|
|
|
|
|
|
gdata->gname = g_strdup (param[0].data.d_string);
|
|
|
|
gdata->width = param[1].data.d_int32;
|
|
|
|
gdata->gradient_data = g_new (gdouble, param[1].data.d_int32);
|
|
|
|
|
1998-11-01 00:22:37 +08:00
|
|
|
values = param[2].data.d_floatarray;
|
|
|
|
pv = gdata->gradient_data;
|
|
|
|
|
|
|
|
for (i = 0; i < gdata->width; i++)
|
|
|
|
gdata->gradient_data[i] = param[2].data.d_floatarray[i];
|
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
gdata->closing = param[3].data.d_int32;
|
1998-11-01 00:22:37 +08:00
|
|
|
active_gradient_pdb = gdata;
|
2000-05-09 01:45:16 +08:00
|
|
|
gdata->busy = TRUE;
|
|
|
|
gtk_idle_add ((GtkFunction)idle_test_gradient, active_gradient_pdb);
|
1998-11-01 00:22:37 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*nreturn_vals = 1;
|
|
|
|
*return_vals = values;
|
|
|
|
|
2000-08-03 09:35:28 +08:00
|
|
|
values[0].type = GIMP_PDB_STATUS;
|
1998-11-01 00:22:37 +08:00
|
|
|
values[0].data.d_status = status;
|
|
|
|
}
|
|
|
|
|
1999-03-07 20:56:03 +08:00
|
|
|
static gboolean
|
|
|
|
input_callback (GIOChannel *channel,
|
|
|
|
GIOCondition condition,
|
|
|
|
gpointer data)
|
1998-09-19 08:40:27 +08:00
|
|
|
{
|
|
|
|
/* We have some data in the wire - read it */
|
|
|
|
/* The below will only ever run a single proc */
|
2000-05-09 01:45:16 +08:00
|
|
|
gimp_run_temp ();
|
1999-03-07 20:56:03 +08:00
|
|
|
|
|
|
|
return TRUE;
|
1998-09-19 08:40:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-09-21 07:04:33 +08:00
|
|
|
gimp_setup_callbacks (void)
|
1998-09-19 08:40:27 +08:00
|
|
|
{
|
2000-05-09 01:45:16 +08:00
|
|
|
static gboolean first_time = TRUE;
|
1999-03-07 20:56:03 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
if (first_time)
|
1998-09-19 08:40:27 +08:00
|
|
|
{
|
2000-05-09 01:45:16 +08:00
|
|
|
/* Tie into the gdk input function only once */
|
1999-03-07 20:56:03 +08:00
|
|
|
g_io_add_watch (_readchannel, G_IO_IN | G_IO_PRI, input_callback, NULL);
|
2000-05-09 01:45:16 +08:00
|
|
|
|
1998-09-19 08:40:27 +08:00
|
|
|
first_time = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
1998-09-21 07:04:33 +08:00
|
|
|
gen_temp_plugin_name (void)
|
1998-09-19 08:40:27 +08:00
|
|
|
{
|
2000-05-31 14:15:06 +08:00
|
|
|
GimpParam *return_vals;
|
2000-05-09 01:45:16 +08:00
|
|
|
gint nreturn_vals;
|
|
|
|
gchar *result;
|
1998-09-19 08:40:27 +08:00
|
|
|
|
|
|
|
return_vals = gimp_run_procedure ("gimp_temp_PDB_name",
|
|
|
|
&nreturn_vals,
|
2000-08-03 09:35:28 +08:00
|
|
|
GIMP_PDB_END);
|
1998-09-19 08:40:27 +08:00
|
|
|
|
|
|
|
result = "temp_name_gen_failed";
|
2000-08-03 09:35:28 +08:00
|
|
|
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
1998-09-19 08:40:27 +08:00
|
|
|
result = g_strdup (return_vals[1].data.d_string);
|
|
|
|
|
|
|
|
gimp_destroy_params (return_vals, nreturn_vals);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Can only be used in conjuction with gdk since we need to tie into the input
|
|
|
|
* selection mech.
|
|
|
|
*/
|
2000-06-01 05:16:11 +08:00
|
|
|
gchar *
|
2000-05-31 14:15:06 +08:00
|
|
|
gimp_interactive_selection_brush (gchar *dialogname,
|
|
|
|
gchar *brush_name,
|
|
|
|
gdouble opacity,
|
|
|
|
gint spacing,
|
|
|
|
gint paint_mode,
|
|
|
|
GimpRunBrushCallback callback,
|
|
|
|
gpointer data)
|
1998-09-19 08:40:27 +08:00
|
|
|
{
|
2000-05-31 14:15:06 +08:00
|
|
|
static GimpParamDef args[] =
|
1998-09-19 08:40:27 +08:00
|
|
|
{
|
2000-08-03 09:35:28 +08:00
|
|
|
{ GIMP_PDB_STRING, "str", "String" },
|
|
|
|
{ GIMP_PDB_FLOAT, "opacity", "Opacity" },
|
|
|
|
{ GIMP_PDB_INT32, "spacing", "Spacing" },
|
|
|
|
{ GIMP_PDB_INT32, "paint mode", "Paint mode" },
|
|
|
|
{ GIMP_PDB_INT32, "mask width", "Brush width" },
|
|
|
|
{ GIMP_PDB_INT32, "mask height" "Brush heigth" },
|
|
|
|
{ GIMP_PDB_INT32, "mask len", "Length of brush mask data" },
|
|
|
|
{ GIMP_PDB_INT8ARRAY, "mask data", "The brush mask data" },
|
|
|
|
{ GIMP_PDB_INT32, "dialog status", "Registers if the dialog was closing "
|
2000-05-31 14:15:06 +08:00
|
|
|
"[0 = No, 1 = Yes]" },
|
1998-09-19 08:40:27 +08:00
|
|
|
};
|
2000-05-31 14:15:06 +08:00
|
|
|
static GimpParamDef *return_vals = NULL;
|
|
|
|
static gint nargs = sizeof (args) / sizeof (args[0]);
|
|
|
|
static gint nreturn_vals = 0;
|
1998-09-19 08:40:27 +08:00
|
|
|
gint bnreturn_vals;
|
2000-05-31 14:15:06 +08:00
|
|
|
GimpParam *pdbreturn_vals;
|
2000-05-09 01:45:16 +08:00
|
|
|
gchar *pdbname = gen_temp_plugin_name ();
|
|
|
|
GimpBrushData *bdata;
|
|
|
|
|
|
|
|
bdata = g_new0 (GimpBrushData, 1);
|
1998-09-19 08:40:27 +08:00
|
|
|
|
|
|
|
gimp_install_temp_proc (pdbname,
|
|
|
|
"Temp PDB for interactive popups",
|
|
|
|
"More here later",
|
|
|
|
"Andy Thomas",
|
|
|
|
"Andy Thomas",
|
|
|
|
"1997",
|
|
|
|
NULL,
|
|
|
|
"RGB*, GRAY*",
|
2000-08-03 09:35:28 +08:00
|
|
|
GIMP_TEMPORARY,
|
1998-09-19 08:40:27 +08:00
|
|
|
nargs, nreturn_vals,
|
|
|
|
args, return_vals,
|
|
|
|
temp_brush_invoker);
|
|
|
|
|
|
|
|
pdbreturn_vals =
|
2000-05-31 14:15:06 +08:00
|
|
|
gimp_run_procedure ("gimp_brushes_popup",
|
|
|
|
&bnreturn_vals,
|
2000-08-03 09:35:28 +08:00
|
|
|
GIMP_PDB_STRING, pdbname,
|
|
|
|
GIMP_PDB_STRING, dialogname,
|
|
|
|
GIMP_PDB_STRING, brush_name,
|
|
|
|
GIMP_PDB_FLOAT, opacity,
|
|
|
|
GIMP_PDB_INT32, spacing,
|
|
|
|
GIMP_PDB_INT32, paint_mode,
|
|
|
|
GIMP_PDB_END);
|
|
|
|
|
|
|
|
/* if (pdbreturn_vals[0].data.d_status != GIMP_PDB_SUCCESS) */
|
1998-09-19 08:40:27 +08:00
|
|
|
/* { */
|
|
|
|
/* printf("ret failed = 0x%x\n",bnreturn_vals); */
|
|
|
|
/* } */
|
|
|
|
/* else */
|
|
|
|
/* printf("worked = 0x%x\n",bnreturn_vals); */
|
|
|
|
|
2000-05-31 14:15:06 +08:00
|
|
|
gimp_setup_callbacks (); /* New function to allow callbacks to be watched */
|
1998-09-19 08:40:27 +08:00
|
|
|
|
|
|
|
gimp_destroy_params (pdbreturn_vals,bnreturn_vals);
|
|
|
|
|
|
|
|
/* g_free(pdbname); */
|
|
|
|
|
|
|
|
/* Now add to hash table so we can find it again */
|
2000-05-09 01:45:16 +08:00
|
|
|
if (gbrush_ht == NULL)
|
1998-09-19 08:40:27 +08:00
|
|
|
gbrush_ht = g_hash_table_new (g_str_hash,
|
2000-05-09 01:45:16 +08:00
|
|
|
g_str_equal);
|
|
|
|
|
1998-09-19 08:40:27 +08:00
|
|
|
bdata->callback = callback;
|
2000-05-09 01:45:16 +08:00
|
|
|
bdata->data = data;
|
|
|
|
g_hash_table_insert (gbrush_ht, pdbname, bdata);
|
1998-10-21 06:36:52 +08:00
|
|
|
|
|
|
|
return pdbname;
|
|
|
|
}
|
|
|
|
|
|
|
|
gchar *
|
2000-05-31 14:15:06 +08:00
|
|
|
gimp_interactive_selection_pattern (gchar *dialogname,
|
|
|
|
gchar *pattern_name,
|
|
|
|
GimpRunPatternCallback callback,
|
|
|
|
gpointer data)
|
1998-10-02 06:09:01 +08:00
|
|
|
{
|
2000-05-31 14:15:06 +08:00
|
|
|
static GimpParamDef args[] =
|
1998-10-02 06:09:01 +08:00
|
|
|
{
|
2000-08-03 09:35:28 +08:00
|
|
|
{ GIMP_PDB_STRING, "str", "String" },
|
|
|
|
{ GIMP_PDB_INT32, "mask width", "Pattern width" },
|
|
|
|
{ GIMP_PDB_INT32, "mask height", "Pattern heigth" },
|
|
|
|
{ GIMP_PDB_INT32, "mask bpp", "Pattern bytes per pixel" },
|
|
|
|
{ GIMP_PDB_INT32, "mask len", "Length of pattern mask data" },
|
|
|
|
{ GIMP_PDB_INT8ARRAY,"mask data", "The pattern mask data" },
|
|
|
|
{ GIMP_PDB_INT32, "dialog status", "Registers if the dialog was closing "
|
2000-05-31 14:15:06 +08:00
|
|
|
"[0 = No, 1 = Yes]" },
|
1998-10-02 06:09:01 +08:00
|
|
|
};
|
2000-05-31 14:15:06 +08:00
|
|
|
static GimpParamDef *return_vals = NULL;
|
|
|
|
static gint nargs = sizeof (args) / sizeof (args[0]);
|
|
|
|
static gint nreturn_vals = 0;
|
1998-10-02 06:09:01 +08:00
|
|
|
gint bnreturn_vals;
|
2000-05-31 14:15:06 +08:00
|
|
|
GimpParam *pdbreturn_vals;
|
2000-05-09 01:45:16 +08:00
|
|
|
gchar *pdbname = gen_temp_plugin_name ();
|
|
|
|
GimpPatternData *pdata;
|
|
|
|
|
|
|
|
pdata = g_new0 (GimpPatternData, 1);
|
1998-10-02 06:09:01 +08:00
|
|
|
|
|
|
|
gimp_install_temp_proc (pdbname,
|
|
|
|
"Temp PDB for interactive popups",
|
|
|
|
"More here later",
|
|
|
|
"Andy Thomas",
|
|
|
|
"Andy Thomas",
|
|
|
|
"1997",
|
|
|
|
NULL,
|
|
|
|
"RGB*, GRAY*",
|
2000-08-03 09:35:28 +08:00
|
|
|
GIMP_TEMPORARY,
|
1998-10-02 06:09:01 +08:00
|
|
|
nargs, nreturn_vals,
|
|
|
|
args, return_vals,
|
|
|
|
temp_pattern_invoker);
|
|
|
|
|
|
|
|
pdbreturn_vals =
|
|
|
|
gimp_run_procedure("gimp_patterns_popup",
|
|
|
|
&bnreturn_vals,
|
2000-08-03 09:35:28 +08:00
|
|
|
GIMP_PDB_STRING,pdbname,
|
|
|
|
GIMP_PDB_STRING,dialogname,
|
|
|
|
GIMP_PDB_STRING,pattern_name,/*name*/
|
|
|
|
GIMP_PDB_END);
|
1998-10-02 06:09:01 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
gimp_setup_callbacks (); /* New function to allow callbacks to be watched */
|
1998-10-02 06:09:01 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
gimp_destroy_params (pdbreturn_vals, bnreturn_vals);
|
1998-10-02 06:09:01 +08:00
|
|
|
|
|
|
|
/* Now add to hash table so we can find it again */
|
2000-05-09 01:45:16 +08:00
|
|
|
if (gpattern_ht == NULL)
|
1998-10-02 06:09:01 +08:00
|
|
|
gpattern_ht = g_hash_table_new (g_str_hash,
|
2000-05-09 01:45:16 +08:00
|
|
|
g_str_equal);
|
1998-10-02 06:09:01 +08:00
|
|
|
|
|
|
|
pdata->callback = callback;
|
2000-05-09 01:45:16 +08:00
|
|
|
pdata->data = data;
|
|
|
|
g_hash_table_insert (gpattern_ht, pdbname,pdata);
|
1998-10-02 06:09:01 +08:00
|
|
|
|
|
|
|
return pdbname;
|
|
|
|
}
|
|
|
|
|
|
|
|
gchar *
|
2000-05-31 14:15:06 +08:00
|
|
|
gimp_interactive_selection_gradient (gchar *dialogname,
|
|
|
|
gchar *gradient_name,
|
|
|
|
gint sample_sz,
|
|
|
|
GimpRunGradientCallback callback,
|
|
|
|
gpointer data)
|
1998-11-01 00:22:37 +08:00
|
|
|
{
|
2000-05-31 14:15:06 +08:00
|
|
|
static GimpParamDef args[] =
|
1998-11-01 00:22:37 +08:00
|
|
|
{
|
2000-08-03 09:35:28 +08:00
|
|
|
{ GIMP_PDB_STRING, "str", "String" },
|
|
|
|
{ GIMP_PDB_INT32, "grad width", "Gradient width" },
|
|
|
|
{ GIMP_PDB_FLOATARRAY,"grad data", "The gradient mask data" },
|
|
|
|
{ GIMP_PDB_INT32, "dialog status", "Registers if the dialog was closing "
|
2000-05-31 14:15:06 +08:00
|
|
|
"[0 = No, 1 = Yes]" },
|
1998-11-01 00:22:37 +08:00
|
|
|
};
|
2000-05-31 14:15:06 +08:00
|
|
|
static GimpParamDef *return_vals = NULL;
|
|
|
|
static gint nargs = sizeof (args) / sizeof (args[0]);
|
|
|
|
static gint nreturn_vals = 0;
|
|
|
|
gint bnreturn_vals;
|
|
|
|
GimpParam *pdbreturn_vals;
|
|
|
|
gchar *pdbname = gen_temp_plugin_name();
|
2000-05-09 01:45:16 +08:00
|
|
|
GimpGradientData *gdata;
|
|
|
|
|
|
|
|
gdata = g_new0 (GimpGradientData, 1);
|
1998-11-01 00:22:37 +08:00
|
|
|
|
|
|
|
gimp_install_temp_proc (pdbname,
|
|
|
|
"Temp PDB for interactive popups",
|
|
|
|
"More here later",
|
|
|
|
"Andy Thomas",
|
|
|
|
"Andy Thomas",
|
|
|
|
"1997",
|
|
|
|
NULL,
|
|
|
|
"RGB*, GRAY*",
|
2000-08-03 09:35:28 +08:00
|
|
|
GIMP_TEMPORARY,
|
1998-11-01 00:22:37 +08:00
|
|
|
nargs, nreturn_vals,
|
|
|
|
args, return_vals,
|
|
|
|
temp_gradient_invoker);
|
|
|
|
|
|
|
|
pdbreturn_vals =
|
2000-05-09 01:45:16 +08:00
|
|
|
gimp_run_procedure ("gimp_gradients_popup",
|
|
|
|
&bnreturn_vals,
|
2000-08-03 09:35:28 +08:00
|
|
|
GIMP_PDB_STRING, pdbname,
|
|
|
|
GIMP_PDB_STRING, dialogname,
|
|
|
|
GIMP_PDB_STRING, gradient_name, /*name*/
|
|
|
|
GIMP_PDB_INT32, sample_sz, /* size of sample to be returned */
|
|
|
|
GIMP_PDB_END);
|
1998-11-01 00:22:37 +08:00
|
|
|
|
2000-05-09 01:45:16 +08:00
|
|
|
gimp_setup_callbacks (); /* New function to allow callbacks to be watched */
|
1998-11-01 00:22:37 +08:00
|
|
|
|
|
|
|
gimp_destroy_params (pdbreturn_vals,bnreturn_vals);
|
|
|
|
|
|
|
|
/* Now add to hash table so we can find it again */
|
2000-05-09 01:45:16 +08:00
|
|
|
if (ggradient_ht == NULL)
|
1998-11-01 00:22:37 +08:00
|
|
|
ggradient_ht = g_hash_table_new (g_str_hash,
|
|
|
|
g_str_equal);
|
|
|
|
|
|
|
|
gdata->callback = callback;
|
2000-05-09 01:45:16 +08:00
|
|
|
gdata->data = data;
|
|
|
|
g_hash_table_insert (ggradient_ht, pdbname,gdata);
|
1998-11-01 00:22:37 +08:00
|
|
|
|
|
|
|
return pdbname;
|
|
|
|
}
|