]> SALOME platform Git repositories - modules/superv.git/blobdiff - src/SUPERVGUI/SUPERVGUI_Node.cxx
Salome HOME
NRI : Merge from V1_2.
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_Node.cxx
index 2bb3faea6072e75ae1857eaa58f98cd93f247e7b..ba1a479e199fc898bebf75a9cd521dd4059f12c8 100644 (file)
@@ -1,11 +1,31 @@
-using namespace std;
-//  File      : SUPERVGUI_Node.cxx
-//  Created   : 24 / 10 / 2001
-//  Author    : Francis KLOSS
-//  Project   : SALOME
-//  Module    : SUPERVGUI
-//  Copyright : CEA
+//  SUPERV SUPERVGUI : GUI for Supervisor component
+//
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : SUPERVGUI_Node.cxx
+//  Author : Francis KLOSS
+//  Module : SUPERV
 
+using namespace std;
 #include "SUPERVGUI_Node.h"
 #include "SUPERVGUI_Main.h"
 #include "SUPERVGUI_Python.h"
@@ -13,6 +33,8 @@ using namespace std;
 #include "SUPERVGUI_BrowseNodeDlg.h"
 #include "SALOMEGUI_NameDlg.h"
 #include "SUPERVGUI_Information.h"
+#include "SUPERVGUI_ComputeNode.h"
+#include "SUPERVGUI_ControlNode.h"
 
 #include <qlayout.h>
 #include <qlabel.h>
@@ -20,6 +42,7 @@ using namespace std;
 #include <qpushbutton.h>
 #include <qhbox.h>
 #include <qgroupbox.h>
+#include <qtooltip.h>
 
 
 
@@ -52,13 +75,15 @@ SUPERVGUI_Node::SUPERVGUI_Node(QWidget* theParent, SUPERVGUI_Main* theMain, SUPE
 
   //create common popup
   myPopup = new QPopupMenu(this);
-  if (myMain->isEditable()) {
+  if (myMain->isEditable() && getNodeType() != SUPERV::EndLoopNode 
+                           && getNodeType() != SUPERV::EndSwitchNode) {
     myRenameItem  = myPopup->insertItem(tr("MSG_RENAME"), this, SLOT(rename()));
     myDeleteItem = myPopup->insertItem(tr("MSG_DELETE"), this, SLOT(remove()));
     mySeparatorId = myPopup->insertSeparator();
   }
   myPopup->insertItem(tr("MSG_BROWSE"), this, SLOT(browse()));
-  myPopup->insertItem(tr("MSG_CHANGE_INFO"), this, SLOT(changeInformation()));
+  if ((getNodeType() != SUPERV::EndLoopNode) && (getNodeType() != SUPERV::EndSwitchNode))
+    myPopup->insertItem(tr("MSG_CHANGE_INFO"), this, SLOT(changeInformation()));
   //myPopup->insertItem(tr("MSG_CONFIGURE"),   this, SLOT(configure()));
 
   if (myMain->isEditable() && (getNodeType() != SUPERV::FactoryNode)
@@ -148,10 +173,10 @@ void SUPERVGUI_Node::setState(SUPERV::GraphState theState)
     break;
   }
   myTime->setPaletteBackgroundColor(myStatus->paletteBackgroundColor());
-  int sec = 0; //myNode->getTime();
+  long sec = 0; //myNode->CpuUsed();
   //    sec++;
   char hms[9];
-  int s = sec/3600;
+  long s = sec/3600;
   hms[0]=(char)(((s/10)%10)+48);
   hms[1]=(char)((s%10)+48);
   hms[2]=':';
@@ -231,6 +256,55 @@ void SUPERVGUI_Node::changeInformation() {
   if (aDlg->exec() )
     sync();
   delete aDlg;
+  if (myNode->IsGOTO()) {
+    QString nmGT = myNode->Name();
+    if ( !nmGT.isEmpty() ) {
+      setNodeName(nmGT);
+    }
+  }
+  if (myMain->isEditable()) {
+    if (myMain->isArrayShown()) {  //Table View
+      if (myNode->IsLoop() || myNode->IsSwitch()) { //for synchronic names changing
+       QString nmA = myNode->Name();
+       if ( !nmA.isEmpty() ) {
+         setNodeName(nmA);
+         QString aStrA(tr("ENDNODE_PREFIX"));
+         aStrA+=nmA;
+         (dynamic_cast<SUPERVGUI_Cell*>(this))->getPairCell()->getTitle()->setText(aStrA);
+         (dynamic_cast<SUPERVGUI_Cell*>(this))->getPairCell()->setNodeName(aStrA);
+         // QToolTip::remove((dynamic_cast<SUPERVGUI_Cell*>(this))->getPairCell()->getTitle());
+         QToolTip::add((dynamic_cast<SUPERVGUI_Cell*>(this))->getPairCell()->getTitle(),
+                       (dynamic_cast<SUPERVGUI_Cell*>(this))->getPairCell()->getTitle()->text());
+
+       }
+      }
+      // QToolTip::remove((dynamic_cast<SUPERVGUI_Cell*>(this))->getTitle());
+      QToolTip::add((dynamic_cast<SUPERVGUI_Cell*>(this))->getTitle(),
+                   (dynamic_cast<SUPERVGUI_Cell*>(this))->getTitle()->text());
+      QToolTip::add((dynamic_cast<SUPERVGUI_Cell*>(this))->getComponent(),
+                   (dynamic_cast<SUPERVGUI_Cell*>(this))->getComponent()->text());
+    }
+    else {  //Graph View
+      if (myNode->IsLoop() || myNode->IsSwitch()) { //for synchronic names changing
+       QString nm = myNode->Name();
+       if ( !nm.isEmpty() ) {
+         setNodeName(nm);
+         QString aStr(tr("ENDNODE_PREFIX"));
+         aStr+=nm;
+         (dynamic_cast<SUPERVGUI_StartControlNode*>(this))->getEndNode()->setNodeName(aStr);
+       }
+      }
+      else {
+       if (!(myNode->IsGOTO())) {
+         // QToolTip::remove((dynamic_cast<SUPERVGUI_ComputeNode*>(this))->getCommLabel());
+         QToolTip::add((dynamic_cast<SUPERVGUI_ComputeNode*>(this))->getCommLabel(),
+                       (dynamic_cast<SUPERVGUI_ComputeNode*>(this))->getCommLabel()->text());
+         QToolTip::add((dynamic_cast<SUPERVGUI_ComputeNode*>(this))->getTitleLabel(),
+                       (dynamic_cast<SUPERVGUI_ComputeNode*>(this))->getTitleLabel()->text());
+       }
+      }
+    }
+  }
   /*    Trace("SUPERVGUI_Node::changeInformation")
     if (Supervision.information(myNode, !myMain->isEditable())) {
         myMain->syncAsync();