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 SUIT_ResourceMgr* resMgr() const;
62 void run( const bool andSuspend );
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 LogWindow* getMessage();
76 SUIT_Study* getStudy();
78 void showPopup(QPopupMenu* p, QMouseEvent* e);
80 void ActivatePanning();
83 void setHashCode(QString theCode)
84 { myHashCode = theCode; };
87 { return myHashCode; };
89 bool isDataflowInStudy() const;
92 { if (SUPERV_isNull(dataflow)) return false;
93 return !dataflow->IsReadOnly(); };
95 void addComputeNode(SUPERV_CNode theNode);
96 void addControlNode(SUPERV_CNode theStartNode, SUPERV_CNode theEndNode, bool Update);
97 void addGOTONode(SUPERV_CNode theNode);
98 void addMacroNode(SUPERV_CNode theNode);
100 void setPaletteBackgroundColor(const QColor& color);
102 void lockedGraph(bool theLock) { myIsLocked = theLock; }
103 bool isLocked() { return myIsLocked; }
105 SUPERV::GraphState getNodeExecState();
106 void setNodeExecState(SUPERV::GraphState theNodeExecState);
108 QPtrList< char * > getEventNodes();
109 void setEventNodes(QPtrList< char * > theEventNodes);
110 bool removeFirstEN() { return myEventNodes.removeFirst(); }
111 void removeEventNodes() { myEventNodes.clear(); }
113 QPtrList< SUPERV::GraphState > getStates();
114 void setStates(QPtrList< SUPERV::GraphState > theStates);
115 bool removeFirstS() { return myStates.removeFirst(); }
116 void removeStates() { myStates.clear(); }
118 int getNodesNumber();
119 SUPERVGUI_Thread* getMyThread();
122 void executionFinished();
124 bool eventFilter( QObject* o, QEvent* e);
126 void Editing(); // any Editing operation is to be performed ->
127 // activate Editors data model in Engine
128 bool ReadyToModify(); // must be called before any modification
129 // operation - asks to kill execution of dataflow. If returns false -
130 // modification (==Editing() ) is not allowed.
132 void removeArrayChild(SUPERV::CNode_ptr theNode);
134 GraphViewType getViewType() { return myCurrentView; }
136 virtual void resizeView( QResizeEvent* theEvent );
139 void KillMyThread(bool theValue);
140 void EventToSync(); // mkr : IPAL11362
143 void execute(char * theNodeNode, SUPERV::GraphState theNodeState);
146 void addDataflowToStudy();
149 void changeInformation();
152 void showCanvasTable();
153 void showContolFlow();
156 void filterNotification();
157 void changeDSGraphParameters();
158 void onSubGraphClosed( SUIT_ViewWindow* );
159 void onSubGraphActivated( SUIT_ViewWindow* );
161 void onShowToolbar();
163 void onObjectCreatedDeleted(); // mkr : PAL8237
166 void chooseData(QListViewItem* item);
167 void checkExecution();
170 void init(SUIT_Desktop* parent);
171 void syncNotification();
172 bool isFiltered(char* graph, char* node, char* type, char* message, char* sender, long counter, char* date, long stamp);
173 void closeEvent(QCloseEvent*);
175 SUPERV_Graph dataflow;
177 QMap<QString, SUIT_ViewWindow*> mySubGraphs;
178 QMap<QString, QString> mySubGraphMap;
179 SUIT_ViewWindow* myLastGraph;
182 OB_Browser* objectBrowser;
185 GraphViewType myCurrentView;
186 SUPERVGUI_CanvasArray* myArray;
187 SUPERVGUI_ArrayView* myArrayView;
188 SUPERVGUI_Canvas* myCanvas;
189 SUPERVGUI_CanvasView* myCanvasView;
198 SALOME_NamingService* myNService;
199 QDateTime myRunTime; // mpv 23.12.2002: we need time of running of dataflow
200 // for correct Study document modification
201 /* notification data */
202 NOTIFICATION_Consumer* notification;
205 QString myLogFileName;
213 SUPERVGUI_Thread* myThread;
215 QPtrList<char*> myEventNodes ;
216 QPtrList<SUPERV::GraphState> myStates ;
220 class SUPERVGUI_Thread : public QObject, public QThread {
226 void startThread(const char* m);
227 void setMain(SUPERVGUI_Main* theMain);
230 void KillThread(bool theValue);
234 void main_thread_run(SUPERV_CNode& aNode, SUPERV::GraphEvent& aEvent, SUPERV::GraphState& aState);
238 SUPERVGUI_Main* myMain;
244 * A dialog for setting Graph execution parameters
246 class SUPERVGUI_DSGraphParameters: public QDialog {
250 SUPERVGUI_DSGraphParameters(SUPERV_Graph theGraph, bool isReadOnly);
251 virtual ~SUPERVGUI_DSGraphParameters();
260 QtxDblSpinBox* myDeltaTime;
261 QLineEdit* myTimeOut;
262 QComboBox* myDataStreamTrace;
264 SUPERV_Graph myGraph;