Salome HOME
Memory Leaks
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_Main.h
index b8140ecf5b5e07d81544d710d7efb3cbcfb3e7d3..274a179848a2a189abcd66bd2562a18a3f6bcb8b 100644 (file)
 #ifndef SUPERVGUI_Main_H
 #define SUPERVGUI_Main_H
 
-//#include "SUPERVGUI.h"
 #include "SUPERVGraph_ViewFrame.h"
-#include "SUPERVGUI_Array.h"
-#include "SUPERVGUI_Graph.h"
 #include "QAD_Desktop.h"
-#include "SUPERVGUI_Port.h"
 #include "SUPERVGUI_Canvas.h"
 #include "SUPERVGUI_CanvasView.h"
+#include "SUPERVGUI_ArrayView.h"
 
 #include <qobject.h>
 #include <qapplication.h>
 class QAD_Study;
 class QAD_ObjectBrowser;
 class QAD_Message;
+class QAD_SpinBoxDbl;
+class QLineEdit;
+class QComboBox;
 class NOTIFICATION_Consumer;
 class SUPERVGUI_Thread;
 
 class SUPERVGUI_Main: public SUPERVGraph_View {
   Q_OBJECT
 
+  // asv : 18.11.04 : making Thread class a friend in order to allow it to modify
+  // a private field myGUIEventLoopFinished
+  friend class SUPERVGUI_Thread;
+
   public:
-    SUPERVGUI_Main(SUPERVGraph_ViewFrame*, QAD_Desktop*, bool fromIOR);
-    SUPERVGUI_Main(SUPERVGraph_ViewFrame*, QAD_Desktop*, bool isModify, const char* filename);
     SUPERVGUI_Main(SUPERVGraph_ViewFrame*, QAD_Desktop*, SUPERV_Graph);
     virtual ~SUPERVGUI_Main();
 
-    void run();
-    void startExecute();
+    void run( const bool andSuspend );
     void kill();
     void suspendResume();
-    void stopRestart();
-    bool exportDataflow(QString theFile);
+    //void stopRestart();
     void openSubGraph(SUPERV_CNode theNode, bool correct = false);
 
     bool putDataStudy(SUPERV_Port port, const char* inout);
-    void setData(SUPERVGUI_PortIn* p);
 
-    SUPERVGUI_Graph* getGraph();
-    SUPERVGUI_Array* getArray();
+    SUPERVGUI_CanvasArray*  getCanvasArray();
+    SUPERVGUI_ArrayView* getArrayView();
     SUPERVGUI_Canvas* getCanvas();
     SUPERVGUI_CanvasView* getCanvasView();
     SUPERV_Graph getDataflow();
@@ -85,16 +84,13 @@ class SUPERVGUI_Main: public SUPERVGraph_View {
 
     QString getHashCode() 
       { return myHashCode; };
-
+    
+    bool isDataflowInStudy() const;
     
     bool isEditable() 
       { if (SUPERV_isNull(dataflow)) return false;
       return !dataflow->IsReadOnly(); };
 
-    bool isFromStudy() { return myIsFromStudy; }
-    void setAsFromStudy(bool theToStudy);
-    void checkIsInStudy();
-    
     void addComputeNode(SUPERV_CNode theNode);
     void addControlNode(SUPERV_CNode theStartNode, SUPERV_CNode theEndNode, bool Update);
     void addGOTONode(SUPERV_CNode theNode);
@@ -104,7 +100,6 @@ class SUPERVGUI_Main: public SUPERVGraph_View {
 
     void lockedGraph(bool theLock) { myIsLocked = theLock; }
     bool isLocked() { return myIsLocked; }
-    bool isKilled() { return myIsKilled; }
 
     SUPERV::GraphState getNodeExecState();
     void setNodeExecState(SUPERV::GraphState theNodeExecState);
@@ -127,6 +122,16 @@ class SUPERVGUI_Main: public SUPERVGraph_View {
 
     bool eventFilter( QObject* o, QEvent* e);
 
+    void Editing(); // any Editing operation is to be performed ->
+                   // activate Editors data model in Engine
+    bool ReadyToModify(); // must be called before any modification
+                   // operation - asks to kill execution of dataflow.  If returns false -
+                   // modification (==Editing() ) is not allowed.
+
+    void removeArrayChild(SUPERV::CNode_ptr theNode);
+
+    GraphViewType getViewType() { return myCurrentView; }
+
   signals:
     void KillMyThread(bool theValue);
 
@@ -134,15 +139,16 @@ class SUPERVGUI_Main: public SUPERVGraph_View {
     void execute(char * theNodeNode, SUPERV::GraphState theNodeState);
     void sync();
     void syncAsync();
-    bool addStudy();
+    void addDataflowToStudy();
     void insertFile();
     void addNode();
     void changeInformation();
     void copy();
-    void showTable();
-    void showFullGraph();
+
+    void showCanvasTable();
     void showContolFlow();
     void showCanvas();
+
     void filterNotification();
     void changeDSGraphParameters();
     void onSubGraphClosed(QAD_StudyFrame* );
@@ -156,6 +162,7 @@ class SUPERVGUI_Main: public SUPERVGraph_View {
     void init(QAD_Desktop* parent);
     void syncNotification();
     bool isFiltered(char* graph, char* node, char* type, char* message, char* sender, long counter, char* date, long stamp);
+    void closeEvent(QCloseEvent*);
 
     SUPERV_Graph            dataflow;
 
@@ -166,42 +173,40 @@ class SUPERVGUI_Main: public SUPERVGraph_View {
     QAD_Study*              study;
     QAD_ObjectBrowser*      objectBrowser;
     QAD_Message*            message;
-    SUPERVGUI_Graph*        graph;
-    
-    GraphViewType   myCurrentView;
-    SUPERVGUI_Array*   array;
+
+    GraphViewType           myCurrentView;
+    SUPERVGUI_CanvasArray*  myArray;
+    SUPERVGUI_ArrayView*    myArrayView;
     SUPERVGUI_Canvas*       myCanvas;
     SUPERVGUI_CanvasView*   myCanvasView;
 
-    bool               choosing;
-    SUPERVGUI_PortIn*  portIn;
+    bool                    choosing;
 
-    QString            myHashCode;
+    QString                 myHashCode;
     
-    bool               myIsFromStudy;
-    int                myCopyNum;
+    bool                    myIsFromStudy;
+    int                     myCopyNum;
 
-    SALOME_NamingService* myNService;
-    QDateTime             myRunTime; // mpv 23.12.2002: we need time of running of dataflow
-                                     // for right Study document modification
+    SALOME_NamingService*   myNService;
+    QDateTime               myRunTime; // mpv 23.12.2002: we need time of running of dataflow
+                                       // for correct Study document modification
     /* notification data */                           
-    NOTIFICATION_Consumer* notification;
-    bool                   myFiltered;
-    bool                   myLogged;
-    QString                myLogFileName;
-    FILE*                  myLogFile;
-    bool                   myWarning;
-    bool                   myStep;
-    bool                   myTrace;
-    bool                   myVerbose;
-    bool                   myIsKilled;
-    bool                   myIsLocked;
-
-    SUPERVGUI_Thread*      myThread; 
+    NOTIFICATION_Consumer*  notification;
+    bool                    myFiltered;
+    bool                    myLogged;
+    QString                 myLogFileName;
+    FILE*                   myLogFile;
+    bool                    myWarning;
+    bool                    myStep;
+    bool                    myTrace;
+    bool                    myVerbose;
+    bool                    myIsLocked;
+
+    SUPERVGUI_Thread*       myThread; 
 
     QPtrList< char * >                myEventNodes ;
     QPtrList< SUPERV::GraphState >    myStates ;
-    QTimer*                myTimer;
+    QTimer*                 myTimer;
 };
 
 class SUPERVGUI_Thread : public QObject, public QThread {
@@ -211,7 +216,6 @@ class SUPERVGUI_Thread : public QObject, public QThread {
   ~SUPERVGUI_Thread();
 
   void startThread(const char* m);
-  void stopThread(const char* m);
   void setMain(SUPERVGUI_Main* theMain);
 
  public slots:
@@ -227,7 +231,9 @@ class SUPERVGUI_Thread : public QObject, public QThread {
 
 };
 
-//**************************************************************
+/**
+ * A dialog for setting Graph execution parameters
+ */
 class SUPERVGUI_DSGraphParameters: public QDialog {
   Q_OBJECT
 
@@ -239,9 +245,9 @@ class SUPERVGUI_DSGraphParameters: public QDialog {
     void accept();
 
   private:
-    
+
     void setData();
-    
+
     QAD_SpinBoxDbl*      myDeltaTime;
     QLineEdit*           myTimeOut;
     QComboBox*           myDataStreamTrace;