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
25 // Author : Francis KLOSS
31 // Acces a l`ihm de SALOME
32 // -----------------------
34 #include "SUPERVGUI_Def.h"
35 #include "SUPERVGUI_Service.h"
36 #include "SUPERVGUI_Main.h"
38 #include "SalomeApp_Module.h"
42 // Definition de la classe principale du module de supervision
43 // -----------------------------------------------------------
45 class SUPERVGUI: public SalomeApp_Module {
52 static SUPERVGUI* Supervision();
54 virtual void initialize( CAM_Application* );
55 virtual QString engineIOR() const;
56 SUPERV_Engine getEngine();
57 SUIT_Study* getActiveStudy() { return study; }
59 SUPERVGUI_Service* getBrowser();
61 //bool information(SUPERV_CNode node, bool isReadOnly);
62 void putInfo(const char* mess);
64 void importDataflow();
65 void exportDataflow();
67 void modifyDataflow();
68 void reloadDataflow();
72 void suspendResumeDataflow();
73 void showComponents();
75 SUPERVGUI_Main* getMain();
77 bool OnGUIEvent(int theCommandID);
79 //void DefinePopup(QString & theContext,
80 // QString & theParent,
81 // QString & theObject ) ;
82 //bool CustomPopup(QPopupMenu* popup,
83 // const QString & theContext,
84 // const QString & theParent,
85 // const QString & theObject);
86 bool ActiveStudyChanged();
87 //void SupportedViewType (int* buffer, int bufferSize);
89 bool isContains(SUIT_Study* theStudy, const QString theKey);
91 void registerGraph(QString theName, SUPERVGUI_Main* theGraph);
92 void unregisterGraph(SUPERVGUI_Main* theGraph);
93 SUIT_ViewWindow* createGraph();
96 theIsOwner = true if Selected object belongs to Suipervision.
97 theIsDataflow = true if Selected object is Dataflow
99 void whatIsSelected(const _PTR(SObject)& theObj, bool& theIsOwner, bool& theIsDataflow);
101 /* asv : bug [VSR Bugs and Improvements in Supervisor] 1.8 : when exporting a file,
102 a backup copy of an existing file must be created (in case Export fails..)
103 This method creates a backup file and returns its name or QString::null if it fails
104 Function is static because it is called from
105 SUPERVGUI::exportDataflow() and SUPERVGUI_CanvasMacroNode::exportDataflow()
107 static QString createBackupFile( const QString& theOriginalFileName );
109 virtual void windows( QMap<int, int>& ) const;
111 QMap<QString, QString> getInterfaceNameMap() const;
114 void KillMainThread(bool theValue);
117 void setMain(SUIT_ViewWindow* w);
118 void displayDataflow();
119 void renameDataflow();
121 void onGraphClosed( SUIT_ViewWindow* );
125 virtual bool activateModule( SUIT_Study* );
126 virtual bool deactivateModule( SUIT_Study* );
129 virtual CAM_DataModel* createDataModel();
130 virtual SalomeApp_Selection* createSelection() const;
133 void loadEngine(SALOME_NamingService* namingService);
135 // enumeration used in newDataflow() method
136 enum NEW_DF_MODE { Import, Modify, New };
137 // method called from importDataflow(), modifyDataflow(), newDataflow() with
138 // different modes. The behavior of the function is very similar in all 3 cases,
139 // but some differences still exist. These differences are implemented using NEW_DF_MODE param.
140 bool createDataflow( const NEW_DF_MODE f, bool theInitialDF = false );
142 void createSupervAction( const int id, const QString& po_id, const QString& icon_id = QString(""),
143 const int key = 0, const bool toggle = false );
145 void fillInterfaceNameMap();
149 SUPERV_Engine engine;
150 SUPERVGUI_Service* browser;
151 //SUPERVGUI_Information* info;
154 SUPERVGUI_Main* main; // active main
155 QPtrList<SUPERVGUI_Main> myGraphList;
156 QMap<QString, QString> myInterfaceNameMap;
158 bool myFirstActivation;
159 SUPERVGraph_ViewFrame* myInitialViewFrame;