[gimp] GimpCageConfig: add function to remove all selected points
- From: Michael Muré <mmure src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] GimpCageConfig: add function to remove all selected points
- Date: Mon, 2 May 2011 22:47:06 +0000 (UTC)
commit bcd76a3d5b0f574bf0df9493eb5f5a51d5531973
Author: Michael Muré <batolettre gmail com>
Date: Thu Apr 21 11:22:12 2011 +0200
GimpCageConfig: add function to remove all selected points
app/gegl/gimpcageconfig.c | 31 ++++++++++++++++++++++++++++++-
app/gegl/gimpcageconfig.h | 1 +
2 files changed, 31 insertions(+), 1 deletions(-)
---
diff --git a/app/gegl/gimpcageconfig.c b/app/gegl/gimpcageconfig.c
index 23b42f0..12952af 100644
--- a/app/gegl/gimpcageconfig.c
+++ b/app/gegl/gimpcageconfig.c
@@ -174,7 +174,7 @@ gimp_cage_config_add_cage_point (GimpCageConfig *gcc,
gdouble x,
gdouble y)
{
- gimp_cage_config_insert_cage_point (gcc, gcc->cage_points->len - 1, x, y);
+ gimp_cage_config_insert_cage_point (gcc, gcc->cage_points->len, x, y);
}
/**
@@ -246,6 +246,35 @@ gimp_cage_config_remove_cage_point (GimpCageConfig *gcc,
}
/**
+ * gimp_cage_config_remove_selected_points:
+ * @gcc: the cage config
+ *
+ * Remove all the selected points from the cage
+ */
+void
+gimp_cage_config_remove_selected_points (GimpCageConfig *gcc)
+{
+ gint i;
+ GimpCagePoint *point;
+
+ g_return_if_fail (GIMP_IS_CAGE_CONFIG (gcc));
+
+ for (i = 0; i < gcc->cage_points->len; i++)
+ {
+ point = &g_array_index (gcc->cage_points, GimpCagePoint, i);
+
+ if (point->selected)
+ {
+ g_array_remove_index (gcc->cage_points, i);
+ i--;
+ }
+ }
+
+ gimp_cage_config_compute_scaling_factor (gcc);
+ gimp_cage_config_compute_edges_normal (gcc);
+}
+
+/**
* gimp_cage_config_get_point_coordinate:
* @gcc: the cage config
* @mode: the actual mode of the cage, GIMP_CAGE_MODE_CAGE_CHANGE or GIMP_CAGE_MODE_DEFORM
diff --git a/app/gegl/gimpcageconfig.h b/app/gegl/gimpcageconfig.h
index 6c495a9..77b5394 100644
--- a/app/gegl/gimpcageconfig.h
+++ b/app/gegl/gimpcageconfig.h
@@ -74,6 +74,7 @@ void gimp_cage_config_insert_cage_point (GimpCageConfig *gcc,
void gimp_cage_config_remove_last_cage_point (GimpCageConfig *gcc);
void gimp_cage_config_remove_cage_point (GimpCageConfig *gcc,
gint point_number);
+void gimp_cage_config_remove_selected_points (GimpCageConfig *gcc);
GimpVector2 gimp_cage_config_get_point_coordinate (GimpCageConfig *gcc,
GimpCageMode mode,
gint point_number);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]