#include "GroupScene.h"
#include "GroupItem.h"
#include "BoxItem.h"
-#include "SourceItem.h"
+#include "StimuliItem.h"
#include "InterfaceItem.h"
#include "ConnectionItem.h"
mainWindow->getLibrary()->updateComboScene();
}
-void Dispatcher::renameSourceBlock(Context context, SourceItem *item){
- static QString fctName = "Dispatcher::renameSourceBlock()";
+void Dispatcher::renameStimuliItem(Context context, StimuliItem *item){
+ static QString fctName = "Dispatcher::renameStimuliItem()";
#ifdef DEBUG_FCTNAME
cout << "call to " << qPrintable(fctName) << endl;
#endif
bool ok = false;
QString text = "";
while (!ok) {
- text = QInputDialog::getText(win, "Rename a source",
+ text = QInputDialog::getText(win, "Rename a stimuli",
"New name:", QLineEdit::Normal,
item->getRefBlock()->getName(), &ok);
if (!ok) return;
ok = false;
}
else {
- FunctionalBlock* block = params->getGraph()->getSourceBlockByName(text);
+ FunctionalBlock* block = params->getGraph()->getStimuliBlockByName(text);
if (block != NULL) {
QMessageBox::warning(win,"Error in given name",
- "the name provided is similar to that of another source block within the top group",
+ "the name provided is similar to that of another stimuli block within the top group",
QMessageBox::Ok);
ok = false;
}
}
}
-void Dispatcher::duplicateSourceItem(Context context, SourceItem *item) {
- static QString fctName = "Dispatcher::duplicateSourceItem()";
+void Dispatcher::duplicateStimuliItem(Context context, StimuliItem *item) {
+ static QString fctName = "Dispatcher::duplicateStimuliItem()";
#ifdef DEBUG_FCTNAME
cout << "call to " << qPrintable(fctName) << endl;
#endif
// adding to the model
FunctionalBlock* funBlock = (FunctionalBlock*)block;
- newBlock = params->getGraph()->duplicateSourceBlock(funBlock);
+ newBlock = params->getGraph()->duplicateStimuliBlock(funBlock);
// adding to the view
- scene->createSourceItem(newBlock);
+ scene->createStimuliItem(newBlock);
params->unsaveModif = true;
}
#ifdef DEBUG_FCTNAME
cout << "call to " << qPrintable(fctName) << endl;
#endif
- bool newSource = false;
+ bool newStimuli = false;
BoxItem* item = NULL;
/* For now, this method is only used while designing and not loading */
GroupScene *scene = getSceneById(idScene);
ReferenceBlock* ref = params->getReferenceBlock(idCategory,idBlock);
// if block has no inputs, propose to add it as a source to top scene
- if ((scene->isTopScene()) && (ref->isGeneratorBlock())) {
- int ret = QMessageBox::question(NULL,"Adding a block to top scene","Selected block may be used as a source for the top scene. Do you want to add it as a source ?");
+ if ((scene->isTopScene()) && (ref->isSourceBlock())) {
+ int ret = QMessageBox::question(NULL,"Adding a block to top scene","Selected block may be used as a stimuli for the top scene. Do you want to add it as a stimuli ?");
if (ret == QMessageBox::Yes) {
- newSource = true;
+ newStimuli = true;
}
}
- if (newSource) {
- FunctionalBlock* newOne = params->getGraph()->createSourceBlock(ref, true);
- scene->createSourceItem(newOne);
+ if (newStimuli) {
+ FunctionalBlock* newOne = params->getGraph()->createStimuliBlock(ref, true);
+ scene->createStimuliItem(newOne);
}
else {
if (context == Design) {
- params->clocks.append(frequency);
+ params->getGraph()->addClock(frequency);
// get the top group
GroupBlock *group = params->getGraph()->getTopGroup();
FunctionalBlock* newOne = params->getGraph()->createFunctionalBlock(group, ref, true);
QString name = "clkrstgen_";
- name += QString::number(params->clocks.size()-1);
+ name += QString::number(params->getGraph()->getClocks().size()-1);
newOne->setName(name);
// creating the box item
ConnectedInterface* fromIfaceClk = NULL;
ConnectedInterface* fromIfaceReset = NULL;
- QString clkName = "ext_clk_"+QString::number(params->clocks.size()-1);
- QString rstName = "ext_reset_"+QString::number(params->clocks.size()-1);
+ QString clkName = "ext_clk_"+QString::number(params->getGraph()->getClocks().size()-1);
+ QString rstName = "ext_reset_"+QString::number(params->getGraph()->getClocks().size()-1);
fromIfaceClk = new GroupInterface(group,clkName, AbstractInterface::Input, AbstractInterface::Clock);
fromIfaceReset = new GroupInterface(group,rstName, AbstractInterface::Input, AbstractInterface::Reset);
group->addInterface(fromIfaceClk);
-GroupWidget *Dispatcher::createTopScene(Context context){
+GroupWidget *Dispatcher::createTopScene(Context context, double mainClock){
static QString fctName = "Dispatcher::createTopScene()";
#ifdef DEBUG_FCTNAME
cout << "call to " << qPrintable(fctName) << endl;
createIfaces = false;
}
// creating the graph and thus, the topgroup
- Graph* graph = params->createGraph(createIfaces);
+ Graph* graph = params->initGraph(createIfaces);
+ graph->addClock(mainClock);
// get the top group
GroupBlock *topBlock = graph->getTopGroup();
// creating the top group widget
if (context == Design) {
// create clkrstgen
- double freq = params->clocks.at(0);
- params->clocks.clear();
+ double freq = params->getGraph()->getClock(0);
+ params->getGraph()->resetClocks();
addClkRstGenBlock(context,freq);
}
}
}
-void Dispatcher::removeSourceItem(Context context, SourceItem *item) {
- static QString fctName = "Dispatcher::removeSourceItem()";
+void Dispatcher::removeStimuliItem(Context context, StimuliItem *item) {
+ static QString fctName = "Dispatcher::removeStimuliItem()";
#ifdef DEBUG_FCTNAME
cout << "call to " << qPrintable(fctName) << endl;
#endif
- QString msg = "Removing source ";
+ QString msg = "Removing stimmuli ";
msg += item->getRefBlock()->getName();
msg += " and all its connections.\n\nAre you sure ?";
- int ret = QMessageBox::question(NULL,"Removing source block",msg, QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok);
+ int ret = QMessageBox::question(NULL,"Removing stimuli block",msg, QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok);
if (ret == QMessageBox::Cancel) {
return;
}
removeAllBlockConnections(context, item);
FunctionalBlock* block = AB_TO_FUN(item->getRefBlock());
- item->getScene()->removeSourceItem(item);
- params->getGraph()->removeSourceBlock(block);
+ item->getScene()->removeStimuliItem(item);
+ params->getGraph()->removeStimuliBlock(block);
}