setZValue(100);
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemSendsGeometryChanges);
- initInterfaces();
+ createInterfaceItems();
updateGeometry(InterfaceMove);
- resetInterfacesPosition();
+ resetInterfaceItemsPosition();
QPointF initPos = QPointF(0.0,0.0) - originPoint;
setPos(initPos);
//cout << "total size of block: " << totalWidth << "," << totalHeight << endl;
}
}
if (boxSizeChanged) {
- updateInterfacesAndConnections();
+ updateInterfaceAndConnectionItems();
}
}
else if(params->editState == Parameters::EditInterfaceMove) {
prepareGeometryChange();
- moveInterfaceTo(event->pos());
+ moveInterfaceItemTo(event->pos());
// recompute the geometry of the block
if (updateGeometry(InterfaceMove)) {
//cout << "must recompute group item geometry" << endl;
int mode = getScene()->getEditionMode();
- dispatcher->setCurrentGroupWidget(getScene()->getGroupWidget());
+ dispatcher->setCurrentGroupWidget(Dispatcher::Design, getScene()->getGroupWidget());
if ((mode == GroupScene::AddConnection) && (params->cursorState == Parameters::CursorOnInterface)) {
- InterfaceItem *inter = getInterfaceFromCursor(x,y);
+ InterfaceItem *inter = getInterfaceItemFromCursor(x,y);
if (inter != NULL) {
if (params->editState == Parameters::EditNoOperation) {
else if (mode == GroupScene::ItemEdition) {
//setZValue(zValue()+100);
if (params->cursorState == Parameters::CursorOnInterface) {
- InterfaceItem *inter = getInterfaceFromCursor(x,y);
+ InterfaceItem *inter = getInterfaceItemFromCursor(x,y);
if (inter != NULL) {
if (inter == currentInterface) {
params->setEditState(Parameters::EditInterfaceDeselect);
else if (params->editState == Parameters::EditCloseConnection) {
InterfaceItem* iface1 = getScene()->getSelectedInterface(1);
InterfaceItem* iface2 = getScene()->getSelectedInterface(2);
- bool ok = dispatcher->createConnectionItem(iface1,iface2);
+ bool ok = dispatcher->createConnection(Dispatcher::Design, iface1,iface2);
if (ok) {
iface1->selected = false;
update(iface1->boundingRect());
int mode = getScene()->getEditionMode();
if (mode == GroupScene::AddConnection) {
- InterfaceItem* iface = getInterfaceFromCursor(x,y);
+ InterfaceItem* iface = getInterfaceItemFromCursor(x,y);
if (iface != NULL) {
params->cursorState = Parameters::CursorOnInterface;
setCursor(Qt::PointingHandCursor);
int marginE = 5;
int marginS = 5;
- InterfaceItem* iface = getInterfaceFromCursor(x,y);
+ InterfaceItem* iface = getInterfaceItemFromCursor(x,y);
if (iface != NULL) {
params->cursorState = Parameters::CursorOnInterface;
setCursor(Qt::PointingHandCursor);
QAction* renameAction = NULL;
QAction* showProperties = NULL;
QAction* showParameters = NULL;
+ QAction* showPatterns = NULL;
-
- InterfaceItem* ifaceItem = getInterfaceFromCursor(event->pos().x(), event->pos().y());
+ InterfaceItem* ifaceItem = getInterfaceItemFromCursor(event->pos().x(), event->pos().y());
// menu for interface
if( ifaceItem != NULL){
+ ConnectedInterface* iface = ifaceItem->refInter;
+
titleAction = menu.addAction("Interface operations");
titleAction->setEnabled(false);
menu.addSeparator();
showProperties = menu.addAction("Show properties");
renameAction = menu.addAction("Rename");
+ if (iface->getAssociatedIface() != NULL) {
+ if (iface->getDirection() == AbstractInterface::Output) {
+ showPatterns = menu.addAction("Show output pattern");
+ }
+ }
}
// menu for block
else {
if(selectedAction == NULL) return ;
if (selectedAction == removeAction) {
- dispatcher->removeSourceItem(this);
+ dispatcher->removeSourceItem(Dispatcher::Design, this);
}
else if (selectedAction == duplicateAction) {
- dispatcher->duplicateSourceItem(this);
+ dispatcher->duplicateSourceItem(Dispatcher::Design, this);
}
else if(selectedAction == renameAction){
if(ifaceItem != NULL) {
- dispatcher->renameInterface(ifaceItem);
+ dispatcher->renameInterface(Dispatcher::Design, ifaceItem);
}
else {
- dispatcher->renameSourceBlock(this);
+ dispatcher->renameSourceBlock(Dispatcher::Design, this);
}
}
else if(selectedAction == showProperties){
- dispatcher->showProperties(ifaceItem);
+ dispatcher->showProperties(Dispatcher::Design, ifaceItem);
}
else if(selectedAction == showParameters){
new ParametersWindow(refBlock, params, NULL);
}
+ else if(selectedAction == showPatterns) {
+ dispatcher->showPatterns(Dispatcher::Design, ifaceItem);
+ }
}
void SourceItem::load(QDomElement funcElement) throw(Exception) {
throw(Exception(PROJECTFILE_CORRUPTED));
}
if (referenceMd5 != referenceXml) {
- throw(Exception(PROJECTFILE_CORRUPTED));
+ reference = referenceXml;
}
else {
reference = referenceMd5;
}
-
- GroupBlock* parentGroupBlock = AB_TO_GRP(((GroupItem *)parentItem())->getRefBlock());
- FunctionalBlock* functionalBlock = params->getGraph()->createFunctionalBlock(parentGroupBlock, reference);
- /* NB: addFunctionalBlock creates all interfaces from the reference, which is annoying when
+
+ FunctionalBlock* functionalBlock = params->getGraph()->createSourceBlock(reference);
+ /* NB: createSourceBlock creates all interfaces from the reference, which is annoying when
reading bif_iface tags. Thus interface are all removed.
*/
functionalBlock->setName(name);
setId(id);
- QDomNodeList blockParamNodes = funcElement.elementsByTagName("bif_parameter");
+ QDomNodeList blockParamNodes = funcElement.elementsByTagName("source_parameter");
// setting parameters value
for(int i=0; i<blockParamNodes.length(); i++){
QDomElement currentBlockParamNode = blockParamNodes.at(i).toElement();
BlockParameter *blockParam = NULL;
blockParam = functionalBlock->getParameterFromName(name);
if (blockParam == NULL) throw(Exception(PROJECTFILE_CORRUPTED));
- blockParam->setValue(value);
+ blockParam->setValue(value);
}
// recreate all (non-control) interfaces because of some may have a multiplicity>1 with several examplars
functionalBlock->removeAllInterfaces();
- QDomNodeList interfaceNodes = funcElement.elementsByTagName("bif_iface");
+ QDomNodeList interfaceNodes = funcElement.elementsByTagName("source_iface");
// setting interfaces (user name, and for multiplicity>1 may be create some new ones)
for(int i=0; i<interfaceNodes.length(); i++) {
}
// creating InterfaceItem
- initInterfaces();
+ createInterfaceItems();
// setting them with saved values
for(int i=0; i<interfaceNodes.length(); i++){
double position = currentInterfaceNode.attribute("position","none").toDouble(&ok);
if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));
- InterfaceItem *interfaceItem = searchInterfaceByName(name);
+ InterfaceItem *interfaceItem = searchInterfaceItemByName(name);
interfaceItem->setId(id);
interfaceItem->setOrientation(orientation);
interfaceItem->setPositionRatio(position);