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,
45 SUPERVGUI_Main* theMain, SUPERV_CNode theNode, bool theIsCell):
58 Trace("SUPERVGUI_CanvasNode::SUPERVGUI_CanvasNode");
60 setName(myNode->Name());
62 QString aComment(myNode->Comment());
63 QString aNewComment = aComment;
64 if (getNodeType() == SUPERV::FactoryNode) {
65 aNewComment = QString(myNode->Service()->ServiceName) +
66 QString(tr("COMMENT_FROM")) +
67 QString(getFactoryNode()->GetComponentName());
69 else if (myNode->IsMacro()) {
70 aNewComment = tr("COMMENT_MNODE");
73 aNewComment = tr("COMMENT_CNODE");
75 if (aComment.isEmpty()) {
76 myNode->SetComment(aNewComment.latin1());
79 myLabelText = aNewComment;
81 // mkr : if the SUPERVGUI_CavasCellNode created (for CANVASTABLE view),
82 // we don't create the ports
86 SUPERV_Ports aPortList = myNode->Ports();
87 for (int i = 0; i < aPortList->length(); i++)
88 createPort(aPortList[i].in());
90 SUPERV_StreamPorts aStreamPortList = myNode->StreamPorts();
91 for (int i = 0; i < aStreamPortList->length(); i++) {
92 createStreamPort(aStreamPortList[i].in());
99 connect(this, SIGNAL(objectCreatedDeleted()), myMain, SLOT(onObjectCreatedDeleted()));
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*/ );
135 return new SUPERVGUI_CanvasNodePrs( myMgr, myMain->getCanvas(), (SUPERVGUI_CanvasNode*)this);
138 void SUPERVGUI_CanvasNode::createPort(SUPERV::Port_ptr thePort)
140 SUPERVGUI_CanvasPort* aPort = 0;
141 if (thePort->IsInput())
142 aPort = new SUPERVGUI_CanvasPortIn((SUPERVGUI_CanvasNode*)this, myMain, thePort);
144 aPort = new SUPERVGUI_CanvasPortOut((SUPERVGUI_CanvasNode*)this, myMain, thePort);
147 connect(aPort, SIGNAL(destroyed(QObject*)), this, SLOT(onDestroyed(QObject*)));
148 if (!isIgnore) getPrs()->updatePorts();
150 emit objectCreatedDeleted(); // mkr : PAL8237
154 void SUPERVGUI_CanvasNode::createStreamPort(SUPERV::StreamPort_ptr thePort)
156 SUPERVGUI_CanvasPort* aPort = 0;
157 if (thePort->IsInput())
158 aPort = new SUPERVGUI_CanvasStreamPortIn((SUPERVGUI_CanvasNode*)this, myMain, thePort);
160 aPort = new SUPERVGUI_CanvasStreamPortOut((SUPERVGUI_CanvasNode*)this, myMain, thePort);
163 connect(aPort, SIGNAL(destroyed(QObject*)), this, SLOT(onDestroyed(QObject*)));
164 if (!isIgnore) getPrs()->updatePorts();
168 void SUPERVGUI_CanvasNode::onDestroyed(QObject* theObject)
171 removeChild(theObject); // signal is sent before removing the object
172 getPrs()->updatePorts();
176 QPopupMenu* SUPERVGUI_CanvasNode::getPopupMenu(QWidget* theParent)
178 QPopupMenu* popup = new QPopupMenu(theParent);
180 if (myMain->getDataflow()->IsExecuting()) { // Execution time
181 popup->insertItem((myNode->IsSuspended()?tr("MSG_RESUME"):tr("MSG_SUSPEND")), this, SLOT(suspendResume()));
182 popup->insertItem(tr("MSG_KILL"), this, SLOT(kill()));
184 else { // Edition time
185 const int type = getNodeType();
187 // for all nodes except EndLoop and EndSwitch : Rename, Delete, Copy
188 if ( myMain->isEditable() && type != SUPERV::EndLoopNode && type != SUPERV::EndSwitchNode &&
189 // asv 26.01.05 : don't allow nodes "edition" commands in Table view
190 myMain->getViewType() != CANVASTABLE ) {
191 popup->insertItem(tr("MSG_RENAME"), this, SLOT(rename()));
192 popup->insertItem(tr("MSG_DELETE"), this, SLOT(remove()));
195 // tmp: Copy temporary does not work for Macro nodes...
196 if ( type != SUPERV::MacroNode )
197 popup->insertItem(tr("ITM_COPY_NODE"), this, SLOT(copy())); // Copy Node functionality
198 popup->insertSeparator();
200 // for all nodes : Browse
201 popup->insertItem(tr("MSG_BROWSE"), this, SLOT(browse()));
203 // for all nodes except EndLoop and EndSwitch : Change info
204 if (type != SUPERV::EndLoopNode && type != SUPERV::EndSwitchNode)
205 popup->insertItem(tr("MSG_CHANGE_INFO"), this, SLOT(changeInformation()));
207 // for all InLine nodes
208 if ( type != SUPERV::FactoryNode && type != SUPERV::ComputingNode && type != SUPERV::MacroNode ) {
209 if ( myMain->isEditable() ) {
210 popup->insertSeparator();
211 popup->insertItem( tr( "MNU_EDIT_FUNC" ), this, SLOT(editFunction()));
214 // for all InLine, regardless isEditable() : Export to Library
215 popup->insertItem( tr( "MNU_EXPORT" ), this, SLOT( exportToLib()));
217 // for all InLine except EndLoop : Add Ports menu, Paste, Manage Ports
218 if ( myMain->isEditable() && type != SUPERV::EndLoopNode ) {
219 // mkr : IPAL9815 : commented the following code
220 /*QPopupMenu* addPortMenu = new QPopupMenu(theParent);
221 addPortMenu->insertItem( tr( "MNU_INPUT" ), this, SLOT(addInputPort()));
222 if (getNodeType() != SUPERV::LoopNode)
223 addPortMenu->insertItem( tr( "MNU_OUTPUT" ), this, SLOT(addOutputPort()));
225 popup->insertItem( tr( "MNU_ADD_PORT" ), addPortMenu);*/
226 popup->insertItem( tr( "MNU_MANAGE_PORTS" ), this, SLOT(managePorts()));
228 // Paste Port functionality
229 int aPasteItem = popup->insertItem(tr("ITM_PASTE_PORT"), this, SLOT(pastePort()));
230 SUPERVGUI_Clipboard* aCB = SUPERVGUI_Clipboard::getClipboard();
231 if ( !aCB->isCopyPort() || (type == SUPERV::LoopNode && !aCB->getCopyPort()->IsInput()) )
232 popup->setItemEnabled( aPasteItem, false );
239 void SUPERVGUI_CanvasNode::show()
244 void SUPERVGUI_CanvasNode::showAll()
249 void SUPERVGUI_CanvasNode::hideAll()
254 void SUPERVGUI_CanvasNode::switchLabel()
256 getPrs()->setLabelVisible(!getPrs()->isLabelVisible());
259 void SUPERVGUI_CanvasNode::switchPorts()
261 getPrs()->setPortVisible(!getPrs()->isPortVisible());
264 void SUPERVGUI_CanvasNode::move(int x, int y)
266 // myNode->Coords(x, y); // <<<- done inside Prs to reflect item movement by mouse press
267 if (x > GRAPH_MAX) x = (int) getPrs()->x();
268 if (y > GRAPH_MAX) y = (int) getPrs()->y();
269 getPrs()->move(x, y);
272 void SUPERVGUI_CanvasNode::merge()
274 // synchronize port list
277 SUPERVGUI_CanvasPort* aPort;
278 QObjectList* aPortList = queryList("SUPERVGUI_CanvasPort");
279 SUPERV_Ports aPorts = myNode->Ports();
280 for (int i = 0; i < aPorts->length(); i++) {
281 aPort = (SUPERVGUI_CanvasPort*)
282 child(myMain->getCanvas()->getPortName(aPorts[i].in()), "SUPERVGUI_CanvasPort");
284 aPortList->removeRef(aPort);
288 createPort(aPorts[i].in());
293 SUPERV_StreamPorts aStreamPorts = myNode->StreamPorts();
294 for (int i = 0; i < aStreamPorts->length(); i++) {
295 aPort = (SUPERVGUI_CanvasPort*)
296 child(myMain->getCanvas()->getPortName(aStreamPorts[i].in()), "SUPERVGUI_CanvasPort");
298 aPortList->removeRef(aPort);
302 createPort(aStreamPorts[i].in());
307 QObjectListIt it(*aPortList);
308 while ((aPort=(SUPERVGUI_CanvasPort*)it.current()) != 0) {
310 aPortList->removeRef(aPort);
316 if (update) getPrs()->updatePorts();
318 sync(); // update node state also
321 void SUPERVGUI_CanvasNode::sync() {
322 const bool isExecuting = myMain->getDataflow()->IsExecuting();
323 if ( myNode->IsMacro() && isExecuting ) {
324 // get SubGraph from MacroNode
325 SUPERV_Graph aMacro = SUPERV::Graph::_narrow(myNode);
326 if (!SUPERV_isNull(aMacro)) {
328 if (aMacro->IsStreamMacro())
329 aGraph = aMacro->StreamObjRef();
331 aGraph = aMacro->FlowObjRef();
332 if (!SUPERV_isNull(aGraph)) {
333 if (aGraph->State() != SUPERV::UndefinedState && aGraph->State() != SUPERV::NoState)
334 getPrs()->setState(aGraph->State());
336 getPrs()->setState(myNode->State());
341 SUPERV::GraphState aState = myNode->State();
343 // asv : 18.11.04 : fix for 6170 : after execution is finished, nodes' status must be reset.
344 // asv : 13.12.04 : commented out setting EditingState. See 2.21.
345 //if ( !isExecuting && myMain->IsGUIEventLoopFinished() && (aState == SUPERV::DoneState ||
346 // aState == SUPERV::KillState || aState == SUPERV::StopState ) )
347 // aState = SUPERV::EditingState;
348 getPrs()->setState(aState);
351 // update child ports
352 const QObjectList* list = children();
354 QObjectListIt it(*list);
355 while (QObject* obj = it.current()) {
357 if (obj->inherits("SUPERVGUI_CanvasPort")) {
358 ((SUPERVGUI_CanvasPort*)obj)->sync();
364 void SUPERVGUI_CanvasNode::syncOnEvent(SUPERV::GraphState theStateFromEvent)
366 getPrs()->setState(theStateFromEvent);
369 bool SUPERVGUI_CanvasNode::setNodeName(QString aName) {
370 bool result = myNode->SetName(aName.latin1());
372 setName(myNode->Name());
373 getPrs()->updateInfo();
374 // TODO: update name of all the links to this node
377 QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr( "ERROR" ), tr( "MSG_CANT_RENAMENODE" ) );
382 void SUPERVGUI_CanvasNode::rename() {
384 QString aName = QInputDialog::getText( tr( "Rename" ), tr( "Enter new name:" ), QLineEdit::Normal,
385 myNode->Name(), &ok, SUIT_Session::session()->activeApplication()->desktop() );
387 //mkr : modifications for fixing bug IPAL9972
388 if( ok && !aName.isEmpty() && aName.compare( myNode->Name() ) != 0) {
393 void SUPERVGUI_CanvasNode::remove() {
394 Trace("SUPERVGUI_CanvasNode::remove");
395 myMain->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag
397 //set myCopyPort from Main object to empty if engine of this port is deleted
398 //check if any port of this deleted node has been copied
399 SUPERVGUI_Clipboard* aCB = SUPERVGUI_Clipboard::getClipboard();
400 if ( aCB->isCopyPort() )
401 if ( QString(myNode->Name()) == QString(aCB->getCopyPort()->Node()->Name()) )
402 aCB->setCopyPort( 0 );
404 //set myCopyNode from Main object to empty if engine of this node is deleted
405 //check if myCopyNode and this node engine is equal
406 if ( aCB->isCopyNode() )
407 if ( QString(myNode->Name()) == QString(aCB->getCopyNode()->Name()) )
408 aCB->setCopyNode( 0 );
410 // mkr: since the deletion of the node allow only in CANVAS view,
411 // it is necessary to remove the CanvasArray's children, which
412 // have the same CNode engine as deleting node
413 myMain->removeArrayChild(myNode);
415 SUPERVGUI_Canvas* aCanvas = myMain->getCanvas();
419 emit objectCreatedDeleted(); // mkr : PAL8237
425 void SUPERVGUI_CanvasNode::copy() {
426 Trace("SUPERVGUI_CanvasNode::copy()");
427 SUPERVGUI_Clipboard* aCB = SUPERVGUI_Clipboard::getClipboard();
428 const int aKind = getNodeType();
429 if ( aKind == SUPERV::EndLoopNode || aKind == SUPERV::EndSwitchNode )
430 aCB->setCopyNode( SUPERV::CNode::_duplicate(SUPERV::GNode::_narrow(getEngine())->Coupled()) );
432 aCB->setCopyNode( SUPERV::CNode::_duplicate( getEngine() ) );
435 void SUPERVGUI_CanvasNode::suspendResume() {
436 Trace("SUPERVGUI_CanvasNode::suspendResume");
437 int n = queryList("SUPERVGUI_CanvasNode")->count();
438 if (myNode->IsSuspended()) {
439 if (!((n==1)? myMain->getDataflow()->Resume() : myNode->Resume())) {
440 QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_RESUMENODE") );
444 myMain->getMyThread()->startThread(tr("MSG_NODE_RESUMED1")+myNode->Name()+tr("MSG_NODE_RESUMED2"));
447 if (!((n==1)? myMain->getDataflow()->Suspend() : myNode->Suspend())) {
448 QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_SUSPENDNODE") );
450 syncOnEvent(SUPERV::SuspendReadyState);
451 myMain->getMessage()->putMessage(tr("MSG_NODE_SUSPENDED1")+myNode->Name()+tr("MSG_NODE_SUSPENDED2"));
456 void SUPERVGUI_CanvasNode::kill() {
457 Trace("SUPERVGUI_CanvasNode::kill");
458 int n = queryList("SUPERVGUI_CanvasNode")->count();
459 if (!((n==1)? myMain->getDataflow()->Kill() : myNode->Kill())) {
460 QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_KILLNODE") );
462 syncOnEvent(SUPERV_Kill);
463 myMain->getMessage()->putMessage(tr("MSG_NODE_KILLED1")+myNode->Name()+tr("MSG_NODE_KILLED2"));
466 /* asv : 15.12.04 : commented out stopRestart() in Main and CanvasNode because it's not called from anywhere,
467 the comment from kloss (in Main.cxx) may be explaining it, but it's in French and I do not understand it..
468 void SUPERVGUI_CanvasNode::stopRestart() {
469 Trace("SUPERVGUI_CanvasNode::stopRestart");
471 int n = queryList("SUPERVGUI_CanvasNode")->count();
472 if ((myNode->State() == SUPERV_Stop) || (myNode->State() == SUPERV_Kill)) {
473 if (!((n==1)? myMain->getDataflow()->Run() : myNode->ReStart())) {
474 QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_RESTARTNODE") );
477 if (!((n==1)? myMain->getDataflow()->Stop() : myNode->Stop())) {
478 QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_CANT_STOPNODE") );
483 void SUPERVGUI_CanvasNode::changeInformation() {
484 SUPERVGUI_Information* aDlg = new SUPERVGUI_Information(myNode, !myMain->isEditable());
487 QString aName = myNode->Name();
488 if (!aName.isEmpty() && myMain->isEditable()) {
489 //mkr : modifications for fixing bug IPAL9972
490 //setNodeName(aName);
492 setName(myNode->Name());
493 getPrs()->updateInfo();
494 // TODO: update name of all the links to this node
501 /* asv : 13.12.04 : The functions below are not called from anywhere, so commenting them out...
502 void SUPERVGUI_CanvasNode::configure()
504 Trace("SUPERVGUI_CanvasNode::configure");
505 QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr("ERROR"), tr("MSG_NOT_IMPLEMENTED") ); // kloss : a faire : lancer l'ihm DATA
508 void SUPERVGUI_CanvasNode::showPython()
510 Trace("SUPERVGUI_CanvasNode::showPython");
511 SUPERVGUI_Python cp(myMain->getStudy()->get_PyInterp(), !myMain->isEditable());
516 bool SUPERVGUI_CanvasNode::isWarning()
518 Trace("SUPERVGUI_CanvasNode::isWarning");
522 bool SUPERVGUI_CanvasNode::isStep()
524 Trace("SUPERVGUI_CanvasNode::isStep");
528 bool SUPERVGUI_CanvasNode::isTrace()
530 Trace("SUPERVGUI_CanvasNode::isTrace");
534 bool SUPERVGUI_CanvasNode::isVerbose()
536 Trace("SUPERVGUI_CanvasNode::isVerbose");
540 void SUPERVGUI_CanvasNode::setWarning(bool b)
542 Trace("SUPERVGUI_CanvasNode::setWarning");
546 void SUPERVGUI_CanvasNode::setStep(bool b)
548 Trace("SUPERVGUI_CanvasNode::setStep");
552 void SUPERVGUI_CanvasNode::setTrace(bool b)
554 Trace("SUPERVGUI_CanvasNode::setTrace");
558 void SUPERVGUI_CanvasNode::setVerbose(bool b)
560 Trace("SUPERVGUI_CanvasNode::setVerbose");
565 void SUPERVGUI_CanvasNode::browse()
567 // asv 28.01.05 : set "Editing" flag only on "OK" pressed in BrowseDlg
568 //myMain->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag
570 myBrowseDlg = new SUPERVGUI_BrowseNodeDlg(this);
571 myBrowseDlg->installEventFilter(this);
573 if (!myBrowseDlg->isVisible())
576 myBrowseDlg->raise();
577 myBrowseDlg->setActiveWindow();
578 myBrowseDlg->setFocus();
582 bool SUPERVGUI_CanvasNode::eventFilter( QObject* o, QEvent* e )
584 if (o == myBrowseDlg && e->type() == QEvent::Close)
586 return QObject::eventFilter(o, e);
589 QStringList SUPERVGUI_CanvasNode::getPortsNamesIN(SUPERV_INode theNode, bool theInputPorts)
592 if (!SUPERV_isNull(theNode)) {
593 SUPERV_Ports aPorts = theNode->Ports();
594 for (int i=0; i<aPorts->length(); i++) {
596 if (aPorts[i]->IsInput()) aPNList.append(QString(aPorts[i]->Name()));
599 if (!aPorts[i]->IsInput()) aPNList.append(QString(aPorts[i]->Name()));
605 SUPERV_Port SUPERVGUI_CanvasNode::createInPort()
607 SUPERV_INode aNode = getInlineNode();
608 if (SUPERV_isNull(aNode)) {
609 MESSAGE("SUPERVGUI_CanvasNode::createInPort: Node is wrong type");
612 SUPERVGUI_PortParamsDlg* aDlg = new SUPERVGUI_PortParamsDlg(getPortsNamesIN(aNode,true));
614 myMain->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag
615 SUPERV_Port aPort = aNode->InPort(aDlg->getName().latin1(),
616 aDlg->getType().latin1());
624 SUPERV_Port SUPERVGUI_CanvasNode::createOutPort()
626 SUPERV_INode aNode = getInlineNode();
627 if (SUPERV_isNull(aNode)) {
628 MESSAGE("SUPERVGUI_CanvasNode::createOutPort: Node is wrong type");
632 SUPERVGUI_PortParamsDlg* aDlg = new SUPERVGUI_PortParamsDlg(getPortsNamesIN(aNode,false));
634 myMain->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag
635 SUPERV_Port aPort = aNode->OutPort(aDlg->getName().latin1(),
636 aDlg->getType().latin1());
644 // mkr : IPAL9815 : commented the following code
645 /*void SUPERVGUI_CanvasNode::addInputPort() {
646 SUPERV_Port aPort = createInPort();
647 if (aPort == NULL || CORBA::is_nil( aPort ) ) return;
649 createPort(aPort.in());
653 void SUPERVGUI_CanvasNode::addOutputPort() {
654 SUPERV_Port aPort = createOutPort();
655 if (aPort == NULL || CORBA::is_nil( aPort ) ) return;
657 createPort(aPort.in());
661 void SUPERVGUI_CanvasNode::editFunction() {
662 if (getNodeType() == SUPERV::LoopNode) {
663 SUPERVGUI_EditPythonDlg* aDlg = new SUPERVGUI_EditPythonDlg(true);
664 SUPERV_LNode aLNode = getLoopNode();
665 aDlg->setInitFunction(aLNode->PyInit());
666 aDlg->setMoreFunction(aLNode->PyMore());
667 aDlg->setNextFunction(aLNode->PyNext());
669 myMain->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag
670 aLNode->SetPyInit(aDlg->getInitFuncName().latin1(), (aDlg->getInitFunction()).in());
671 aLNode->SetPyMore(aDlg->getMoreFuncName().latin1(), (aDlg->getMoreFunction()).in());
672 aLNode->SetPyNext(aDlg->getNextFuncName().latin1(), (aDlg->getNextFunction()).in());
677 SUPERVGUI_EditPythonDlg* aDlg = new SUPERVGUI_EditPythonDlg();
678 SUPERV_INode aINode = getInlineNode();
679 aDlg->setFunction(aINode->PyFunction());
681 myMain->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag
682 aINode->SetPyFunction(aDlg->getFuncName().latin1(), (aDlg->getFunction()).in());
689 * Called on "Paste port" command of popup menu
691 void SUPERVGUI_CanvasNode::pastePort() {
692 SUPERVGUI_Clipboard::getClipboard()->pastePort( this );
696 * Called on "Edit ports" popup menu command. See SUPERVGUI_ManagePortsDlg.h
697 * for detailed description of the functionality
699 void SUPERVGUI_CanvasNode::managePorts() {
700 SUPERVGUI_ManagePortsDlg* aDlg = new SUPERVGUI_ManagePortsDlg( this );
706 * Called on "Export to Library" popup menu command. See SUPERVGUI_Library.h
707 * for details on InLine nodes library functionality
709 void SUPERVGUI_CanvasNode::exportToLib() {
710 SUPERV::INode_var anINode = SUPERV::INode::_narrow( getEngine() );
711 if ( !CORBA::is_nil( anINode ) )
712 SUPERVGUI_Library::getLibrary()->Export( anINode );
714 SUIT_MessageBox::error1( SUIT_Session::session()->activeApplication()->desktop(), tr( "ERROR" ), tr( "MSG_BAD_INODE" ), tr( "OK" ) );
717 QString SUPERVGUI_CanvasNode::getToolTipText() const {
718 if ( myNode->IsFactory() )
719 return QString("Name : ") + SUPERV::FNode::_narrow(myNode)->Name() +
720 QString("\nContainer : ") + SUPERV::FNode::_narrow(myNode)->GetContainer() +
721 QString("\nComponentName : ") + SUPERV::FNode::_narrow(myNode)->GetComponentName() +
722 QString("\nInterfaceName : ") + SUPERV::FNode::_narrow(myNode)->GetInterfaceName();
723 return QString("Name : ") + myNode->Name() + '\n' + getLabelText();