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.salome-platform.org/ or email : webmaster.salome@opencascade.com
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; }
143 // srn: marks an active study as being modified by the Supervisor
144 // Note: to set the modified flag the method requires that Supervision
145 // component was previously added to study.
146 static void setModifiedFlag();
149 void KillMyThread(bool theValue);
150 void EventToSync(); // mkr : IPAL11362
153 void execute(char * theNodeNode, SUPERV::GraphState theNodeState);
156 void addDataflowToStudy();
159 void changeInformation();
162 void showCanvasTable();
163 void showContolFlow();
166 void filterNotification();
167 void changeDSGraphParameters();
168 void onSubGraphClosed( SUIT_ViewWindow* );
169 void onSubGraphActivated( SUIT_ViewWindow* );
171 void onShowToolbar();
173 void onObjectCreatedDeleted(); // mkr : PAL8237
174 void onPutInStudy( QString* ); // mkr : PAL8150
177 void chooseData(QListViewItem* item);
178 void checkExecution();
181 void init(SUIT_Desktop* parent);
182 void syncNotification();
183 bool isFiltered(char* graph, char* node, char* type, char* message, char* sender, long counter, char* date, long stamp);
184 void closeEvent(QCloseEvent*);
185 void syncPutInStudy(); // mkr : PAL8150
187 SUPERV_Graph dataflow;
189 QMap<QString, SUIT_ViewWindow*> mySubGraphs;
190 QMap<QString, QString> mySubGraphMap;
191 SUIT_ViewWindow* myLastGraph;
194 OB_Browser* objectBrowser;
197 GraphViewType myCurrentView;
198 SUPERVGUI_CanvasArray* myArray;
199 SUPERVGUI_ArrayView* myArrayView;
200 SUPERVGUI_Canvas* myCanvas;
201 SUPERVGUI_CanvasView* myCanvasView;
210 SALOME_NamingService* myNService;
211 QDateTime myRunTime; // mpv 23.12.2002: we need time of running of dataflow
212 // for correct Study document modification
213 /* notification data */
214 NOTIFICATION_Consumer* notification;
217 QString myLogFileName;
225 SUPERVGUI_Thread* myThread;
227 QPtrList<char*> myEventNodes ;
228 QPtrList<SUPERV::GraphState> myStates ;
232 class SUPERVGUI_Thread : public QObject, public QThread {
238 void startThread(const char* m);
239 void setMain(SUPERVGUI_Main* theMain);
242 void KillThread(bool theValue);
246 void main_thread_run(SUPERV_CNode& aNode, SUPERV::GraphEvent& aEvent, SUPERV::GraphState& aState);
250 SUPERVGUI_Main* myMain;
256 * A dialog for setting Graph execution parameters
258 class SUPERVGUI_DSGraphParameters: public QDialog {
262 SUPERVGUI_DSGraphParameters(SUPERV_Graph theGraph, bool isReadOnly);
263 virtual ~SUPERVGUI_DSGraphParameters();
272 QtxDblSpinBox* myDeltaTime;
273 QLineEdit* myTimeOut;
274 QComboBox* myDataStreamTrace;
276 SUPERV_Graph myGraph;