Commit 0d4dd11e authored by Thomas Manni's avatar Thomas Manni

Bug 777880 - better handling of sensitivity functions for channel combobox on...

Bug 777880 - better handling of sensitivity functions for channel combobox on threshold, levels and curves tools

- set the filter_tool->drawable before showing the tool gui.
- set the sensitivity functions for channel combobox of threshold,
  levels and curves tools dialogs only once during dialog creations.
- use the filter_tool->drawable inside the sensitivity functions
parent 448f12c8
......@@ -222,9 +222,6 @@ gimp_curves_tool_initialize (GimpTool *tool,
return FALSE;
}
gimp_int_combo_box_set_sensitivity (GIMP_INT_COMBO_BOX (c_tool->channel_menu),
curves_menu_sensitivity, drawable, NULL);
histogram = gimp_histogram_new (FALSE);
gimp_drawable_calculate_histogram (drawable, histogram);
gimp_histogram_view_set_background (GIMP_HISTOGRAM_VIEW (c_tool->graph),
......@@ -471,6 +468,8 @@ gimp_curves_tool_dialog (GimpFilterTool *filter_tool)
config->channel);
gimp_enum_combo_box_set_icon_prefix (GIMP_ENUM_COMBO_BOX (tool->channel_menu),
"gimp-channel");
gimp_int_combo_box_set_sensitivity (GIMP_INT_COMBO_BOX (tool->channel_menu),
curves_menu_sensitivity, filter_tool, NULL);
gtk_box_pack_start (GTK_BOX (hbox), tool->channel_menu, FALSE, FALSE, 0);
gtk_widget_show (tool->channel_menu);
......@@ -822,9 +821,12 @@ static gboolean
curves_menu_sensitivity (gint value,
gpointer data)
{
GimpDrawable *drawable = GIMP_DRAWABLE (data);
GimpDrawable *drawable = GIMP_FILTER_TOOL (data)->drawable;
GimpHistogramChannel channel = value;
if (!drawable)
return FALSE;
switch (channel)
{
case GIMP_HISTOGRAM_VALUE:
......
......@@ -484,9 +484,9 @@ gimp_filter_tool_initialize (GimpTool *tool,
gimp_tool_gui_set_shell (filter_tool->gui, shell);
gimp_tool_gui_set_viewable (filter_tool->gui, GIMP_VIEWABLE (drawable));
filter_tool->drawable = drawable;
gimp_tool_gui_show (filter_tool->gui);
filter_tool->drawable = drawable;
gimp_filter_tool_create_map (filter_tool);
return TRUE;
......
......@@ -214,9 +214,6 @@ gimp_levels_tool_initialize (GimpTool *tool,
return FALSE;
}
gimp_int_combo_box_set_sensitivity (GIMP_INT_COMBO_BOX (l_tool->channel_menu),
levels_menu_sensitivity, drawable, NULL);
gimp_drawable_calculate_histogram (drawable, l_tool->histogram);
gimp_histogram_view_set_histogram (GIMP_HISTOGRAM_VIEW (l_tool->histogram_view),
l_tool->histogram);
......@@ -376,6 +373,8 @@ gimp_levels_tool_dialog (GimpFilterTool *filter_tool)
gimp_enum_combo_box_set_icon_prefix (GIMP_ENUM_COMBO_BOX (tool->channel_menu),
"gimp-channel");
gimp_int_combo_box_set_sensitivity (GIMP_INT_COMBO_BOX (tool->channel_menu),
levels_menu_sensitivity, filter_tool, NULL);
gtk_box_pack_start (GTK_BOX (hbox), tool->channel_menu, FALSE, FALSE, 0);
gtk_widget_show (tool->channel_menu);
......@@ -918,9 +917,12 @@ static gboolean
levels_menu_sensitivity (gint value,
gpointer data)
{
GimpDrawable *drawable = GIMP_DRAWABLE (data);
GimpDrawable *drawable = GIMP_FILTER_TOOL (data)->drawable;
GimpHistogramChannel channel = value;
if (!drawable)
return FALSE;
switch (channel)
{
case GIMP_HISTOGRAM_VALUE:
......
......@@ -162,10 +162,6 @@ gimp_threshold_tool_initialize (GimpTool *tool,
return FALSE;
}
gimp_int_combo_box_set_sensitivity (GIMP_INT_COMBO_BOX (t_tool->channel_menu),
gimp_threshold_tool_channel_sensitive,
drawable, NULL);
gimp_drawable_calculate_histogram (drawable, t_tool->histogram);
gimp_histogram_view_set_histogram (t_tool->histogram_box->view,
t_tool->histogram);
......@@ -230,6 +226,11 @@ gimp_threshold_tool_dialog (GimpFilterTool *filter_tool)
"channel", -1, -1);
gimp_enum_combo_box_set_icon_prefix (GIMP_ENUM_COMBO_BOX (t_tool->channel_menu),
"gimp-channel");
gimp_int_combo_box_set_sensitivity (GIMP_INT_COMBO_BOX (t_tool->channel_menu),
gimp_threshold_tool_channel_sensitive,
filter_tool, NULL);
gtk_box_pack_start (GTK_BOX (hbox), t_tool->channel_menu, FALSE, FALSE, 0);
gtk_widget_show (t_tool->channel_menu);
......@@ -331,9 +332,12 @@ static gboolean
gimp_threshold_tool_channel_sensitive (gint value,
gpointer data)
{
GimpDrawable *drawable = GIMP_DRAWABLE (data);
GimpDrawable *drawable = GIMP_FILTER_TOOL (data)->drawable;
GimpHistogramChannel channel = value;
if (!drawable)
return FALSE;
switch (channel)
{
case GIMP_HISTOGRAM_VALUE:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment