libgimpwidgets/Makefile.am new widget derived from GtkButton. It adds an
2001-05-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/Makefile.am * libgimpwidgets/gimpbutton.[ch]: new widget derived from GtkButton. It adds an "extended_clicked" signal which is emitted instead of "clicked" if a modifier was pressed. * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimppixmap.[ch]: removed the opaque typedefs. * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetstypes.h: and added them here. Added GimpButton. * app/widgets/gimpdrawablelistview.c: use GimpButtons for "Raise" and "Lower" and raise/lower to top/bottom on shift-click.
This commit is contained in:

committed by
Michael Natterer

parent
5e2480d798
commit
10afaf8d1c
17
ChangeLog
17
ChangeLog
@ -1,3 +1,20 @@
|
||||
2001-05-06 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* libgimpwidgets/Makefile.am
|
||||
* libgimpwidgets/gimpbutton.[ch]: new widget derived from
|
||||
GtkButton. It adds an "extended_clicked" signal which is emitted
|
||||
instead of "clicked" if a modifier was pressed.
|
||||
|
||||
* libgimpwidgets/gimpchainbutton.[ch]
|
||||
* libgimpwidgets/gimppixmap.[ch]: removed the opaque typedefs.
|
||||
|
||||
* libgimpwidgets/gimpwidgets.h
|
||||
* libgimpwidgets/gimpwidgetstypes.h: and added them here. Added
|
||||
GimpButton.
|
||||
|
||||
* app/widgets/gimpdrawablelistview.c: use GimpButtons for "Raise"
|
||||
and "Lower" and raise/lower to top/bottom on shift-click.
|
||||
|
||||
2001-05-06 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/gimpimage.[ch]: renamed "restructure" to "alpha_changed" and
|
||||
|
@ -91,8 +91,16 @@ static void gimp_drawable_list_view_new_dropped (GtkWidget *w
|
||||
|
||||
static void gimp_drawable_list_view_raise_clicked (GtkWidget *widget,
|
||||
GimpDrawableListView *view);
|
||||
static void gimp_drawable_list_view_raise_extended_clicked
|
||||
(GtkWidget *widget,
|
||||
guint state,
|
||||
GimpDrawableListView *view);
|
||||
static void gimp_drawable_list_view_lower_clicked (GtkWidget *widget,
|
||||
GimpDrawableListView *view);
|
||||
static void gimp_drawable_list_view_lower_extended_clicked
|
||||
(GtkWidget *widget,
|
||||
guint state,
|
||||
GimpDrawableListView *view);
|
||||
|
||||
static void gimp_drawable_list_view_duplicate_drawable (GimpDrawableListView *view,
|
||||
GimpDrawable *drawable);
|
||||
@ -221,16 +229,20 @@ gimp_drawable_list_view_init (GimpDrawableListView *view)
|
||||
|
||||
/* raise */
|
||||
|
||||
view->raise_button = gtk_button_new ();
|
||||
view->raise_button = gimp_button_new ();
|
||||
gtk_box_pack_start (GTK_BOX (view->button_box), view->raise_button,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (view->raise_button);
|
||||
|
||||
gimp_help_set_help_data (view->raise_button, _("Raise"), NULL);
|
||||
gimp_help_set_help_data (view->raise_button, _("Raise \n"
|
||||
"<shift> To Top"), NULL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (view->raise_button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gimp_drawable_list_view_raise_clicked),
|
||||
view);
|
||||
gtk_signal_connect (GTK_OBJECT (view->raise_button), "extended_clicked",
|
||||
GTK_SIGNAL_FUNC (gimp_drawable_list_view_raise_extended_clicked),
|
||||
view);
|
||||
|
||||
pixmap = gimp_pixmap_new (raise_xpm);
|
||||
gtk_container_add (GTK_CONTAINER (view->raise_button), pixmap);
|
||||
@ -238,16 +250,20 @@ gimp_drawable_list_view_init (GimpDrawableListView *view)
|
||||
|
||||
/* lower */
|
||||
|
||||
view->lower_button = gtk_button_new ();
|
||||
view->lower_button = gimp_button_new ();
|
||||
gtk_box_pack_start (GTK_BOX (view->button_box), view->lower_button,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (view->lower_button);
|
||||
|
||||
gimp_help_set_help_data (view->lower_button, _("Lower"), NULL);
|
||||
gimp_help_set_help_data (view->lower_button, _("Lower \n"
|
||||
"<shift> To Bottom"), NULL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (view->lower_button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gimp_drawable_list_view_lower_clicked),
|
||||
view);
|
||||
gtk_signal_connect (GTK_OBJECT (view->lower_button), "extended_clicked",
|
||||
GTK_SIGNAL_FUNC (gimp_drawable_list_view_lower_extended_clicked),
|
||||
view);
|
||||
|
||||
pixmap = gimp_pixmap_new (lower_xpm);
|
||||
gtk_container_add (GTK_CONTAINER (view->lower_button), pixmap);
|
||||
@ -707,6 +723,28 @@ gimp_drawable_list_view_raise_clicked (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_list_view_raise_extended_clicked (GtkWidget *widget,
|
||||
guint state,
|
||||
GimpDrawableListView *view)
|
||||
{
|
||||
GimpContainer *container;
|
||||
GimpDrawable *drawable;
|
||||
gint index;
|
||||
|
||||
container = GIMP_CONTAINER_VIEW (view)->container;
|
||||
drawable = view->get_drawable_func (view->gimage);
|
||||
|
||||
index = gimp_container_get_child_index (container, GIMP_OBJECT (drawable));
|
||||
|
||||
if ((state & GDK_SHIFT_MASK) && (index > 0))
|
||||
{
|
||||
view->reorder_drawable_func (view->gimage, drawable, 0, TRUE);
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_list_view_lower_clicked (GtkWidget *widget,
|
||||
GimpDrawableListView *view)
|
||||
@ -728,6 +766,29 @@ gimp_drawable_list_view_lower_clicked (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_list_view_lower_extended_clicked (GtkWidget *widget,
|
||||
guint state,
|
||||
GimpDrawableListView *view)
|
||||
{
|
||||
GimpContainer *container;
|
||||
GimpDrawable *drawable;
|
||||
gint index;
|
||||
|
||||
container = GIMP_CONTAINER_VIEW (view)->container;
|
||||
drawable = view->get_drawable_func (view->gimage);
|
||||
|
||||
index = gimp_container_get_child_index (container, GIMP_OBJECT (drawable));
|
||||
|
||||
if ((state & GDK_SHIFT_MASK) && (index < container->num_children - 1))
|
||||
{
|
||||
view->reorder_drawable_func (view->gimage, drawable,
|
||||
container->num_children - 1, TRUE);
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* "Edit" functions */
|
||||
|
||||
|
@ -91,8 +91,16 @@ static void gimp_drawable_list_view_new_dropped (GtkWidget *w
|
||||
|
||||
static void gimp_drawable_list_view_raise_clicked (GtkWidget *widget,
|
||||
GimpDrawableListView *view);
|
||||
static void gimp_drawable_list_view_raise_extended_clicked
|
||||
(GtkWidget *widget,
|
||||
guint state,
|
||||
GimpDrawableListView *view);
|
||||
static void gimp_drawable_list_view_lower_clicked (GtkWidget *widget,
|
||||
GimpDrawableListView *view);
|
||||
static void gimp_drawable_list_view_lower_extended_clicked
|
||||
(GtkWidget *widget,
|
||||
guint state,
|
||||
GimpDrawableListView *view);
|
||||
|
||||
static void gimp_drawable_list_view_duplicate_drawable (GimpDrawableListView *view,
|
||||
GimpDrawable *drawable);
|
||||
@ -221,16 +229,20 @@ gimp_drawable_list_view_init (GimpDrawableListView *view)
|
||||
|
||||
/* raise */
|
||||
|
||||
view->raise_button = gtk_button_new ();
|
||||
view->raise_button = gimp_button_new ();
|
||||
gtk_box_pack_start (GTK_BOX (view->button_box), view->raise_button,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (view->raise_button);
|
||||
|
||||
gimp_help_set_help_data (view->raise_button, _("Raise"), NULL);
|
||||
gimp_help_set_help_data (view->raise_button, _("Raise \n"
|
||||
"<shift> To Top"), NULL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (view->raise_button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gimp_drawable_list_view_raise_clicked),
|
||||
view);
|
||||
gtk_signal_connect (GTK_OBJECT (view->raise_button), "extended_clicked",
|
||||
GTK_SIGNAL_FUNC (gimp_drawable_list_view_raise_extended_clicked),
|
||||
view);
|
||||
|
||||
pixmap = gimp_pixmap_new (raise_xpm);
|
||||
gtk_container_add (GTK_CONTAINER (view->raise_button), pixmap);
|
||||
@ -238,16 +250,20 @@ gimp_drawable_list_view_init (GimpDrawableListView *view)
|
||||
|
||||
/* lower */
|
||||
|
||||
view->lower_button = gtk_button_new ();
|
||||
view->lower_button = gimp_button_new ();
|
||||
gtk_box_pack_start (GTK_BOX (view->button_box), view->lower_button,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (view->lower_button);
|
||||
|
||||
gimp_help_set_help_data (view->lower_button, _("Lower"), NULL);
|
||||
gimp_help_set_help_data (view->lower_button, _("Lower \n"
|
||||
"<shift> To Bottom"), NULL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (view->lower_button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gimp_drawable_list_view_lower_clicked),
|
||||
view);
|
||||
gtk_signal_connect (GTK_OBJECT (view->lower_button), "extended_clicked",
|
||||
GTK_SIGNAL_FUNC (gimp_drawable_list_view_lower_extended_clicked),
|
||||
view);
|
||||
|
||||
pixmap = gimp_pixmap_new (lower_xpm);
|
||||
gtk_container_add (GTK_CONTAINER (view->lower_button), pixmap);
|
||||
@ -707,6 +723,28 @@ gimp_drawable_list_view_raise_clicked (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_list_view_raise_extended_clicked (GtkWidget *widget,
|
||||
guint state,
|
||||
GimpDrawableListView *view)
|
||||
{
|
||||
GimpContainer *container;
|
||||
GimpDrawable *drawable;
|
||||
gint index;
|
||||
|
||||
container = GIMP_CONTAINER_VIEW (view)->container;
|
||||
drawable = view->get_drawable_func (view->gimage);
|
||||
|
||||
index = gimp_container_get_child_index (container, GIMP_OBJECT (drawable));
|
||||
|
||||
if ((state & GDK_SHIFT_MASK) && (index > 0))
|
||||
{
|
||||
view->reorder_drawable_func (view->gimage, drawable, 0, TRUE);
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_list_view_lower_clicked (GtkWidget *widget,
|
||||
GimpDrawableListView *view)
|
||||
@ -728,6 +766,29 @@ gimp_drawable_list_view_lower_clicked (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_list_view_lower_extended_clicked (GtkWidget *widget,
|
||||
guint state,
|
||||
GimpDrawableListView *view)
|
||||
{
|
||||
GimpContainer *container;
|
||||
GimpDrawable *drawable;
|
||||
gint index;
|
||||
|
||||
container = GIMP_CONTAINER_VIEW (view)->container;
|
||||
drawable = view->get_drawable_func (view->gimage);
|
||||
|
||||
index = gimp_container_get_child_index (container, GIMP_OBJECT (drawable));
|
||||
|
||||
if ((state & GDK_SHIFT_MASK) && (index < container->num_children - 1))
|
||||
{
|
||||
view->reorder_drawable_func (view->gimage, drawable,
|
||||
container->num_children - 1, TRUE);
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* "Edit" functions */
|
||||
|
||||
|
@ -91,8 +91,16 @@ static void gimp_drawable_list_view_new_dropped (GtkWidget *w
|
||||
|
||||
static void gimp_drawable_list_view_raise_clicked (GtkWidget *widget,
|
||||
GimpDrawableListView *view);
|
||||
static void gimp_drawable_list_view_raise_extended_clicked
|
||||
(GtkWidget *widget,
|
||||
guint state,
|
||||
GimpDrawableListView *view);
|
||||
static void gimp_drawable_list_view_lower_clicked (GtkWidget *widget,
|
||||
GimpDrawableListView *view);
|
||||
static void gimp_drawable_list_view_lower_extended_clicked
|
||||
(GtkWidget *widget,
|
||||
guint state,
|
||||
GimpDrawableListView *view);
|
||||
|
||||
static void gimp_drawable_list_view_duplicate_drawable (GimpDrawableListView *view,
|
||||
GimpDrawable *drawable);
|
||||
@ -221,16 +229,20 @@ gimp_drawable_list_view_init (GimpDrawableListView *view)
|
||||
|
||||
/* raise */
|
||||
|
||||
view->raise_button = gtk_button_new ();
|
||||
view->raise_button = gimp_button_new ();
|
||||
gtk_box_pack_start (GTK_BOX (view->button_box), view->raise_button,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (view->raise_button);
|
||||
|
||||
gimp_help_set_help_data (view->raise_button, _("Raise"), NULL);
|
||||
gimp_help_set_help_data (view->raise_button, _("Raise \n"
|
||||
"<shift> To Top"), NULL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (view->raise_button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gimp_drawable_list_view_raise_clicked),
|
||||
view);
|
||||
gtk_signal_connect (GTK_OBJECT (view->raise_button), "extended_clicked",
|
||||
GTK_SIGNAL_FUNC (gimp_drawable_list_view_raise_extended_clicked),
|
||||
view);
|
||||
|
||||
pixmap = gimp_pixmap_new (raise_xpm);
|
||||
gtk_container_add (GTK_CONTAINER (view->raise_button), pixmap);
|
||||
@ -238,16 +250,20 @@ gimp_drawable_list_view_init (GimpDrawableListView *view)
|
||||
|
||||
/* lower */
|
||||
|
||||
view->lower_button = gtk_button_new ();
|
||||
view->lower_button = gimp_button_new ();
|
||||
gtk_box_pack_start (GTK_BOX (view->button_box), view->lower_button,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (view->lower_button);
|
||||
|
||||
gimp_help_set_help_data (view->lower_button, _("Lower"), NULL);
|
||||
gimp_help_set_help_data (view->lower_button, _("Lower \n"
|
||||
"<shift> To Bottom"), NULL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (view->lower_button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gimp_drawable_list_view_lower_clicked),
|
||||
view);
|
||||
gtk_signal_connect (GTK_OBJECT (view->lower_button), "extended_clicked",
|
||||
GTK_SIGNAL_FUNC (gimp_drawable_list_view_lower_extended_clicked),
|
||||
view);
|
||||
|
||||
pixmap = gimp_pixmap_new (lower_xpm);
|
||||
gtk_container_add (GTK_CONTAINER (view->lower_button), pixmap);
|
||||
@ -707,6 +723,28 @@ gimp_drawable_list_view_raise_clicked (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_list_view_raise_extended_clicked (GtkWidget *widget,
|
||||
guint state,
|
||||
GimpDrawableListView *view)
|
||||
{
|
||||
GimpContainer *container;
|
||||
GimpDrawable *drawable;
|
||||
gint index;
|
||||
|
||||
container = GIMP_CONTAINER_VIEW (view)->container;
|
||||
drawable = view->get_drawable_func (view->gimage);
|
||||
|
||||
index = gimp_container_get_child_index (container, GIMP_OBJECT (drawable));
|
||||
|
||||
if ((state & GDK_SHIFT_MASK) && (index > 0))
|
||||
{
|
||||
view->reorder_drawable_func (view->gimage, drawable, 0, TRUE);
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_list_view_lower_clicked (GtkWidget *widget,
|
||||
GimpDrawableListView *view)
|
||||
@ -728,6 +766,29 @@ gimp_drawable_list_view_lower_clicked (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_list_view_lower_extended_clicked (GtkWidget *widget,
|
||||
guint state,
|
||||
GimpDrawableListView *view)
|
||||
{
|
||||
GimpContainer *container;
|
||||
GimpDrawable *drawable;
|
||||
gint index;
|
||||
|
||||
container = GIMP_CONTAINER_VIEW (view)->container;
|
||||
drawable = view->get_drawable_func (view->gimage);
|
||||
|
||||
index = gimp_container_get_child_index (container, GIMP_OBJECT (drawable));
|
||||
|
||||
if ((state & GDK_SHIFT_MASK) && (index < container->num_children - 1))
|
||||
{
|
||||
view->reorder_drawable_func (view->gimage, drawable,
|
||||
container->num_children - 1, TRUE);
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* "Edit" functions */
|
||||
|
||||
|
@ -91,8 +91,16 @@ static void gimp_drawable_list_view_new_dropped (GtkWidget *w
|
||||
|
||||
static void gimp_drawable_list_view_raise_clicked (GtkWidget *widget,
|
||||
GimpDrawableListView *view);
|
||||
static void gimp_drawable_list_view_raise_extended_clicked
|
||||
(GtkWidget *widget,
|
||||
guint state,
|
||||
GimpDrawableListView *view);
|
||||
static void gimp_drawable_list_view_lower_clicked (GtkWidget *widget,
|
||||
GimpDrawableListView *view);
|
||||
static void gimp_drawable_list_view_lower_extended_clicked
|
||||
(GtkWidget *widget,
|
||||
guint state,
|
||||
GimpDrawableListView *view);
|
||||
|
||||
static void gimp_drawable_list_view_duplicate_drawable (GimpDrawableListView *view,
|
||||
GimpDrawable *drawable);
|
||||
@ -221,16 +229,20 @@ gimp_drawable_list_view_init (GimpDrawableListView *view)
|
||||
|
||||
/* raise */
|
||||
|
||||
view->raise_button = gtk_button_new ();
|
||||
view->raise_button = gimp_button_new ();
|
||||
gtk_box_pack_start (GTK_BOX (view->button_box), view->raise_button,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (view->raise_button);
|
||||
|
||||
gimp_help_set_help_data (view->raise_button, _("Raise"), NULL);
|
||||
gimp_help_set_help_data (view->raise_button, _("Raise \n"
|
||||
"<shift> To Top"), NULL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (view->raise_button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gimp_drawable_list_view_raise_clicked),
|
||||
view);
|
||||
gtk_signal_connect (GTK_OBJECT (view->raise_button), "extended_clicked",
|
||||
GTK_SIGNAL_FUNC (gimp_drawable_list_view_raise_extended_clicked),
|
||||
view);
|
||||
|
||||
pixmap = gimp_pixmap_new (raise_xpm);
|
||||
gtk_container_add (GTK_CONTAINER (view->raise_button), pixmap);
|
||||
@ -238,16 +250,20 @@ gimp_drawable_list_view_init (GimpDrawableListView *view)
|
||||
|
||||
/* lower */
|
||||
|
||||
view->lower_button = gtk_button_new ();
|
||||
view->lower_button = gimp_button_new ();
|
||||
gtk_box_pack_start (GTK_BOX (view->button_box), view->lower_button,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (view->lower_button);
|
||||
|
||||
gimp_help_set_help_data (view->lower_button, _("Lower"), NULL);
|
||||
gimp_help_set_help_data (view->lower_button, _("Lower \n"
|
||||
"<shift> To Bottom"), NULL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (view->lower_button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gimp_drawable_list_view_lower_clicked),
|
||||
view);
|
||||
gtk_signal_connect (GTK_OBJECT (view->lower_button), "extended_clicked",
|
||||
GTK_SIGNAL_FUNC (gimp_drawable_list_view_lower_extended_clicked),
|
||||
view);
|
||||
|
||||
pixmap = gimp_pixmap_new (lower_xpm);
|
||||
gtk_container_add (GTK_CONTAINER (view->lower_button), pixmap);
|
||||
@ -707,6 +723,28 @@ gimp_drawable_list_view_raise_clicked (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_list_view_raise_extended_clicked (GtkWidget *widget,
|
||||
guint state,
|
||||
GimpDrawableListView *view)
|
||||
{
|
||||
GimpContainer *container;
|
||||
GimpDrawable *drawable;
|
||||
gint index;
|
||||
|
||||
container = GIMP_CONTAINER_VIEW (view)->container;
|
||||
drawable = view->get_drawable_func (view->gimage);
|
||||
|
||||
index = gimp_container_get_child_index (container, GIMP_OBJECT (drawable));
|
||||
|
||||
if ((state & GDK_SHIFT_MASK) && (index > 0))
|
||||
{
|
||||
view->reorder_drawable_func (view->gimage, drawable, 0, TRUE);
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_list_view_lower_clicked (GtkWidget *widget,
|
||||
GimpDrawableListView *view)
|
||||
@ -728,6 +766,29 @@ gimp_drawable_list_view_lower_clicked (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_list_view_lower_extended_clicked (GtkWidget *widget,
|
||||
guint state,
|
||||
GimpDrawableListView *view)
|
||||
{
|
||||
GimpContainer *container;
|
||||
GimpDrawable *drawable;
|
||||
gint index;
|
||||
|
||||
container = GIMP_CONTAINER_VIEW (view)->container;
|
||||
drawable = view->get_drawable_func (view->gimage);
|
||||
|
||||
index = gimp_container_get_child_index (container, GIMP_OBJECT (drawable));
|
||||
|
||||
if ((state & GDK_SHIFT_MASK) && (index < container->num_children - 1))
|
||||
{
|
||||
view->reorder_drawable_func (view->gimage, drawable,
|
||||
container->num_children - 1, TRUE);
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* "Edit" functions */
|
||||
|
||||
|
@ -28,6 +28,8 @@ libgimpwidgets_1_3_la_SOURCES = \
|
||||
gimpwidgets.c \
|
||||
gimpwidgets.h \
|
||||
gimpwidgetstypes.h \
|
||||
gimpbutton.c \
|
||||
gimpbutton.h \
|
||||
gimpchainbutton.c \
|
||||
gimpchainbutton.h \
|
||||
gimpcolorarea.c \
|
||||
|
191
libgimpwidgets/gimpbutton.c
Normal file
191
libgimpwidgets/gimpbutton.c
Normal file
@ -0,0 +1,191 @@
|
||||
/* LIBGIMP - The GIMP Library
|
||||
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
||||
*
|
||||
* gimpbutton.c
|
||||
* Copyright (C) 2000 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; 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 "gimpwidgetstypes.h"
|
||||
|
||||
#include "gimpbutton.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
EXTENDED_CLICKED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
|
||||
static void gimp_button_class_init (GimpButtonClass *klass);
|
||||
static void gimp_button_init (GimpButton *button);
|
||||
|
||||
static gboolean gimp_button_button_press (GtkWidget *widget,
|
||||
GdkEventButton *event);
|
||||
static gboolean gimp_button_button_release (GtkWidget *widget,
|
||||
GdkEventButton *event);
|
||||
|
||||
|
||||
static guint button_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
static GtkButtonClass *parent_class = NULL;
|
||||
|
||||
|
||||
GtkType
|
||||
gimp_button_get_type (void)
|
||||
{
|
||||
static guint button_type = 0;
|
||||
|
||||
if (!button_type)
|
||||
{
|
||||
GtkTypeInfo button_info =
|
||||
{
|
||||
"GimpButton",
|
||||
sizeof (GimpButton),
|
||||
sizeof (GimpButtonClass),
|
||||
(GtkClassInitFunc) gimp_button_class_init,
|
||||
(GtkObjectInitFunc) gimp_button_init,
|
||||
/* reserved_1 */ NULL,
|
||||
/* reserved_2 */ NULL,
|
||||
(GtkClassInitFunc) NULL
|
||||
};
|
||||
|
||||
button_type = gtk_type_unique (GTK_TYPE_BUTTON, &button_info);
|
||||
}
|
||||
|
||||
return button_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_button_class_init (GimpButtonClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
widget_class = (GtkWidgetClass *) klass;
|
||||
|
||||
parent_class = gtk_type_class (GTK_TYPE_BUTTON);
|
||||
|
||||
button_signals[EXTENDED_CLICKED] =
|
||||
gtk_signal_new ("extended_clicked",
|
||||
GTK_RUN_FIRST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GimpButtonClass,
|
||||
extended_clicked),
|
||||
gtk_marshal_NONE__UINT,
|
||||
GTK_TYPE_NONE, 1,
|
||||
GTK_TYPE_UINT);
|
||||
|
||||
gtk_object_class_add_signals (object_class, button_signals, LAST_SIGNAL);
|
||||
|
||||
widget_class->button_press_event = gimp_button_button_press;
|
||||
widget_class->button_release_event = gimp_button_button_release;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_button_init (GimpButton *button)
|
||||
{
|
||||
button->press_state = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_button_new:
|
||||
*
|
||||
* Creates a new #GimpButton widget.
|
||||
*
|
||||
* Returns: A pointer to the new #GimpButton widget.
|
||||
**/
|
||||
GtkWidget *
|
||||
gimp_button_new (void)
|
||||
{
|
||||
GimpButton *button;
|
||||
|
||||
button = gtk_type_new (GIMP_TYPE_BUTTON);
|
||||
|
||||
return GTK_WIDGET (button);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_button_button_press (GtkWidget *widget,
|
||||
GdkEventButton *bevent)
|
||||
{
|
||||
g_return_val_if_fail (widget != NULL, FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_BUTTON (widget), FALSE);
|
||||
g_return_val_if_fail (bevent != NULL, FALSE);
|
||||
|
||||
if (bevent->type == GDK_BUTTON_PRESS && bevent->button == 1)
|
||||
{
|
||||
GimpButton *button;
|
||||
|
||||
button = GIMP_BUTTON (widget);
|
||||
|
||||
button->press_state = bevent->state;
|
||||
}
|
||||
|
||||
if (GTK_WIDGET_CLASS (parent_class)->button_press_event)
|
||||
GTK_WIDGET_CLASS (parent_class)->button_press_event (widget, bevent);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gint
|
||||
gimp_button_button_release (GtkWidget *widget,
|
||||
GdkEventButton *bevent)
|
||||
{
|
||||
gboolean in_button = FALSE;
|
||||
|
||||
g_return_val_if_fail (widget != NULL, FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_BUTTON (widget), FALSE);
|
||||
g_return_val_if_fail (bevent != NULL, FALSE);
|
||||
|
||||
if (bevent->button == 1)
|
||||
{
|
||||
GtkButton *button;
|
||||
|
||||
button = GTK_BUTTON (widget);
|
||||
|
||||
in_button = button->in_button;
|
||||
|
||||
if (in_button &&
|
||||
(GIMP_BUTTON (button)->press_state &
|
||||
(GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK)))
|
||||
{
|
||||
gtk_signal_emit (GTK_OBJECT (widget),
|
||||
button_signals[EXTENDED_CLICKED],
|
||||
GIMP_BUTTON (button)->press_state);
|
||||
|
||||
button->in_button = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (GTK_WIDGET_CLASS (parent_class)->button_release_event)
|
||||
GTK_WIDGET_CLASS (parent_class)->button_release_event (widget, bevent);
|
||||
|
||||
if (bevent->button == 1 && in_button)
|
||||
{
|
||||
gtk_widget_set_state (widget, GTK_STATE_PRELIGHT);
|
||||
gtk_widget_draw (widget, NULL);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
66
libgimpwidgets/gimpbutton.h
Normal file
66
libgimpwidgets/gimpbutton.h
Normal file
@ -0,0 +1,66 @@
|
||||
/* LIBGIMP - The GIMP Library
|
||||
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
||||
*
|
||||
* gimpbutton.h
|
||||
* Copyright (C) 2001 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_BUTTON_H__
|
||||
#define __GIMP_BUTTON_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* For information look into the C source or the html documentation */
|
||||
|
||||
|
||||
#define GIMP_TYPE_BUTTON (gimp_button_get_type ())
|
||||
#define GIMP_BUTTON(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BUTTON, GimpButton))
|
||||
#define GIMP_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_BUTTON, GimpButtonClass))
|
||||
#define GIMP_IS_BUTTON(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BUTTON))
|
||||
#define GIMP_IS_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BUTTON))
|
||||
|
||||
|
||||
typedef struct _GimpButtonClass GimpButtonClass;
|
||||
|
||||
struct _GimpButton
|
||||
{
|
||||
GtkButton parent_instance;
|
||||
|
||||
/*< private >*/
|
||||
guint press_state;
|
||||
};
|
||||
|
||||
struct _GimpButtonClass
|
||||
{
|
||||
GtkButtonClass parent_class;
|
||||
|
||||
void (* extended_clicked) (GimpButton *preview,
|
||||
guint modifier_state);
|
||||
};
|
||||
|
||||
GtkType gimp_button_get_type (void);
|
||||
GtkWidget * gimp_button_new (void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __GIMP_BUTTON_H__ */
|
@ -22,6 +22,8 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gimpwidgetstypes.h"
|
||||
|
||||
#include "gimpchainbutton.h"
|
||||
|
||||
#include "pixmaps/chain.xpm"
|
||||
|
@ -42,7 +42,7 @@ extern "C" {
|
||||
#define GIMP_IS_CHAIN_BUTTON(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_CHAIN_BUTTON))
|
||||
#define GIMP_IS_CHAIN_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CHAIN_BUTTON))
|
||||
|
||||
typedef struct _GimpChainButton GimpChainButton;
|
||||
|
||||
typedef struct _GimpChainButtonClass GimpChainButtonClass;
|
||||
|
||||
typedef enum
|
||||
|
@ -24,6 +24,8 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gimpwidgetstypes.h"
|
||||
|
||||
#include "gimppixmap.h"
|
||||
|
||||
|
||||
|
@ -36,7 +36,7 @@ extern "C" {
|
||||
#define GIMP_IS_PIXMAP(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_PIXMAP))
|
||||
#define GIMP_IS_PIXMAP_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PIXMAP))
|
||||
|
||||
typedef struct _GimpPixmap GimpPixmap;
|
||||
|
||||
typedef struct _GimpPixmapClass GimpPixmapClass;
|
||||
|
||||
struct _GimpPixmap
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include <libgimpwidgets/gimpwidgetstypes.h>
|
||||
|
||||
#include <libgimpwidgets/gimpbutton.h>
|
||||
#include <libgimpwidgets/gimpchainbutton.h>
|
||||
#include <libgimpwidgets/gimpcolorarea.h>
|
||||
#include <libgimpwidgets/gimpcolorbutton.h>
|
||||
|
@ -44,9 +44,12 @@ typedef enum
|
||||
} GimpSizeEntryUpdatePolicy;
|
||||
|
||||
|
||||
typedef struct _GimpButton GimpButton;
|
||||
typedef struct _GimpChainButton GimpChainButton;
|
||||
typedef struct _GimpColorArea GimpColorArea;
|
||||
typedef struct _GimpColorButton GimpColorButton;
|
||||
typedef struct _GimpPathEditor GimpPathEditor;
|
||||
typedef struct _GimpPixmap GimpPixmap;
|
||||
typedef struct _GimpSizeEntry GimpSizeEntry;
|
||||
typedef struct _GimpUnitMenu GimpUnitMenu;
|
||||
|
||||
|
Reference in New Issue
Block a user