1 // SUPERV SUPERVGUI : GUI for Supervisor component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SUPERVGUI_Main.h
25 // Author : Francis KLOSS
28 #ifndef SUPERVGUI_Main_H
29 #define SUPERVGUI_Main_H
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 #include "SUPERVGUI_Canvas.h"
38 #include "SUPERVGUI_CanvasView.h"
41 #include <qapplication.h>
45 class QAD_ObjectBrowser;
47 class NOTIFICATION_Consumer;
48 class SUPERVGUI_Thread;
50 class SUPERVGUI_Main: public SUPERVGraph_View {
53 // asv : 18.11.04 : making Thread class a friend in order to allow it to modify
54 // a private field myGUIEventLoopFinished
55 friend class SUPERVGUI_Thread;
58 //SUPERVGUI_Main(SUPERVGraph_ViewFrame*, QAD_Desktop*, bool fromIOR);
59 //SUPERVGUI_Main(SUPERVGraph_ViewFrame*, QAD_Desktop*, bool isModify, const char* filename);
60 SUPERVGUI_Main(SUPERVGraph_ViewFrame*, QAD_Desktop*, SUPERV_Graph);
61 virtual ~SUPERVGUI_Main();
68 bool exportDataflow(QString theFile);
69 void openSubGraph(SUPERV_CNode theNode, bool correct = false);
71 bool putDataStudy(SUPERV_Port port, const char* inout);
72 void setData(SUPERVGUI_PortIn* p);
74 SUPERVGUI_Graph* getGraph();
75 SUPERVGUI_Array* getArray();
76 SUPERVGUI_Canvas* getCanvas();
77 SUPERVGUI_CanvasView* getCanvasView();
78 SUPERV_Graph getDataflow();
79 QAD_Message* getMessage();
80 QAD_Study* getStudy();
82 void showPopup(QPopupMenu* p, QMouseEvent* e);
84 void ActivatePanning();
87 void setHashCode(QString theCode)
88 { myHashCode = theCode; };
91 { return myHashCode; };
95 { if (SUPERV_isNull(dataflow)) return false;
96 return !dataflow->IsReadOnly(); };
98 bool isFromStudy() { return myIsFromStudy; }
99 void setAsFromStudy(bool theToStudy);
100 void checkIsInStudy();
102 void addComputeNode(SUPERV_CNode theNode);
103 void addControlNode(SUPERV_CNode theStartNode, SUPERV_CNode theEndNode, bool Update);
104 void addGOTONode(SUPERV_CNode theNode);
105 void addMacroNode(SUPERV_CNode theNode);
107 void setPaletteBackgroundColor(const QColor& color);
109 void lockedGraph(bool theLock) { myIsLocked = theLock; }
110 bool isLocked() { return myIsLocked; }
111 bool isKilled() { return myIsKilled; }
113 SUPERV::GraphState getNodeExecState();
114 void setNodeExecState(SUPERV::GraphState theNodeExecState);
116 QPtrList< char * > getEventNodes();
117 void setEventNodes(QPtrList< char * > theEventNodes);
118 bool removeFirstEN() { return myEventNodes.removeFirst(); }
119 void removeEventNodes() { myEventNodes.clear(); }
121 QPtrList< SUPERV::GraphState > getStates();
122 void setStates(QPtrList< SUPERV::GraphState > theStates);
123 bool removeFirstS() { return myStates.removeFirst(); }
124 void removeStates() { myStates.clear(); }
126 int getNodesNumber();
127 SUPERVGUI_Thread* getMyThread();
130 void executionFinished();
132 bool eventFilter( QObject* o, QEvent* e);
134 bool IsGUIEventLoopFinished() const { return myGUIEventLoopFinished; }
137 void KillMyThread(bool theValue);
140 void execute(char * theNodeNode, SUPERV::GraphState theNodeState);
146 void changeInformation();
149 void showFullGraph();
150 void showContolFlow();
152 void filterNotification();
153 void changeDSGraphParameters();
154 void onSubGraphClosed(QAD_StudyFrame* );
155 void onSubGraphActivated(QAD_StudyFrame* );
158 void chooseData(QListViewItem* item);
159 void checkExecution();
162 void init(QAD_Desktop* parent);
163 void syncNotification();
164 bool isFiltered(char* graph, char* node, char* type, char* message, char* sender, long counter, char* date, long stamp);
165 void closeEvent(QCloseEvent*);
167 SUPERV_Graph dataflow;
169 QMap<QString, QAD_StudyFrame*> mySubGraphs;
170 QMap<QString, QString> mySubGraphMap;
171 QAD_StudyFrame* myLastGraph;
174 QAD_ObjectBrowser* objectBrowser;
175 QAD_Message* message;
176 SUPERVGUI_Graph* graph;
178 GraphViewType myCurrentView;
179 SUPERVGUI_Array* array;
180 SUPERVGUI_Canvas* myCanvas;
181 SUPERVGUI_CanvasView* myCanvasView;
184 SUPERVGUI_PortIn* portIn;
191 SALOME_NamingService* myNService;
192 QDateTime myRunTime; // mpv 23.12.2002: we need time of running of dataflow
193 // for right Study document modification
194 /* notification data */
195 NOTIFICATION_Consumer* notification;
198 QString myLogFileName;
207 SUPERVGUI_Thread* myThread;
209 QPtrList< char * > myEventNodes ;
210 QPtrList< SUPERV::GraphState > myStates ;
213 // asv : 18.11.04 : fix for bug 6170 : this field is FALSE when SUPERVGUI_Thread
214 // is inside event loop during graph execution. dataflow->IsDone() returns true
215 // BEFORE all events are handled (a few of them are still being processed in GUI thread),
216 // and for bug 6170 it is neccessary to know exactly when GUI events processing stops..
217 bool myGUIEventLoopFinished;
220 class SUPERVGUI_Thread : public QObject, public QThread {
226 void startThread(const char* m);
227 void stopThread(const char* m);
228 void setMain(SUPERVGUI_Main* theMain);
231 void KillThread(bool theValue);
238 SUPERVGUI_Main* myMain;
243 //**************************************************************
244 class SUPERVGUI_DSGraphParameters: public QDialog {
248 SUPERVGUI_DSGraphParameters(SUPERV_Graph theGraph, bool isReadOnly);
249 virtual ~SUPERVGUI_DSGraphParameters();
258 QAD_SpinBoxDbl* myDeltaTime;
259 QLineEdit* myTimeOut;
260 QComboBox* myDataStreamTrace;
262 SUPERV_Graph myGraph;