Salome HOME
Les préférences.
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_AdaptDlg.h
1 // Copyright (C) 2011-2020  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // SMESH SMESHGUI : GUI for the adaptation in the SMESH component
21 // File   : SMESHGUI_AdaptDlg.h
22 // Author : Gérald NICOLAS, EDF
23 //
24 #ifndef SMESHGUI_ADAPTDLG_H
25 #define SMESHGUI_ADAPTDLG_H
26
27 // SMESH includes
28 #include "SMESH_SMESHGUI.hxx"
29
30 // Qt includes
31 #include <QDialog>
32 #include <QList>
33 #include <QMap>
34
35 // IDL includes
36 #include <SALOMEconfig.h>
37 #include CORBA_SERVER_HEADER(SMESH_Mesh)
38 #include CORBA_SERVER_HEADER(SMESH_Group)
39 #include CORBA_SERVER_HEADER(SMESH_Filter)
40
41 class QGroupBox;
42 class QLabel;
43 class QLineEdit;
44 class QButtonGroup;
45 class QListWidget;
46 class QMenu;
47 class QPushButton;
48 class QToolButton;
49 class QCheckBox;
50 class QStackedWidget;
51 class QAction;
52 class SMESHGUI;
53 class SMESH_Actor;
54 class SMESHGUI_FilterDlg;
55 class SMESHGUI_ShapeByMeshOp;
56 class QtxColorButton;
57 class SUIT_Operation;
58 class SVTK_Selector;
59 class SUIT_SelectionFilter;
60 class LightApp_SelectionMgr;
61 class SMESH_LogicalFilter;
62
63 //=================================================================================
64 // class    : SMESHGUI_AdaptDlg
65 // purpose  :
66 //=================================================================================
67 class SMESHGUI_EXPORT SMESHGUI_AdaptDlg : public QDialog
68 {
69   Q_OBJECT
70
71 public:
72   SMESHGUI_AdaptDlg( SMESHGUI*,
73                      int theCommandID,
74                      SMESH::SMESH_Mesh_ptr = SMESH::SMESH_Mesh::_nil() );
75   ~SMESHGUI_AdaptDlg();
76
77   virtual bool action (int theCommandID);
78   virtual bool OnGUIEvent (int theCommandID);
79
80   static QString                GetDefaultName( const QString& );
81
82 //   static ADAPT::ADAPT_Gen_var InitAdaptGen(SalomeApp_Application*); 
83
84 public slots:
85   void onAdd();
86   void onRemove();
87
88 protected slots:
89   virtual void                  reject();
90
91 private slots:
92   void                          onTypeChanged( int );
93   void                          onGrpTypeChanged( int );
94   void                          onColorChanged( QColor );
95
96   void                          onOK();
97   bool                          onApply();
98   void                          onHelp();
99   void                          onDeactivate();
100   void                          onVisibilityChanged();
101
102   void                          onListSelectionChanged();
103   void                          onObjectSelectionChanged();
104
105   void                          onSelectAll();
106   void                          onSelectSubMesh( bool );
107   void                          onSelectGroup( bool );
108   void                          onSelectGeomGroup( bool );
109   void                          setCurrentSelection();
110
111   void                          setFilters();
112   void                          onSort();
113
114   void                          onNameChanged( const QString& );
115   void                          onFilterAccepted();
116
117   void                          onGeomPopup( QAction* );
118   void                          onGeomSelectionButton( bool );
119
120   void                          onPublishShapeByMeshDlg( SUIT_Operation* );
121   void                          onCloseShapeByMeshDlg( SUIT_Operation* );
122
123   void                          onOpenView();
124   void                          onCloseView();
125
126 private:
127   void                          initDialog( bool );
128   void                          init( SMESH::SMESH_Mesh_ptr );
129   void                          init( SMESH::SMESH_GroupBase_ptr );
130   void                          enterEvent( QEvent* );
131   void                          keyPressEvent( QKeyEvent* );
132   void                          setSelectionMode( int );
133   void                          updateButtons();
134   void                          updateGeomPopup();
135   bool                          SetAppropriateActor();
136   void                          setShowEntityMode();
137   void                          restoreShowEntityMode();
138
139   bool                          IsActorVisible( SMESH_Actor* );
140
141   void                          setGroupColor( const SALOMEDS::Color& );
142   SALOMEDS::Color               getGroupColor() const;
143
144   void                          setGroupQColor( const QColor& );
145   QColor                        getGroupQColor() const;
146   void                          setDefaultName() const;
147   void                          setDefaultGroupColor();
148
149   void                          setIsApplyAndClose( const bool theFlag );
150   bool                          isApplyAndClose() const;
151
152  private:
153
154   void recupPreferences();
155   SMESHGUI*                     mySMESHGUI;              /* Current SMESHGUI object */
156   LightApp_SelectionMgr*        mySelectionMgr;          /* User shape selection */
157   int                           myGrpTypeId;             /* Current group type id : standalone or group on geometry */
158   int                           myTypeId;                /* Current type id = radio button id */
159   int                           myStoredShownEntity;     /* Store ShowEntity mode of myMesh */
160   QLineEdit*                    myCurrentLineEdit;       /* Current  LineEdit */
161   SVTK_Selector*                mySelector;
162
163   QPushButton*                  myMeshGroupBtn;
164   QLineEdit*                    myMeshGroupLine;
165
166   QButtonGroup*                 myTypeGroup;
167   QLineEdit*                    myName;
168   QString                       myOldName;
169
170   QButtonGroup*                 myGrpTypeGroup;
171
172   QStackedWidget*               myWGStack;
173   QCheckBox*                    mySelectAll;
174   QCheckBox*                    myAllowElemsModif;
175   QLabel*                       myElementsLab;
176   QListWidget*                  myElements;
177   QPushButton*                  myFilterBtn;
178   QPushButton*                  myAddBtn;
179   QPushButton*                  myRemoveBtn;
180   QPushButton*                  mySortBtn;
181
182   QGroupBox*                    mySelectBox;
183   QCheckBox*                    mySelectSubMesh;
184   QPushButton*                  mySubMeshBtn;
185   QLineEdit*                    mySubMeshLine;
186   QCheckBox*                    mySelectGroup;
187   QPushButton*                  myGroupBtn;
188   QLineEdit*                    myGroupLine;
189
190   QtxColorButton*               myColorBtn;
191
192   QCheckBox*                    mySelectGeomGroup;
193   QToolButton*                  myGeomGroupBtn;
194   QLineEdit*                    myGeomGroupLine;
195   QMenu*                        myGeomPopup;
196
197   QPushButton*                  myOKBtn;
198   QPushButton*                  myApplyBtn;
199   QPushButton*                  myCloseBtn;
200   QPushButton*                  myHelpBtn;
201
202   SMESHGUI_ShapeByMeshOp*       myShapeByMeshOp;
203
204   SMESH::SMESH_Mesh_var         myMesh;
205   QList<SMESH_Actor*>           myActorsList;
206   SMESH::SMESH_Group_var        myGroup;
207   SMESH::SMESH_GroupOnGeom_var  myGroupOnGeom;
208   SMESH::SMESH_GroupOnFilter_var myGroupOnFilter;
209   SMESH::Filter_var             myFilter;
210   QList<int>                    myIdList;
211   GEOM::ListOfGO_var            myGeomObjects;
212
213   int                           mySelectionMode;
214   //Handle(SMESH_TypeFilter)      myMeshFilter;
215   //Handle(SMESH_TypeFilter)      mySubMeshFilter;
216   //Handle(SMESH_TypeFilter)      myGroupFilter;
217   SUIT_SelectionFilter*         myMeshFilter;
218   SMESH_LogicalFilter*          mySubMeshFilter;
219   SMESH_LogicalFilter*          myGroupFilter;
220   SUIT_SelectionFilter*         myGeomFilter;
221
222   SMESHGUI_FilterDlg*           myFilterDlg;
223
224   bool                          myCreate, myIsBusy;
225
226   QString                       myHelpFileName;
227
228   QMap<QAction*, int>           myActions;
229
230   bool                          myNameChanged; //added by skl for IPAL19574
231   int                           myNbChangesOfContents; // nb add's and remove's
232
233   QString                       myObjectToSelect;
234   bool                          myIsApplyAndClose;
235
236   QString _ObjectName;
237   QString _LanguageShort ;
238   int _PublisMeshIN ;
239   int _PublisMeshOUT ;
240   int _YACSMaxIter ;
241   int _YACSMaxNode ;
242   int _YACSMaxElem ;
243   int _YACSTypeTest ;
244 };
245
246 #endif // SMESHGUI_ADAPTDLG_H