mirror of https://github.com/GNOME/gimp.git
removed gimp_enum_combo_box_set_visible().
2005-03-01 Sven Neumann <sven@gimp.org> * libgimpwidgets/gimpenumcombobox.[ch]: removed gimp_enum_combo_box_set_visible(). * libgimpwidgets/gimpintcombobox.[ch]: added gimp_int_combo_box_set_sensitivity() instead. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c * app/widgets/gimphistogrameditor.c: changed accordingly. * libgimpwidgets/gimpenumstore.h: added padding for future expansion. * libgimpwidgets/gimpwidgets.def: updated.
This commit is contained in:
parent
ef724e7b6e
commit
49005d9bfd
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
||||||
|
2005-03-01 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* libgimpwidgets/gimpenumcombobox.[ch]: removed
|
||||||
|
gimp_enum_combo_box_set_visible().
|
||||||
|
|
||||||
|
* libgimpwidgets/gimpintcombobox.[ch]: added
|
||||||
|
gimp_int_combo_box_set_sensitivity() instead.
|
||||||
|
|
||||||
|
* app/tools/gimpcurvestool.c
|
||||||
|
* app/tools/gimplevelstool.c
|
||||||
|
* app/widgets/gimphistogrameditor.c: changed accordingly.
|
||||||
|
|
||||||
|
* libgimpwidgets/gimpenumstore.h: added padding for future expansion.
|
||||||
|
|
||||||
|
* libgimpwidgets/gimpwidgets.def: updated.
|
||||||
|
|
||||||
2005-02-28 Sven Neumann <sven@gimp.org>
|
2005-02-28 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* app/core/gimpdrawable-blend.c: major speedup for dithering code
|
* app/core/gimpdrawable-blend.c: major speedup for dithering code
|
||||||
|
|
|
@ -106,9 +106,9 @@ static void curves_channel_callback (GtkWidget *widget,
|
||||||
static void curves_channel_reset_callback (GtkWidget *widget,
|
static void curves_channel_reset_callback (GtkWidget *widget,
|
||||||
GimpCurvesTool *tool);
|
GimpCurvesTool *tool);
|
||||||
|
|
||||||
static gboolean curves_menu_visible_func (GtkTreeModel *model,
|
static gboolean curves_menu_sensitivity (gint value,
|
||||||
GtkTreeIter *iter,
|
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
|
||||||
static void curves_curve_type_callback (GtkWidget *widget,
|
static void curves_curve_type_callback (GtkWidget *widget,
|
||||||
GimpCurvesTool *tool);
|
GimpCurvesTool *tool);
|
||||||
static gboolean curves_graph_events (GtkWidget *widget,
|
static gboolean curves_graph_events (GtkWidget *widget,
|
||||||
|
@ -297,8 +297,8 @@ gimp_curves_tool_initialize (GimpTool *tool,
|
||||||
gimp_color_tool_enable (GIMP_COLOR_TOOL (tool),
|
gimp_color_tool_enable (GIMP_COLOR_TOOL (tool),
|
||||||
GIMP_COLOR_OPTIONS (tool->tool_info->tool_options));
|
GIMP_COLOR_OPTIONS (tool->tool_info->tool_options));
|
||||||
|
|
||||||
gimp_enum_combo_box_set_visible (GIMP_ENUM_COMBO_BOX (c_tool->channel_menu),
|
gimp_int_combo_box_set_sensitivity (GIMP_INT_COMBO_BOX (c_tool->channel_menu),
|
||||||
curves_menu_visible_func, c_tool);
|
curves_menu_sensitivity, c_tool, NULL);
|
||||||
|
|
||||||
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (c_tool->channel_menu),
|
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (c_tool->channel_menu),
|
||||||
c_tool->channel);
|
c_tool->channel);
|
||||||
|
@ -445,6 +445,7 @@ gimp_curves_tool_dialog (GimpImageMapTool *image_map_tool)
|
||||||
{
|
{
|
||||||
GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
|
GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
|
||||||
GimpToolOptions *tool_options;
|
GimpToolOptions *tool_options;
|
||||||
|
GtkListStore *store;
|
||||||
GtkWidget *vbox;
|
GtkWidget *vbox;
|
||||||
GtkWidget *vbox2;
|
GtkWidget *vbox2;
|
||||||
GtkWidget *hbox;
|
GtkWidget *hbox;
|
||||||
|
@ -471,7 +472,14 @@ gimp_curves_tool_dialog (GimpImageMapTool *image_map_tool)
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
|
|
||||||
menu = gimp_enum_combo_box_new (GIMP_TYPE_HISTOGRAM_CHANNEL);
|
store = gimp_enum_store_new_with_range (GIMP_TYPE_HISTOGRAM_CHANNEL,
|
||||||
|
GIMP_HISTOGRAM_VALUE,
|
||||||
|
GIMP_HISTOGRAM_ALPHA);
|
||||||
|
menu = g_object_new (GIMP_TYPE_ENUM_COMBO_BOX,
|
||||||
|
"model", store,
|
||||||
|
NULL);
|
||||||
|
g_object_unref (store);
|
||||||
|
|
||||||
g_signal_connect (menu, "changed",
|
g_signal_connect (menu, "changed",
|
||||||
G_CALLBACK (curves_channel_callback),
|
G_CALLBACK (curves_channel_callback),
|
||||||
tool);
|
tool);
|
||||||
|
@ -816,16 +824,11 @@ curves_channel_reset_callback (GtkWidget *widget,
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
curves_menu_visible_func (GtkTreeModel *model,
|
curves_menu_sensitivity (gint value,
|
||||||
GtkTreeIter *iter,
|
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GimpCurvesTool *tool = GIMP_CURVES_TOOL (data);
|
GimpCurvesTool *tool = GIMP_CURVES_TOOL (data);
|
||||||
GimpHistogramChannel channel;
|
GimpHistogramChannel channel = value;
|
||||||
|
|
||||||
gtk_tree_model_get (model, iter,
|
|
||||||
GIMP_INT_STORE_VALUE, &channel,
|
|
||||||
-1);
|
|
||||||
|
|
||||||
switch (channel)
|
switch (channel)
|
||||||
{
|
{
|
||||||
|
|
|
@ -104,9 +104,10 @@ static void levels_channel_callback (GtkWidget *widget,
|
||||||
GimpLevelsTool *tool);
|
GimpLevelsTool *tool);
|
||||||
static void levels_channel_reset_callback (GtkWidget *widget,
|
static void levels_channel_reset_callback (GtkWidget *widget,
|
||||||
GimpLevelsTool *tool);
|
GimpLevelsTool *tool);
|
||||||
static gboolean levels_menu_visible_func (GtkTreeModel *model,
|
|
||||||
GtkTreeIter *iter,
|
static gboolean levels_menu_sensitivity (gint value,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
|
||||||
static void levels_stretch_callback (GtkWidget *widget,
|
static void levels_stretch_callback (GtkWidget *widget,
|
||||||
GimpLevelsTool *tool);
|
GimpLevelsTool *tool);
|
||||||
static void levels_low_input_adjustment_update (GtkAdjustment *adjustment,
|
static void levels_low_input_adjustment_update (GtkAdjustment *adjustment,
|
||||||
|
@ -295,8 +296,8 @@ gimp_levels_tool_initialize (GimpTool *tool,
|
||||||
|
|
||||||
GIMP_TOOL_CLASS (parent_class)->initialize (tool, gdisp);
|
GIMP_TOOL_CLASS (parent_class)->initialize (tool, gdisp);
|
||||||
|
|
||||||
gimp_enum_combo_box_set_visible (GIMP_ENUM_COMBO_BOX (l_tool->channel_menu),
|
gimp_int_combo_box_set_sensitivity (GIMP_INT_COMBO_BOX (l_tool->channel_menu),
|
||||||
levels_menu_visible_func, l_tool);
|
levels_menu_sensitivity, l_tool, NULL);
|
||||||
|
|
||||||
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (l_tool->channel_menu),
|
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (l_tool->channel_menu),
|
||||||
l_tool->channel);
|
l_tool->channel);
|
||||||
|
@ -378,6 +379,7 @@ gimp_levels_tool_dialog (GimpImageMapTool *image_map_tool)
|
||||||
{
|
{
|
||||||
GimpLevelsTool *tool = GIMP_LEVELS_TOOL (image_map_tool);
|
GimpLevelsTool *tool = GIMP_LEVELS_TOOL (image_map_tool);
|
||||||
GimpToolOptions *tool_options;
|
GimpToolOptions *tool_options;
|
||||||
|
GtkListStore *store;
|
||||||
GtkWidget *vbox;
|
GtkWidget *vbox;
|
||||||
GtkWidget *vbox2;
|
GtkWidget *vbox2;
|
||||||
GtkWidget *vbox3;
|
GtkWidget *vbox3;
|
||||||
|
@ -406,7 +408,14 @@ gimp_levels_tool_dialog (GimpImageMapTool *image_map_tool)
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
|
|
||||||
menu = gimp_enum_combo_box_new (GIMP_TYPE_HISTOGRAM_CHANNEL);
|
store = gimp_enum_store_new_with_range (GIMP_TYPE_HISTOGRAM_CHANNEL,
|
||||||
|
GIMP_HISTOGRAM_VALUE,
|
||||||
|
GIMP_HISTOGRAM_ALPHA);
|
||||||
|
menu = g_object_new (GIMP_TYPE_ENUM_COMBO_BOX,
|
||||||
|
"model", store,
|
||||||
|
NULL);
|
||||||
|
g_object_unref (store);
|
||||||
|
|
||||||
g_signal_connect (menu, "changed",
|
g_signal_connect (menu, "changed",
|
||||||
G_CALLBACK (levels_channel_callback),
|
G_CALLBACK (levels_channel_callback),
|
||||||
tool);
|
tool);
|
||||||
|
@ -915,16 +924,11 @@ levels_channel_reset_callback (GtkWidget *widget,
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
levels_menu_visible_func (GtkTreeModel *model,
|
levels_menu_sensitivity (gint value,
|
||||||
GtkTreeIter *iter,
|
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GimpLevelsTool *tool = GIMP_LEVELS_TOOL (data);
|
GimpLevelsTool *tool = GIMP_LEVELS_TOOL (data);
|
||||||
GimpHistogramChannel channel;
|
GimpHistogramChannel channel = value;
|
||||||
|
|
||||||
gtk_tree_model_get (model, iter,
|
|
||||||
GIMP_INT_STORE_VALUE, &channel,
|
|
||||||
-1);
|
|
||||||
|
|
||||||
switch (channel)
|
switch (channel)
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,8 +57,7 @@ static void gimp_histogram_editor_layer_changed (GimpImage *gimage,
|
||||||
static void gimp_histogram_editor_update (GimpHistogramEditor *editor);
|
static void gimp_histogram_editor_update (GimpHistogramEditor *editor);
|
||||||
|
|
||||||
static gboolean gimp_histogram_editor_idle_update (GimpHistogramEditor *editor);
|
static gboolean gimp_histogram_editor_idle_update (GimpHistogramEditor *editor);
|
||||||
static gboolean gimp_histogram_editor_item_visible (GtkTreeModel *model,
|
static gboolean gimp_histogram_menu_sensitivity (gint value,
|
||||||
GtkTreeIter *iter,
|
|
||||||
gpointer data);
|
gpointer data);
|
||||||
static void gimp_histogram_editor_menu_update (GimpHistogramEditor *editor);
|
static void gimp_histogram_editor_menu_update (GimpHistogramEditor *editor);
|
||||||
static void gimp_histogram_editor_info_update (GimpHistogramEditor *editor);
|
static void gimp_histogram_editor_info_update (GimpHistogramEditor *editor);
|
||||||
|
@ -162,9 +161,9 @@ gimp_histogram_editor_init (GimpHistogramEditor *editor)
|
||||||
0, 0);
|
0, 0);
|
||||||
gimp_enum_combo_box_set_stock_prefix (GIMP_ENUM_COMBO_BOX (menu),
|
gimp_enum_combo_box_set_stock_prefix (GIMP_ENUM_COMBO_BOX (menu),
|
||||||
"gimp-channel");
|
"gimp-channel");
|
||||||
gimp_enum_combo_box_set_visible (GIMP_ENUM_COMBO_BOX (editor->menu),
|
gimp_int_combo_box_set_sensitivity (GIMP_INT_COMBO_BOX (editor->menu),
|
||||||
gimp_histogram_editor_item_visible,
|
gimp_histogram_menu_sensitivity,
|
||||||
editor);
|
editor, NULL);
|
||||||
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (editor->menu),
|
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (editor->menu),
|
||||||
view->channel);
|
view->channel);
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), menu, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), menu, FALSE, FALSE, 0);
|
||||||
|
@ -391,20 +390,14 @@ gimp_histogram_editor_idle_update (GimpHistogramEditor *editor)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gimp_histogram_editor_item_visible (GtkTreeModel *model,
|
gimp_histogram_menu_sensitivity (gint value,
|
||||||
GtkTreeIter *iter,
|
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GimpHistogramEditor *editor = GIMP_HISTOGRAM_EDITOR (data);
|
GimpHistogramEditor *editor = GIMP_HISTOGRAM_EDITOR (data);
|
||||||
|
GimpHistogramChannel channel = value;
|
||||||
|
|
||||||
if (editor->drawable)
|
if (editor->drawable)
|
||||||
{
|
{
|
||||||
GimpHistogramChannel channel;
|
|
||||||
|
|
||||||
gtk_tree_model_get (model, iter,
|
|
||||||
GIMP_INT_STORE_VALUE, &channel,
|
|
||||||
-1);
|
|
||||||
|
|
||||||
switch (channel)
|
switch (channel)
|
||||||
{
|
{
|
||||||
case GIMP_HISTOGRAM_VALUE:
|
case GIMP_HISTOGRAM_VALUE:
|
||||||
|
@ -419,22 +412,15 @@ gimp_histogram_editor_item_visible (GtkTreeModel *model,
|
||||||
case GIMP_HISTOGRAM_ALPHA:
|
case GIMP_HISTOGRAM_ALPHA:
|
||||||
return gimp_drawable_has_alpha (editor->drawable);
|
return gimp_drawable_has_alpha (editor->drawable);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* allow all channels, the menu is insensitive anyway */
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_histogram_editor_menu_update (GimpHistogramEditor *editor)
|
gimp_histogram_editor_menu_update (GimpHistogramEditor *editor)
|
||||||
{
|
{
|
||||||
GtkTreeModel *model = gtk_combo_box_get_model (GTK_COMBO_BOX (editor->menu));
|
gtk_widget_queue_draw (editor->menu);
|
||||||
|
|
||||||
gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (model));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
2005-03-01 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* libgimpwidgets/libgimpwidgets-sections.txt
|
||||||
|
* libgimpwidgets/tmpl/gimpenumcombobox.sgml
|
||||||
|
* libgimpwidgets/tmpl/gimpintcombobox.sgml: updated.
|
||||||
|
|
||||||
2005-02-25 Sven Neumann <sven@gimp.org>
|
2005-02-25 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* app/app-docs.sgml
|
* app/app-docs.sgml
|
||||||
|
|
|
@ -198,7 +198,6 @@ GIMP_ENUM_STORE_GET_CLASS
|
||||||
GimpEnumComboBox
|
GimpEnumComboBox
|
||||||
gimp_enum_combo_box_new
|
gimp_enum_combo_box_new
|
||||||
gimp_enum_combo_box_set_stock_prefix
|
gimp_enum_combo_box_set_stock_prefix
|
||||||
gimp_enum_combo_box_set_visible
|
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
GimpEnumComboBoxClass
|
GimpEnumComboBoxClass
|
||||||
GIMP_ENUM_COMBO_BOX
|
GIMP_ENUM_COMBO_BOX
|
||||||
|
@ -305,6 +304,7 @@ GIMP_INT_STORE_GET_CLASS
|
||||||
<FILE>gimpintcombobox</FILE>
|
<FILE>gimpintcombobox</FILE>
|
||||||
<TITLE>GimpIntComboBox</TITLE>
|
<TITLE>GimpIntComboBox</TITLE>
|
||||||
GimpIntComboBox
|
GimpIntComboBox
|
||||||
|
GimpIntSensitivityFunc
|
||||||
gimp_int_combo_box_new
|
gimp_int_combo_box_new
|
||||||
gimp_int_combo_box_new_valist
|
gimp_int_combo_box_new_valist
|
||||||
gimp_int_combo_box_new_array
|
gimp_int_combo_box_new_array
|
||||||
|
@ -313,6 +313,7 @@ gimp_int_combo_box_append
|
||||||
gimp_int_combo_box_set_active
|
gimp_int_combo_box_set_active
|
||||||
gimp_int_combo_box_get_active
|
gimp_int_combo_box_get_active
|
||||||
gimp_int_combo_box_connect
|
gimp_int_combo_box_connect
|
||||||
|
gimp_int_combo_box_set_sensitivity
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
GimpIntComboBoxClass
|
GimpIntComboBoxClass
|
||||||
GIMP_INT_COMBO_BOX
|
GIMP_INT_COMBO_BOX
|
||||||
|
|
|
@ -38,13 +38,3 @@ GimpEnumComboBox
|
||||||
@stock_prefix:
|
@stock_prefix:
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gimp_enum_combo_box_set_visible ##### -->
|
|
||||||
<para>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@combo_box:
|
|
||||||
@func:
|
|
||||||
@data:
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,21 @@ A widget providing a popup menu of integer values (e.g. enums).
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ##### ARG GimpIntComboBox:ellipsize ##### -->
|
||||||
|
<para>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<!-- ##### USER_FUNCTION GimpIntSensitivityFunc ##### -->
|
||||||
|
<para>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
@value:
|
||||||
|
@data:
|
||||||
|
@Returns:
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gimp_int_combo_box_new ##### -->
|
<!-- ##### FUNCTION gimp_int_combo_box_new ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
@ -102,3 +117,14 @@ A widget providing a popup menu of integer values (e.g. enums).
|
||||||
@Returns:
|
@Returns:
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ##### FUNCTION gimp_int_combo_box_set_sensitivity ##### -->
|
||||||
|
<para>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
@combo_box:
|
||||||
|
@func:
|
||||||
|
@data:
|
||||||
|
@destroy:
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -120,48 +120,3 @@ gimp_enum_combo_box_set_stock_prefix (GimpEnumComboBox *combo_box,
|
||||||
|
|
||||||
gimp_enum_store_set_stock_prefix (GIMP_ENUM_STORE (model), stock_prefix);
|
gimp_enum_store_set_stock_prefix (GIMP_ENUM_STORE (model), stock_prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gimp_enum_combo_box_set_visible:
|
|
||||||
* @combo_box: a #GimpEnumComboBox
|
|
||||||
* @func: a #GtkTreeModelFilterVisibleFunc
|
|
||||||
* @data: a pointer that is passed to @func
|
|
||||||
*
|
|
||||||
* Sets a filter on the combo_box that selectively hides items. The
|
|
||||||
* registered callback @func is called with an iter for each item and
|
|
||||||
* must return %TRUE or %FALSE indicating whether the respective row
|
|
||||||
* should be visible or not.
|
|
||||||
*
|
|
||||||
* This function must only be called once for a @combo_box. If you
|
|
||||||
* want to refresh the visibility of the items in the @combo_box
|
|
||||||
* later, call gtk_tree_model_filter_refilter() on the @combo_box's
|
|
||||||
* model.
|
|
||||||
*
|
|
||||||
* This is a kludge to allow to work around the inability of
|
|
||||||
* #GtkComboBox to set the sensitivity of it's items (bug #135875).
|
|
||||||
* It should be removed as soon as this bug is fixed (probably with
|
|
||||||
* GTK+-2.6).
|
|
||||||
*
|
|
||||||
* This function is only temporarily in GIMP 2.3, it will not become
|
|
||||||
* part of the GIMP 2.0 API!!
|
|
||||||
**/
|
|
||||||
void
|
|
||||||
gimp_enum_combo_box_set_visible (GimpEnumComboBox *combo_box,
|
|
||||||
GtkTreeModelFilterVisibleFunc func,
|
|
||||||
gpointer data)
|
|
||||||
{
|
|
||||||
GtkTreeModel *model;
|
|
||||||
GtkTreeModelFilter *filter;
|
|
||||||
|
|
||||||
g_return_if_fail (GIMP_IS_ENUM_COMBO_BOX (combo_box));
|
|
||||||
g_return_if_fail (func != NULL);
|
|
||||||
|
|
||||||
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box));
|
|
||||||
|
|
||||||
filter = GTK_TREE_MODEL_FILTER (gtk_tree_model_filter_new (model, NULL));
|
|
||||||
gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), GTK_TREE_MODEL (filter));
|
|
||||||
g_object_unref (filter);
|
|
||||||
|
|
||||||
gtk_tree_model_filter_set_visible_func (filter, func, data, NULL);
|
|
||||||
gtk_tree_model_filter_refilter (filter);
|
|
||||||
}
|
|
||||||
|
|
|
@ -36,16 +36,22 @@
|
||||||
|
|
||||||
typedef struct _GimpEnumComboBoxClass GimpEnumComboBoxClass;
|
typedef struct _GimpEnumComboBoxClass GimpEnumComboBoxClass;
|
||||||
|
|
||||||
struct _GimpEnumComboBoxClass
|
|
||||||
{
|
|
||||||
GimpIntComboBoxClass parent_instance;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _GimpEnumComboBox
|
struct _GimpEnumComboBox
|
||||||
{
|
{
|
||||||
GimpIntComboBox parent_instance;
|
GimpIntComboBox parent_instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct _GimpEnumComboBoxClass
|
||||||
|
{
|
||||||
|
GimpIntComboBoxClass parent_instance;
|
||||||
|
|
||||||
|
/* Padding for future expansion */
|
||||||
|
void (* _gimp_reserved1) (void);
|
||||||
|
void (* _gimp_reserved2) (void);
|
||||||
|
void (* _gimp_reserved3) (void);
|
||||||
|
void (* _gimp_reserved4) (void);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
GType gimp_enum_combo_box_get_type (void) G_GNUC_CONST;
|
GType gimp_enum_combo_box_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
@ -53,9 +59,6 @@ GtkWidget * gimp_enum_combo_box_new (GType enum_type);
|
||||||
|
|
||||||
void gimp_enum_combo_box_set_stock_prefix (GimpEnumComboBox *combo_box,
|
void gimp_enum_combo_box_set_stock_prefix (GimpEnumComboBox *combo_box,
|
||||||
const gchar *stock_prefix);
|
const gchar *stock_prefix);
|
||||||
void gimp_enum_combo_box_set_visible (GimpEnumComboBox *combo_box,
|
|
||||||
GtkTreeModelFilterVisibleFunc func,
|
|
||||||
gpointer data);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_ENUM_COMBO_BOX_H__ */
|
#endif /* __GIMP_ENUM_COMBO_BOX_H__ */
|
||||||
|
|
|
@ -36,11 +36,6 @@
|
||||||
|
|
||||||
typedef struct _GimpEnumStoreClass GimpEnumStoreClass;
|
typedef struct _GimpEnumStoreClass GimpEnumStoreClass;
|
||||||
|
|
||||||
struct _GimpEnumStoreClass
|
|
||||||
{
|
|
||||||
GimpIntStoreClass parent_instance;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _GimpEnumStore
|
struct _GimpEnumStore
|
||||||
{
|
{
|
||||||
GimpIntStore parent_instance;
|
GimpIntStore parent_instance;
|
||||||
|
@ -48,6 +43,16 @@ struct _GimpEnumStore
|
||||||
GEnumClass *enum_class;
|
GEnumClass *enum_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct _GimpEnumStoreClass
|
||||||
|
{
|
||||||
|
GimpIntStoreClass parent_instance;
|
||||||
|
|
||||||
|
void (* _gimp_reserved1) (void);
|
||||||
|
void (* _gimp_reserved2) (void);
|
||||||
|
void (* _gimp_reserved3) (void);
|
||||||
|
void (* _gimp_reserved4) (void);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
GType gimp_enum_store_get_type (void) G_GNUC_CONST;
|
GType gimp_enum_store_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
|
|
@ -38,17 +38,25 @@ enum
|
||||||
PROP_ELLIPSIZE
|
PROP_ELLIPSIZE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
PangoEllipsizeMode ellipsize;
|
GtkCellRenderer *pixbuf_renderer;
|
||||||
|
GtkCellRenderer *text_renderer;
|
||||||
|
|
||||||
|
GimpIntSensitivityFunc sensitivity_func;
|
||||||
|
gpointer sensitivity_data;
|
||||||
|
GDestroyNotify sensitivity_destroy;
|
||||||
} GimpIntComboBoxPrivate;
|
} GimpIntComboBoxPrivate;
|
||||||
|
|
||||||
|
|
||||||
#define GIMP_INT_COMBO_BOX_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GIMP_TYPE_INT_COMBO_BOX, GimpIntComboBoxPrivate))
|
#define GIMP_INT_COMBO_BOX_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GIMP_TYPE_INT_COMBO_BOX, GimpIntComboBoxPrivate))
|
||||||
|
|
||||||
|
|
||||||
static void gimp_int_combo_box_class_init (GimpIntComboBoxClass *klass);
|
static void gimp_int_combo_box_class_init (GimpIntComboBoxClass *klass);
|
||||||
static void gimp_int_combo_box_init (GimpIntComboBox *combo_box);
|
static void gimp_int_combo_box_init (GimpIntComboBox *combo_box);
|
||||||
|
|
||||||
|
static void gimp_int_combo_box_finalize (GObject *object);
|
||||||
static void gimp_int_combo_box_set_property (GObject *object,
|
static void gimp_int_combo_box_set_property (GObject *object,
|
||||||
guint property_id,
|
guint property_id,
|
||||||
const GValue *value,
|
const GValue *value,
|
||||||
|
@ -57,10 +65,12 @@ static void gimp_int_combo_box_get_property (GObject *object,
|
||||||
guint property_id,
|
guint property_id,
|
||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
static GObject *
|
|
||||||
gimp_int_combo_box_constructor (GType type,
|
static void gimp_int_combo_box_data_func (GtkCellLayout *layout,
|
||||||
guint n_params,
|
GtkCellRenderer *cell,
|
||||||
GObjectConstructParam *params);
|
GtkTreeModel *model,
|
||||||
|
GtkTreeIter *iter,
|
||||||
|
gpointer data);
|
||||||
|
|
||||||
|
|
||||||
static GtkComboBoxClass *parent_class = NULL;
|
static GtkComboBoxClass *parent_class = NULL;
|
||||||
|
@ -101,9 +111,9 @@ gimp_int_combo_box_class_init (GimpIntComboBoxClass *klass)
|
||||||
|
|
||||||
parent_class = g_type_class_peek_parent (klass);
|
parent_class = g_type_class_peek_parent (klass);
|
||||||
|
|
||||||
object_class->constructor = gimp_int_combo_box_constructor;
|
|
||||||
object_class->set_property = gimp_int_combo_box_set_property;
|
object_class->set_property = gimp_int_combo_box_set_property;
|
||||||
object_class->get_property = gimp_int_combo_box_get_property;
|
object_class->get_property = gimp_int_combo_box_get_property;
|
||||||
|
object_class->finalize = gimp_int_combo_box_finalize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GimpIntComboBox:ellipsize:
|
* GimpIntComboBox:ellipsize:
|
||||||
|
@ -119,12 +129,27 @@ gimp_int_combo_box_class_init (GimpIntComboBoxClass *klass)
|
||||||
g_param_spec_enum ("ellipsize", NULL, NULL,
|
g_param_spec_enum ("ellipsize", NULL, NULL,
|
||||||
PANGO_TYPE_ELLIPSIZE_MODE,
|
PANGO_TYPE_ELLIPSIZE_MODE,
|
||||||
PANGO_ELLIPSIZE_NONE,
|
PANGO_ELLIPSIZE_NONE,
|
||||||
G_PARAM_READWRITE |
|
G_PARAM_READWRITE));
|
||||||
G_PARAM_CONSTRUCT_ONLY));
|
|
||||||
|
|
||||||
g_type_class_add_private (object_class, sizeof (GimpIntComboBoxPrivate));
|
g_type_class_add_private (object_class, sizeof (GimpIntComboBoxPrivate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_int_combo_box_finalize (GObject *object)
|
||||||
|
{
|
||||||
|
GimpIntComboBoxPrivate *priv = GIMP_INT_COMBO_BOX_GET_PRIVATE (object);
|
||||||
|
|
||||||
|
if (priv->sensitivity_destroy)
|
||||||
|
{
|
||||||
|
GDestroyNotify d = priv->sensitivity_destroy;
|
||||||
|
|
||||||
|
priv->sensitivity_destroy = NULL;
|
||||||
|
d (priv->sensitivity_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_int_combo_box_set_property (GObject *object,
|
gimp_int_combo_box_set_property (GObject *object,
|
||||||
guint property_id,
|
guint property_id,
|
||||||
|
@ -136,7 +161,8 @@ gimp_int_combo_box_set_property (GObject *object,
|
||||||
switch (property_id)
|
switch (property_id)
|
||||||
{
|
{
|
||||||
case PROP_ELLIPSIZE:
|
case PROP_ELLIPSIZE:
|
||||||
priv->ellipsize = g_value_get_enum (value);
|
g_object_set_property (G_OBJECT (priv->text_renderer),
|
||||||
|
pspec->name, value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
|
@ -155,7 +181,8 @@ gimp_int_combo_box_get_property (GObject *object,
|
||||||
switch (property_id)
|
switch (property_id)
|
||||||
{
|
{
|
||||||
case PROP_ELLIPSIZE:
|
case PROP_ELLIPSIZE:
|
||||||
g_value_set_enum (value, priv->ellipsize);
|
g_object_get_property (G_OBJECT (priv->text_renderer),
|
||||||
|
pspec->name, value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
|
@ -163,52 +190,32 @@ gimp_int_combo_box_get_property (GObject *object,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static GObject *
|
|
||||||
gimp_int_combo_box_constructor (GType type,
|
|
||||||
guint n_params,
|
|
||||||
GObjectConstructParam *params)
|
|
||||||
{
|
|
||||||
GObject *object;
|
|
||||||
GtkCellRenderer *cell;
|
|
||||||
GimpIntComboBoxPrivate *priv;
|
|
||||||
|
|
||||||
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
|
|
||||||
|
|
||||||
cell = gtk_cell_renderer_pixbuf_new ();
|
|
||||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (object), cell, FALSE);
|
|
||||||
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (object), cell,
|
|
||||||
"stock_id", GIMP_INT_STORE_STOCK_ID,
|
|
||||||
"pixbuf", GIMP_INT_STORE_PIXBUF,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
priv = GIMP_INT_COMBO_BOX_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
if (priv->ellipsize != PANGO_ELLIPSIZE_NONE)
|
|
||||||
cell = g_object_new (GTK_TYPE_CELL_RENDERER_TEXT,
|
|
||||||
"ellipsize", priv->ellipsize,
|
|
||||||
NULL);
|
|
||||||
else
|
|
||||||
cell = gtk_cell_renderer_text_new ();
|
|
||||||
|
|
||||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (object), cell, TRUE);
|
|
||||||
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (object), cell,
|
|
||||||
"text", GIMP_INT_STORE_LABEL,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_int_combo_box_init (GimpIntComboBox *combo_box)
|
gimp_int_combo_box_init (GimpIntComboBox *combo_box)
|
||||||
{
|
{
|
||||||
GimpIntComboBoxPrivate *priv = GIMP_INT_COMBO_BOX_GET_PRIVATE (combo_box);
|
GimpIntComboBoxPrivate *priv = GIMP_INT_COMBO_BOX_GET_PRIVATE (combo_box);
|
||||||
GtkListStore *store;
|
GtkListStore *store;
|
||||||
|
GtkCellRenderer *cell;
|
||||||
priv->ellipsize = PANGO_ELLIPSIZE_NONE;
|
|
||||||
|
|
||||||
store = gimp_int_store_new ();
|
store = gimp_int_store_new ();
|
||||||
gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), GTK_TREE_MODEL (store));
|
gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), GTK_TREE_MODEL (store));
|
||||||
g_object_unref (store);
|
g_object_unref (store);
|
||||||
|
|
||||||
|
priv = GIMP_INT_COMBO_BOX_GET_PRIVATE (combo_box);
|
||||||
|
|
||||||
|
priv->pixbuf_renderer = cell = gtk_cell_renderer_pixbuf_new ();
|
||||||
|
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), cell, FALSE);
|
||||||
|
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), cell,
|
||||||
|
"stock_id", GIMP_INT_STORE_STOCK_ID,
|
||||||
|
"pixbuf", GIMP_INT_STORE_PIXBUF,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
priv->text_renderer = cell = gtk_cell_renderer_text_new ();
|
||||||
|
|
||||||
|
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), cell, TRUE);
|
||||||
|
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), cell,
|
||||||
|
"text", GIMP_INT_STORE_LABEL,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -507,3 +514,83 @@ gimp_int_combo_box_connect (GimpIntComboBox *combo_box,
|
||||||
|
|
||||||
return handler;
|
return handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gimp_int_combo_box_set_sensitivity:
|
||||||
|
* @combo_box: a #GimpIntComboBox
|
||||||
|
* @func: a function that returns a boolean value, or %NULL to unset
|
||||||
|
* @data: data to pass to @func
|
||||||
|
* @destroy: destroy notification for @data
|
||||||
|
*
|
||||||
|
* Sets a function that is used to decide about the sensitivity of
|
||||||
|
* rows in the @combo_box. Use this if you want to set certain rows
|
||||||
|
* insensitive.
|
||||||
|
*
|
||||||
|
* Calling gtk_widget_queue_draw() on the @combo_box will cause the
|
||||||
|
* sensitivity to be updated.
|
||||||
|
*
|
||||||
|
* Since: GIMP 2.4
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
gimp_int_combo_box_set_sensitivity (GimpIntComboBox *combo_box,
|
||||||
|
GimpIntSensitivityFunc func,
|
||||||
|
gpointer data,
|
||||||
|
GDestroyNotify destroy)
|
||||||
|
{
|
||||||
|
GimpIntComboBoxPrivate *priv;
|
||||||
|
|
||||||
|
g_return_if_fail (GIMP_IS_INT_COMBO_BOX (combo_box));
|
||||||
|
|
||||||
|
priv = GIMP_INT_COMBO_BOX_GET_PRIVATE (combo_box);
|
||||||
|
|
||||||
|
if (priv->sensitivity_destroy)
|
||||||
|
{
|
||||||
|
GDestroyNotify d = priv->sensitivity_destroy;
|
||||||
|
|
||||||
|
priv->sensitivity_destroy = NULL;
|
||||||
|
d (priv->sensitivity_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
priv->sensitivity_func = func;
|
||||||
|
priv->sensitivity_data = data;
|
||||||
|
priv->sensitivity_destroy = destroy;
|
||||||
|
|
||||||
|
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo_box),
|
||||||
|
priv->pixbuf_renderer,
|
||||||
|
func ?
|
||||||
|
gimp_int_combo_box_data_func : NULL,
|
||||||
|
priv, NULL);
|
||||||
|
|
||||||
|
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo_box),
|
||||||
|
priv->text_renderer,
|
||||||
|
func ?
|
||||||
|
gimp_int_combo_box_data_func : NULL,
|
||||||
|
priv, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_int_combo_box_data_func (GtkCellLayout *layout,
|
||||||
|
GtkCellRenderer *cell,
|
||||||
|
GtkTreeModel *model,
|
||||||
|
GtkTreeIter *iter,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GimpIntComboBoxPrivate *priv = data;
|
||||||
|
|
||||||
|
if (priv->sensitivity_func)
|
||||||
|
{
|
||||||
|
gint value;
|
||||||
|
gboolean sensitive;
|
||||||
|
|
||||||
|
gtk_tree_model_get (model, iter,
|
||||||
|
GIMP_INT_STORE_VALUE, &value,
|
||||||
|
-1);
|
||||||
|
|
||||||
|
sensitive = priv->sensitivity_func (value, priv->sensitivity_data);
|
||||||
|
|
||||||
|
g_object_set (cell,
|
||||||
|
"sensitive", sensitive,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -38,22 +38,27 @@ G_BEGIN_DECLS
|
||||||
|
|
||||||
typedef struct _GimpIntComboBoxClass GimpIntComboBoxClass;
|
typedef struct _GimpIntComboBoxClass GimpIntComboBoxClass;
|
||||||
|
|
||||||
struct _GimpIntComboBoxClass
|
|
||||||
{
|
|
||||||
GtkComboBoxClass parent_instance;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _GimpIntComboBox
|
struct _GimpIntComboBox
|
||||||
{
|
{
|
||||||
GtkComboBox parent_instance;
|
GtkComboBox parent_instance;
|
||||||
|
|
||||||
/* Padding for future expansion */
|
/* Padding for future expansion (should have gone to the class) */
|
||||||
void (* _gimp_reserved1) (void);
|
void (* _gimp_reserved1) (void);
|
||||||
void (* _gimp_reserved2) (void);
|
void (* _gimp_reserved2) (void);
|
||||||
void (* _gimp_reserved3) (void);
|
void (* _gimp_reserved3) (void);
|
||||||
void (* _gimp_reserved4) (void);
|
void (* _gimp_reserved4) (void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct _GimpIntComboBoxClass
|
||||||
|
{
|
||||||
|
GtkComboBoxClass parent_instance;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
typedef gboolean (* GimpIntSensitivityFunc) (gint value,
|
||||||
|
gpointer data);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GType gimp_int_combo_box_get_type (void) G_GNUC_CONST;
|
GType gimp_int_combo_box_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
@ -82,6 +87,11 @@ gulong gimp_int_combo_box_connect (GimpIntComboBox *combo_box,
|
||||||
GCallback callback,
|
GCallback callback,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
|
||||||
|
void gimp_int_combo_box_set_sensitivity (GimpIntComboBox *combo_box,
|
||||||
|
GimpIntSensitivityFunc func,
|
||||||
|
gpointer data,
|
||||||
|
GDestroyNotify destroy);
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,6 @@ EXPORTS
|
||||||
gimp_enum_combo_box_get_type
|
gimp_enum_combo_box_get_type
|
||||||
gimp_enum_combo_box_new
|
gimp_enum_combo_box_new
|
||||||
gimp_enum_combo_box_set_stock_prefix
|
gimp_enum_combo_box_set_stock_prefix
|
||||||
gimp_enum_combo_box_set_visible
|
|
||||||
gimp_enum_store_get_type
|
gimp_enum_store_get_type
|
||||||
gimp_enum_store_new_with_range
|
gimp_enum_store_new_with_range
|
||||||
gimp_enum_store_new
|
gimp_enum_store_new
|
||||||
|
@ -133,6 +132,7 @@ EXPORTS
|
||||||
gimp_int_combo_box_new_valist
|
gimp_int_combo_box_new_valist
|
||||||
gimp_int_combo_box_prepend
|
gimp_int_combo_box_prepend
|
||||||
gimp_int_combo_box_set_active
|
gimp_int_combo_box_set_active
|
||||||
|
gimp_int_combo_box_set_sensitivity
|
||||||
gimp_int_option_menu_new
|
gimp_int_option_menu_new
|
||||||
gimp_int_option_menu_set_history
|
gimp_int_option_menu_set_history
|
||||||
gimp_int_option_menu_set_sensitive
|
gimp_int_option_menu_set_sensitive
|
||||||
|
|
Loading…
Reference in New Issue