Code

Disabled unfinished connection point edit mode. Added inkscape:connection-start-point...
authorArcadie M. Cracan <acracan@gmail.com>
Sun, 21 Feb 2010 10:40:13 +0000 (12:40 +0200)
committerArcadie M. Cracan <acracan@gmail.com>
Sun, 21 Feb 2010 10:40:13 +0000 (12:40 +0200)
src/attributes.cpp
src/attributes.h
src/connector-context.cpp
src/connector-context.h
src/sp-conn-end-pair.cpp
src/sp-conn-end.cpp
src/sp-conn-end.h
src/sp-path.cpp
src/widgets/toolbox.cpp

index f4a2a879a8541d205feca9114778b2f3c7932c29..3cfe04fab9b0bb25f9d7a65e795647bcac9ce36c 100644 (file)
@@ -127,9 +127,11 @@ static SPStyleProp const props[] = {
     {SP_ATTR_INKSCAPE_ORIGINAL_D, "inkscape:original-d"},
     /* (Note: XML representation of connectors may change in future.) */
     {SP_ATTR_CONNECTOR_TYPE, "inkscape:connector-type"},
+    {SP_ATTR_CONNECTOR_CURVATURE, "inkscape:connector-curvature"},
     {SP_ATTR_CONNECTION_START, "inkscape:connection-start"},
     {SP_ATTR_CONNECTION_END, "inkscape:connection-end"},
-    {SP_ATTR_CONNECTOR_CURVATURE, "inkscape:connector-curvature"},
+    {SP_ATTR_CONNECTION_START_POINT, "inkscape:connection-start-point"},
+    {SP_ATTR_CONNECTION_END_POINT, "inkscape:connection-end-point"},
     /* SPRect */
     {SP_ATTR_RX, "rx"},
     {SP_ATTR_RY, "ry"},
index e3399bc58602687306712bac0d9198c79856748b..c21087e3658e6d119f332f24610c013eb4d5b11f 100644 (file)
@@ -127,9 +127,11 @@ enum SPAttributeEnum {
     SP_ATTR_D,
     SP_ATTR_INKSCAPE_ORIGINAL_D,
     SP_ATTR_CONNECTOR_TYPE,
+    SP_ATTR_CONNECTOR_CURVATURE,
     SP_ATTR_CONNECTION_START,
     SP_ATTR_CONNECTION_END,
-    SP_ATTR_CONNECTOR_CURVATURE,
+    SP_ATTR_CONNECTION_START_POINT,
+    SP_ATTR_CONNECTION_END_POINT,
     /* SPRect */
     SP_ATTR_RX,
     SP_ATTR_RY,
index b61c00df6a9a15968c82be0f0ee46f745f35ddee..eed03385c21c25ae971627f8cc92620a65f2f5fc 100644 (file)
@@ -218,7 +218,7 @@ static void cc_set_active_shape(SPConnectorContext *cc, SPItem *item);
 static void cc_clear_active_shape(SPConnectorContext *cc);
 static void cc_set_active_conn(SPConnectorContext *cc, SPItem *item);
 static void cc_clear_active_conn(SPConnectorContext *cc);
-static gchar *conn_pt_handle_test(SPConnectorContext *cc, Geom::Point& w);
+static bool conn_pt_handle_test(SPConnectorContext *cc, Geom::Point& p, gchar **href, gchar **cpid);
 static void cc_select_handle(SPKnot* knot);
 static void cc_deselect_handle(SPKnot* knot);
 static bool cc_item_is_shape(SPItem *item);
@@ -338,8 +338,10 @@ sp_connector_context_init(SPConnectorContext *cc)
         cc->endpt_handle[i] = NULL;
         cc->endpt_handler_id[i] = 0;
     }
-    cc->sid = NULL;
-    cc->eid = NULL;
+    cc->shref = NULL;
+    cc->scpid = NULL;
+    cc->ehref = NULL;
+    cc->ecpid = NULL;
     cc->npoints = 0;
     cc->state = SP_CONNECTOR_CONTEXT_IDLE;
 }
@@ -366,13 +368,21 @@ sp_connector_context_dispose(GObject *object)
             cc->endpt_handle[i] = NULL;
         }
     }
-    if (cc->sid) {
-        g_free(cc->sid);
-        cc->sid = NULL;
+    if (cc->shref) {
+        g_free(cc->shref);
+        cc->shref = NULL;
     }
-    if (cc->eid) {
-        g_free(cc->eid);
-        cc->eid = NULL;
+    if (cc->scpid) {
+        g_free(cc->scpid);
+        cc->scpid = NULL;
+    }
+    if (cc->ehref) {
+        g_free(cc->shref);
+        cc->shref = NULL;
+    }
+    if (cc->ecpid) {
+        g_free(cc->scpid);
+        cc->scpid = NULL;
     }
     g_assert( cc->newConnRef == NULL );
 
@@ -570,8 +580,8 @@ cc_clear_active_conn(SPConnectorContext *cc)
 }
 
 
-static gchar *
-conn_pt_handle_test(SPConnectorContext *cc, Geom::Point& p)
+static bool
+conn_pt_handle_test(SPConnectorContext *cc, Geom::Point& p, gchar **href, gchar **cpid)
 {
     // TODO: this will need to change when there are more connection
     //       points available for each shape.
@@ -580,10 +590,13 @@ conn_pt_handle_test(SPConnectorContext *cc, Geom::Point& p)
     {
         p = cc->active_handle->pos;
         const ConnectionPoint& cp = cc->connpthandles[cc->active_handle];
-        return g_strdup_printf("#%s_%c_%d", SP_OBJECT_ID(cc->active_shape),
-                               cp.type == ConnPointDefault ? 'd' : 'u' , cp.id);
+        *href = g_strdup_printf("#%s", SP_OBJECT_ID(cc->active_shape));
+        *cpid = g_strdup_printf("%c%d", cp.type == ConnPointDefault ? 'd' : 'u' , cp.id);
+        return true;
     }
-    return NULL;
+    *href = NULL;
+    *cpid = NULL;
+    return false;
 }
 
 static void
@@ -769,9 +782,9 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const
                         Geom::Point p = event_dt;
 
                         // Test whether we clicked on a connection point
-                        cc->sid = conn_pt_handle_test(cc, p);
+                        bool found = conn_pt_handle_test(cc, p, &cc->shref, &cc->scpid);
 
-                        if (!cc->sid) {
+                        if (!found) {
                             // This is the first point, so just snap it to the grid
                             // as there's no other points to go off.
                             m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_OTHER_HANDLE);
@@ -791,7 +804,7 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const
                     spcc_connector_set_subsequent_point(cc, p);
                     spcc_connector_finish_segment(cc, p);
                     // Test whether we clicked on a connection point
-                    cc->eid = conn_pt_handle_test(cc, p);
+                    /*bool found = */conn_pt_handle_test(cc, p, &cc->ehref, &cc->ecpid);
                     if (cc->npoints != 0) {
                         spcc_connector_finish(cc);
                     }
@@ -1035,7 +1048,7 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con
                     spcc_connector_set_subsequent_point(cc, p);
                     spcc_connector_finish_segment(cc, p);
                     // Test whether we clicked on a connection point
-                    cc->eid = conn_pt_handle_test(cc, p);
+                    /*bool found = */conn_pt_handle_test(cc, p, &cc->ehref, &cc->ecpid);
                     if (cc->npoints != 0) {
                         spcc_connector_finish(cc);
                     }
@@ -1265,16 +1278,21 @@ cc_connector_rerouting_finish(SPConnectorContext *const cc, Geom::Point *const p
     if (p != NULL)
     {
         // Test whether we clicked on a connection point
-        gchar *shape_label = conn_pt_handle_test(cc, *p);
+        gchar *shape_label, *cpid;
+        bool found = conn_pt_handle_test(cc, *p, &shape_label, &cpid);
 
-        if (shape_label) {
+        if (found) {
             if (cc->clickedhandle == cc->endpt_handle[0]) {
                 sp_object_setAttribute(cc->clickeditem,
-                        "inkscape:connection-start",shape_label, false);
+                        "inkscape:connection-start", shape_label, false);
+                sp_object_setAttribute(cc->clickeditem,
+                        "inkscape:connection-start-point", cpid, false);
             }
             else {
                 sp_object_setAttribute(cc->clickeditem,
-                        "inkscape:connection-end",shape_label, false);
+                        "inkscape:connection-end", shape_label, false);
+                sp_object_setAttribute(cc->clickeditem,
+                        "inkscape:connection-end-point", cpid, false);
             }
             g_free(shape_label);
         }
@@ -1417,17 +1435,23 @@ spcc_flush_white(SPConnectorContext *cc, SPCurve *gc)
                 cc->isOrthogonal ? "orthogonal" : "polyline", false);
         sp_object_setAttribute(cc->newconn, "inkscape:connector-curvature",
                 Glib::Ascii::dtostr(cc->curvature).c_str(), false);
-        if (cc->sid)
+        if (cc->shref)
         {
             sp_object_setAttribute(cc->newconn, "inkscape:connection-start",
-                    cc->sid, false);
+                    cc->shref, false);
+            if (cc->scpid)
+                sp_object_setAttribute(cc->newconn, "inkscape:connection-start-point",
+                        cc->scpid, false);
             connection = true;
         }
 
-        if (cc->eid)
+        if (cc->ehref)
         {
             sp_object_setAttribute(cc->newconn, "inkscape:connection-end",
-                    cc->eid, false);
+                    cc->ehref, false);
+            if (cc->ecpid)
+                sp_object_setAttribute(cc->newconn, "inkscape:connection-end-point",
+                        cc->ecpid, false);
             connection = true;
         }
         // Process pending updates.
index 640a03aaea67d8848439fc9009ed91fbaf17590b..bc16609de61165387aa22e1e5f8451348da88dab 100644 (file)
@@ -103,8 +103,10 @@ struct SPConnectorContext : public SPEventContext {
     ConnectionPointMap connpthandles;
     SPKnot *endpt_handle[2];
     guint  endpt_handler_id[2];
-    gchar *sid;
-    gchar *eid;
+    gchar *shref;
+    gchar *scpid;
+    gchar *ehref;
+    gchar *ecpid;
     SPCanvasItem *c0, *c1, *cl0, *cl1;
 };
 
index 98b2aec26dc23eaf1125a5c04f601746ea35da9f..33225f467c3055dad6a5f33cff66bc0de745443a 100644 (file)
@@ -81,7 +81,9 @@ sp_conn_end_pair_build(SPObject *object)
 {
     sp_object_read_attr(object, "inkscape:connector-type");
     sp_object_read_attr(object, "inkscape:connection-start");
+    sp_object_read_attr(object, "inkscape:connection-start-point");
     sp_object_read_attr(object, "inkscape:connection-end");
+    sp_object_read_attr(object, "inkscape:connection-end-point");
     sp_object_read_attr(object, "inkscape:connector-curvature");
 }
 
@@ -99,31 +101,18 @@ avoid_conn_transformed(Geom::Matrix const */*mp*/, SPItem *moved_item)
 void
 SPConnEndPair::setAttr(unsigned const key, gchar const *const value)
 {
-    if (key == SP_ATTR_CONNECTOR_TYPE) {
-        if (value && (strcmp(value, "polyline") == 0 || strcmp(value, "orthogonal") == 0)) {
-            int newconnType = strcmp(value, "polyline") ? SP_CONNECTOR_ORTHOGONAL : SP_CONNECTOR_POLYLINE;
-            
-            if (!_connRef)
-            {
-                _connType = newconnType;
-                Avoid::Router *router = _path->document->router;
-                GQuark itemID = g_quark_from_string(SP_OBJECT(_path)->id);
-                _connRef = new Avoid::ConnRef(router, itemID);
-                switch (newconnType)
-                {
-                    case SP_CONNECTOR_POLYLINE:
-                        _connRef->setRoutingType(Avoid::ConnType_PolyLine);
-                        break;
-                    case SP_CONNECTOR_ORTHOGONAL:
-                        _connRef->setRoutingType(Avoid::ConnType_Orthogonal);
-                }
-                _transformed_connection = _path->connectTransformed(
-                        sigc::ptr_fun(&avoid_conn_transformed));
-            }
-            else
-                if (newconnType != _connType)
+    switch (key)
+    {
+        case SP_ATTR_CONNECTOR_TYPE:
+            if (value && (strcmp(value, "polyline") == 0 || strcmp(value, "orthogonal") == 0)) {
+                int newconnType = strcmp(value, "polyline") ? SP_CONNECTOR_ORTHOGONAL : SP_CONNECTOR_POLYLINE;
+                
+                if (!_connRef)
                 {
                     _connType = newconnType;
+                    Avoid::Router *router = _path->document->router;
+                    GQuark itemID = g_quark_from_string(SP_OBJECT(_path)->id);
+                    _connRef = new Avoid::ConnRef(router, itemID);
                     switch (newconnType)
                     {
                         case SP_CONNECTOR_POLYLINE:
@@ -132,51 +121,68 @@ SPConnEndPair::setAttr(unsigned const key, gchar const *const value)
                         case SP_CONNECTOR_ORTHOGONAL:
                             _connRef->setRoutingType(Avoid::ConnType_Orthogonal);
                     }
-                    sp_conn_reroute_path(_path);
+                    _transformed_connection = _path->connectTransformed(
+                            sigc::ptr_fun(&avoid_conn_transformed));
                 }
-        }
-        else {
-            _connType = SP_CONNECTOR_NOAVOID;
+                else
+                    if (newconnType != _connType)
+                    {
+                        _connType = newconnType;
+                        switch (newconnType)
+                        {
+                            case SP_CONNECTOR_POLYLINE:
+                                _connRef->setRoutingType(Avoid::ConnType_PolyLine);
+                                break;
+                            case SP_CONNECTOR_ORTHOGONAL:
+                                _connRef->setRoutingType(Avoid::ConnType_Orthogonal);
+                        }
+                        sp_conn_reroute_path(_path);
+                    }
+            }
+            else {
+                _connType = SP_CONNECTOR_NOAVOID;
 
-            if (_connRef) {
-                _connRef->removeFromGraph();
-                delete _connRef;
-                _connRef = NULL;
-                _transformed_connection.disconnect();
+                if (_connRef) {
+                    _connRef->removeFromGraph();
+                    delete _connRef;
+                    _connRef = NULL;
+                    _transformed_connection.disconnect();
+                }
             }
-        }
-        return;
-    }
-    else if (key == SP_ATTR_CONNECTOR_CURVATURE) {
-        if (value) {
-            _connCurvature = g_strtod(value, NULL);
-            if (_connRef && _connRef->isInitialised()) {
-                // Redraw the connector, but only if it has been initialised.
-                sp_conn_reroute_path(_path);
+            break;
+        case SP_ATTR_CONNECTOR_CURVATURE:
+            if (value) {
+                _connCurvature = g_strtod(value, NULL);
+                if (_connRef && _connRef->isInitialised()) {
+                    // Redraw the connector, but only if it has been initialised.
+                    sp_conn_reroute_path(_path);
+                }
             }
-        }
-        return;
+            break;
+        case SP_ATTR_CONNECTION_START:
+        case SP_ATTR_CONNECTION_END:
+            this->_connEnd[(key == SP_ATTR_CONNECTION_START ? 0 : 1)]->setAttacherHref(value, _path);
+            break;
+        case SP_ATTR_CONNECTION_START_POINT:
+        case SP_ATTR_CONNECTION_END_POINT:
+            this->_connEnd[(key == SP_ATTR_CONNECTION_START_POINT ? 0 : 1)]->setAttacherEndpoint(value, _path);
+            break;
     }
 
-    unsigned const handle_ix = key - SP_ATTR_CONNECTION_START;
-    g_assert( handle_ix <= 1 );
-    this->_connEnd[handle_ix]->setAttacherHref(value, _path);
 }
 
 void
 SPConnEndPair::writeRepr(Inkscape::XML::Node *const repr) const
 {
+    char const * const attr_strs[] = {"inkscape:connection-start", "inkscape:connection-start-point",
+                                      "inkscape:connection-end", "inkscape:connection-end-point"};
     for (unsigned handle_ix = 0; handle_ix < 2; ++handle_ix) {
         if (this->_connEnd[handle_ix]->ref.getURI()) {
-            char const * const attr_strs[] = {"inkscape:connection-start",
-                                              "inkscape:connection-end"};
+            repr->setAttribute(attr_strs[2*handle_ix], this->_connEnd[handle_ix]->ref.getURI()->toString());
             std::ostringstream ostr;
-            ostr<<this->_connEnd[handle_ix]->ref.getURI()->toString()<<"_"<<
-                  (this->_connEnd[handle_ix]->type == ConnPointDefault ? "d":"u") <<
-                  "_" << this->_connEnd[handle_ix]->id;
-            
-            
-            repr->setAttribute(attr_strs[handle_ix], ostr.str().c_str());
+            ostr<<(this->_connEnd[handle_ix]->type == ConnPointDefault ? "d":"u") <<
+                  this->_connEnd[handle_ix]->id;
+            repr->setAttribute(attr_strs[2*handle_ix+1], ostr.str().c_str());
         }
     }
     repr->setAttribute("inkscape:connector-curvature", Glib::Ascii::dtostr(_connCurvature).c_str());
@@ -287,25 +293,19 @@ SPConnEndPair::update(void)
 void SPConnEndPair::storeIds(void)
 {
     if (_connEnd[0]->href) {
-        gchar ** href_strarray = NULL;
-        href_strarray = g_strsplit(_connEnd[0]->href, "_", 0);
         // href begins with a '#' which we don't want.
-        const char *startId = href_strarray[0] + 1;
+        const char *startId = _connEnd[0]->href + 1;
         GQuark itemId = g_quark_from_string(startId);
         _connRef->setEndPointId(Avoid::VertID::src, itemId);
-        g_strfreev(href_strarray);
     }
     else {
         _connRef->setEndPointId(Avoid::VertID::src, 0);
     }
     if (_connEnd[1]->href) {
-        gchar ** href_strarray = NULL;
-        href_strarray = g_strsplit(_connEnd[1]->href, "_", 0);
         // href begins with a '#' which we don't want.
-        const char *endId = href_strarray[0] + 1;
+        const char *endId = _connEnd[1]->href + 1;
         GQuark itemId = g_quark_from_string(endId);
         _connRef->setEndPointId(Avoid::VertID::tar, itemId);
-        g_strfreev(href_strarray);
     }
     else {
         _connRef->setEndPointId(Avoid::VertID::tar, 0);
index 224442eb852370a877a160070d957f0ad09e6b13..3ad6954a25204497c27d4ea2f3bb24d74d47c91a 100644 (file)
@@ -21,6 +21,9 @@ static void change_endpts(SPCurve *const curve, double const endPos[2]);
 SPConnEnd::SPConnEnd(SPObject *const owner) :
     ref(owner),
     href(NULL),
+    // Default to center connection endpoint
+    type(ConnPointDefault),
+    id(4),
     _changed_connection(),
     _delete_connection(),
     _transformed_connection()
@@ -228,9 +231,10 @@ sp_conn_end_deleted(SPObject *, SPObject *const owner, unsigned const handle_ix)
     // todo: The first argument is the deleted object, or just NULL if
     //       called by sp_conn_end_detach.
     g_return_if_fail(handle_ix < 2);
-    char const *const attr_str[] = {"inkscape:connection-start",
-                                    "inkscape:connection-end"};
-    SP_OBJECT_REPR(owner)->setAttribute(attr_str[handle_ix], NULL);
+    char const * const attr_strs[] = {"inkscape:connection-start", "inkscape:connection-start-point",
+                                      "inkscape:connection-end", "inkscape:connection-end-point"};
+    SP_OBJECT_REPR(owner)->setAttribute(attr_strs[2*handle_ix], NULL);
+    SP_OBJECT_REPR(owner)->setAttribute(attr_strs[2*handle_ix+1], NULL);
     /* I believe this will trigger sp_conn_end_href_changed. */
 }
 
@@ -245,7 +249,9 @@ SPConnEnd::setAttacherHref(gchar const *value, SPPath* /*path*/)
 {
     if ( value && href && ( strcmp(value, href) == 0 ) ) {
         /* No change, do nothing. */
-    } else {
+    } 
+    else 
+    {
         if (!value)
         {
             ref.detach();
@@ -254,138 +260,104 @@ SPConnEnd::setAttacherHref(gchar const *value, SPPath* /*path*/)
         }
         else
         {
-
-            /* References to the connection points have the following format
-               #svguri_t_id, where #svguri is the id of the item the
-               connector is attached to, t is the type of the point, which
-               can be either "d" for default or "u" for user-defined, and
-               id is the local (inside the item) id of the connection point.
-               In the case of default points id represents the position on the
-               item (i.e. Top-Left, Centre-Centre, etc.).
-            */
-
-            gchar ** href_strarray = NULL;
-            if (href)
-                href_strarray = g_strsplit(href, "_", 0);
-            gchar ** value_strarray = g_strsplit(value, "_", 0);
-
-            g_free(href);
-            href = NULL;
-
-            bool changed = false;
             bool validRef = true;
+            href = g_strdup(value);
+            // Now do the attaching, which emits the changed signal.
+            try {
+                ref.attach(Inkscape::URI(value));
+            } catch (Inkscape::BadURIException &e) {
+                /* TODO: Proper error handling as per
+                * http://www.w3.org/TR/SVG11/implnote.html#ErrorProcessing.  (Also needed for
+                * sp-use.) */
+                g_warning("%s", e.what());
+                validRef = false;
+            }
 
-            if ( !href_strarray || g_strcmp0(href_strarray[0], value_strarray[0]) != 0 )
+            if ( !validRef )
             {
-                // The href has changed, so update it.
-                changed = true;
-                // Set the href field, because sp_conn_end_href_changed will need it.
-                href = g_strdup(value);
-                // Now do the attaching, which emits the changed signal.
-                try {
-                    ref.attach(Inkscape::URI(value_strarray[0]));
-                } catch (Inkscape::BadURIException &e) {
-                    /* TODO: Proper error handling as per
-                    * http://www.w3.org/TR/SVG11/implnote.html#ErrorProcessing.  (Also needed for
-                    * sp-use.) */
-                    g_warning("%s", e.what());
-                    validRef = false;
-                }
+                ref.detach();
+                g_free(href);
+                href = NULL;
             }
-            // Check to see if the connection point changed and update it.
-            //
+        }
+    }
+}
 
-            if ( !value_strarray[1] )
-            {
-                /* Treat the old references to connection points
-                   as default points that connect to the centre
-                   of the item.
-                */
-                if ( type != ConnPointDefault )
+void
+SPConnEnd::setAttacherEndpoint(gchar const *value, SPPath* /*path*/)
+{
+    
+    /* References to the connection points have the following format
+        <t><id>, where t is the type of the point, which
+        can be either "d" for default or "u" for user-defined, and
+        id is the local (inside the item) id of the connection point.
+        In the case of default points id represents the position on the
+        item (i.e. Top-Left, Center-Center, etc.).
+    */
+    
+    bool changed = false;
+    ConnPointType newtype = type;
+    
+    if (!value)
+    {
+        // Default to center endpoint
+        type = ConnPointDefault;
+        id = 4;
+    }
+    else
+    {
+        switch (value[0])
+        {
+            case 'd':
+                if ( newtype != ConnPointDefault )
                 {
-                    type = ConnPointDefault;
+                    newtype = ConnPointDefault;
                     changed = true;
                 }
-                if ( id != ConnPointPosCC )
+                break;
+            case 'u':
+                if ( newtype != ConnPointUserDefined)
                 {
-                    id = ConnPointPosCC;
+                    newtype = ConnPointUserDefined;
                     changed = true;
                 }
-            }
-            else
+                break;
+            default:
+                g_warning("Bad reference to a connection point.");
+        }
+        
+        int newid = (int) g_ascii_strtod( value+1, 0 );
+        if ( id != newid )
+        {
+            id = newid;
+            changed = true;
+        }
+
+        // We have to verify that the reference to the
+        // connection point is a valid one.
+        
+        if ( changed )
+        {
+
+            // Get the item the connector is attached to
+            SPItem* item = ref.getObject();
+            if ( item )
             {
-                switch (value_strarray[1][0])
-                {
-                    case 'd':
-                        if ( type != ConnPointDefault )
-                        {
-                            type = ConnPointDefault;
-                            changed = true;
-                        }
-                        break;
-                    case 'u':
-                        if ( type != ConnPointUserDefined)
-                        {
-                            type = ConnPointUserDefined;
-                            changed = true;
-                        }
-                        break;
-                    default:
-                        g_warning("Bad reference to a connection point.");
-                        validRef = false;
-                }
-                if ( value_strarray[2] )
+                if (!item->avoidRef->isValidConnPointId( newtype, newid ) )
                 {
-                    int newId = (int) g_ascii_strtod( value_strarray[2], 0 );
-                    if ( id != newId )
-                    {
-                        id = newId;
-                        changed = true;
-                    }
-
+                    g_warning("Bad reference to a connection point.");
                 }
                 else
                 {
-                    // We have a malformed reference to a connection point,
-                    // emit a warning, clear href and detach ref.
-                    changed = true;
-                    g_warning("Bad reference to a connection point.");\
-                    validRef = false;
+                    type = newtype;
+                    id = newid;
                 }
-            }
-
-            if ( changed )
-            {
-                // We still have to verify that the reference to the
-                // connection point is a valid one.
-
-                // Get the item the connector is attached to
-                SPItem* item = ref.getObject();
-                if ( item && !item->avoidRef->isValidConnPointId( type, id ) )
-                {
-                    g_warning("Bad reference to a connection point.");
-                    validRef = false;
+    /*          // Update the connector
+                if (path->connEndPair.isAutoRoutingConn()) {
+                    path->connEndPair.tellLibavoidNewEndpoints();
                 }
-/*                else
-                    // Update the connector
-                    if (path->connEndPair.isAutoRoutingConn()) {
-                        path->connEndPair.tellLibavoidNewEndpoints();
-                    }
-*/
-            }
-
-            if ( !validRef )
-            {
-                ref.detach();
-                g_free(href);
-                href = NULL;
+    */
             }
-            else
-                if (!href)
-                    href = g_strdup(value);
-
-            g_strfreev(href_strarray);
-            g_strfreev(value_strarray);
         }
     }
 }
index 5e9dbb9dae35620eb7d5a21154fd3552bf8bb694..16a611ec4bcdcc72a88328c716375fcc01a5cca6 100644 (file)
@@ -35,6 +35,8 @@ public:
     sigc::connection _transformed_connection;
 
     void setAttacherHref(gchar const *, SPPath *);
+    void setAttacherEndpoint(gchar const *, SPPath *);
+
 
 private:
     SPConnEnd(SPConnEnd const &);
index bbcb25356a28289f14d58f1485b574fb6d92ac7d..54d2a201a1480225c438fb778d5ca44d71baa7a1 100644 (file)
@@ -298,6 +298,8 @@ sp_path_set(SPObject *object, unsigned int key, gchar const *value)
         case SP_ATTR_CONNECTOR_CURVATURE:
         case SP_ATTR_CONNECTION_START:
         case SP_ATTR_CONNECTION_END:
+        case SP_ATTR_CONNECTION_START_POINT:
+        case SP_ATTR_CONNECTION_END_POINT:
             path->connEndPair.setAttr(key, value);
             break;
         default:
index f17686e5e0e53f0a5f0525a47fa8f39cbb102751..f81702f4f9c04841276767e1dbee2cac4a3265e9 100644 (file)
@@ -499,7 +499,7 @@ static gchar const * ui_descr =
         "  </toolbar>"
 
         "  <toolbar name='ConnectorToolbar'>"
-        "    <toolitem action='ConnectorEditModeAction' />"
+//        "    <toolitem action='ConnectorEditModeAction' />"
         "    <toolitem action='ConnectorAvoidAction' />"
         "    <toolitem action='ConnectorIgnoreAction' />"
         "    <toolitem action='ConnectorOrthogonalAction' />"
@@ -509,8 +509,8 @@ static gchar const * ui_descr =
         "    <toolitem action='ConnectorLengthAction' />"
         "    <toolitem action='ConnectorDirectedAction' />"
         "    <toolitem action='ConnectorOverlapAction' />"
-        "    <toolitem action='ConnectorNewConnPointAction' />"
-        "    <toolitem action='ConnectorRemoveConnPointAction' />"
+//        "    <toolitem action='ConnectorNewConnPointAction' />"
+//        "    <toolitem action='ConnectorRemoveConnPointAction' />"
         "  </toolbar>"
 
         "</ui>"