#include "GroupScene.h"\r
#include "GroupItem.h"\r
#include "BoxItem.h"\r
-#include "SourceItem.h"\r
+#include "StimuliItem.h"\r
#include "InterfaceItem.h"\r
#include "ConnectionItem.h"\r
\r
projectPath = "";\r
projectName = "";\r
projectFile = "";\r
+\r
+ graph = new Graph();\r
}\r
\r
Parameters::~Parameters() {\r
refPathes.clear();\r
}\r
\r
-Graph* Parameters::createGraph(bool createTopGroupIfaces) {\r
- graph = new Graph(createTopGroupIfaces);\r
+Graph* Parameters::initGraph(bool createTopGroupIfaces) {\r
+ graph->createTopGroup(createTopGroupIfaces);\r
return graph;\r
}\r
\r
void Parameters::destroyGraph() {\r
delete graph;\r
+ graph = new Graph();\r
}\r
\r
ReferenceBlock* Parameters::getReferenceBlock(int idCategory, int idBlock) {\r
return ref;\r
}\r
\r
+\r
void Parameters::createDelayBlock() {\r
delayRef = new ReferenceBlock("no.xml");\r
delayRef->addCategory(100);\r
if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));\r
\r
if (idUpperScene == -1) {\r
+ QString clkList = currentSceneNode.attribute("clklist","none");\r
+ if (clkList == "none") throw(Exception(PROJECTFILE_CORRUPTED));\r
+ QStringList clks = clkList.split(",");\r
+ for(int j=0;j<clks.size();j++) {\r
+ double freq = clks.at(j).toDouble(&ok);\r
+ if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));\r
+ graph->addClock(freq);\r
+ }\r
topGroup = dispatcher->createTopScene(Dispatcher::Load);\r
topScene->setId(idScene);\r
groupItem = topScene->getGroupItem(); \r
else {\r
cout << "trying to create scene n°" << idScene << " with upper scene n°" <<idUpperScene << endl;\r
GroupScene* upperScene = searchSceneById(idUpperScene, topScene);\r
+ /* IMPORTANT: calling addNewEmptyGroup() leads to create a new GroupWidget\r
+ * AND a BoxItem in upperScene that represents the GroupItem in the\r
+ * newly created child scene. Thus, it has not to be created when\r
+ * reading bi_group tags in the following but just searched\r
+ */\r
groupWidget = dispatcher->addNewEmptyGroup(Dispatcher::Load, upperScene,false);\r
groupWidget->getScene()->setId(idScene);\r
groupItem = groupWidget->getScene()->getGroupItem(); \r
cout << "top scene has " << sourceNodes.length() << " sources" << endl;\r
for(int j=0; j<sourceNodes.length(); j++) {\r
QDomElement currentSBNode = sourceNodes.at(j).toElement(); \r
- SourceItem* sourceItem = new SourceItem(dispatcher,this);\r
+ StimuliItem* sourceItem = new StimuliItem(dispatcher,this);\r
try {\r
sourceItem->load(currentSBNode);\r
}\r
}\r
cout << "source item has been read, add it to the scene" << endl;\r
// add the block to the GroupScene\r
- currentScene->addSourceItem(sourceItem);\r
+ currentScene->addStimuliItem(sourceItem);\r
} \r
}\r
/**********************************************************\r
int to = currentConnectionNode.attribute("to","none").toInt(&ok);\r
if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));\r
\r
-\r
+ bool showConn = true;\r
+ QString visStr = currentConnectionNode.attribute("visible","none");\r
+ if (visStr == "false") {\r
+ showConn = false;\r
+ }\r
InterfaceItem *iface1 = searchInterfaceItemById(from,topScene);\r
InterfaceItem *iface2 = searchInterfaceItemById(to,topScene);\r
\r
if(iface1 != NULL && iface2 != NULL){\r
- dispatcher->createConnection(Dispatcher::Load, iface1,iface2);\r
+ dispatcher->createConnection(Dispatcher::Load, iface1,iface2,showConn);\r
} else {\r
cout << "interfaces not found, connect canceled!" << endl;\r
}\r
\r
writer.writeAttribute("from",QString::number(item->getFromInterfaceItem()->getId()));\r
writer.writeAttribute("to", QString::number(item->getToInterfaceItem()->getId()));\r
-\r
+ if (!item->isVisible()) {\r
+ writer.writeAttribute("visible","false");\r
+ }\r
writer.writeEndElement();\r
}\r
\r
}\r
}\r
if (scene->isTopScene()) {\r
- foreach(SourceItem *block, scene->getSourceItems()){\r
+ foreach(StimuliItem *block, scene->getSourceItems()){\r
foreach(InterfaceItem *item, block->getInterfaces()){\r
if(item->getId() == id){\r
return item;\r