2000-02-26 11:41:06 +08:00
|
|
|
/* LIBGIMP - The GIMP Library
|
2000-11-18 08:25:42 +08:00
|
|
|
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
2000-01-13 23:39:26 +08:00
|
|
|
*
|
|
|
|
* gimpwidgets.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
|
2000-02-26 11:41:06 +08: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
|
2000-01-13 23:39:26 +08:00
|
|
|
* Library 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.
|
|
|
|
*/
|
|
|
|
|
2000-01-27 09:54:52 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
2000-05-31 07:38:46 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2002-10-31 00:10:18 +08:00
|
|
|
#include "libgimpcolor/gimpcolor.h"
|
2001-01-24 07:56:18 +08:00
|
|
|
#include "libgimpmath/gimpmath.h"
|
2001-05-21 21:58:46 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
2001-01-24 07:56:18 +08:00
|
|
|
|
2001-01-25 06:36:18 +08:00
|
|
|
#include "gimpwidgetstypes.h"
|
2000-12-29 23:22:01 +08:00
|
|
|
|
2000-02-01 04:47:44 +08:00
|
|
|
#include "gimpchainbutton.h"
|
2004-07-13 23:59:52 +08:00
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
#include "gimpsizeentry.h"
|
2000-01-14 20:41:00 +08:00
|
|
|
#include "gimpunitmenu.h"
|
2004-07-13 23:59:52 +08:00
|
|
|
|
|
|
|
#undef GIMP_DISABLE_DEPRECATED
|
|
|
|
#include "gimppixmap.h"
|
2000-01-13 23:39:26 +08:00
|
|
|
#include "gimpwidgets.h"
|
2001-11-28 09:14:06 +08:00
|
|
|
|
2001-01-25 06:36:18 +08:00
|
|
|
#include "libgimp/libgimp-intl.h"
|
2000-01-26 01:46:56 +08:00
|
|
|
|
2000-05-31 07:38:46 +08:00
|
|
|
|
2000-02-19 03:59:02 +08:00
|
|
|
/**
|
|
|
|
* gimp_radio_group_new:
|
2003-02-07 05:17:12 +08:00
|
|
|
* @in_frame: %TRUE if you want a #GtkFrame around the radio button group.
|
|
|
|
* @frame_title: The title of the Frame or %NULL if you don't want a title.
|
|
|
|
* @...: A %NULL-terminated @va_list describing the radio buttons.
|
2000-02-19 03:59:02 +08:00
|
|
|
*
|
2003-01-05 23:41:23 +08:00
|
|
|
* Convenience function to create a group of radio buttons embedded into
|
|
|
|
* a #GtkFrame or #GtkVbox.
|
|
|
|
*
|
2000-02-23 23:52:33 +08:00
|
|
|
* Returns: A #GtkFrame or #GtkVbox (depending on @in_frame).
|
2000-11-18 08:25:42 +08:00
|
|
|
**/
|
2000-01-13 23:39:26 +08:00
|
|
|
GtkWidget *
|
|
|
|
gimp_radio_group_new (gboolean in_frame,
|
2000-11-18 08:25:42 +08:00
|
|
|
const gchar *frame_title,
|
2000-01-13 23:39:26 +08:00
|
|
|
|
|
|
|
/* specify radio buttons as va_list:
|
2000-11-18 08:25:42 +08:00
|
|
|
* const gchar *label,
|
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-25 05:27:11 +08:00
|
|
|
* GCallback callback,
|
|
|
|
* gpointer callback_data,
|
2001-11-22 21:01:26 +08:00
|
|
|
* gpointer item_data,
|
2000-01-13 23:39:26 +08:00
|
|
|
* GtkWidget **widget_ptr,
|
|
|
|
* gboolean active,
|
|
|
|
*/
|
|
|
|
|
|
|
|
...)
|
|
|
|
{
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *button;
|
|
|
|
GSList *group;
|
|
|
|
|
|
|
|
/* radio button variables */
|
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-25 05:27:11 +08:00
|
|
|
const gchar *label;
|
|
|
|
GCallback callback;
|
|
|
|
gpointer callback_data;
|
2001-11-22 21:01:26 +08:00
|
|
|
gpointer item_data;
|
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-25 05:27:11 +08:00
|
|
|
GtkWidget **widget_ptr;
|
|
|
|
gboolean active;
|
2000-01-13 23:39:26 +08:00
|
|
|
|
|
|
|
va_list args;
|
|
|
|
|
2004-05-19 01:06:06 +08:00
|
|
|
vbox = gtk_vbox_new (FALSE, 2);
|
2000-01-13 23:39:26 +08:00
|
|
|
|
|
|
|
group = NULL;
|
|
|
|
|
|
|
|
/* create the radio buttons */
|
|
|
|
va_start (args, frame_title);
|
2000-11-18 08:25:42 +08:00
|
|
|
label = va_arg (args, const gchar *);
|
2000-01-13 23:39:26 +08:00
|
|
|
while (label)
|
|
|
|
{
|
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-25 05:27:11 +08:00
|
|
|
callback = va_arg (args, GCallback);
|
|
|
|
callback_data = va_arg (args, gpointer);
|
2001-11-22 21:01:26 +08:00
|
|
|
item_data = va_arg (args, gpointer);
|
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-25 05:27:11 +08:00
|
|
|
widget_ptr = va_arg (args, GtkWidget **);
|
|
|
|
active = va_arg (args, gboolean);
|
2000-01-13 23:39:26 +08:00
|
|
|
|
2000-01-26 01:46:56 +08:00
|
|
|
if (label != (gpointer) 1)
|
|
|
|
button = gtk_radio_button_new_with_label (group, label);
|
|
|
|
else
|
|
|
|
button = gtk_radio_button_new (group);
|
|
|
|
|
2001-08-01 08:35:59 +08:00
|
|
|
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
|
2000-01-13 23:39:26 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
|
|
|
|
2001-11-22 21:01:26 +08:00
|
|
|
if (item_data)
|
|
|
|
{
|
|
|
|
g_object_set_data (G_OBJECT (button), "gimp-item-data", item_data);
|
|
|
|
|
|
|
|
/* backward compatibility */
|
|
|
|
g_object_set_data (G_OBJECT (button), "user_data", item_data);
|
|
|
|
}
|
2000-01-13 23:39:26 +08:00
|
|
|
|
|
|
|
if (widget_ptr)
|
|
|
|
*widget_ptr = button;
|
|
|
|
|
|
|
|
if (active)
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (button, "toggled",
|
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-25 05:27:11 +08:00
|
|
|
callback,
|
|
|
|
callback_data);
|
2000-01-15 23:32:28 +08:00
|
|
|
|
2000-01-13 23:39:26 +08:00
|
|
|
gtk_widget_show (button);
|
|
|
|
|
2000-11-18 08:25:42 +08:00
|
|
|
label = va_arg (args, const gchar *);
|
2000-01-13 23:39:26 +08:00
|
|
|
}
|
|
|
|
va_end (args);
|
|
|
|
|
|
|
|
if (in_frame)
|
2000-02-14 06:26:41 +08:00
|
|
|
{
|
|
|
|
GtkWidget *frame;
|
|
|
|
|
2000-04-01 02:10:25 +08:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
|
|
|
|
2004-05-03 08:10:24 +08:00
|
|
|
frame = gimp_frame_new (frame_title);
|
2000-02-14 06:26:41 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
|
|
|
return frame;
|
|
|
|
}
|
2000-01-13 23:39:26 +08:00
|
|
|
|
|
|
|
return vbox;
|
|
|
|
}
|
|
|
|
|
2000-02-19 03:59:02 +08:00
|
|
|
/**
|
|
|
|
* gimp_radio_group_new2:
|
2003-02-07 05:17:12 +08:00
|
|
|
* @in_frame: %TRUE if you want a #GtkFrame around the
|
2000-11-28 01:09:53 +08:00
|
|
|
* radio button group.
|
2003-02-07 05:17:12 +08:00
|
|
|
* @frame_title: The title of the Frame or %NULL if you don't want
|
2000-11-28 01:09:53 +08:00
|
|
|
* a title.
|
2000-02-23 23:52:33 +08:00
|
|
|
* @radio_button_callback: The callback each button's "toggled" signal will
|
|
|
|
* be connected with.
|
GimpViewableDialogs everywhere, cleanup:
2002-09-01 Michael Natterer <mitch@gimp.org>
GimpViewableDialogs everywhere, cleanup:
* libgimpwidgets/gimpstock.c: added texts for the RESIZE, SCALE
and CROP stock items.
* app/widgets/gimpviewabledialog.c: update the title when the
viewable's name changes.
* app/gui/color-notebook.[ch]: added color_notebook_viewable_new()
which creates a GimpViewableDialog.
* app/widgets/gimpgradienteditor.[ch]
* app/gui/colormap-editor-commands.c
* app/gui/file-new-dialog.c
* app/gui/gradient-editor-commands.c
* app/gui/palette-editor-commands.c
* app/undo_history.c: use GimpViewableDialogs and the new
color_notebook constructor.
* app/gui/convert-dialog.c: #include "widgets/gimpviewabledialog.h"
* app/gui/image-commands.c
* app/gui/info-dialog.c
* app/gui/resize-dialog.c: minor cleanups.
* app/gui/info-window.c: cleaned up the whole thing, esp. the
"Extended" page. Added HSV color display to the color picker
frame. Set the icons as frame titles, stuff...
* app/tools/gimpimagemaptool.[ch]: removed "shell_title",
"shell_name" and "stock_id" from the GimpImageMapTool struct
because they can be obtained from the tool's GimpToolInfo object.
* app/tools/gimpbrightnesscontrasttool.c
* app/tools/gimpcolorbalancetool.c
* app/tools/gimpcurvestool.c
* app/tools/gimphuesaturationtool.c
* app/tools/gimplevelstool.c
* app/tools/gimpposterizetool.c
* app/tools/gimpthresholdtool.c: changed accordingly.
* app/tools/gimphistogramtool.c: same here: take values from
tool->tool_info instead of hardcoding them.
* app/tools/gimpcroptool.[ch]: removed the static crop dialog
variables and added them to the GimpCropTool struct. Feels safer
and makes the callback code much simpler. Use stock items for the
dialog's "Resize" and "Crop" buttons.
* app/tools/gimpmeasuretool.c
* app/tools/gimprotatetool.c: for consistency don't name the tools
"Blah Tool", also the dialog titles need to match the menu
entries.
Unrelated:
* libgimpwidgets/gimpwidgets.c: the recently changed, gtk-doc
comment was correct, as gtk-doc takes the parameter names from
the header, not the .c file.
* app/tools/gimptransformtool.c: set the transform tool's state to
TRANSFORM_CREATING after changing displays, so the initial matrix
components are saved correctly for the "Reset" function.
2002-09-01 16:44:57 +08:00
|
|
|
* @radio_button_callback_data:
|
|
|
|
* The data which will be passed to g_signal_connect().
|
2001-11-22 21:01:26 +08:00
|
|
|
* @initial: The @item_data of the initially pressed radio button.
|
2003-02-07 05:17:12 +08:00
|
|
|
* @...: A %NULL-terminated @va_list describing
|
2000-11-28 01:09:53 +08:00
|
|
|
* the radio buttons.
|
2000-02-19 03:59:02 +08:00
|
|
|
*
|
2003-01-05 23:41:23 +08:00
|
|
|
* Convenience function to create a group of radio buttons embedded into
|
|
|
|
* a #GtkFrame or #GtkVbox.
|
|
|
|
*
|
2000-02-23 23:52:33 +08:00
|
|
|
* Returns: A #GtkFrame or #GtkVbox (depending on @in_frame).
|
2000-11-18 08:25:42 +08:00
|
|
|
**/
|
2000-01-13 23:39:26 +08:00
|
|
|
GtkWidget *
|
2000-11-18 08:25:42 +08:00
|
|
|
gimp_radio_group_new2 (gboolean in_frame,
|
|
|
|
const gchar *frame_title,
|
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-25 05:27:11 +08:00
|
|
|
GCallback radio_button_callback,
|
|
|
|
gpointer callback_data,
|
2001-11-22 21:01:26 +08:00
|
|
|
gpointer initial, /* item_data */
|
2000-01-13 23:39:26 +08:00
|
|
|
|
|
|
|
/* specify radio buttons as va_list:
|
2000-11-18 08:25:42 +08:00
|
|
|
* const gchar *label,
|
2001-11-22 21:01:26 +08:00
|
|
|
* gpointer item_data,
|
2000-11-18 08:25:42 +08:00
|
|
|
* GtkWidget **widget_ptr,
|
2000-01-13 23:39:26 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
...)
|
|
|
|
{
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *button;
|
|
|
|
GSList *group;
|
|
|
|
|
|
|
|
/* radio button variables */
|
2000-11-18 08:25:42 +08:00
|
|
|
const gchar *label;
|
2001-11-22 21:01:26 +08:00
|
|
|
gpointer item_data;
|
2000-11-18 08:25:42 +08:00
|
|
|
GtkWidget **widget_ptr;
|
2000-01-13 23:39:26 +08:00
|
|
|
|
|
|
|
va_list args;
|
|
|
|
|
2004-05-19 01:06:06 +08:00
|
|
|
vbox = gtk_vbox_new (FALSE, 2);
|
2000-01-13 23:39:26 +08:00
|
|
|
|
|
|
|
group = NULL;
|
|
|
|
|
|
|
|
/* create the radio buttons */
|
|
|
|
va_start (args, initial);
|
2000-11-18 08:25:42 +08:00
|
|
|
label = va_arg (args, const gchar *);
|
|
|
|
|
2000-01-13 23:39:26 +08:00
|
|
|
while (label)
|
|
|
|
{
|
2001-11-22 21:01:26 +08:00
|
|
|
item_data = va_arg (args, gpointer);
|
2000-01-27 09:22:27 +08:00
|
|
|
widget_ptr = va_arg (args, GtkWidget **);
|
2000-01-13 23:39:26 +08:00
|
|
|
|
2000-01-26 01:46:56 +08:00
|
|
|
if (label != (gpointer) 1)
|
2002-05-11 18:33:51 +08:00
|
|
|
button = gtk_radio_button_new_with_mnemonic (group, label);
|
2000-01-26 01:46:56 +08:00
|
|
|
else
|
|
|
|
button = gtk_radio_button_new (group);
|
|
|
|
|
2001-08-01 08:35:59 +08:00
|
|
|
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
|
2000-01-13 23:39:26 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
|
|
|
|
2001-11-22 21:01:26 +08:00
|
|
|
if (item_data)
|
|
|
|
{
|
|
|
|
g_object_set_data (G_OBJECT (button), "gimp-item-data", item_data);
|
|
|
|
|
|
|
|
/* backward compatibility */
|
|
|
|
g_object_set_data (G_OBJECT (button), "user_data", item_data);
|
|
|
|
}
|
2000-01-13 23:39:26 +08:00
|
|
|
|
|
|
|
if (widget_ptr)
|
|
|
|
*widget_ptr = button;
|
|
|
|
|
2001-11-22 21:01:26 +08:00
|
|
|
if (initial == item_data)
|
2000-01-13 23:39:26 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (button, "toggled",
|
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-25 05:27:11 +08:00
|
|
|
radio_button_callback,
|
|
|
|
callback_data);
|
2000-01-15 23:32:28 +08:00
|
|
|
|
2000-01-13 23:39:26 +08:00
|
|
|
gtk_widget_show (button);
|
|
|
|
|
2000-11-18 08:25:42 +08:00
|
|
|
label = va_arg (args, const gchar *);
|
2000-01-13 23:39:26 +08:00
|
|
|
}
|
|
|
|
va_end (args);
|
|
|
|
|
|
|
|
if (in_frame)
|
2000-02-14 06:26:41 +08:00
|
|
|
{
|
|
|
|
GtkWidget *frame;
|
|
|
|
|
2000-04-01 02:10:25 +08:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
|
|
|
|
2004-05-03 08:10:24 +08:00
|
|
|
frame = gimp_frame_new (frame_title);
|
2000-02-14 06:26:41 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
|
|
|
return frame;
|
|
|
|
}
|
2000-01-13 23:39:26 +08:00
|
|
|
|
|
|
|
return vbox;
|
|
|
|
}
|
|
|
|
|
2003-11-15 02:05:39 +08:00
|
|
|
/**
|
|
|
|
* gimp_int_radio_group_new:
|
|
|
|
* @in_frame: %TRUE if you want a #GtkFrame around the
|
|
|
|
* radio button group.
|
|
|
|
* @frame_title: The title of the Frame or %NULL if you don't want
|
|
|
|
* a title.
|
|
|
|
* @radio_button_callback: The callback each button's "toggled" signal will
|
|
|
|
* be connected with.
|
|
|
|
* @radio_button_callback_data:
|
|
|
|
* The data which will be passed to g_signal_connect().
|
|
|
|
* @initial: The @item_data of the initially pressed radio button.
|
|
|
|
* @...: A %NULL-terminated @va_list describing
|
|
|
|
* the radio buttons.
|
|
|
|
*
|
|
|
|
* Convenience function to create a group of radio buttons embedded into
|
|
|
|
* a #GtkFrame or #GtkVbox. This function does the same thing as
|
|
|
|
* gimp_radio_group_new2(), but it takes integers as @item_data instead of
|
|
|
|
* pointers, since that is a very common case (mapping an enum to a radio
|
|
|
|
* group).
|
|
|
|
*
|
|
|
|
* Returns: A #GtkFrame or #GtkVbox (depending on @in_frame).
|
|
|
|
**/
|
|
|
|
GtkWidget *
|
|
|
|
gimp_int_radio_group_new (gboolean in_frame,
|
|
|
|
const gchar *frame_title,
|
|
|
|
GCallback radio_button_callback,
|
|
|
|
gpointer callback_data,
|
|
|
|
gint initial, /* item_data */
|
|
|
|
|
|
|
|
/* specify radio buttons as va_list:
|
|
|
|
* const gchar *label,
|
|
|
|
* gint item_data,
|
|
|
|
* GtkWidget **widget_ptr,
|
|
|
|
*/
|
|
|
|
|
|
|
|
...)
|
|
|
|
{
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *button;
|
|
|
|
GSList *group;
|
|
|
|
|
|
|
|
/* radio button variables */
|
|
|
|
const gchar *label;
|
|
|
|
gint item_data;
|
|
|
|
gpointer item_ptr;
|
|
|
|
GtkWidget **widget_ptr;
|
|
|
|
|
|
|
|
va_list args;
|
|
|
|
|
2004-05-19 01:06:06 +08:00
|
|
|
vbox = gtk_vbox_new (FALSE, 2);
|
2003-11-15 02:05:39 +08:00
|
|
|
|
|
|
|
group = NULL;
|
|
|
|
|
|
|
|
/* create the radio buttons */
|
|
|
|
va_start (args, initial);
|
|
|
|
label = va_arg (args, const gchar *);
|
|
|
|
|
|
|
|
while (label)
|
|
|
|
{
|
|
|
|
item_data = va_arg (args, gint);
|
|
|
|
widget_ptr = va_arg (args, GtkWidget **);
|
|
|
|
|
|
|
|
item_ptr = GINT_TO_POINTER (item_data);
|
|
|
|
|
|
|
|
if (label != GINT_TO_POINTER (1))
|
|
|
|
button = gtk_radio_button_new_with_mnemonic (group, label);
|
|
|
|
else
|
|
|
|
button = gtk_radio_button_new (group);
|
|
|
|
|
|
|
|
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
if (item_data)
|
|
|
|
{
|
|
|
|
g_object_set_data (G_OBJECT (button), "gimp-item-data", item_ptr);
|
|
|
|
|
|
|
|
/* backward compatibility */
|
|
|
|
g_object_set_data (G_OBJECT (button), "user_data", item_ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (widget_ptr)
|
|
|
|
*widget_ptr = button;
|
|
|
|
|
|
|
|
if (initial == item_data)
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
|
|
|
|
|
|
|
g_signal_connect (button, "toggled",
|
|
|
|
radio_button_callback,
|
|
|
|
callback_data);
|
|
|
|
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
|
|
|
label = va_arg (args, const gchar *);
|
|
|
|
}
|
|
|
|
va_end (args);
|
|
|
|
|
|
|
|
if (in_frame)
|
|
|
|
{
|
|
|
|
GtkWidget *frame;
|
|
|
|
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
|
|
|
|
2004-05-03 08:10:24 +08:00
|
|
|
frame = gimp_frame_new (frame_title);
|
2003-11-15 02:05:39 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
|
|
|
return frame;
|
|
|
|
}
|
|
|
|
|
|
|
|
return vbox;
|
|
|
|
}
|
|
|
|
|
2003-01-05 23:41:23 +08:00
|
|
|
/**
|
|
|
|
* gimp_radio_group_set_active:
|
|
|
|
* @radio_button: Pointer to a #GtkRadioButton.
|
|
|
|
* @item_data: The @item_data of the radio button you want to select.
|
|
|
|
*
|
2003-11-15 19:27:34 +08:00
|
|
|
* Calls gtk_toggle_button_set_active() with the radio button that was
|
|
|
|
* created with a matching @item_data.
|
2003-01-05 23:41:23 +08:00
|
|
|
**/
|
2001-11-22 21:01:26 +08:00
|
|
|
void
|
|
|
|
gimp_radio_group_set_active (GtkRadioButton *radio_button,
|
|
|
|
gpointer item_data)
|
|
|
|
{
|
|
|
|
GtkWidget *button;
|
|
|
|
GSList *group;
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_RADIO_BUTTON (radio_button));
|
|
|
|
|
|
|
|
for (group = gtk_radio_button_get_group (radio_button);
|
|
|
|
group;
|
|
|
|
group = g_slist_next (group))
|
|
|
|
{
|
|
|
|
button = GTK_WIDGET (group->data);
|
|
|
|
|
|
|
|
if (g_object_get_data (G_OBJECT (button), "gimp-item-data") == item_data)
|
|
|
|
{
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-15 07:17:38 +08:00
|
|
|
/**
|
|
|
|
* gimp_int_radio_group_set_active:
|
|
|
|
* @radio_button: Pointer to a #GtkRadioButton.
|
|
|
|
* @item_data: The @item_data of the radio button you want to select.
|
|
|
|
*
|
|
|
|
* Calls gtk_toggle_button_set_active() with the radio button that was created
|
|
|
|
* with a matching @item_data. This function does the same thing as
|
|
|
|
* gimp_radio_group_set_active(), but takes integers as @item_data instead
|
|
|
|
* of pointers.
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gimp_int_radio_group_set_active (GtkRadioButton *radio_button,
|
|
|
|
gint item_data)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_RADIO_BUTTON (radio_button));
|
|
|
|
|
|
|
|
gimp_radio_group_set_active (radio_button, GINT_TO_POINTER (item_data));
|
|
|
|
}
|
|
|
|
|
2000-02-19 03:59:02 +08:00
|
|
|
/**
|
|
|
|
* gimp_spin_button_new:
|
2000-11-28 01:09:53 +08:00
|
|
|
* @adjustment: Returns the spinbutton's #GtkAdjustment.
|
|
|
|
* @value: The initial value of the spinbutton.
|
|
|
|
* @lower: The lower boundary.
|
|
|
|
* @upper: The uppper boundary.
|
2000-02-23 23:52:33 +08:00
|
|
|
* @step_increment: The spinbutton's step increment.
|
|
|
|
* @page_increment: The spinbutton's page increment (mouse button 2).
|
2000-11-28 01:09:53 +08:00
|
|
|
* @page_size: The spinbutton's page size.
|
|
|
|
* @climb_rate: The spinbutton's climb rate.
|
|
|
|
* @digits: The spinbutton's number of decimal digits.
|
2000-02-23 23:52:33 +08:00
|
|
|
*
|
|
|
|
* This function is a shortcut for gtk_adjustment_new() and a subsequent
|
|
|
|
* gtk_spin_button_new() and does some more initialisation stuff like
|
2002-05-29 17:20:56 +08:00
|
|
|
* setting a standard minimum horizontal size.
|
2000-02-19 03:59:02 +08:00
|
|
|
*
|
2000-02-23 23:52:33 +08:00
|
|
|
* Returns: A #GtkSpinbutton and it's #GtkAdjustment.
|
2000-11-18 08:25:42 +08:00
|
|
|
**/
|
2000-01-13 23:39:26 +08:00
|
|
|
GtkWidget *
|
|
|
|
gimp_spin_button_new (GtkObject **adjustment, /* return value */
|
2003-02-26 20:48:48 +08:00
|
|
|
gdouble value,
|
|
|
|
gdouble lower,
|
|
|
|
gdouble upper,
|
|
|
|
gdouble step_increment,
|
|
|
|
gdouble page_increment,
|
|
|
|
gdouble page_size,
|
|
|
|
gdouble climb_rate,
|
2000-01-13 23:39:26 +08:00
|
|
|
guint digits)
|
|
|
|
{
|
|
|
|
GtkWidget *spinbutton;
|
|
|
|
|
|
|
|
*adjustment = gtk_adjustment_new (value, lower, upper,
|
|
|
|
step_increment, page_increment, page_size);
|
|
|
|
|
|
|
|
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (*adjustment),
|
|
|
|
climb_rate, digits);
|
|
|
|
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
|
|
|
|
|
|
|
return spinbutton;
|
|
|
|
}
|
|
|
|
|
2000-02-04 23:12:17 +08:00
|
|
|
static void
|
|
|
|
gimp_scale_entry_unconstrained_adjustment_callback (GtkAdjustment *adjustment,
|
|
|
|
GtkAdjustment *other_adj)
|
|
|
|
{
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_handlers_block_by_func (other_adj,
|
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-25 05:27:11 +08:00
|
|
|
gimp_scale_entry_unconstrained_adjustment_callback,
|
|
|
|
adjustment);
|
2000-02-04 23:12:17 +08:00
|
|
|
|
|
|
|
gtk_adjustment_set_value (other_adj, adjustment->value);
|
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_handlers_unblock_by_func (other_adj,
|
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-25 05:27:11 +08:00
|
|
|
gimp_scale_entry_unconstrained_adjustment_callback,
|
|
|
|
adjustment);
|
2000-02-04 23:12:17 +08:00
|
|
|
}
|
|
|
|
|
2003-01-05 23:41:23 +08:00
|
|
|
static GtkObject *
|
2002-10-31 00:10:18 +08:00
|
|
|
gimp_scale_entry_new_internal (gboolean color_scale,
|
|
|
|
GtkTable *table,
|
|
|
|
gint column,
|
|
|
|
gint row,
|
|
|
|
const gchar *text,
|
|
|
|
gint scale_width,
|
|
|
|
gint spinbutton_width,
|
2003-02-26 20:48:48 +08:00
|
|
|
gdouble value,
|
|
|
|
gdouble lower,
|
|
|
|
gdouble upper,
|
|
|
|
gdouble step_increment,
|
|
|
|
gdouble page_increment,
|
2002-10-31 00:10:18 +08:00
|
|
|
guint digits,
|
|
|
|
gboolean constrain,
|
2003-02-26 20:48:48 +08:00
|
|
|
gdouble unconstrained_lower,
|
|
|
|
gdouble unconstrained_upper,
|
2002-10-31 00:10:18 +08:00
|
|
|
const gchar *tooltip,
|
2003-08-24 03:35:05 +08:00
|
|
|
const gchar *help_id)
|
2000-01-13 23:39:26 +08:00
|
|
|
{
|
|
|
|
GtkWidget *label;
|
2004-03-19 21:40:04 +08:00
|
|
|
GtkWidget *ebox;
|
2000-01-13 23:39:26 +08:00
|
|
|
GtkWidget *scale;
|
|
|
|
GtkWidget *spinbutton;
|
|
|
|
GtkObject *adjustment;
|
2000-02-04 23:12:17 +08:00
|
|
|
GtkObject *return_adj;
|
2000-01-13 23:39:26 +08:00
|
|
|
|
2002-05-08 08:30:26 +08:00
|
|
|
label = gtk_label_new_with_mnemonic (text);
|
2004-05-12 19:37:21 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
2004-03-19 21:40:04 +08:00
|
|
|
|
|
|
|
if (tooltip)
|
|
|
|
{
|
|
|
|
ebox = gtk_event_box_new ();
|
|
|
|
gtk_table_attach (GTK_TABLE (table), ebox,
|
|
|
|
column, column + 1, row, row + 1,
|
|
|
|
GTK_FILL, GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (ebox);
|
|
|
|
|
|
|
|
gtk_container_add (GTK_CONTAINER (ebox), label);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ebox = NULL;
|
|
|
|
gtk_table_attach (GTK_TABLE (table), label,
|
|
|
|
column, column + 1, row, row + 1,
|
|
|
|
GTK_FILL, GTK_FILL, 0, 0);
|
|
|
|
}
|
|
|
|
|
2000-01-13 23:39:26 +08:00
|
|
|
gtk_widget_show (label);
|
|
|
|
|
2000-02-04 23:12:17 +08:00
|
|
|
if (! constrain &&
|
|
|
|
unconstrained_lower <= lower &&
|
|
|
|
unconstrained_upper >= upper)
|
|
|
|
{
|
|
|
|
GtkObject *constrained_adj;
|
|
|
|
|
|
|
|
constrained_adj = gtk_adjustment_new (value, lower, upper,
|
|
|
|
step_increment, page_increment,
|
|
|
|
0.0);
|
|
|
|
|
|
|
|
spinbutton = gimp_spin_button_new (&adjustment, value,
|
|
|
|
unconstrained_lower,
|
|
|
|
unconstrained_upper,
|
|
|
|
step_increment, page_increment, 0.0,
|
|
|
|
1.0, digits);
|
|
|
|
|
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-25 05:27:11 +08:00
|
|
|
g_signal_connect
|
|
|
|
(G_OBJECT (constrained_adj), "value_changed",
|
|
|
|
G_CALLBACK (gimp_scale_entry_unconstrained_adjustment_callback),
|
2000-02-04 23:12:17 +08:00
|
|
|
adjustment);
|
|
|
|
|
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-25 05:27:11 +08:00
|
|
|
g_signal_connect
|
|
|
|
(G_OBJECT (adjustment), "value_changed",
|
|
|
|
G_CALLBACK (gimp_scale_entry_unconstrained_adjustment_callback),
|
2000-02-04 23:12:17 +08:00
|
|
|
constrained_adj);
|
|
|
|
|
|
|
|
return_adj = adjustment;
|
|
|
|
|
|
|
|
adjustment = constrained_adj;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
spinbutton = gimp_spin_button_new (&adjustment, value, lower, upper,
|
|
|
|
step_increment, page_increment, 0.0,
|
|
|
|
1.0, digits);
|
|
|
|
|
|
|
|
return_adj = adjustment;
|
|
|
|
}
|
2002-05-08 08:30:26 +08:00
|
|
|
|
|
|
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), spinbutton);
|
2003-08-17 03:46:59 +08:00
|
|
|
|
2001-11-12 02:35:25 +08:00
|
|
|
if (spinbutton_width > 0)
|
2002-09-07 04:44:47 +08:00
|
|
|
{
|
|
|
|
if (spinbutton_width < 17)
|
|
|
|
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), spinbutton_width);
|
|
|
|
else
|
|
|
|
gtk_widget_set_size_request (spinbutton, spinbutton_width, -1);
|
|
|
|
}
|
2000-01-13 23:39:26 +08:00
|
|
|
|
2002-10-31 00:10:18 +08:00
|
|
|
if (color_scale)
|
|
|
|
{
|
|
|
|
scale = gimp_color_scale_new (GTK_ORIENTATION_HORIZONTAL,
|
2002-10-31 20:48:19 +08:00
|
|
|
GIMP_COLOR_SELECTOR_VALUE);
|
2002-10-31 00:10:18 +08:00
|
|
|
|
2002-10-31 20:48:19 +08:00
|
|
|
gtk_range_set_adjustment (GTK_RANGE (scale),
|
|
|
|
GTK_ADJUSTMENT (adjustment));
|
2002-10-31 00:10:18 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
scale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment));
|
|
|
|
}
|
|
|
|
|
2001-11-12 02:35:25 +08:00
|
|
|
if (scale_width > 0)
|
|
|
|
gtk_widget_set_size_request (scale, scale_width, -1);
|
2000-01-13 23:39:26 +08:00
|
|
|
gtk_scale_set_digits (GTK_SCALE (scale), digits);
|
|
|
|
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), scale,
|
|
|
|
column + 1, column + 2, row, row + 1,
|
2000-02-04 23:12:17 +08:00
|
|
|
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
|
2000-01-13 23:39:26 +08:00
|
|
|
gtk_widget_show (scale);
|
|
|
|
|
|
|
|
gtk_table_attach (GTK_TABLE (table), spinbutton,
|
|
|
|
column + 2, column + 3, row, row + 1,
|
2000-02-04 23:12:17 +08:00
|
|
|
GTK_SHRINK, GTK_SHRINK, 0, 0);
|
2000-01-13 23:39:26 +08:00
|
|
|
gtk_widget_show (spinbutton);
|
|
|
|
|
2003-08-24 03:35:05 +08:00
|
|
|
if (tooltip || help_id)
|
2000-01-13 23:39:26 +08:00
|
|
|
{
|
2004-03-19 21:40:04 +08:00
|
|
|
if (ebox)
|
|
|
|
gimp_help_set_help_data (ebox, tooltip, help_id);
|
|
|
|
|
2003-08-24 03:35:05 +08:00
|
|
|
gimp_help_set_help_data (scale, tooltip, help_id);
|
|
|
|
gimp_help_set_help_data (spinbutton, tooltip, help_id);
|
2000-01-13 23:39:26 +08:00
|
|
|
}
|
|
|
|
|
2004-03-19 21:40:04 +08:00
|
|
|
g_object_set_data (G_OBJECT (return_adj), "label", label);
|
|
|
|
g_object_set_data (G_OBJECT (return_adj), "scale", scale);
|
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-25 05:27:11 +08:00
|
|
|
g_object_set_data (G_OBJECT (return_adj), "spinbutton", spinbutton);
|
2000-02-14 21:23:12 +08:00
|
|
|
|
2000-02-04 23:12:17 +08:00
|
|
|
return return_adj;
|
2000-01-13 23:39:26 +08:00
|
|
|
}
|
|
|
|
|
2002-10-31 00:10:18 +08:00
|
|
|
/**
|
|
|
|
* gimp_scale_entry_new:
|
|
|
|
* @table: The #GtkTable the widgets will be attached to.
|
|
|
|
* @column: The column to start with.
|
|
|
|
* @row: The row to attach the widgets.
|
|
|
|
* @text: The text for the #GtkLabel which will appear
|
|
|
|
* left of the #GtkHScale.
|
|
|
|
* @scale_width: The minimum horizontal size of the #GtkHScale.
|
|
|
|
* @spinbutton_width: The minimum horizontal size of the #GtkSpinButton.
|
|
|
|
* @value: The initial value.
|
|
|
|
* @lower: The lower boundary.
|
|
|
|
* @upper: The upper boundary.
|
|
|
|
* @step_increment: The step increment.
|
|
|
|
* @page_increment: The page increment.
|
|
|
|
* @digits: The number of decimal digits.
|
2003-02-07 05:17:12 +08:00
|
|
|
* @constrain: %TRUE if the range of possible values of the
|
2002-10-31 00:10:18 +08:00
|
|
|
* #GtkSpinButton should be the same as of the #GtkHScale.
|
|
|
|
* @unconstrained_lower: The spinbutton's lower boundary
|
2003-02-07 05:17:12 +08:00
|
|
|
* if @constrain == %FALSE.
|
2002-10-31 00:10:18 +08:00
|
|
|
* @unconstrained_upper: The spinbutton's upper boundary
|
2003-02-07 05:17:12 +08:00
|
|
|
* if @constrain == %FALSE.
|
2002-10-31 00:10:18 +08:00
|
|
|
* @tooltip: A tooltip message for the scale and the spinbutton.
|
2003-08-24 03:35:05 +08:00
|
|
|
* @help_id: The widgets' help_id (see gimp_help_set_help_data()).
|
2002-10-31 00:10:18 +08:00
|
|
|
*
|
|
|
|
* This function creates a #GtkLabel, a #GtkHScale and a #GtkSpinButton and
|
|
|
|
* attaches them to a 3-column #GtkTable.
|
|
|
|
*
|
|
|
|
* Returns: The #GtkSpinButton's #GtkAdjustment.
|
|
|
|
**/
|
|
|
|
GtkObject *
|
|
|
|
gimp_scale_entry_new (GtkTable *table,
|
|
|
|
gint column,
|
|
|
|
gint row,
|
|
|
|
const gchar *text,
|
|
|
|
gint scale_width,
|
|
|
|
gint spinbutton_width,
|
2003-02-26 20:48:48 +08:00
|
|
|
gdouble value,
|
|
|
|
gdouble lower,
|
|
|
|
gdouble upper,
|
|
|
|
gdouble step_increment,
|
|
|
|
gdouble page_increment,
|
2002-10-31 00:10:18 +08:00
|
|
|
guint digits,
|
|
|
|
gboolean constrain,
|
2003-02-26 20:48:48 +08:00
|
|
|
gdouble unconstrained_lower,
|
|
|
|
gdouble unconstrained_upper,
|
2002-10-31 00:10:18 +08:00
|
|
|
const gchar *tooltip,
|
2003-08-24 03:35:05 +08:00
|
|
|
const gchar *help_id)
|
2002-10-31 00:10:18 +08:00
|
|
|
{
|
|
|
|
return gimp_scale_entry_new_internal (FALSE,
|
|
|
|
table, column, row,
|
|
|
|
text, scale_width, spinbutton_width,
|
|
|
|
value, lower, upper,
|
|
|
|
step_increment, page_increment,
|
|
|
|
digits,
|
|
|
|
constrain,
|
|
|
|
unconstrained_lower,
|
|
|
|
unconstrained_upper,
|
2003-08-24 03:35:05 +08:00
|
|
|
tooltip, help_id);
|
2002-10-31 00:10:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_color_scale_entry_new:
|
|
|
|
* @table: The #GtkTable the widgets will be attached to.
|
|
|
|
* @column: The column to start with.
|
|
|
|
* @row: The row to attach the widgets.
|
|
|
|
* @text: The text for the #GtkLabel which will appear
|
|
|
|
* left of the #GtkHScale.
|
|
|
|
* @scale_width: The minimum horizontal size of the #GtkHScale.
|
|
|
|
* @spinbutton_width: The minimum horizontal size of the #GtkSpinButton.
|
|
|
|
* @value: The initial value.
|
|
|
|
* @lower: The lower boundary.
|
|
|
|
* @upper: The upper boundary.
|
|
|
|
* @step_increment: The step increment.
|
|
|
|
* @page_increment: The page increment.
|
|
|
|
* @digits: The number of decimal digits.
|
|
|
|
* @tooltip: A tooltip message for the scale and the spinbutton.
|
2003-08-24 03:35:05 +08:00
|
|
|
* @help_id: The widgets' help_id (see gimp_help_set_help_data()).
|
2002-10-31 00:10:18 +08:00
|
|
|
*
|
2003-02-26 20:48:48 +08:00
|
|
|
* This function creates a #GtkLabel, a #GimpColorScale and a
|
|
|
|
* #GtkSpinButton and attaches them to a 3-column #GtkTable.
|
2002-10-31 00:10:18 +08:00
|
|
|
*
|
|
|
|
* Returns: The #GtkSpinButton's #GtkAdjustment.
|
|
|
|
**/
|
|
|
|
GtkObject *
|
|
|
|
gimp_color_scale_entry_new (GtkTable *table,
|
|
|
|
gint column,
|
|
|
|
gint row,
|
|
|
|
const gchar *text,
|
|
|
|
gint scale_width,
|
|
|
|
gint spinbutton_width,
|
2003-02-26 20:48:48 +08:00
|
|
|
gdouble value,
|
|
|
|
gdouble lower,
|
|
|
|
gdouble upper,
|
|
|
|
gdouble step_increment,
|
|
|
|
gdouble page_increment,
|
2002-10-31 00:10:18 +08:00
|
|
|
guint digits,
|
|
|
|
const gchar *tooltip,
|
2003-08-24 03:35:05 +08:00
|
|
|
const gchar *help_id)
|
2002-10-31 00:10:18 +08:00
|
|
|
{
|
|
|
|
return gimp_scale_entry_new_internal (TRUE,
|
|
|
|
table, column, row,
|
|
|
|
text, scale_width, spinbutton_width,
|
|
|
|
value, lower, upper,
|
|
|
|
step_increment, page_increment,
|
|
|
|
digits,
|
|
|
|
TRUE, 0.0, 0.0,
|
2003-08-24 03:35:05 +08:00
|
|
|
tooltip, help_id);
|
2002-10-31 00:10:18 +08:00
|
|
|
}
|
|
|
|
|
2002-10-09 01:36:32 +08:00
|
|
|
/**
|
|
|
|
* gimp_scale_entry_set_sensitive:
|
|
|
|
* @adjustment: a #GtkAdjustment returned by gimp_scale_entry_new()
|
|
|
|
* @sensitive: a boolean value with the same semantics as the @sensitive
|
|
|
|
* parameter of gtk_widget_set_sensitive()
|
2003-08-17 03:46:59 +08:00
|
|
|
*
|
2002-10-09 01:36:32 +08:00
|
|
|
* Sets the sensitivity of the scale_entry's #GtkLabel, #GtkHScale and
|
|
|
|
* #GtkSpinbutton.
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gimp_scale_entry_set_sensitive (GtkObject *adjustment,
|
|
|
|
gboolean sensitive)
|
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
|
|
|
|
|
|
|
|
widget = GIMP_SCALE_ENTRY_LABEL (adjustment);
|
|
|
|
if (widget)
|
|
|
|
gtk_widget_set_sensitive (widget, sensitive);
|
|
|
|
|
|
|
|
widget = GIMP_SCALE_ENTRY_SCALE (adjustment);
|
|
|
|
if (widget)
|
|
|
|
gtk_widget_set_sensitive (widget, sensitive);
|
|
|
|
|
|
|
|
widget = GIMP_SCALE_ENTRY_SPINBUTTON (adjustment);
|
|
|
|
if (widget)
|
|
|
|
gtk_widget_set_sensitive (widget, sensitive);
|
|
|
|
}
|
|
|
|
|
2000-01-26 01:46:56 +08:00
|
|
|
static void
|
2002-11-25 03:26:58 +08:00
|
|
|
gimp_random_seed_update (GtkWidget *widget,
|
|
|
|
gpointer data)
|
2000-01-26 01:46:56 +08:00
|
|
|
{
|
2004-02-01 21:22:09 +08:00
|
|
|
GtkWidget *spinbutton = data;
|
2000-01-26 01:46:56 +08:00
|
|
|
|
2004-02-01 21:22:09 +08:00
|
|
|
/* Generate a new seed if the "New Seed" button was clicked or
|
|
|
|
* of the "Randomize" toggle is activated
|
|
|
|
*/
|
|
|
|
if (! GTK_IS_TOGGLE_BUTTON (widget) ||
|
|
|
|
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
|
|
|
|
{
|
|
|
|
gtk_spin_button_set_value (GTK_SPIN_BUTTON (spinbutton),
|
|
|
|
(guint) g_random_int ());
|
|
|
|
}
|
2000-01-26 01:46:56 +08:00
|
|
|
}
|
|
|
|
|
2000-02-19 03:59:02 +08:00
|
|
|
/**
|
|
|
|
* gimp_random_seed_new:
|
2003-12-17 22:39:38 +08:00
|
|
|
* @seed: A pointer to the variable which stores the random seed.
|
2004-02-01 21:22:09 +08:00
|
|
|
* @random_seed: A pointer to a boolean indicating whether seed should be
|
2003-12-17 22:49:56 +08:00
|
|
|
* initialised randomly or not.
|
2000-02-19 03:59:02 +08:00
|
|
|
*
|
2003-03-06 04:21:50 +08:00
|
|
|
* Creates a widget that allows the user to control how the random number
|
|
|
|
* generator is initialized.
|
2000-02-23 23:52:33 +08:00
|
|
|
*
|
2002-11-25 03:26:58 +08:00
|
|
|
* Returns: A #GtkHBox containing a #GtkSpinButton for the seed and
|
|
|
|
* a #GtkButton for setting a random seed.
|
2000-11-18 08:25:42 +08:00
|
|
|
**/
|
2000-01-26 01:46:56 +08:00
|
|
|
GtkWidget *
|
2004-02-01 21:22:09 +08:00
|
|
|
gimp_random_seed_new (guint *seed,
|
|
|
|
gboolean *random_seed)
|
2000-01-26 01:46:56 +08:00
|
|
|
{
|
|
|
|
GtkWidget *hbox;
|
2004-02-01 07:34:56 +08:00
|
|
|
GtkWidget *toggle;
|
2000-01-26 01:46:56 +08:00
|
|
|
GtkWidget *spinbutton;
|
|
|
|
GtkObject *adj;
|
2000-02-04 23:12:17 +08:00
|
|
|
GtkWidget *button;
|
2000-01-26 01:46:56 +08:00
|
|
|
|
2004-02-01 21:22:09 +08:00
|
|
|
g_return_val_if_fail (seed != NULL, NULL);
|
|
|
|
g_return_val_if_fail (random_seed != NULL, NULL);
|
|
|
|
|
2000-01-26 01:46:56 +08:00
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
|
2004-02-01 07:34:56 +08:00
|
|
|
/* If we're being asked to generate a random seed, generate one. */
|
2003-12-17 22:49:56 +08:00
|
|
|
if (*random_seed)
|
2004-02-01 21:22:09 +08:00
|
|
|
*seed = g_random_int ();
|
2003-12-17 22:49:56 +08:00
|
|
|
|
2000-01-26 01:46:56 +08:00
|
|
|
spinbutton = gimp_spin_button_new (&adj, *seed,
|
configure.in app/core/gimpbrushpipe.c app/gui/about-dialog.c
2002-11-20 Dave Neary <bolsh@gimp.org>
* configure.in
* app/core/gimpbrushpipe.c
* app/gui/about-dialog.c
* app/paint-funcs/paint-funcs-generic.h
* app/paint-funcs/paint-funcs.c
* libgimpmath/gimpmath.h
* libgimpwidgets/gimpwidgets.c
* plug-ins/common/CML_explorer.c
* plug-ins/common/blur.c
* plug-ins/common/cubism.c
* plug-ins/common/gee.c
* plug-ins/common/gee_zoom.c
* plug-ins/common/gqbist.c
* plug-ins/common/jigsaw.c
* plug-ins/common/lic.c
* plug-ins/common/noisify.c
* plug-ins/common/nova.c
* plug-ins/common/papertile.c
* plug-ins/common/plasma.c
* plug-ins/common/randomize.c
* plug-ins/common/sample_colorize.c
* plug-ins/common/scatter_hsv.c
* plug-ins/common/shift.c
* plug-ins/common/sinus.c
* plug-ins/common/smooth_palette.c
* plug-ins/common/snoise.c
* plug-ins/common/sparkle.c
* plug-ins/common/spheredesigner.c
* plug-ins/common/spread.c
* plug-ins/common/warp.c
* plug-ins/common/wind.c
* plug-ins/flame/cmap.c
* plug-ins/flame/flame.c
* plug-ins/flame/libifs.c
* plug-ins/gflare/gflare.c
* plug-ins/gimpressionist/gimpressionist.c
* plug-ins/gimpressionist/gimpressionist.h
* plug-ins/gimpressionist/plasma.c
* plug-ins/gimpressionist/repaint.c
* plug-ins/ifscompose/ifscompose_utils.c
* plug-ins/maze/algorithms.c
* plug-ins/maze/maze.c
* plug-ins/maze/maze.h
* plug-ins/mosaic/mosaic.c: Change all occurrences of RAND_MAX,
G_MAXRAND, rand(), srand(), lrand48(), srand48(), random(),
srandom(), RAND_FUNC and SRAND_FUNC to the appropriate g_rand*
equivalent. Programs which require seed setting for reproducible
results, and anything in the core, gets a dedicated GRand * for
the lifetime required. Programs which only ever used random
numbers for tossing a coin, rolling a dice, etc use g_random
functions. For the rest, judgement was used. Where it was easy, a
GRand * object was used and g_rand_* functions were
preferred. This fixes bug #67386 in HEAD.
2002-11-20 17:27:48 +08:00
|
|
|
0, (guint32) -1 , 1, 10, 0, 1, 0);
|
2000-01-26 01:46:56 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
|
2004-02-01 21:22:09 +08:00
|
|
|
gtk_widget_show (spinbutton);
|
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (adj, "value_changed",
|
2002-11-25 03:26:58 +08:00
|
|
|
G_CALLBACK (gimp_uint_adjustment_update),
|
2001-07-31 19:33:13 +08:00
|
|
|
seed);
|
2000-01-26 01:46:56 +08:00
|
|
|
|
|
|
|
gimp_help_set_help_data (spinbutton,
|
2002-11-25 03:26:58 +08:00
|
|
|
_("Use this value for random number generator "
|
2000-01-26 01:46:56 +08:00
|
|
|
"seed - this allows you to repeat a "
|
|
|
|
"given \"random\" operation"), NULL);
|
|
|
|
|
2004-02-01 21:22:09 +08:00
|
|
|
button = gtk_button_new_with_mnemonic (_("_New Seed"));
|
2000-02-04 23:12:17 +08:00
|
|
|
gtk_misc_set_padding (GTK_MISC (GTK_BIN (button)->child), 2, 0);
|
2004-02-01 21:22:09 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
2003-08-17 03:46:59 +08:00
|
|
|
/* Send spinbutton as data so that we can change the value in
|
2004-02-01 21:22:09 +08:00
|
|
|
* gimp_random_seed_update()
|
|
|
|
*/
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (button, "clicked",
|
2002-11-25 03:26:58 +08:00
|
|
|
G_CALLBACK (gimp_random_seed_update),
|
|
|
|
spinbutton);
|
2000-02-04 23:12:17 +08:00
|
|
|
|
|
|
|
gimp_help_set_help_data (button,
|
2004-02-01 21:22:09 +08:00
|
|
|
_("Seed random number generator with a generated "
|
|
|
|
"random number"),
|
2002-11-25 03:26:58 +08:00
|
|
|
NULL);
|
2000-01-26 01:46:56 +08:00
|
|
|
|
2004-03-05 21:27:26 +08:00
|
|
|
toggle = gtk_check_button_new_with_mnemonic (_("_Randomize"));
|
2004-02-01 07:34:56 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), *random_seed);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), toggle, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (toggle);
|
2004-02-01 21:22:09 +08:00
|
|
|
|
2004-02-01 07:34:56 +08:00
|
|
|
g_signal_connect (toggle, "toggled",
|
|
|
|
G_CALLBACK (gimp_toggle_button_update),
|
|
|
|
random_seed);
|
|
|
|
|
2004-02-01 21:22:09 +08:00
|
|
|
/* Need to create a new seed when the "Randomize" toggle is activated */
|
|
|
|
g_signal_connect (toggle, "toggled",
|
|
|
|
G_CALLBACK (gimp_random_seed_update),
|
|
|
|
spinbutton);
|
|
|
|
|
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-25 05:27:11 +08:00
|
|
|
g_object_set_data (G_OBJECT (hbox), "spinbutton", spinbutton);
|
2002-11-25 03:26:58 +08:00
|
|
|
g_object_set_data (G_OBJECT (hbox), "button", button);
|
2004-02-01 07:34:56 +08:00
|
|
|
g_object_set_data (G_OBJECT (hbox), "toggle", toggle);
|
|
|
|
|
2004-02-01 21:22:09 +08:00
|
|
|
/* Set sensitivity data for the toggle, this stuff makes
|
|
|
|
* gimp_toggle_button_sensitive_update work
|
|
|
|
*/
|
2004-02-01 07:34:56 +08:00
|
|
|
g_object_set_data (G_OBJECT (toggle), "inverse_sensitive", spinbutton);
|
|
|
|
g_object_set_data (G_OBJECT (spinbutton), "inverse_sensitive", button);
|
|
|
|
|
|
|
|
/* Initialise sensitivity */
|
|
|
|
gimp_toggle_button_update (toggle, random_seed);
|
2000-02-23 23:52:33 +08:00
|
|
|
|
2000-01-26 01:46:56 +08:00
|
|
|
return hbox;
|
|
|
|
}
|
|
|
|
|
2000-02-01 04:47:44 +08:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GimpChainButton *chainbutton;
|
2000-02-03 01:59:44 +08:00
|
|
|
gboolean chain_constrains_ratio;
|
|
|
|
gdouble orig_x;
|
|
|
|
gdouble orig_y;
|
2000-02-01 04:47:44 +08:00
|
|
|
gdouble last_x;
|
|
|
|
gdouble last_y;
|
|
|
|
} GimpCoordinatesData;
|
|
|
|
|
|
|
|
static void
|
2003-08-17 03:46:59 +08:00
|
|
|
gimp_coordinates_callback (GtkWidget *widget,
|
|
|
|
GimpCoordinatesData *gcd)
|
2000-02-01 04:47:44 +08:00
|
|
|
{
|
|
|
|
gdouble new_x;
|
|
|
|
gdouble new_y;
|
|
|
|
|
|
|
|
new_x = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
|
|
|
|
new_y = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
|
|
|
|
|
|
|
|
if (gimp_chain_button_get_active (gcd->chainbutton))
|
|
|
|
{
|
2000-02-03 01:59:44 +08:00
|
|
|
if (gcd->chain_constrains_ratio)
|
|
|
|
{
|
|
|
|
if ((gcd->orig_x != 0) && (gcd->orig_y != 0))
|
|
|
|
{
|
|
|
|
if (new_x != gcd->last_x)
|
|
|
|
{
|
|
|
|
gcd->last_x = new_x;
|
|
|
|
gcd->last_y = new_y = (new_x * gcd->orig_y) / gcd->orig_x;
|
2003-08-17 03:46:59 +08:00
|
|
|
|
|
|
|
g_signal_stop_emission_by_name (widget, "value_changed");
|
2000-02-03 01:59:44 +08:00
|
|
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 1,
|
|
|
|
new_y);
|
|
|
|
}
|
|
|
|
else if (new_y != gcd->last_y)
|
|
|
|
{
|
|
|
|
gcd->last_y = new_y;
|
|
|
|
gcd->last_x = new_x = (new_y * gcd->orig_x) / gcd->orig_y;
|
2003-08-17 03:46:59 +08:00
|
|
|
|
|
|
|
g_signal_stop_emission_by_name (widget, "value_changed");
|
2000-02-03 01:59:44 +08:00
|
|
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 0,
|
|
|
|
new_x);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (new_x != gcd->last_x)
|
|
|
|
{
|
|
|
|
gcd->last_y = new_y = gcd->last_x = new_x;
|
2003-08-17 03:46:59 +08:00
|
|
|
|
|
|
|
g_signal_stop_emission_by_name (widget, "value_changed");
|
2000-02-03 01:59:44 +08:00
|
|
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 1, new_x);
|
|
|
|
}
|
|
|
|
else if (new_y != gcd->last_y)
|
|
|
|
{
|
|
|
|
gcd->last_x = new_x = gcd->last_y = new_y;
|
2003-08-17 03:46:59 +08:00
|
|
|
|
|
|
|
g_signal_stop_emission_by_name (widget, "value_changed");
|
2000-02-03 01:59:44 +08:00
|
|
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 0, new_y);
|
|
|
|
}
|
|
|
|
}
|
2000-02-01 04:47:44 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (new_x != gcd->last_x)
|
|
|
|
gcd->last_x = new_x;
|
|
|
|
if (new_y != gcd->last_y)
|
|
|
|
gcd->last_y = new_y;
|
2003-08-17 03:46:59 +08:00
|
|
|
}
|
2000-02-01 04:47:44 +08:00
|
|
|
}
|
|
|
|
|
2000-02-19 03:59:02 +08:00
|
|
|
/**
|
|
|
|
* gimp_coordinates_new:
|
2000-11-28 01:09:53 +08:00
|
|
|
* @unit: The initial unit of the #GimpUnitMenu.
|
2003-02-07 05:17:12 +08:00
|
|
|
* @unit_format: A printf-like unit-format string as is used with
|
|
|
|
* gimp_unit_menu_new().
|
|
|
|
* @menu_show_pixels: %TRUE if the #GimpUnitMenu should contain an item
|
|
|
|
* for GIMP_UNIT_PIXEL.
|
2003-08-17 03:46:59 +08:00
|
|
|
* @menu_show_percent: %TRUE if the #GimpUnitMenu should contain an item
|
2003-02-07 05:17:12 +08:00
|
|
|
* for GIMP_UNIT_PERCENT.
|
2001-11-12 02:35:25 +08:00
|
|
|
* @spinbutton_width: The horizontal size of the #GimpSizeEntry's
|
2000-11-28 01:09:53 +08:00
|
|
|
* #GtkSpinButton's.
|
|
|
|
* @update_policy: The update policy for the #GimpSizeEntry.
|
2003-02-07 05:17:12 +08:00
|
|
|
* @chainbutton_active: %TRUE if the attached #GimpChainButton should be
|
2000-11-28 01:09:53 +08:00
|
|
|
* active.
|
2003-02-07 05:17:12 +08:00
|
|
|
* @chain_constrains_ratio: %TRUE if the chainbutton should constrain the
|
|
|
|
* fields' aspect ratio. If %FALSE, the values will
|
2000-02-23 23:52:33 +08:00
|
|
|
* be constrained.
|
2000-11-28 01:09:53 +08:00
|
|
|
* @xlabel: The label for the X coordinate.
|
|
|
|
* @x: The initial value of the X coordinate.
|
|
|
|
* @xres: The horizontal resolution in DPI.
|
|
|
|
* @lower_boundary_x: The lower boundary of the X coordinate.
|
|
|
|
* @upper_boundary_x: The upper boundary of the X coordinate.
|
|
|
|
* @xsize_0: The X value which will be treated as 0%.
|
|
|
|
* @xsize_100: The X value which will be treated as 100%.
|
|
|
|
* @ylabel: The label for the Y coordinate.
|
|
|
|
* @y: The initial value of the Y coordinate.
|
|
|
|
* @yres: The vertical resolution in DPI.
|
|
|
|
* @lower_boundary_y: The lower boundary of the Y coordinate.
|
|
|
|
* @upper_boundary_y: The upper boundary of the Y coordinate.
|
|
|
|
* @ysize_0: The Y value which will be treated as 0%.
|
|
|
|
* @ysize_100: The Y value which will be treated as 100%.
|
2000-02-19 03:59:02 +08:00
|
|
|
*
|
2003-01-05 23:41:23 +08:00
|
|
|
* Convenience function that creates a #GimpSizeEntry with two fields for x/y
|
|
|
|
* coordinates/sizes with a #GimpChainButton attached to constrain either the
|
|
|
|
* two fields' values or the ratio between them.
|
|
|
|
*
|
|
|
|
* Returns: The new #GimpSizeEntry.
|
2000-11-18 08:25:42 +08:00
|
|
|
**/
|
2000-02-01 04:47:44 +08:00
|
|
|
GtkWidget *
|
2000-02-08 04:35:13 +08:00
|
|
|
gimp_coordinates_new (GimpUnit unit,
|
2000-11-18 08:25:42 +08:00
|
|
|
const gchar *unit_format,
|
2000-02-01 04:47:44 +08:00
|
|
|
gboolean menu_show_pixels,
|
|
|
|
gboolean menu_show_percent,
|
2001-11-12 02:35:25 +08:00
|
|
|
gint spinbutton_width,
|
2000-02-08 04:35:13 +08:00
|
|
|
GimpSizeEntryUpdatePolicy update_policy,
|
2000-02-01 04:47:44 +08:00
|
|
|
|
2000-02-03 01:59:44 +08:00
|
|
|
gboolean chainbutton_active,
|
|
|
|
gboolean chain_constrains_ratio,
|
|
|
|
|
2000-11-18 08:25:42 +08:00
|
|
|
const gchar *xlabel,
|
2000-02-01 04:47:44 +08:00
|
|
|
gdouble x,
|
|
|
|
gdouble xres,
|
2000-02-03 01:59:44 +08:00
|
|
|
gdouble lower_boundary_x,
|
|
|
|
gdouble upper_boundary_x,
|
|
|
|
gdouble xsize_0, /* % */
|
|
|
|
gdouble xsize_100, /* % */
|
2000-02-01 04:47:44 +08:00
|
|
|
|
2000-11-18 08:25:42 +08:00
|
|
|
const gchar *ylabel,
|
2000-02-01 04:47:44 +08:00
|
|
|
gdouble y,
|
|
|
|
gdouble yres,
|
2000-02-03 01:59:44 +08:00
|
|
|
gdouble lower_boundary_y,
|
|
|
|
gdouble upper_boundary_y,
|
|
|
|
gdouble ysize_0, /* % */
|
|
|
|
gdouble ysize_100 /* % */)
|
2000-02-01 04:47:44 +08:00
|
|
|
{
|
|
|
|
GimpCoordinatesData *gcd;
|
|
|
|
GtkObject *adjustment;
|
|
|
|
GtkWidget *spinbutton;
|
|
|
|
GtkWidget *sizeentry;
|
2000-02-23 23:52:33 +08:00
|
|
|
GtkWidget *chainbutton;
|
2000-02-01 04:47:44 +08:00
|
|
|
|
|
|
|
spinbutton = gimp_spin_button_new (&adjustment, 1, 0, 1, 1, 10, 1, 1, 2);
|
2002-09-07 04:44:47 +08:00
|
|
|
|
|
|
|
if (spinbutton_width > 0)
|
|
|
|
{
|
|
|
|
if (spinbutton_width < 17)
|
|
|
|
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), spinbutton_width);
|
|
|
|
else
|
|
|
|
gtk_widget_set_size_request (spinbutton, spinbutton_width, -1);
|
|
|
|
}
|
|
|
|
|
2000-02-01 04:47:44 +08:00
|
|
|
sizeentry = gimp_size_entry_new (1, unit, unit_format,
|
|
|
|
menu_show_pixels,
|
|
|
|
menu_show_percent,
|
|
|
|
FALSE,
|
2001-11-12 02:35:25 +08:00
|
|
|
spinbutton_width,
|
2000-02-01 04:47:44 +08:00
|
|
|
update_policy);
|
2003-08-17 03:46:59 +08:00
|
|
|
gtk_table_set_col_spacing (GTK_TABLE (sizeentry), 0, 4);
|
|
|
|
gtk_table_set_col_spacing (GTK_TABLE (sizeentry), 2, 4);
|
2000-02-01 04:47:44 +08:00
|
|
|
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (sizeentry),
|
|
|
|
GTK_SPIN_BUTTON (spinbutton), NULL);
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (sizeentry), spinbutton, 1, 2, 0, 1);
|
|
|
|
gtk_widget_show (spinbutton);
|
|
|
|
|
2000-03-15 07:06:21 +08:00
|
|
|
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry),
|
2003-08-17 03:46:59 +08:00
|
|
|
(update_policy == GIMP_SIZE_ENTRY_UPDATE_RESOLUTION) ||
|
|
|
|
(menu_show_pixels == FALSE) ?
|
2000-03-15 07:06:21 +08:00
|
|
|
GIMP_UNIT_INCH : GIMP_UNIT_PIXEL);
|
2000-02-01 04:47:44 +08:00
|
|
|
|
|
|
|
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0, xres, TRUE);
|
|
|
|
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 1, yres, TRUE);
|
|
|
|
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
|
|
|
|
lower_boundary_x, upper_boundary_x);
|
|
|
|
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 1,
|
|
|
|
lower_boundary_y, upper_boundary_y);
|
|
|
|
|
2000-02-03 01:59:44 +08:00
|
|
|
if (menu_show_percent)
|
|
|
|
{
|
|
|
|
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (sizeentry), 0,
|
|
|
|
xsize_0, xsize_100);
|
|
|
|
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (sizeentry), 1,
|
|
|
|
ysize_0, ysize_100);
|
|
|
|
}
|
|
|
|
|
2000-02-01 04:47:44 +08:00
|
|
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0, x);
|
|
|
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1, y);
|
|
|
|
|
2004-05-12 19:37:21 +08:00
|
|
|
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
|
|
|
|
xlabel, 0, 0, 0.0);
|
|
|
|
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (sizeentry),
|
|
|
|
ylabel, 1, 0, 0.0);
|
2000-02-01 04:47:44 +08:00
|
|
|
|
2000-02-23 23:52:33 +08:00
|
|
|
chainbutton = gimp_chain_button_new (GIMP_CHAIN_RIGHT);
|
2000-02-03 01:59:44 +08:00
|
|
|
if (chainbutton_active)
|
2000-02-23 23:52:33 +08:00
|
|
|
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chainbutton), TRUE);
|
|
|
|
gtk_table_attach (GTK_TABLE (sizeentry), chainbutton, 2, 3, 0, 2,
|
2000-02-01 04:47:44 +08:00
|
|
|
GTK_SHRINK | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
2000-02-23 23:52:33 +08:00
|
|
|
gtk_widget_show (chainbutton);
|
2000-02-01 04:47:44 +08:00
|
|
|
|
|
|
|
gcd = g_new (GimpCoordinatesData, 1);
|
2000-02-23 23:52:33 +08:00
|
|
|
gcd->chainbutton = GIMP_CHAIN_BUTTON (chainbutton);
|
2000-02-03 01:59:44 +08:00
|
|
|
gcd->chain_constrains_ratio = chain_constrains_ratio;
|
|
|
|
gcd->orig_x = x;
|
|
|
|
gcd->orig_y = y;
|
|
|
|
gcd->last_x = x;
|
|
|
|
gcd->last_y = y;
|
2000-02-01 04:47:44 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect_swapped (sizeentry, "destroy",
|
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-25 05:27:11 +08:00
|
|
|
G_CALLBACK (g_free),
|
|
|
|
gcd);
|
2000-02-01 04:47:44 +08:00
|
|
|
|
2003-08-17 03:46:59 +08:00
|
|
|
g_signal_connect (sizeentry, "value_changed",
|
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-25 05:27:11 +08:00
|
|
|
G_CALLBACK (gimp_coordinates_callback),
|
|
|
|
gcd);
|
2000-02-01 04:47:44 +08: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-25 05:27:11 +08:00
|
|
|
g_object_set_data (G_OBJECT (sizeentry), "chainbutton", chainbutton);
|
2000-02-23 23:52:33 +08:00
|
|
|
|
2000-02-01 04:47:44 +08:00
|
|
|
return sizeentry;
|
|
|
|
}
|
|
|
|
|
2000-03-15 07:06:21 +08:00
|
|
|
|
2000-02-19 03:59:02 +08:00
|
|
|
/**
|
|
|
|
* gimp_pixmap_button_new:
|
2000-02-23 23:52:33 +08:00
|
|
|
* @xpm_data: The XPM data which will be passed to gimp_pixmap_new().
|
2000-11-28 01:09:53 +08:00
|
|
|
* @text: An optional text which will appear right of the pixmap.
|
2000-02-19 03:59:02 +08:00
|
|
|
*
|
2003-02-07 05:17:12 +08:00
|
|
|
* Convenience function that creates a #GtkButton with a #GimpPixmap
|
|
|
|
* and an optional #GtkLabel.
|
2003-08-17 03:46:59 +08:00
|
|
|
*
|
2003-01-05 23:41:23 +08:00
|
|
|
* Returns: The new #GtkButton.
|
2000-11-18 08:25:42 +08:00
|
|
|
**/
|
2000-02-18 21:59:18 +08:00
|
|
|
GtkWidget *
|
2000-11-18 08:25:42 +08:00
|
|
|
gimp_pixmap_button_new (gchar **xpm_data,
|
|
|
|
const gchar *text)
|
2000-02-18 21:59:18 +08:00
|
|
|
{
|
|
|
|
GtkWidget *button;
|
|
|
|
GtkWidget *pixmap;
|
|
|
|
|
|
|
|
button = gtk_button_new ();
|
|
|
|
pixmap = gimp_pixmap_new (xpm_data);
|
2000-02-19 22:25:27 +08:00
|
|
|
|
|
|
|
if (text)
|
|
|
|
{
|
|
|
|
GtkWidget *abox;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *label;
|
|
|
|
|
|
|
|
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
|
|
|
gtk_container_add (GTK_CONTAINER (button), abox);
|
|
|
|
gtk_widget_show (abox);
|
|
|
|
|
|
|
|
hbox = gtk_hbox_new (FALSE, 0);
|
|
|
|
gtk_container_add (GTK_CONTAINER (abox), hbox);
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), pixmap, FALSE, FALSE, 4);
|
|
|
|
gtk_widget_show (pixmap);
|
|
|
|
|
2002-11-29 21:57:30 +08:00
|
|
|
label = gtk_label_new_with_mnemonic (text);
|
|
|
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), button);
|
2000-02-19 22:25:27 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gtk_container_add (GTK_CONTAINER (button), pixmap);
|
|
|
|
gtk_widget_show (pixmap);
|
|
|
|
}
|
|
|
|
|
2000-02-18 21:59:18 +08:00
|
|
|
|
|
|
|
return button;
|
|
|
|
}
|
|
|
|
|
2000-01-13 23:39:26 +08:00
|
|
|
/*
|
2000-01-27 09:22:27 +08:00
|
|
|
* Standard Callbacks
|
2000-01-13 23:39:26 +08:00
|
|
|
*/
|
|
|
|
|
2000-02-23 23:52:33 +08:00
|
|
|
/**
|
|
|
|
* gimp_toggle_button_sensitive_update:
|
|
|
|
* @toggle_button: The #GtkToggleButton the "set_sensitive" and
|
|
|
|
* "inverse_sensitive" lists are attached to.
|
|
|
|
*
|
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-25 05:27:11 +08:00
|
|
|
* If you attached a pointer to a #GtkWidget with g_object_set_data() and
|
2000-02-23 23:52:33 +08:00
|
|
|
* the "set_sensitive" key to the #GtkToggleButton, the sensitive state of
|
|
|
|
* the attached widget will be set according to the toggle button's
|
|
|
|
* "active" state.
|
|
|
|
*
|
|
|
|
* You can attach an arbitrary list of widgets by attaching another
|
|
|
|
* "set_sensitive" data pointer to the first widget (and so on...).
|
|
|
|
*
|
|
|
|
* This function can also set the sensitive state according to the toggle
|
|
|
|
* button's inverse "active" state by attaching widgets with the
|
|
|
|
* "inverse_sensitive" key.
|
2000-11-18 08:25:42 +08:00
|
|
|
**/
|
2000-02-23 23:52:33 +08:00
|
|
|
void
|
2000-01-26 01:46:56 +08:00
|
|
|
gimp_toggle_button_sensitive_update (GtkToggleButton *toggle_button)
|
2000-01-13 23:39:26 +08:00
|
|
|
{
|
|
|
|
GtkWidget *set_sensitive;
|
2000-01-26 01:46:56 +08:00
|
|
|
gboolean active;
|
2000-01-13 23:39:26 +08:00
|
|
|
|
2000-01-26 01:46:56 +08:00
|
|
|
active = gtk_toggle_button_get_active (toggle_button);
|
2000-01-13 23:39:26 +08:00
|
|
|
|
2003-08-17 03:46:59 +08:00
|
|
|
set_sensitive =
|
2001-07-31 19:33:13 +08:00
|
|
|
g_object_get_data (G_OBJECT (toggle_button), "set_sensitive");
|
2000-01-13 23:39:26 +08:00
|
|
|
while (set_sensitive)
|
|
|
|
{
|
2000-02-01 04:47:44 +08:00
|
|
|
gtk_widget_set_sensitive (set_sensitive, active);
|
2000-01-13 23:39:26 +08:00
|
|
|
set_sensitive =
|
2001-07-31 19:33:13 +08:00
|
|
|
g_object_get_data (G_OBJECT (set_sensitive), "set_sensitive");
|
2000-01-13 23:39:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
set_sensitive =
|
2001-07-31 19:33:13 +08:00
|
|
|
g_object_get_data (G_OBJECT (toggle_button), "inverse_sensitive");
|
2000-01-13 23:39:26 +08:00
|
|
|
while (set_sensitive)
|
|
|
|
{
|
2000-02-01 04:47:44 +08:00
|
|
|
gtk_widget_set_sensitive (set_sensitive, ! active);
|
2000-01-13 23:39:26 +08:00
|
|
|
set_sensitive =
|
2001-07-31 19:33:13 +08:00
|
|
|
g_object_get_data (G_OBJECT (set_sensitive), "inverse_sensitive");
|
2000-01-13 23:39:26 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-02-19 03:59:02 +08:00
|
|
|
/**
|
|
|
|
* gimp_toggle_button_update:
|
2000-02-23 23:52:33 +08:00
|
|
|
* @widget: A #GtkToggleButton.
|
2000-11-28 01:09:53 +08:00
|
|
|
* @data: A pointer to a #gint variable which will store the value of
|
|
|
|
* gtk_toggle_button_get_active().
|
2000-02-23 23:52:33 +08:00
|
|
|
*
|
|
|
|
* Note that this function calls gimp_toggle_button_sensitive_update().
|
2000-11-18 08:25:42 +08:00
|
|
|
**/
|
2000-01-26 01:46:56 +08:00
|
|
|
void
|
|
|
|
gimp_toggle_button_update (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
gint *toggle_val;
|
|
|
|
|
|
|
|
toggle_val = (gint *) data;
|
|
|
|
|
|
|
|
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
|
|
|
|
*toggle_val = TRUE;
|
|
|
|
else
|
|
|
|
*toggle_val = FALSE;
|
|
|
|
|
|
|
|
gimp_toggle_button_sensitive_update (GTK_TOGGLE_BUTTON (widget));
|
|
|
|
}
|
|
|
|
|
2000-02-19 03:59:02 +08:00
|
|
|
/**
|
|
|
|
* gimp_radio_button_update:
|
2000-02-23 23:52:33 +08:00
|
|
|
* @widget: A #GtkRadioButton.
|
2000-11-28 01:09:53 +08:00
|
|
|
* @data: A pointer to a #gint variable which will store the value of
|
2003-02-07 05:17:12 +08:00
|
|
|
* GPOINTER_TO_INT (g_object_get_data (@widget, "gimp-item-data")).
|
2000-02-23 23:52:33 +08:00
|
|
|
*
|
|
|
|
* Note that this function calls gimp_toggle_button_sensitive_update().
|
2000-11-18 08:25:42 +08:00
|
|
|
**/
|
2000-01-13 23:39:26 +08:00
|
|
|
void
|
|
|
|
gimp_radio_button_update (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
gint *toggle_val;
|
|
|
|
|
2000-01-26 01:46:56 +08:00
|
|
|
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
|
2000-01-13 23:39:26 +08:00
|
|
|
{
|
|
|
|
toggle_val = (gint *) data;
|
|
|
|
|
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-25 05:27:11 +08:00
|
|
|
*toggle_val = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget),
|
2001-11-22 21:01:26 +08:00
|
|
|
"gimp-item-data"));
|
2000-01-13 23:39:26 +08:00
|
|
|
}
|
2000-01-26 01:46:56 +08:00
|
|
|
|
|
|
|
gimp_toggle_button_sensitive_update (GTK_TOGGLE_BUTTON (widget));
|
2000-01-13 23:39:26 +08:00
|
|
|
}
|
|
|
|
|
2000-02-19 03:59:02 +08:00
|
|
|
/**
|
|
|
|
* gimp_int_adjustment_update:
|
2000-02-23 23:52:33 +08:00
|
|
|
* @adjustment: A #GtkAdjustment.
|
2000-11-28 01:09:53 +08:00
|
|
|
* @data: A pointer to a #gint variable which will store the
|
|
|
|
* @adjustment's value.
|
2000-02-23 23:52:33 +08:00
|
|
|
*
|
2003-02-26 20:48:48 +08:00
|
|
|
* Note that the #GtkAdjustment's value (which is a #gdouble) will be
|
|
|
|
* rounded with RINT().
|
2000-11-18 08:25:42 +08:00
|
|
|
**/
|
2000-01-13 23:39:26 +08:00
|
|
|
void
|
|
|
|
gimp_int_adjustment_update (GtkAdjustment *adjustment,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
gint *val;
|
|
|
|
|
|
|
|
val = (gint *) data;
|
2000-11-28 01:09:53 +08:00
|
|
|
*val = RINT (adjustment->value);
|
2000-01-13 23:39:26 +08:00
|
|
|
}
|
|
|
|
|
2000-05-21 02:39:02 +08:00
|
|
|
/**
|
|
|
|
* gimp_uint_adjustment_update:
|
|
|
|
* @adjustment: A #GtkAdjustment.
|
2000-11-28 01:09:53 +08:00
|
|
|
* @data: A pointer to a #guint variable which will store the
|
|
|
|
* @adjustment's value.
|
2000-05-21 02:39:02 +08:00
|
|
|
*
|
2003-02-26 20:48:48 +08:00
|
|
|
* Note that the #GtkAdjustment's value (which is a #gdouble) will be rounded
|
2000-05-21 02:39:02 +08:00
|
|
|
* with (#guint) (value + 0.5).
|
2000-11-18 08:25:42 +08:00
|
|
|
**/
|
2000-05-21 02:39:02 +08:00
|
|
|
void
|
|
|
|
gimp_uint_adjustment_update (GtkAdjustment *adjustment,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
guint *val;
|
|
|
|
|
|
|
|
val = (guint *) data;
|
|
|
|
*val = (guint) (adjustment->value + 0.5);
|
|
|
|
}
|
|
|
|
|
2000-02-19 03:59:02 +08:00
|
|
|
/**
|
|
|
|
* gimp_float_adjustment_update:
|
2000-02-23 23:52:33 +08:00
|
|
|
* @adjustment: A #GtkAdjustment.
|
2003-02-26 20:48:48 +08:00
|
|
|
* @data: A pointer to a #gfloat varaiable which will store the
|
2000-11-28 01:09:53 +08:00
|
|
|
* @adjustment's value.
|
2000-11-18 08:25:42 +08:00
|
|
|
**/
|
2000-01-15 23:32:28 +08:00
|
|
|
void
|
|
|
|
gimp_float_adjustment_update (GtkAdjustment *adjustment,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
gfloat *val;
|
|
|
|
|
|
|
|
val = (gfloat *) data;
|
|
|
|
*val = adjustment->value;
|
|
|
|
}
|
|
|
|
|
2000-02-19 03:59:02 +08:00
|
|
|
/**
|
|
|
|
* gimp_double_adjustment_update:
|
2000-02-23 23:52:33 +08:00
|
|
|
* @adjustment: A #GtkAdjustment.
|
2000-11-28 01:09:53 +08:00
|
|
|
* @data: A pointer to a #gdouble variable which will store the
|
|
|
|
* @adjustment's value.
|
2000-11-18 08:25:42 +08:00
|
|
|
**/
|
2000-01-13 23:39:26 +08:00
|
|
|
void
|
|
|
|
gimp_double_adjustment_update (GtkAdjustment *adjustment,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
gdouble *val;
|
|
|
|
|
|
|
|
val = (gdouble *) data;
|
|
|
|
*val = adjustment->value;
|
|
|
|
}
|
|
|
|
|
2000-02-19 03:59:02 +08:00
|
|
|
/**
|
|
|
|
* gimp_unit_menu_update:
|
2000-02-23 23:52:33 +08:00
|
|
|
* @widget: A #GimpUnitMenu.
|
2000-11-28 01:09:53 +08:00
|
|
|
* @data: A pointer to a #GimpUnit variable which will store the unit menu's
|
|
|
|
* value.
|
2000-02-23 23:52:33 +08:00
|
|
|
*
|
|
|
|
* This callback can set the number of decimal digits of an arbitrary number
|
|
|
|
* of #GtkSpinButton's. To use this functionality, attach the spinbuttons
|
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-25 05:27:11 +08:00
|
|
|
* as list of data pointers attached with g_object_set_data() with the
|
2000-02-23 23:52:33 +08:00
|
|
|
* "set_digits" key.
|
|
|
|
*
|
|
|
|
* See gimp_toggle_button_sensitive_update() for a description of how
|
|
|
|
* to set up the list.
|
2000-11-18 08:25:42 +08:00
|
|
|
**/
|
2000-01-14 20:41:00 +08:00
|
|
|
void
|
|
|
|
gimp_unit_menu_update (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2000-02-08 04:35:13 +08:00
|
|
|
GimpUnit *val;
|
2000-01-14 20:41:00 +08:00
|
|
|
GtkWidget *spinbutton;
|
|
|
|
gint digits;
|
|
|
|
|
2000-02-08 04:35:13 +08:00
|
|
|
val = (GimpUnit *) data;
|
2000-01-14 20:41:00 +08:00
|
|
|
*val = gimp_unit_menu_get_unit (GIMP_UNIT_MENU (widget));
|
|
|
|
|
2000-02-08 04:35:13 +08:00
|
|
|
digits = ((*val == GIMP_UNIT_PIXEL) ? 0 :
|
|
|
|
((*val == GIMP_UNIT_PERCENT) ? 2 :
|
2003-11-16 06:53:28 +08:00
|
|
|
(MIN (6, MAX (3, gimp_unit_get_digits (*val))))));
|
2000-01-14 20:41:00 +08:00
|
|
|
|
2003-10-01 07:19:48 +08:00
|
|
|
digits += gimp_unit_menu_get_pixel_digits (GIMP_UNIT_MENU (widget));
|
|
|
|
|
2001-07-31 19:33:13 +08:00
|
|
|
spinbutton = g_object_get_data (G_OBJECT (widget), "set_digits");
|
2000-01-14 20:41:00 +08:00
|
|
|
while (spinbutton)
|
|
|
|
{
|
|
|
|
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spinbutton), digits);
|
2001-07-31 19:33:13 +08:00
|
|
|
spinbutton = g_object_get_data (G_OBJECT (spinbutton), "set_digits");
|
2000-01-14 20:41:00 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-01-11 06:49:45 +08:00
|
|
|
|
2000-01-13 23:39:26 +08:00
|
|
|
/*
|
2000-01-27 09:22:27 +08:00
|
|
|
* Helper Functions
|
2000-01-13 23:39:26 +08:00
|
|
|
*/
|
|
|
|
|
2000-02-19 03:59:02 +08:00
|
|
|
/**
|
|
|
|
* gimp_table_attach_aligned:
|
2000-11-28 01:09:53 +08:00
|
|
|
* @table: The #GtkTable the widgets will be attached to.
|
|
|
|
* @column: The column to start with.
|
2002-03-09 02:30:40 +08:00
|
|
|
* @row: The row to attach the widgets.
|
2003-02-07 05:17:12 +08:00
|
|
|
* @label_text: The text for the #GtkLabel which will be attached left of
|
|
|
|
* the widget.
|
2000-11-28 01:09:53 +08:00
|
|
|
* @xalign: The horizontal alignment of the #GtkLabel.
|
|
|
|
* @yalign: The vertival alignment of the #GtkLabel.
|
|
|
|
* @widget: The #GtkWidget to attach right of the label.
|
|
|
|
* @colspan: The number of columns the widget will use.
|
2003-02-07 05:17:12 +08:00
|
|
|
* @left_align: %TRUE if the widget should be left-aligned.
|
2000-02-23 23:52:33 +08:00
|
|
|
*
|
2003-02-07 05:17:12 +08:00
|
|
|
* Note that the @label_text can be %NULL and that the widget will be
|
|
|
|
* attached starting at (@column + 1) in this case, too.
|
2002-03-09 02:30:40 +08:00
|
|
|
*
|
|
|
|
* Returns: The created #GtkLabel.
|
2000-11-18 08:25:42 +08:00
|
|
|
**/
|
2002-03-09 02:30:40 +08:00
|
|
|
GtkWidget *
|
2000-11-18 08:25:42 +08:00
|
|
|
gimp_table_attach_aligned (GtkTable *table,
|
|
|
|
gint column,
|
|
|
|
gint row,
|
|
|
|
const gchar *label_text,
|
|
|
|
gfloat xalign,
|
|
|
|
gfloat yalign,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gint colspan,
|
|
|
|
gboolean left_align)
|
2000-01-28 03:26:00 +08:00
|
|
|
{
|
2002-03-09 02:30:40 +08:00
|
|
|
GtkWidget *label = NULL;
|
|
|
|
|
2000-01-28 03:26:00 +08:00
|
|
|
if (label_text)
|
|
|
|
{
|
2002-05-08 08:30:26 +08:00
|
|
|
label = gtk_label_new_with_mnemonic (label_text);
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), xalign, yalign);
|
|
|
|
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_RIGHT);
|
2000-01-31 11:13:02 +08:00
|
|
|
gtk_table_attach (table, label,
|
|
|
|
column, column + 1,
|
2000-01-28 03:26:00 +08:00
|
|
|
row, row + 1,
|
2000-02-04 23:12:17 +08:00
|
|
|
GTK_FILL, GTK_FILL, 0, 0);
|
2000-01-28 03:26:00 +08:00
|
|
|
gtk_widget_show (label);
|
2002-05-08 08:30:26 +08:00
|
|
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget);
|
2000-01-28 03:26:00 +08:00
|
|
|
}
|
|
|
|
|
2000-01-31 11:13:02 +08:00
|
|
|
if (left_align)
|
2000-01-28 03:26:00 +08:00
|
|
|
{
|
2003-09-24 21:23:20 +08:00
|
|
|
GtkWidget *hbox = gtk_hbox_new (FALSE, 0);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
2003-09-24 21:23:20 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
|
2000-02-04 23:12:17 +08:00
|
|
|
gtk_widget_show (widget);
|
|
|
|
|
2003-09-24 21:23:20 +08:00
|
|
|
widget = hbox;
|
2000-01-28 03:26:00 +08:00
|
|
|
}
|
2000-02-04 23:12:17 +08:00
|
|
|
|
|
|
|
gtk_table_attach (table, widget,
|
|
|
|
column + 1, column + 1 + colspan,
|
|
|
|
row, row + 1,
|
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
2000-01-28 03:26:00 +08:00
|
|
|
|
|
|
|
gtk_widget_show (widget);
|
2002-03-09 02:30:40 +08:00
|
|
|
|
|
|
|
return label;
|
2000-01-28 03:26:00 +08:00
|
|
|
}
|
2004-06-21 21:18:50 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_label_set_attributes:
|
|
|
|
* @label: a #GtkLabel
|
|
|
|
* @...: a list of PangoAttrType and value pairs terminated by -1.
|
|
|
|
*
|
|
|
|
* Sets Pango attributes on a #GtkLabel in a more convenient way than
|
|
|
|
* gtk_label_set_attributes().
|
|
|
|
*
|
|
|
|
* This function is useful if you want to change the font attributes
|
|
|
|
* of a #GtkLabel. This is an alternative to using PangoMarkup which
|
|
|
|
* is slow to parse and akward to handle in an i18n-friendly way.
|
|
|
|
*
|
|
|
|
* The attributes are set on the complete label, from start to end. If
|
|
|
|
* you need to set attributes on part of the label, you will have to
|
|
|
|
* use the PangoAttributes API directly.
|
|
|
|
*
|
|
|
|
* Since: GIMP 2.2
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gimp_label_set_attributes (GtkLabel *label,
|
|
|
|
...)
|
|
|
|
{
|
|
|
|
PangoAttribute *attr = NULL;
|
|
|
|
PangoAttrList *attrs;
|
|
|
|
va_list args;
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_LABEL (label));
|
|
|
|
|
|
|
|
attrs = pango_attr_list_new ();
|
|
|
|
|
|
|
|
va_start (args, label);
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
PangoAttrType attr_type = va_arg (args, PangoAttrType);
|
|
|
|
|
|
|
|
switch (attr_type)
|
|
|
|
{
|
|
|
|
case PANGO_ATTR_LANGUAGE:
|
|
|
|
attr = pango_attr_language_new (va_arg (args, PangoLanguage *));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PANGO_ATTR_FAMILY:
|
|
|
|
attr = pango_attr_family_new (va_arg (args, const gchar *));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PANGO_ATTR_STYLE:
|
|
|
|
attr = pango_attr_style_new (va_arg (args, PangoStyle));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PANGO_ATTR_WEIGHT:
|
|
|
|
attr = pango_attr_weight_new (va_arg (args, PangoWeight));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PANGO_ATTR_VARIANT:
|
|
|
|
attr = pango_attr_variant_new (va_arg (args, PangoVariant));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PANGO_ATTR_STRETCH:
|
|
|
|
attr = pango_attr_stretch_new (va_arg (args, PangoStretch));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PANGO_ATTR_SIZE:
|
|
|
|
attr = pango_attr_stretch_new (va_arg (args, gint));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PANGO_ATTR_FONT_DESC:
|
|
|
|
attr = pango_attr_font_desc_new (va_arg (args,
|
|
|
|
const PangoFontDescription *));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PANGO_ATTR_FOREGROUND:
|
|
|
|
{
|
|
|
|
const PangoColor *color = va_arg (args, const PangoColor *);
|
|
|
|
|
|
|
|
attr = pango_attr_foreground_new (color->red,
|
|
|
|
color->green,
|
|
|
|
color->blue);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PANGO_ATTR_BACKGROUND:
|
|
|
|
{
|
|
|
|
const PangoColor *color = va_arg (args, const PangoColor *);
|
|
|
|
|
|
|
|
attr = pango_attr_background_new (color->red,
|
|
|
|
color->green,
|
|
|
|
color->blue);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PANGO_ATTR_UNDERLINE:
|
|
|
|
attr = pango_attr_underline_new (va_arg (args, PangoUnderline));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PANGO_ATTR_STRIKETHROUGH:
|
|
|
|
attr = pango_attr_underline_new (va_arg (args, gboolean));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PANGO_ATTR_RISE:
|
|
|
|
attr = pango_attr_rise_new (va_arg (args, gint));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PANGO_ATTR_SCALE:
|
|
|
|
attr = pango_attr_scale_new (va_arg (args, gdouble));
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
g_warning ("%s: invalid PangoAttribute type %d",
|
|
|
|
G_STRFUNC, attr_type);
|
|
|
|
case -1:
|
|
|
|
case PANGO_ATTR_INVALID:
|
|
|
|
attr = NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (attr)
|
|
|
|
{
|
|
|
|
attr->start_index = 0;
|
|
|
|
attr->end_index = -1;
|
|
|
|
pango_attr_list_insert (attrs, attr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (attr);
|
|
|
|
|
|
|
|
va_end (args);
|
|
|
|
|
|
|
|
gtk_label_set_attributes (label, attrs);
|
|
|
|
pango_attr_list_unref (attrs);
|
|
|
|
}
|