#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()
{
+ // asv 28.01.05 : set "Editing" flag only on "OK" pressed in BrowseDlg
+ //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)
void SUPERVGUI_CanvasPortOut::sync()
{
+ /* asv : 26.01.05 : Bug PAL7164 : sometimes CanvasPortOut::sync() is called twice (or maybe even more)
+ by mistake. It happens because of incorrect Qt events, or other reason, but it is not a
+ stable feature (bug). Adding an object in the study in sync() is therefore called more than once
+ which is a BUG. I decided to move call to putDataStudy() method to Event handling function.
+ When a node successfully finishes execution - check the ports and put out-value to study,
+ if the corresponding flag is set.
bool ok = getEngine()->State() == SUPERV_Ready;
if (ok && myInStudy) {
myInStudy = getMain()->putDataStudy(getEngine(), STUDY_PORT_OUT);
}
+ */
SUPERVGUI_CanvasPort::update();
}
{
Trace("SUPERVGUI_CanvasPortOut::toStudy");
- if (getMain()->getStudy()->getStudyDocument()->GetProperties()->IsLocked()) {
+ // asv 08.02.05 : added && !myInStudy - fix for PAL8105
+ if ( getMain()->getStudy()->getStudyDocument()->GetProperties()->IsLocked() && !myInStudy ) {
QMessageBox::warning(QAD_Application::getDesktop(), tr("WRN_WARNING"),
tr("WRN_STUDY_LOCKED"));
return;
}
- if (!getMain()->isFromStudy()) {
- if (getMain()->addStudy())
- getMain()->setAsFromStudy(true);
- }
myInStudy = !myInStudy;
sync();
getMain()->getCanvas()->update();
+
+ if ( myInStudy ) // put values to study (supervision, supervision->dataflow, supervision->dataflow->runXXX, etc.
+ getMain()->putDataStudy( getEngine(), STUDY_PORT_OUT );
}