Added buttons to access the menu functions in the Layers&Channels-dialog

more directly. They are connected to the menu-item-callback-functions.


--Sven
This commit is contained in:
Sven Neumann 1998-04-03 10:29:25 +00:00
parent 6e1afab963
commit 69fc983a33
20 changed files with 611 additions and 1 deletions

View File

@ -1,3 +1,13 @@
Fri Apr 3 12:22:40 MEST 1998 Sven Neumann <sven@gimp.org>
* app/Makefile.am
* tools/*.xpm
* app/ops_buttons.[c|h]
* app/channels_dialog.c
* app/layers_dialog.c: Added buttons to access the menu functions
in the Layers&Channels-dialog more directly. They are connected to
the menu-item-callback-functions.
Thu Apr 2 04:06:50 EST 1998 Matthew Wilson <msw@gimp.org> Thu Apr 2 04:06:50 EST 1998 Matthew Wilson <msw@gimp.org>
* app/disp_callbacks.c: Always ungrab the pointer on button release. * app/disp_callbacks.c: Always ungrab the pointer on button release.

View File

@ -187,6 +187,8 @@ gimp_SOURCES = \
menus.h \ menus.h \
move.c \ move.c \
move.h \ move.h \
ops_buttons.c \
ops_buttons.h \
palette.c \ palette.c \
palette.h \ palette.h \
paint_core.c \ paint_core.c \
@ -266,7 +268,19 @@ EXTRA_DIST = \
tools/eye.xbm \ tools/eye.xbm \
tools/layer.xbm \ tools/layer.xbm \
tools/linked.xbm \ tools/linked.xbm \
tools/mask.xbm tools/mask.xbm \
tools/anchor.xpm \
tools/anchor_is.xpm \
tools/delete.xpm \
tools/delete_is.xpm \
tools/duplicate.xpm \
tools/duplicate_is.xpm \
tools/lower.xpm \
tools/lower_is.xpm \
tools/new.xpm \
tools/new_is.xpm \
tools/raise.xpm \
tools/raise_is.xpm
CPPFLAGS = \ CPPFLAGS = \
-DLIBDIR=\""$(gimpplugindir)"\" \ -DLIBDIR=\""$(gimpplugindir)"\" \

View File

@ -33,12 +33,23 @@
#include "general.h" #include "general.h"
#include "interface.h" #include "interface.h"
#include "layers_dialogP.h" #include "layers_dialogP.h"
#include "ops_buttons.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "palette.h" #include "palette.h"
#include "resize.h" #include "resize.h"
#include "tools/eye.xbm" #include "tools/eye.xbm"
#include "tools/channel.xbm" #include "tools/channel.xbm"
#include "tools/new.xpm"
#include "tools/new_is.xpm"
#include "tools/raise.xpm"
#include "tools/raise_is.xpm"
#include "tools/lower.xpm"
#include "tools/lower_is.xpm"
#include "tools/duplicate.xpm"
#include "tools/duplicate_is.xpm"
#include "tools/delete.xpm"
#include "tools/delete_is.xpm"
#include "channel_pvt.h" #include "channel_pvt.h"
@ -160,6 +171,16 @@ static MenuItem channels_ops[] =
{ NULL, 0, 0, NULL, NULL, NULL, NULL }, { NULL, 0, 0, NULL, NULL, NULL, NULL },
}; };
/* the ops buttons */
static OpsButton channels_ops_buttons[] =
{
{ new_xpm, new_is_xpm, channels_dialog_new_channel_callback, "New Channel", NULL, NULL, NULL, NULL, NULL, NULL },
{ raise_xpm, raise_is_xpm, channels_dialog_raise_channel_callback, "Raise Channel", NULL, NULL, NULL, NULL, NULL, NULL },
{ lower_xpm, lower_is_xpm, channels_dialog_lower_channel_callback, "Lower Channel", NULL, NULL, NULL, NULL, NULL, NULL },
{ duplicate_xpm, duplicate_is_xpm, channels_dialog_duplicate_channel_callback, "Duplicate Channel", NULL, NULL, NULL, NULL, NULL, NULL },
{ delete_xpm, delete_is_xpm, channels_dialog_delete_channel_callback, "Delete Channel", NULL, NULL, NULL, NULL, NULL, NULL },
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
};
/**************************************/ /**************************************/
/* Public channels dialog functions */ /* Public channels dialog functions */
@ -170,6 +191,7 @@ channels_dialog_create ()
{ {
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *listbox; GtkWidget *listbox;
GtkWidget *button_box;
if (!channelsD) if (!channelsD)
{ {
@ -209,6 +231,14 @@ channels_dialog_create ()
gtk_widget_show (channelsD->channel_list); gtk_widget_show (channelsD->channel_list);
gtk_widget_show (listbox); gtk_widget_show (listbox);
/* The ops buttons */
button_box = ops_button_box_new (lc_shell, tool_tips, channels_ops_buttons);
gtk_box_pack_start (GTK_BOX (vbox), button_box, FALSE, FALSE, 2);
gtk_widget_show (button_box);
/* Set up signals for map/unmap for the accelerators */ /* Set up signals for map/unmap for the accelerators */
gtk_signal_connect (GTK_OBJECT (channelsD->vbox), "map", gtk_signal_connect (GTK_OBJECT (channelsD->vbox), "map",
(GtkSignalFunc) channels_dialog_map_callback, (GtkSignalFunc) channels_dialog_map_callback,
@ -513,14 +543,19 @@ channels_dialog_set_menu_sensitivity ()
/* new channel */ /* new channel */
gtk_widget_set_sensitive (channels_ops[0].widget, !fs_sensitive); gtk_widget_set_sensitive (channels_ops[0].widget, !fs_sensitive);
ops_button_set_sensitive (channels_ops_buttons[0], !fs_sensitive);
/* raise channel */ /* raise channel */
gtk_widget_set_sensitive (channels_ops[1].widget, !fs_sensitive && aux_sensitive); gtk_widget_set_sensitive (channels_ops[1].widget, !fs_sensitive && aux_sensitive);
ops_button_set_sensitive (channels_ops_buttons[1], !fs_sensitive && aux_sensitive);
/* lower channel */ /* lower channel */
gtk_widget_set_sensitive (channels_ops[2].widget, !fs_sensitive && aux_sensitive); gtk_widget_set_sensitive (channels_ops[2].widget, !fs_sensitive && aux_sensitive);
ops_button_set_sensitive (channels_ops_buttons[2], !fs_sensitive && aux_sensitive);
/* duplicate channel */ /* duplicate channel */
gtk_widget_set_sensitive (channels_ops[3].widget, !fs_sensitive && aux_sensitive); gtk_widget_set_sensitive (channels_ops[3].widget, !fs_sensitive && aux_sensitive);
ops_button_set_sensitive (channels_ops_buttons[3], !fs_sensitive && aux_sensitive);
/* delete channel */ /* delete channel */
gtk_widget_set_sensitive (channels_ops[4].widget, !fs_sensitive && aux_sensitive); gtk_widget_set_sensitive (channels_ops[4].widget, !fs_sensitive && aux_sensitive);
ops_button_set_sensitive (channels_ops_buttons[4], !fs_sensitive && aux_sensitive);
/* channel to selection */ /* channel to selection */
gtk_widget_set_sensitive (channels_ops[5].widget, aux_sensitive); gtk_widget_set_sensitive (channels_ops[5].widget, aux_sensitive);
} }

View File

@ -33,12 +33,23 @@
#include "general.h" #include "general.h"
#include "interface.h" #include "interface.h"
#include "layers_dialogP.h" #include "layers_dialogP.h"
#include "ops_buttons.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "palette.h" #include "palette.h"
#include "resize.h" #include "resize.h"
#include "tools/eye.xbm" #include "tools/eye.xbm"
#include "tools/channel.xbm" #include "tools/channel.xbm"
#include "tools/new.xpm"
#include "tools/new_is.xpm"
#include "tools/raise.xpm"
#include "tools/raise_is.xpm"
#include "tools/lower.xpm"
#include "tools/lower_is.xpm"
#include "tools/duplicate.xpm"
#include "tools/duplicate_is.xpm"
#include "tools/delete.xpm"
#include "tools/delete_is.xpm"
#include "channel_pvt.h" #include "channel_pvt.h"
@ -160,6 +171,16 @@ static MenuItem channels_ops[] =
{ NULL, 0, 0, NULL, NULL, NULL, NULL }, { NULL, 0, 0, NULL, NULL, NULL, NULL },
}; };
/* the ops buttons */
static OpsButton channels_ops_buttons[] =
{
{ new_xpm, new_is_xpm, channels_dialog_new_channel_callback, "New Channel", NULL, NULL, NULL, NULL, NULL, NULL },
{ raise_xpm, raise_is_xpm, channels_dialog_raise_channel_callback, "Raise Channel", NULL, NULL, NULL, NULL, NULL, NULL },
{ lower_xpm, lower_is_xpm, channels_dialog_lower_channel_callback, "Lower Channel", NULL, NULL, NULL, NULL, NULL, NULL },
{ duplicate_xpm, duplicate_is_xpm, channels_dialog_duplicate_channel_callback, "Duplicate Channel", NULL, NULL, NULL, NULL, NULL, NULL },
{ delete_xpm, delete_is_xpm, channels_dialog_delete_channel_callback, "Delete Channel", NULL, NULL, NULL, NULL, NULL, NULL },
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
};
/**************************************/ /**************************************/
/* Public channels dialog functions */ /* Public channels dialog functions */
@ -170,6 +191,7 @@ channels_dialog_create ()
{ {
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *listbox; GtkWidget *listbox;
GtkWidget *button_box;
if (!channelsD) if (!channelsD)
{ {
@ -209,6 +231,14 @@ channels_dialog_create ()
gtk_widget_show (channelsD->channel_list); gtk_widget_show (channelsD->channel_list);
gtk_widget_show (listbox); gtk_widget_show (listbox);
/* The ops buttons */
button_box = ops_button_box_new (lc_shell, tool_tips, channels_ops_buttons);
gtk_box_pack_start (GTK_BOX (vbox), button_box, FALSE, FALSE, 2);
gtk_widget_show (button_box);
/* Set up signals for map/unmap for the accelerators */ /* Set up signals for map/unmap for the accelerators */
gtk_signal_connect (GTK_OBJECT (channelsD->vbox), "map", gtk_signal_connect (GTK_OBJECT (channelsD->vbox), "map",
(GtkSignalFunc) channels_dialog_map_callback, (GtkSignalFunc) channels_dialog_map_callback,
@ -513,14 +543,19 @@ channels_dialog_set_menu_sensitivity ()
/* new channel */ /* new channel */
gtk_widget_set_sensitive (channels_ops[0].widget, !fs_sensitive); gtk_widget_set_sensitive (channels_ops[0].widget, !fs_sensitive);
ops_button_set_sensitive (channels_ops_buttons[0], !fs_sensitive);
/* raise channel */ /* raise channel */
gtk_widget_set_sensitive (channels_ops[1].widget, !fs_sensitive && aux_sensitive); gtk_widget_set_sensitive (channels_ops[1].widget, !fs_sensitive && aux_sensitive);
ops_button_set_sensitive (channels_ops_buttons[1], !fs_sensitive && aux_sensitive);
/* lower channel */ /* lower channel */
gtk_widget_set_sensitive (channels_ops[2].widget, !fs_sensitive && aux_sensitive); gtk_widget_set_sensitive (channels_ops[2].widget, !fs_sensitive && aux_sensitive);
ops_button_set_sensitive (channels_ops_buttons[2], !fs_sensitive && aux_sensitive);
/* duplicate channel */ /* duplicate channel */
gtk_widget_set_sensitive (channels_ops[3].widget, !fs_sensitive && aux_sensitive); gtk_widget_set_sensitive (channels_ops[3].widget, !fs_sensitive && aux_sensitive);
ops_button_set_sensitive (channels_ops_buttons[3], !fs_sensitive && aux_sensitive);
/* delete channel */ /* delete channel */
gtk_widget_set_sensitive (channels_ops[4].widget, !fs_sensitive && aux_sensitive); gtk_widget_set_sensitive (channels_ops[4].widget, !fs_sensitive && aux_sensitive);
ops_button_set_sensitive (channels_ops_buttons[4], !fs_sensitive && aux_sensitive);
/* channel to selection */ /* channel to selection */
gtk_widget_set_sensitive (channels_ops[5].widget, aux_sensitive); gtk_widget_set_sensitive (channels_ops[5].widget, aux_sensitive);
} }

View File

@ -35,6 +35,7 @@
#include "interface.h" #include "interface.h"
#include "layers_dialog.h" #include "layers_dialog.h"
#include "layers_dialogP.h" #include "layers_dialogP.h"
#include "ops_buttons.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "palette.h" #include "palette.h"
#include "resize.h" #include "resize.h"
@ -45,6 +46,19 @@
#include "tools/layer.xbm" #include "tools/layer.xbm"
#include "tools/mask.xbm" #include "tools/mask.xbm"
#include "tools/new.xpm"
#include "tools/new_is.xpm"
#include "tools/raise.xpm"
#include "tools/raise_is.xpm"
#include "tools/lower.xpm"
#include "tools/lower_is.xpm"
#include "tools/duplicate.xpm"
#include "tools/duplicate_is.xpm"
#include "tools/delete.xpm"
#include "tools/delete_is.xpm"
#include "tools/anchor.xpm"
#include "tools/anchor_is.xpm"
#include "layer_pvt.h" #include "layer_pvt.h"
@ -254,6 +268,18 @@ static MenuItem option_items[] =
{ NULL, 0, 0, NULL, NULL, NULL, NULL } { NULL, 0, 0, NULL, NULL, NULL, NULL }
}; };
/* the ops buttons */
static OpsButton layers_ops_buttons[] =
{
{ new_xpm, new_is_xpm, layers_dialog_new_layer_callback, "New Layer", NULL, NULL, NULL, NULL, NULL, NULL },
{ raise_xpm, raise_is_xpm, layers_dialog_raise_layer_callback, "Raise Layer", NULL, NULL, NULL, NULL, NULL, NULL },
{ lower_xpm, lower_is_xpm, layers_dialog_lower_layer_callback, "Lower Layer", NULL, NULL, NULL, NULL, NULL, NULL },
{ duplicate_xpm, duplicate_is_xpm, layers_dialog_duplicate_layer_callback, "Duplicate Layer", NULL, NULL, NULL, NULL, NULL, NULL },
{ delete_xpm, delete_is_xpm, layers_dialog_delete_layer_callback, "Delete Layer", NULL, NULL, NULL, NULL, NULL, NULL },
{ anchor_xpm, anchor_is_xpm, layers_dialog_anchor_layer_callback, "Anchor Layer", NULL, NULL, NULL, NULL, NULL, NULL },
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
};
/************************************/ /************************************/
/* Public layers dialog functions */ /* Public layers dialog functions */
@ -586,10 +612,12 @@ layers_dialog_create ()
{ {
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *util_box; GtkWidget *util_box;
GtkWidget *button_box;
GtkWidget *label; GtkWidget *label;
GtkWidget *menu; GtkWidget *menu;
GtkWidget *slider; GtkWidget *slider;
GtkWidget *listbox; GtkWidget *listbox;
if (!layersD) if (!layersD)
{ {
@ -675,6 +703,12 @@ layers_dialog_create ()
gtk_widget_show (layersD->layer_list); gtk_widget_show (layersD->layer_list);
gtk_widget_show (listbox); gtk_widget_show (listbox);
/* The ops buttons */
button_box = ops_button_box_new (lc_shell, tool_tips, layers_ops_buttons);
gtk_box_pack_start (GTK_BOX (vbox), button_box, FALSE, FALSE, 2);
gtk_widget_show (button_box);
/* Set up signals for map/unmap for the accelerators */ /* Set up signals for map/unmap for the accelerators */
gtk_signal_connect (GTK_OBJECT (layersD->vbox), "map", gtk_signal_connect (GTK_OBJECT (layersD->vbox), "map",
@ -1127,14 +1161,19 @@ layers_dialog_set_menu_sensitivity ()
/* new layer */ /* new layer */
gtk_widget_set_sensitive (layers_ops[0].widget, gimage); gtk_widget_set_sensitive (layers_ops[0].widget, gimage);
ops_button_set_sensitive (layers_ops_buttons[0], gimage);
/* raise layer */ /* raise layer */
gtk_widget_set_sensitive (layers_ops[1].widget, fs && ac && gimage && lp); gtk_widget_set_sensitive (layers_ops[1].widget, fs && ac && gimage && lp);
ops_button_set_sensitive (layers_ops_buttons[1], fs && ac && gimage && lp);
/* lower layer */ /* lower layer */
gtk_widget_set_sensitive (layers_ops[2].widget, fs && ac && gimage && lp); gtk_widget_set_sensitive (layers_ops[2].widget, fs && ac && gimage && lp);
ops_button_set_sensitive (layers_ops_buttons[2], fs && ac && gimage && lp);
/* duplicate layer */ /* duplicate layer */
gtk_widget_set_sensitive (layers_ops[3].widget, fs && ac && gimage && lp); gtk_widget_set_sensitive (layers_ops[3].widget, fs && ac && gimage && lp);
ops_button_set_sensitive (layers_ops_buttons[3], fs && ac && gimage && lp);
/* delete layer */ /* delete layer */
gtk_widget_set_sensitive (layers_ops[4].widget, ac && gimage && lp); gtk_widget_set_sensitive (layers_ops[4].widget, ac && gimage && lp);
ops_button_set_sensitive (layers_ops_buttons[4], ac && gimage && lp);
/* scale layer */ /* scale layer */
gtk_widget_set_sensitive (layers_ops[5].widget, ac && gimage && lp); gtk_widget_set_sensitive (layers_ops[5].widget, ac && gimage && lp);
/* resize layer */ /* resize layer */
@ -1145,6 +1184,7 @@ layers_dialog_set_menu_sensitivity ()
gtk_widget_set_sensitive (layers_ops[8].widget, fs && ac && gimage && lm && lp); gtk_widget_set_sensitive (layers_ops[8].widget, fs && ac && gimage && lm && lp);
/* anchor layer */ /* anchor layer */
gtk_widget_set_sensitive (layers_ops[9].widget, !fs && ac && gimage && lp); gtk_widget_set_sensitive (layers_ops[9].widget, !fs && ac && gimage && lp);
ops_button_set_sensitive (layers_ops_buttons[5], !fs && ac && gimage && lp);
/* merge visible layers */ /* merge visible layers */
gtk_widget_set_sensitive (layers_ops[10].widget, fs && ac && gimage && lp); gtk_widget_set_sensitive (layers_ops[10].widget, fs && ac && gimage && lp);
/* flatten image */ /* flatten image */

View File

@ -35,6 +35,7 @@
#include "interface.h" #include "interface.h"
#include "layers_dialog.h" #include "layers_dialog.h"
#include "layers_dialogP.h" #include "layers_dialogP.h"
#include "ops_buttons.h"
#include "paint_funcs.h" #include "paint_funcs.h"
#include "palette.h" #include "palette.h"
#include "resize.h" #include "resize.h"
@ -45,6 +46,19 @@
#include "tools/layer.xbm" #include "tools/layer.xbm"
#include "tools/mask.xbm" #include "tools/mask.xbm"
#include "tools/new.xpm"
#include "tools/new_is.xpm"
#include "tools/raise.xpm"
#include "tools/raise_is.xpm"
#include "tools/lower.xpm"
#include "tools/lower_is.xpm"
#include "tools/duplicate.xpm"
#include "tools/duplicate_is.xpm"
#include "tools/delete.xpm"
#include "tools/delete_is.xpm"
#include "tools/anchor.xpm"
#include "tools/anchor_is.xpm"
#include "layer_pvt.h" #include "layer_pvt.h"
@ -254,6 +268,18 @@ static MenuItem option_items[] =
{ NULL, 0, 0, NULL, NULL, NULL, NULL } { NULL, 0, 0, NULL, NULL, NULL, NULL }
}; };
/* the ops buttons */
static OpsButton layers_ops_buttons[] =
{
{ new_xpm, new_is_xpm, layers_dialog_new_layer_callback, "New Layer", NULL, NULL, NULL, NULL, NULL, NULL },
{ raise_xpm, raise_is_xpm, layers_dialog_raise_layer_callback, "Raise Layer", NULL, NULL, NULL, NULL, NULL, NULL },
{ lower_xpm, lower_is_xpm, layers_dialog_lower_layer_callback, "Lower Layer", NULL, NULL, NULL, NULL, NULL, NULL },
{ duplicate_xpm, duplicate_is_xpm, layers_dialog_duplicate_layer_callback, "Duplicate Layer", NULL, NULL, NULL, NULL, NULL, NULL },
{ delete_xpm, delete_is_xpm, layers_dialog_delete_layer_callback, "Delete Layer", NULL, NULL, NULL, NULL, NULL, NULL },
{ anchor_xpm, anchor_is_xpm, layers_dialog_anchor_layer_callback, "Anchor Layer", NULL, NULL, NULL, NULL, NULL, NULL },
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
};
/************************************/ /************************************/
/* Public layers dialog functions */ /* Public layers dialog functions */
@ -586,10 +612,12 @@ layers_dialog_create ()
{ {
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *util_box; GtkWidget *util_box;
GtkWidget *button_box;
GtkWidget *label; GtkWidget *label;
GtkWidget *menu; GtkWidget *menu;
GtkWidget *slider; GtkWidget *slider;
GtkWidget *listbox; GtkWidget *listbox;
if (!layersD) if (!layersD)
{ {
@ -675,6 +703,12 @@ layers_dialog_create ()
gtk_widget_show (layersD->layer_list); gtk_widget_show (layersD->layer_list);
gtk_widget_show (listbox); gtk_widget_show (listbox);
/* The ops buttons */
button_box = ops_button_box_new (lc_shell, tool_tips, layers_ops_buttons);
gtk_box_pack_start (GTK_BOX (vbox), button_box, FALSE, FALSE, 2);
gtk_widget_show (button_box);
/* Set up signals for map/unmap for the accelerators */ /* Set up signals for map/unmap for the accelerators */
gtk_signal_connect (GTK_OBJECT (layersD->vbox), "map", gtk_signal_connect (GTK_OBJECT (layersD->vbox), "map",
@ -1127,14 +1161,19 @@ layers_dialog_set_menu_sensitivity ()
/* new layer */ /* new layer */
gtk_widget_set_sensitive (layers_ops[0].widget, gimage); gtk_widget_set_sensitive (layers_ops[0].widget, gimage);
ops_button_set_sensitive (layers_ops_buttons[0], gimage);
/* raise layer */ /* raise layer */
gtk_widget_set_sensitive (layers_ops[1].widget, fs && ac && gimage && lp); gtk_widget_set_sensitive (layers_ops[1].widget, fs && ac && gimage && lp);
ops_button_set_sensitive (layers_ops_buttons[1], fs && ac && gimage && lp);
/* lower layer */ /* lower layer */
gtk_widget_set_sensitive (layers_ops[2].widget, fs && ac && gimage && lp); gtk_widget_set_sensitive (layers_ops[2].widget, fs && ac && gimage && lp);
ops_button_set_sensitive (layers_ops_buttons[2], fs && ac && gimage && lp);
/* duplicate layer */ /* duplicate layer */
gtk_widget_set_sensitive (layers_ops[3].widget, fs && ac && gimage && lp); gtk_widget_set_sensitive (layers_ops[3].widget, fs && ac && gimage && lp);
ops_button_set_sensitive (layers_ops_buttons[3], fs && ac && gimage && lp);
/* delete layer */ /* delete layer */
gtk_widget_set_sensitive (layers_ops[4].widget, ac && gimage && lp); gtk_widget_set_sensitive (layers_ops[4].widget, ac && gimage && lp);
ops_button_set_sensitive (layers_ops_buttons[4], ac && gimage && lp);
/* scale layer */ /* scale layer */
gtk_widget_set_sensitive (layers_ops[5].widget, ac && gimage && lp); gtk_widget_set_sensitive (layers_ops[5].widget, ac && gimage && lp);
/* resize layer */ /* resize layer */
@ -1145,6 +1184,7 @@ layers_dialog_set_menu_sensitivity ()
gtk_widget_set_sensitive (layers_ops[8].widget, fs && ac && gimage && lm && lp); gtk_widget_set_sensitive (layers_ops[8].widget, fs && ac && gimage && lm && lp);
/* anchor layer */ /* anchor layer */
gtk_widget_set_sensitive (layers_ops[9].widget, !fs && ac && gimage && lp); gtk_widget_set_sensitive (layers_ops[9].widget, !fs && ac && gimage && lp);
ops_button_set_sensitive (layers_ops_buttons[5], !fs && ac && gimage && lp);
/* merge visible layers */ /* merge visible layers */
gtk_widget_set_sensitive (layers_ops[10].widget, fs && ac && gimage && lp); gtk_widget_set_sensitive (layers_ops[10].widget, fs && ac && gimage && lp);
/* flatten image */ /* flatten image */

112
app/ops_buttons.c Normal file
View File

@ -0,0 +1,112 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* To do this more elegantly, there should be a GtkWidget pixmap_button,
* probably derived from a simple hbox. It should keep track of the widgets
* sensitivity and draw the related pixmap. This way one could avoid the
* need to have a special function to set sensitivity as you'll find below.
* (sven@gimp.org)
*/
#include "appenv.h"
#include "gimprc.h"
#include "ops_buttons.h"
GtkWidget *ops_button_box_new (GtkWidget *parent,
GtkTooltips *tool_tips,
OpsButton *ops_buttons)
{
GtkWidget *button;
GtkWidget *button_box;
GtkWidget *box;
GtkWidget *pixmapwid;
GdkPixmap *pixmap;
GdkBitmap *mask;
GdkPixmap *is_pixmap;
GdkBitmap *is_mask;
GtkStyle *style;
gtk_widget_realize(parent);
style = gtk_widget_get_style(parent);
button_box = gtk_hbox_new (FALSE, 1);
while (ops_buttons->xpm_data)
{
box = gtk_hbox_new (FALSE, 0);
gtk_container_border_width (GTK_CONTAINER (box), 0);
pixmap = gdk_pixmap_create_from_xpm_d (parent->window,
&mask,
&style->bg[GTK_STATE_NORMAL],
ops_buttons->xpm_data);
is_pixmap = gdk_pixmap_create_from_xpm_d (parent->window,
&is_mask,
&style->bg[GTK_STATE_NORMAL],
ops_buttons->xpm_is_data);
pixmapwid = gtk_pixmap_new (pixmap, mask);
gtk_box_pack_start (GTK_BOX (box), pixmapwid, TRUE, TRUE, 3);
gtk_widget_show(pixmapwid);
gtk_widget_show(box);
button = gtk_button_new ();
gtk_container_add (GTK_CONTAINER (button), box);
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) ops_buttons->callback,
GTK_OBJECT (parent));
if (tool_tips != NULL)
gtk_tooltips_set_tip (tool_tips, button, ops_buttons->tooltip, NULL);
gtk_box_pack_start (GTK_BOX(button_box), button, TRUE, TRUE, 0);
gtk_widget_show (button);
ops_buttons->pixmap = pixmap;
ops_buttons->mask = mask;
ops_buttons->is_pixmap = is_pixmap;
ops_buttons->is_mask = is_mask;
ops_buttons->pixmapwid = pixmapwid;
ops_buttons->widget = button;
ops_buttons++;
}
return (button_box);
}
void
ops_button_set_sensitive(OpsButton ops_button,
gint sensitive)
{
sensitive = (sensitive != FALSE);
if (sensitive == (GTK_WIDGET_SENSITIVE (ops_button.widget) != FALSE))
return;
if (sensitive)
gtk_pixmap_set (GTK_PIXMAP(ops_button.pixmapwid),
ops_button.pixmap,
ops_button.mask);
else
gtk_pixmap_set (GTK_PIXMAP(ops_button.pixmapwid),
ops_button.is_pixmap,
ops_button.is_mask);
gtk_widget_set_sensitive (ops_button.widget, sensitive);
}

54
app/ops_buttons.h Normal file
View File

@ -0,0 +1,54 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __OPS_BUTTONS_H__
#define __OPS_BUTTONS_H__
/* Structures */
typedef struct _OpsButton OpsButton;
typedef void (*OpsButtonCallback) (GtkWidget *widget,
gpointer user_data);
struct _OpsButton
{
gchar **xpm_data; /* xpm data for the button in sensitive state */
gchar **xpm_is_data; /* xpm data for the button in insensitive state */
OpsButtonCallback callback;
char *tooltip;
GdkPixmap *pixmap;
GdkBitmap *mask;
GdkPixmap *is_pixmap;
GdkBitmap *is_mask;
GtkWidget *pixmapwid; /* the pixmap widget */
GtkWidget *widget; /* the button widget */
};
/* Function declarations */
GtkWidget * ops_button_box_new (GtkWidget *, /* parent widget */
GtkTooltips *,
OpsButton *);
void ops_button_set_sensitive (OpsButton, gint);
#endif /* __OPS_BUTTONS_H__ */

22
app/tools/anchor.xpm Normal file
View File

@ -0,0 +1,22 @@
/* XPM */
static char * anchor_xpm[] = {
"16 16 3 1",
" c None",
". c #000000",
"+ c #7F7F7F",
" ",
" ",
" .. ",
" ...... ",
" ....+ ",
" ..+ ",
" ..+ ",
" ..+ ",
" ..+ ",
" .. ..+ .. ",
" .. ..+ ..+ ",
" ... ..+ ...+ ",
" ..........+ ",
" ........+ ",
" ++..+++ ",
" + "};

22
app/tools/anchor_is.xpm Normal file
View File

@ -0,0 +1,22 @@
/* XPM */
static char * anchor_is_xpm[] = {
"16 16 3 1",
" c None",
". c #7F7F7F",
"+ c #FFFFFF",
" ",
" .. ",
" ...... ",
" ....+ ",
" ..+ ",
" ..+ ",
" ..+ ",
" ..+ ",
" .. ..+ .. ",
" .. ..+ ..+ ",
" ... ..+ ...+ ",
" ..........+ ",
" ........+ ",
" ++..+++ ",
" + ",
" "};

22
app/tools/delete.xpm Normal file
View File

@ -0,0 +1,22 @@
/* XPM */
static char * delete_xpm[] = {
"16 16 3 1",
" c None",
". c #000000",
"+ c #7F7F7F",
" ",
" ",
" .+ .+ ",
" ...+ ...+ ",
" ...+ ...+ ",
" ...+ ...+ ",
" ......+ ",
" ....+ ",
" ....+ ",
" ......+ ",
" ...++...+ ",
" ...+ ...+ ",
" ...+ ...+ ",
" .+ .+ ",
" ",
" "};

22
app/tools/delete_is.xpm Normal file
View File

@ -0,0 +1,22 @@
/* XPM */
static char * delete_is_xpm[] = {
"16 16 3 1",
" c None",
". c #7F7F7F",
"+ c #FFFFFF",
" ",
" ",
" .+ .+ ",
" ...+ ...+ ",
" ...+ ...+ ",
" ...+ ...+ ",
" ......+ ",
" ....+ ",
" ....+ ",
" ......+ ",
" ...++...+ ",
" ...+ ...+ ",
" ...+ ...+ ",
" .+ .+ ",
" ",
" "};

24
app/tools/duplicate.xpm Normal file
View File

@ -0,0 +1,24 @@
/* XPM */
static char * duplicate_xpm[] = {
"17 17 4 1",
" c None",
". c #000000",
"+ c #FFFFFF",
"@ c #7F7F7F",
" ...... ",
" ..++++. ",
" .+.++++.@ ",
" .++.++++.... ",
" .....++++.++.@ ",
" .++++++++.++.@ ",
" .++++++++.++.@ ",
" .++++++++.++.@ ",
" .++++++++.++.@ ",
" .++++++++.++.@ ",
" .++++++++.++.@ ",
" .++++++++.++.@ ",
" ..........++.@ ",
" @@.++++++++.@ ",
" .++++++++.@ ",
" ..........@ ",
" @@@@@@@@@@ "};

View File

@ -0,0 +1,23 @@
/* XPM */
static char * duplicate_is_xpm[] = {
"17 17 3 1",
" c None",
". c #7F7F7F",
"+ c #FFFFFF",
" ...... ",
" .. . ",
" . . .+ ",
" . . .... ",
" ..... . .+ ",
" . . .+ ",
" . . .+ ",
" . . .+ ",
" . . .+ ",
" . . .+ ",
" . . .+ ",
" . . .+ ",
" .......... .+ ",
" ++. .+ ",
" . .+ ",
" ..........+ ",
" ++++++++++ "};

24
app/tools/lower.xpm Normal file
View File

@ -0,0 +1,24 @@
/* XPM */
static char * lower_xpm[] = {
"22 18 3 1",
" c None",
". c #000000",
"+ c #7F7F7F",
" ",
" ",
" ",
" ",
" ",
" ",
" .............. ",
" ............+ ",
" ..........+ ",
" ........+ ",
" ......+ ",
" ....+ ",
" ..+ ",
" + ",
" ",
" ",
" ",
" "};

22
app/tools/lower_is.xpm Normal file
View File

@ -0,0 +1,22 @@
/* XPM */
static char * lower_is_xpm[] = {
"16 16 3 1",
" c None",
". c #7F7F7F",
"+ c #FFFFFF",
" ",
" ",
" ",
" ",
" ",
" ............ ",
" ..........+ ",
" ........+ ",
" ......+ ",
" ....+ ",
" ..+ ",
" + ",
" ",
" ",
" ",
" "};

23
app/tools/new.xpm Normal file
View File

@ -0,0 +1,23 @@
/* XPM */
static char * new_xpm[] = {
"16 16 4 1",
" c None",
". c #000000",
"+ c #FFFFFF",
"@ c #7F7F7F",
" ",
" ...... ",
" ..++++.@ ",
" .+.++++.@ ",
" .++.++++.@ ",
" .....++++.@ ",
" .++++++++.@ ",
" .++++++++.@ ",
" .++++++++.@ ",
" .++++++++.@ ",
" .++++++++.@ ",
" .++++++++.@ ",
" .++++++++.@ ",
" ..........@ ",
" @@@@@@@@@@ ",
" "};

22
app/tools/new_is.xpm Normal file
View File

@ -0,0 +1,22 @@
/* XPM */
static char * new_is_xpm[] = {
"16 16 3 1",
" c None",
". c #7F7F7F",
"+ c #F7F7F7",
" ",
" ...... ",
" .. .+ ",
" . . .+ ",
" . . .+ ",
" ..... .+ ",
" . .+ ",
" . .+ ",
" . .+ ",
" . .+ ",
" . .+ ",
" . .+ ",
" . .+ ",
" ..........+ ",
" ++++++++++ ",
" "};

22
app/tools/raise.xpm Normal file
View File

@ -0,0 +1,22 @@
/* XPM */
static char * raise_xpm[] = {
"16 16 3 1",
" c None",
". c #000000",
"+ c #7F7F7F",
" ",
" ",
" ",
" ",
" ",
" .. ",
" ....+ ",
" ......+ ",
" ........+ ",
" ..........+ ",
" ............+ ",
" ++++++++++++ ",
" ",
" ",
" ",
" "};

22
app/tools/raise_is.xpm Normal file
View File

@ -0,0 +1,22 @@
/* XPM */
static char * raise_is_xpm[] = {
"16 16 3 1",
" c None",
". c #7F7F7F",
"+ c #FFFFFF",
" ",
" ",
" ",
" ",
" ",
" .. ",
" ....+ ",
" ......+ ",
" ........+ ",
" ..........+ ",
" ............+ ",
" ++++++++++++ ",
" ",
" ",
" ",
" "};