Salome HOME
300b1c23414a8d8df0f74f202bc78b78a2dc88b7
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_Main.h
1 //  SUPERV SUPERVGUI : GUI for Supervisor component
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SUPERVGUI_Main.h
25 //  Author : Francis KLOSS
26 //  Module : SUPERV
27
28 #ifndef SUPERVGUI_Main_H
29 #define SUPERVGUI_Main_H
30
31 //#include "SUPERVGUI.h"
32 #include "SUPERVGraph_ViewFrame.h"
33 #include "SUPERVGUI_Array.h"
34 #include "SUPERVGUI_Graph.h"
35 #include "QAD_Desktop.h"
36 #include "SUPERVGUI_Port.h"
37
38 class QAD_Study;
39 class QAD_ObjectBrowser;
40 class QAD_Message;
41 class NOTIFICATION_Consumer;
42
43
44 class SUPERVGUI_Main: public SUPERVGraph_View {
45   Q_OBJECT
46
47   public:
48     SUPERVGUI_Main(SUPERVGraph_ViewFrame*, QAD_Desktop*, bool fromIOR);
49     SUPERVGUI_Main(SUPERVGraph_ViewFrame*, QAD_Desktop*, bool isModify, const char* filename);
50     SUPERVGUI_Main(SUPERVGraph_ViewFrame*, QAD_Desktop*, SUPERV_Graph);
51     virtual ~SUPERVGUI_Main();
52
53     void run();
54     void startExecute();
55     void kill();
56     void suspendResume();
57     void stopRestart();
58     bool exportDataflow(QString theFile);
59
60     bool putDataStudy(SUPERV_Port port, const char* inout);
61     void setData(SUPERVGUI_PortIn* p);
62
63     SUPERVGUI_Graph* getGraph();
64     SUPERVGUI_Array* getArray();
65     SUPERV_Graph getDataflow();
66     QAD_Message* getMessage();
67     QAD_Study* getStudy();
68     bool isArrayShown();
69     void showPopup(QPopupMenu* p, QMouseEvent* e);
70
71     void ActivatePanning();
72     void ResetView();
73
74     void setHashCode(QString theCode) 
75       { myHashCode = theCode; };
76
77     QString getHashCode() 
78       { return myHashCode; };
79
80     
81     bool isEditable() 
82       { if (SUPERV_isNull(dataflow)) return false;
83       return !dataflow->IsReadOnly(); };
84
85     bool isFromStudy() { return myIsFromStudy; }
86     void setAsFromStudy(bool theToStudy);
87     void checkIsInStudy();
88     
89     void addComputeNode(SUPERV_CNode theNode);
90     void addControlNode(SUPERV_CNode theStartNode, SUPERV_CNode theEndNode, bool Update);
91     void addGOTONode(SUPERV_CNode theNode);
92
93     void setPaletteBackgroundColor(const QColor& color);
94
95     void lockedGraph(bool theLock) { myIsLocked = theLock; }
96     bool isLocked() { return myIsLocked; }
97
98   public slots:
99     void execute();
100     void sync();
101     void syncAsync();
102     bool addStudy();
103     void insertFile();
104     void addNode();
105     void changeInformation();
106     void copy();
107     void showTable();
108     void showFullGraph();
109     void showContolFlow();
110     void filterNotification();
111  
112   private slots:
113     void chooseData(QListViewItem* item);
114
115   private:
116     void init(QAD_Desktop* parent);
117     void StartTimer(const char* m);
118     void StopTimer(const char* m);
119     void syncNotification();
120     bool isFiltered(char* graph, char* node, char* type, char* message, char* sender, long counter, char* date, long stamp);
121
122     SUPERV_Graph            dataflow;
123     QAD_Study*              study;
124     QAD_ObjectBrowser*      objectBrowser;
125     QAD_Message*            message;
126     SUPERVGUI_Graph*        graph;
127     QTimer*                 timer;
128
129     GraphViewType   myCurrentView;
130     SUPERVGUI_Array*   array;
131
132     bool               choosing;
133     SUPERVGUI_PortIn*  portIn;
134
135     QString            myHashCode;
136     
137     bool               myIsFromStudy;
138     int                myCopyNum;
139
140     SALOME_NamingService* myNService;
141     QDateTime             myRunTime; // mpv 23.12.2002: we need time of running of dataflow
142                                      // for right Study document modification
143     /* notification data */                            
144     NOTIFICATION_Consumer* notification;
145     bool                   myFiltered;
146     bool                   myLogged;
147     QString                myLogFileName;
148     FILE*                  myLogFile;
149     bool                   myWarning;
150     bool                   myStep;
151     bool                   myTrace;
152     bool                   myVerbose;
153     bool                   myIsKilled;
154     bool                   myIsLocked;
155 };
156
157 #endif