X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/4cf57e6db08da791233d75237f62e74bc88dd427..2bdaa0aa3fab52f0808f60d9bbdabcd56d0efae9:/SourceItem.cpp?ds=sidebyside diff --git a/SourceItem.cpp b/SourceItem.cpp index 6c2b30d..0229e7f 100644 --- a/SourceItem.cpp +++ b/SourceItem.cpp @@ -30,7 +30,7 @@ SourceItem::SourceItem(AbstractBlock *_refBlock, setZValue(100); setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemSendsGeometryChanges); - initInterfaceItems(); + createInterfaceItems(); updateGeometry(InterfaceMove); resetInterfaceItemsPosition(); QPointF initPos = QPointF(0.0,0.0) - originPoint; @@ -315,7 +315,7 @@ void SourceItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { int mode = getScene()->getEditionMode(); - dispatcher->setCurrentGroupWidget(getScene()->getGroupWidget()); + dispatcher->setCurrentGroupWidget(Dispatcher::Design, getScene()->getGroupWidget()); if ((mode == GroupScene::AddConnection) && (params->cursorState == Parameters::CursorOnInterface)) { InterfaceItem *inter = getInterfaceItemFromCursor(x,y); @@ -389,7 +389,7 @@ void SourceItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { else if (params->editState == Parameters::EditCloseConnection) { InterfaceItem* iface1 = getScene()->getSelectedInterface(1); InterfaceItem* iface2 = getScene()->getSelectedInterface(2); - bool ok = dispatcher->createConnection(iface1,iface2); + bool ok = dispatcher->createConnection(Dispatcher::Design, iface1,iface2); if (ok) { iface1->selected = false; update(iface1->boundingRect()); @@ -496,12 +496,14 @@ void SourceItem::contextMenuEvent(QGraphicsSceneContextMenuEvent * event) { QAction* renameAction = NULL; QAction* showProperties = NULL; QAction* showParameters = NULL; - + QAction* showPatterns = NULL; 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(); @@ -510,6 +512,11 @@ void SourceItem::contextMenuEvent(QGraphicsSceneContextMenuEvent * event) { 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 { @@ -532,25 +539,28 @@ void SourceItem::contextMenuEvent(QGraphicsSceneContextMenuEvent * event) { 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) { @@ -598,7 +608,7 @@ void SourceItem::load(QDomElement funcElement) throw(Exception) { throw(Exception(PROJECTFILE_CORRUPTED)); } if (referenceMd5 != referenceXml) { - throw(Exception(PROJECTFILE_CORRUPTED)); + reference = referenceXml; } else { reference = referenceMd5; @@ -669,7 +679,7 @@ void SourceItem::load(QDomElement funcElement) throw(Exception) { } // creating InterfaceItem - initInterfaceItems(); + createInterfaceItems(); // setting them with saved values for(int i=0; i