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 "SUPERVGUI.h"
32 #include "SUPERVGraph_ViewFrame.h"
33 #include "SUPERVGUI_Array.h"
34 #include "SUPERVGUI_Graph.h"
35 #include "QAD_Desktop.h"
36 #include "SUPERVGUI_Port.h"
39 #include <qapplication.h>
43 class QAD_ObjectBrowser;
45 class NOTIFICATION_Consumer;
46 class SUPERVGUI_Thread;
48 class SUPERVGUI_Main: public SUPERVGraph_View {
52 SUPERVGUI_Main(SUPERVGraph_ViewFrame*, QAD_Desktop*, bool fromIOR);
53 SUPERVGUI_Main(SUPERVGraph_ViewFrame*, QAD_Desktop*, bool isModify, const char* filename);
54 SUPERVGUI_Main(SUPERVGraph_ViewFrame*, QAD_Desktop*, SUPERV_Graph);
55 virtual ~SUPERVGUI_Main();
62 bool exportDataflow(QString theFile);
64 bool putDataStudy(SUPERV_Port port, const char* inout);
65 void setData(SUPERVGUI_PortIn* p);
67 SUPERVGUI_Graph* getGraph();
68 SUPERVGUI_Array* getArray();
69 SUPERV_Graph getDataflow();
70 QAD_Message* getMessage();
71 QAD_Study* getStudy();
73 void showPopup(QPopupMenu* p, QMouseEvent* e);
75 void ActivatePanning();
78 void setHashCode(QString theCode)
79 { myHashCode = theCode; };
82 { return myHashCode; };
86 { if (SUPERV_isNull(dataflow)) return false;
87 return !dataflow->IsReadOnly(); };
89 bool isFromStudy() { return myIsFromStudy; }
90 void setAsFromStudy(bool theToStudy);
91 void checkIsInStudy();
93 void addComputeNode(SUPERV_CNode theNode);
94 void addControlNode(SUPERV_CNode theStartNode, SUPERV_CNode theEndNode, bool Update);
95 void addGOTONode(SUPERV_CNode theNode);
97 void setPaletteBackgroundColor(const QColor& color);
99 void lockedGraph(bool theLock) { myIsLocked = theLock; }
100 bool isLocked() { return myIsLocked; }
102 SUPERV::GraphState getNodeExecState();
103 void setNodeExecState(SUPERV::GraphState theNodeExecState);
105 QPtrList< char * > getEventNodes();
106 void setEventNodes(QPtrList< char * > theEventNodes);
107 bool removeFirstEN() { return myEventNodes.removeFirst(); }
108 void removeEventNodes() { myEventNodes.clear(); }
110 QPtrList< SUPERV::GraphState > getStates();
111 void setStates(QPtrList< SUPERV::GraphState > theStates);
112 bool removeFirstS() { return myStates.removeFirst(); }
113 void removeStates() { myStates.clear(); }
115 int getNodesNumber();
116 SUPERVGUI_Thread* getMyThread();
119 void executionFinished();
122 void execute(char * theNodeNode, SUPERV::GraphState theNodeState);
128 void changeInformation();
131 void showFullGraph();
132 void showContolFlow();
133 void filterNotification();
136 void chooseData(QListViewItem* item);
137 void checkExecution();
140 void init(QAD_Desktop* parent);
141 void syncNotification();
142 bool isFiltered(char* graph, char* node, char* type, char* message, char* sender, long counter, char* date, long stamp);
144 SUPERV_Graph dataflow;
146 QAD_ObjectBrowser* objectBrowser;
147 QAD_Message* message;
148 SUPERVGUI_Graph* graph;
150 GraphViewType myCurrentView;
151 SUPERVGUI_Array* array;
154 SUPERVGUI_PortIn* portIn;
161 SALOME_NamingService* myNService;
162 QDateTime myRunTime; // mpv 23.12.2002: we need time of running of dataflow
163 // for right Study document modification
164 /* notification data */
165 NOTIFICATION_Consumer* notification;
168 QString myLogFileName;
177 SUPERVGUI_Thread* myThread;
179 QPtrList< char * > myEventNodes ;
180 QPtrList< SUPERV::GraphState > myStates ;
184 class SUPERVGUI_Thread : public QObject, public QThread {
190 void startThread(const char* m);
191 void stopThread(const char* m);
192 void setMain(SUPERVGUI_Main* theMain);
199 SUPERVGUI_Main* myMain;