Salome HOME
7d3b1d32cc5949144d9781c7759791e61a4a9105
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_Main.h
1 //  File      : SUPERVGUI_Main.h
2 //  Created   : 24 / 10 / 2001
3 //  Author    : Francis KLOSS
4 //  Project   : SALOME
5 //  Module    : SUPERVGUI
6 //  Copyright : CEA
7
8 #ifndef SUPERVGUI_Main_H
9 #define SUPERVGUI_Main_H
10
11 //#include "SUPERVGUI.h"
12 #include "SUPERVGraph_ViewFrame.h"
13 #include "SUPERVGUI_Array.h"
14 #include "SUPERVGUI_Graph.h"
15 #include "QAD_Desktop.h"
16 #include "SUPERVGUI_Port.h"
17
18 class QAD_Study;
19 class QAD_ObjectBrowser;
20 class QAD_Message;
21 class NOTIFICATION_Consumer;
22
23
24 class SUPERVGUI_Main: public SUPERVGraph_View {
25   Q_OBJECT
26
27   public:
28     SUPERVGUI_Main(SUPERVGraph_ViewFrame*, QAD_Desktop*, bool fromIOR);
29     SUPERVGUI_Main(SUPERVGraph_ViewFrame*, QAD_Desktop*, bool isModify, const char* filename);
30     SUPERVGUI_Main(SUPERVGraph_ViewFrame*, QAD_Desktop*, SUPERV_Graph);
31     virtual ~SUPERVGUI_Main();
32
33     void run();
34     void startExecute();
35     void kill();
36     void suspendResume();
37     void stopRestart();
38     bool exportDataflow(QString theFile);
39
40     bool putDataStudy(SUPERV_Port port, const char* inout);
41     void setData(SUPERVGUI_PortIn* p);
42
43     SUPERVGUI_Graph* getGraph();
44     SUPERVGUI_Array* getArray();
45     SUPERV_Graph getDataflow();
46     QAD_Message* getMessage();
47     QAD_Study* getStudy();
48     bool isArrayShown();
49     void showPopup(QPopupMenu* p, QMouseEvent* e);
50
51     void ActivatePanning();
52     void ResetView();
53
54     void setHashCode(QString theCode) 
55       { myHashCode = theCode; };
56
57     QString getHashCode() 
58       { return myHashCode; };
59
60     
61     bool isEditable() 
62       { if (SUPERV_isNull(dataflow)) return false;
63       return !dataflow->IsReadOnly(); };
64
65     bool isFromStudy() { return myIsFromStudy; }
66     void setAsFromStudy(bool theToStudy);
67     void checkIsInStudy();
68     
69     void addComputeNode(SUPERV_CNode theNode);
70     void addControlNode(SUPERV_CNode theStartNode, SUPERV_CNode theEndNode, bool Update);
71     void addGOTONode(SUPERV_CNode theNode);
72
73     void setPaletteBackgroundColor(const QColor& color);
74
75     void lockedGraph(bool theLock) { myIsLocked = theLock; }
76     bool isLocked() { return myIsLocked; }
77
78   public slots:
79     void execute();
80     void sync();
81     void syncAsync();
82     bool addStudy();
83     void insertFile();
84     void addNode();
85     void changeInformation();
86     void copy();
87     void showTable();
88     void showFullGraph();
89     void showContolFlow();
90     void filterNotification();
91  
92   private slots:
93     void chooseData(QListViewItem* item);
94
95   private:
96     void init(QAD_Desktop* parent);
97     void StartTimer(const char* m);
98     void StopTimer(const char* m);
99     void syncNotification();
100     bool isFiltered(char* graph, char* node, char* type, char* message, char* sender, long counter, char* date, long stamp);
101
102     SUPERV_Graph            dataflow;
103     QAD_Study*              study;
104     QAD_ObjectBrowser*      objectBrowser;
105     QAD_Message*            message;
106     SUPERVGUI_Graph*        graph;
107     QTimer*                 timer;
108
109     GraphViewType   myCurrentView;
110     SUPERVGUI_Array*   array;
111
112     bool               choosing;
113     SUPERVGUI_PortIn*  portIn;
114
115     QString            myHashCode;
116     
117     bool               myIsFromStudy;
118     int                myCopyNum;
119
120     SALOME_NamingService* myNService;
121     QDateTime             myRunTime; // mpv 23.12.2002: we need time of running of dataflow
122                                      // for right Study document modification
123     /* notification data */                            
124     NOTIFICATION_Consumer* notification;
125     bool                   myFiltered;
126     bool                   myLogged;
127     QString                myLogFileName;
128     FILE*                  myLogFile;
129     bool                   myWarning;
130     bool                   myStep;
131     bool                   myTrace;
132     bool                   myVerbose;
133     bool                   myIsKilled;
134     bool                   myIsLocked;
135 };
136
137 #endif