From: mkr Date: Wed, 8 Jun 2005 10:41:44 +0000 (+0000) Subject: Fix PAL8912 in SUIT-based version of SUPERVISOR. X-Git-Tag: T3_0_0_a2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d797c7fa5e2df201abd8a31c8773ccdfbe88ee87;p=modules%2Fsuperv.git Fix PAL8912 in SUIT-based version of SUPERVISOR. --- diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasView.cxx b/src/SUPERVGUI/SUPERVGUI_CanvasView.cxx index 75fe69c..bbe4d72 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasView.cxx +++ b/src/SUPERVGUI/SUPERVGUI_CanvasView.cxx @@ -148,6 +148,11 @@ SUPERVGUI_CanvasView::SUPERVGUI_CanvasView(SUPERVGUI_Canvas* theCanvas, SUPERVGU myDelPntItem = mySketchPopup->insertItem(tr("MSG_DEL_LAST_PNT"), this, SLOT(deletePoint())); mySketchPopup->insertItem(tr("MSG_DEL_LINK"), this, SLOT(cancelSketch())); myOrtoItem = mySketchPopup->insertItem(tr("MSG_ORTHO_LINE"), this, SLOT(setOrthoMode())); + + + // add "change dataflow parameters" popup item + myPopup->insertSeparator(); + myDSParamsItem = myPopup->insertItem( tr( "MSG_SET_GRAPHPARAMS" ), myMain, SLOT( changeDSGraphParameters() ) ); } @@ -224,6 +229,9 @@ void SUPERVGUI_CanvasView::contentsMousePressEvent(QMouseEvent* theEvent) // Paste Node functionality SUPERVGUI_Clipboard* aCB = SUPERVGUI_Clipboard::getClipboard(); myPopup->setItemEnabled(myPasteNodeItem, aCB->isCopyNode() ); + + myPopup->setItemEnabled( myDSParamsItem, isHavingStreamPort()/*myMain->getDataflow()->IsStreamGraph()*/ ); + myMain->showPopup(myPopup, theEvent); return; } @@ -738,3 +746,58 @@ void SUPERVGUI_CanvasView::fitWithinRect() myCursor = cursor(); setCursor(handCursor); } + +bool SUPERVGUI_CanvasView::isHavingStreamPort() const +{ + SUPERV::ListOfNodes* aNodesList = myMain->getDataflow()->Nodes(); + + //Computing Nodes + for ( int i = 0 ; i < (int) aNodesList->CNodes.length() ; i++ ) { + SUPERV::ListOfStreamPorts aStrPortsList = *( (aNodesList->CNodes)[i]->StreamPorts() ); + if ((int) aStrPortsList.length() > 0) { + return true; + } + } + + //FactoryNodes + for ( int i = 0 ; i < (int) aNodesList->FNodes.length() ; i++ ) { + SUPERV::ListOfStreamPorts aStrPortsList = *( (aNodesList->FNodes)[i]->StreamPorts() ); + if ((int) aStrPortsList.length() > 0) { + return true; + } + } + + //InLineNodes + for ( int i = 0 ; i < (int) aNodesList->INodes.length() ; i++ ) { + SUPERV::ListOfStreamPorts aStrPortsList = *( (aNodesList->INodes)[i]->StreamPorts() ); + if ((int) aStrPortsList.length() > 0) { + return true; + } + } + + //GOTONodes + for ( int i = 0 ; i < (int) aNodesList->GNodes.length() ; i++ ) { + SUPERV::ListOfStreamPorts aStrPortsList = *( (aNodesList->GNodes)[i]->StreamPorts() ); + if ((int) aStrPortsList.length() > 0) { + return true; + } + } + + //LoopNodes + for ( int i = 0 ; i < (int) aNodesList->LNodes.length() ; i++ ) { + SUPERV::ListOfStreamPorts aStrPortsList = *( (aNodesList->LNodes)[i]->StreamPorts() ); + if ((int) aStrPortsList.length() > 0) { + return true; + } + } + + //SwitchNodes + for ( int i = 0 ; i < (int) aNodesList->SNodes.length() ; i++ ) { + SUPERV::ListOfStreamPorts aStrPortsList = *( (aNodesList->SNodes)[i]->StreamPorts() ); + if ((int) aStrPortsList.length() > 0) { + return true; + } + } + + return false; +} diff --git a/src/SUPERVGUI/SUPERVGUI_CanvasView.h b/src/SUPERVGUI/SUPERVGUI_CanvasView.h index 52b5b5f..e44fb2a 100644 --- a/src/SUPERVGUI/SUPERVGUI_CanvasView.h +++ b/src/SUPERVGUI/SUPERVGUI_CanvasView.h @@ -64,10 +64,13 @@ class SUPERVGUI_CanvasView: public QCanvasView { void setHilighted(SUPERVGUI_CanvasLink* theLink); void endSketch(SUPERVGUI_CanvasPort* thePort); + bool isHavingStreamPort() const; + SUPERVGUI_Main* myMain; QPopupMenu* myPopup; int myAddStudyItem; int myPasteNodeItem; + int myDSParamsItem; QPopupMenu* mySketchPopup; int myDelPntItem; int myOrtoItem; diff --git a/src/SUPERVGUI/SUPERVGUI_Main.cxx b/src/SUPERVGUI/SUPERVGUI_Main.cxx index b307213..ad484dd 100644 --- a/src/SUPERVGUI/SUPERVGUI_Main.cxx +++ b/src/SUPERVGUI/SUPERVGUI_Main.cxx @@ -244,6 +244,13 @@ void SUPERVGUI_Main::filterNotification() { } } +void SUPERVGUI_Main::changeDSGraphParameters() { + SUPERVGUI_DSGraphParameters* aDlg = new SUPERVGUI_DSGraphParameters(dataflow, dataflow->IsReadOnly()); + if (aDlg->exec() ) + sync(); + delete aDlg; +} + void SUPERVGUI_Main::syncAsync() { Trace("SUPERVGUI_Main::syncAsync"); QTimer::singleShot(1, this, SLOT(sync()));