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 "SUPERVGUI_Canvas.h"
33 #include "SUPERVGUI_CanvasView.h"
34 #include "SUPERVGUI_ArrayView.h"
37 #include <qapplication.h>
46 class NOTIFICATION_Consumer;
47 class SUPERVGUI_Thread;
49 class SUPERVGUI_Main: public SUPERVGraph_View {
52 // asv : 18.11.04 : making Thread class a friend in order to allow it to modify
53 // a private field myGUIEventLoopFinished
54 friend class SUPERVGUI_Thread;
57 SUPERVGUI_Main(SUPERVGraph_ViewFrame*, SUIT_Desktop*/*QAD_Desktop**/, SUPERV_Graph);
58 virtual ~SUPERVGUI_Main();
60 void run( const bool andSuspend );
64 void openSubGraph(SUPERV_CNode theNode, bool correct = false);
66 bool putDataStudy(SUPERV_Port port, const char* inout);
68 SUPERVGUI_CanvasArray* getCanvasArray();
69 SUPERVGUI_ArrayView* getArrayView();
70 SUPERVGUI_Canvas* getCanvas();
71 SUPERVGUI_CanvasView* getCanvasView();
72 SUPERV_Graph getDataflow();
73 LogWindow* getMessage();
74 SUIT_Study* getStudy();
76 void showPopup(QPopupMenu* p, QMouseEvent* e);
78 void ActivatePanning();
81 void setHashCode(QString theCode)
82 { myHashCode = theCode; };
85 { return myHashCode; };
87 bool isDataflowInStudy() const;
90 { if (SUPERV_isNull(dataflow)) return false;
91 return !dataflow->IsReadOnly(); };
93 void addComputeNode(SUPERV_CNode theNode);
94 void addControlNode(SUPERV_CNode theStartNode, SUPERV_CNode theEndNode, bool Update);
95 void addGOTONode(SUPERV_CNode theNode);
96 void addMacroNode(SUPERV_CNode theNode);
98 void setPaletteBackgroundColor(const QColor& color);
100 void lockedGraph(bool theLock) { myIsLocked = theLock; }
101 bool isLocked() { return myIsLocked; }
103 SUPERV::GraphState getNodeExecState();
104 void setNodeExecState(SUPERV::GraphState theNodeExecState);
106 QPtrList< char * > getEventNodes();
107 void setEventNodes(QPtrList< char * > theEventNodes);
108 bool removeFirstEN() { return myEventNodes.removeFirst(); }
109 void removeEventNodes() { myEventNodes.clear(); }
111 QPtrList< SUPERV::GraphState > getStates();
112 void setStates(QPtrList< SUPERV::GraphState > theStates);
113 bool removeFirstS() { return myStates.removeFirst(); }
114 void removeStates() { myStates.clear(); }
116 int getNodesNumber();
117 SUPERVGUI_Thread* getMyThread();
120 void executionFinished();
122 bool eventFilter( QObject* o, QEvent* e);
124 void Editing(); // any Editing operation is to be performed ->
125 // activate Editors data model in Engine
126 bool ReadyToModify(); // must be called before any modification
127 // operation - asks to kill execution of dataflow. If returns false -
128 // modification (==Editing() ) is not allowed.
130 void removeArrayChild(SUPERV::CNode_ptr theNode);
132 GraphViewType getViewType() { return myCurrentView; }
134 virtual void resizeView( QResizeEvent* theEvent );
137 void KillMyThread(bool theValue);
140 void execute(char * theNodeNode, SUPERV::GraphState theNodeState);
143 void addDataflowToStudy();
146 void changeInformation();
149 void showCanvasTable();
150 void showContolFlow();
153 void filterNotification();
154 void changeDSGraphParameters();
155 void onSubGraphClosed( SUIT_ViewWindow* );
156 void onSubGraphActivated( SUIT_ViewWindow* );
159 void chooseData(QListViewItem* item);
160 void checkExecution();
163 void init(SUIT_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, SUIT_ViewWindow*> mySubGraphs;
171 QMap<QString, QString> mySubGraphMap;
172 SUIT_ViewWindow* myLastGraph;
175 OB_Browser* objectBrowser;
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 correct 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 ;
213 class SUPERVGUI_Thread : public QObject, public QThread {
219 void startThread(const char* m);
220 void setMain(SUPERVGUI_Main* theMain);
223 void KillThread(bool theValue);
227 void main_thread_run(SUPERV_CNode& aNode, SUPERV::GraphEvent& aEvent, SUPERV::GraphState& aState);
231 SUPERVGUI_Main* myMain;
237 * A dialog for setting Graph execution parameters
239 class SUPERVGUI_DSGraphParameters: public QDialog {
243 SUPERVGUI_DSGraphParameters(SUPERV_Graph theGraph, bool isReadOnly);
244 virtual ~SUPERVGUI_DSGraphParameters();
253 QtxDblSpinBox* myDeltaTime;
254 QLineEdit* myTimeOut;
255 QComboBox* myDataStreamTrace;
257 SUPERV_Graph myGraph;