#include "AbstractBlock.h"
#include "GroupScene.h"
+#include "GroupItem.h"
#include "AbstractInterface.h"
#include "ConnectedInterface.h"
selected = false;
currentInterface = NULL;
rstClkVisible = false;
+ wishboneVisible = false;
setAcceptHoverEvents(true);
selected = false;
currentInterface = NULL;
rstClkVisible = false;
-
+ wishboneVisible = false;
+
setAcceptHoverEvents(true);
// NOTE : initInterfaces() is only called in subclasses
bool AbstractBoxItem::isGroupItem() {
return false;
}
+void AbstractBoxItem::setRstClkVisible(bool b) {
+ rstClkVisible = b;
+ foreach(InterfaceItem* ifaceItem, interfaces) {
+ if ((ifaceItem->refInter->getPurpose() == AbstractInterface::Clock) ||
+ (ifaceItem->refInter->getPurpose() == AbstractInterface::Reset) ) {
+ ifaceItem->visible = b;
+ }
+ }
+ resetInterfacesPosition();
+ updateGeometry(InterfaceMove);
+ update();
+ getScene()->updateConnectionItemsShape();
+ (getScene()->getGroupItem())->updateShape();
+
+}
+
+void AbstractBoxItem::setWishboneVisible(bool b) {
+ wishboneVisible = b;
+ foreach(InterfaceItem* ifaceItem, interfaces) {
+ if (ifaceItem->refInter->getPurpose() == AbstractInterface::Wishbone) {
+ ifaceItem->visible = b;
+ }
+ }
+ resetInterfacesPosition();
+ updateGeometry(InterfaceMove);
+ update();
+ getScene()->updateConnectionItemsShape();
+ (getScene()->getGroupItem())->updateShape();
+}
void AbstractBoxItem::setRefBlock(AbstractBlock* _refBlock) {
refBlock = _refBlock;
int orientation = Parameters::West;
foreach(AbstractInterface *inter, refBlock->getInterfaces()){
- if(inter->getPurpose() != AbstractInterface::Wishbone){
- InterfaceItem *item;
- if(inter->getDirection() == AbstractInterface::Input){
- orientation = Parameters::West;
- } else if(inter->getDirection() == AbstractInterface::Output){
- orientation = Parameters::East;
- } else if(inter->getDirection() == AbstractInterface::InOut){
- orientation = Parameters::North;
- }
- item = new InterfaceItem(0.0 , orientation, (ConnectedInterface *)inter, this, params);
- interfaces.append(item);
+
+ InterfaceItem *item;
+ if(inter->getDirection() == AbstractInterface::Input){
+ orientation = Parameters::West;
+ } else if(inter->getDirection() == AbstractInterface::Output){
+ orientation = Parameters::East;
+ } else if(inter->getDirection() == AbstractInterface::InOut){
+ orientation = Parameters::North;
}
+ item = new InterfaceItem(0.0 , orientation, (ConnectedInterface *)inter, this, params);
+ interfaces.append(item);
}
}
foreach(InterfaceItem* inter, interfaces) {
// only data interfaces and if needed time and reset
- if(inter->refInter->getPurpose() == AbstractInterface::Data || inter->getOwner()->isRstClkVisible()){
+ if(inter->visible) {
if(inter->getOrientation() == Parameters::North){
nbNorth++;
} else if(inter->getOrientation() == Parameters::South){
foreach(InterfaceItem* inter, interfaces) {
- if(inter->refInter->getPurpose() == AbstractInterface::Data || inter->getOwner()->isRstClkVisible()){
+ if(inter->visible){
if(inter->getOrientation() == Parameters::North){
positionRatio = cntNorth/(double)(nbNorth+1);
void setRefBlock(AbstractBlock* _refBlock);
inline void setId(int _id){ id = _id; }
inline void setSelected(bool _selected) { selected = _selected; }
- inline void setRstClkVisible(bool b){ rstClkVisible = b;}
+ void setRstClkVisible(bool b);
+ void setWishboneVisible(bool b);
void setDimension(int x, int y);
inline void setCurrentInterface(InterfaceItem* iface) { currentInterface = iface; }
virtual bool isGroupItem();
inline bool isSelected() { return selected; }
inline bool isRstClkVisible(){ return rstClkVisible;}
+ inline bool isWishboneVisible(){ return wishboneVisible;}
bool isInterfaces(int orientation) const;
// others
QPointF originPoint; // the left-top point that is the origin of the bounding box
bool selected;
- bool rstClkVisible;
+ bool rstClkVisible; //! true if clock/reset interfaces are visible
+ bool wishboneVisible; //! true if wishbone interfaces are visible
QPointF currentPosition; // the start point for resize
QAction* showProperties = NULL;
QAction* cloneInterface = NULL;
QAction* openWindow = NULL;
- QAction* showRstClkInter = NULL;
+ QAction* showRstClkIface = NULL;
+ QAction* showWishboneIface = NULL;
QAction* showParameters = NULL;
InterfaceItem* ifaceItem = getInterfaceFromCursor(event->pos().x(), event->pos().y());
}
else {
duplicateAction = menu.addAction("Duplicate");
- showRstClkInter = menu.addAction("Show reset/clock interfaces");
- showRstClkInter->setCheckable(true);
- showRstClkInter->setChecked(rstClkVisible);
+ showRstClkIface = menu.addAction("Show reset/clock interfaces");
+ showRstClkIface->setCheckable(true);
+ showRstClkIface->setChecked(rstClkVisible);
+ showWishboneIface = menu.addAction("Show wishbone interfaces");
+ showWishboneIface->setCheckable(true);
+ showWishboneIface->setChecked(wishboneVisible);
}
removeAction = menu.addAction("Remove");
}
else if (selectedAction == openWindow){
dispatcher->showRaiseWindow(this);
}
- else if(selectedAction == showRstClkInter){
- dispatcher->showRstClkInter(this);
+ else if(selectedAction == showRstClkIface) {
+ dispatcher->showRstClkIface(this);
+ }
+ else if(selectedAction == showWishboneIface) {
+ dispatcher->showWishboneIface(this);
}
else if(selectedAction == showParameters){
new ParametersWindow(refBlock, params, NULL);
params->setCurrentScene(currentGroup->getScene());
}
-void Dispatcher::showRstClkInter(AbstractBoxItem *item) {
- static QString fctName = "Dispatcher::showRstClkInter()";
+void Dispatcher::showRstClkIface(AbstractBoxItem *item) {
+ static QString fctName = "Dispatcher::showRstClkIface()";
#ifdef DEBUG_FCTNAME
cout << "call to " << qPrintable(fctName) << endl;
#endif
item->setRstClkVisible(!item->isRstClkVisible());
- item->resetInterfacesPosition();
+
+}
+
+void Dispatcher::showWishboneIface(AbstractBoxItem *item) {
+ static QString fctName = "Dispatcher::showWishboneIface()";
+#ifdef DEBUG_FCTNAME
+ cout << "call to " << qPrintable(fctName) << endl;
+#endif
- item->getScene()->updateConnectionItemsShape();
+ item->setWishboneVisible(!item->isWishboneVisible());
}
void Dispatcher::addNewFullGroup() {
GroupWidget* createChildScene(GroupWidget* parentWidget, BoxItem* upperItemOfGroupItem = NULL);
void destroyScene(GroupScene* scene);
void showRaiseWindow(BoxItem *item);
- void showRstClkInter(AbstractBoxItem *item);
+ void showRstClkIface(AbstractBoxItem *item);
+ void showWishboneIface(AbstractBoxItem *item);
GroupWidget *addNewEmptyGroup(GroupScene *scene, bool show = true);
void addNewFullGroup();
GroupWidget* topGroup = dispatcher->createTopScene();
addTopGroup(topGroup);
library->updateComboScene();
+ library->show();
params->isCurrentProject = true;
}
break;
}
}
+ else {
+ doClose = true;
+ }
if (doClose) {
// removing the GroupWidget from stack
QWidget *widget = stackedWidget->widget(1);
slotCloseProject();
event->ignore();
}
+ else {
+ library->deleteLater();
+ }
}
int duration = 0;
QString wbValue = "";
QStringList listWb = wbStr.split(",");
+ cout << "wb param has:";
+ foreach(QString s, listWb) {
+ cout << qPrintable(s) << " | ";
+ }
+ cout << endl;
if (listWb.at(0) == "r") {
access = BlockParameter::Read;
}
- else if (wbStr == "w") {
+ else if (listWb.at(0) == "w") {
access = BlockParameter::Write;
bool ok;
wbValue = listWb.at(1).toInt(&ok);
nameStr = eltOutput.attribute("name","none");
typeStr = eltOutput.attribute("type","none");
widthStr = eltOutput.attribute("width","none");
- purposeStr = eltOutput.attribute("type","none");
+ purposeStr = eltOutput.attribute("purpose","none");
purpose = ReferenceInterface::translatePurpose(purposeStr);
multStr = eltOutput.attribute("multiplicity","none");
mult = ReferenceInterface::translateMultiplicity(multStr);
nameStr = eltBidir.attribute("name","none");
typeStr = eltBidir.attribute("type","none");
widthStr = eltBidir.attribute("width","none");
- purposeStr = eltBidir.attribute("type","none");
+ purposeStr = eltBidir.attribute("purpose","none");
purpose = ReferenceInterface::translatePurpose(purposeStr);
multStr = eltBidir.attribute("multiplicity","none");
mult = ReferenceInterface::translateMultiplicity(multStr);
foreach(BlockParameter* param, params) {
if (param->isWishboneParameter()) {
- BlockParameterWishbone* p = (BlockParameterWishbone*)param;
- int orientation = -1;
+
+ BlockParameterWishbone* p = (BlockParameterWishbone*)param;
+ cout << "creating interface for parameter wb " << qPrintable(p->getName()) << endl;
+
if (p->getWBAccess() == BlockParameter::Read) {
- iface = new ReferenceInterface(this,p->getName(),p->getType(),p->getWidth(), AbstractInterface::Output, AbstractInterface::Wishbone,1);
+ iface = new ReferenceInterface(this,p->getName(),p->getTypeString(),p->getWidth(), AbstractInterface::Output, AbstractInterface::Wishbone,1);
outputs.append(iface);
}
else if (p->getWBAccess() == BlockParameter::Write) {
- iface = new ReferenceInterface(this,p->getName(),p->getType(),p->getWidth(), AbstractInterface::Input, AbstractInterface::Wishbone,1);
+ iface = new ReferenceInterface(this,p->getName(),p->getTypeString(),p->getWidth(), AbstractInterface::Input, AbstractInterface::Wishbone,1);
inputs.append(iface);
}
- ReferenceInterface* iface = new ReferenceInterface(this,p->getName(),p->getType(),p->getWidth(), orientation, AbstractInterface::Wishbone,1);
+ else {
+ throw (Exception(BLOCKFILE_CORRUPTED));
+ }
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 3.2.1, 2017-05-04T17:29:00. -->
+<!-- Written by QtCreator 3.2.1, 2017-05-04T21:30:29. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
- <value type="QByteArray">{1d077e47-e3a1-47fd-8b12-4de650e39df5}</value>
+ <value type="QByteArray">{c8006d66-d34f-42be-ad10-d0207752286d}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{451ee8a3-56ff-4aba-8a8e-3da882cc142e}</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{2c9bf876-3476-44eb-8065-1f0844704dda}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
- <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/localhome/sdomas/Projet/Blast/code/blast</value>
+ <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/sdomas/Projet/Blast/code/blast</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<valuelist type="QVariantList" key="GenericProjectManager.GenericMakeStep.BuildTargets">
<name>\r
block multiply/add\r
</name>\r
- <category ids="2,5" /> \r
+ <category ids="1,4" /> \r
<description>\r
<brief>\r
This block multiplies 2 input values, adding the result to a third one.\r