static void gimp_curves_tool_button_release (GimpTool *tool, const GimpCoords *coords, guint32 time, GdkModifierType state, GimpButtonReleaseType release_type, GimpDisplay *display) { GimpCurvesTool *c_tool = GIMP_CURVES_TOOL (tool); GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (tool); GimpCurvesConfig *config = GIMP_CURVES_CONFIG (im_tool->config); if (state & gimp_get_extend_selection_mask ()) { GimpCurve *curve = config->curve[config->channel]; gdouble value = c_tool->picked_color[config->channel]; gint closest; closest = gimp_curve_get_closest_point (curve, value); gimp_curve_view_set_selected (GIMP_CURVE_VIEW (c_tool->graph), closest); gimp_curve_set_point (curve, closest, value, gimp_curve_map_value (curve, value)); } else if (state & gimp_get_toggle_behavior_mask ()) { GimpHistogramChannel channel; for (channel = GIMP_HISTOGRAM_VALUE; channel <= GIMP_HISTOGRAM_ALPHA; channel++) { GimpCurve *curve = config->curve[channel]; gdouble value = c_tool->picked_color[channel]; gint closest; if (value != -1) { closest = gimp_curve_get_closest_point (curve, value); gimp_curve_view_set_selected (GIMP_CURVE_VIEW (c_tool->graph), closest); gimp_curve_set_point (curve, closest, value, gimp_curve_map_value (curve, value)); } } } /* chain up to halt the tool */ GIMP_TOOL_CLASS (parent_class)->button_release (tool, coords, time, state, release_type, display); }
static void gimp_curves_tool_button_release (GimpTool *tool, GimpCoords *coords, guint32 time, GdkModifierType state, GimpButtonReleaseType release_type, GimpDisplay *display) { GimpCurvesTool *c_tool = GIMP_CURVES_TOOL (tool); GimpCurvesConfig *config = c_tool->config; if (state & GDK_SHIFT_MASK) { GimpCurve *curve = config->curve[config->channel]; gdouble value = c_tool->picked_color[config->channel]; gint closest; closest = gimp_curve_get_closest_point (curve, value); gimp_curve_view_set_selected (GIMP_CURVE_VIEW (c_tool->graph), closest); gimp_curve_set_point (curve, closest, value, gimp_curve_map_value (curve, value)); } else if (state & GDK_CONTROL_MASK) { gint i; for (i = 0; i < 5; i++) { GimpCurve *curve = config->curve[i]; gdouble value = c_tool->picked_color[i]; gint closest; closest = gimp_curve_get_closest_point (curve, value); gimp_curve_view_set_selected (GIMP_CURVE_VIEW (c_tool->graph), closest); gimp_curve_set_point (curve, closest, value, gimp_curve_map_value (curve, value)); } } /* chain up to halt the tool */ GIMP_TOOL_CLASS (parent_class)->button_release (tool, coords, time, state, release_type, display); }