app: allow to delete curve points

Pressing Delete in the Curve view now deletes the selected point
on the curve.
This commit is contained in:
Sven Neumann 2010-07-26 01:08:44 +02:00
parent f60d456e61
commit 8cf801c8e0
3 changed files with 34 additions and 0 deletions

View file

@ -797,6 +797,34 @@ gimp_curve_move_point (GimpCurve *curve,
gimp_data_dirty (GIMP_DATA (curve));
}
void
gimp_curve_delete_point (GimpCurve *curve,
gint point)
{
g_return_if_fail (GIMP_IS_CURVE (curve));
g_return_if_fail (point >= 0 && point < curve->n_points);
if (point == 0)
{
curve->points[0].x = 0.0;
curve->points[0].y = 0.0;
}
else if (point == curve->n_points - 1)
{
curve->points[curve->n_points - 1].x = 1.0;
curve->points[curve->n_points - 1].y = 1.0;
}
else
{
curve->points[point].x = -1.0;
curve->points[point].y = -1.0;
}
g_object_notify (G_OBJECT (curve), "points");
gimp_data_dirty (GIMP_DATA (curve));
}
void
gimp_curve_get_point (GimpCurve *curve,
gint point,

View file

@ -79,6 +79,8 @@ void gimp_curve_set_point (GimpCurve *curve,
void gimp_curve_move_point (GimpCurve *curve,
gint point,
gdouble y);
void gimp_curve_delete_point (GimpCurve *curve,
gint point);
void gimp_curve_get_point (GimpCurve *curve,
gint point,
gdouble *x,

View file

@ -1014,6 +1014,10 @@ gimp_curve_view_key_press (GtkWidget *widget,
}
break;
case GDK_Delete:
gimp_curve_delete_point (curve, i);
break;
default:
break;
}