]> AND Private Git Repository - blast.git/blobdiff - GroupItem.cpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
source connection ok
[blast.git] / GroupItem.cpp
index c965452a932cbb99fd288e55d70ace9f575a83e4..e219f4c7fa68e24843f95bbb6c6060096a7e7bba 100644 (file)
@@ -383,12 +383,7 @@ void GroupItem::mousePressEvent(QGraphicsSceneMouseEvent *event) {
 
   dispatcher->setCurrentGroupWidget(getScene()->getGroupWidget());
 
-  /* NOTE : commneted because group interface are normally
-     created and the connected directly to a block within
-     the group. Furthermore, there can be a single connection
-     from a groupe interface.
-
-  if ((mode == GroupScene::AddConnection) && (params->cursorState == Parameters::CursorOnInterface)) {
+  if ((refBlock->isTopGroupBlock()) && (mode == GroupScene::AddConnection) && (params->cursorState == Parameters::CursorOnInterface)) {
     InterfaceItem *inter = getInterfaceFromCursor(x,y);
     if (inter != NULL) {
 
@@ -406,9 +401,8 @@ void GroupItem::mousePressEvent(QGraphicsSceneMouseEvent *event) {
         }
       }
     }
-  }
-  */
-  if (mode == GroupScene::ItemEdition) {
+  }  
+  else if (mode == GroupScene::ItemEdition) {
 
     if (params->cursorState == Parameters::CursorOnInterface) {
       InterfaceItem *inter = getInterfaceFromCursor(x,y);
@@ -433,12 +427,7 @@ void GroupItem::mouseReleaseEvent(QGraphicsSceneMouseEvent  *event) {
 
   int mode = getScene()->getEditionMode();
 
-  /* NOTE : commneted because group interface are normally
-     created and the connected directly to a block within
-     the group. Furthermore, there can be a single connection
-     from a groupe interface.
-
-  if (mode == GroupScene::AddConnection) {
+  if ((refBlock->isTopGroupBlock()) && (mode == GroupScene::AddConnection)) {
 
     if (params->editState == Parameters::EditStartConnection) {
       params->setEditState(Parameters::EditStartConnection);
@@ -456,7 +445,7 @@ void GroupItem::mouseReleaseEvent(QGraphicsSceneMouseEvent  *event) {
     else if (params->editState == Parameters::EditCloseConnection) {
       InterfaceItem* iface1 = getScene()->getSelectedInterface(1);
       InterfaceItem* iface2 = getScene()->getSelectedInterface(2);
-      bool ok = dispatcher->connect(iface1,iface2);
+      bool ok = dispatcher->createConnectionItem(iface1,iface2);
       if (ok) {
         iface1->selected = false;
         update(iface1->boundingRect());
@@ -465,9 +454,8 @@ void GroupItem::mouseReleaseEvent(QGraphicsSceneMouseEvent  *event) {
         params->setEditState(Parameters::EditNoOperation);
       }
     }
-  }
-  */
-  if (mode == GroupScene::ItemEdition) {
+  }  
+  else if (mode == GroupScene::ItemEdition) {
     currentInterface = NULL;
     setFlag(ItemIsMovable, true);
     params->editState = Parameters::EditNoOperation;