2000-05-08 17:45:16 +00:00
|
|
|
/* LIBGIMP - The GIMP Library
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
1998-01-25 10:26:47 +00:00
|
|
|
*
|
2000-05-31 06:15:06 +00:00
|
|
|
* gimpmenu.c
|
|
|
|
*
|
1998-01-25 10:26:47 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
1999-11-17 21:13:50 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1998-01-25 10:26:47 +00:00
|
|
|
* License as published by the Free Software Foundation; either
|
2000-05-08 17:45:16 +00: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 10:26:47 +00:00
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
1999-11-17 21:13:50 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
1998-04-13 05:44:11 +00: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-08 17:45:16 +00:00
|
|
|
*/
|
|
|
|
|
2002-05-13 13:21:55 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
1997-11-24 22:05:25 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
2002-01-30 14:54:27 +00:00
|
|
|
#ifdef __GNUC__
|
|
|
|
#warning GTK_DISABLE_DEPRECATED
|
|
|
|
#endif
|
|
|
|
#undef GTK_DISABLE_DEPRECATED
|
|
|
|
|
1997-11-24 22:05:25 +00:00
|
|
|
#include "gimp.h"
|
|
|
|
#include "gimpui.h"
|
|
|
|
|
2002-05-13 13:21:55 +00:00
|
|
|
#include "libgimp-intl.h"
|
2002-01-30 14:54:27 +00:00
|
|
|
|
2003-06-19 13:01:49 +00:00
|
|
|
|
2000-05-08 17:45:16 +00:00
|
|
|
#define MENU_THUMBNAIL_WIDTH 24
|
|
|
|
#define MENU_THUMBNAIL_HEIGHT 24
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2003-06-19 13:01:49 +00:00
|
|
|
|
1998-09-20 23:04:33 +00:00
|
|
|
/* Copy data from temp_PDB call */
|
2000-05-08 17:45:16 +00:00
|
|
|
struct _GimpBrushData
|
|
|
|
{
|
2003-06-19 13:01:49 +00:00
|
|
|
guint idle_id;
|
|
|
|
gchar *name;
|
|
|
|
gdouble opacity;
|
|
|
|
gint spacing;
|
|
|
|
gint paint_mode;
|
|
|
|
gint width;
|
|
|
|
gint height;
|
|
|
|
guchar *brush_mask_data;
|
|
|
|
GimpRunBrushCallback callback;
|
|
|
|
gboolean closing;
|
|
|
|
gpointer data;
|
1998-09-20 23:04:33 +00:00
|
|
|
};
|
|
|
|
|
2000-05-08 17:45:16 +00:00
|
|
|
typedef struct _GimpBrushData GimpBrushData;
|
1998-09-20 23:04:33 +00:00
|
|
|
|
2003-03-28 14:13:54 +00:00
|
|
|
|
1998-10-01 22:09:01 +00:00
|
|
|
/* Copy data from temp_PDB call */
|
2003-03-28 14:13:54 +00:00
|
|
|
struct _GimpFontData
|
2000-05-08 17:45:16 +00:00
|
|
|
{
|
2003-06-19 13:01:49 +00:00
|
|
|
guint idle_id;
|
|
|
|
gchar *name;
|
2003-03-28 14:13:54 +00:00
|
|
|
GimpRunFontCallback callback;
|
2003-06-19 13:01:49 +00:00
|
|
|
gboolean closing;
|
|
|
|
gpointer data;
|
1998-10-01 22:09:01 +00:00
|
|
|
};
|
|
|
|
|
2003-03-28 14:13:54 +00:00
|
|
|
typedef struct _GimpFontData GimpFontData;
|
|
|
|
|
1998-09-20 23:04:33 +00:00
|
|
|
|
1998-10-31 16:22:37 +00:00
|
|
|
/* Copy data from temp_PDB call */
|
2000-05-08 17:45:16 +00:00
|
|
|
struct _GimpGradientData
|
|
|
|
{
|
2003-06-19 13:01:49 +00:00
|
|
|
guint idle_id;
|
|
|
|
gchar *name;
|
|
|
|
gint width;
|
|
|
|
gdouble *gradient_data;
|
2000-05-31 06:15:06 +00:00
|
|
|
GimpRunGradientCallback callback;
|
2003-06-19 13:01:49 +00:00
|
|
|
gboolean closing;
|
|
|
|
gpointer data;
|
1998-10-31 16:22:37 +00:00
|
|
|
};
|
|
|
|
|
2000-05-08 17:45:16 +00:00
|
|
|
typedef struct _GimpGradientData GimpGradientData;
|
|
|
|
|
2003-03-28 14:13:54 +00:00
|
|
|
|
|
|
|
/* Copy data from temp_PDB call */
|
|
|
|
struct _GimpPatternData
|
|
|
|
{
|
2003-06-19 13:01:49 +00:00
|
|
|
guint idle_id;
|
|
|
|
gchar *name;
|
|
|
|
gint width;
|
|
|
|
gint height;
|
|
|
|
gint bytes;
|
|
|
|
guchar *pattern_mask_data;
|
|
|
|
GimpRunPatternCallback callback;
|
|
|
|
gboolean closing;
|
|
|
|
gpointer data;
|
2003-03-28 14:13:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _GimpPatternData GimpPatternData;
|
|
|
|
|
|
|
|
|
2003-06-19 13:01:49 +00:00
|
|
|
static void gimp_menu_callback (GtkWidget *widget,
|
|
|
|
gint32 *id);
|
|
|
|
|
|
|
|
static gboolean idle_brush_callback (GimpBrushData *bdata);
|
|
|
|
static gboolean idle_font_callback (GimpFontData *fdata);
|
|
|
|
static gboolean idle_gradient_callback (GimpGradientData *gdata);
|
|
|
|
static gboolean idle_pattern_callback (GimpPatternData *pdata);
|
|
|
|
|
|
|
|
static void temp_brush_invoker (gchar *name,
|
|
|
|
gint nparams,
|
|
|
|
GimpParam *param,
|
|
|
|
gint *nreturn_vals,
|
|
|
|
GimpParam **return_vals);
|
|
|
|
static gchar * gen_temp_plugin_name (void);
|
|
|
|
static void fill_preview_with_thumb (GtkWidget *widget,
|
|
|
|
gint32 drawable_ID,
|
|
|
|
gint width,
|
|
|
|
gint height);
|
|
|
|
|
2000-05-31 06:15:06 +00:00
|
|
|
|
2003-06-19 13:01:49 +00:00
|
|
|
static GHashTable *gbrush_ht = NULL;
|
|
|
|
static GHashTable *gfont_ht = NULL;
|
|
|
|
static GHashTable *ggradient_ht = NULL;
|
|
|
|
static GHashTable *gpattern_ht = NULL;
|
|
|
|
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2000-05-31 06:15:06 +00:00
|
|
|
GtkWidget *
|
1997-11-24 22:05:25 +00:00
|
|
|
gimp_image_menu_new (GimpConstraintFunc constraint,
|
|
|
|
GimpMenuCallback callback,
|
|
|
|
gpointer data,
|
|
|
|
gint32 active_image)
|
|
|
|
{
|
|
|
|
GtkWidget *menu;
|
|
|
|
GtkWidget *menuitem;
|
2002-05-13 13:21:55 +00:00
|
|
|
gchar *name;
|
2001-08-29 17:48:28 +00:00
|
|
|
gchar *label;
|
|
|
|
gint32 *images;
|
|
|
|
gint nimages;
|
|
|
|
gint i, k;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
|
|
|
menu = gtk_menu_new ();
|
2001-07-31 12:10:14 +00: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-24 22:05:25 +00:00
|
|
|
|
2000-08-03 01:35:28 +00:00
|
|
|
images = gimp_image_list (&nimages);
|
1997-11-24 22:05:25 +00:00
|
|
|
for (i = 0, k = 0; i < nimages; i++)
|
|
|
|
if (!constraint || (* constraint) (images[i], -1, data))
|
|
|
|
{
|
2002-05-13 13:21:55 +00:00
|
|
|
name = gimp_image_get_name (images[i]);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2002-05-13 13:21:55 +00:00
|
|
|
label = g_strdup_printf ("%s-%d", name, images[i]);
|
2001-08-29 17:48:28 +00:00
|
|
|
|
2002-05-13 13:21:55 +00:00
|
|
|
g_free (name);
|
2001-08-29 17:48:28 +00:00
|
|
|
|
1997-11-24 22:05:25 +00:00
|
|
|
menuitem = gtk_menu_item_new_with_label (label);
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_connect (menuitem, "activate",
|
2001-07-31 12:10:14 +00: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-24 21:27:11 +00:00
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
1997-11-24 22:05:25 +00: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 13:21:55 +00:00
|
|
|
menuitem = gtk_menu_item_new_with_label (_("None"));
|
1997-11-24 22:05:25 +00: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-24 21:27:11 +00:00
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
1997-11-24 22:05:25 +00:00
|
|
|
gtk_widget_show (menuitem);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (images)
|
|
|
|
{
|
|
|
|
if (active_image == -1)
|
|
|
|
active_image = images[0];
|
|
|
|
(* callback) (active_image, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
1999-06-23 23:01:14 +00:00
|
|
|
|
2000-05-31 06:15:06 +00:00
|
|
|
GtkWidget *
|
1997-11-24 22:05:25 +00:00
|
|
|
gimp_layer_menu_new (GimpConstraintFunc constraint,
|
|
|
|
GimpMenuCallback callback,
|
|
|
|
gpointer data,
|
|
|
|
gint32 active_layer)
|
|
|
|
{
|
|
|
|
GtkWidget *menu;
|
|
|
|
GtkWidget *menuitem;
|
2001-08-29 17:48:28 +00:00
|
|
|
gchar *name;
|
|
|
|
gchar *image_label;
|
|
|
|
gchar *label;
|
|
|
|
gint32 *images;
|
|
|
|
gint32 *layers;
|
|
|
|
gint32 layer;
|
|
|
|
gint nimages;
|
|
|
|
gint nlayers;
|
|
|
|
gint i, j, k;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
|
|
|
menu = gtk_menu_new ();
|
2001-07-31 12:10:14 +00:00
|
|
|
g_object_set_data (G_OBJECT (menu), "gimp_callback", callback);
|
|
|
|
g_object_set_data (G_OBJECT (menu), "gimp_callback_data", data);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
|
|
|
layer = -1;
|
|
|
|
|
2000-08-03 01:35:28 +00:00
|
|
|
images = gimp_image_list (&nimages);
|
1997-11-24 22:05:25 +00:00
|
|
|
for (i = 0, k = 0; i < nimages; i++)
|
|
|
|
if (!constraint || (* constraint) (images[i], -1, data))
|
|
|
|
{
|
2002-05-13 13:21:55 +00:00
|
|
|
name = gimp_image_get_name (images[i]);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2002-05-13 13:21:55 +00:00
|
|
|
image_label = g_strdup_printf ("%s-%d", name, images[i]);
|
2001-08-29 17:48:28 +00:00
|
|
|
|
2002-05-13 13:21:55 +00:00
|
|
|
g_free (name);
|
2001-08-29 17:48:28 +00:00
|
|
|
|
1997-11-24 22:05:25 +00: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-23 23:01:14 +00:00
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *wcolor_box;
|
|
|
|
GtkWidget *wlabel;
|
|
|
|
|
1997-11-24 22:05:25 +00:00
|
|
|
name = gimp_layer_get_name (layers[j]);
|
2000-05-31 06:15:06 +00:00
|
|
|
label = g_strdup_printf ("%s/%s", image_label, name);
|
1997-11-24 22:05:25 +00:00
|
|
|
g_free (name);
|
|
|
|
|
1999-06-23 23:01:14 +00:00
|
|
|
menuitem = gtk_menu_item_new();
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_connect (menuitem, "activate",
|
2001-07-31 12:10:14 +00:00
|
|
|
G_CALLBACK (gimp_menu_callback),
|
|
|
|
&layers[j]);
|
1999-06-23 23:01:14 +00:00
|
|
|
|
2003-01-05 22:07:10 +00:00
|
|
|
hbox = gtk_hbox_new (FALSE, 0);
|
|
|
|
gtk_container_add (GTK_CONTAINER (menuitem), hbox);
|
|
|
|
gtk_widget_show (hbox);
|
1999-06-23 23:01:14 +00:00
|
|
|
|
2003-01-05 22:07:10 +00:00
|
|
|
vbox = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (vbox);
|
1999-06-23 23:01:14 +00:00
|
|
|
|
2003-01-05 22:07:10 +00:00
|
|
|
wcolor_box = gtk_preview_new (GTK_PREVIEW_COLOR);
|
2002-05-13 13:21:55 +00:00
|
|
|
gtk_preview_set_dither (GTK_PREVIEW (wcolor_box),
|
|
|
|
GDK_RGB_DITHER_MAX);
|
1999-06-23 23:01:14 +00:00
|
|
|
|
2000-05-31 06:15:06 +00:00
|
|
|
fill_preview_with_thumb (wcolor_box,
|
|
|
|
layers[j],
|
|
|
|
MENU_THUMBNAIL_WIDTH,
|
|
|
|
MENU_THUMBNAIL_HEIGHT);
|
1999-06-23 23:01:14 +00:00
|
|
|
|
2001-12-29 13:26:29 +00:00
|
|
|
gtk_widget_set_size_request (GTK_WIDGET (wcolor_box),
|
|
|
|
MENU_THUMBNAIL_WIDTH,
|
|
|
|
MENU_THUMBNAIL_HEIGHT);
|
1999-06-23 23:01:14 +00:00
|
|
|
|
2000-05-31 06:15:06 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (vbox), wcolor_box);
|
|
|
|
gtk_widget_show (wcolor_box);
|
1999-06-23 23:01:14 +00:00
|
|
|
|
2000-05-31 06:15:06 +00: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-23 23:01:14 +00: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-24 21:27:11 +00:00
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
1997-11-24 22:05:25 +00: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 13:21:55 +00:00
|
|
|
menuitem = gtk_menu_item_new_with_label (_("None"));
|
1997-11-24 22:05:25 +00: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-24 21:27:11 +00:00
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
1997-11-24 22:05:25 +00:00
|
|
|
gtk_widget_show (menuitem);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (layer != -1)
|
|
|
|
(* callback) (layer, data);
|
|
|
|
|
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
2000-05-31 06:15:06 +00:00
|
|
|
GtkWidget *
|
1997-11-24 22:05:25 +00:00
|
|
|
gimp_channel_menu_new (GimpConstraintFunc constraint,
|
|
|
|
GimpMenuCallback callback,
|
|
|
|
gpointer data,
|
|
|
|
gint32 active_channel)
|
|
|
|
{
|
|
|
|
GtkWidget *menu;
|
|
|
|
GtkWidget *menuitem;
|
2001-08-29 17:48:28 +00:00
|
|
|
gchar *name;
|
|
|
|
gchar *image_label;
|
|
|
|
gchar *label;
|
|
|
|
gint32 *images;
|
|
|
|
gint32 *channels;
|
|
|
|
gint32 channel;
|
|
|
|
gint nimages;
|
|
|
|
gint nchannels;
|
|
|
|
gint i, j, k;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
|
|
|
menu = gtk_menu_new ();
|
2001-07-31 12:10:14 +00:00
|
|
|
g_object_set_data (G_OBJECT (menu), "gimp_callback", callback);
|
|
|
|
g_object_set_data (G_OBJECT (menu), "gimp_callback_data", data);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
|
|
|
channel = -1;
|
|
|
|
|
2000-08-03 01:35:28 +00:00
|
|
|
images = gimp_image_list (&nimages);
|
1997-11-24 22:05:25 +00:00
|
|
|
for (i = 0, k = 0; i < nimages; i++)
|
|
|
|
if (!constraint || (* constraint) (images[i], -1, data))
|
|
|
|
{
|
2002-05-13 13:21:55 +00:00
|
|
|
name = gimp_image_get_name (images[i]);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2002-05-13 13:21:55 +00:00
|
|
|
image_label = g_strdup_printf ("%s-%d", name, images[i]);
|
2001-08-29 17:48:28 +00:00
|
|
|
|
2002-05-13 13:21:55 +00:00
|
|
|
g_free (name);
|
2001-08-29 17:48:28 +00:00
|
|
|
|
1997-11-24 22:05:25 +00: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-23 23:01:14 +00:00
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *wcolor_box;
|
|
|
|
GtkWidget *wlabel;
|
|
|
|
|
1997-11-24 22:05:25 +00:00
|
|
|
name = gimp_channel_get_name (channels[j]);
|
2000-05-31 06:15:06 +00:00
|
|
|
label = g_strdup_printf ("%s/%s", image_label, name);
|
1997-11-24 22:05:25 +00:00
|
|
|
g_free (name);
|
|
|
|
|
2000-05-31 06:15:06 +00:00
|
|
|
menuitem = gtk_menu_item_new ();
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_connect (menuitem, "activate",
|
2001-07-31 12:10:14 +00:00
|
|
|
G_CALLBACK (gimp_menu_callback),
|
|
|
|
&channels[j]);
|
1999-06-23 23:01:14 +00:00
|
|
|
|
2000-05-31 06:15:06 +00:00
|
|
|
hbox = gtk_hbox_new (FALSE, 0);
|
|
|
|
gtk_container_add (GTK_CONTAINER (menuitem), hbox);
|
|
|
|
gtk_widget_show (hbox);
|
1999-06-23 23:01:14 +00:00
|
|
|
|
2000-05-31 06:15:06 +00: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-23 23:01:14 +00:00
|
|
|
|
2000-05-31 06:15:06 +00:00
|
|
|
fill_preview_with_thumb (wcolor_box,
|
|
|
|
channels[j],
|
|
|
|
MENU_THUMBNAIL_WIDTH,
|
|
|
|
MENU_THUMBNAIL_HEIGHT);
|
1999-06-23 23:01:14 +00:00
|
|
|
|
2001-12-29 13:26:29 +00:00
|
|
|
gtk_widget_set_size_request (GTK_WIDGET (wcolor_box),
|
|
|
|
MENU_THUMBNAIL_WIDTH,
|
|
|
|
MENU_THUMBNAIL_HEIGHT);
|
1999-06-23 23:01:14 +00:00
|
|
|
|
2000-05-31 06:15:06 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER(vbox), wcolor_box);
|
|
|
|
gtk_widget_show (wcolor_box);
|
1999-06-23 23:01:14 +00:00
|
|
|
|
2000-05-31 06:15:06 +00: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-23 23:01:14 +00: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-24 21:27:11 +00:00
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
1997-11-24 22:05:25 +00: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 13:21:55 +00:00
|
|
|
menuitem = gtk_menu_item_new_with_label (_("None"));
|
1997-11-24 22:05:25 +00: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-24 21:27:11 +00:00
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
1997-11-24 22:05:25 +00:00
|
|
|
gtk_widget_show (menuitem);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (channel != -1)
|
|
|
|
(* callback) (channel, data);
|
|
|
|
|
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
2000-05-31 06:15:06 +00:00
|
|
|
GtkWidget *
|
1997-11-24 22:05:25 +00:00
|
|
|
gimp_drawable_menu_new (GimpConstraintFunc constraint,
|
|
|
|
GimpMenuCallback callback,
|
|
|
|
gpointer data,
|
|
|
|
gint32 active_drawable)
|
|
|
|
{
|
|
|
|
GtkWidget *menu;
|
|
|
|
GtkWidget *menuitem;
|
2001-08-29 17:48:28 +00: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-24 22:05:25 +00:00
|
|
|
|
|
|
|
menu = gtk_menu_new ();
|
2001-07-31 12:10:14 +00:00
|
|
|
g_object_set_data (G_OBJECT (menu), "gimp_callback", callback);
|
|
|
|
g_object_set_data (G_OBJECT (menu), "gimp_callback_data", data);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
|
|
|
drawable = -1;
|
|
|
|
|
2000-08-03 01:35:28 +00:00
|
|
|
images = gimp_image_list (&nimages);
|
2000-05-08 17:45:16 +00:00
|
|
|
|
1997-11-24 22:05:25 +00:00
|
|
|
for (i = 0, k = 0; i < nimages; i++)
|
|
|
|
if (!constraint || (* constraint) (images[i], -1, data))
|
|
|
|
{
|
2002-05-13 13:21:55 +00:00
|
|
|
name = gimp_image_get_name (images[i]);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2002-05-13 13:21:55 +00:00
|
|
|
image_label = g_strdup_printf ("%s-%d", name, images[i]);
|
2001-08-29 17:48:28 +00:00
|
|
|
|
2002-05-13 13:21:55 +00:00
|
|
|
g_free (name);
|
2001-08-29 17:48:28 +00:00
|
|
|
|
1997-11-24 22:05:25 +00:00
|
|
|
layers = gimp_image_get_layers (images[i], &nlayers);
|
2000-05-08 17:45:16 +00:00
|
|
|
|
1997-11-24 22:05:25 +00:00
|
|
|
for (j = 0; j < nlayers; j++)
|
|
|
|
if (!constraint || (* constraint) (images[i], layers[j], data))
|
|
|
|
{
|
1999-06-23 23:01:14 +00:00
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *wcolor_box;
|
|
|
|
GtkWidget *wlabel;
|
|
|
|
|
1997-11-24 22:05:25 +00:00
|
|
|
name = gimp_layer_get_name (layers[j]);
|
2000-05-31 06:15:06 +00:00
|
|
|
label = g_strdup_printf ("%s/%s", image_label, name);
|
1997-11-24 22:05:25 +00:00
|
|
|
g_free (name);
|
|
|
|
|
2000-05-08 17:45:16 +00:00
|
|
|
menuitem = gtk_menu_item_new ();
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_connect (menuitem, "activate",
|
2001-07-31 12:10:14 +00:00
|
|
|
G_CALLBACK (gimp_menu_callback),
|
|
|
|
&layers[j]);
|
1999-06-23 23:01:14 +00:00
|
|
|
|
2000-05-08 17:45:16 +00:00
|
|
|
hbox = gtk_hbox_new (FALSE, 0);
|
|
|
|
gtk_container_add (GTK_CONTAINER(menuitem), hbox);
|
|
|
|
gtk_widget_show (hbox);
|
1999-06-23 23:01:14 +00:00
|
|
|
|
2000-05-08 17:45:16 +00:00
|
|
|
vbox = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (vbox);
|
1999-06-23 23:01:14 +00:00
|
|
|
|
2000-05-08 17:45:16 +00:00
|
|
|
wcolor_box = gtk_preview_new (GTK_PREVIEW_COLOR);
|
1999-06-23 23:01:14 +00:00
|
|
|
gtk_preview_set_dither (GTK_PREVIEW (wcolor_box), GDK_RGB_DITHER_MAX);
|
|
|
|
|
2000-05-08 17:45:16 +00:00
|
|
|
fill_preview_with_thumb (wcolor_box,
|
|
|
|
layers[j],
|
|
|
|
MENU_THUMBNAIL_WIDTH,
|
|
|
|
MENU_THUMBNAIL_HEIGHT);
|
1999-06-23 23:01:14 +00:00
|
|
|
|
2001-12-29 13:26:29 +00:00
|
|
|
gtk_widget_set_size_request (GTK_WIDGET (wcolor_box),
|
|
|
|
MENU_THUMBNAIL_WIDTH ,
|
|
|
|
MENU_THUMBNAIL_HEIGHT);
|
1999-06-23 23:01:14 +00:00
|
|
|
|
2000-05-08 17:45:16 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER(vbox), wcolor_box);
|
|
|
|
gtk_widget_show (wcolor_box);
|
1999-06-23 23:01:14 +00:00
|
|
|
|
2000-05-08 17:45:16 +00: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-23 23:01:14 +00: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-24 21:27:11 +00:00
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
1997-11-24 22:05:25 +00: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-08 17:45:16 +00:00
|
|
|
|
1997-11-24 22:05:25 +00:00
|
|
|
for (j = 0; j < nchannels; j++)
|
|
|
|
if (!constraint || (* constraint) (images[i], channels[j], data))
|
|
|
|
{
|
1999-06-23 23:01:14 +00:00
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *wcolor_box;
|
|
|
|
GtkWidget *wlabel;
|
|
|
|
|
1997-11-24 22:05:25 +00:00
|
|
|
name = gimp_channel_get_name (channels[j]);
|
2000-05-31 06:15:06 +00:00
|
|
|
label = g_strdup_printf ("%s/%s", image_label, name);
|
1997-11-24 22:05:25 +00:00
|
|
|
g_free (name);
|
|
|
|
|
2000-05-31 06:15:06 +00:00
|
|
|
menuitem = gtk_menu_item_new ();
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_connect (menuitem, "activate",
|
2001-07-31 12:10:14 +00:00
|
|
|
G_CALLBACK (gimp_menu_callback),
|
|
|
|
&channels[j]);
|
1999-06-23 23:01:14 +00:00
|
|
|
|
2000-05-08 17:45:16 +00:00
|
|
|
hbox = gtk_hbox_new (FALSE, 0);
|
|
|
|
gtk_container_add (GTK_CONTAINER (menuitem), hbox);
|
|
|
|
gtk_widget_show (hbox);
|
1999-06-23 23:01:14 +00:00
|
|
|
|
2000-05-08 17:45:16 +00:00
|
|
|
vbox = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (vbox);
|
1999-06-23 23:01:14 +00:00
|
|
|
|
2000-05-08 17:45:16 +00:00
|
|
|
wcolor_box = gtk_preview_new (GTK_PREVIEW_COLOR);
|
2000-05-31 06:15:06 +00:00
|
|
|
gtk_preview_set_dither (GTK_PREVIEW (wcolor_box),
|
|
|
|
GDK_RGB_DITHER_MAX);
|
1999-06-23 23:01:14 +00:00
|
|
|
|
2000-05-08 17:45:16 +00:00
|
|
|
fill_preview_with_thumb (wcolor_box,
|
|
|
|
channels[j],
|
|
|
|
MENU_THUMBNAIL_WIDTH,
|
|
|
|
MENU_THUMBNAIL_HEIGHT);
|
1999-06-23 23:01:14 +00:00
|
|
|
|
2001-12-29 13:26:29 +00:00
|
|
|
gtk_widget_set_size_request (GTK_WIDGET (wcolor_box),
|
|
|
|
MENU_THUMBNAIL_WIDTH ,
|
|
|
|
MENU_THUMBNAIL_HEIGHT);
|
2000-05-08 17:45:16 +00:00
|
|
|
|
|
|
|
gtk_container_add (GTK_CONTAINER (vbox), wcolor_box);
|
|
|
|
gtk_widget_show (wcolor_box);
|
1999-06-23 23:01:14 +00:00
|
|
|
|
2000-05-08 17:45:16 +00: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-23 23:01:14 +00: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-24 21:27:11 +00:00
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
1997-11-24 22:05:25 +00: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 13:21:55 +00:00
|
|
|
menuitem = gtk_menu_item_new_with_label (_("None"));
|
1997-11-24 22:05:25 +00: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-24 21:27:11 +00:00
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
1997-11-24 22:05:25 +00:00
|
|
|
gtk_widget_show (menuitem);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (drawable != -1)
|
|
|
|
(* callback) (drawable, data);
|
|
|
|
|
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2000-05-08 17:45:16 +00:00
|
|
|
gimp_menu_callback (GtkWidget *widget,
|
1997-11-24 22:05:25 +00:00
|
|
|
gint32 *id)
|
|
|
|
{
|
|
|
|
GimpMenuCallback callback;
|
2000-05-08 17:45:16 +00:00
|
|
|
gpointer callback_data;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2001-07-31 12:10:14 +00: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-24 22:05:25 +00:00
|
|
|
|
|
|
|
(* callback) (*id, callback_data);
|
|
|
|
}
|
1998-09-19 00:40:27 +00:00
|
|
|
|
1999-06-23 23:01:14 +00:00
|
|
|
static void
|
2000-05-08 17:45:16 +00:00
|
|
|
fill_preview_with_thumb (GtkWidget *widget,
|
|
|
|
gint32 drawable_ID,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1999-06-23 23:01:14 +00:00
|
|
|
{
|
1999-07-06 21:19:34 +00:00
|
|
|
guchar *drawable_data;
|
|
|
|
gint bpp;
|
2000-05-08 17:45:16 +00:00
|
|
|
gint x, y;
|
1999-07-06 21:19:34 +00:00
|
|
|
guchar *src;
|
|
|
|
gdouble r, g, b, a;
|
|
|
|
gdouble c0, c1;
|
2000-05-08 17:45:16 +00:00
|
|
|
guchar *p0, *p1, *even, *odd;
|
1999-06-23 23:01:14 +00:00
|
|
|
|
|
|
|
bpp = 0; /* Only returned */
|
|
|
|
|
2000-05-08 17:45:16 +00:00
|
|
|
drawable_data =
|
|
|
|
gimp_drawable_get_thumbnail_data (drawable_ID, &width, &height, &bpp);
|
1999-06-23 23:01:14 +00:00
|
|
|
|
2000-05-08 17:45:16 +00:00
|
|
|
gtk_preview_size (GTK_PREVIEW (widget), width, height);
|
1999-06-23 23:01:14 +00:00
|
|
|
|
2000-05-08 17:45:16 +00:00
|
|
|
even = g_malloc (width * 3);
|
|
|
|
odd = g_malloc (width * 3);
|
|
|
|
src = drawable_data;
|
1999-07-06 21:19:34 +00:00
|
|
|
|
|
|
|
for (y = 0; y < height; y++)
|
1999-06-23 23:01:14 +00:00
|
|
|
{
|
1999-07-06 21:19:34 +00:00
|
|
|
p0 = even;
|
|
|
|
p1 = odd;
|
1999-06-23 23:01:14 +00:00
|
|
|
|
2000-05-08 17:45:16 +00:00
|
|
|
for (x = 0; x < width; x++)
|
|
|
|
{
|
2000-05-31 06:15:06 +00:00
|
|
|
if (bpp == 4)
|
2000-05-08 17:45:16 +00:00
|
|
|
{
|
2000-05-31 06:15:06 +00: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-08 17:45:16 +00:00
|
|
|
}
|
2000-05-31 06:15:06 +00:00
|
|
|
else if (bpp == 3)
|
2000-05-08 17:45:16 +00:00
|
|
|
{
|
2000-05-31 06:15:06 +00: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-06 21:19:34 +00:00
|
|
|
a = 1.0;
|
2000-05-08 17:45:16 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-05-31 06:15:06 +00:00
|
|
|
r = ((gdouble) src[x*bpp+0]) / 255.0;
|
2000-05-08 17:45:16 +00:00
|
|
|
g = b = r;
|
2000-05-31 06:15:06 +00:00
|
|
|
if (bpp == 2)
|
|
|
|
a = ((gdouble) src[x*bpp+1]) / 255.0;
|
2000-05-08 17:45:16 +00:00
|
|
|
else
|
|
|
|
a = 1.0;
|
|
|
|
}
|
2000-05-31 06:15:06 +00:00
|
|
|
|
2000-05-08 17:45:16 +00: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-06 21:19:34 +00:00
|
|
|
|
2000-05-08 17:45:16 +00: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 06:15:06 +00:00
|
|
|
|
2000-05-08 17:45:16 +00:00
|
|
|
*p1++ = (c1 + (r - c1) * a) * 255.0;
|
|
|
|
*p1++ = (c1 + (g - c1) * a) * 255.0;
|
|
|
|
*p1++ = (c1 + (b - c1) * a) * 255.0;
|
1999-07-06 21:19:34 +00:00
|
|
|
}
|
2000-05-08 17:45:16 +00:00
|
|
|
|
|
|
|
if ((y / GIMP_CHECK_SIZE_SM) & 1)
|
2003-06-19 13:01:49 +00:00
|
|
|
gtk_preview_draw_row (GTK_PREVIEW (widget), odd, 0, y, width);
|
1999-07-06 21:19:34 +00:00
|
|
|
else
|
2003-06-19 13:01:49 +00:00
|
|
|
gtk_preview_draw_row (GTK_PREVIEW (widget), even, 0, y, width);
|
2000-05-08 17:45:16 +00:00
|
|
|
|
1999-07-06 21:19:34 +00:00
|
|
|
src += width * bpp;
|
1999-06-23 23:01:14 +00:00
|
|
|
}
|
2000-05-08 17:45:16 +00:00
|
|
|
|
|
|
|
g_free (even);
|
|
|
|
g_free (odd);
|
1999-06-23 23:01:14 +00:00
|
|
|
}
|
|
|
|
|
2003-06-19 13:01:49 +00:00
|
|
|
static gboolean
|
|
|
|
idle_brush_callback (GimpBrushData *bdata)
|
1998-09-19 00:40:27 +00:00
|
|
|
{
|
2000-05-08 17:45:16 +00:00
|
|
|
if (bdata->callback)
|
2003-06-19 13:01:49 +00:00
|
|
|
bdata->callback (bdata->name,
|
2000-05-08 17:45:16 +00:00
|
|
|
bdata->opacity,
|
|
|
|
bdata->spacing,
|
|
|
|
bdata->paint_mode,
|
|
|
|
bdata->width,
|
|
|
|
bdata->height,
|
|
|
|
bdata->brush_mask_data,
|
|
|
|
bdata->closing,
|
|
|
|
bdata->data);
|
|
|
|
|
2003-06-19 13:01:49 +00:00
|
|
|
g_free (bdata->name);
|
|
|
|
g_free (bdata->brush_mask_data);
|
1998-09-19 00:40:27 +00:00
|
|
|
|
2003-06-19 13:01:49 +00:00
|
|
|
bdata->idle_id = 0;
|
|
|
|
bdata->name = NULL;
|
2000-05-08 17:45:16 +00:00
|
|
|
bdata->brush_mask_data = NULL;
|
2003-06-19 13:01:49 +00:00
|
|
|
|
|
|
|
return FALSE;
|
1998-09-19 00:40:27 +00:00
|
|
|
}
|
|
|
|
|
2003-06-19 13:01:49 +00:00
|
|
|
static gboolean
|
|
|
|
idle_font_callback (GimpFontData *fdata)
|
1998-10-01 22:09:01 +00:00
|
|
|
{
|
2003-03-28 14:13:54 +00:00
|
|
|
if (fdata->callback)
|
2003-06-19 13:01:49 +00:00
|
|
|
fdata->callback (fdata->name,
|
2003-03-28 14:13:54 +00:00
|
|
|
fdata->closing,
|
|
|
|
fdata->data);
|
1998-10-01 22:09:01 +00:00
|
|
|
|
2003-06-19 13:01:49 +00:00
|
|
|
g_free (fdata->name);
|
|
|
|
|
|
|
|
fdata->idle_id = 0;
|
|
|
|
fdata->name = NULL;
|
1998-10-01 22:09:01 +00:00
|
|
|
|
2003-06-19 13:01:49 +00:00
|
|
|
return FALSE;
|
1998-10-01 22:09:01 +00:00
|
|
|
}
|
|
|
|
|
2003-06-19 13:01:49 +00:00
|
|
|
static gboolean
|
|
|
|
idle_gradient_callback (GimpGradientData *gdata)
|
1998-10-31 16:22:37 +00:00
|
|
|
{
|
2000-05-08 17:45:16 +00:00
|
|
|
if (gdata->callback)
|
2003-06-19 13:01:49 +00:00
|
|
|
gdata->callback (gdata->name,
|
2000-05-08 17:45:16 +00:00
|
|
|
gdata->width,
|
|
|
|
gdata->gradient_data,
|
|
|
|
gdata->closing,
|
|
|
|
gdata->data);
|
1998-10-31 16:22:37 +00:00
|
|
|
|
2003-06-19 13:01:49 +00:00
|
|
|
g_free (gdata->name);
|
|
|
|
g_free (gdata->gradient_data);
|
1998-10-31 16:22:37 +00:00
|
|
|
|
2003-06-19 13:01:49 +00:00
|
|
|
gdata->idle_id = 0;
|
|
|
|
gdata->name = NULL;
|
1998-10-31 16:22:37 +00:00
|
|
|
gdata->gradient_data = NULL;
|
2003-06-19 13:01:49 +00:00
|
|
|
|
|
|
|
return FALSE;
|
1998-10-31 16:22:37 +00:00
|
|
|
}
|
|
|
|
|
2003-06-19 13:01:49 +00:00
|
|
|
static gboolean
|
|
|
|
idle_pattern_callback (GimpPatternData *pdata)
|
2003-03-28 14:13:54 +00:00
|
|
|
{
|
|
|
|
if (pdata->callback)
|
2003-06-19 13:01:49 +00:00
|
|
|
pdata->callback (pdata->name,
|
2003-03-28 14:13:54 +00:00
|
|
|
pdata->width,
|
|
|
|
pdata->height,
|
|
|
|
pdata->bytes,
|
|
|
|
pdata->pattern_mask_data,
|
|
|
|
pdata->closing,
|
|
|
|
pdata->data);
|
|
|
|
|
2003-06-19 13:01:49 +00:00
|
|
|
g_free (pdata->name);
|
|
|
|
g_free (pdata->pattern_mask_data);
|
2003-03-28 14:13:54 +00:00
|
|
|
|
2003-06-19 13:01:49 +00:00
|
|
|
pdata->idle_id = 0;
|
|
|
|
pdata->name = NULL;
|
2003-03-28 14:13:54 +00:00
|
|
|
pdata->pattern_mask_data = NULL;
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1998-09-19 00:40:27 +00:00
|
|
|
static void
|
2000-05-31 06:15:06 +00:00
|
|
|
temp_brush_invoker (gchar *name,
|
|
|
|
gint nparams,
|
|
|
|
GimpParam *param,
|
|
|
|
gint *nreturn_vals,
|
|
|
|
GimpParam **return_vals)
|
1998-09-19 00:40:27 +00:00
|
|
|
{
|
2003-06-19 13:01:49 +00:00
|
|
|
static GimpParam values[1];
|
|
|
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
|
|
|
GimpBrushData *bdata;
|
1998-09-19 00:40:27 +00:00
|
|
|
|
2000-05-08 17:45:16 +00:00
|
|
|
bdata = (GimpBrushData *) g_hash_table_lookup (gbrush_ht, name);
|
|
|
|
|
2003-06-19 13:01:49 +00:00
|
|
|
if (! bdata)
|
|
|
|
{
|
|
|
|
g_warning("Can't find internal brush data");
|
|
|
|
}
|
1998-09-19 00:40:27 +00:00
|
|
|
else
|
2003-06-19 13:01:49 +00:00
|
|
|
{
|
|
|
|
g_free (bdata->name);
|
|
|
|
g_free (bdata->brush_mask_data);
|
|
|
|
|
|
|
|
bdata->name = 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_memdup (param[7].data.d_int8array,
|
|
|
|
param[6].data.d_int32);
|
|
|
|
bdata->closing = param[8].data.d_int32;
|
|
|
|
|
|
|
|
if (! bdata->idle_id)
|
|
|
|
bdata->idle_id = g_idle_add ((GSourceFunc) idle_brush_callback, bdata);
|
|
|
|
}
|
1998-10-01 22:09:01 +00:00
|
|
|
|
|
|
|
*nreturn_vals = 1;
|
|
|
|
*return_vals = values;
|
|
|
|
|
2000-08-03 01:35:28 +00:00
|
|
|
values[0].type = GIMP_PDB_STATUS;
|
1998-10-01 22:09:01 +00:00
|
|
|
values[0].data.d_status = status;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-03-28 14:13:54 +00:00
|
|
|
temp_font_invoker (gchar *name,
|
|
|
|
gint nparams,
|
|
|
|
GimpParam *param,
|
|
|
|
gint *nreturn_vals,
|
|
|
|
GimpParam **return_vals)
|
1998-10-01 22:09:01 +00:00
|
|
|
{
|
2003-06-19 13:01:49 +00:00
|
|
|
static GimpParam values[1];
|
|
|
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
|
|
|
GimpFontData *fdata;
|
1998-10-01 22:09:01 +00:00
|
|
|
|
2003-06-19 13:01:49 +00:00
|
|
|
fdata = (GimpFontData *) g_hash_table_lookup (gfont_ht, name);
|
1998-10-01 22:09:01 +00:00
|
|
|
|
2003-06-19 13:01:49 +00:00
|
|
|
if (! fdata)
|
|
|
|
{
|
|
|
|
g_warning ("Can't find internal font data");
|
|
|
|
}
|
2000-05-08 17:45:16 +00:00
|
|
|
else
|
2003-06-19 13:01:49 +00:00
|
|
|
{
|
|
|
|
g_free (fdata->name);
|
2000-05-08 17:45:16 +00:00
|
|
|
|
2003-06-19 13:01:49 +00:00
|
|
|
fdata->name = g_strdup (param[0].data.d_string);
|
|
|
|
fdata->closing = param[1].data.d_int32;
|
|
|
|
|
|
|
|
if (! fdata->idle_id)
|
|
|
|
fdata->idle_id = g_idle_add ((GSourceFunc) idle_font_callback, fdata);
|
|
|
|
}
|
1998-09-19 00:40:27 +00:00
|
|
|
|
|
|
|
*nreturn_vals = 1;
|
|
|
|
*return_vals = values;
|
|
|
|
|
2000-08-03 01:35:28 +00:00
|
|
|
values[0].type = GIMP_PDB_STATUS;
|
1998-09-19 00:40:27 +00:00
|
|
|
values[0].data.d_status = status;
|
|
|
|
}
|
|
|
|
|
1998-10-31 16:22:37 +00:00
|
|
|
static void
|
2000-05-31 06:15:06 +00:00
|
|
|
temp_gradient_invoker (gchar *name,
|
|
|
|
gint nparams,
|
|
|
|
GimpParam *param,
|
|
|
|
gint *nreturn_vals,
|
|
|
|
GimpParam **return_vals)
|
1998-10-31 16:22:37 +00:00
|
|
|
{
|
2003-06-19 13:01:49 +00:00
|
|
|
static GimpParam values[1];
|
|
|
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
|
|
|
GimpGradientData *gdata;
|
1998-10-31 16:22:37 +00:00
|
|
|
|
2000-05-08 17:45:16 +00:00
|
|
|
gdata = (GimpGradientData *) g_hash_table_lookup (ggradient_ht, name);
|
|
|
|
|
2003-06-19 13:01:49 +00:00
|
|
|
if (! gdata)
|
|
|
|
{
|
1998-10-31 16:22:37 +00:00
|
|
|
g_warning("Can't find internal gradient data");
|
2003-06-19 13:01:49 +00:00
|
|
|
}
|
1998-10-31 16:22:37 +00:00
|
|
|
else
|
|
|
|
{
|
2003-06-19 13:01:49 +00:00
|
|
|
g_free (gdata->name);
|
|
|
|
g_free (gdata->gradient_data);
|
|
|
|
|
|
|
|
gdata->name = g_strdup (param[0].data.d_string);
|
|
|
|
gdata->width = param[1].data.d_int32;
|
|
|
|
gdata->gradient_data = g_memdup (param[2].data.d_floatarray,
|
|
|
|
param[1].data.d_int32 * sizeof (gdouble));
|
|
|
|
gdata->closing = param[3].data.d_int32;
|
|
|
|
|
|
|
|
if (! gdata->idle_id)
|
|
|
|
gdata->idle_id = g_idle_add ((GSourceFunc) idle_gradient_callback,
|
|
|
|
gdata);
|
1998-10-31 16:22:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
*nreturn_vals = 1;
|
|
|
|
*return_vals = values;
|
|
|
|
|
2000-08-03 01:35:28 +00:00
|
|
|
values[0].type = GIMP_PDB_STATUS;
|
1998-10-31 16:22:37 +00:00
|
|
|
values[0].data.d_status = status;
|
|
|
|
}
|
|
|
|
|
2003-03-28 14:13:54 +00:00
|
|
|
static void
|
|
|
|
temp_pattern_invoker (gchar *name,
|
|
|
|
gint nparams,
|
|
|
|
GimpParam *param,
|
|
|
|
gint *nreturn_vals,
|
|
|
|
GimpParam **return_vals)
|
|
|
|
{
|
2003-06-19 13:01:49 +00:00
|
|
|
static GimpParam values[1];
|
|
|
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
|
|
|
GimpPatternData *pdata;
|
2003-03-28 14:13:54 +00:00
|
|
|
|
2003-06-19 13:01:49 +00:00
|
|
|
pdata = (GimpPatternData *) g_hash_table_lookup (gpattern_ht, name);
|
2003-03-28 14:13:54 +00:00
|
|
|
|
2003-06-19 13:01:49 +00:00
|
|
|
if (! pdata)
|
|
|
|
{
|
|
|
|
g_warning ("Can't find internal pattern data");
|
|
|
|
}
|
2003-03-28 14:13:54 +00:00
|
|
|
else
|
2003-06-19 13:01:49 +00:00
|
|
|
{
|
|
|
|
g_free (pdata->name);
|
|
|
|
g_free (pdata->pattern_mask_data);
|
|
|
|
|
|
|
|
pdata->name = 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_memdup (param[5].data.d_int8array,
|
|
|
|
param[4].data.d_int32);
|
|
|
|
pdata->closing = param[6].data.d_int32;
|
|
|
|
|
|
|
|
if (! pdata->idle_id)
|
|
|
|
pdata->idle_id = g_idle_add ((GSourceFunc) idle_pattern_callback,
|
|
|
|
pdata);
|
|
|
|
}
|
2003-03-28 14:13:54 +00:00
|
|
|
|
|
|
|
*nreturn_vals = 1;
|
|
|
|
*return_vals = values;
|
|
|
|
|
|
|
|
values[0].type = GIMP_PDB_STATUS;
|
|
|
|
values[0].data.d_status = status;
|
|
|
|
}
|
|
|
|
|
1998-09-19 00:40:27 +00:00
|
|
|
static gchar *
|
1998-09-20 23:04:33 +00:00
|
|
|
gen_temp_plugin_name (void)
|
1998-09-19 00:40:27 +00:00
|
|
|
{
|
2000-05-31 06:15:06 +00:00
|
|
|
GimpParam *return_vals;
|
2000-05-08 17:45:16 +00:00
|
|
|
gint nreturn_vals;
|
|
|
|
gchar *result;
|
1998-09-19 00:40:27 +00:00
|
|
|
|
|
|
|
return_vals = gimp_run_procedure ("gimp_temp_PDB_name",
|
|
|
|
&nreturn_vals,
|
2000-08-03 01:35:28 +00:00
|
|
|
GIMP_PDB_END);
|
1998-09-19 00:40:27 +00:00
|
|
|
|
|
|
|
result = "temp_name_gen_failed";
|
2000-08-03 01:35:28 +00:00
|
|
|
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
1998-09-19 00:40:27 +00:00
|
|
|
result = g_strdup (return_vals[1].data.d_string);
|
|
|
|
|
|
|
|
gimp_destroy_params (return_vals, nreturn_vals);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2000-05-31 21:16:11 +00:00
|
|
|
gchar *
|
2003-06-17 09:43:14 +00:00
|
|
|
gimp_interactive_selection_brush (const gchar *title,
|
|
|
|
const gchar *brush_name,
|
|
|
|
gdouble opacity,
|
|
|
|
gint spacing,
|
|
|
|
GimpLayerModeEffects paint_mode,
|
2000-05-31 06:15:06 +00:00
|
|
|
GimpRunBrushCallback callback,
|
2003-06-17 09:43:14 +00:00
|
|
|
gpointer data)
|
1998-09-19 00:40:27 +00:00
|
|
|
{
|
2000-05-31 06:15:06 +00:00
|
|
|
static GimpParamDef args[] =
|
1998-09-19 00:40:27 +00:00
|
|
|
{
|
2000-08-03 01:35:28 +00: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 06:15:06 +00:00
|
|
|
"[0 = No, 1 = Yes]" },
|
1998-09-19 00:40:27 +00:00
|
|
|
};
|
2000-05-31 06:15:06 +00:00
|
|
|
static GimpParamDef *return_vals = NULL;
|
|
|
|
static gint nargs = sizeof (args) / sizeof (args[0]);
|
|
|
|
static gint nreturn_vals = 0;
|
1998-09-19 00:40:27 +00:00
|
|
|
gint bnreturn_vals;
|
2000-05-31 06:15:06 +00:00
|
|
|
GimpParam *pdbreturn_vals;
|
2000-05-08 17:45:16 +00:00
|
|
|
gchar *pdbname = gen_temp_plugin_name ();
|
|
|
|
GimpBrushData *bdata;
|
|
|
|
|
|
|
|
bdata = g_new0 (GimpBrushData, 1);
|
1998-09-19 00:40:27 +00: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 01:35:28 +00:00
|
|
|
GIMP_TEMPORARY,
|
1998-09-19 00:40:27 +00:00
|
|
|
nargs, nreturn_vals,
|
|
|
|
args, return_vals,
|
|
|
|
temp_brush_invoker);
|
|
|
|
|
|
|
|
pdbreturn_vals =
|
2000-05-31 06:15:06 +00:00
|
|
|
gimp_run_procedure ("gimp_brushes_popup",
|
|
|
|
&bnreturn_vals,
|
2000-08-03 01:35:28 +00:00
|
|
|
GIMP_PDB_STRING, pdbname,
|
2003-06-17 09:43:14 +00:00
|
|
|
GIMP_PDB_STRING, title,
|
2000-08-03 01:35:28 +00:00
|
|
|
GIMP_PDB_STRING, brush_name,
|
|
|
|
GIMP_PDB_FLOAT, opacity,
|
|
|
|
GIMP_PDB_INT32, spacing,
|
|
|
|
GIMP_PDB_INT32, paint_mode,
|
|
|
|
GIMP_PDB_END);
|
|
|
|
|
Changed the semantics of GIMP_EXTENSION and (to some extent) of
2003-06-19 Michael Natterer <mitch@gimp.org>
Changed the semantics of GIMP_EXTENSION and (to some extent)
of GIMP_PLUGIN:
The old meaning of EXTENSION was "I live in the toolbox" and
PLUGIN meant "I take RUN-MODE,IMAGE,DRAWABLE args (but only if I
am invoked interactively)". This is completely useless, since
living in the toolbox means having "<Toolbox>" in the menu_path
and taking RUN-MODE,IMAGE,DRAWABLE means just that, regardless of
what type of procedure we are.
The new meaning of GIMP_PLUGIN is just "I am an ordinary procedure,
I am invoked, do my job and finish", while GIMP_EXTENSION means
"I will install temporary procedures and I will keep running to
keep them available".
(A GIMP_EXTENSION *must* call gimp_extension_ack() now to tell the
core that it's ready to run, or the core will block waiting for
the message !!!).
* configure.in: bumped version number to 1.3.16.
* libgimpbase/gimpprotocol.h: increased protocol version number so
old extensions will refuse to load.
* app/gui/plug-in-commands.c (plug_in_run_cmd_callback): don't
blindly pass RUN-MODE,IMAGE,DRAWABLE to GIMP_PLUGIN procedures but
look at their parameters and pass them either RUN-MODE, or
RUN-MODE,IMAGE, or RUN-MODE,IMAGE,DRAWABLE.
* app/pdb/procedural_db.c: cleaned up, better error reporting,
replaced an impossible error message by g_return_if_fail()
* app/plug-in/plug-in-message.c (plug_in_handle_proc_install):
better error messages.
* app/plug-in/plug-in-params.c: allocate parameter arrays using
g_new0() so we don't have to worry about uninitialized stuff
later.
* app/plug-in/plug-in-run.c (plug_in_run): wait for
gimp_extension_ack() installation confirmation for ALL extensions,
not just for automatically started ones.
* app/plug-in/plug-ins.c: cleanup.
* libgimp/gimp.[ch]: cleaned up and API-documented massively. Made
all magic values given in the GPConfig message static and added
accessor functions for them. Added gimp_tile_width()/height().
Added new function gimp_extension_enable() which turns on
asynchronous processing of temp_proc run requests without having
to enter an endless gimp_extension_process() loop. Moved all
private functions to the end of the file. Added tons of
g_return_if_fail() all over the place. Call gimp_run_procedure2()
from gimp_run_procedure() instead of duplicating the
code. Indentation, spacing, stuff...
* libgimp/gimptile.[ch]: removed gimp_tile_width()/height().
* libgimp/gimpdrawable.c
* libgimp/gimppixelrgn.c
* libgimp/gimptile.c: use the gimp_tile_width()/height() accessor
functions.
* libgimp/gimp.def: added gimp_extension_enable.
* libgimp/gimpmenu.c: removed evil code which connected to
_readchannel manually and use gimp_extension_enable() for watching
temp_procs.
* plug-ins/helpbrowser/helpbrowser.c: removed the same evil code
here and call gimp_extension_enable(). Call gimp_extension_ack()
to let the core know that the temp_proc is installed.
* plug-ins/script-fu/script-fu.c: made all procedures except the
permanently running "extension_script_fu" ordinary GIMP_PLUGIN
procedures.
* plug-ins/common/curve_bend.c
* plug-ins/common/plugindetails.c
* plug-ins/common/screenshot.c
* plug-ins/common/uniteditor.c
* plug-ins/common/winclipboard.c
* plug-ins/dbbrowser/dbbrowser.c
* plug-ins/gfli/gfli.c
* plug-ins/twain/twain.c
* plug-ins/webbrowser/webbrowser.c
* plug-ins/winsnap/winsnap.c: made them all ordinary GIMP_PLUGIN
procedures and renamed them from "extension_*" to "plug_in_*".
Random cleanups.
* app/widgets/gimphelp.c
* plug-ins/maze/maze_face.c: call "plug_in_web_browser" now.
2003-06-19 17:12:00 +00:00
|
|
|
gimp_extension_enable (); /* Allow callbacks to be watched */
|
1998-09-19 00:40:27 +00:00
|
|
|
|
|
|
|
gimp_destroy_params (pdbreturn_vals,bnreturn_vals);
|
|
|
|
|
|
|
|
/* Now add to hash table so we can find it again */
|
2003-06-19 13:01:49 +00:00
|
|
|
if (! gbrush_ht)
|
2003-06-17 09:43:14 +00:00
|
|
|
gbrush_ht = g_hash_table_new (g_str_hash, g_str_equal);
|
2000-05-08 17:45:16 +00:00
|
|
|
|
1998-09-19 00:40:27 +00:00
|
|
|
bdata->callback = callback;
|
2000-05-08 17:45:16 +00:00
|
|
|
bdata->data = data;
|
|
|
|
g_hash_table_insert (gbrush_ht, pdbname, bdata);
|
1998-10-20 22:36:52 +00:00
|
|
|
|
|
|
|
return pdbname;
|
|
|
|
}
|
|
|
|
|
|
|
|
gchar *
|
2003-06-17 09:43:14 +00:00
|
|
|
gimp_interactive_selection_font (const gchar *title,
|
|
|
|
const gchar *font_name,
|
2003-03-28 14:13:54 +00:00
|
|
|
GimpRunFontCallback callback,
|
|
|
|
gpointer data)
|
1998-10-01 22:09:01 +00:00
|
|
|
{
|
2000-05-31 06:15:06 +00:00
|
|
|
static GimpParamDef args[] =
|
1998-10-01 22:09:01 +00:00
|
|
|
{
|
2003-03-28 14:13:54 +00:00
|
|
|
{ GIMP_PDB_STRING, "str", "String" },
|
|
|
|
{ GIMP_PDB_INT32, "dialog status", "Registers if the dialog was closing "
|
|
|
|
"[0 = No, 1 = Yes]" },
|
1998-10-01 22:09:01 +00:00
|
|
|
};
|
2000-05-31 06:15:06 +00:00
|
|
|
static GimpParamDef *return_vals = NULL;
|
|
|
|
static gint nargs = sizeof (args) / sizeof (args[0]);
|
|
|
|
static gint nreturn_vals = 0;
|
2003-03-28 14:13:54 +00:00
|
|
|
gint fnreturn_vals;
|
2000-05-31 06:15:06 +00:00
|
|
|
GimpParam *pdbreturn_vals;
|
2000-05-08 17:45:16 +00:00
|
|
|
gchar *pdbname = gen_temp_plugin_name ();
|
2003-03-28 14:13:54 +00:00
|
|
|
GimpFontData *fdata;
|
2000-05-08 17:45:16 +00:00
|
|
|
|
2003-03-28 14:13:54 +00:00
|
|
|
fdata = g_new0 (GimpFontData, 1);
|
1998-10-01 22:09:01 +00: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 01:35:28 +00:00
|
|
|
GIMP_TEMPORARY,
|
1998-10-01 22:09:01 +00:00
|
|
|
nargs, nreturn_vals,
|
|
|
|
args, return_vals,
|
2003-03-28 14:13:54 +00:00
|
|
|
temp_font_invoker);
|
1998-10-01 22:09:01 +00:00
|
|
|
|
|
|
|
pdbreturn_vals =
|
2003-03-28 14:13:54 +00:00
|
|
|
gimp_run_procedure ("gimp_fonts_popup",
|
|
|
|
&fnreturn_vals,
|
|
|
|
GIMP_PDB_STRING, pdbname,
|
2003-06-17 09:43:14 +00:00
|
|
|
GIMP_PDB_STRING, title,
|
|
|
|
GIMP_PDB_STRING, font_name,
|
2003-03-28 14:13:54 +00:00
|
|
|
GIMP_PDB_END);
|
1998-10-01 22:09:01 +00:00
|
|
|
|
Changed the semantics of GIMP_EXTENSION and (to some extent) of
2003-06-19 Michael Natterer <mitch@gimp.org>
Changed the semantics of GIMP_EXTENSION and (to some extent)
of GIMP_PLUGIN:
The old meaning of EXTENSION was "I live in the toolbox" and
PLUGIN meant "I take RUN-MODE,IMAGE,DRAWABLE args (but only if I
am invoked interactively)". This is completely useless, since
living in the toolbox means having "<Toolbox>" in the menu_path
and taking RUN-MODE,IMAGE,DRAWABLE means just that, regardless of
what type of procedure we are.
The new meaning of GIMP_PLUGIN is just "I am an ordinary procedure,
I am invoked, do my job and finish", while GIMP_EXTENSION means
"I will install temporary procedures and I will keep running to
keep them available".
(A GIMP_EXTENSION *must* call gimp_extension_ack() now to tell the
core that it's ready to run, or the core will block waiting for
the message !!!).
* configure.in: bumped version number to 1.3.16.
* libgimpbase/gimpprotocol.h: increased protocol version number so
old extensions will refuse to load.
* app/gui/plug-in-commands.c (plug_in_run_cmd_callback): don't
blindly pass RUN-MODE,IMAGE,DRAWABLE to GIMP_PLUGIN procedures but
look at their parameters and pass them either RUN-MODE, or
RUN-MODE,IMAGE, or RUN-MODE,IMAGE,DRAWABLE.
* app/pdb/procedural_db.c: cleaned up, better error reporting,
replaced an impossible error message by g_return_if_fail()
* app/plug-in/plug-in-message.c (plug_in_handle_proc_install):
better error messages.
* app/plug-in/plug-in-params.c: allocate parameter arrays using
g_new0() so we don't have to worry about uninitialized stuff
later.
* app/plug-in/plug-in-run.c (plug_in_run): wait for
gimp_extension_ack() installation confirmation for ALL extensions,
not just for automatically started ones.
* app/plug-in/plug-ins.c: cleanup.
* libgimp/gimp.[ch]: cleaned up and API-documented massively. Made
all magic values given in the GPConfig message static and added
accessor functions for them. Added gimp_tile_width()/height().
Added new function gimp_extension_enable() which turns on
asynchronous processing of temp_proc run requests without having
to enter an endless gimp_extension_process() loop. Moved all
private functions to the end of the file. Added tons of
g_return_if_fail() all over the place. Call gimp_run_procedure2()
from gimp_run_procedure() instead of duplicating the
code. Indentation, spacing, stuff...
* libgimp/gimptile.[ch]: removed gimp_tile_width()/height().
* libgimp/gimpdrawable.c
* libgimp/gimppixelrgn.c
* libgimp/gimptile.c: use the gimp_tile_width()/height() accessor
functions.
* libgimp/gimp.def: added gimp_extension_enable.
* libgimp/gimpmenu.c: removed evil code which connected to
_readchannel manually and use gimp_extension_enable() for watching
temp_procs.
* plug-ins/helpbrowser/helpbrowser.c: removed the same evil code
here and call gimp_extension_enable(). Call gimp_extension_ack()
to let the core know that the temp_proc is installed.
* plug-ins/script-fu/script-fu.c: made all procedures except the
permanently running "extension_script_fu" ordinary GIMP_PLUGIN
procedures.
* plug-ins/common/curve_bend.c
* plug-ins/common/plugindetails.c
* plug-ins/common/screenshot.c
* plug-ins/common/uniteditor.c
* plug-ins/common/winclipboard.c
* plug-ins/dbbrowser/dbbrowser.c
* plug-ins/gfli/gfli.c
* plug-ins/twain/twain.c
* plug-ins/webbrowser/webbrowser.c
* plug-ins/winsnap/winsnap.c: made them all ordinary GIMP_PLUGIN
procedures and renamed them from "extension_*" to "plug_in_*".
Random cleanups.
* app/widgets/gimphelp.c
* plug-ins/maze/maze_face.c: call "plug_in_web_browser" now.
2003-06-19 17:12:00 +00:00
|
|
|
gimp_extension_enable (); /* Allow callbacks to be watched */
|
1998-10-01 22:09:01 +00:00
|
|
|
|
2003-03-28 14:13:54 +00:00
|
|
|
gimp_destroy_params (pdbreturn_vals, fnreturn_vals);
|
1998-10-01 22:09:01 +00:00
|
|
|
|
|
|
|
/* Now add to hash table so we can find it again */
|
2003-06-19 13:01:49 +00:00
|
|
|
if (! gfont_ht)
|
2003-06-17 09:43:14 +00:00
|
|
|
gfont_ht = g_hash_table_new (g_str_hash, g_str_equal);
|
1998-10-01 22:09:01 +00:00
|
|
|
|
2003-03-28 14:13:54 +00:00
|
|
|
fdata->callback = callback;
|
|
|
|
fdata->data = data;
|
|
|
|
g_hash_table_insert (gfont_ht, pdbname, fdata);
|
1998-10-01 22:09:01 +00:00
|
|
|
|
|
|
|
return pdbname;
|
|
|
|
}
|
|
|
|
|
|
|
|
gchar *
|
2003-06-17 09:43:14 +00:00
|
|
|
gimp_interactive_selection_gradient (const gchar *title,
|
|
|
|
const gchar *gradient_name,
|
|
|
|
gint sample_size,
|
2000-05-31 06:15:06 +00:00
|
|
|
GimpRunGradientCallback callback,
|
|
|
|
gpointer data)
|
1998-10-31 16:22:37 +00:00
|
|
|
{
|
2000-05-31 06:15:06 +00:00
|
|
|
static GimpParamDef args[] =
|
1998-10-31 16:22:37 +00:00
|
|
|
{
|
2000-08-03 01:35:28 +00: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 06:15:06 +00:00
|
|
|
"[0 = No, 1 = Yes]" },
|
1998-10-31 16:22:37 +00:00
|
|
|
};
|
2000-05-31 06:15:06 +00: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-08 17:45:16 +00:00
|
|
|
GimpGradientData *gdata;
|
|
|
|
|
|
|
|
gdata = g_new0 (GimpGradientData, 1);
|
1998-10-31 16:22:37 +00: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 01:35:28 +00:00
|
|
|
GIMP_TEMPORARY,
|
1998-10-31 16:22:37 +00:00
|
|
|
nargs, nreturn_vals,
|
|
|
|
args, return_vals,
|
|
|
|
temp_gradient_invoker);
|
|
|
|
|
|
|
|
pdbreturn_vals =
|
2000-05-08 17:45:16 +00:00
|
|
|
gimp_run_procedure ("gimp_gradients_popup",
|
|
|
|
&bnreturn_vals,
|
2000-08-03 01:35:28 +00:00
|
|
|
GIMP_PDB_STRING, pdbname,
|
2003-06-17 09:43:14 +00:00
|
|
|
GIMP_PDB_STRING, title,
|
|
|
|
GIMP_PDB_STRING, gradient_name,
|
|
|
|
GIMP_PDB_INT32, sample_size,
|
2000-08-03 01:35:28 +00:00
|
|
|
GIMP_PDB_END);
|
1998-10-31 16:22:37 +00:00
|
|
|
|
Changed the semantics of GIMP_EXTENSION and (to some extent) of
2003-06-19 Michael Natterer <mitch@gimp.org>
Changed the semantics of GIMP_EXTENSION and (to some extent)
of GIMP_PLUGIN:
The old meaning of EXTENSION was "I live in the toolbox" and
PLUGIN meant "I take RUN-MODE,IMAGE,DRAWABLE args (but only if I
am invoked interactively)". This is completely useless, since
living in the toolbox means having "<Toolbox>" in the menu_path
and taking RUN-MODE,IMAGE,DRAWABLE means just that, regardless of
what type of procedure we are.
The new meaning of GIMP_PLUGIN is just "I am an ordinary procedure,
I am invoked, do my job and finish", while GIMP_EXTENSION means
"I will install temporary procedures and I will keep running to
keep them available".
(A GIMP_EXTENSION *must* call gimp_extension_ack() now to tell the
core that it's ready to run, or the core will block waiting for
the message !!!).
* configure.in: bumped version number to 1.3.16.
* libgimpbase/gimpprotocol.h: increased protocol version number so
old extensions will refuse to load.
* app/gui/plug-in-commands.c (plug_in_run_cmd_callback): don't
blindly pass RUN-MODE,IMAGE,DRAWABLE to GIMP_PLUGIN procedures but
look at their parameters and pass them either RUN-MODE, or
RUN-MODE,IMAGE, or RUN-MODE,IMAGE,DRAWABLE.
* app/pdb/procedural_db.c: cleaned up, better error reporting,
replaced an impossible error message by g_return_if_fail()
* app/plug-in/plug-in-message.c (plug_in_handle_proc_install):
better error messages.
* app/plug-in/plug-in-params.c: allocate parameter arrays using
g_new0() so we don't have to worry about uninitialized stuff
later.
* app/plug-in/plug-in-run.c (plug_in_run): wait for
gimp_extension_ack() installation confirmation for ALL extensions,
not just for automatically started ones.
* app/plug-in/plug-ins.c: cleanup.
* libgimp/gimp.[ch]: cleaned up and API-documented massively. Made
all magic values given in the GPConfig message static and added
accessor functions for them. Added gimp_tile_width()/height().
Added new function gimp_extension_enable() which turns on
asynchronous processing of temp_proc run requests without having
to enter an endless gimp_extension_process() loop. Moved all
private functions to the end of the file. Added tons of
g_return_if_fail() all over the place. Call gimp_run_procedure2()
from gimp_run_procedure() instead of duplicating the
code. Indentation, spacing, stuff...
* libgimp/gimptile.[ch]: removed gimp_tile_width()/height().
* libgimp/gimpdrawable.c
* libgimp/gimppixelrgn.c
* libgimp/gimptile.c: use the gimp_tile_width()/height() accessor
functions.
* libgimp/gimp.def: added gimp_extension_enable.
* libgimp/gimpmenu.c: removed evil code which connected to
_readchannel manually and use gimp_extension_enable() for watching
temp_procs.
* plug-ins/helpbrowser/helpbrowser.c: removed the same evil code
here and call gimp_extension_enable(). Call gimp_extension_ack()
to let the core know that the temp_proc is installed.
* plug-ins/script-fu/script-fu.c: made all procedures except the
permanently running "extension_script_fu" ordinary GIMP_PLUGIN
procedures.
* plug-ins/common/curve_bend.c
* plug-ins/common/plugindetails.c
* plug-ins/common/screenshot.c
* plug-ins/common/uniteditor.c
* plug-ins/common/winclipboard.c
* plug-ins/dbbrowser/dbbrowser.c
* plug-ins/gfli/gfli.c
* plug-ins/twain/twain.c
* plug-ins/webbrowser/webbrowser.c
* plug-ins/winsnap/winsnap.c: made them all ordinary GIMP_PLUGIN
procedures and renamed them from "extension_*" to "plug_in_*".
Random cleanups.
* app/widgets/gimphelp.c
* plug-ins/maze/maze_face.c: call "plug_in_web_browser" now.
2003-06-19 17:12:00 +00:00
|
|
|
gimp_extension_enable (); /* Allow callbacks to be watched */
|
1998-10-31 16:22:37 +00:00
|
|
|
|
|
|
|
gimp_destroy_params (pdbreturn_vals,bnreturn_vals);
|
|
|
|
|
|
|
|
/* Now add to hash table so we can find it again */
|
2003-06-19 13:01:49 +00:00
|
|
|
if (! ggradient_ht)
|
2003-06-17 09:43:14 +00:00
|
|
|
ggradient_ht = g_hash_table_new (g_str_hash, g_str_equal);
|
1998-10-31 16:22:37 +00:00
|
|
|
|
|
|
|
gdata->callback = callback;
|
2000-05-08 17:45:16 +00:00
|
|
|
gdata->data = data;
|
|
|
|
g_hash_table_insert (ggradient_ht, pdbname,gdata);
|
1998-10-31 16:22:37 +00:00
|
|
|
|
|
|
|
return pdbname;
|
|
|
|
}
|
2003-03-28 14:13:54 +00:00
|
|
|
|
|
|
|
gchar *
|
2003-06-17 09:43:14 +00:00
|
|
|
gimp_interactive_selection_pattern (const gchar *title,
|
|
|
|
const gchar *pattern_name,
|
2003-03-28 14:13:54 +00:00
|
|
|
GimpRunPatternCallback callback,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
static GimpParamDef args[] =
|
|
|
|
{
|
|
|
|
{ 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 "
|
|
|
|
"[0 = No, 1 = Yes]" },
|
|
|
|
};
|
|
|
|
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 ();
|
|
|
|
GimpPatternData *pdata;
|
|
|
|
|
|
|
|
pdata = g_new0 (GimpPatternData, 1);
|
|
|
|
|
|
|
|
gimp_install_temp_proc (pdbname,
|
|
|
|
"Temp PDB for interactive popups",
|
|
|
|
"More here later",
|
|
|
|
"Andy Thomas",
|
|
|
|
"Andy Thomas",
|
|
|
|
"1997",
|
|
|
|
NULL,
|
|
|
|
"RGB*, GRAY*",
|
|
|
|
GIMP_TEMPORARY,
|
|
|
|
nargs, nreturn_vals,
|
|
|
|
args, return_vals,
|
|
|
|
temp_pattern_invoker);
|
|
|
|
|
|
|
|
pdbreturn_vals =
|
|
|
|
gimp_run_procedure("gimp_patterns_popup",
|
|
|
|
&bnreturn_vals,
|
2003-06-17 09:43:14 +00:00
|
|
|
GIMP_PDB_STRING, pdbname,
|
|
|
|
GIMP_PDB_STRING, title,
|
|
|
|
GIMP_PDB_STRING, pattern_name,
|
2003-03-28 14:13:54 +00:00
|
|
|
GIMP_PDB_END);
|
|
|
|
|
Changed the semantics of GIMP_EXTENSION and (to some extent) of
2003-06-19 Michael Natterer <mitch@gimp.org>
Changed the semantics of GIMP_EXTENSION and (to some extent)
of GIMP_PLUGIN:
The old meaning of EXTENSION was "I live in the toolbox" and
PLUGIN meant "I take RUN-MODE,IMAGE,DRAWABLE args (but only if I
am invoked interactively)". This is completely useless, since
living in the toolbox means having "<Toolbox>" in the menu_path
and taking RUN-MODE,IMAGE,DRAWABLE means just that, regardless of
what type of procedure we are.
The new meaning of GIMP_PLUGIN is just "I am an ordinary procedure,
I am invoked, do my job and finish", while GIMP_EXTENSION means
"I will install temporary procedures and I will keep running to
keep them available".
(A GIMP_EXTENSION *must* call gimp_extension_ack() now to tell the
core that it's ready to run, or the core will block waiting for
the message !!!).
* configure.in: bumped version number to 1.3.16.
* libgimpbase/gimpprotocol.h: increased protocol version number so
old extensions will refuse to load.
* app/gui/plug-in-commands.c (plug_in_run_cmd_callback): don't
blindly pass RUN-MODE,IMAGE,DRAWABLE to GIMP_PLUGIN procedures but
look at their parameters and pass them either RUN-MODE, or
RUN-MODE,IMAGE, or RUN-MODE,IMAGE,DRAWABLE.
* app/pdb/procedural_db.c: cleaned up, better error reporting,
replaced an impossible error message by g_return_if_fail()
* app/plug-in/plug-in-message.c (plug_in_handle_proc_install):
better error messages.
* app/plug-in/plug-in-params.c: allocate parameter arrays using
g_new0() so we don't have to worry about uninitialized stuff
later.
* app/plug-in/plug-in-run.c (plug_in_run): wait for
gimp_extension_ack() installation confirmation for ALL extensions,
not just for automatically started ones.
* app/plug-in/plug-ins.c: cleanup.
* libgimp/gimp.[ch]: cleaned up and API-documented massively. Made
all magic values given in the GPConfig message static and added
accessor functions for them. Added gimp_tile_width()/height().
Added new function gimp_extension_enable() which turns on
asynchronous processing of temp_proc run requests without having
to enter an endless gimp_extension_process() loop. Moved all
private functions to the end of the file. Added tons of
g_return_if_fail() all over the place. Call gimp_run_procedure2()
from gimp_run_procedure() instead of duplicating the
code. Indentation, spacing, stuff...
* libgimp/gimptile.[ch]: removed gimp_tile_width()/height().
* libgimp/gimpdrawable.c
* libgimp/gimppixelrgn.c
* libgimp/gimptile.c: use the gimp_tile_width()/height() accessor
functions.
* libgimp/gimp.def: added gimp_extension_enable.
* libgimp/gimpmenu.c: removed evil code which connected to
_readchannel manually and use gimp_extension_enable() for watching
temp_procs.
* plug-ins/helpbrowser/helpbrowser.c: removed the same evil code
here and call gimp_extension_enable(). Call gimp_extension_ack()
to let the core know that the temp_proc is installed.
* plug-ins/script-fu/script-fu.c: made all procedures except the
permanently running "extension_script_fu" ordinary GIMP_PLUGIN
procedures.
* plug-ins/common/curve_bend.c
* plug-ins/common/plugindetails.c
* plug-ins/common/screenshot.c
* plug-ins/common/uniteditor.c
* plug-ins/common/winclipboard.c
* plug-ins/dbbrowser/dbbrowser.c
* plug-ins/gfli/gfli.c
* plug-ins/twain/twain.c
* plug-ins/webbrowser/webbrowser.c
* plug-ins/winsnap/winsnap.c: made them all ordinary GIMP_PLUGIN
procedures and renamed them from "extension_*" to "plug_in_*".
Random cleanups.
* app/widgets/gimphelp.c
* plug-ins/maze/maze_face.c: call "plug_in_web_browser" now.
2003-06-19 17:12:00 +00:00
|
|
|
gimp_extension_enable (); /* Allow callbacks to be watched */
|
2003-03-28 14:13:54 +00:00
|
|
|
|
|
|
|
gimp_destroy_params (pdbreturn_vals, bnreturn_vals);
|
|
|
|
|
|
|
|
/* Now add to hash table so we can find it again */
|
2003-06-19 13:01:49 +00:00
|
|
|
if (! gpattern_ht)
|
2003-06-17 09:43:14 +00:00
|
|
|
gpattern_ht = g_hash_table_new (g_str_hash, g_str_equal);
|
2003-03-28 14:13:54 +00:00
|
|
|
|
|
|
|
pdata->callback = callback;
|
|
|
|
pdata->data = data;
|
|
|
|
g_hash_table_insert (gpattern_ht, pdbname,pdata);
|
|
|
|
|
|
|
|
return pdbname;
|
|
|
|
}
|