[dia] [substitute] Convert to Path for 'Standard - BezierLine'



commit 43e5ba62ad01ab7cb7594c7a959c6a1d75346527
Author: Hans Breuer <hans breuer org>
Date:   Tue Oct 2 23:08:04 2012 +0200

    [substitute] Convert to Path for 'Standard - BezierLine'

 objects/standard/bezier.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/objects/standard/bezier.c b/objects/standard/bezier.c
index bb7711d..a40c610 100644
--- a/objects/standard/bezier.c
+++ b/objects/standard/bezier.c
@@ -755,6 +755,22 @@ bezierline_set_corner_type_callback (DiaObject *obj, Point *clicked, gpointer da
   return change;
 }
 
+static ObjectChange *
+_bezierline_convert_to_path_callback (DiaObject *obj, Point *clicked, gpointer data)
+{
+  Bezierline *bezierline = (Bezierline *) obj;
+  BezierConn *bez = &bezierline->bez;
+  DiaObject *path;
+
+  if (bez->bezier.num_points > 2) {
+    path = create_standard_path (bez->bezier.num_points, bez->bezier.points);
+
+    return object_substitute (obj, path);
+  }
+  /* Change empty */
+  return change_list_create ();
+}
+
 static DiaMenuItem bezierline_menu_items[] = {
   { N_("Add Segment"), bezierline_add_segment_callback, NULL, 1 },
   { N_("Delete Segment"), bezierline_delete_segment_callback, NULL, 1 },
@@ -765,6 +781,7 @@ static DiaMenuItem bezierline_menu_items[] = {
     GINT_TO_POINTER(BEZ_CORNER_SMOOTH), 1 },
   { N_("Cusp control"), bezierline_set_corner_type_callback,
     GINT_TO_POINTER(BEZ_CORNER_CUSP), 1 },
+  { N_("Convert to Path"), _bezierline_convert_to_path_callback, NULL, DIAMENU_ACTIVE }
 };
 
 static DiaMenu bezierline_menu = {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]