diff --git a/ChangeLog b/ChangeLog index 2f21cab6fc..00b03be6de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-11-02 Michael Natterer + + * app/widgets/gimphistogramview.[ch]: added API to set the + selected point. + + * app/tools/gimpcurvestool.c: use it. + 2007-11-02 Michael Natterer * app/core/gimpcurve.[ch]: added API to modify free-form curves diff --git a/app/tools/gimpcurvestool.c b/app/tools/gimpcurvestool.c index 563024b39a..23f47665e9 100644 --- a/app/tools/gimpcurvestool.c +++ b/app/tools/gimpcurvestool.c @@ -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) diff --git a/app/widgets/gimphistogramview.c b/app/widgets/gimphistogramview.c index 0f58671117..71fce7c93b 100644 --- a/app/widgets/gimphistogramview.c +++ b/app/widgets/gimphistogramview.c @@ -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) diff --git a/app/widgets/gimphistogramview.h b/app/widgets/gimphistogramview.h index d7c8f31234..daad006c7d 100644 --- a/app/widgets/gimphistogramview.h +++ b/app/widgets/gimphistogramview.h @@ -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,