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
|
|
|
|
2003-07-01 15:06:06 +00:00
|
|
|
static void gimp_menu_callback (GtkWidget *widget,
|
|
|
|
gint32 *id);
|
|
|
|
static void fill_preview_with_thumb (GtkWidget *widget,
|
|
|
|
gint32 drawable_ID,
|
|
|
|
gint width,
|
|
|
|
gint height);
|
2003-06-19 13:01:49 +00:00
|
|
|
|
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);
|
2003-07-01 15:06:06 +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]);
|
|
|
|
label = g_strdup_printf ("%s-%d", name, images[i]);
|
|
|
|
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];
|
2003-07-01 15:06:06 +00:00
|
|
|
|
1997-11-24 22:05:25 +00:00
|
|
|
(* callback) (active_image, data);
|
2003-07-01 15:06:06 +00:00
|
|
|
|
|
|
|
g_free (images);
|
1997-11-24 22:05:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
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);
|
2003-07-01 15:06:06 +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]);
|
|
|
|
image_label = g_strdup_printf ("%s-%d", name, images[i]);
|
|
|
|
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);
|
2003-07-01 15:06:06 +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);
|
|
|
|
|
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);
|
2003-07-01 15:06:06 +00:00
|
|
|
g_free (layers);
|
1997-11-24 22:05:25 +00:00
|
|
|
}
|
2003-07-01 15:06:06 +00:00
|
|
|
|
1997-11-24 22:05:25 +00:00
|
|
|
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);
|
2003-07-01 15:06:06 +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]);
|
|
|
|
image_label = g_strdup_printf ("%s-%d", name, images[i]);
|
|
|
|
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);
|
2003-07-01 15:06:06 +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-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);
|
2003-07-01 15:06:06 +00:00
|
|
|
g_free (channels);
|
1997-11-24 22:05:25 +00:00
|
|
|
}
|
2003-07-01 15:06:06 +00:00
|
|
|
|
1997-11-24 22:05:25 +00:00
|
|
|
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]);
|
|
|
|
image_label = g_strdup_printf ("%s-%d", name, images[i]);
|
|
|
|
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);
|
2003-07-01 15:06:06 +00:00
|
|
|
g_free (layers);
|
|
|
|
g_free (channels);
|
1997-11-24 22:05:25 +00:00
|
|
|
}
|
2003-07-01 15:06:06 +00:00
|
|
|
|
1997-11-24 22:05:25 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-07-01 15:06:06 +00:00
|
|
|
/* private functions */
|
|
|
|
|
1997-11-24 22:05:25 +00:00
|
|
|
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 */
|
2003-07-01 15:06:06 +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;
|
2003-07-01 15:06:06 +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
|
|
|
|
{
|
2003-07-01 15:06:06 +00:00
|
|
|
r = g = b = ((gdouble) src[x*bpp+0]) / 255.0;
|
|
|
|
|
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;
|
|
|
|
}
|
2003-07-01 15:06:06 +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
|
|
|
}
|
2003-07-01 15:06:06 +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
|
|
|
|
2003-07-01 15:06:06 +00:00
|
|
|
g_free (drawable_data);
|
2000-05-08 17:45:16 +00:00
|
|
|
g_free (even);
|
|
|
|
g_free (odd);
|
1999-06-23 23:01:14 +00:00
|
|
|
}
|