gimp/app/widgets/gimpcomponentlistitem.c

366 lines
11 KiB
C
Raw Normal View History

/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpcomponentlistitem.c
* Copyright (C) 2001 Michael Natterer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "widgets-types.h"
#include "core/gimpimage.h"
#include "core/gimpviewable.h"
#include "display/gimpdisplay.h"
#include "gimpcomponentlistitem.h"
#include "gimpdnd.h"
#include "gimpimagepreview.h"
#include "gimppreview.h"
#include "libgimp/gimpintl.h"
static void gimp_component_list_item_class_init (GimpComponentListItemClass *klass);
static void gimp_component_list_item_init (GimpComponentListItem *list_item);
static void gimp_component_list_item_set_viewable (GimpListItem *list_item,
GimpViewable *viewable);
static void gimp_component_list_item_eye_toggled (GtkWidget *widget,
gpointer data);
static void gimp_component_list_item_visibility_changed (GimpImage *gimage,
ChannelType channel,
gpointer data);
static void gimp_component_list_item_active_changed (GimpImage *gimage,
ChannelType channel,
gpointer data);
static gchar * gimp_component_list_item_get_name (GtkWidget *widget);
static GimpListItemClass *parent_class = NULL;
GtkType
gimp_component_list_item_get_type (void)
{
static GtkType list_item_type = 0;
if (! list_item_type)
{
static const GtkTypeInfo list_item_info =
{
"GimpComponentListItem",
sizeof (GimpComponentListItem),
sizeof (GimpComponentListItemClass),
(GtkClassInitFunc) gimp_component_list_item_class_init,
(GtkObjectInitFunc) gimp_component_list_item_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
list_item_type = gtk_type_unique (GIMP_TYPE_LIST_ITEM, &list_item_info);
}
return list_item_type;
}
static void
gimp_component_list_item_class_init (GimpComponentListItemClass *klass)
{
GtkWidgetClass *widget_class;
GtkItemClass *item_class;
GimpListItemClass *list_item_class;
widget_class = (GtkWidgetClass *) klass;
item_class = (GtkItemClass *) klass;
list_item_class = (GimpListItemClass *) klass;
parent_class = gtk_type_class (GIMP_TYPE_LIST_ITEM);
list_item_class->set_viewable = gimp_component_list_item_set_viewable;
}
static void
gimp_component_list_item_init (GimpComponentListItem *list_item)
{
GtkWidget *abox;
register the button icons with GTK_ICON_SIZE_BUTTON, but set them as 2001-08-05 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpstock.[ch]: register the button icons with GTK_ICON_SIZE_BUTTON, but set them as scalable fallbacks for themselves so they get scaled for menus. * app/gui/menus.c: set stock icons for much more menu entries. * app/widgets/gimpwidgets-utils.[ch]: new utility function gimp_item_factory_popup_with_data(). * app/disp_callbacks.[ch] * app/gui/brushes-commands.c * app/gui/channels-commands.c * app/gui/gradients-commands.c * app/gui/layers-commands.c * app/gui/palettes-commands.c * app/gui/paths-dialog.c * app/gui/patterns-commands.c: use the new function. * app/tools/gimpcolorbalancetool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c: s/_("Reset")/GIMP_STOCK_RESET/ * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainerview.[ch]: moved the button_box utility functions from the container editor to GimpContainerView itself. * app/widgets/gimpbufferview.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpcontainergridview.[ch] * app/widgets/gimpdatafactoryview.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.[ch] * app/widgets/gimplayerlistitem.c * app/widgets/gimplayerlistview.c: changed accordingly. Removed lots of duplicated code and use stock images instead of pixmaps. * libgimpwidgets/gimpfileselection.[ch] * libgimpwidgets/gimppatheditor.c: use stock images instead of pixmaps. * pixmaps/Makefile.am: removed "yes" and "no", added "stroke". * pixmaps/anchor.xpm * pixmaps/delete.xpm * pixmaps/lower.xpm * pixmaps/new.xpm * pixmaps/paste-as-new.xpm * pixmaps/paste-into.xpm * pixmaps/paste.xpm * pixmaps/raise.xpm * pixmaps/refresh.xpm * pixmaps/toselection.xpm: made them all 16x16 so they are scaled nicely in menus. Should probably be 18x18.
2001-08-04 20:38:54 +00:00
GtkWidget *image;
list_item->channel = 0;
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
gtk_box_pack_start (GTK_BOX (GIMP_LIST_ITEM (list_item)->hbox), abox,
FALSE, FALSE, 0);
gtk_widget_show (abox);
list_item->eye_button = gtk_toggle_button_new ();
gtk_button_set_relief (GTK_BUTTON (list_item->eye_button), GTK_RELIEF_NONE);
gtk_container_add (GTK_CONTAINER (abox), list_item->eye_button);
gtk_widget_show (list_item->eye_button);
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
g_signal_connect (G_OBJECT (list_item->eye_button), "realize",
G_CALLBACK (gimp_list_item_button_realize),
list_item);
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
g_signal_connect (G_OBJECT (list_item->eye_button), "state_changed",
G_CALLBACK (gimp_list_item_button_state_changed),
list_item);
register the button icons with GTK_ICON_SIZE_BUTTON, but set them as 2001-08-05 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpstock.[ch]: register the button icons with GTK_ICON_SIZE_BUTTON, but set them as scalable fallbacks for themselves so they get scaled for menus. * app/gui/menus.c: set stock icons for much more menu entries. * app/widgets/gimpwidgets-utils.[ch]: new utility function gimp_item_factory_popup_with_data(). * app/disp_callbacks.[ch] * app/gui/brushes-commands.c * app/gui/channels-commands.c * app/gui/gradients-commands.c * app/gui/layers-commands.c * app/gui/palettes-commands.c * app/gui/paths-dialog.c * app/gui/patterns-commands.c: use the new function. * app/tools/gimpcolorbalancetool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c: s/_("Reset")/GIMP_STOCK_RESET/ * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainerview.[ch]: moved the button_box utility functions from the container editor to GimpContainerView itself. * app/widgets/gimpbufferview.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpcontainergridview.[ch] * app/widgets/gimpdatafactoryview.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.[ch] * app/widgets/gimplayerlistitem.c * app/widgets/gimplayerlistview.c: changed accordingly. Removed lots of duplicated code and use stock images instead of pixmaps. * libgimpwidgets/gimpfileselection.[ch] * libgimpwidgets/gimppatheditor.c: use stock images instead of pixmaps. * pixmaps/Makefile.am: removed "yes" and "no", added "stroke". * pixmaps/anchor.xpm * pixmaps/delete.xpm * pixmaps/lower.xpm * pixmaps/new.xpm * pixmaps/paste-as-new.xpm * pixmaps/paste-into.xpm * pixmaps/paste.xpm * pixmaps/raise.xpm * pixmaps/refresh.xpm * pixmaps/toselection.xpm: made them all 16x16 so they are scaled nicely in menus. Should probably be 18x18.
2001-08-04 20:38:54 +00:00
image = gtk_image_new_from_stock (GIMP_STOCK_VISIBLE,
GTK_ICON_SIZE_BUTTON);
gtk_container_add (GTK_CONTAINER (list_item->eye_button), image);
gtk_widget_show (image);
}
GtkWidget *
gimp_component_list_item_new (GimpImage *gimage,
gint preview_size,
ChannelType channel)
{
GimpListItem *list_item;
g_return_val_if_fail (gimage != NULL, NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
g_return_val_if_fail (preview_size > 0 && preview_size <= 256, NULL);
g_return_val_if_fail (channel >= RED_CHANNEL && channel <= ALPHA_CHANNEL,
NULL);
list_item = g_object_new (GIMP_TYPE_COMPONENT_LIST_ITEM, NULL);
list_item->preview_size = preview_size;
list_item->get_name_func = gimp_component_list_item_get_name;
GIMP_COMPONENT_LIST_ITEM (list_item)->channel = channel;
gimp_list_item_set_viewable (list_item, GIMP_VIEWABLE (gimage));
GTK_PREVIEW (list_item->preview)->bpp = 1;
GTK_PREVIEW (list_item->preview)->type = GTK_PREVIEW_GRAYSCALE;
return GTK_WIDGET (list_item);
}
static void
gimp_component_list_item_set_viewable (GimpListItem *list_item,
GimpViewable *viewable)
{
GimpComponentListItem *component_item;
GimpImage *gimage;
gboolean visible;
gboolean active;
gint pixel;
if (GIMP_LIST_ITEM_CLASS (parent_class)->set_viewable)
GIMP_LIST_ITEM_CLASS (parent_class)->set_viewable (list_item, viewable);
component_item = GIMP_COMPONENT_LIST_ITEM (list_item);
gimage = GIMP_IMAGE (GIMP_PREVIEW (list_item->preview)->viewable);
visible = gimp_image_get_component_visible (gimage,
component_item->channel);
active = gimp_image_get_component_active (gimage,
component_item->channel);
switch (component_item->channel)
{
case RED_CHANNEL: pixel = RED_PIX; break;
case GREEN_CHANNEL: pixel = GREEN_PIX; break;
case BLUE_CHANNEL: pixel = BLUE_PIX; break;
case GRAY_CHANNEL: pixel = GRAY_PIX; break;
case INDEXED_CHANNEL: pixel = INDEXED_PIX; break;
case ALPHA_CHANNEL: pixel = ALPHA_PIX; break;
default:
pixel = 0;
}
GIMP_IMAGE_PREVIEW (list_item->preview)->channel = pixel;
if (! visible)
{
GtkRequisition requisition;
gtk_widget_size_request (component_item->eye_button, &requisition);
gtk_widget_set_usize (component_item->eye_button,
requisition.width,
requisition.height);
gtk_widget_hide (GTK_BIN (component_item->eye_button)->child);
}
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (component_item->eye_button),
visible);
if (active)
gtk_item_select (GTK_ITEM (list_item));
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
g_signal_connect (G_OBJECT (component_item->eye_button), "toggled",
G_CALLBACK (gimp_component_list_item_eye_toggled),
list_item);
g_signal_connect_object (G_OBJECT (viewable), "component_visibility_changed",
G_CALLBACK (gimp_component_list_item_visibility_changed),
G_OBJECT (list_item),
0);
g_signal_connect_object (G_OBJECT (viewable), "component_active_changed",
G_CALLBACK (gimp_component_list_item_active_changed),
G_OBJECT (list_item),
0);
}
static void
gimp_component_list_item_eye_toggled (GtkWidget *widget,
gpointer data)
{
GimpComponentListItem *component_item;
GimpListItem *list_item;
GimpImage *gimage;
gboolean visible;
component_item = GIMP_COMPONENT_LIST_ITEM (data);
list_item = GIMP_LIST_ITEM (data);
gimage = GIMP_IMAGE (GIMP_PREVIEW (list_item->preview)->viewable);
visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
if (visible != gimp_image_get_component_visible (gimage,
component_item->channel))
{
if (! visible)
{
gtk_widget_set_usize (GTK_WIDGET (widget),
GTK_WIDGET (widget)->allocation.width,
GTK_WIDGET (widget)->allocation.height);
gtk_widget_hide (GTK_BIN (widget)->child);
}
else
{
gtk_widget_show (GTK_BIN (widget)->child);
gtk_widget_set_usize (GTK_WIDGET (widget), -1, -1);
}
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
g_signal_handlers_block_by_func (G_OBJECT (gimage),
gimp_component_list_item_visibility_changed,
list_item);
gimp_image_set_component_visible (gimage, component_item->channel,
visible);
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
g_signal_handlers_unblock_by_func (G_OBJECT (gimage),
gimp_component_list_item_visibility_changed,
list_item);
gdisplays_update_area (gimage, 0, 0, gimage->width, gimage->height);
gdisplays_flush ();
}
}
static void
gimp_component_list_item_visibility_changed (GimpImage *gimage,
ChannelType channel,
gpointer data)
{
GimpComponentListItem *component_item;
GimpListItem *list_item;
GtkToggleButton *toggle;
gboolean visible;
component_item = GIMP_COMPONENT_LIST_ITEM (data);
if (channel != component_item->channel)
return;
list_item = GIMP_LIST_ITEM (data);
toggle = GTK_TOGGLE_BUTTON (component_item->eye_button);
visible = gimp_image_get_component_visible (gimage, component_item->channel);
if (visible != toggle->active)
{
if (! visible)
{
gtk_widget_set_usize (GTK_WIDGET (toggle),
GTK_WIDGET (toggle)->allocation.width,
GTK_WIDGET (toggle)->allocation.height);
gtk_widget_hide (GTK_BIN (toggle)->child);
}
else
{
gtk_widget_show (GTK_BIN (toggle)->child);
gtk_widget_set_usize (GTK_WIDGET (toggle), -1, -1);
}
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
g_signal_handlers_block_by_func (G_OBJECT (toggle),
gimp_component_list_item_eye_toggled,
list_item);
gtk_toggle_button_set_active (toggle, visible);
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
g_signal_handlers_unblock_by_func (G_OBJECT (toggle),
gimp_component_list_item_eye_toggled,
list_item);
}
}
static void
gimp_component_list_item_active_changed (GimpImage *gimage,
ChannelType channel,
gpointer data)
{
GimpComponentListItem *component_item;
gboolean active;
component_item = GIMP_COMPONENT_LIST_ITEM (data);
if (channel != component_item->channel)
return;
active = gimp_image_get_component_active (gimage, component_item->channel);
if (active)
gtk_item_select (GTK_ITEM (data));
else
gtk_item_deselect (GTK_ITEM (data));
}
static gchar *
gimp_component_list_item_get_name (GtkWidget *widget)
{
GimpComponentListItem *component_item;
component_item = GIMP_COMPONENT_LIST_ITEM (widget);
switch (component_item->channel)
{
case RED_CHANNEL: return g_strdup (_("Red")); break;
case GREEN_CHANNEL: return g_strdup (_("Green")); break;
case BLUE_CHANNEL: return g_strdup (_("Blue")); break;
case GRAY_CHANNEL: return g_strdup (_("Gray")); break;
case INDEXED_CHANNEL: return g_strdup (_("Indexed")); break;
case ALPHA_CHANNEL: return g_strdup (_("Alpha")); break;
default: return g_strdup ("EEK"); break;
}
}