[dia] [substitute] remove Standard object specific "Convert to Path" again



commit 0b8f9d34f803fea9c58db72fac043519bdbbc89c
Author: Hans Breuer <hans breuer org>
Date:   Sun Aug 3 14:55:11 2014 +0200

    [substitute] remove Standard object specific "Convert to Path" again
    
    At least for "Standard - Box" and "Standard - Bezier*" there is no user
    visible gain anymore with the object specific implementations. All their
    functionality is integrated with DiaPathRenderer and global menuc entry
    "<Selection>/Convert to Path" now.

 objects/standard/bezier.c    |   19 +------------
 objects/standard/beziergon.c |   24 +----------------
 objects/standard/box.c       |   60 +-----------------------------------------
 3 files changed, 3 insertions(+), 100 deletions(-)
---
diff --git a/objects/standard/bezier.c b/objects/standard/bezier.c
index 183ceab..51c90a0 100644
--- a/objects/standard/bezier.c
+++ b/objects/standard/bezier.c
@@ -755,22 +755,6 @@ 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 },
@@ -780,8 +764,7 @@ static DiaMenuItem bezierline_menu_items[] = {
   { N_("Smooth control"), bezierline_set_corner_type_callback, 
     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 }
+    GINT_TO_POINTER(BEZ_CORNER_CUSP), 1 }
 };
 
 static DiaMenu bezierline_menu = {
diff --git a/objects/standard/beziergon.c b/objects/standard/beziergon.c
index 0e1fcbb..8212334 100644
--- a/objects/standard/beziergon.c
+++ b/objects/standard/beziergon.c
@@ -512,27 +512,6 @@ beziergon_set_corner_type_callback (DiaObject *obj, Point *clicked, gpointer dat
   return change;
 }
 
-/*!
- * \brief Convert _Beziergon to _Path
- * \memberof _Beziergon
- */
-static ObjectChange *
-_beziergon_convert_to_path_callback (DiaObject *obj, Point *clicked, gpointer data)
-{
-  Beziergon *beziergon = (Beziergon *) obj;
-  BezierShape *bez = &beziergon->bezier;
-  DiaObject *path = NULL;
-
-  if (bez->bezier.num_points > 1)
-    path = create_standard_path (bez->bezier.num_points, bez->bezier.points);
-
-  if (path)
-    return object_substitute (obj, path);
-
-  /* just an empty change */
-  return change_list_create ();
-}
-
 static DiaMenuItem beziergon_menu_items[] = {
   { N_("Add Segment"), beziergon_add_segment_callback, NULL, 1 },
   { N_("Delete Segment"), beziergon_delete_segment_callback, NULL, 1 },
@@ -542,8 +521,7 @@ static DiaMenuItem beziergon_menu_items[] = {
   { N_("Smooth control"), beziergon_set_corner_type_callback, 
     GINT_TO_POINTER(BEZ_CORNER_SMOOTH), 1 },
   { N_("Cusp control"), beziergon_set_corner_type_callback,
-    GINT_TO_POINTER(BEZ_CORNER_CUSP), 1 },
-  { N_("Convert to Path"), _beziergon_convert_to_path_callback, NULL, DIAMENU_ACTIVE }
+    GINT_TO_POINTER(BEZ_CORNER_CUSP), 1 }
 };
 
 static DiaMenu beziergon_menu = {
diff --git a/objects/standard/box.c b/objects/standard/box.c
index 9e8b731..64dac85 100644
--- a/objects/standard/box.c
+++ b/objects/standard/box.c
@@ -715,71 +715,13 @@ box_set_aspect_callback (DiaObject* obj, Point* clicked, gpointer data)
   return change;
 }
 
-static ObjectChange *
-_box_convert_to_path_callback (DiaObject *obj, Point *clicked, gpointer data)
-{
-  const Box *box = (Box *)obj;
-  const Element *elem = &box->element;
-  DiaObject *path;
-  int num_points;
-  BezPoint *points;
-
-  if (box->corner_radius > 0) {
-    const real w = elem->width;
-    const real h = elem->height;
-    const real x = elem->corner.x;
-    const real y = elem->corner.y;
-    real r = box->corner_radius;
-    num_points = 9;
-    points = g_alloca (sizeof(BezPoint) * num_points);
-
-    /* avoid r>w/w and r>h/2 */
-    r = (w > h ) ? (r > h/2 ? h/2 : r) : (r > w/2 ? w/2 : r);
-
-    points[0].type = BEZ_MOVE_TO;  points[0].p1.x = x + r; points[0].p1.y = y; /* top-left */
-    points[1].type = BEZ_LINE_TO;  points[1].p1.x = x + w - r; points[1].p1.y = y; /* top-right */
-    points[2].type = BEZ_CURVE_TO; points[2].p1.x = x + w - r; points[2].p1.y = y; /* around */
-    points[2].p2.x = x + w; points[2].p2.y = y; points[2].p3.x = x + w; points[2].p3.y = y + r;
-    points[3].type = BEZ_LINE_TO; points[3].p1.x =  x + w; points[3].p1.y = y + h - r; /* bottom-right */
-    points[4].type = BEZ_CURVE_TO; points[4].p1.x = x + w; points[4].p1.y = y + h - r; /* around */
-    points[4].p2.x = x + w; points[4].p2.y = y + h; points[4].p3.x = x + w - r; points[4].p3.y = y + h;
-    points[5].type = BEZ_LINE_TO;  points[5].p1.x = x + r; points[5].p1.y = y + h; /* bottom-left */
-    points[6].type = BEZ_CURVE_TO; points[6].p1.x = x + r; points[6].p1.y = y + h; /* around */
-    points[6].p2.x = x; points[6].p2.y = y + h; points[6].p3.x = x; points[6].p3.y = y + h - r;
-    points[7].type = BEZ_LINE_TO;  points[7].p1.x = x; points[7].p1.y = y + r; /* top-left */
-    points[8].type = BEZ_CURVE_TO; points[8].p1.x = x; points[8].p1.y = y + r; /* around */
-    points[8].p2.x = x; points[8].p2.y = y; points[8].p3.x = x + r; points[8].p3.y = y;
-  } else {
-    num_points = 5;
-    points = g_alloca (sizeof(BezPoint) * num_points);
-
-    points[0].type = BEZ_MOVE_TO;
-    points[0].p1 = elem->corner;
-    points[1].type = points[2].type = points[3].type = points[4].type = BEZ_LINE_TO;
-    points[1].p1.x = elem->corner.x + elem->width;
-    points[1].p1.y = elem->corner.y;
-    points[2].p1.x = elem->corner.x + elem->width;
-    points[2].p1.y = elem->corner.y + elem->height;
-    points[3].p1.x = elem->corner.x;
-    points[3].p1.y = elem->corner.y + elem->height;
-    points[4].p1 = elem->corner;
-  }
-  path = create_standard_path (num_points, points);
-  if (path)
-    return object_substitute (obj, path);
-
-  /* Empty change */
-  return change_list_create ();
-}
-
 static DiaMenuItem box_menu_items[] = {
   { N_("Free aspect"), box_set_aspect_callback, (void*)FREE_ASPECT, 
     DIAMENU_ACTIVE|DIAMENU_TOGGLE },
   { N_("Fixed aspect"), box_set_aspect_callback, (void*)FIXED_ASPECT, 
     DIAMENU_ACTIVE|DIAMENU_TOGGLE },
   { N_("Square"), box_set_aspect_callback, (void*)SQUARE_ASPECT, 
-    DIAMENU_ACTIVE|DIAMENU_TOGGLE},
-  { N_("Convert to Path"), _box_convert_to_path_callback, NULL, DIAMENU_ACTIVE }
+    DIAMENU_ACTIVE|DIAMENU_TOGGLE}
 };
 
 static DiaMenu box_menu = {


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