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 "SUPERVGraph_ViewFrame.h"
32 #include "QAD_Desktop.h"
33 #include "SUPERVGUI_Canvas.h"
34 #include "SUPERVGUI_CanvasView.h"
35 #include "SUPERVGUI_ArrayView.h"
38 #include <qapplication.h>
42 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*, SUPERV_Graph);
59 virtual ~SUPERVGUI_Main();
66 void openSubGraph(SUPERV_CNode theNode, bool correct = false);
68 bool putDataStudy(SUPERV_Port port, const char* inout);
70 SUPERVGUI_CanvasArray* getCanvasArray();
71 SUPERVGUI_ArrayView* getArrayView();
72 SUPERVGUI_Canvas* getCanvas();
73 SUPERVGUI_CanvasView* getCanvasView();
74 SUPERV_Graph getDataflow();
75 QAD_Message* getMessage();
76 QAD_Study* getStudy();
78 void showPopup(QPopupMenu* p, QMouseEvent* e);
80 void ActivatePanning();
83 void setHashCode(QString theCode)
84 { myHashCode = theCode; };
87 { return myHashCode; };
91 { if (SUPERV_isNull(dataflow)) return false;
92 return !dataflow->IsReadOnly(); };
94 bool isFromStudy() { return myIsFromStudy; }
95 void setAsFromStudy(bool theToStudy);
96 void checkIsInStudy();
98 void addComputeNode(SUPERV_CNode theNode);
99 void addControlNode(SUPERV_CNode theStartNode, SUPERV_CNode theEndNode, bool Update);
100 void addGOTONode(SUPERV_CNode theNode);
101 void addMacroNode(SUPERV_CNode theNode);
103 void setPaletteBackgroundColor(const QColor& color);
105 void lockedGraph(bool theLock) { myIsLocked = theLock; }
106 bool isLocked() { return myIsLocked; }
108 SUPERV::GraphState getNodeExecState();
109 void setNodeExecState(SUPERV::GraphState theNodeExecState);
111 QPtrList< char * > getEventNodes();
112 void setEventNodes(QPtrList< char * > theEventNodes);
113 bool removeFirstEN() { return myEventNodes.removeFirst(); }
114 void removeEventNodes() { myEventNodes.clear(); }
116 QPtrList< SUPERV::GraphState > getStates();
117 void setStates(QPtrList< SUPERV::GraphState > theStates);
118 bool removeFirstS() { return myStates.removeFirst(); }
119 void removeStates() { myStates.clear(); }
121 int getNodesNumber();
122 SUPERVGUI_Thread* getMyThread();
125 void executionFinished();
127 bool eventFilter( QObject* o, QEvent* e);
129 bool IsGUIEventLoopFinished() const { return myGUIEventLoopFinished; }
131 void Editing(); // any Editing operation is to be performed ->
132 // activate Editors data model in Engine
134 void removeArrayChild(SUPERV::CNode_ptr theNode);
137 void KillMyThread(bool theValue);
140 void execute(char * theNodeNode, SUPERV::GraphState theNodeState);
146 void changeInformation();
149 void showCanvasTable();
150 void showContolFlow();
153 void filterNotification();
154 void changeDSGraphParameters();
155 void onSubGraphClosed(QAD_StudyFrame* );
156 void onSubGraphActivated(QAD_StudyFrame* );
159 void chooseData(QListViewItem* item);
160 void checkExecution();
163 void init(QAD_Desktop* parent);
164 void syncNotification();
165 bool isFiltered(char* graph, char* node, char* type, char* message, char* sender, long counter, char* date, long stamp);
166 void closeEvent(QCloseEvent*);
168 SUPERV_Graph dataflow;
170 QMap<QString, QAD_StudyFrame*> mySubGraphs;
171 QMap<QString, QString> mySubGraphMap;
172 QAD_StudyFrame* myLastGraph;
175 QAD_ObjectBrowser* objectBrowser;
176 QAD_Message* message;
178 GraphViewType myCurrentView;
179 SUPERVGUI_CanvasArray* myArray;
180 SUPERVGUI_ArrayView* myArrayView;
181 SUPERVGUI_Canvas* myCanvas;
182 SUPERVGUI_CanvasView* myCanvasView;
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;
206 SUPERVGUI_Thread* myThread;
208 QPtrList< char * > myEventNodes ;
209 QPtrList< SUPERV::GraphState > myStates ;
212 // asv : 18.11.04 : fix for bug 6170 : this field is FALSE when SUPERVGUI_Thread
213 // is inside event loop during graph execution. dataflow->IsDone() returns true
214 // BEFORE all events are handled (a few of them are still being processed in GUI thread),
215 // and for bug 6170 it is neccessary to know exactly when GUI events processing stops..
216 bool myGUIEventLoopFinished;
219 class SUPERVGUI_Thread : public QObject, public QThread {
225 void startThread(const char* m);
226 void stopThread(const char* m);
227 void setMain(SUPERVGUI_Main* theMain);
230 void KillThread(bool theValue);
237 SUPERVGUI_Main* myMain;
243 * A dialog for setting Graph execution parameters
245 class SUPERVGUI_DSGraphParameters: public QDialog {
249 SUPERVGUI_DSGraphParameters(SUPERV_Graph theGraph, bool isReadOnly);
250 virtual ~SUPERVGUI_DSGraphParameters();
259 QAD_SpinBoxDbl* myDeltaTime;
260 QLineEdit* myTimeOut;
261 QComboBox* myDataStreamTrace;
263 SUPERV_Graph myGraph;