mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-21 03:52:33 +00:00
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:
parent
f60d456e61
commit
8cf801c8e0
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -1014,6 +1014,10 @@ gimp_curve_view_key_press (GtkWidget *widget,
|
|||
}
|
||||
break;
|
||||
|
||||
case GDK_Delete:
|
||||
gimp_curve_delete_point (curve, i);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue