Salome HOME
Stream Links show
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_Main.h
index 7d43978f96ab90914371681fba08b1314443a77e..08692040f8072f66d921cc84aba2bdc8f257d265 100644 (file)
@@ -1,9 +1,29 @@
-//  File      : SUPERVGUI_Main.h
-//  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_Main.h
+//  Author : Francis KLOSS
+//  Module : SUPERV
 
 #ifndef SUPERVGUI_Main_H
 #define SUPERVGUI_Main_H
 #include "QAD_Desktop.h"
 #include "SUPERVGUI_Port.h"
 
+#include <qobject.h>
+#include <qapplication.h>
+#include <qthread.h>
+
 class QAD_Study;
 class QAD_ObjectBrowser;
 class QAD_Message;
 class NOTIFICATION_Consumer;
-
+class SUPERVGUI_Thread;
 
 class SUPERVGUI_Main: public SUPERVGraph_View {
   Q_OBJECT
@@ -67,7 +91,7 @@ class SUPERVGUI_Main: public SUPERVGraph_View {
     void checkIsInStudy();
     
     void addComputeNode(SUPERV_CNode theNode);
-    void addControlNode(SUPERV_CNode theStartNode, SUPERV_CNode theEndNode);
+    void addControlNode(SUPERV_CNode theStartNode, SUPERV_CNode theEndNode, bool Update);
     void addGOTONode(SUPERV_CNode theNode);
 
     void setPaletteBackgroundColor(const QColor& color);
@@ -75,8 +99,27 @@ class SUPERVGUI_Main: public SUPERVGraph_View {
     void lockedGraph(bool theLock) { myIsLocked = theLock; }
     bool isLocked() { return myIsLocked; }
 
+    SUPERV::GraphState getNodeExecState();
+    void setNodeExecState(SUPERV::GraphState theNodeExecState);
+
+    QPtrList< char * > getEventNodes();
+    void setEventNodes(QPtrList< char * > theEventNodes);
+    bool removeFirstEN() { return myEventNodes.removeFirst(); }
+    void removeEventNodes() { myEventNodes.clear(); }
+
+    QPtrList< SUPERV::GraphState > getStates();
+    void setStates(QPtrList< SUPERV::GraphState > theStates);
+    bool removeFirstS() { return myStates.removeFirst(); }
+    void removeStates() { myStates.clear(); }
+
+    int getNodesNumber();
+    SUPERVGUI_Thread* getMyThread();
+
+    void startTimer();
+    void executionFinished();
+
   public slots:
-    void execute();
+    void execute(char * theNodeNode, SUPERV::GraphState theNodeState);
     void sync();
     void syncAsync();
     bool addStudy();
@@ -91,11 +134,10 @@ class SUPERVGUI_Main: public SUPERVGraph_View {
  
   private slots:
     void chooseData(QListViewItem* item);
+    void checkExecution();
 
   private:
     void init(QAD_Desktop* parent);
-    void StartTimer(const char* m);
-    void StopTimer(const char* m);
     void syncNotification();
     bool isFiltered(char* graph, char* node, char* type, char* message, char* sender, long counter, char* date, long stamp);
 
@@ -104,8 +146,7 @@ class SUPERVGUI_Main: public SUPERVGraph_View {
     QAD_ObjectBrowser*      objectBrowser;
     QAD_Message*            message;
     SUPERVGUI_Graph*        graph;
-    QTimer*                 timer;
-
+    
     GraphViewType   myCurrentView;
     SUPERVGUI_Array*   array;
 
@@ -132,6 +173,31 @@ class SUPERVGUI_Main: public SUPERVGraph_View {
     bool                   myVerbose;
     bool                   myIsKilled;
     bool                   myIsLocked;
+
+    SUPERVGUI_Thread*      myThread; 
+
+    QPtrList< char * >                myEventNodes ;
+    QPtrList< SUPERV::GraphState >    myStates ;
+    QTimer*                myTimer;
+};
+
+class SUPERVGUI_Thread : public QObject, public QThread {
+  Q_OBJECT;
+ public:
+  SUPERVGUI_Thread();
+  ~SUPERVGUI_Thread();
+
+  void startThread(const char* m);
+  void stopThread(const char* m);
+  void setMain(SUPERVGUI_Main* theMain);
+
+ protected:
+  void run();
+
+ private:
+  bool                myIsActive;
+  SUPERVGUI_Main*     myMain;
+
 };
 
 #endif