Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_CanvasControlNode.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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  File   : SUPERVGUI_CanvasControlNode.cxx
23 //  Author : Natalia KOPNOVA
24 //  Module : SUPERV
25
26 #include "SUPERVGUI_CanvasControlNode.h"
27 #include "SUPERVGUI_CanvasControlNodePrs.h"
28 #include "SUPERVGUI_CanvasCellNodePrs.h"
29 #include "SUPERVGUI_CanvasLink.h"
30 #include "SUPERVGUI_Clipboard.h"
31 #include "SUPERVGUI_Main.h"
32 #include "SUPERVGUI.h"
33 #include "SUPERVGUI_Canvas.h"
34
35 #include "SUIT_FileDlg.h"
36 #include "SUIT_Session.h"
37
38 #include <qlabel.h>
39 #include <qlayout.h>
40
41 //=====================================================================
42 // Compute node
43 //=====================================================================
44 SUPERVGUI_CanvasComputeNode::SUPERVGUI_CanvasComputeNode (SUIT_ResourceMgr* mgr, QObject* theParent,
45                                                           SUPERVGUI_Main* theMain, SUPERV_CNode theNode):
46   SUPERVGUI_CanvasNode(mgr, theParent, theMain, theNode)
47 {
48   Trace("SUPERVGUI_CanvasComputeNode::SUPERVGUI_CanvasComputeNode");
49 }
50
51 SUPERVGUI_CanvasComputeNode* SUPERVGUI_CanvasComputeNode::Create
52                              (SUIT_ResourceMgr* mgr, QObject* theParent,
53                               SUPERVGUI_Main* theMain, SUPERV_CNode theNode)
54 {
55   SUPERVGUI_CanvasComputeNode* aRet = new SUPERVGUI_CanvasComputeNode (mgr, theParent, theMain, theNode);
56   emit aRet->objectCreatedDeleted();
57   return aRet;
58 }
59
60 QPopupMenu* SUPERVGUI_CanvasComputeNode::getPopupMenu(QWidget* theParent) 
61 {
62   QPopupMenu* popup = SUPERVGUI_CanvasNode::getPopupMenu(theParent);
63
64   QPopupMenu* aShowPopup = new QPopupMenu(theParent);
65   int anItem;
66   anItem = aShowPopup->insertItem(tr("POP_SHOWTITLES"), this, SLOT(switchLabel()));
67   aShowPopup->setItemChecked(anItem, getPrs()->isLabelVisible());
68   anItem = aShowPopup->insertItem(tr("POP_SHOWPORTS"), this, SLOT(switchPorts()));
69   aShowPopup->setItemChecked(anItem, getPrs()->isPortVisible());
70
71   popup->insertSeparator();
72   popup->insertItem(tr("POP_SHOW"), aShowPopup);
73
74   return popup;
75 }
76
77
78 //=====================================================================
79 // Start control node
80 //=====================================================================
81 SUPERVGUI_CanvasStartNode::SUPERVGUI_CanvasStartNode (SUIT_ResourceMgr* mgr, QObject* theParent,
82                                                       SUPERVGUI_Main* theMain, SUPERV_CNode theNode):
83   SUPERVGUI_CanvasNode( mgr, theParent, theMain, theNode), 
84   myCoupled(0)
85 {
86   Trace("SUPERVGUI_CanvasStartNode::SUPERVGUI_CanvasStartNode");
87 }
88
89 SUPERVGUI_CanvasStartNode* SUPERVGUI_CanvasStartNode::Create (SUIT_ResourceMgr* mgr, QObject* theParent,
90                                                               SUPERVGUI_Main* theMain, SUPERV_CNode theNode)
91 {
92   SUPERVGUI_CanvasStartNode* aRet = new SUPERVGUI_CanvasStartNode (mgr, theParent, theMain, theNode);
93   emit aRet->objectCreatedDeleted();
94   return aRet;
95 }
96
97 SUPERVGUI_CanvasNodePrs* SUPERVGUI_CanvasStartNode::createPrs() const
98 {
99   return new SUPERVGUI_CanvasStartNodePrs (resMgr(), getMain()->getCanvas(), 
100                                            (SUPERVGUI_CanvasStartNode*)this);
101 }
102
103 bool SUPERVGUI_CanvasStartNode::setNodeName(QString aName)
104 {
105   bool result = SUPERVGUI_CanvasNode::setNodeName(aName);
106   if (result && myCoupled) {
107     myCoupled->setNodeName(QString(tr("ENDNODE_PREFIX"))+aName);
108   }
109   return result;
110 }
111
112 QPopupMenu* SUPERVGUI_CanvasStartNode::getPopupMenu(QWidget* theParent) 
113 {
114   QPopupMenu* popup = SUPERVGUI_CanvasNode::getPopupMenu(theParent);
115
116   popup->insertSeparator();
117   int anItem = popup->insertItem(tr("POP_HIDEPORTS"), this, SLOT(switchPorts()));
118   popup->setItemChecked(anItem, !getPrs()->isPortVisible());
119
120   return popup;
121 }
122
123 void SUPERVGUI_CanvasStartNode::remove()
124 {
125   SUPERVGUI_Canvas* aCanvas = getMain()->getCanvas();
126
127   setDestroyed();
128   SUPERVGUI_Clipboard* aCB = SUPERVGUI_Clipboard::getClipboard();
129   if (myCoupled) {
130
131     //set myCopyPort from Main object to empty if engine of this port is deleted
132     //check if any port of this deleted node has been copied
133     if ( aCB->isCopyPort() )
134       if ( QString(getEngine()->Name()) == QString(aCB->getCopyPort()->Node()->Name())    ||
135            QString(myCoupled->getEngine()->Name()) == QString(aCB->getCopyPort()->Node()->Name()) )
136         aCB->setCopyPort( 0 );
137     
138     myCoupled->setDestroyed();
139   }
140
141   //set myCopyNode from Main object to empty if engine of this node is deleted
142   //check if myCopyNode and this node engine is equal
143   if ( aCB->isCopyNode() )
144     if ( QString(getEngine()->Name()) == QString(aCB->getCopyNode()->Name()) ) 
145       aCB->setCopyNode( 0 );
146
147   // mkr: since the deletion of the node allow only in CANVAS view,
148   // it is necessary to remove the CanvasArray's children, which
149   // have the same CNode engine as deleting node
150   getMain()->removeArrayChild(getEngine());
151   getMain()->removeArrayChild(myCoupled->getEngine());
152
153   getEngine()->destroy();
154
155   if (myCoupled) 
156     delete myCoupled;
157
158   emit objectCreatedDeleted(); // jfa : NPAL15529
159
160   delete this;
161
162   aCanvas->update();
163 }
164
165 void SUPERVGUI_CanvasStartNode::onDestroyed(QObject* theObject)
166 {
167   if (!isIgnore) {
168     SUPERVGUI_CanvasNode::onDestroyed(theObject);
169     if (getEngine()->IsLoop()) merge();
170     if (myCoupled) myCoupled->merge();
171   }
172 }
173
174 // mkr : IPAL9815 : commented the following code
175 /*void SUPERVGUI_CanvasStartNode::addInputPort()
176 {
177   SUPERVGUI_CanvasNode::addInputPort();
178   if (getEngine()->IsLoop()) merge();
179   if (myCoupled) myCoupled->merge();
180 }
181
182 void SUPERVGUI_CanvasStartNode::addOutputPort()
183 {
184   SUPERVGUI_CanvasNode::addOutputPort();
185   if (myCoupled) myCoupled->merge();
186 }*/
187  
188 void SUPERVGUI_CanvasStartNode::pastePort()
189 {
190   SUPERVGUI_Clipboard* aCB = SUPERVGUI_Clipboard::getClipboard();
191   SUPERVGUI_CanvasNode::pastePort();
192   if ( aCB->getCopyPort()->IsInput() && getEngine()->IsLoop() ) 
193     merge();
194   if ( myCoupled )
195     myCoupled->merge();
196 }
197
198 //=====================================================================
199 // End control node
200 //=====================================================================
201 SUPERVGUI_CanvasEndNode::SUPERVGUI_CanvasEndNode (SUIT_ResourceMgr* mgr, QObject* theParent,
202                                                   SUPERVGUI_Main* theMain, SUPERV_CNode theNode,
203                                                   SUPERVGUI_CanvasStartNode* theStart):
204   SUPERVGUI_CanvasNode(mgr, theParent, theMain, theNode), 
205   myCoupled(theStart)
206 {
207   Trace("SUPERVGUI_CanvasEndNode::SUPERVGUI_CanvasEndNode");
208   myCoupled->setCoupled(this);
209 }
210
211 SUPERVGUI_CanvasEndNode* SUPERVGUI_CanvasEndNode::Create (SUIT_ResourceMgr* mgr, QObject* theParent,
212                                                           SUPERVGUI_Main* theMain, SUPERV_CNode theNode,
213                                                           SUPERVGUI_CanvasStartNode* theStart)
214 {
215   SUPERVGUI_CanvasEndNode* aRet = new SUPERVGUI_CanvasEndNode (mgr, theParent, theMain, theNode, theStart);
216   emit aRet->objectCreatedDeleted();
217   return aRet;
218 }
219
220 SUPERVGUI_CanvasNodePrs* SUPERVGUI_CanvasEndNode::createPrs() const
221 {
222   return new SUPERVGUI_CanvasEndNodePrs( resMgr(), getMain()->getCanvas(), 
223                                          (SUPERVGUI_CanvasEndNode*)this);
224 }
225
226 QPopupMenu* SUPERVGUI_CanvasEndNode::getPopupMenu(QWidget* theParent) 
227 {
228   QPopupMenu* popup = SUPERVGUI_CanvasNode::getPopupMenu(theParent);
229
230   popup->insertSeparator();
231   int anItem = popup->insertItem(tr("POP_HIDEPORTS"), this, SLOT(switchPorts()));
232   popup->setItemChecked(anItem, !getPrs()->isPortVisible());
233
234   return popup;
235 }
236
237 // mkr : IPAL9815 : commented the following code
238 /*void SUPERVGUI_CanvasEndNode::addInputPort()
239 {
240   SUPERVGUI_CanvasNode::addInputPort();
241   if (getEngine()->IsEndSwitch()) merge();
242 }*/
243
244
245 //=====================================================================
246 // Goto control node
247 //=====================================================================
248 SUPERVGUI_CanvasGotoNode::SUPERVGUI_CanvasGotoNode (SUIT_ResourceMgr* mgr, QObject* theParent,
249                                                     SUPERVGUI_Main* theMain, SUPERV_CNode theNode):
250   SUPERVGUI_CanvasNode(mgr, theParent, theMain, theNode)
251 {
252   Trace("SUPERVGUI_CanvasGotoNode::SUPERVGUI_CanvasGotoNode");
253 }
254
255 SUPERVGUI_CanvasGotoNode* SUPERVGUI_CanvasGotoNode::Create (SUIT_ResourceMgr* mgr, QObject* theParent,
256                                                             SUPERVGUI_Main* theMain, SUPERV_CNode theNode)
257 {
258   SUPERVGUI_CanvasGotoNode* aRet = new SUPERVGUI_CanvasGotoNode (mgr, theParent, theMain, theNode);
259   emit aRet->objectCreatedDeleted();
260   return aRet;
261 }
262
263 SUPERVGUI_CanvasNodePrs* SUPERVGUI_CanvasGotoNode::createPrs() const
264 {
265   return new SUPERVGUI_CanvasGotoNodePrs( resMgr(), getMain()->getCanvas(), 
266                                           (SUPERVGUI_CanvasGotoNode*)this);
267 }
268
269 QPopupMenu* SUPERVGUI_CanvasGotoNode::getPopupMenu(QWidget* theParent) 
270 {
271   QPopupMenu* popup = SUPERVGUI_CanvasNode::getPopupMenu(theParent);
272
273   popup->insertSeparator();
274   popup->insertItem("Link to Node...", this, SLOT(linkToNode()));
275
276   popup->insertSeparator();
277   int anItem = popup->insertItem(tr("POP_HIDEPORTS"), this, SLOT(switchPorts()));
278   popup->setItemChecked(anItem, !getPrs()->isPortVisible());
279
280   return popup;
281 }
282
283 void SUPERVGUI_CanvasGotoNode::linkToNode() {
284   SUPERVGUI_SelectInlineDlg* aDlg = new SUPERVGUI_SelectInlineDlg(getMain());
285   if (aDlg->exec()) {
286     QString aNodeName = aDlg->getName();
287     if (!aNodeName.isEmpty()) { //implement additional check from GUI side for bug PAL7007
288       // mkr : here we should re/create (if it is not yet exists) a presentation for new
289       //       Goto(OutGate)->CoupledNode(InGate) link, which will be created in SetCoupled method
290
291       // check if GoTo node have coupled node
292       SUPERV_INode aCoupledNode = getGotoNode()->Coupled();
293       if ( !SUPERV_isNull(aCoupledNode) )
294       { // we got old coupled node
295         SUPERV_Port anInGatePort = aCoupledNode->GetInPort("InGate");
296         SUPERV_Link anOldLinkEngine = anInGatePort->Link();
297         if ( !SUPERV_isNull(anOldLinkEngine) )
298         { // we got old link engine
299           SUPERVGUI_CanvasLink* anOldLinkPrs = getMain()->getCanvas()->getLink(anOldLinkEngine);
300           if ( anOldLinkPrs )
301           { // delete old link presentation
302             delete anOldLinkPrs;
303             anOldLinkPrs = 0;
304           }
305         }
306       }
307
308       getGotoNode()->SetCoupled(aNodeName.latin1());
309
310       aCoupledNode = SUPERV::INode::_narrow(getMain()->getDataflow()->Node(aNodeName.latin1()));
311       if ( !SUPERV_isNull(aCoupledNode) )
312       { // we got new coupled node
313         SUPERV_Port anInGatePort = aCoupledNode->GetInPort("InGate");
314         SUPERV_Link aLinkEngine = anInGatePort->Link();
315         if ( !SUPERV_isNull(aLinkEngine) )
316         { // we got new link engine
317           if ( !getMain()->getCanvas()->getLink(aLinkEngine) )
318           { // there is no presentation for such link engine => create it
319             SUPERVGUI_CanvasLink* aLink = new SUPERVGUI_CanvasLink(getMain()->getCanvas(), getMain(), aLinkEngine);
320             aLink->show();
321           }
322         }
323       }
324
325       getMain()->getCanvas()->sync();
326     }
327   }
328   delete aDlg;
329 }
330
331 //=====================================================================
332 // Macro node
333 //=====================================================================
334 SUPERVGUI_CanvasMacroNode::SUPERVGUI_CanvasMacroNode (SUIT_ResourceMgr* mgr, QObject* theParent,
335                                                       SUPERVGUI_Main* theMain, SUPERV_CNode theNode):
336   SUPERVGUI_CanvasComputeNode(mgr, theParent, theMain, theNode)
337 {
338   Trace("SUPERVGUI_CanvasMacroNode::SUPERVGUI_CanvasMacroNode");
339 }
340
341 SUPERVGUI_CanvasMacroNode* SUPERVGUI_CanvasMacroNode::Create (SUIT_ResourceMgr* mgr, QObject* theParent,
342                                                               SUPERVGUI_Main* theMain, SUPERV_CNode theNode)
343 {
344   SUPERVGUI_CanvasMacroNode* aRet = new SUPERVGUI_CanvasMacroNode (mgr, theParent, theMain, theNode);
345   emit aRet->objectCreatedDeleted();
346   return aRet;
347 }
348
349 SUPERVGUI_CanvasNodePrs* SUPERVGUI_CanvasMacroNode::createPrs() const
350 {
351   return new SUPERVGUI_CanvasMacroNodePrs( resMgr(), getMain()->getCanvas(), 
352                                            (SUPERVGUI_CanvasMacroNode*)this);
353 }
354
355 QPopupMenu* SUPERVGUI_CanvasMacroNode::getPopupMenu(QWidget* theParent) 
356 {
357   QPopupMenu* popup = SUPERVGUI_CanvasComputeNode::getPopupMenu(theParent);
358
359   popup->insertSeparator(0);
360   popup->insertItem(tr("MSG_EXPORT"), this, SLOT(exportDataflow()), 0, -1, 0);
361   popup->insertItem("Open SubGraph", this, SLOT(openSubGraph()), 0, -1, 0);
362
363   return popup;
364 }
365
366 void SUPERVGUI_CanvasMacroNode::openSubGraph()
367 {
368   getMain()->openSubGraph(getEngine());
369 }
370
371 void SUPERVGUI_CanvasMacroNode::exportDataflow()
372 {
373   SUPERV_Graph aGraph;
374   if (getEngine()->IsMacro()) {
375     SUPERV_Graph aMacro = getMacroNode();
376     if (aMacro->IsStreamMacro())
377       aGraph = aMacro->StreamObjRef();
378     else
379       aGraph = aMacro->FlowObjRef();
380   }
381   if (SUPERV_isNull(aGraph)) {
382     QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_EXPORT"));
383     return;
384   }
385   else {
386     QString aFileName = SUIT_FileDlg::getFileName(SUIT_Session::session()->activeApplication()->desktop(),
387                                                   "",
388                                                   "*.xml",
389                                                   tr("TTL_EXPORT_DATAFLOW"),
390                                                   false);
391     if ( !aFileName.isEmpty() ) {
392       // asv : bug [VSR Bugs and Improvements in Supervisor] 1.8 : when exporting a file, 
393       // a backup copy of an existing file must be created (in case Export fails..)
394       QString aBackupFile = SUPERVGUI::createBackupFile( aFileName );
395
396       if (!aGraph->Export(aFileName.latin1())) {
397         QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_BAD_WRITING").arg(aBackupFile));
398       }
399       // remove a backup file if export was successfull
400       else if ( !aBackupFile.isNull() && !aBackupFile.isEmpty() ) {
401         QFile::remove( aBackupFile );
402       }
403     }
404   }
405 }
406
407 // mkr : IPAL11549 : before remove Macro Node we have to destroy
408 //                   all its opened sub-graphs
409 void SUPERVGUI_CanvasMacroNode::remove()
410 {
411   SUPERV_Graph aGraph;
412   if (getEngine()->IsMacro()) {
413     SUPERV_Graph aMacro = getMacroNode();
414     if (aMacro->IsStreamMacro())
415       aGraph = aMacro->StreamObjRef();
416     else
417       aGraph = aMacro->FlowObjRef();
418   }
419   if (SUPERV_isNull(aGraph)) {
420     QMessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), tr("WARNING"), tr("MSG_NOSUBGRAPH_TO_REMOVE"));
421     return;
422   }
423   else {
424     getMain()->destroySubGraph(aGraph->Name());
425   }
426
427   SUPERVGUI_CanvasNode::remove();
428 }
429
430 //=====================================================================
431 // Cell node: node for table view
432 //=====================================================================
433 SUPERVGUI_CanvasCellNode::SUPERVGUI_CanvasCellNode (SUIT_ResourceMgr* mgr, QObject* theParent, 
434                                                     SUPERVGUI_Main* theMain, SUPERV_CNode theNode):
435   SUPERVGUI_CanvasNode(mgr, theParent, theMain, theNode, true)
436 {
437   Trace("SUPERVGUI_CanvasCellNode::SUPERVGUI_CanvasCellNode");
438   
439   myIsControl = false;
440   myIsStart = false;
441
442   //check for control nodes
443   if (getEngine()->IsLoop() || getEngine()->IsSwitch()) {
444     myIsControl = true;  
445     myIsStart = true;
446   }
447   if (getEngine()->IsEndLoop() || getEngine()->IsEndSwitch())
448     myIsControl = true;
449 }
450
451 SUPERVGUI_CanvasCellNode* SUPERVGUI_CanvasCellNode::Create (SUIT_ResourceMgr* mgr, QObject* theParent, 
452                                                             SUPERVGUI_Main* theMain, SUPERV_CNode theNode)
453 {
454   SUPERVGUI_CanvasCellNode* aRet = new SUPERVGUI_CanvasCellNode (mgr, theParent, theMain, theNode);
455   emit aRet->objectCreatedDeleted();
456   return aRet;
457 }
458
459 SUPERVGUI_CanvasCellNode::~SUPERVGUI_CanvasCellNode()
460 {
461 }
462 /*
463 QPopupMenu* SUPERVGUI_CanvasCellNode::getPopupMenu(QWidget* theParent)
464 {
465   QPopupMenu* popup = SUPERVGUI_CanvasNode::getPopupMenu(theParent);
466   popup->setItemEnabled(myDeleteItem, false);
467   return popup;
468 }
469 */
470 void SUPERVGUI_CanvasCellNode::setPairCell(SUPERVGUI_CanvasCellNode* thePairCell) {
471   if (myIsControl) { //only for ControlNode
472     myPairCell = thePairCell;
473   }
474   else 
475     myPairCell = 0;
476 }
477
478 SUPERVGUI_CanvasCellNode* SUPERVGUI_CanvasCellNode::getPairCell() {
479   return myPairCell;
480 }
481
482 void SUPERVGUI_CanvasCellNode::sync() {
483   const bool isExecuting = getMain()->getDataflow()->IsExecuting();
484   //if getEngine() is a MacroNode then set it state to state of its subgraph
485   if ( getEngine()->IsMacro() && isExecuting ) {
486     // get SubGraph from MacroNode
487     SUPERV_Graph aMacro = SUPERV::Graph::_narrow(getEngine());
488     if (!SUPERV_isNull(aMacro)) {
489       SUPERV_Graph aGraph;
490       if (aMacro->IsStreamMacro())
491         aGraph = aMacro->StreamObjRef();
492       else
493         aGraph = aMacro->FlowObjRef();
494       if (!SUPERV_isNull(aGraph)) {
495         if (aGraph->State() != SUPERV::UndefinedState && aGraph->State() != SUPERV::NoState)
496           getPrs()->setState(aGraph->State());
497         else 
498           getPrs()->setState(getEngine()->State());
499       }
500     }
501   }
502   else {
503     getPrs()->setState(getEngine()->State());
504   }
505 }
506 /*
507 bool SUPERVGUI_CanvasCellNode::setNodeName(QString aName) 
508 {
509   bool result = SUPERVGUI_CanvasNode::setNodeName(aName);
510   if (result && myPairCell) {
511     result = myPairCell->setNodeName(QString(tr("ENDNODE_PREFIX"))+aName);
512   }
513   return result;
514 }
515 */
516 SUPERVGUI_CanvasNodePrs* SUPERVGUI_CanvasCellNode::createPrs() const
517 {
518   SUPERVGUI_CanvasNodePrs* aPrs = 
519     new SUPERVGUI_CanvasCellNodePrs( resMgr(), getMain()->getCanvasArray(), 
520                                      (SUPERVGUI_CanvasCellNode*)this);
521   return aPrs;
522 }
523
524 SUPERVGUI_CanvasCellEndNode::SUPERVGUI_CanvasCellEndNode (SUIT_ResourceMgr* mgr, QObject* theParent, 
525                                                           SUPERVGUI_Main* theMain, SUPERV_CNode theNode, 
526                                                           SUPERVGUI_CanvasCellNode* theStart):
527   SUPERVGUI_CanvasCellNode(mgr, theParent, theMain, theNode)
528 {
529   //set start cell for end cell as pair 
530   myPairCell = theStart; 
531   //set end cell for start cell as pair
532   myPairCell->setPairCell(dynamic_cast<SUPERVGUI_CanvasCellNode*>(this));
533 }
534
535 SUPERVGUI_CanvasCellEndNode* SUPERVGUI_CanvasCellEndNode::Create (SUIT_ResourceMgr* mgr, QObject* theParent, 
536                                                                   SUPERVGUI_Main* theMain,
537                                                                   SUPERV_CNode theNode, 
538                                                                   SUPERVGUI_CanvasCellNode* theStart)
539 {
540   SUPERVGUI_CanvasCellEndNode* aRet =
541     new SUPERVGUI_CanvasCellEndNode (mgr, theParent, theMain, theNode, theStart);
542   emit aRet->objectCreatedDeleted();
543   return aRet;
544 }
545
546 /*
547 bool SUPERVGUI_CanvasCellEndNode::setNodeName(QString theName)
548 {
549   return SUPERVGUI_CanvasNode::setNodeName(theName);
550 }
551 */
552
553 //-----------------------------------------------------------
554 //*************** Select Inline node dialog******************
555 // Taken from SUPERVGUI_ControlNode.cxx without change
556 //-----------------------------------------------------------
557
558 SUPERVGUI_SelectInlineDlg::SUPERVGUI_SelectInlineDlg(SUPERVGUI_Main* theMain)  
559   :QDialog(theMain, 0, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
560 {
561   setSizeGripEnabled( true );
562   setCaption(tr("TIT_FUNC_PYTHON"));
563   QGridLayout* aMainLayout = new QGridLayout(this, 2, 2, 7, 4);
564
565   QLabel* aLabel = new QLabel("Connect to", this );
566   aMainLayout->addWidget(aLabel, 0, 0);
567
568   myCombo = new QComboBox(this);
569   myCombo->clear(); //for the additional check from GUI side for bug PAL7007
570   SUPERV_Nodes aNodesList = theMain->getDataflow()->Nodes();  
571   int i;
572   for (i = 0; i < aNodesList->INodes.length(); i++) {
573     myCombo->insertItem(QString(aNodesList->INodes[i]->Name()));
574   }
575   for (i = 0; i < aNodesList->LNodes.length(); i++) {
576     myCombo->insertItem(QString(aNodesList->LNodes[i]->Name()));
577   }
578   for (i = 0; i < aNodesList->SNodes.length(); i++) {
579     myCombo->insertItem(QString(aNodesList->SNodes[i]->Name()));
580   }
581   aMainLayout->addWidget(myCombo, 0, 1);
582
583   QGroupBox* aBtnBox = new QGroupBox( this );
584   aBtnBox->setColumnLayout( 0, Qt::Vertical );
585   aBtnBox->layout()->setSpacing( 0 ); aBtnBox->layout()->setMargin( 0 );
586   QHBoxLayout* aBtnLayout = new QHBoxLayout( aBtnBox->layout() );
587   aBtnLayout->setAlignment( Qt::AlignTop );
588   aBtnLayout->setSpacing( 6 ); aBtnLayout->setMargin( 11 );
589   
590   QPushButton* aOKBtn = new QPushButton( tr( "BUT_OK" ), aBtnBox );
591   connect( aOKBtn, SIGNAL( clicked() ), this, SLOT( accept() ) );
592   aBtnLayout->addWidget( aOKBtn );
593
594   aBtnLayout->addStretch();
595
596   QPushButton* aCancelBtn = new QPushButton( tr("BUT_CANCEL"), aBtnBox );
597   connect( aCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
598   aBtnLayout->addWidget( aCancelBtn );
599
600   aMainLayout->addMultiCellWidget(aBtnBox, 1, 1, 0, 1);
601 }