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

Private GIT Repository
insert/move/remove block/groups/interface done. Next to fo: loading project file
[blast.git] / GroupItem.cpp
index bb26e53b17c42e64995373dfa6f75c91ede37caa..fa341b268d166c1de4bee34a0a2b90f3d9b3e061 100644 (file)
@@ -9,6 +9,7 @@
 #include "AbstractInterface.h"
 #include "ConnectedInterface.h"
 #include "GroupScene.h"
 #include "AbstractInterface.h"
 #include "ConnectedInterface.h"
 #include "GroupScene.h"
+#include "ParametersWindow.h"
 
 
 GroupItem::GroupItem(BoxItem *_parentItem,
 
 
 GroupItem::GroupItem(BoxItem *_parentItem,
@@ -17,6 +18,9 @@ GroupItem::GroupItem(BoxItem *_parentItem,
                      Parameters *_params) throw(Exception) :AbstractBoxItem( _refBlock, _dispatcher, _params) {
 
   parentItem = _parentItem;
                      Parameters *_params) throw(Exception) :AbstractBoxItem( _refBlock, _dispatcher, _params) {
 
   parentItem = _parentItem;
+  if (parentItem != NULL) {
+    parentItem->setChildGroupItem(this);
+  }
 
   /*
   minimumBoxWidth = nameWidth+2*nameMargin;
 
   /*
   minimumBoxWidth = nameWidth+2*nameMargin;
@@ -337,7 +341,7 @@ void GroupItem::mousePressEvent(QGraphicsSceneMouseEvent *event) {
 
   int mode = getScene()->getEditionMode();
 
 
   int mode = getScene()->getEditionMode();
 
-  dispatcher->setCurrentGroupWidget(getScene()->getGroupWindow());
+  dispatcher->setCurrentGroupWidget(getScene()->getGroupWidget());
 
   /* NOTE : commneted because group interface are normally
      created and the connected directly to a block within
 
   /* NOTE : commneted because group interface are normally
      created and the connected directly to a block within
@@ -500,12 +504,19 @@ void GroupItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) {
 
 void GroupItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) {
   QMenu menu;
 
 void GroupItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) {
   QMenu menu;
+  QAction* titleAction = NULL;
   QAction* showProperties = NULL;
   QAction* removeAction = NULL;
   QAction* renameAction = NULL;
   QAction* showProperties = NULL;
   QAction* removeAction = NULL;
   QAction* renameAction = NULL;
+  QAction* showParameters = NULL;
 
   InterfaceItem* ifaceItem = getInterfaceFromCursor(event->pos().x(), event->pos().y());
 
   InterfaceItem* ifaceItem = getInterfaceFromCursor(event->pos().x(), event->pos().y());
-  if( ifaceItem != NULL){
+
+  // menu for interface
+  if( ifaceItem != NULL) {
+    titleAction = menu.addAction("Interface operations");
+    titleAction->setEnabled(false);
+    menu.addSeparator();
     showProperties = menu.addAction("Show properties");
     renameAction = menu.addAction("Rename");
     menu.addSeparator();
     showProperties = menu.addAction("Show properties");
     renameAction = menu.addAction("Rename");
     menu.addSeparator();
@@ -520,6 +531,13 @@ void GroupItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) {
     }
   }
   else {
     }
   }
   else {
+    titleAction = menu.addAction("Block operations");
+    titleAction->setEnabled(false);
+    menu.addSeparator();
+
+    if (refBlock->nbParameters() > 0) {
+      showParameters = menu.addAction("Show parameters");
+    }
     renameAction = menu.addAction("Rename");
   }
   QAction* selectedAction = menu.exec(event->screenPos());
     renameAction = menu.addAction("Rename");
   }
   QAction* selectedAction = menu.exec(event->screenPos());
@@ -528,16 +546,19 @@ void GroupItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) {
 
   if(selectedAction == renameAction){
     if(ifaceItem != NULL)
 
   if(selectedAction == renameAction){
     if(ifaceItem != NULL)
-      dispatcher->rename(ifaceItem);
+      dispatcher->renameInterface(ifaceItem);
     else
     else
-      dispatcher->rename(this);
+      dispatcher->renameBlockOrGroup(this);
   }
   else if(selectedAction == showProperties){
     dispatcher->showProperties(ifaceItem);
   }
   else if(selectedAction == showProperties){
     dispatcher->showProperties(ifaceItem);
-  }
+  }  
   else if (selectedAction == removeAction) {
     dispatcher->removeGroupInterface(ifaceItem);
   }
   else if (selectedAction == removeAction) {
     dispatcher->removeGroupInterface(ifaceItem);
   }
+  else if(selectedAction == showParameters) {
+    new ParametersWindow(refBlock, params, NULL);
+  }
 }
 
 InterfaceItem* GroupItem::isHoverInterface(QPointF point) {
 }
 
 InterfaceItem* GroupItem::isHoverInterface(QPointF point) {