added API to set the selected point.

2007-11-02  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimphistogramview.[ch]: added API to set the
	selected point.

	* app/tools/gimpcurvestool.c: use it.


svn path=/trunk/; revision=24046
This commit is contained in:
Michael Natterer
2007-11-02 17:08:42 +00:00
committed by Michael Natterer
parent e5927feba1
commit 6c64c64b07
4 changed files with 42 additions and 10 deletions

View File

@ -1,3 +1,10 @@
2007-11-02 Michael Natterer <mitch@gimp.org>
* app/widgets/gimphistogramview.[ch]: added API to set the
selected point.
* app/tools/gimpcurvestool.c: use it.
2007-11-02 Michael Natterer <mitch@gimp.org>
* app/core/gimpcurve.[ch]: added API to modify free-form curves

View File

@ -297,7 +297,8 @@ gimp_curves_tool_button_release (GimpTool *tool,
gimp_curve_get_closest_point (curve,
c_tool->col_value[c_tool->channel]);
GIMP_HISTOGRAM_VIEW (c_tool->graph)->selected = c_tool->selected;
gimp_histogram_view_set_selected (GIMP_HISTOGRAM_VIEW (c_tool->graph),
c_tool->selected);
gimp_curve_set_point (curve,
c_tool->selected,
@ -316,7 +317,8 @@ gimp_curves_tool_button_release (GimpTool *tool,
gimp_curve_get_closest_point (curve,
c_tool->col_value[i]);
GIMP_HISTOGRAM_VIEW (c_tool->graph)->selected = c_tool->selected;
gimp_histogram_view_set_selected (GIMP_HISTOGRAM_VIEW (c_tool->graph),
c_tool->selected);
gimp_curve_set_point (curve,
c_tool->selected,
@ -426,8 +428,9 @@ curves_key_press (GimpCurvesTool *tool,
if (curve->points[i][0] != -1)
{
tool->selected = i;
GIMP_HISTOGRAM_VIEW (tool->graph)->selected = i;
gtk_widget_queue_draw (tool->graph);
gimp_histogram_view_set_selected (GIMP_HISTOGRAM_VIEW (tool->graph),
i);
return TRUE;
}
@ -440,8 +443,9 @@ curves_key_press (GimpCurvesTool *tool,
if (curve->points[i][0] != -1)
{
tool->selected = i;
GIMP_HISTOGRAM_VIEW (tool->graph)->selected = i;
gtk_widget_queue_draw (tool->graph);
gimp_histogram_view_set_selected (GIMP_HISTOGRAM_VIEW (tool->graph),
i);
return TRUE;
}
@ -1009,7 +1013,9 @@ curves_graph_events (GtkWidget *widget,
}
tool->selected = closest_point;
GIMP_HISTOGRAM_VIEW (tool->graph)->selected = closest_point;
gimp_histogram_view_set_selected (GIMP_HISTOGRAM_VIEW (tool->graph),
closest_point);
gimp_curve_set_point (curve, tool->selected, x, 255 - y);
@ -1019,8 +1025,10 @@ curves_graph_events (GtkWidget *widget,
gimp_curve_set_curve (curve, x, 255 - y);
tool->selected = x;
GIMP_HISTOGRAM_VIEW (tool->graph)->selected = x;
tool->last = y;
gimp_histogram_view_set_selected (GIMP_HISTOGRAM_VIEW (tool->graph),
x);
break;
}
@ -1072,7 +1080,9 @@ curves_graph_events (GtkWidget *widget,
if (curve->points[closest_point][0] == -1)
{
tool->selected = closest_point;
GIMP_HISTOGRAM_VIEW (tool->graph)->selected = closest_point;
gimp_histogram_view_set_selected (GIMP_HISTOGRAM_VIEW (tool->graph),
closest_point);
}
gimp_curve_set_point (curve, tool->selected, x, 255 - y);
@ -1110,8 +1120,10 @@ curves_graph_events (GtkWidget *widget,
}
tool->selected = x;
GIMP_HISTOGRAM_VIEW (tool->graph)->selected = x;
tool->last = y;
gimp_histogram_view_set_selected (GIMP_HISTOGRAM_VIEW (tool->graph),
x);
}
if (mevent->state & GDK_BUTTON1_MASK)

View File

@ -815,6 +815,17 @@ gimp_histogram_view_get_curve (GimpHistogramView *view)
return view->curve;
}
void
gimp_histogram_view_set_selected (GimpHistogramView *view,
gint selected)
{
g_return_if_fail (GIMP_IS_HISTOGRAM_VIEW (view));
view->selected = selected;
gtk_widget_queue_draw (GTK_WIDGET (view));
}
void
gimp_histogram_view_set_xpos (GimpHistogramView *view,
gint x)

View File

@ -96,6 +96,8 @@ void gimp_histogram_view_set_curve (GimpHistogramView *view,
GimpCurve *curve);
GimpCurve * gimp_histogram_view_get_curve (GimpHistogramView *view);
void gimp_histogram_view_set_selected (GimpHistogramView *view,
gint selected);
void gimp_histogram_view_set_xpos (GimpHistogramView *view,
gint x);
void gimp_histogram_view_set_cusor (GimpHistogramView *view,