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);
67 void destroySubGraph(QString theSubGraphName); // mkr : IPAL11549
69 bool putDataStudy(SUPERV_Port port, const char* inout);
71 SUPERVGUI_CanvasArray* getCanvasArray();
72 SUPERVGUI_ArrayView* getArrayView();
73 SUPERVGUI_Canvas* getCanvas();
74 SUPERVGUI_CanvasView* getCanvasView();
75 SUPERV_Graph getDataflow();
76 LogWindow* getMessage();
77 SUIT_Study* getStudy();
79 void showPopup(QPopupMenu* p, QMouseEvent* e);
81 void ActivatePanning();
84 void setHashCode(QString theCode)
85 { myHashCode = theCode; };
88 { return myHashCode; };
90 bool isDataflowInStudy() const;
93 { if (SUPERV_isNull(dataflow)) return false;
94 return !dataflow->IsReadOnly(); };
96 void addComputeNode(SUPERV_CNode theNode);
97 void addControlNode(SUPERV_CNode theStartNode, SUPERV_CNode theEndNode, bool Update);
98 void addGOTONode(SUPERV_CNode theNode);
99 void addMacroNode(SUPERV_CNode theNode);
101 void setPaletteBackgroundColor(const QColor& color);
103 void lockedGraph(bool theLock) { myIsLocked = theLock; }
104 bool isLocked() { return myIsLocked; }
106 SUPERV::GraphState getNodeExecState();
107 void setNodeExecState(SUPERV::GraphState theNodeExecState);
109 QPtrList< char * > getEventNodes();
110 void setEventNodes(QPtrList< char * > theEventNodes);
111 bool removeFirstEN() { return myEventNodes.removeFirst(); }
112 void removeEventNodes() { myEventNodes.clear(); }
114 QPtrList< SUPERV::GraphState > getStates();
115 void setStates(QPtrList< SUPERV::GraphState > theStates);
116 bool removeFirstS() { return myStates.removeFirst(); }
117 void removeStates() { myStates.clear(); }
119 int getNodesNumber();
120 SUPERVGUI_Thread* getMyThread();
123 void executionFinished();
125 bool eventFilter( QObject* o, QEvent* e);
127 void Editing(); // any Editing operation is to be performed ->
128 // activate Editors data model in Engine
129 bool ReadyToModify(); // must be called before any modification
130 // operation - asks to kill execution of dataflow. If returns false -
131 // modification (==Editing() ) is not allowed.
133 void removeArrayChild(SUPERV::CNode_ptr theNode);
135 GraphViewType getViewType() { return myCurrentView; }
137 virtual void resizeView( QResizeEvent* theEvent );
140 void setRunTime( QDateTime theRunTime ) { myRunTime = theRunTime; }
141 QDateTime getRunTime() const { return myRunTime; }
144 void KillMyThread(bool theValue);
145 void EventToSync(); // mkr : IPAL11362
148 void execute(char * theNodeNode, SUPERV::GraphState theNodeState);
151 void addDataflowToStudy();
154 void changeInformation();
157 void showCanvasTable();
158 void showContolFlow();
161 void filterNotification();
162 void changeDSGraphParameters();
163 void onSubGraphClosed( SUIT_ViewWindow* );
164 void onSubGraphActivated( SUIT_ViewWindow* );
166 void onShowToolbar();
168 void onObjectCreatedDeleted(); // mkr : PAL8237
169 void onPutInStudy( QString* ); // mkr : PAL8150
172 void chooseData(QListViewItem* item);
173 void checkExecution();
176 void init(SUIT_Desktop* parent);
177 void syncNotification();
178 bool isFiltered(char* graph, char* node, char* type, char* message, char* sender, long counter, char* date, long stamp);
179 void closeEvent(QCloseEvent*);
180 void syncPutInStudy(); // mkr : PAL8150
182 SUPERV_Graph dataflow;
184 QMap<QString, SUIT_ViewWindow*> mySubGraphs;
185 QMap<QString, QString> mySubGraphMap;
186 SUIT_ViewWindow* myLastGraph;
189 OB_Browser* objectBrowser;
192 GraphViewType myCurrentView;
193 SUPERVGUI_CanvasArray* myArray;
194 SUPERVGUI_ArrayView* myArrayView;
195 SUPERVGUI_Canvas* myCanvas;
196 SUPERVGUI_CanvasView* myCanvasView;
205 SALOME_NamingService* myNService;
206 QDateTime myRunTime; // mpv 23.12.2002: we need time of running of dataflow
207 // for correct Study document modification
208 /* notification data */
209 NOTIFICATION_Consumer* notification;
212 QString myLogFileName;
220 SUPERVGUI_Thread* myThread;
222 QPtrList<char*> myEventNodes ;
223 QPtrList<SUPERV::GraphState> myStates ;
227 class SUPERVGUI_Thread : public QObject, public QThread {
233 void startThread(const char* m);
234 void setMain(SUPERVGUI_Main* theMain);
237 void KillThread(bool theValue);
241 void main_thread_run(SUPERV_CNode& aNode, SUPERV::GraphEvent& aEvent, SUPERV::GraphState& aState);
245 SUPERVGUI_Main* myMain;
251 * A dialog for setting Graph execution parameters
253 class SUPERVGUI_DSGraphParameters: public QDialog {
257 SUPERVGUI_DSGraphParameters(SUPERV_Graph theGraph, bool isReadOnly);
258 virtual ~SUPERVGUI_DSGraphParameters();
267 QtxDblSpinBox* myDeltaTime;
268 QLineEdit* myTimeOut;
269 QComboBox* myDataStreamTrace;
271 SUPERV_Graph myGraph;