Code

Adding use of GtkScaleButton when available
[inkscape.git] / src / sp-conn-end-pair.cpp
index 40f939e25a596eb92492de255bbf774d42bd3e38..786209fdae0a4a859286a85aed84c59f45e55529 100644 (file)
@@ -10,6 +10,9 @@
  * Released under GNU GPL, read the file 'COPYING' for more information
  */
 
+#include <cstring>
+#include <string>
+
 #include "attributes.h"
 #include "sp-conn-end.h"
 #include "uri.h"
@@ -77,7 +80,7 @@ sp_conn_end_pair_build(SPObject *object)
 
 
 static void
-avoid_conn_move(NR::Matrix const *mp, SPItem *moved_item)
+avoid_conn_move(NR::Matrix const */*mp*/, SPItem *moved_item)
 {
     // Reroute connector
     SPPath *path = SP_PATH(moved_item);
@@ -141,7 +144,7 @@ SPConnEndPair::getAttachedItems(SPItem *h2attItem[2]) const {
         h2attItem[h] = this->_connEnd[h]->ref.getObject();
 
         // Deal with the case of the attached object being an empty group.
-        // A group containing no items does not have a valid bbox, so 
+        // A group containing no items does not have a valid bbox, so
         // causes problems for the auto-routing code.  Also, since such a
         // group no longer has an onscreen representation and can only be
         // selected through the XML editor, it makes sense just to detach
@@ -164,16 +167,21 @@ SPConnEndPair::getEndpoints(NR::Point endPts[]) const {
 
     for (unsigned h = 0; h < 2; ++h) {
         if ( h2attItem[h] ) {
-            NR::Rect const bbox = h2attItem[h]->invokeBbox(sp_item_i2doc_affine(h2attItem[h]));
-            endPts[h] = bbox.midpoint();
+            NR::Maybe<NR::Rect> bbox = h2attItem[h]->getBounds(from_2geom(sp_item_i2doc_affine(h2attItem[h])));
+            if (bbox) {
+                endPts[h] = bbox->midpoint();
+            } else {
+                // FIXME
+                endPts[h] = NR::Point(0, 0);
+            }
         }
         else
         {
             if (h == 0) {
-                endPts[h] = sp_curve_first_point(curve);
+                endPts[h] = curve->first_point();
             }
             else {
-                endPts[h] = sp_curve_last_point(curve);
+                endPts[h] = curve->last_point();
             }
         }
     }
@@ -294,12 +302,12 @@ SPConnEndPair::reroutePath(void)
     Avoid::PolyLine route = _connRef->route();
     _connRef->calcRouteDist();
 
-    sp_curve_reset(curve);
-    sp_curve_moveto(curve, endPt[0]);
+    curve->reset();
+    curve->moveto(endPt[0]);
 
     for (int i = 1; i < route.pn; ++i) {
         NR::Point p(route.ps[i].x, route.ps[i].y);
-        sp_curve_lineto(curve, p);
+        curve->lineto(p);
     }
 }