add gimp_int_option_menu_set_history as a wrapper for

2003-11-14  Manish Singh  <yosh@gimp.org>

        * libgimpwidgets/gimpwidgets.[ch]: add gimp_int_option_menu_set_history
        as a wrapper for gimp_option_menu_set_history.

        * app/gui/brush-select.c
        * app/gui/resize-dialog.c
        * app/tools/gimpcurvestool.c
        * app/widgets/gimppropwidgets.c
        * app/widgets/gimplayertreeview.c
        * app/widgets/gimpcolorframe.c
        * libgimpwidgets/gimpmemsizeentry.c
        * modules/cdisplay_colorblind.c: use the above.
This commit is contained in:
Manish Singh 2003-11-14 19:02:24 +00:00 committed by Manish Singh
parent 4961608004
commit 178c225318
13 changed files with 61 additions and 31 deletions

View File

@ -1,6 +1,20 @@
2003-11-14 Manish Singh <yosh@gimp.org>
* libgimpwidgets/gimpwidgets.[ch]: implementedgimp_int_option_menu_new
* libgimpwidgets/gimpwidgets.[ch]: add gimp_int_option_menu_set_history
as a wrapper for gimp_option_menu_set_history.
* app/gui/brush-select.c
* app/gui/resize-dialog.c
* app/tools/gimpcurvestool.c
* app/widgets/gimppropwidgets.c
* app/widgets/gimplayertreeview.c
* app/widgets/gimpcolorframe.c
* libgimpwidgets/gimpmemsizeentry.c
* modules/cdisplay_colorblind.c: use the above.
2003-11-14 Manish Singh <yosh@gimp.org>
* libgimpwidgets/gimpwidgets.[ch]: implemented gimp_int_option_menu_new
and gimp_int_radio_group_new, which are the same as
gimp_option_menu_new2 and gimp_radio_group_new2, but they take
integers as values to map instead of gpointers, which avoids casts

View File

@ -712,8 +712,8 @@ resize_widget_new (GimpViewable *viewable,
gimp_enum_option_menu_new (GIMP_TYPE_INTERPOLATION_TYPE,
G_CALLBACK (gimp_menu_item_update),
&resize->interpolation);
gimp_option_menu_set_history (GTK_OPTION_MENU (option_menu),
GINT_TO_POINTER (resize->interpolation));
gimp_int_option_menu_set_history (GTK_OPTION_MENU (option_menu),
resize->interpolation);
gtk_box_pack_start (GTK_BOX (hbox), option_menu,
FALSE, FALSE, 0);
gtk_widget_show (option_menu);
@ -879,8 +879,8 @@ response_callback (GtkWidget *widget,
resize->interpolation =
resize->gimage->gimp->config->interpolation_type;
gimp_option_menu_set_history (GTK_OPTION_MENU (private->interpolation_menu),
GINT_TO_POINTER (resize->interpolation));
gimp_int_option_menu_set_history (GTK_OPTION_MENU (private->interpolation_menu),
resize->interpolation);
}
break;

View File

@ -362,8 +362,8 @@ brush_select_paint_mode_changed (GimpContext *context,
GimpLayerModeEffects paint_mode,
BrushSelect *bsp)
{
gimp_option_menu_set_history (GTK_OPTION_MENU (bsp->option_menu),
GINT_TO_POINTER (paint_mode));
gimp_int_option_menu_set_history (GTK_OPTION_MENU (bsp->option_menu),
paint_mode);
brush_select_change_callbacks (bsp, FALSE);
}

View File

@ -712,8 +712,8 @@ resize_widget_new (GimpViewable *viewable,
gimp_enum_option_menu_new (GIMP_TYPE_INTERPOLATION_TYPE,
G_CALLBACK (gimp_menu_item_update),
&resize->interpolation);
gimp_option_menu_set_history (GTK_OPTION_MENU (option_menu),
GINT_TO_POINTER (resize->interpolation));
gimp_int_option_menu_set_history (GTK_OPTION_MENU (option_menu),
resize->interpolation);
gtk_box_pack_start (GTK_BOX (hbox), option_menu,
FALSE, FALSE, 0);
gtk_widget_show (option_menu);
@ -879,8 +879,8 @@ response_callback (GtkWidget *widget,
resize->interpolation =
resize->gimage->gimp->config->interpolation_type;
gimp_option_menu_set_history (GTK_OPTION_MENU (private->interpolation_menu),
GINT_TO_POINTER (resize->interpolation));
gimp_int_option_menu_set_history (GTK_OPTION_MENU (private->interpolation_menu),
resize->interpolation);
}
break;

View File

@ -311,8 +311,8 @@ gimp_curves_tool_initialize (GimpTool *tool,
c_tool);
/* set the current selection */
gimp_option_menu_set_history (GTK_OPTION_MENU (c_tool->channel_menu),
GINT_TO_POINTER (c_tool->channel));
gimp_int_option_menu_set_history (GTK_OPTION_MENU (c_tool->channel_menu),
c_tool->channel);
curves_update (c_tool, ALL);
}

View File

@ -154,8 +154,7 @@ gimp_color_frame_set_mode (GimpColorFrame *frame,
{
g_return_if_fail (GIMP_IS_COLOR_FRAME (frame));
gimp_option_menu_set_history (GTK_OPTION_MENU (frame->menu),
GINT_TO_POINTER (mode));
gimp_int_option_menu_set_history (GTK_OPTION_MENU (frame->menu), mode);
frame->frame_mode = mode;
gimp_color_frame_update (frame);

View File

@ -918,8 +918,8 @@ static void
gimp_layer_tree_view_update_options (GimpLayerTreeView *view,
GimpLayer *layer)
{
gimp_option_menu_set_history (GTK_OPTION_MENU (view->paint_mode_menu),
GINT_TO_POINTER (layer->mode));
gimp_int_option_menu_set_history (GTK_OPTION_MENU (view->paint_mode_menu),
layer->mode);
if (layer->preserve_trans !=
GTK_TOGGLE_BUTTON (view->preserve_trans_toggle)->active)

View File

@ -364,8 +364,7 @@ gimp_prop_enum_option_menu_new (GObject *config,
config);
}
gimp_option_menu_set_history (GTK_OPTION_MENU (menu),
GINT_TO_POINTER (value));
gimp_int_option_menu_set_history (GTK_OPTION_MENU (menu), value);
set_param_spec (G_OBJECT (menu), menu, param_spec);
@ -448,8 +447,7 @@ gimp_prop_option_menu_notify (GObject *config,
param_spec->name, &value,
NULL);
gimp_option_menu_set_history (GTK_OPTION_MENU (menu),
GINT_TO_POINTER (value));
gimp_int_option_menu_set_history (GTK_OPTION_MENU (menu), value);
}

View File

@ -254,8 +254,7 @@ gimp_memsize_entry_set_value (GimpMemsizeEntry *entry,
entry->shift = shift;
entry->value = value;
gimp_option_menu_set_history (GTK_OPTION_MENU (entry->menu),
GUINT_TO_POINTER (shift));
gimp_int_option_menu_set_history (GTK_OPTION_MENU (entry->menu), shift);
}
gtk_adjustment_set_value (entry->adjustment, value >> shift);

View File

@ -364,8 +364,7 @@ gimp_prop_enum_option_menu_new (GObject *config,
config);
}
gimp_option_menu_set_history (GTK_OPTION_MENU (menu),
GINT_TO_POINTER (value));
gimp_int_option_menu_set_history (GTK_OPTION_MENU (menu), value);
set_param_spec (G_OBJECT (menu), menu, param_spec);
@ -448,8 +447,7 @@ gimp_prop_option_menu_notify (GObject *config,
param_spec->name, &value,
NULL);
gimp_option_menu_set_history (GTK_OPTION_MENU (menu),
GINT_TO_POINTER (value));
gimp_int_option_menu_set_history (GTK_OPTION_MENU (menu), value);
}

View File

@ -417,6 +417,26 @@ gimp_option_menu_set_history (GtkOptionMenu *option_menu,
gtk_option_menu_set_history (option_menu, history);
}
/**
* gimp_int_option_menu_set_history:
* @option_menu: A #GtkOptionMenu as returned by gimp_int_option_menu_new().
* @item_data: The @item_data of the menu item you want to select.
*
* Iterates over all entries in a #GtkOptionMenu and selects the one with the
* matching @item_data. Probably only makes sense to use with a #GtkOptionMenu
* that was created using gimp_int_option_menu_new(). This just mirrors
* gimp_option_menu_set_history() like gimp_int_option_menu_new() mirrors
* gimp_option_menu_new2().
**/
void
gimp_int_option_menu_set_history (GtkOptionMenu *option_menu,
gint item_data)
{
g_return_if_fail (GTK_IS_OPTION_MENU (option_menu));
gimp_option_menu_set_history (option_menu, GINT_TO_POINTER (item_data));
}
/**
* gimp_option_menu_set_sensitive:
* @option_menu: a #GtkOptionMenu as returned by gimp_option_menu_new() or

View File

@ -99,8 +99,10 @@ GtkWidget * gimp_int_option_menu_new (gboolean menu_only,
...);
void gimp_option_menu_set_history (GtkOptionMenu *option_menu,
gpointer item_data);
void gimp_option_menu_set_history (GtkOptionMenu *option_menu,
gpointer item_data);
void gimp_int_option_menu_set_history (GtkOptionMenu *option_menu,
gint item_data);
typedef gboolean (*GimpOptionMenuSensitivityCallback) (gpointer item_data,
gpointer callback_data);

View File

@ -509,8 +509,8 @@ cdisplay_colorblind_configure_reset (GimpColorDisplay *display)
if (colorblind->optionmenu)
{
gimp_option_menu_set_history (GTK_OPTION_MENU (colorblind->optionmenu),
GINT_TO_POINTER (DEFAULT_DEFICIENCY));
gimp_int_option_menu_set_history (GTK_OPTION_MENU (colorblind->optionmenu),
DEFAULT_DEFICIENCY);
colorblind->deficiency = DEFAULT_DEFICIENCY;
gimp_color_display_changed (GIMP_COLOR_DISPLAY (colorblind));