Xcos MVC: allow passing mlists as Superblocks' subdiagrams
[scilab.git] / scilab / modules / scicos / src / cpp / view_scilab / DiagramAdapter.cpp
index 59643dc..abb9b7b 100644 (file)
@@ -49,6 +49,7 @@ namespace
 
 const std::wstring Deleted (L"Deleted");
 const std::wstring TextSharedTypeStr (L"Text");
+const std::wstring BlockSharedTypeStr (L"Block");
 
 struct props
 {
@@ -216,6 +217,19 @@ struct objs
                     diagramChildren.push_back(0ll);
                     diagramChildrenKind.push_back(ANNOTATION);
                 }
+                else if (header->get(0) == BlockSharedTypeStr)
+                {
+                    ScicosID localAdaptee = controller.createObject(BLOCK);
+                    BlockAdapter* localAdaptor = new BlockAdapter(controller, controller.getObject<model::Block>(localAdaptee));
+                    if (!localAdaptor->setAsTList(modelElement, controller))
+                    {
+                        list->killMe();
+                        return false;
+                    }
+
+                    diagramChildren.push_back(localAdaptee);
+                    list->set(i, localAdaptor);
+                }
                 else
                 {
                     list->killMe();