]> AND Private Git Repository - blast.git/blobdiff - Parameters.cpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
insert/move/remove block/groups/interface done. Next to fo: loading project file
[blast.git] / Parameters.cpp
index c991e5ff86fd033d5470157f7303d67576c0a6be..fce043506b96dce7c4a8ccb6962ceb386345dd11 100644 (file)
@@ -69,37 +69,23 @@ void Parameters::destroyGraph() {
   delete graph;\r
 }\r
 \r
-GroupBlock* Parameters::addGroupBlock() {\r
-  GroupBlock* parent = AB_TO_GRP(currentScene->getGroupItem()->getRefBlock());\r
-  GroupBlock* newOne = graph->createChildBlock(parent);\r
-  return newOne;\r
-}\r
-\r
-FunctionalBlock* Parameters::addFunctionalBlock(int idCategory, int idBlock) {\r
+ReferenceBlock* Parameters::getReferenceBlock(int idCategory, int idBlock) {\r
 \r
   BlockCategory* blockCat = categoryTree->searchCategory(idCategory);\r
 \r
   if (blockCat == NULL) return NULL;\r
-  GroupBlock* group = AB_TO_GRP(currentScene->getGroupItem()->getRefBlock());\r
   ReferenceBlock* ref = blockCat->getBlock(idBlock);\r
-  if (ref == NULL) return NULL;\r
-\r
-  FunctionalBlock* newOne = graph->addFunctionalBlock(group, ref);\r
-  unsaveModif = true;\r
-\r
-  return newOne;\r
+  return ref;\r
 }\r
 \r
+\r
 FunctionalBlock* Parameters::duplicateFunctionalBlock(FunctionalBlock *block) {\r
 \r
   ReferenceBlock* ref = block->getReference();\r
   GroupBlock* group = AB_TO_GRP(block->getParent());\r
 \r
-  // adding to the group\r
-  FunctionalBlock* newBlock = new FunctionalBlock(group,ref);\r
-  newBlock->populate();\r
-  group->addBlock(newBlock);\r
-\r
+  // adding to the graph\r
+  FunctionalBlock* newBlock = graph->addFunctionalBlock(group,ref);\r
   return newBlock;\r
 }\r
 \r
@@ -1032,11 +1018,11 @@ void Parameters::updateToolbar() {
   int nb = currentScene->getBlockItems().length();\r
   for(int i = 0; i<nb; i++){\r
     if(currentScene->getBlockItems().at(i)->isSelected()){\r
-      currentScene->getGroupWindow()->enableGroupButton(true);\r
+      currentScene->getGroupWidget()->enableGroupButton(true);\r
       return;\r
     }\r
   }\r
-  currentScene->getGroupWindow()->enableGroupButton(false);\r
+  currentScene->getGroupWidget()->enableGroupButton(false);\r
 }\r
 \r
 \r
@@ -1098,9 +1084,6 @@ void Parameters::save(QString confFile) {
     // cross the scene level by level using a FIFO\r
     QList<GroupScene*> fifoScene;\r
     fifoScene.append(topScene);\r
-    foreach(ConnectionItem* item, topScene->getConnectionItems()) {\r
-      allConnections.append(item);\r
-    }\r
 \r
     GroupScene *scene;\r
     while (!fifoScene.isEmpty()) {\r
@@ -1109,11 +1092,12 @@ void Parameters::save(QString confFile) {
       foreach(GroupScene* s, scene->getChildrenScene()) {\r
         fifoScene.append(s);\r
       }\r
-      foreach(ConnectionItem* item, topScene->getConnectionItems()) {\r
+\r
+      foreach(ConnectionItem* item, scene->getConnectionItems()) {\r
         allConnections.append(item);\r
       }\r
     }\r
-\r
+    writer.writeEndElement();    //</scenes>\r
 \r
     writer.writeStartElement("connections");\r
     foreach(ConnectionItem* item, allConnections) {\r