#include "AbstractInterface.h"
#include "ConnectedInterface.h"
#include "GroupScene.h"
+#include "ParametersWindow.h"
GroupItem::GroupItem(BoxItem *_parentItem,
Parameters *_params) throw(Exception) :AbstractBoxItem( _refBlock, _dispatcher, _params) {
parentItem = _parentItem;
+ if (parentItem != NULL) {
+ parentItem->setChildGroupItem(this);
+ }
/*
minimumBoxWidth = nameWidth+2*nameMargin;
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
void GroupItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) {
QMenu menu;
+ QAction* titleAction = NULL;
QAction* showProperties = NULL;
QAction* removeAction = NULL;
QAction* renameAction = NULL;
+ QAction* showParameters = NULL;
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();
}
}
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());
if(selectedAction == renameAction){
if(ifaceItem != NULL)
- dispatcher->rename(ifaceItem);
+ dispatcher->renameInterface(ifaceItem);
else
- dispatcher->rename(this);
+ dispatcher->renameBlockOrGroup(this);
}
else if(selectedAction == showProperties){
dispatcher->showProperties(ifaceItem);
- }
+ }
else if (selectedAction == removeAction) {
dispatcher->removeGroupInterface(ifaceItem);
}
+ else if(selectedAction == showParameters) {
+ new ParametersWindow(refBlock, params, NULL);
+ }
}
InterfaceItem* GroupItem::isHoverInterface(QPointF point) {