1 // SUPERV SUPERVGUI : GUI for Supervisor component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : SUPERVGUI_CanvasNode.cxx
23 // Author : Natalia KOPNOVA
26 #include "SUPERVGUI_CanvasNode.h"
27 #include "SUPERVGUI_CanvasNodePrs.h"
28 #include "SUPERVGUI_CanvasPort.h"
29 #include "SUPERVGUI_Clipboard.h"
30 #include "SUPERVGUI_Main.h"
31 #include "SUPERVGUI.h"
32 #include "SUPERVGUI_BrowseNodeDlg.h"
33 #include "SUPERVGUI_ManagePortsDlg.h"
34 #include "SUPERVGUI_Information.h"
35 #include "SUPERVGUI_Library.h"
37 #include "SUIT_MessageBox.h"
38 #include "LogWindow.h"
39 #include "SUIT_Session.h"
41 #include <qinputdialog.h>
44 SUPERVGUI_CanvasNode::SUPERVGUI_CanvasNode( SUIT_ResourceMgr* mgr, QObject* theParent, SUPERVGUI_Main* theMain, SUPERV_CNode theNode, bool theIsCell):
57 Trace("SUPERVGUI_CanvasNode::SUPERVGUI_CanvasNode");
59 setName(myNode->Name());
61 QString aComment(myNode->Comment());
62 QString aNewComment = aComment;
63 if (getNodeType() == SUPERV::FactoryNode) {
64 aNewComment = QString(myNode->Service()->ServiceName) +
65 QString(tr("COMMENT_FROM")) +
66 QString(getFactoryNode()->GetComponentName());
68 else if (myNode->IsMacro()) {
69 aNewComment = tr("COMMENT_MNODE");
72 aNewComment = tr("COMMENT_CNODE");
74 if (aComment.isEmpty()) {
75 myNode->SetComment(aNewComment.latin1());
78 myLabelText = aNewComment;
80 // mkr : if the SUPERVGUI_CavasCellNode created (for CANVASTABLE view),
81 // we don't create the ports
85 SUPERV_Ports aPortList = myNode->Ports();
86 for (int i = 0; i < aPortList->length(); i++)
87 createPort(aPortList[i].in());
89 SUPERV_StreamPorts aStreamPortList = myNode->StreamPorts();
90 for (int i = 0; i < aStreamPortList->length(); i++) {
91 createStreamPort(aStreamPortList[i].in());
98 connect(this, SIGNAL(objectCreatedDeleted()), myMain, SLOT(onObjectCreatedDeleted()));
99 emit objectCreatedDeleted();
102 SUPERVGUI_CanvasNode::~SUPERVGUI_CanvasNode()
112 void SUPERVGUI_CanvasNode::setDestroyed()
118 SUPERVGUI_CanvasNodePrs* SUPERVGUI_CanvasNode::getPrs()
126 SUPERVGUI_CanvasNodePrs* SUPERVGUI_CanvasNode::createPrs() const
129 //SUPERVGUI_PrsNode* glNode = new SUPERVGUI_PrsNode( (SUPERVGUI_CanvasNode*)this );
130 //glNode->setFirstPoint( new GLViewer_Pnt( 10, 10 ) );
133 //getGLContext()->insertObject( glNode, true /*false*/ );
136 return new SUPERVGUI_CanvasNodePrs( myMgr, myMain->getCanvas(), (SUPERVGUI_CanvasNode*)this);
139 void SUPERVGUI_CanvasNode::createPort(SUPERV::Port_ptr thePort)
141 SUPERVGUI_CanvasPort* aPort = 0;
142 if (thePort->IsInput())
143 aPort = new SUPERVGUI_CanvasPortIn((SUPERVGUI_CanvasNode*)this, myMain, thePort);
145 aPort = new SUPERVGUI_CanvasPortOut((SUPERVGUI_CanvasNode*)this, myMain, thePort);
148 connect(aPort, SIGNAL(destroyed(QObject*)), this, SLOT(onDestroyed(QObject*)));
149 if (!isIgnore) getPrs()->updatePorts();
151 emit objectCreatedDeleted(); // mkr : PAL8237
155 void SUPERVGUI_CanvasNode::createStreamPort(SUPERV::StreamPort_ptr thePort)
157 SUPERVGUI_CanvasPort* aPort = 0;
158 if (thePort->IsInput())
159 aPort = new SUPERVGUI_CanvasStreamPortIn((SUPERVGUI_CanvasNode*)this, myMain, thePort);
161 aPort = new SUPERVGUI_CanvasStreamPortOut((SUPERVGUI_CanvasNode*)this, myMain, thePort);
164 connect(aPort, SIGNAL(destroyed(QObject*)), this, SLOT(onDestroyed(QObject*)));
165 if (!isIgnore) getPrs()->updatePorts();
169 void SUPERVGUI_CanvasNode::onDestroyed(QObject* theObject)
172 removeChild(theObject); // signal is sent before removing the object
173 getPrs()->updatePorts();
177 QPopupMenu* SUPERVGUI_CanvasNode::getPopupMenu(QWidget* theParent)
179 QPopupMenu* popup = new QPopupMenu(theParent);
181 if (myMain->getDataflow()->IsExecuting()) { // Execution time
182 popup->insertItem((myNode->IsSuspended()?tr("MSG_RESUME"):tr("MSG_SUSPEND")), this, SLOT(suspendResume()));
183 popup->insertItem(tr("MSG_KILL"), this, SLOT(kill()));
185 else { // Edition time
186 const int type = getNodeType();
188 // for all nodes except EndLoop and EndSwitch : Rename, Delete, Copy
189 if ( myMain->isEditable() && type != SUPERV::EndLoopNode && type != SUPERV::EndSwitchNode &&
190 // asv 26.01.05 : don't allow nodes "edition" commands in Table view
191 myMain->getViewType() != CANVASTABLE ) {
192 popup->insertItem(tr("MSG_RENAME"), this, SLOT(rename()));
193 popup->insertItem(tr("MSG_DELETE"), this, SLOT(remove()));
196 // tmp: Copy temporary does not work for Macro nodes...
197 if ( type != SUPERV::MacroNode )
198 popup->insertItem(tr("ITM_COPY_NODE"), this, SLOT(copy())); // Copy Node functionality
199 popup->insertSeparator();
201 // for all nodes : Browse
202 popup->insertItem(tr("MSG_BROWSE"), this, SLOT(browse()));
204 // for all nodes except EndLoop and EndSwitch : Change info
205 if (type != SUPERV::EndLoopNode && type != SUPERV::EndSwitchNode)
206 popup->insertItem(tr("MSG_CHANGE_INFO"), this, SLOT(changeInformation()));
208 // for all InLine nodes
209 if ( type != SUPERV::FactoryNode && type != SUPERV::ComputingNode && type != SUPERV::MacroNode ) {
210 if ( myMain->isEditable() ) {
211 popup->insertSeparator();
212 popup->insertItem( tr( "MNU_EDIT_FUNC" ), this, SLOT(editFunction()));
215 // for all InLine, regardless isEditable() : Export to Library
216 popup->insertItem( tr( "MNU_EXPORT" ), this, SLOT( exportToLib()));
218 // for all InLine except EndLoop : Add Ports menu, Paste, Manage Ports
219 if ( myMain->isEditable() && type != SUPERV::EndLoopNode ) {
220 // mkr : IPAL9815 : commented the following code
221 /*QPopupMenu* addPortMenu = new QPopupMenu(theParent);
222 addPortMenu->insertItem( tr( "MNU_INPUT" ), this, SLOT(addInputPort()));
223 if (getNodeType() != SUPERV::LoopNode)
224 addPortMenu->insertItem( tr( "MNU_OUTPUT" ), this, SLOT(addOutputPort()));
226 popup->insertItem( tr( "MNU_ADD_PORT" ), addPortMenu);*/
227 popup->insertItem( tr( "MNU_MANAGE_PORTS" ), this, SLOT(managePorts()));
229 // Paste Port functionality
230 int aPasteItem = popup->insertItem(tr("ITM_PASTE_PORT"), this, SLOT(pastePort()));
231 SUPERVGUI_Clipboard* aCB = SUPERVGUI_Clipboard::getClipboard();
232 if ( !aCB->isCopyPort() || (type == SUPERV::LoopNode && !aCB->getCopyPort()->IsInput()) )
233 popup->setItemEnabled( aPasteItem, false );
240 void SUPERVGUI_CanvasNode::show()
245 void SUPERVGUI_CanvasNode::showAll()
250 void SUPERVGUI_CanvasNode::hideAll()
255 void SUPERVGUI_CanvasNode::switchLabel()
257 getPrs()->setLabelVisible(!getPrs()->isLabelVisible());
260 void SUPERVGUI_CanvasNode::switchPorts()
262 getPrs()->setPortVisible(!getPrs()->isPortVisible());
265 void SUPERVGUI_CanvasNode::move(int x, int y)
267 // myNode->Coords(x, y); // <<<- done inside Prs to reflect item movement by mouse press
268 if (x > GRAPH_MAX) x = (int) getPrs()->x();
269 if (y > GRAPH_MAX) y = (int) getPrs()->y();
270 getPrs()->move(x, y);
273 void SUPERVGUI_CanvasNode::merge()
275 // synchronize port list
278 SUPERVGUI_CanvasPort* aPort;
279 QObjectList* aPortList = queryList("SUPERVGUI_CanvasPort");
280 SUPERV_Ports aPorts = myNode->Ports();
281 for (int i = 0; i < aPorts->length(); i++) {
282 aPort = (SUPERVGUI_CanvasPort*)
283 child(myMain->getCanvas()->getPortName(aPorts[i].in()), "SUPERVGUI_CanvasPort");
285 aPortList->removeRef(aPort);
289 createPort(aPorts[i].in());
294 SUPERV_StreamPorts aStreamPorts = myNode->StreamPorts();
295 for (int i = 0; i < aStreamPorts->length(); i++) {
296 aPort = (SUPERVGUI_CanvasPort*)
297 child(myMain->getCanvas()->getPortName(aStreamPorts[i].in()), "SUPERVGUI_CanvasPort");
299 aPortList->removeRef(aPort);
303 createPort(aStreamPorts[i].in());
308 QObjectListIt it(*aPortList);
309 while ((aPort=(SUPERVGUI_CanvasPort*)it.current()) != 0) {
311 aPortList->removeRef(aPort);
317 if (update) getPrs()->updatePorts();
319 sync(); // update node state also
322 void SUPERVGUI_CanvasNode::sync() {
323 const bool isExecuting = myMain->getDataflow()->IsExecuting();
324 if ( myNode->IsMacro() && isExecuting ) {
325 // get SubGraph from MacroNode
326 SUPERV_Graph aMacro = SUPERV::Graph::_narrow(myNode);
327 if (!SUPERV_isNull(aMacro)) {
329 if (aMacro->IsStreamMacro())
330 aGraph = aMacro->StreamObjRef();
332 aGraph = aMacro->FlowObjRef();
333 if (!SUPERV_isNull(aGraph)) {
334 if (aGraph->State() != SUPERV::UndefinedState && aGraph->State() != SUPERV::NoState)
335 getPrs()->setState(aGraph->State());
337 getPrs()->setState(myNode->State());
342 SUPERV::GraphState aState = myNode->State();
344 // asv : 18.11.04 : fix for 6170 : after execution is finished, nodes' status must be reset.
345 // asv : 13.12.04 : commented out setting EditingState. See 2.21.
346 //if ( !isExecuting && myMain->IsGUIEventLoopFinished() && (aState == SUPERV::DoneState ||
347 // aState == SUPERV::KillState || aState == SUPERV::StopState ) )
348 // aState = SUPERV::EditingState;
349 getPrs()->setState(aState);
352 // update child ports
353 const QObjectList* list = children();
355 QObjectListIt it(*list);
356 while (QObject* obj = it.current()) {
358 if (obj->inherits("SUPERVGUI_CanvasPort")) {
359 ((SUPERVGUI_CanvasPort*)obj)->sync();
365 void SUPERVGUI_CanvasNode::syncOnEvent(SUPERV::GraphState theStateFromEvent)
367 getPrs()->setState(theStateFromEvent);
370 bool SUPERVGUI_CanvasNode::setNodeName(QString aName) {
371 bool result = myNode->SetName(aName.latin1());
373 setName(myNode->Name());
374 getPrs()->updateInfo();
375 // TODO: update name of all the links to this node
378 QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr( "ERROR" ), tr( "MSG_CANT_RENAMENODE" ) );
383 void SUPERVGUI_CanvasNode::rename() {
385 QString aName = QInputDialog::getText( tr( "Rename" ), tr( "Enter new name:" ), QLineEdit::Normal,
386 myNode->Name(), &ok, SUIT_Session::session()->activeApplication()->desktop() );
388 //mkr : modifications for fixing bug IPAL9972
389 if( ok && !aName.isEmpty() && aName.compare( myNode->Name() ) != 0) {
394 void SUPERVGUI_CanvasNode::remove() {
395 Trace("SUPERVGUI_CanvasNode::remove");
396 myMain->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag
398 //set myCopyPort from Main object to empty if engine of this port is deleted
399 //check if any port of this deleted node has been copied
400 SUPERVGUI_Clipboard* aCB = SUPERVGUI_Clipboard::getClipboard();
401 if ( aCB->isCopyPort() )
402 if ( QString(myNode->Name()) == QString(aCB->getCopyPort()->Node()->Name()) )
403 aCB->setCopyPort( 0 );
405 //set myCopyNode from Main object to empty if engine of this node is deleted
406 //check if myCopyNode and this node engine is equal
407 if ( aCB->isCopyNode() )
408 if ( QString(myNode->Name()) == QString(aCB->getCopyNode()->Name()) )
409 aCB->setCopyNode( 0 );
411 // mkr: since the deletion of the node allow only in CANVAS view,
412 // it is necessary to remove the CanvasArray's children, which
413 // have the same CNode engine as deleting node
414 myMain->removeArrayChild(myNode);
416 SUPERVGUI_Canvas* aCanvas = myMain->getCanvas();
420 emit objectCreatedDeleted(); // mkr : PAL8237
426 void SUPERVGUI_CanvasNode::copy() {
427 Trace("SUPERVGUI_CanvasNode::copy()");
428 SUPERVGUI_Clipboard* aCB = SUPERVGUI_Clipboard::getClipboard();
429 const int aKind = getNodeType();
430 if ( aKind == SUPERV::EndLoopNode || aKind == SUPERV::EndSwitchNode )
431 aCB->setCopyNode( SUPERV::CNode::_duplicate(SUPERV::GNode::_narrow(getEngine())->Coupled()) );
433 aCB->setCopyNode( SUPERV::CNode::_duplicate( getEngine() ) );
436 void SUPERVGUI_CanvasNode::suspendResume() {
437 Trace("SUPERVGUI_CanvasNode::suspendResume");
438 int n = queryList("SUPERVGUI_CanvasNode")->count();
439 if (myNode->IsSuspended()) {
440 if (!((n==1)? myMain->getDataflow()->Resume() : myNode->Resume())) {
441 QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_RESUMENODE") );
445 myMain->getMyThread()->startThread(tr("MSG_NODE_RESUMED1")+myNode->Name()+tr("MSG_NODE_RESUMED2"));
448 if (!((n==1)? myMain->getDataflow()->Suspend() : myNode->Suspend())) {
449 QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_SUSPENDNODE") );
451 syncOnEvent(SUPERV::SuspendReadyState);
452 myMain->getMessage()->putMessage(tr("MSG_NODE_SUSPENDED1")+myNode->Name()+tr("MSG_NODE_SUSPENDED2"));
457 void SUPERVGUI_CanvasNode::kill() {
458 Trace("SUPERVGUI_CanvasNode::kill");
459 int n = queryList("SUPERVGUI_CanvasNode")->count();
460 if (!((n==1)? myMain->getDataflow()->Kill() : myNode->Kill())) {
461 QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_KILLNODE") );
463 syncOnEvent(SUPERV_Kill);
464 myMain->getMessage()->putMessage(tr("MSG_NODE_KILLED1")+myNode->Name()+tr("MSG_NODE_KILLED2"));
467 /* asv : 15.12.04 : commented out stopRestart() in Main and CanvasNode because it's not called from anywhere,
468 the comment from kloss (in Main.cxx) may be explaining it, but it's in French and I do not understand it..
469 void SUPERVGUI_CanvasNode::stopRestart() {
470 Trace("SUPERVGUI_CanvasNode::stopRestart");
472 int n = queryList("SUPERVGUI_CanvasNode")->count();
473 if ((myNode->State() == SUPERV_Stop) || (myNode->State() == SUPERV_Kill)) {
474 if (!((n==1)? myMain->getDataflow()->Run() : myNode->ReStart())) {
475 QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_RESTARTNODE") );
478 if (!((n==1)? myMain->getDataflow()->Stop() : myNode->Stop())) {
479 QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_STOPNODE") );
484 void SUPERVGUI_CanvasNode::changeInformation() {
485 SUPERVGUI_Information* aDlg = new SUPERVGUI_Information(myNode, !myMain->isEditable());
488 QString aName = myNode->Name();
489 if (!aName.isEmpty() && myMain->isEditable()) {
490 //mkr : modifications for fixing bug IPAL9972
491 //setNodeName(aName);
493 setName(myNode->Name());
494 getPrs()->updateInfo();
495 // TODO: update name of all the links to this node
502 /* asv : 13.12.04 : The functions below are not called from anywhere, so commenting them out...
503 void SUPERVGUI_CanvasNode::configure()
505 Trace("SUPERVGUI_CanvasNode::configure");
506 QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_NOT_IMPLEMENTED") ); // kloss : a faire : lancer l'ihm DATA
509 void SUPERVGUI_CanvasNode::showPython()
511 Trace("SUPERVGUI_CanvasNode::showPython");
512 SUPERVGUI_Python cp(myMain->getStudy()->get_PyInterp(), !myMain->isEditable());
517 bool SUPERVGUI_CanvasNode::isWarning()
519 Trace("SUPERVGUI_CanvasNode::isWarning");
523 bool SUPERVGUI_CanvasNode::isStep()
525 Trace("SUPERVGUI_CanvasNode::isStep");
529 bool SUPERVGUI_CanvasNode::isTrace()
531 Trace("SUPERVGUI_CanvasNode::isTrace");
535 bool SUPERVGUI_CanvasNode::isVerbose()
537 Trace("SUPERVGUI_CanvasNode::isVerbose");
541 void SUPERVGUI_CanvasNode::setWarning(bool b)
543 Trace("SUPERVGUI_CanvasNode::setWarning");
547 void SUPERVGUI_CanvasNode::setStep(bool b)
549 Trace("SUPERVGUI_CanvasNode::setStep");
553 void SUPERVGUI_CanvasNode::setTrace(bool b)
555 Trace("SUPERVGUI_CanvasNode::setTrace");
559 void SUPERVGUI_CanvasNode::setVerbose(bool b)
561 Trace("SUPERVGUI_CanvasNode::setVerbose");
566 void SUPERVGUI_CanvasNode::browse()
568 // asv 28.01.05 : set "Editing" flag only on "OK" pressed in BrowseDlg
569 //myMain->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag
571 myBrowseDlg = new SUPERVGUI_BrowseNodeDlg(this);
572 myBrowseDlg->installEventFilter(this);
574 if (!myBrowseDlg->isVisible())
577 myBrowseDlg->raise();
578 myBrowseDlg->setActiveWindow();
579 myBrowseDlg->setFocus();
583 bool SUPERVGUI_CanvasNode::eventFilter( QObject* o, QEvent* e )
585 if (o == myBrowseDlg && e->type() == QEvent::Close)
587 return QObject::eventFilter(o, e);
590 QStringList SUPERVGUI_CanvasNode::getPortsNamesIN(SUPERV_INode theNode, bool theInputPorts)
593 if (!SUPERV_isNull(theNode)) {
594 SUPERV_Ports aPorts = theNode->Ports();
595 for (int i=0; i<aPorts->length(); i++) {
597 if (aPorts[i]->IsInput()) aPNList.append(QString(aPorts[i]->Name()));
600 if (!aPorts[i]->IsInput()) aPNList.append(QString(aPorts[i]->Name()));
606 SUPERV_Port SUPERVGUI_CanvasNode::createInPort()
608 SUPERV_INode aNode = getInlineNode();
609 if (SUPERV_isNull(aNode)) {
610 MESSAGE("SUPERVGUI_CanvasNode::createInPort: Node is wrong type");
613 SUPERVGUI_PortParamsDlg* aDlg = new SUPERVGUI_PortParamsDlg(getPortsNamesIN(aNode,true));
615 myMain->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag
616 SUPERV_Port aPort = aNode->InPort(aDlg->getName().latin1(),
617 aDlg->getType().latin1());
625 SUPERV_Port SUPERVGUI_CanvasNode::createOutPort()
627 SUPERV_INode aNode = getInlineNode();
628 if (SUPERV_isNull(aNode)) {
629 MESSAGE("SUPERVGUI_CanvasNode::createOutPort: Node is wrong type");
633 SUPERVGUI_PortParamsDlg* aDlg = new SUPERVGUI_PortParamsDlg(getPortsNamesIN(aNode,false));
635 myMain->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag
636 SUPERV_Port aPort = aNode->OutPort(aDlg->getName().latin1(),
637 aDlg->getType().latin1());
645 // mkr : IPAL9815 : commented the following code
646 /*void SUPERVGUI_CanvasNode::addInputPort() {
647 SUPERV_Port aPort = createInPort();
648 if (aPort == NULL || CORBA::is_nil( aPort ) ) return;
650 createPort(aPort.in());
654 void SUPERVGUI_CanvasNode::addOutputPort() {
655 SUPERV_Port aPort = createOutPort();
656 if (aPort == NULL || CORBA::is_nil( aPort ) ) return;
658 createPort(aPort.in());
662 void SUPERVGUI_CanvasNode::editFunction() {
663 if (getNodeType() == SUPERV::LoopNode) {
664 SUPERVGUI_EditPythonDlg* aDlg = new SUPERVGUI_EditPythonDlg(true);
665 SUPERV_LNode aLNode = getLoopNode();
666 aDlg->setInitFunction(aLNode->PyInit());
667 aDlg->setMoreFunction(aLNode->PyMore());
668 aDlg->setNextFunction(aLNode->PyNext());
670 myMain->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag
671 aLNode->SetPyInit(aDlg->getInitFuncName().latin1(), (aDlg->getInitFunction()).in());
672 aLNode->SetPyMore(aDlg->getMoreFuncName().latin1(), (aDlg->getMoreFunction()).in());
673 aLNode->SetPyNext(aDlg->getNextFuncName().latin1(), (aDlg->getNextFunction()).in());
678 SUPERVGUI_EditPythonDlg* aDlg = new SUPERVGUI_EditPythonDlg();
679 SUPERV_INode aINode = getInlineNode();
680 aDlg->setFunction(aINode->PyFunction());
682 myMain->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag
683 aINode->SetPyFunction(aDlg->getFuncName().latin1(), (aDlg->getFunction()).in());
690 * Called on "Paste port" command of popup menu
692 void SUPERVGUI_CanvasNode::pastePort() {
693 SUPERVGUI_Clipboard::getClipboard()->pastePort( this );
697 * Called on "Edit ports" popup menu command. See SUPERVGUI_ManagePortsDlg.h
698 * for detailed description of the functionality
700 void SUPERVGUI_CanvasNode::managePorts() {
701 SUPERVGUI_ManagePortsDlg* aDlg = new SUPERVGUI_ManagePortsDlg( this );
707 * Called on "Export to Library" popup menu command. See SUPERVGUI_Library.h
708 * for details on InLine nodes library functionality
710 void SUPERVGUI_CanvasNode::exportToLib() {
711 SUPERV::INode_var anINode = SUPERV::INode::_narrow( getEngine() );
712 if ( !CORBA::is_nil( anINode ) )
713 SUPERVGUI_Library::getLibrary()->Export( anINode );
715 SUIT_MessageBox::error1( SUIT_Session::session()->activeApplication()->desktop(), tr( "ERROR" ), tr( "MSG_BAD_INODE" ), tr( "OK" ) );
718 QString SUPERVGUI_CanvasNode::getToolTipText() const {
719 if ( myNode->IsFactory() )
720 return QString("Name : ") + SUPERV::FNode::_narrow(myNode)->Name() +
721 QString("\nContainer : ") + SUPERV::FNode::_narrow(myNode)->GetContainer() +
722 QString("\nComponentName : ") + SUPERV::FNode::_narrow(myNode)->GetComponentName() +
723 QString("\nInterfaceName : ") + SUPERV::FNode::_narrow(myNode)->GetInterfaceName();
724 return QString("Name : ") + myNode->Name() + '\n' + getLabelText();