]> SALOME platform Git repositories - modules/superv.git/blob - src/SUPERVGUI/SUPERVGUI_Graph.cxx
Salome HOME
DCQ:prepare 2.0.0
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_Graph.cxx
1 //  SUPERV SUPERVGUI : GUI for Supervisor component
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SUPERVGUI_Graph.cxx
25 //  Author : Francis KLOSS
26 //  Module : SUPERV
27
28 using namespace std;
29 #include "SUPERVGUI_Def.h"
30 #include "SUPERVGUI_Graph.h"
31 #include "SUPERVGUI_Main.h"
32 #include "SUPERVGUI_ComputeNode.h"
33 #include "SUPERVGUI_ControlNode.h"
34 #include "SUPERVGUI.h"
35
36 #include <qapplication.h>
37 #include <qlabel.h>
38 #include <qgroupbox.h>
39 #include <qlayout.h>
40
41 //#define CHECKTIME
42
43 #ifdef CHECKTIME
44 #include <sys/timeb.h>
45 #endif
46
47
48 #define UPDATECONTROLNODES(NodesName)  \
49     n = nodes->NodesName.length(); \
50     for (int i=0; i<n; i++) { \
51       SUPERV_CNode aCNode = SUPERV::CNode::_narrow(nodes->NodesName[i]); \
52       SUPERV_CNode aCNodeEnd = SUPERV::CNode::_narrow(nodes->NodesName[i]->Coupled()); \
53       ihmNode = (SUPERVGUI_Node *)child(aCNode->Name(), "SUPERVGUI_Node"); \
54       if (ihmNode == NULL) { \
55         main->addControlNode(aCNode, aCNodeEnd, false); \
56       } else { \
57         ResizeGraph(ihmNode, aCNode->X(), aCNode->Y()); \
58         moveChild(ihmNode, aCNode->X(), aCNode->Y());  \
59         ihmList->removeRef(ihmNode); \
60         ihmNode->sync(); \
61         aEndNodePrs = (SUPERVGUI_EndControlNode*)child(aCNodeEnd->Name(), "SUPERVGUI_EndControlNode"); \
62         ResizeGraph(aEndNodePrs, aCNodeEnd->X(), aCNodeEnd->Y()); \
63         moveChild(aEndNodePrs, aCNodeEnd->X(), aCNodeEnd->Y());  \
64         ihmList->removeRef(aEndNodePrs); \
65         aEndNodePrs->sync(); \
66       } \
67     }
68
69
70 #define UPDATENODES(NodesName, FuncName)   \
71     n = nodes->NodesName.length(); \
72     for (int i=0; i<n; i++) { \
73       SUPERV_CNode aCNode = SUPERV::CNode::_narrow(nodes->NodesName[i]); \
74       ihmNode = (SUPERVGUI_Node *)child(aCNode->Name(), "SUPERVGUI_Node"); \
75       if (ihmNode == NULL) { \
76           main->FuncName(aCNode); \
77       } else { \
78         ResizeGraph(ihmNode, aCNode->X(), aCNode->Y()); \
79         moveChild(ihmNode, aCNode->X(), aCNode->Y()); \
80         ihmList->removeRef(ihmNode); \
81         ihmNode->sync(); \
82       } \
83     }
84
85
86 SUPERVGUI_Graph::SUPERVGUI_Graph(SUPERVGUI_Main* m):
87     SUPERVGUI_View(m),
88     myNewLink(0)
89 {
90   Trace("SUPERVGUI_Graph::SUPERVGUI_Graph");
91   myIsControlView = false;
92   myLinksList.setAutoDelete(true);
93   viewport()->setMouseTracking(true);
94
95   resizeContents(GRAPH_WIDTH, GRAPH_HEIGHT);
96   
97   if (SUPERV_isNull(main->getDataflow())) return;
98   
99  
100   //create sketching popup menu
101   mySketchPopup = new QPopupMenu(viewport());
102   if (!mySketchPopup->isCheckable())
103     mySketchPopup->setCheckable(true);
104   myDelPntItem = mySketchPopup->insertItem(tr("MSG_DEL_LAST_PNT"), this, SLOT(delLastPnt()));
105   mySketchPopup->insertItem(tr("MSG_DEL_LINK"), this, SLOT(delCreatingLink()));
106   myOrtoItem = mySketchPopup->insertItem(tr("MSG_ORTHO_LINE"), this, SLOT(setOrtho()));
107
108   //create link popup menu
109   myLinkPopup = new QPopupMenu(viewport());
110   myDelLinkItem = myLinkPopup->insertItem(tr("MSG_DELLINK"), this, SLOT(deleteLink()));
111   myAddLinkPntItem = myLinkPopup->insertItem(tr("MSG_ADD_POINT"), this, SLOT(addPoint()));
112   myDelLinkPntItem = myLinkPopup->insertItem(tr("MSG_DEL_POINT"), this, SLOT(deletePoint()));
113 }
114
115
116
117 SUPERVGUI_Graph::~SUPERVGUI_Graph() {
118 }
119
120 /** 
121  * Synchronizes Graph presentation with internal graph structure
122  */
123 void SUPERVGUI_Graph::sync() {
124     if (SUPERV_isNull(main->getDataflow())) return;
125       
126     myLinksList.clear();
127
128     SUPERVGUI_Node* ihmNode;
129     QObjectList* ihmList = queryList("SUPERVGUI_Node");
130     SUPERV_Nodes nodes = main->getDataflow()->Nodes();
131
132     MESSAGE("CNodes="<<nodes->CNodes.length());
133     MESSAGE("FNodes="<<nodes->FNodes.length());
134     MESSAGE("INodes="<<nodes->INodes.length());
135     MESSAGE("GNodes="<<nodes->GNodes.length());
136     MESSAGE("LNodes="<<nodes->LNodes.length());
137     MESSAGE("SNodes="<<nodes->SNodes.length());
138
139     int n;
140     UPDATENODES(CNodes, addComputeNode);
141     UPDATENODES(FNodes, addComputeNode);
142     UPDATENODES(INodes, addComputeNode);
143     UPDATENODES(GNodes, addGOTONode);
144
145     SUPERVGUI_EndControlNode* aEndNodePrs;
146     UPDATECONTROLNODES(LNodes);    
147     UPDATECONTROLNODES(SNodes);
148
149     QObjectListIt i(*ihmList);
150     while ((ihmNode=(SUPERVGUI_Node*)i.current()) != 0) {
151       ++i;
152       ihmNode->close(true);
153     }
154     delete ihmList;
155
156     ihmList = queryList("SUPERVGUI_GraphNode");
157     i=(*ihmList);
158     SUPERVGUI_GraphNode* aGraphNode;
159     while ((aGraphNode=(SUPERVGUI_GraphNode*)i.current()) != 0) {
160       ++i;
161       aGraphNode->updateLinksPrs();
162     }
163     delete ihmList;
164
165     draw();
166 }
167
168
169 /**
170  * Reimplemented for repainting links
171  */
172 bool SUPERVGUI_Graph::eventFilter(QObject* object, QEvent* event) {
173   if (event->type() == QEvent::Paint) {
174     draw();
175     return true;
176   }
177   return QScrollView::eventFilter(object, event);
178 }
179
180
181 /**
182  * Clears content of Graph (links)
183  */
184 void SUPERVGUI_Graph::clearView() {
185   QPainter aPainter(viewport());
186   aPainter.eraseRect(viewport()->rect());    
187 }
188
189
190 /**
191  * Draws links using off screen buffer
192  */
193 void SUPERVGUI_Graph::draw() {
194 #ifdef CHECKTIME
195   struct timeb aTm1;
196   ftime(&aTm1);
197 #endif
198   if (myLinksList.count() == 0) {
199     return;
200   }
201   int aWidth = viewport()->width();
202   int aHeight = viewport()->height();
203   QPixmap aPixmap(aWidth, aHeight);
204   aPixmap.setOptimization(QPixmap::BestOptim);
205   aPixmap.fill(viewport()->paletteBackgroundColor());
206   
207   QPainter aPainter(&aPixmap);
208   QPoint aPos = viewportToContents(viewport()->pos());
209
210   if (myIsControlView) {
211     SUPERVGUI_CtrlLink* aLink;
212     QMap<QString, SUPERVGUI_CtrlLink>::Iterator it;    
213     for ( it = myCtrlLinks.begin(); it != myCtrlLinks.end(); ++it ) {
214       it.data().paint(&aPainter, false);
215     }
216   } else {
217     SUPERVGUI_Link* aLink;
218     for (aLink = myLinksList.first(); aLink; aLink = myLinksList.next()) {
219       aLink->isInRect(aPos.x(), aPos.y(), aWidth, aHeight);
220       if (aLink->isInRect(aPos.x(), aPos.y(), aWidth, aHeight)) {
221         aLink->paint(&aPainter, false);
222       }
223     }    
224   }
225   bitBlt(viewport(), 0, 0, 
226              &aPixmap, 0, 0, aWidth, aHeight, 
227              Qt::CopyROP, true);
228   
229   if (myNewLink) {
230     myNewLink->repaintSketch();
231   }
232 #ifdef CHECKTIME
233   struct timeb aTm2;
234   ftime(&aTm2);
235   ulong aTm = 1000*(aTm2.time-aTm1.time)+(aTm2.millitm-aTm1.millitm);
236   //cout<<"### Time="<<aTm<<endl;
237 #endif
238 }
239
240
241 void SUPERVGUI_Graph::contentsMousePressEvent(QMouseEvent* e) {
242   Trace("SUPERVGUI_Graph::contentsMousePressEvent");
243   if ( e->button() == Qt::RightButton) {
244     if (myNewLink) {
245       main->showPopup(mySketchPopup, e);
246     } else {
247       SUPERVGUI_Link* aLink = SUPERVGUI_Link::getSelectedLink();
248       if (aLink && main->isEditable()) {
249         myLinkPopup->setItemEnabled(myAddLinkPntItem, 
250                                     !aLink->haveSelectedPoint());
251         myLinkPopup->setItemEnabled(myDelLinkPntItem, 
252                                     aLink->haveSelectedPoint());
253
254
255         if (!aLink->isESInputPort()) {
256           SUPERV::KindOfPort aOutType = aLink->getOutputPort()->getPort()->Kind();
257           SUPERV::KindOfPort aInType = aLink->getInputPort()->getPort()->Kind();
258           myLinkPopup->setItemEnabled(myDelLinkItem,
259                                       ((aOutType != SUPERV::LoopParameter) 
260                                        && 
261                                        (aInType != SUPERV::LoopParameter)));
262         }
263         
264         myMousePos = e->pos();
265         mySelectedLink = aLink;
266         mySelectedPoint = mySelectedLink->getSelectedPoint();
267         main->showPopup(myLinkPopup, e);
268       } else {
269         mySelectedLink = 0;
270         addDSPopupItem();
271         main->showPopup(myPopup, e);
272       }
273     }
274   } 
275   emit mousePressed(e);
276     
277   SUPERVGUI_View::contentsMousePressEvent(e);  
278 }
279
280
281 void SUPERVGUI_Graph::contentsMouseReleaseEvent(QMouseEvent* e) {
282   Trace("SUPERVGUI_Graph::contentsMouseReleaseEvent");
283   if (myNewLink && (e->button() == Qt::LeftButton)) {
284     myNewLink->addTmpPoint(e->pos());
285     mySketchPopup->setItemEnabled(myDelPntItem, true);      
286   } 
287   emit mouseReleased(e);
288   SUPERVGUI_View::contentsMouseReleaseEvent(e);
289 }
290
291
292 void SUPERVGUI_Graph::contentsMouseMoveEvent(QMouseEvent* e) {
293   Trace("SUPERVGUI_Graph::contentsMouseMoveEvent");
294   if (myNewLink) {
295     myNewLink->drawTo(e->pos());
296   } 
297   emit mouseMoved(e);
298   SUPERVGUI_View::contentsMouseMoveEvent(e);
299 }
300
301
302 void SUPERVGUI_Graph::addPoint() {
303   mySelectedLink->addPoint(myMousePos.x(), myMousePos.y());
304 }
305
306
307 void SUPERVGUI_Graph::deletePoint() {
308   mySelectedLink->removePoint(mySelectedPoint);
309 }
310
311
312 void SUPERVGUI_Graph::deleteLink() {
313   QString aName;
314   if (mySelectedLink->isESInputPort())
315     aName = mySelectedLink->getInputPortES()->getPort()->Name();
316   else
317     aName = mySelectedLink->getInputPort()->getPort()->Name();
318
319   if (aName != "Default") {
320     deleteLink(mySelectedLink);
321     mySelectedLink = 0;
322     repaintContents();
323   }
324 }
325
326
327 void SUPERVGUI_Graph::deleteLink(SUPERVGUI_Link* theLink) {
328   if (getMain()->getDataflow()->IsDone()) {
329     //update values of input ports of theLink if theLink is deleted and dataflow has been executed any times
330     SUPERVGUI_PortIn* aInPort = theLink->getInputPort();
331     if ( aInPort ) {
332       //input port exist
333       QString aPortValue = QString(aInPort->getPort()->ToString());
334       if ( (aInPort->getPort()->IsParam() || aInPort->getPort()->IsInLine())
335            &&
336            !aPortValue.isNull()) {
337         //gives a value to an input port
338         theLink->destroyEngine();
339         aInPort->getPort()->Input( Supervision.getEngine()->StringValue( aPortValue ) );
340         aInPort->sync();
341       }
342       else 
343         theLink->destroyEngine();
344     }
345     else
346       theLink->destroyEngine(); 
347   }
348   else
349     theLink->destroyEngine();
350
351   myLinksList.removeRef(theLink);
352   if (myLinksList.count() == 0) clearView();
353 }
354
355
356 void SUPERVGUI_Graph::setAsFromStudy(bool theToStudy) {
357   SUPERVGUI_View::setAsFromStudy(theToStudy);
358   if (theToStudy) return;
359
360   SUPERVGUI_PortOut* aPortOut;
361   QObjectList* aPortsList = queryList("SUPERVGUI_PortOut");
362   QObjectListIt aPortIt(*aPortsList);
363   while ((aPortOut=(SUPERVGUI_PortOut*)aPortIt.current()) != 0) {
364     ++aPortIt;
365     if (aPortOut->isInStudy()) {
366       aPortOut->setStudyState(false);
367       aPortOut->sync();
368     }
369   }
370   delete aPortsList;
371 }
372
373
374 /**
375  * Begins Link sketching
376  */
377 void SUPERVGUI_Graph::sketchBegin(SUPERVGUI_Port* thePort) {
378   if (thePort == 0) return;
379
380   SUPERV_Port aPort = thePort->getPort();
381   myNewLink = new SUPERVGUI_Link(this);
382   mySketchPopup->setItemEnabled(myDelPntItem, false);      
383   mySketchPopup->setItemChecked(myOrtoItem, myNewLink->isOrthoMode());
384
385   myNewLink->setBeginPort(thePort);
386
387   if (aPort->IsInput()) {
388     if (aPort->Kind() == SUPERV::EndSwitchParameter
389         ||
390         aPort->Node()->Kind() == SUPERV::EndSwitchNode) {
391       myNewLink->setInputPortES(dynamic_cast<SUPERVGUI_PortInESNode*>(thePort));
392     }
393     else
394       myNewLink->setInputPort(dynamic_cast<SUPERVGUI_PortIn*>(thePort));
395   }
396   else
397     myNewLink->setOutputPort(dynamic_cast<SUPERVGUI_PortOut*>(thePort));    
398 }
399
400
401 void SUPERVGUI_Graph::sketchEnd(SUPERVGUI_Port* thePort) {
402   if (!myNewLink) return;
403
404   bool aIsInput = myNewLink->getBeginPort()->getPort()->IsInput();
405   if (aIsInput && thePort->getPort()->IsInput()
406       ||
407       !aIsInput && !thePort->getPort()->IsInput()) {
408     return;
409   }
410   
411
412   SUPERV_Port aPort = thePort->getPort();
413   if (aPort->IsInput()) {
414
415     int aKind = myNewLink->getOutputPort()->getPort()->Kind();
416
417     if ((aPort->Kind() == SUPERV::EndSwitchParameter
418          ||
419          aPort->Node()->Kind() == SUPERV::EndSwitchNode)
420         &&
421         (aKind == SUPERV::InLineParameter || aKind == SUPERV::ServiceParameter))
422       {
423         QString aName(aPort->Name());
424         if (aName != "Default")
425           myNewLink->setInputPortES(dynamic_cast<SUPERVGUI_PortInESNode*>(thePort));
426       }
427     else if (aPort->Kind() == SUPERV::DataStreamParameter){
428       myNewLink->setInputPort(dynamic_cast<SUPERVGUI_StreamPortIn*>(thePort));
429     } else { 
430       if (aPort->IsLinked()) return;
431     
432       if (aKind == SUPERV::GateParameter || aPort->Kind() == SUPERV::GateParameter) {
433         if (aKind != aPort->Kind() && aKind != SUPERV::InLineParameter 
434             && aPort->Kind() != SUPERV::InLineParameter) {
435           return;
436         }
437         else { //connection like Gate <--> Gate
438           myNewLink->setInputPort(dynamic_cast<SUPERVGUI_PortIn*>(thePort));
439         }
440       } else {
441         myNewLink->setInputPort(dynamic_cast<SUPERVGUI_PortIn*>(thePort));
442       }
443     }
444
445   } else {
446     if (myNewLink->isESInputPort()) {
447       if(aPort->Kind() == SUPERV::InLineParameter || aPort->Kind() == SUPERV::ServiceParameter)
448         {
449           myNewLink->setOutputPort(dynamic_cast<SUPERVGUI_PortOut*>(thePort));
450         }
451       else
452         return;
453     } else {
454       int aKind = myNewLink->getInputPort()->getPort()->Kind();
455
456       if (aKind == SUPERV::GateParameter || aPort->Kind() == SUPERV::GateParameter) {
457         if (aKind != aPort->Kind() && 
458             aKind != SUPERV::InLineParameter && 
459             aPort->Kind() != SUPERV::InLineParameter) {
460           return;
461         } else  //connection like Gate <--> Gate
462           myNewLink->setOutputPort(dynamic_cast<SUPERVGUI_PortOut*>(thePort));
463       } else if (aPort->Kind() == SUPERV::DataStreamParameter){
464         myNewLink->setOutputPort(dynamic_cast<SUPERVGUI_StreamPortOut*>(thePort));
465       } else
466         myNewLink->setOutputPort(dynamic_cast<SUPERVGUI_PortOut*>(thePort));    
467     }
468   }
469   
470   if (myNewLink->isCreationComplete()) {  // if everything is defined
471     if (myNewLink->createEngine()) {
472       myLinksList.append(myNewLink);
473       myNewLink = 0;
474     } else {
475       QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_CREATE_LINK")); 
476       delete myNewLink;
477     }
478   }
479 }
480
481
482 /**
483  * Returns true if presentation of link exists
484  */
485 bool SUPERVGUI_Graph::isLinkPrsExists(SUPERV_Link theLink) {
486   SUPERVGUI_Link* aTmpLink;
487   for (aTmpLink = myLinksList.first(); aTmpLink; aTmpLink = myLinksList.next()) {
488     SUPERVGUI_PortOut* aOutPort = aTmpLink->getOutputPort();
489     if (strcmp(aOutPort->getPort()->Node()->Name(), 
490                theLink->OutPort()->Node()->Name()) == 0) {
491       QString aName(theLink->OutPort()->Name());
492       aName += "Output";
493       if (aOutPort->name() == aName) {
494         return true;
495       }
496     }
497   }
498   return false;
499 }
500
501
502 /**
503  * Creates link presentation from link engine
504  * Returns false if fails
505  */
506 bool SUPERVGUI_Graph::createLinkPrs(SUPERV_Link theLink) {
507   SUPERVGUI_Link* aNewLink = new SUPERVGUI_Link(this, theLink);
508   
509   // Find output node
510   SUPERVGUI_Node* aOutNode = (SUPERVGUI_Node*) 
511     child(theLink->OutPort()->Node()->Name(), "SUPERVGUI_Node");
512   if (aOutNode) {
513     QString aName(theLink->OutPort()->Name());
514     aName += "Output";
515     SUPERVGUI_PortOut* aOutPort = (SUPERVGUI_PortOut*)
516       aOutNode->child(aName, "SUPERVGUI_PortOut");
517     if (aOutPort)
518       aNewLink->setOutputPort(aOutPort);
519     else {
520       delete aNewLink;
521       return false;
522     }
523   } else {
524     delete aNewLink;
525     return false;
526   }
527   // Find input node
528   SUPERVGUI_Node* aInNode = (SUPERVGUI_Node*)
529     child(theLink->InPort()->Node()->Name(), "SUPERVGUI_Node");
530   if (aInNode) {
531     QString aName(theLink->InPort()->Name());
532     aName += "Input";
533     if (theLink->InPort()->Kind() == SUPERV::EndSwitchParameter) {
534       //If input port is EndSwitchParameter
535       SUPERVGUI_PortInESNode* aInPortES =(SUPERVGUI_PortInESNode*)
536         aInNode->child(aName, "SUPERVGUI_PortInESNode");        //returns null
537       if (aInPortES)
538         aNewLink->setInputPortES(aInPortES);
539       else {
540         delete aNewLink;
541         return false;
542       }
543     } else {
544       SUPERVGUI_PortIn* aInPort =(SUPERVGUI_PortIn*)
545         aInNode->child(aName, "SUPERVGUI_PortIn");
546       if (aInPort) 
547         aNewLink->setInputPort(aInPort);
548       else {
549         delete aNewLink;
550         return false;
551       }
552     }
553   } else {
554     delete aNewLink;
555     return false;
556   }
557   aNewLink->setVisible(!myIsControlView);
558   myLinksList.append(aNewLink);
559   return true;
560 }
561
562
563 void SUPERVGUI_Graph::delLastPnt() {
564   if (myNewLink) { 
565     myNewLink->delLastTmpPoint();
566   }
567 }
568
569 void SUPERVGUI_Graph::delCreatingLink() {
570   myNewLink->abortCreation();
571   delete myNewLink;
572   myNewLink=0;
573   repaintContents();
574 }
575
576 void SUPERVGUI_Graph::setOrtho() {
577   if (myNewLink) { 
578     bool aIsOrtho = !mySketchPopup->isItemChecked(myOrtoItem);
579     myNewLink->setOrthoMode(aIsOrtho);
580     mySketchPopup->setItemChecked(myOrtoItem, aIsOrtho);
581   }
582 }
583
584
585
586 void SUPERVGUI_Graph::setFullView() {
587   QObjectList* aNodeList = queryList("SUPERVGUI_Node");
588   QObjectListIt aIt(*aNodeList);
589   SUPERVGUI_Node* aNode;
590   while ((aNode=(SUPERVGUI_Node*)aIt.current()) != 0) {
591     ++aIt;
592     aNode->showAll();
593   }
594   delete aNodeList;
595
596   myCtrlLinks.clear();
597   SUPERVGUI_Link* aLink;
598   for (aLink = myLinksList.first(); aLink; aLink = myLinksList.next()) {
599     aLink->setVisible(true);
600   }
601   draw();
602   myIsControlView = false;
603 }
604
605
606 void SUPERVGUI_Graph::setControlView() {
607   QObjectList* aNodeList = queryList("SUPERVGUI_Node");
608   QObjectListIt aIt(*aNodeList);
609   SUPERVGUI_Node* aNode;
610   while ((aNode=(SUPERVGUI_Node*)aIt.current()) != 0) {
611     ++aIt;
612     aNode->hideAll();
613   }
614   delete aNodeList;
615   myCtrlLinks.clear();
616   SUPERVGUI_Link* aLink;
617   for (aLink = myLinksList.first(); aLink; aLink = myLinksList.next()) {
618     aLink->setVisible(false);
619
620     QString aOutName(aLink->getEngineLink()->OutPort()->Node()->Name());
621     QString aInName(aLink->getEngineLink()->InPort()->Node()->Name());
622     QString aKey = aOutName + aInName;
623
624     if (!myCtrlLinks.contains(aKey)) {
625       SUPERVGUI_GraphNode* aOutNode = (SUPERVGUI_GraphNode*)
626         child(aOutName, "SUPERVGUI_GraphNode");
627       if (!aOutNode) continue;
628       SUPERVGUI_GraphNode* aInNode = (SUPERVGUI_GraphNode*)
629         child(aInName, "SUPERVGUI_GraphNode");
630       if (!aInNode) continue;
631
632       myCtrlLinks[aKey] = SUPERVGUI_CtrlLink(this, aOutNode, aInNode);
633     }
634   }
635   draw();
636   myIsControlView = true;
637 }
638
639
640 void SUPERVGUI_Graph::deleteNode(SUPERVGUI_Node* theNode) { 
641   theNode->close(true); 
642   draw(); 
643 }