mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-21 03:52:33 +00:00
register GimpConvertPaletteType with the type system.
2004-10-14 Michael Natterer <mitch@gimp.org> * app/core/core-enums.[ch]: register GimpConvertPaletteType with the type system. * app/widgets/gimpwidgets-utils.c (gimp_enum_radio_frame_add): fixed to insert the widget at the right place in the radio box. * app/dialogs/convert-dialog.c: use enum widgets and gimp_enum_radio_frame_add(), resulting in a much better looking dialog with much less lines of code.
This commit is contained in:
parent
ca5ccbd235
commit
1e4203e665
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2004-10-14 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/core/core-enums.[ch]: register GimpConvertPaletteType with
|
||||
the type system.
|
||||
|
||||
* app/widgets/gimpwidgets-utils.c (gimp_enum_radio_frame_add):
|
||||
fixed to insert the widget at the right place in the radio box.
|
||||
|
||||
* app/dialogs/convert-dialog.c: use enum widgets and
|
||||
gimp_enum_radio_frame_add(), resulting in a much better looking
|
||||
dialog with much less lines of code.
|
||||
|
||||
2004-10-14 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/helpbrowser/dialog.c: changed "Home" button to "Index".
|
||||
|
|
|
@ -133,10 +133,10 @@ gimp_convert_dither_type_get_type (void)
|
|||
{
|
||||
static const GEnumValue values[] =
|
||||
{
|
||||
{ GIMP_NO_DITHER, N_("No color dithering"), "no-dither" },
|
||||
{ GIMP_FS_DITHER, N_("Floyd-Steinberg color dithering (normal)"), "fs-dither" },
|
||||
{ GIMP_FSLOWBLEED_DITHER, N_("Floyd-Steinberg color dithering (reduced color bleeding)"), "fslowbleed-dither" },
|
||||
{ GIMP_FIXED_DITHER, N_("Positioned color dithering"), "fixed-dither" },
|
||||
{ GIMP_NO_DITHER, N_("None"), "no-dither" },
|
||||
{ GIMP_FS_DITHER, N_("Floyd-Steinberg (normal)"), "fs-dither" },
|
||||
{ GIMP_FSLOWBLEED_DITHER, N_("Floyd-Steinberg (reduced color bleeding)"), "fslowbleed-dither" },
|
||||
{ GIMP_FIXED_DITHER, N_("Positioned"), "fixed-dither" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
|
@ -148,6 +148,26 @@ gimp_convert_dither_type_get_type (void)
|
|||
return type;
|
||||
}
|
||||
|
||||
GType
|
||||
gimp_convert_palette_type_get_type (void)
|
||||
{
|
||||
static const GEnumValue values[] =
|
||||
{
|
||||
{ GIMP_MAKE_PALETTE, N_("Generate optimum palette"), "make-palette" },
|
||||
{ GIMP_WEB_PALETTE, N_("Use web-optimized palette"), "web-palette" },
|
||||
{ GIMP_MONO_PALETTE, N_("Use black and white (1-bit) palette"), "mono-palette" },
|
||||
{ GIMP_CUSTOM_PALETTE, N_("Use custom palette"), "custom-palette" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
static GType type = 0;
|
||||
|
||||
if (! type)
|
||||
type = g_enum_register_static ("GimpConvertPaletteType", values);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
GType
|
||||
gimp_gravity_type_get_type (void)
|
||||
{
|
||||
|
|
|
@ -121,14 +121,28 @@ GType gimp_convert_dither_type_get_type (void) G_GNUC_CONST;
|
|||
|
||||
typedef enum
|
||||
{
|
||||
GIMP_NO_DITHER, /*< desc="No color dithering" >*/
|
||||
GIMP_FS_DITHER, /*< desc="Floyd-Steinberg color dithering (normal)" >*/
|
||||
GIMP_FSLOWBLEED_DITHER, /*< desc="Floyd-Steinberg color dithering (reduced color bleeding)" >*/
|
||||
GIMP_FIXED_DITHER, /*< desc="Positioned color dithering" >*/
|
||||
GIMP_NODESTRUCT_DITHER /*< pdb-skip, skip >*/
|
||||
GIMP_NO_DITHER, /*< desc="None" >*/
|
||||
GIMP_FS_DITHER, /*< desc="Floyd-Steinberg (normal)" >*/
|
||||
GIMP_FSLOWBLEED_DITHER, /*< desc="Floyd-Steinberg (reduced color bleeding)" >*/
|
||||
GIMP_FIXED_DITHER, /*< desc="Positioned" >*/
|
||||
GIMP_NODESTRUCT_DITHER /*< pdb-skip, skip >*/
|
||||
} GimpConvertDitherType;
|
||||
|
||||
|
||||
#define GIMP_TYPE_CONVERT_PALETTE_TYPE (gimp_convert_palette_type_get_type ())
|
||||
|
||||
GType gimp_convert_palette_type_get_type (void) G_GNUC_CONST;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GIMP_MAKE_PALETTE, /*< desc="Generate optimum palette" >*/
|
||||
GIMP_REUSE_PALETTE, /*< skip >*/
|
||||
GIMP_WEB_PALETTE, /*< desc="Use web-optimized palette" >*/
|
||||
GIMP_MONO_PALETTE, /*< desc="Use black and white (1-bit) palette" >*/
|
||||
GIMP_CUSTOM_PALETTE /*< desc="Use custom palette" >*/
|
||||
} GimpConvertPaletteType;
|
||||
|
||||
|
||||
#define GIMP_TYPE_GRAVITY_TYPE (gimp_gravity_type_get_type ())
|
||||
|
||||
GType gimp_gravity_type_get_type (void) G_GNUC_CONST;
|
||||
|
@ -577,15 +591,6 @@ typedef enum /*< pdb-skip, skip >*/
|
|||
GIMP_CONTEXT_PAINT_PROPS_MASK)
|
||||
} GimpContextPropMask;
|
||||
|
||||
typedef enum /*< skip >*/
|
||||
{
|
||||
GIMP_MAKE_PALETTE,
|
||||
GIMP_REUSE_PALETTE,
|
||||
GIMP_WEB_PALETTE,
|
||||
GIMP_MONO_PALETTE,
|
||||
GIMP_CUSTOM_PALETTE
|
||||
} GimpConvertPaletteType;
|
||||
|
||||
typedef enum /*< skip >*/
|
||||
{
|
||||
GIMP_GRADIENT_SEGMENT_LINEAR,
|
||||
|
|
|
@ -36,8 +36,10 @@
|
|||
|
||||
#include "widgets/gimpenumwidgets.h"
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
#include "widgets/gimpenumcombobox.h"
|
||||
#include "widgets/gimpviewablebox.h"
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
#include "widgets/gimpwidgets-utils.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
@ -52,7 +54,6 @@ typedef struct
|
|||
GimpContext *context;
|
||||
GimpContainer *container;
|
||||
GimpPalette *custom_palette;
|
||||
gboolean have_web_palette;
|
||||
|
||||
GimpConvertDitherType dither_type;
|
||||
gboolean alpha_dither;
|
||||
|
@ -100,7 +101,7 @@ convert_dialog_new (GimpImage *gimage,
|
|||
GtkWidget *frame;
|
||||
GtkWidget *toggle;
|
||||
GtkWidget *palette_box;
|
||||
GSList *group = NULL;
|
||||
GtkWidget *combo;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (parent), NULL);
|
||||
|
@ -108,14 +109,13 @@ convert_dialog_new (GimpImage *gimage,
|
|||
|
||||
dialog = g_new0 (IndexedDialog, 1);
|
||||
|
||||
dialog->gimage = gimage;
|
||||
dialog->progress = progress;
|
||||
|
||||
dialog->dither_type = saved_dither_type;
|
||||
dialog->alpha_dither = saved_alpha_dither;
|
||||
dialog->remove_dups = saved_remove_dups;
|
||||
dialog->num_colors = saved_num_colors;
|
||||
dialog->palette_type = saved_palette_type;
|
||||
dialog->gimage = gimage;
|
||||
dialog->progress = progress;
|
||||
dialog->dither_type = saved_dither_type;
|
||||
dialog->alpha_dither = saved_alpha_dither;
|
||||
dialog->remove_dups = saved_remove_dups;
|
||||
dialog->num_colors = saved_num_colors;
|
||||
dialog->palette_type = saved_palette_type;
|
||||
|
||||
dialog->shell =
|
||||
gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage),
|
||||
|
@ -158,160 +158,96 @@ convert_dialog_new (GimpImage *gimage,
|
|||
main_vbox);
|
||||
gtk_widget_show (main_vbox);
|
||||
|
||||
frame = gimp_frame_new (_("General Palette Options"));
|
||||
|
||||
/* palette */
|
||||
|
||||
frame = gimp_enum_radio_frame_new (GIMP_TYPE_CONVERT_PALETTE_TYPE,
|
||||
gtk_label_new (_("Palette")), 2,
|
||||
G_CALLBACK (gimp_radio_button_update),
|
||||
&dialog->palette_type,
|
||||
&toggle);
|
||||
gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (toggle),
|
||||
dialog->palette_type);
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
/* 'generate palette' */
|
||||
/* max n_colors */
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
gimp_enum_radio_frame_add (GTK_FRAME (frame), hbox, GIMP_MAKE_PALETTE);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
toggle = gtk_radio_button_new_with_label (NULL,
|
||||
_("Generate optimum palette:"));
|
||||
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (toggle));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), toggle, FALSE, FALSE, 0);
|
||||
gtk_widget_show (toggle);
|
||||
|
||||
g_object_set_data (G_OBJECT (toggle), "gimp-item-data",
|
||||
GINT_TO_POINTER (GIMP_MAKE_PALETTE));
|
||||
g_signal_connect (toggle, "toggled",
|
||||
G_CALLBACK (gimp_radio_button_update),
|
||||
&dialog->palette_type);
|
||||
label = gtk_label_new_with_mnemonic (_("_Maximum number of colors:"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
if (dialog->num_colors == 256 && gimp_image_has_alpha (gimage))
|
||||
dialog->num_colors = 255;
|
||||
|
||||
spinbutton = gimp_spin_button_new (&adjustment, dialog->num_colors,
|
||||
2, 256, 1, 8, 0, 1, 0);
|
||||
gtk_box_pack_end (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), spinbutton);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
|
||||
gtk_widget_show (spinbutton);
|
||||
|
||||
g_signal_connect (adjustment, "value_changed",
|
||||
G_CALLBACK (gimp_int_adjustment_update),
|
||||
&dialog->num_colors);
|
||||
|
||||
label = gtk_label_new (_("Max. number of colors:"));
|
||||
gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (spinbutton), dialog->num_colors);
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (label), dialog->num_colors);
|
||||
g_object_set_data (G_OBJECT (toggle), "set_sensitive", spinbutton);
|
||||
g_object_set_data (G_OBJECT (spinbutton), "set_sensitive", label);
|
||||
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
if (! dialog->have_web_palette)
|
||||
/* custom palette */
|
||||
if (palette_box)
|
||||
{
|
||||
/* 'web palette'
|
||||
* Only presented as an option to the user if they do not
|
||||
* already have the 'Web' GIMP palette installed on their
|
||||
* system.
|
||||
*/
|
||||
toggle = gtk_radio_button_new_with_label (group,
|
||||
_("Use WWW-Optimized Palette"));
|
||||
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (toggle));
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
gimp_enum_radio_frame_add (GTK_FRAME (frame), vbox, GIMP_CUSTOM_PALETTE);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), palette_box, FALSE, FALSE, 0);
|
||||
gtk_widget_show (palette_box);
|
||||
|
||||
toggle = gtk_check_button_new_with_mnemonic (_("_Remove unused colors "
|
||||
"from final palette"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
||||
dialog->remove_dups);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
|
||||
gtk_widget_show (toggle);
|
||||
|
||||
g_object_set_data (G_OBJECT (toggle), "gimp-item-data",
|
||||
GINT_TO_POINTER (GIMP_WEB_PALETTE));
|
||||
g_signal_connect (toggle, "toggled",
|
||||
G_CALLBACK (gimp_radio_button_update),
|
||||
&dialog->palette_type);
|
||||
}
|
||||
|
||||
/* 'mono palette' */
|
||||
toggle = gtk_radio_button_new_with_label (group, _("Use black and "
|
||||
"white (1-bit) palette"));
|
||||
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (toggle));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
|
||||
gtk_widget_show (toggle);
|
||||
|
||||
g_object_set_data (G_OBJECT (toggle), "gimp-item-data",
|
||||
GINT_TO_POINTER (GIMP_MONO_PALETTE));
|
||||
g_signal_connect (toggle, "toggled",
|
||||
G_CALLBACK (gimp_radio_button_update),
|
||||
&dialog->palette_type);
|
||||
|
||||
/* 'custom' palette from dialog */
|
||||
if (palette_box)
|
||||
{
|
||||
GtkWidget *remove_toggle;
|
||||
|
||||
remove_toggle = gtk_check_button_new_with_label (_("Remove unused colors "
|
||||
"from final palette"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (remove_toggle),
|
||||
dialog->remove_dups);
|
||||
g_signal_connect (remove_toggle, "toggled",
|
||||
G_CALLBACK (gimp_toggle_button_update),
|
||||
&dialog->remove_dups);
|
||||
|
||||
/* 'custom' palette from dialog */
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
toggle = gtk_radio_button_new_with_label (group,
|
||||
_("Use custom palette:"));
|
||||
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (toggle));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), toggle, FALSE, FALSE, 0);
|
||||
gtk_widget_show (toggle);
|
||||
|
||||
g_object_set_data (G_OBJECT (toggle), "gimp-item-data",
|
||||
GINT_TO_POINTER (GIMP_CUSTOM_PALETTE));
|
||||
g_signal_connect (toggle, "toggled",
|
||||
G_CALLBACK (gimp_radio_button_update),
|
||||
&dialog->palette_type);
|
||||
g_object_set_data (G_OBJECT (toggle), "set_sensitive", remove_toggle);
|
||||
|
||||
gtk_box_pack_end (GTK_BOX (hbox), palette_box, TRUE, TRUE, 0);
|
||||
gtk_widget_show (palette_box);
|
||||
|
||||
gtk_widget_set_sensitive (remove_toggle,
|
||||
dialog->palette_type == GIMP_CUSTOM_PALETTE);
|
||||
gtk_widget_set_sensitive (palette_box,
|
||||
dialog->palette_type == GIMP_CUSTOM_PALETTE);
|
||||
g_object_set_data (G_OBJECT (toggle), "set_sensitive", remove_toggle);
|
||||
g_object_set_data (G_OBJECT (remove_toggle), "set_sensitive",
|
||||
palette_box);
|
||||
|
||||
/* add the remove-duplicates toggle */
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), remove_toggle, TRUE, TRUE, 20);
|
||||
gtk_widget_show (remove_toggle);
|
||||
}
|
||||
|
||||
gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (toggle),
|
||||
dialog->palette_type);
|
||||
|
||||
/* the dither type */
|
||||
frame = gimp_frame_new (_("Dithering Options"));
|
||||
/* dithering */
|
||||
|
||||
frame = gimp_frame_new (_("Dithering"));
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
vbox = gimp_enum_radio_box_new (GIMP_TYPE_CONVERT_DITHER_TYPE,
|
||||
G_CALLBACK (gimp_radio_button_update),
|
||||
&dialog->dither_type,
|
||||
&toggle);
|
||||
gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (toggle),
|
||||
dialog->dither_type);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
vbox = gtk_vbox_new (FALSE, 6);
|
||||
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
||||
gtk_widget_show(vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
label = gtk_label_new_with_mnemonic (_("Color _dithering:"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
combo = gimp_enum_combo_box_new (GIMP_TYPE_CONVERT_DITHER_TYPE);
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0);
|
||||
gtk_widget_show (combo);
|
||||
|
||||
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo),
|
||||
dialog->dither_type,
|
||||
G_CALLBACK (gimp_int_combo_box_get_active),
|
||||
&dialog->dither_type);
|
||||
|
||||
/* the alpha-dither toggle */
|
||||
toggle =
|
||||
gtk_check_button_new_with_label (_("Enable dithering of transparency"));
|
||||
gtk_check_button_new_with_mnemonic (_("Enable dithering of _transparency"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
||||
dialog->alpha_dither);
|
||||
dialog->alpha_dither);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
|
||||
gtk_widget_show (toggle);
|
||||
|
||||
|
@ -376,8 +312,6 @@ convert_dialog_palette_box (IndexedDialog *dialog)
|
|||
|
||||
gimp = dialog->gimage->gimp;
|
||||
|
||||
dialog->have_web_palette = FALSE;
|
||||
|
||||
/* We can't dither to > 256 colors */
|
||||
dialog->container = gimp_container_filter (gimp->palette_factory->container,
|
||||
convert_dialog_palette_filter,
|
||||
|
@ -402,7 +336,6 @@ convert_dialog_palette_box (IndexedDialog *dialog)
|
|||
g_ascii_strcasecmp (GIMP_OBJECT (palette)->name, "Web") == 0)
|
||||
{
|
||||
web_palette = palette;
|
||||
dialog->have_web_palette = TRUE;
|
||||
}
|
||||
|
||||
if (saved_palette == palette)
|
||||
|
|
|
@ -229,66 +229,76 @@ gimp_enum_radio_frame_add (GtkFrame *frame,
|
|||
GtkWidget *widget,
|
||||
gint enum_value)
|
||||
{
|
||||
GtkWidget *radio;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *spacer;
|
||||
gint indicator_size;
|
||||
gint indicator_spacing;
|
||||
gint focus_width;
|
||||
gint focus_padding;
|
||||
GSList *list;
|
||||
GtkWidget *vbox;
|
||||
GList *children;
|
||||
GList *list;
|
||||
gint pos;
|
||||
|
||||
g_return_if_fail (GTK_IS_FRAME (frame));
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
|
||||
radio = g_object_get_data (G_OBJECT (frame), "radio-button");
|
||||
vbox = gtk_bin_get_child (GTK_BIN (frame));
|
||||
|
||||
g_return_if_fail (GTK_IS_RADIO_BUTTON (radio));
|
||||
g_return_if_fail (GTK_IS_VBOX (vbox));
|
||||
|
||||
gtk_widget_style_get (radio,
|
||||
"indicator-size", &indicator_size,
|
||||
"indicator-spacing", &indicator_spacing,
|
||||
"focus-line-width", &focus_width,
|
||||
"focus-padding", &focus_padding,
|
||||
NULL);
|
||||
children = gtk_container_get_children (GTK_CONTAINER (vbox));
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
|
||||
spacer = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_set_size_request (spacer,
|
||||
indicator_size +
|
||||
3 * indicator_spacing +
|
||||
focus_width +
|
||||
focus_padding +
|
||||
GTK_CONTAINER (radio)->border_width,
|
||||
-1);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), spacer, FALSE, FALSE, 0);
|
||||
gtk_widget_show (spacer);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
for (list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio));
|
||||
for (list = children, pos = 1;
|
||||
list;
|
||||
list = g_slist_next (list))
|
||||
list = g_list_next (list), pos++)
|
||||
{
|
||||
if (GPOINTER_TO_INT (g_object_get_data (list->data, "gimp-item-data")) ==
|
||||
if (GTK_IS_RADIO_BUTTON (list->data) &&
|
||||
GPOINTER_TO_INT (g_object_get_data (list->data, "gimp-item-data")) ==
|
||||
enum_value)
|
||||
{
|
||||
g_object_set_data (list->data, "set_sensitive", hbox);
|
||||
g_signal_connect (list->data, "toggled",
|
||||
GtkWidget *radio = list->data;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *spacer;
|
||||
gint indicator_size;
|
||||
gint indicator_spacing;
|
||||
gint focus_width;
|
||||
gint focus_padding;
|
||||
|
||||
gtk_widget_style_get (radio,
|
||||
"indicator-size", &indicator_size,
|
||||
"indicator-spacing", &indicator_spacing,
|
||||
"focus-line-width", &focus_width,
|
||||
"focus-padding", &focus_padding,
|
||||
NULL);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
|
||||
spacer = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_set_size_request (spacer,
|
||||
indicator_size +
|
||||
3 * indicator_spacing +
|
||||
focus_width +
|
||||
focus_padding +
|
||||
GTK_CONTAINER (radio)->border_width,
|
||||
-1);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), spacer, FALSE, FALSE, 0);
|
||||
gtk_widget_show (spacer);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
g_object_set_data (G_OBJECT (radio), "set_sensitive", hbox);
|
||||
g_signal_connect (radio, "toggled",
|
||||
G_CALLBACK (gimp_toggle_button_sensitive_update),
|
||||
NULL);
|
||||
|
||||
gtk_widget_set_sensitive (hbox,
|
||||
GTK_TOGGLE_BUTTON (list->data)->active);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_box_reorder_child (GTK_BOX (vbox), hbox, pos);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (GTK_BIN (frame)->child), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
g_list_free (children);
|
||||
}
|
||||
|
||||
GtkIconSize
|
||||
|
|
Loading…
Reference in a new issue