Xcos MVC: allow to pass Links as mlists 30/16730/2
Paul Bignier [Thu, 25 Jun 2015 15:15:23 +0000 (17:15 +0200)]
Change-Id: I66bb2af625f132d34fd68d978a7d4e33ce7bf8ec

scilab/modules/scicos/src/cpp/view_scilab/DiagramAdapter.cpp

index abb9b7b..bdfadc7 100644 (file)
@@ -50,6 +50,7 @@ namespace
 const std::wstring Deleted (L"Deleted");
 const std::wstring TextSharedTypeStr (L"Text");
 const std::wstring BlockSharedTypeStr (L"Block");
+const std::wstring LinkSharedTypeStr (L"Link");
 
 struct props
 {
@@ -230,6 +231,19 @@ struct objs
                     diagramChildren.push_back(localAdaptee);
                     list->set(i, localAdaptor);
                 }
+                else if (header->get(0) == LinkSharedTypeStr)
+                {
+                    ScicosID localAdaptee = controller.createObject(LINK);
+                    LinkAdapter* localAdaptor = new LinkAdapter(controller, controller.getObject<model::Link>(localAdaptee));
+                    if (!localAdaptor->setAsTList(modelElement, controller))
+                    {
+                        list->killMe();
+                        return false;
+                    }
+
+                    diagramChildren.push_back(localAdaptee);
+                    list->set(i, localAdaptor);
+                }
                 else
                 {
                     list->killMe();