#include "SUPERVGUI_CanvasNode.h"
#include "SUPERVGUI_CanvasLink.h"
#include "SUPERVGUI_CanvasNodePrs.h"
+#include "SUPERVGUI_Clipboard.h"
#include "SUPERVGUI_Main.h"
#include "SUPERVGUI.h"
#include "SUPERVGUI_BrowseNodeDlg.h"
QPopupMenu* SUPERVGUI_CanvasPort::getPopupMenu(QWidget* theParent)
{
QPopupMenu* popup = new QPopupMenu(theParent);
- if (myMain->isEditable()) {
+ if ( myMain->isEditable() && !myMain->getDataflow()->IsExecuting() ) {
int anItem = popup->insertItem(tr("MSG_SKETCH_LINK"), this, SLOT(sketchLink()));
if (myMain->getDataflow()->IsExecuting())
popup->setItemEnabled(anItem, false);
|| myPort->Kind() == SUPERV::EndSwitchParameter);
popup->insertSeparator();
}
- if (myMain->isEditable()
+ if (myMain->isEditable() && !myMain->getDataflow()->IsExecuting()
&&
((myPort->IsEndSwitch() && myPort->IsInput())
||
!(myPort->Node()->Kind() == SUPERV::LoopNode && !myPort->IsInput())))) {
popup->insertItem(tr("ITM_DEL_PORT"), this, SLOT(remove()));
}
+ // Copy Port functionality
+ if (myMain->isEditable() && !myPort->Node()->IsFactory()
+ && !myPort->Node()->IsComputing()
+ && !myPort->Node()->IsMacro())
+ popup->insertItem(tr("ITM_COPY_PORT"), this, SLOT(copy()));
- int anItem = popup->insertItem(tr("MSG_BROWSE"), this, SLOT(browse()));
+//int anItem = popup->insertItem(tr("MSG_BROWSE"), this, SLOT(browse()));
// if (getEngine()->IsLinked())
// popup->setItemEnabled(anItem, getEngine()->State() == SUPERV_Ready);
// else
getPrs()->update();
}
-void SUPERVGUI_CanvasPort::sketchLink()
-{
+void SUPERVGUI_CanvasPort::sketchLink() {
+ myMain->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag
+
myMain->getCanvasView()->startSketch(this);
}
void SUPERVGUI_CanvasPort::remove() {
+ myMain->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag
+
+ //set myCopyPort from Main object to empty if engine of this port is deleted
+ //check if myCopyPort and this port engine is equal
+ SUPERVGUI_Clipboard* aCB = SUPERVGUI_Clipboard::getClipboard();
+ if ( aCB->isCopyPort() )
+ if ( QString(myPort->Node()->Name()) == QString(aCB->getCopyPort()->Node()->Name()) &&
+ QString(myPort->Name()) == QString(aCB->getCopyPort()->Name()) &&
+ myPort->IsInput() == aCB->getCopyPort()->IsInput() )
+ aCB->setCopyPort( 0 );
+
Trace("SUPERVGUI_CanvasPort::remove");
myPort->destroy();
delete this;
QMessageBox::information(QAD_Application::getDesktop(), tr("MSG_INFO"), aMes);
}
+void SUPERVGUI_CanvasPort::copy()
+{
+ SUPERVGUI_Clipboard* aCB = SUPERVGUI_Clipboard::getClipboard();
+ aCB->setCopyPort(SUPERV::Port::_duplicate(getEngine()));
+}
//***********************************************************
// Input Port
QPopupMenu* SUPERVGUI_CanvasPortIn::getPopupMenu(QWidget* theParent)
{
QPopupMenu* popup = SUPERVGUI_CanvasPort::getPopupMenu(theParent);
- bool editable = getEngine()->IsInput() && (!getEngine()->IsLinked());
+ bool editable = getEngine()->IsInput() && !getEngine()->IsLinked() && !getMain()->getDataflow()->IsExecuting();
if (!getEngine()->IsGate() && editable)
popup->insertItem(tr("MSG_SETVALUE"), this, SLOT(setInput()));
void SUPERVGUI_CanvasPortIn::setInput()
{
+ getMain()->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag
if (!myDlg) {
myDlg = new SUPERVGUI_GetValueDlg(this);
myDlg->installEventFilter(this);
myDlg->setActiveWindow();
myDlg->setFocus();
}
-
}
bool SUPERVGUI_CanvasPortIn::eventFilter(QObject* o, QEvent* e)