1 // Copyright (C) 2007-2008 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
22 // SMESH SMESHGUI : GUI for SMESH component
24 // Author : Nicolas REJNERI, Open CASCADE S.A.S.
30 #include "SMESH_SMESHGUI.hxx"
32 // SALOME GUI includes
33 #include <SalomeApp_Module.h>
34 #include <VTKViewer_MarkerDef.h>
35 #include <SALOME_InteractiveObject.hxx>
38 #include <SALOMEconfig.h>
39 #include CORBA_SERVER_HEADER(SMESH_Gen)
45 class SUIT_ViewWindow;
46 class SUIT_ResourceMgr;
47 class SUIT_ViewManager;
49 class LightApp_Operation;
50 class SalomeApp_Study;
51 class LightApp_Selection;
52 class LightApp_SelectionMgr;
54 class SMESHGUI_FilterLibraryDlg;
56 typedef std::map<int, VTK::MarkerMap> SMESHGUI_StudyId2MarkerMap;
58 //=================================================================================
61 //=================================================================================
62 class SMESHGUI_EXPORT SMESHGUI : public SalomeApp_Module
70 static SMESH::SMESH_Gen_var GetSMESHGen();
71 static SMESHGUI* GetSMESHGUI();
72 static LightApp_SelectionMgr* selectionMgr();
73 static SUIT_ResourceMgr* resourceMgr();
74 static SUIT_Desktop* desktop();
75 static SalomeApp_Study* activeStudy();
77 bool isActiveStudyLocked();
79 static bool automaticUpdate();
81 virtual LightApp_Displayer* displayer();
82 virtual QString engineIOR() const;
83 virtual void initialize( CAM_Application* );
84 virtual void windows( QMap<int, int>& ) const;
85 virtual void viewManagers( QStringList& ) const;
87 QDialog* GetActiveDialogBox();
88 void SetActiveDialogBox( QDialog* );
92 bool DefineDlgPosition( QWidget*, int&, int& );
93 void switchToOperation( int );
95 virtual bool OnGUIEvent( int );
96 virtual bool OnMousePress( QMouseEvent*, SUIT_ViewWindow* );
97 virtual bool OnMouseMove( QMouseEvent*, SUIT_ViewWindow* );
98 virtual bool OnKeyPress( QKeyEvent*, SUIT_ViewWindow* );
100 virtual LightApp_Selection* createSelection() const;
102 virtual void BuildPresentation ( const Handle(SALOME_InteractiveObject)&,
103 SUIT_ViewWindow* = 0 );
105 /* Non modal dialog boxes management */
106 void EmitSignalDeactivateDialog();
107 void EmitSignalStudyFrameChanged();
108 void EmitSignalCloseAllDialogs();
109 void EmitSignalVisibilityChanged();
111 virtual void contextMenuPopup( const QString&, QMenu*, QString& );
112 virtual void createPreferences();
113 virtual void preferencesChanged( const QString&, const QString& );
115 virtual void update( const int );
117 static SALOMEDS::Color getUniqueColor( const QList<SALOMEDS::Color>& );
119 virtual void storeVisualParameters (int savePoint);
120 virtual void restoreVisualParameters(int savePoint);
123 virtual bool deactivateModule( SUIT_Study* );
124 virtual bool activateModule( SUIT_Study* );
125 virtual void studyClosed( SUIT_Study* );
129 void onViewManagerActivated( SUIT_ViewManager* );
130 void onOperationCommited( SUIT_Operation* );
131 void onOperationAborted( SUIT_Operation* );
132 void onHypothesisEdit( int result );
135 void SignalDeactivateActiveDialog();
136 void SignalStudyFrameChanged();
137 void SignalCloseAllDialogs();
138 void SignalVisibilityChanged();
141 void createSMESHAction( const int,
143 const QString& = QString(),
145 const bool = false );
146 void createPopupItem( const int,
149 const QString& = QString(),
152 virtual LightApp_Operation* createOperation( const int ) const;
154 virtual bool isSelectionCompatible();
156 virtual bool reusableOperation( const int id );
160 int addVtkFontPref( const QString& label,
162 const QString& param );
165 static SMESH::SMESH_Gen_var myComponentSMESH;
166 QDialog* myActiveDialogBox;
168 QMap<int, QString> myRules;
169 LightApp_Displayer* myDisplayer;
171 SMESHGUI_FilterLibraryDlg* myFilterLibraryDlg;
173 SMESHGUI_StudyId2MarkerMap myMarkerMap;