1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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
23 // SMESH SMESHGUI : GUI for SMESH component
25 // Author : Nicolas REJNERI, Open CASCADE S.A.S.
31 #include "SMESH_SMESHGUI.hxx"
33 // SALOME GUI includes
34 #include <SalomeApp_Module.h>
35 #include <VTKViewer_MarkerDef.h>
36 #include <SALOME_InteractiveObject.hxx>
39 #include <SALOMEconfig.h>
40 #include CORBA_SERVER_HEADER(SMESH_Gen)
46 class SUIT_ViewWindow;
47 class SUIT_ResourceMgr;
48 class SUIT_ViewManager;
50 class LightApp_Operation;
51 class SalomeApp_Study;
52 class LightApp_Selection;
53 class LightApp_SelectionMgr;
55 class SMESHGUI_FilterLibraryDlg;
57 typedef std::map<int, VTK::MarkerMap> SMESHGUI_StudyId2MarkerMap;
59 //=================================================================================
62 //=================================================================================
63 class SMESHGUI_EXPORT SMESHGUI : public SalomeApp_Module
71 static SMESH::SMESH_Gen_var GetSMESHGen();
72 static SMESHGUI* GetSMESHGUI();
73 static LightApp_SelectionMgr* selectionMgr();
74 static SUIT_ResourceMgr* resourceMgr();
75 static SUIT_Desktop* desktop();
76 static SalomeApp_Study* activeStudy();
78 bool isActiveStudyLocked();
80 static bool automaticUpdate();
82 virtual LightApp_Displayer* displayer();
83 virtual QString engineIOR() const;
84 virtual void initialize( CAM_Application* );
85 virtual void windows( QMap<int, int>& ) const;
86 virtual void viewManagers( QStringList& ) const;
88 QDialog* GetActiveDialogBox();
89 void SetActiveDialogBox( QDialog* );
93 bool DefineDlgPosition( QWidget*, int&, int& );
94 void switchToOperation( int );
96 virtual bool OnGUIEvent( int );
97 virtual bool OnMousePress( QMouseEvent*, SUIT_ViewWindow* );
98 virtual bool OnMouseMove( QMouseEvent*, SUIT_ViewWindow* );
99 virtual bool OnKeyPress( QKeyEvent*, SUIT_ViewWindow* );
101 virtual LightApp_Selection* createSelection() const;
103 virtual void BuildPresentation ( const Handle(SALOME_InteractiveObject)&,
104 SUIT_ViewWindow* = 0 );
106 /* Non modal dialog boxes management */
107 void EmitSignalDeactivateDialog();
108 void EmitSignalStudyFrameChanged();
109 void EmitSignalCloseAllDialogs();
110 void EmitSignalVisibilityChanged();
112 virtual void contextMenuPopup( const QString&, QMenu*, QString& );
113 virtual void createPreferences();
114 virtual void preferencesChanged( const QString&, const QString& );
116 virtual void update( const int );
118 static SALOMEDS::Color getUniqueColor( const QList<SALOMEDS::Color>& );
120 virtual void storeVisualParameters (int savePoint);
121 virtual void restoreVisualParameters(int savePoint);
124 virtual bool deactivateModule( SUIT_Study* );
125 virtual bool activateModule( SUIT_Study* );
126 virtual void studyClosed( SUIT_Study* );
130 void onViewManagerActivated( SUIT_ViewManager* );
131 void onOperationCommited( SUIT_Operation* );
132 void onOperationAborted( SUIT_Operation* );
133 void onHypothesisEdit( int result );
136 void SignalDeactivateActiveDialog();
137 void SignalStudyFrameChanged();
138 void SignalCloseAllDialogs();
139 void SignalVisibilityChanged();
142 void createSMESHAction( const int,
144 const QString& = QString(),
146 const bool = false );
147 void createPopupItem( const int,
150 const QString& = QString(),
153 virtual LightApp_Operation* createOperation( const int ) const;
155 virtual bool isSelectionCompatible();
157 virtual bool reusableOperation( const int id );
161 int addVtkFontPref( const QString& label,
163 const QString& param );
166 static SMESH::SMESH_Gen_var myComponentSMESH;
167 QDialog* myActiveDialogBox;
169 QMap<int, QString> myRules;
170 LightApp_Displayer* myDisplayer;
172 SMESHGUI_FilterLibraryDlg* myFilterLibraryDlg;
174 SMESHGUI_StudyId2MarkerMap myMarkerMap;