Xcos MVC: fix Diagrams's 'objs' property getter and setter
[scilab.git] / scilab / modules / scicos / src / cpp / model / Link.hxx
index d2d47ba..23f6285 100644 (file)
@@ -40,19 +40,25 @@ class Link: public BaseObject
 
 private:
     Link() : BaseObject(LINK), parentDiagram(0), sourcePort(0), destinationPort(0), controlPoints(),
-        label(), thick(), color(1), linkKind(regular) {};
+        label(), thick(std::vector<double>(2)), color(1), linkKind(regular) {};
     Link(const Link& o) : BaseObject(LINK), parentDiagram(o.parentDiagram), sourcePort(o.sourcePort), destinationPort(o.destinationPort),
         controlPoints(o.controlPoints), label(o.label), thick(o.thick), color(o.color), linkKind(o.linkKind) {};
     ~Link() {}
 
-    ScicosID getParentDiagram() const
+    void getParentDiagram(ScicosID& v) const
     {
-        return parentDiagram;
+        v = parentDiagram;
     }
 
-    void setParentDiagram(ScicosID parentDiagram)
+    update_status_t setParentDiagram(const ScicosID v)
     {
-        this->parentDiagram = parentDiagram;
+        if (v == parentDiagram)
+        {
+            return NO_CHANGES;
+        }
+
+        parentDiagram = v;
+        return SUCCESS;
     }
 
     void getControlPoints(std::vector<double>& v) const
@@ -154,24 +160,36 @@ private:
         return SUCCESS;
     }
 
-    ScicosID getDestinationPort() const
+    void getSourcePort(ScicosID& sp) const
     {
-        return destinationPort;
+        sp = sourcePort;
     }
 
-    void setDestinationPort(ScicosID destinationPort)
+    update_status_t setSourcePort(const ScicosID sp)
     {
-        this->destinationPort = destinationPort;
+        if (sp == sourcePort)
+        {
+            return NO_CHANGES;
+        }
+
+        sourcePort = sp;
+        return SUCCESS;
     }
 
-    ScicosID getSourcePort() const
+    void getDestinationPort(ScicosID& dp) const
     {
-        return sourcePort;
+        dp = destinationPort;
     }
 
-    void setSourcePort(ScicosID sourcePort)
+    update_status_t setDestinationPort(const ScicosID dp)
     {
-        this->sourcePort = sourcePort;
+        if (dp == destinationPort)
+        {
+            return NO_CHANGES;
+        }
+
+        destinationPort = dp;
+        return SUCCESS;
     }
 
 private: