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();
61 void run( const bool andSuspend );
65 void openSubGraph(SUPERV_CNode theNode, bool correct = false);
67 bool putDataStudy(SUPERV_Port port, const char* inout);
69 SUPERVGUI_CanvasArray* getCanvasArray();
70 SUPERVGUI_ArrayView* getArrayView();
71 SUPERVGUI_Canvas* getCanvas();
72 SUPERVGUI_CanvasView* getCanvasView();
73 SUPERV_Graph getDataflow();
74 QAD_Message* getMessage();
75 QAD_Study* getStudy();
77 void showPopup(QPopupMenu* p, QMouseEvent* e);
79 void ActivatePanning();
82 void setHashCode(QString theCode)
83 { myHashCode = theCode; };
86 { return myHashCode; };
90 { if (SUPERV_isNull(dataflow)) return false;
91 return !dataflow->IsReadOnly(); };
93 bool isFromStudy() { return myIsFromStudy; }
94 void setAsFromStudy(bool theToStudy);
95 void checkIsInStudy();
97 void addComputeNode(SUPERV_CNode theNode);
98 void addControlNode(SUPERV_CNode theStartNode, SUPERV_CNode theEndNode, bool Update);
99 void addGOTONode(SUPERV_CNode theNode);
100 void addMacroNode(SUPERV_CNode theNode);
102 void setPaletteBackgroundColor(const QColor& color);
104 void lockedGraph(bool theLock) { myIsLocked = theLock; }
105 bool isLocked() { return myIsLocked; }
107 SUPERV::GraphState getNodeExecState();
108 void setNodeExecState(SUPERV::GraphState theNodeExecState);
110 QPtrList< char * > getEventNodes();
111 void setEventNodes(QPtrList< char * > theEventNodes);
112 bool removeFirstEN() { return myEventNodes.removeFirst(); }
113 void removeEventNodes() { myEventNodes.clear(); }
115 QPtrList< SUPERV::GraphState > getStates();
116 void setStates(QPtrList< SUPERV::GraphState > theStates);
117 bool removeFirstS() { return myStates.removeFirst(); }
118 void removeStates() { myStates.clear(); }
120 int getNodesNumber();
121 SUPERVGUI_Thread* getMyThread();
124 void executionFinished();
126 bool eventFilter( QObject* o, QEvent* e);
128 void Editing(); // any Editing operation is to be performed ->
129 // activate Editors data model in Engine
131 void removeArrayChild(SUPERV::CNode_ptr theNode);
133 GraphViewType getViewType() { return myCurrentView; }
136 void KillMyThread(bool theValue);
139 void execute(char * theNodeNode, SUPERV::GraphState theNodeState);
145 void changeInformation();
148 void showCanvasTable();
149 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;
177 GraphViewType myCurrentView;
178 SUPERVGUI_CanvasArray* myArray;
179 SUPERVGUI_ArrayView* myArrayView;
180 SUPERVGUI_Canvas* myCanvas;
181 SUPERVGUI_CanvasView* myCanvasView;
190 SALOME_NamingService* myNService;
191 QDateTime myRunTime; // mpv 23.12.2002: we need time of running of dataflow
192 // for correct Study document modification
193 /* notification data */
194 NOTIFICATION_Consumer* notification;
197 QString myLogFileName;
205 SUPERVGUI_Thread* myThread;
207 QPtrList< char * > myEventNodes ;
208 QPtrList< SUPERV::GraphState > myStates ;
211 bool myExecuted; // asv 02.02.05 : set to true on first dataflow execution
212 // is needed for correct publishing objects in Study
215 class SUPERVGUI_Thread : public QObject, public QThread {
221 void startThread(const char* m);
222 void setMain(SUPERVGUI_Main* theMain);
225 void KillThread(bool theValue);
232 SUPERVGUI_Main* myMain;
238 * A dialog for setting Graph execution parameters
240 class SUPERVGUI_DSGraphParameters: public QDialog {
244 SUPERVGUI_DSGraphParameters(SUPERV_Graph theGraph, bool isReadOnly);
245 virtual ~SUPERVGUI_DSGraphParameters();
254 QAD_SpinBoxDbl* myDeltaTime;
255 QLineEdit* myTimeOut;
256 QComboBox* myDataStreamTrace;
258 SUPERV_Graph myGraph;