// SUPERV SUPERVGUI : GUI for Supervisor component
//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SUPERVGUI_CanvasView.cxx
// Author : Natalia KOPNOVA
// Module : SUPERV
-using namespace std;
-
+#include "SUPERVGUI.h"
#include "SUPERVGUI_CanvasView.h"
#include "SUPERVGUI_Main.h"
#include "SUPERVGUI_CanvasNode.h"
#include "SUPERVGUI_CanvasNodePrs.h"
#include "SUPERVGUI_Clipboard.h"
+#include "SUPERVGUI_ArrayView.h" //for tooltip testing
+
#include "SUIT_MessageBox.h"
#include <qpixmap.h>
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() ) );
+
+ SUPERVGraph_ViewFrame* anActiveVF = (SUPERVGraph_ViewFrame*)myMain->parent();
+ if ( anActiveVF ) {
+ myPopup->insertSeparator();
+ myShowToolBarItem = myPopup->insertItem( tr( "MEN_SHOW_TOOLBAR" ), myMain, SLOT( onShowToolbar() ) );
+ }
+
+ // mkr : PAL8237
+ connect(this, SIGNAL(objectCreated()), myMain, SLOT(onObjectCreatedDeleted()));
}
SUPERVGUI_CanvasView::~SUPERVGUI_CanvasView()
{
+ SUPERVGUI_Clipboard::setNullClipboard();
}
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()*/ );
+
+ myPopup->setItemEnabled( myShowToolBarItem, !((SUPERVGraph_ViewFrame*)myMain->parent())->getToolBar()->isVisible() );
+
myMain->showPopup(myPopup, theEvent);
return;
}
myLinkBuilder->setFloatPoint(p);
canvas()->update();
}
-
+
if (myCurrentItem) {
// setHilighted(0);
if (myCurrentItem->x() && myCurrentItem->y()) {
setHilighted(0);
}
+ // QToolTip for title and label for SUPERVGUI_CanvasNode
+ SUPERVGUI_ToolTip* aTT = new SUPERVGUI_ToolTip(this);
+ aTT->maybeTip(p);
+
busy = false;
}
{
QColor aColor = QColorDialog::getColor(canvas()->backgroundColor(), this );
if ( aColor.isValid() ) {
+ // change background color for canvas view
canvas()->setBackgroundColor(aColor);
setPaletteBackgroundColor(aColor.light(120));
+ // change background color for array view
+ getMain()->getArrayView()->canvas()->setBackgroundColor(aColor);
+ getMain()->getArrayView()->setPaletteBackgroundColor(aColor.light(120));
+
+ // mkr : IPAL10825 -->
+ SUPERVGUI* aSupMod = SUPERVGUI::Supervision();
+ if ( !aSupMod ) {
+ MESSAGE("NULL Supervision module!");
+ return;
+ }
+ aSupMod->setIVFBackgroundColor(aColor);
+ // <--
}
}
SUPERVGUI_CanvasLink* aLink = new SUPERVGUI_CanvasLink(canvas(), myMain, aLinkEngine);
aLink->show();
+ emit objectCreated(); // mkr : PAL8237
+
canvas()->update();
myIsLinkCreating = false;
// asv : 13.12.04 : introducing a check for ports' types compatibility (Bugs and Improvements p.1.16, PAL7380)
if ( !aLinkEngine->IsValid() ) {
- const int id = SUIT_MessageBox::warn2( this, tr( "TLT_INVALID_LINK" ), tr( "MSG_INVALID_LINK" ),
+ const int id = SUIT_MessageBox::warn2( this, tr( "TLT_INVALID_LINK" ),
+ tr( "MSG_INVALID_LINK" ) + QString(" : ") + QString(myMain->getDataflow()->Messages()),
tr( "Keep" ), tr( "Remove" ), 0, 1, 0 );
if ( id == 1 ) { // "Remove" was selected in Message Box
aLink->remove(); // the new link did not live long...
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;
+}