X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/3bbc311e444c1ef9ac66dd6861fb0acb13ddb72a..6e2b3026c6a496e81642c373796bd39dad33d2a6:/SourceItem.cpp?ds=sidebyside diff --git a/SourceItem.cpp b/SourceItem.cpp index 62f601a..52cf887 100644 --- a/SourceItem.cpp +++ b/SourceItem.cpp @@ -30,9 +30,9 @@ SourceItem::SourceItem(AbstractBlock *_refBlock, setZValue(100); setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemSendsGeometryChanges); - initInterfaces(); + initInterfaceItems(); updateGeometry(InterfaceMove); - resetInterfacesPosition(); + resetInterfaceItemsPosition(); QPointF initPos = QPointF(0.0,0.0) - originPoint; setPos(initPos); //cout << "total size of block: " << totalWidth << "," << totalHeight << endl; @@ -177,7 +177,7 @@ bool SourceItem::updateGeometry(ChangeType type) { } } if (boxSizeChanged) { - updateInterfacesAndConnections(); + updateInterfaceAndConnectionItems(); } @@ -288,7 +288,7 @@ void SourceItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { } 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; @@ -318,7 +318,7 @@ void SourceItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { dispatcher->setCurrentGroupWidget(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) { @@ -339,7 +339,7 @@ void SourceItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { 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); @@ -424,7 +424,7 @@ void SourceItem::hoverMoveEvent(QGraphicsSceneHoverEvent * event) { 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); @@ -438,7 +438,7 @@ void SourceItem::hoverMoveEvent(QGraphicsSceneHoverEvent * event) { 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); @@ -498,7 +498,7 @@ void SourceItem::contextMenuEvent(QGraphicsSceneContextMenuEvent * event) { QAction* showParameters = 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){ @@ -598,15 +598,14 @@ 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); @@ -617,7 +616,7 @@ void SourceItem::load(QDomElement funcElement) throw(Exception) { setId(id); - QDomNodeList blockParamNodes = funcElement.elementsByTagName("bif_parameter"); + QDomNodeList blockParamNodes = funcElement.elementsByTagName("source_parameter"); // setting parameters value for(int i=0; igetParameterFromName(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; isetId(id); interfaceItem->setOrientation(orientation); interfaceItem->setPositionRatio(position);