connect(myTitle, SIGNAL(MouseMove (QMouseEvent*)), this, SLOT(mouseTitleMove(QMouseEvent*)));
connect(myTitle, SIGNAL(MouseRelease(QMouseEvent*)), this, SLOT(mouseTitleRelease(QMouseEvent*)));
- myPortsBox = new QFrame(0);
- myPortLayout = new QGridLayout(myPortsBox, 0, 2, 0, 1);
+ myPortsBox = new QVBox(0);
+ myPortsBox->setSpacing(3);
+ myValuesBox = new QWidget(myPortsBox);
+ myPortLayout = new QGridLayout(myValuesBox, 0, 2, 0, 1);
+
+ myGatesBox = new QFrame(myPortsBox);
+ myGatesBox->setFrameStyle( QFrame::Panel | QFrame::Raised );
+ myGatesBox->setLineWidth(2);
+ // myGatesBox->setPaletteBackgroundColor(backgroundColor().dark(105));
+ myGatesBox->setPaletteBackgroundColor(green.light(170));
+ myGatesLayout = new QGridLayout(myGatesBox, 0, 2);
+ myGatesLayout->setMargin(3);
myTimer = new QTimer(this);
connect(myTimer, SIGNAL(timeout()), this, SLOT(movingNode(/*QMouseEvent* e*/)));
myPOcount = 0;
SUPERV_Ports ports = myNode->Ports();
int n = ports->length();
-
+
for (int i=0; i<n; i++) {
if (ports[i]->IsInput()) {
- myPortLayout->addWidget(new SUPERVGUI_PortIn(myPortsBox, myMain, ports[i]),
- myPIcount, 0);
- myPIcount++;
+ if (getComputingNode()->IsEndSwitch()) {
+ if (ports[i]->IsGate())
+ myGatesLayout->addWidget(new SUPERVGUI_PortInESNode(myGatesBox, myMain, ports[i]),
+ 0, 0);
+ else {
+ myPortLayout->addWidget(new SUPERVGUI_PortInESNode(myValuesBox, myMain, ports[i]),
+ myPIcount, 0);
+ myPIcount++;
+ }
+ } else {
+ if (ports[i]->IsGate())
+ myGatesLayout->addWidget(new SUPERVGUI_PortIn(myGatesBox, myMain, ports[i]),
+ 0, 0);
+ else {
+ myPortLayout->addWidget(new SUPERVGUI_PortIn(myValuesBox, myMain, ports[i]),
+ myPIcount, 0);
+ myPIcount++;
+ }
+ }
} else {
- myPortLayout->addWidget(new SUPERVGUI_PortOut(myPortsBox, myMain, ports[i]),
- myPOcount, 1, Qt::AlignRight);
- myPOcount++;
+ if (ports[i]->IsGate())
+ myGatesLayout->addWidget(new SUPERVGUI_PortOut(myGatesBox, myMain, ports[i]),
+ 0, 1, Qt::AlignRight);
+ else {
+ myPortLayout->addWidget(new SUPERVGUI_PortOut(myValuesBox, myMain, ports[i]),
+ myPOcount, 1, Qt::AlignRight);
+ myPOcount++;
+ }
}
}
+
}
//check: is creation of link is complete
if (myMain->getGraph()->isAnyLinkCreating()) {
//not creation complete
- //cout<<" --- $$$ 1"<<endl;
myPopup->setItemEnabled(myDeleteItem, false);
}
else {
* If toCheckExisting = true the existing of links will be checked before creation
*/
void SUPERVGUI_GraphNode::updateLinksPrs(bool toCheckExisting) {
+
SUPERVGUI_Graph* aGraph= myMain->getGraph();
- SUPERVGUI_PortIn* pi;
- QObjectList* ihmList = queryList("SUPERVGUI_PortIn");
- QObjectListIt i(*ihmList);
- while ((pi=(SUPERVGUI_PortIn*)i.current()) != 0) {
- ++i;
- if (pi->getPort()->IsLinked()) {
- SUPERV_Link aLink = pi->getPort()->Link();
- if (toCheckExisting) {
- if (aGraph->isLinkPrsExists(aLink))
- continue;
+ //Find PortInESNode
+ SUPERVGUI_PortInESNode* piES;
+ QObjectList* ihmListES = queryList("SUPERVGUI_PortInESNode");
+ QObjectListIt iES(*ihmListES);
+ if (iES.count()) {
+ while ((piES=(SUPERVGUI_PortInESNode*)iES.current()) != 0) {
+ ++iES;
+ if (piES->getPort()->IsLinked()) {
+ SUPERV_Links aLinks = piES->getPort()->Links();
+ for (int j=0; j<aLinks->length(); j++) {
+ if (toCheckExisting) {
+ if (aGraph->isLinkPrsExists(aLinks[j]))
+ continue;
+ }
+ aGraph->createLinkPrs(aLinks[j]);
+ }
}
- aGraph->createLinkPrs(aLink);
}
}
- delete ihmList;
+ else {
+ SUPERVGUI_PortIn* pi;
+ QObjectList* ihmList = queryList("SUPERVGUI_PortIn");
+ QObjectListIt i(*ihmList);
+ while ((pi=(SUPERVGUI_PortIn*)i.current()) != 0) {
+ ++i;
+ if (pi->getPort()->IsLinked()) {
+ SUPERV_Link aLink = pi->getPort()->Link();
+ if (toCheckExisting) {
+ if (aGraph->isLinkPrsExists(aLink))
+ continue;
+ }
+ aGraph->createLinkPrs(aLink);
+ }
+ }
+ delete ihmList;
+ }
+ delete ihmListES;
}
thePort->deleteLinks();
thePort->getPort()->destroy();
+
thePort->close(true);
+
updatePorts();
updateShape();
}
if (aPort == NULL) return;
if (getNodeType() == SUPERV::EndSwitchNode) {
- SUPERVGUI_PortInESNode* aPortPrs = new SUPERVGUI_PortInESNode(myPortsBox, myMain, aPort);
+ SUPERVGUI_PortInESNode* aPortPrs = new SUPERVGUI_PortInESNode(myValuesBox, myMain, aPort);
myPortLayout->addWidget(aPortPrs, myPIcount, 0);
if (myPortsBox->isVisible()) {
}
}
else {
- SUPERVGUI_PortIn* aPortPrs = new SUPERVGUI_PortIn(myPortsBox, myMain, aPort);
+ SUPERVGUI_PortIn* aPortPrs = new SUPERVGUI_PortIn(myValuesBox, myMain, aPort);
myPortLayout->addWidget(aPortPrs, myPIcount, 0);
if (myPortsBox->isVisible()) {
SUPERV_Port aPort = createOutPort();
if (aPort == NULL) return;
- SUPERVGUI_PortOut* aPortPrs = new SUPERVGUI_PortOut(myPortsBox, myMain, aPort);
+ SUPERVGUI_PortOut* aPortPrs = new SUPERVGUI_PortOut(myValuesBox, myMain, aPort);
myPortLayout->addWidget(aPortPrs, myPOcount, 1, Qt::AlignRight);
myPOcount++;
if (myPortsBox->isVisible()) {
aPortPrs = (SUPERVGUI_Port*) child(aName, "SUPERVGUI_Port");
if (aPortPrs == NULL) {
if (aPorts[i]->IsInput()) {
- SUPERVGUI_PortIn* aPortIn = new SUPERVGUI_PortIn(myPortsBox, myMain, aPorts[i]);
- myPortLayout->addWidget(aPortIn, myPIcount, 0);
+ SUPERVGUI_PortIn* aPortIn;
+ if (aPorts[i]->IsGate()) {
+ aPortIn = new SUPERVGUI_PortIn(myGatesBox, myMain, aPorts[i]);
+ myGatesLayout->addWidget(aPortIn, myPIcount, 0);
+ } else {
+ aPortIn = new SUPERVGUI_PortIn(myValuesBox, myMain, aPorts[i]);
+ myPortLayout->addWidget(aPortIn, myPIcount, 0);
+ myPIcount++;
+ }
if (aIsVisible) aPortIn->show();
- myPIcount++;
isAdded = true;
} else {
- SUPERVGUI_PortOut* aPortOut = new SUPERVGUI_PortOut(myPortsBox, myMain, aPorts[i]);
- myPortLayout->addWidget(aPortOut, myPOcount, 1, Qt::AlignRight);
+ SUPERVGUI_PortOut* aPortOut;
+ if (aPorts[i]->IsGate()) {
+ aPortOut = new SUPERVGUI_PortOut(myGatesBox, myMain, aPorts[i]);
+ myGatesLayout->addWidget(aPortOut, myPOcount, 1, Qt::AlignRight);
+ } else {
+ aPortOut = new SUPERVGUI_PortOut(myValuesBox, myMain, aPorts[i]);
+ myPortLayout->addWidget(aPortOut, myPOcount, 1, Qt::AlignRight);
+ myPOcount++;
+ }
if (aIsVisible) aPortOut->show();
- myPOcount++;
isAdded = true;
}
}
QObjectListIt aLI(*aShownPortsList);
SUPERVGUI_Port* aVisPort;
+
while ((aVisPort=(SUPERVGUI_Port*)aLI.current()) != 0) {
++aLI;
QString aNameVisible(aVisPort->getPort()->Name());
}
}
}
+
+
+/**
+ * Returns coordinates of connection point in content coordinates
+ */
+QPoint SUPERVGUI_GraphNode::getInConnectPnt() {
+ return QPoint(pos().x(),
+ pos().y() + (height()/2));
+}
+QPoint SUPERVGUI_GraphNode::getOutConnectPnt() {
+ return QPoint(pos().x() + width(),
+ pos().y() + (height()/2));
+}