- if (myMain->isEditable() && getNodeType() != SUPERV::FactoryNode
- && getNodeType() != SUPERV::ComputingNode
- && getNodeType() != SUPERV::EndLoopNode
- && getNodeType() != SUPERV::MacroNode) {
- QPopupMenu* addPortMenu = new QPopupMenu(theParent);
- addPortMenu->insertItem("Input", this, SLOT(addInputPort()));
- if (getNodeType() != SUPERV::LoopNode)
- addPortMenu->insertItem("Output", this, SLOT(addOutputPort()));
-
- popup->insertSeparator();
- if ((getNodeType() != SUPERV::EndSwitchNode))
- popup->insertItem("Edit Function", this, SLOT(editFunction()));
- popup->insertItem("Add Port", addPortMenu);
+ // for all InLine nodes
+ if ( type != SUPERV::FactoryNode && type != SUPERV::ComputingNode && type != SUPERV::MacroNode ) {
+ if ( myMain->isEditable() ) {
+ popup->insertSeparator();
+ popup->insertItem( tr( "MNU_EDIT_FUNC" ), this, SLOT(editFunction()));
+ }
+
+ // for all InLine, regardless isEditable() : Export to Library
+ popup->insertItem( tr( "MNU_EXPORT" ), this, SLOT( exportToLib()));
+
+ // for all InLine except EndLoop : Add Ports menu, Paste, Manage Ports
+ if ( myMain->isEditable() && type != SUPERV::EndLoopNode ) {
+ QPopupMenu* addPortMenu = new QPopupMenu(theParent);
+ addPortMenu->insertItem( tr( "MNU_INPUT" ), this, SLOT(addInputPort()));
+ if (getNodeType() != SUPERV::LoopNode)
+ addPortMenu->insertItem( tr( "MNU_OUTPUT" ), this, SLOT(addOutputPort()));
+
+ popup->insertItem( tr( "MNU_ADD_PORT" ), addPortMenu);
+ popup->insertItem( tr( "MNU_MANAGE_PORTS" ), this, SLOT(managePorts()));
+
+ // Paste Port functionality
+ int aPasteItem = popup->insertItem(tr("ITM_PASTE_PORT"), this, SLOT(pastePort()));
+ SUPERVGUI_Clipboard* aCB = SUPERVGUI_Clipboard::getClipboard();
+ if ( !aCB->isCopyPort() || (type == SUPERV::LoopNode && !aCB->getCopyPort()->IsInput()) )
+ popup->setItemEnabled( aPasteItem, false );
+ }