Salome HOME
0020833: EDF 1361 SMESH : Graphical Selection of the boundary faces in one clic
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_Preferences_ColorDlg.cxx
1 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 // SMESH SMESHGUI : GUI for SMESH component
24 // File   : SMESHGUI_Preferences_ColorDlg.cxx
25 // Author : Nicolas REJNERI, Open CASCADE S.A.S.
26 // SMESH includes
27 //
28 #include "SMESHGUI_Preferences_ColorDlg.h"
29
30 #include "SMESHGUI.h"
31 #include "SMESHGUI_SpinBox.h"
32 #include "SMESHGUI_Utils.h"
33
34 // SALOME GUI includes
35 #include <SUIT_Desktop.h>
36 #include <SUIT_MessageBox.h>
37 #include <SUIT_ResourceMgr.h>
38 #include <SUIT_Session.h>
39 #include <QtxColorButton.h>
40 #include <VTKViewer_MarkerWidget.h>
41 #include <LightApp_Application.h>
42 #include <SalomeApp_IntSpinBox.h>
43
44 // Qt includes
45 #include <QGroupBox>
46 #include <QLabel>
47 #include <QPushButton>
48 #include <QVBoxLayout>
49 #include <QHBoxLayout>
50 #include <QGridLayout>
51 #include <QCheckBox>
52 #include <QKeyEvent>
53
54 #define SPACING 6
55 #define MARGIN  11
56
57 //=================================================================================
58 // function : SMESHGUI_Preferences_ColorDlg()
59 // purpose  : Constructs a SMESHGUI_Preferences_ColorDlg which is a child
60 //            of 'parent', with the name 'name' and widget flags set to 'f'
61 //            The dialog will by default be modeless, unless you
62 //            set'modal' to true to construct a modal dialog.
63 //=================================================================================
64 SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( SMESHGUI* theModule )
65   : QDialog( SMESH::GetDesktop( theModule ) ),
66     mySMESHGUI( theModule )
67 {
68   setModal( true );
69   setWindowTitle( tr( "DIALOG_TITLE" ) );
70   setSizeGripEnabled( true );
71
72   // -------------------------------
73   QVBoxLayout* topLayout = new QVBoxLayout( this );
74   topLayout->setSpacing( SPACING );
75   topLayout->setMargin( MARGIN );
76
77   // -------------------------------
78   QGroupBox* ButtonGroup1 = new QGroupBox( tr( "GRP_ELEMENTS" ), this );
79   QGridLayout* ButtonGroup1Layout = new QGridLayout( ButtonGroup1 );
80   ButtonGroup1Layout->setSpacing( SPACING );
81   ButtonGroup1Layout->setMargin( MARGIN );
82
83   QLabel* TextLabel_Fill = new QLabel( tr( "SURFACE_COLOR_LBL" ), ButtonGroup1 );
84
85   toolSurfColor = new QtxBiColorTool(ButtonGroup1);
86   toolSurfColor->setText( tr( "BACKSURFACE_COLOR_LBL" ));
87
88   QLabel* TextLabel_Outline = new QLabel( tr( "OUTLINE_COLOR_LBL" ), ButtonGroup1 );
89   btnOutlineColor = new QtxColorButton( ButtonGroup1 );
90
91   QLabel* TextLabel_Wireframe = new QLabel( tr( "WIREFRAME_COLOR_LBL" ), ButtonGroup1 );
92   btnWireframeColor = new QtxColorButton( ButtonGroup1 );
93
94   QLabel* TextLabel_0DElements_Color = new QLabel( tr( "0D_ELEMENTS_COLOR_LBL" ), ButtonGroup1 );
95   btn0DElementsColor = new QtxColorButton( ButtonGroup1 );
96
97   QLabel* TextLabel_0DElements_Size = new QLabel( tr( "0D_ELEMENTS_SIZE_LBL" ), ButtonGroup1 );
98   SpinBox_0DElements_Size = new SalomeApp_IntSpinBox( ButtonGroup1 );
99   SpinBox_0DElements_Size->setAcceptNames( false ); // No Notebook variables allowed
100   SpinBox_0DElements_Size->setRange( 1, 10 );
101   SpinBox_0DElements_Size->setSingleStep( 1 );
102   SpinBox_0DElements_Size->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
103   SpinBox_0DElements_Size->setButtonSymbols( QSpinBox::PlusMinus );
104
105   QLabel* TextLabel_BallElem_Color = new QLabel( tr( "BALL_ELEMENTS_COLOR_LBL" ), ButtonGroup1 );
106   btnBallElemColor = new QtxColorButton( ButtonGroup1 );
107
108   QLabel* TextLabel_BallElem_Size = new QLabel( tr( "BALL_ELEMENTS_SIZE_LBL" ), ButtonGroup1 );
109   SpinBox_BallElem_Size = new SalomeApp_IntSpinBox( ButtonGroup1 );
110   SpinBox_BallElem_Size->setAcceptNames( false ); // No Notebook variables allowed
111   SpinBox_BallElem_Size->setRange( 1, 10 );
112   SpinBox_BallElem_Size->setSingleStep( 1 );
113   SpinBox_BallElem_Size->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
114   SpinBox_BallElem_Size->setButtonSymbols( QSpinBox::PlusMinus );
115
116   QLabel* TextLabel_Width = new QLabel( tr( "LINE_WIDTH_LBL" ), ButtonGroup1 );
117   SpinBox_Width = new SalomeApp_IntSpinBox( ButtonGroup1 );
118   SpinBox_Width->setAcceptNames( false ); // No Notebook variables allowed
119   SpinBox_Width->setRange( 1, 5 );
120   SpinBox_Width->setSingleStep( 1 );
121   SpinBox_Width->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
122   SpinBox_Width->setButtonSymbols( QSpinBox::PlusMinus );
123
124   QLabel* TextLabel_ShrinkCoeff = new QLabel( tr( "SHRINK_COEF_LBL" ), ButtonGroup1 );
125   SpinBox_Shrink = new SalomeApp_IntSpinBox( ButtonGroup1 );
126   SpinBox_Shrink->setAcceptNames( false ); // No Notebook variables allowed
127   SpinBox_Shrink->setRange( 20, 100 );
128   SpinBox_Shrink->setSingleStep( 1 );
129   SpinBox_Shrink->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
130   SpinBox_Shrink->setButtonSymbols( QSpinBox::PlusMinus );
131
132   int row = 0;
133   ButtonGroup1Layout->addWidget( TextLabel_Fill,             row, 0 );
134   ButtonGroup1Layout->addWidget( toolSurfColor,              row++, 1, 1, 3 );
135
136   ButtonGroup1Layout->addWidget( TextLabel_Outline,          row, 0 );
137   ButtonGroup1Layout->addWidget( btnOutlineColor,            row, 1 );
138   ButtonGroup1Layout->addWidget( TextLabel_Wireframe,        row, 2 );
139   ButtonGroup1Layout->addWidget( btnWireframeColor,          row++, 3 );
140
141   ButtonGroup1Layout->addWidget( TextLabel_0DElements_Color, row, 0 );
142   ButtonGroup1Layout->addWidget( btn0DElementsColor,         row, 1 );
143
144   ButtonGroup1Layout->addWidget( TextLabel_0DElements_Size,  row, 2 );
145   ButtonGroup1Layout->addWidget( SpinBox_0DElements_Size,    row++, 3 );
146
147   ButtonGroup1Layout->addWidget( TextLabel_BallElem_Color,   row, 0 );
148   ButtonGroup1Layout->addWidget( btnBallElemColor,           row, 1 );
149
150   ButtonGroup1Layout->addWidget( TextLabel_BallElem_Size,    row, 2 );
151   ButtonGroup1Layout->addWidget( SpinBox_BallElem_Size,      row++, 3 );
152
153   ButtonGroup1Layout->addWidget( TextLabel_Width,            row, 0 );
154   ButtonGroup1Layout->addWidget( SpinBox_Width,              row, 1 );
155   ButtonGroup1Layout->addWidget( TextLabel_ShrinkCoeff,      row, 2 );
156   ButtonGroup1Layout->addWidget( SpinBox_Shrink,             row, 3 );
157
158   // -------------------------------
159   QGroupBox* ButtonGroup2 = new QGroupBox( tr( "GRP_NODES" ), this );
160   QGridLayout* ButtonGroup2Layout = new QGridLayout( ButtonGroup2 );
161   ButtonGroup2Layout->setSpacing( SPACING );
162   ButtonGroup2Layout->setMargin( MARGIN );
163
164   QLabel* TextLabel_Nodes_Color = new QLabel( tr( "NODES_COLOR_LBL" ), ButtonGroup2 );
165   btnNodeColor = new QtxColorButton( ButtonGroup2 );
166
167   QGroupBox* MarkerGroup = new QGroupBox( tr( "NODES_MARKER_LBL" ), ButtonGroup2 );
168   QVBoxLayout* MarkerGroupLayout = new QVBoxLayout( MarkerGroup );
169   MarkerGroupLayout->setSpacing( 0 );
170   MarkerGroupLayout->setMargin( 0 );
171
172   MarkerWidget = new VTKViewer_MarkerWidget( MarkerGroup );
173
174   MarkerGroupLayout->addWidget( MarkerWidget );
175
176   row = 0;
177   ButtonGroup2Layout->addWidget( TextLabel_Nodes_Color, row, 0 );
178   ButtonGroup2Layout->addWidget( btnNodeColor,          row++, 1 );
179   ButtonGroup2Layout->addWidget( MarkerGroup,           row++, 0, 1, 3 );
180   ButtonGroup2Layout->setColumnStretch( row, 1 );
181
182   // -------------------------------
183   QGroupBox* ButtonGroup3 = new QGroupBox( tr( "GRP_ORIENTATION" ), this );
184   QGridLayout* ButtonGroup3Layout = new QGridLayout( ButtonGroup3 );
185   ButtonGroup3Layout->setSpacing( SPACING );
186   ButtonGroup3Layout->setMargin( MARGIN );
187
188   QLabel* TextLabel_Orientation_Color = new QLabel( tr( "ORIENTATION_COLOR_LBL" ), ButtonGroup3 );
189   btnOrientationColor = new QtxColorButton( ButtonGroup3 );
190
191   QLabel* TextLabel_Orientation_Scale = new QLabel( tr( "ORIENTATION_SCALE_LBL" ), ButtonGroup3 );
192   SpinBox_Orientation_Scale = new SMESHGUI_SpinBox( ButtonGroup3 );
193   SpinBox_Orientation_Scale->setAcceptNames( false ); // No Notebook variables allowed
194   SpinBox_Orientation_Scale->RangeStepAndValidator( .05, .5, .05, "parametric_precision" );
195   SpinBox_Orientation_Scale->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
196   SpinBox_Orientation_Scale->setButtonSymbols( QSpinBox::PlusMinus );
197
198   CheckBox_Orientation_3DVectors = new QCheckBox( tr( "3D_VECTORS_LBL" ), ButtonGroup3 );
199
200   row = 0;
201   ButtonGroup3Layout->addWidget( TextLabel_Orientation_Color,    row, 0 );
202   ButtonGroup3Layout->addWidget( btnOrientationColor,            row, 1 );
203   ButtonGroup3Layout->addWidget( TextLabel_Orientation_Scale,    row, 2 );
204   ButtonGroup3Layout->addWidget( SpinBox_Orientation_Scale,      row++, 3 );
205   ButtonGroup3Layout->addWidget( CheckBox_Orientation_3DVectors, row, 0, 1, 4 );
206
207   // -------------------------------
208   QGroupBox* ButtonGroup4 = new QGroupBox( tr( "GRP_SELECTION" ), this );
209   QGridLayout* ButtonGroup4Layout = new QGridLayout( ButtonGroup4 );
210   ButtonGroup3Layout->setSpacing( SPACING );
211   ButtonGroup3Layout->setMargin( MARGIN );
212   
213   QLabel* TextLabel_Selection_Color = new QLabel( tr( "SELECTION_COLOR_LBL" ), ButtonGroup4 );
214   btnSelectionColor = new QtxColorButton( ButtonGroup4 );
215   
216   QLabel* TextLabel_Preselection_Color = new QLabel( tr( "PRESELECTION_COLOR_LBL" ), ButtonGroup4 );
217   btnPreselectionColor = new QtxColorButton( ButtonGroup4 );
218   
219   row = 0;
220   ButtonGroup4Layout->addWidget( TextLabel_Selection_Color,      row, 0 );
221   ButtonGroup4Layout->addWidget( btnSelectionColor,              row, 1 );
222   ButtonGroup4Layout->addWidget( TextLabel_Preselection_Color,   row, 2 );
223   ButtonGroup4Layout->addWidget( btnPreselectionColor,           row, 3 );
224
225   // -------------------------------
226   QGroupBox* GroupButtons = new QGroupBox( this );
227   QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons );
228   GroupButtonsLayout->setSpacing( SPACING );
229   GroupButtonsLayout->setMargin( MARGIN );
230
231   QPushButton* buttonOk = new QPushButton( tr( "SMESH_BUT_OK" ), GroupButtons );
232   buttonOk->setAutoDefault( true );
233   buttonOk->setDefault( true );
234
235   QPushButton* buttonCancel = new QPushButton( tr( "SMESH_BUT_CANCEL" ), GroupButtons );
236   buttonCancel->setAutoDefault( true );
237
238   QPushButton* buttonHelp = new QPushButton( tr( "SMESH_BUT_HELP" ), GroupButtons );
239   buttonHelp->setAutoDefault( true );
240
241   GroupButtonsLayout->addWidget( buttonOk );
242   GroupButtonsLayout->addSpacing( 10 );
243   GroupButtonsLayout->addStretch();
244   GroupButtonsLayout->addWidget( buttonCancel );
245   GroupButtonsLayout->addWidget( buttonHelp );
246
247   // -------------------------------
248   topLayout->addWidget( ButtonGroup1 );
249   topLayout->addWidget( ButtonGroup2 );
250   topLayout->addWidget( ButtonGroup3 );
251   //  rnv: Selection and preselection colors are defined only in the Preferences 
252   //  topLayout->addWidget( ButtonGroup4 );
253   ButtonGroup4->hide();
254   topLayout->addWidget( GroupButtons );
255
256   // -------------------------------
257   mySMESHGUI->SetActiveDialogBox( this );
258
259   myHelpFileName = "colors_size_page.html";
260
261   /* signals and slots connections */
262   connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
263   connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) );
264   connect( buttonHelp,   SIGNAL( clicked() ), this, SLOT( ClickOnHelp() ) );
265
266   connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ),
267            this,       SLOT( DeactivateActiveDialog() ) );
268   /* to close dialog if study change */
269   connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ),
270            this,       SLOT( ClickOnCancel() ) );
271 }
272
273 //=================================================================================
274 // function : ~SMESHGUI_Preferences_ColorDlg()
275 // purpose  : Destructor
276 //=================================================================================
277 SMESHGUI_Preferences_ColorDlg::~SMESHGUI_Preferences_ColorDlg()
278 {
279 }
280
281 //=================================================================================
282 // function : ClickOnOk()
283 // purpose  :
284 //=================================================================================
285 void SMESHGUI_Preferences_ColorDlg::ClickOnOk()
286 {
287   mySMESHGUI->ResetState();
288   accept();
289 }
290
291 //=================================================================================
292 // function : ClickOnCancel()
293 // purpose  :
294 //=================================================================================
295 void SMESHGUI_Preferences_ColorDlg::ClickOnCancel()
296 {
297   mySMESHGUI->ResetState();
298   reject();
299 }
300
301 //=================================================================================
302 // function : ClickOnHelp()
303 // purpose  :
304 //=================================================================================
305 void SMESHGUI_Preferences_ColorDlg::ClickOnHelp()
306 {
307   LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
308   if (app) 
309     app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
310   else {
311     QString platform;
312 #ifdef WIN32
313     platform = "winapplication";
314 #else
315     platform = "application";
316 #endif
317     SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
318                              tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
319                              arg(app->resourceMgr()->stringValue("ExternalBrowser", 
320                                                                  platform)).
321                              arg(myHelpFileName));
322   }
323 }
324
325 //=================================================================================
326 // function : DeactivateActiveDialog()
327 // purpose  :
328 //=================================================================================
329 void SMESHGUI_Preferences_ColorDlg::DeactivateActiveDialog()
330 {
331 }
332
333 //=================================================================================
334 // function : closeEvent()
335 // purpose  :
336 //=================================================================================
337 void SMESHGUI_Preferences_ColorDlg::closeEvent( QCloseEvent* )
338 {
339   ClickOnCancel(); /* same than click on cancel button */
340 }
341
342 //=================================================================================
343 // function : ActivateThisDialog()
344 // purpose  :
345 //=================================================================================
346 void SMESHGUI_Preferences_ColorDlg::ActivateThisDialog()
347 {
348   /* Emit a signal to deactivate any active dialog */
349   mySMESHGUI->EmitSignalDeactivateDialog();
350 }
351
352 //=================================================================================
353 // function : SetColor()
354 // purpose  :
355 //=================================================================================
356 void SMESHGUI_Preferences_ColorDlg::SetColor( int type, const QColor& color )
357 {
358   switch ( type ) {
359   case 1 : toolSurfColor->setMainColor( color );     break; // fill
360   case 2 : btnWireframeColor->setColor( color );     break; // wireframe
361   case 3 : btnNodeColor->setColor( color );          break; // node
362   case 4 : btnOutlineColor->setColor( color );       break; // outline
363   case 5 : btn0DElementsColor->setColor( color );    break; // 0d elements
364   case 6 : btnBallElemColor->setColor( color );      break; // ball elements
365   case 7 : btnOrientationColor->setColor( color );   break; // orientation of faces
366   case 8 : btnSelectionColor->setColor( color );     break; // selection color
367   case 9 : btnPreselectionColor->setColor( color );  break; // pre-selection color
368   default: break;
369   }
370 }
371
372 //=================================================================================
373 // function : GetColor()
374 // purpose  :
375 //=================================================================================
376 QColor SMESHGUI_Preferences_ColorDlg::GetColor( int type )
377 {
378   QColor color;
379   switch ( type ) {
380   case 1 : color = toolSurfColor->mainColor();    break; // fill
381   case 2 : color = btnWireframeColor->color();    break; // outline
382   case 3 : color = btnNodeColor->color();         break; // node
383   case 4 : color = btnOutlineColor->color();      break; // node
384   case 5 : color = btn0DElementsColor->color();   break; // 0d elements
385   case 6 : color = btnBallElemColor->color();   break; // 0d elements
386   case 7 : color = btnOrientationColor->color();  break; // orientation of faces
387   case 8 : color = btnSelectionColor->color();    break; // selection color
388   case 9 : color = btnPreselectionColor->color(); break; // pre-selection color
389
390   default: break;
391   }
392   return color;
393 }
394
395 //=================================================================================
396 // function : SetIntValue()
397 // purpose  :
398 //=================================================================================
399 void SMESHGUI_Preferences_ColorDlg::SetIntValue( int type, int value )
400 {
401   switch ( type ) {
402   case 1 : SpinBox_Width->setValue( value );           break; // width
403   case 2 : SpinBox_Shrink->setValue( value );          break; // shrink coeff
404   case 3 : SpinBox_0DElements_Size->setValue( value ); break; // 0d elements
405   case 4 : SpinBox_BallElem_Size->setValue( value ); break; // 0d elements
406   default: break;
407   }
408 }
409
410 //=================================================================================
411 // function : GetIntValue()
412 // purpose  :
413 //=================================================================================
414 int SMESHGUI_Preferences_ColorDlg::GetIntValue( int type )
415 {
416   int res = 0;
417   switch ( type ) {
418   case 1 : res = SpinBox_Width->value();           break; // width
419   case 2 : res = SpinBox_Shrink->value();          break; // shrink coeff
420   case 3 : res = SpinBox_0DElements_Size->value(); break; // 0d elements
421   case 4 : res = SpinBox_BallElem_Size->value(); break; // 0d elements
422   default: break;
423   }
424   return res;
425 }
426
427 //=================================================================================
428 // function : SetDoubleValue()
429 // purpose  :
430 //=================================================================================
431 void SMESHGUI_Preferences_ColorDlg::SetDoubleValue( int type, double value )
432 {
433   switch ( type ) {
434   case 1 : SpinBox_Orientation_Scale->setValue( value ); break; // orientation scale
435   default: break;
436   }
437 }
438
439 //=================================================================================
440 // function : GetDoubleValue()
441 // purpose  :
442 //=================================================================================
443 double SMESHGUI_Preferences_ColorDlg::GetDoubleValue( int type )
444 {
445   double res = 0;
446   switch ( type ) {
447   case 1 : res = SpinBox_Orientation_Scale->value(); break; // orientation scale
448   default: break;
449   }
450   return res;
451 }
452
453 //=================================================================================
454 // function : SetBooleanValue()
455 // purpose  :
456 //=================================================================================
457 void SMESHGUI_Preferences_ColorDlg::SetBooleanValue( int type, bool value )
458 {
459   switch ( type ) {
460   case 1 : CheckBox_Orientation_3DVectors->setChecked( value ); break; // 3D vectors
461   default: break;
462   }
463 }
464
465 //=================================================================================
466 // function : GetBooleanValue()
467 // purpose  :
468 //=================================================================================
469 bool SMESHGUI_Preferences_ColorDlg::GetBooleanValue( int type )
470 {
471   bool res = false;
472   switch ( type ) {
473   case 1 : res = CheckBox_Orientation_3DVectors->isChecked(); break; // 3D vectors
474   default: break;
475   }
476   return res;
477 }
478
479 //=================================================================================
480 // function : setCustomMarkerMap()
481 // purpose  :
482 //=================================================================================
483 void SMESHGUI_Preferences_ColorDlg::setCustomMarkerMap( VTK::MarkerMap theMarkerMap )
484 {
485   MarkerWidget->setCustomMarkerMap( theMarkerMap );
486 }
487
488 //=================================================================================
489 // function : getCustomMarkerMap()
490 // purpose  :
491 //=================================================================================
492 VTK::MarkerMap SMESHGUI_Preferences_ColorDlg::getCustomMarkerMap()
493 {
494   return MarkerWidget->getCustomMarkerMap();
495 }
496
497 //=================================================================================
498 // function : setStandardMarker()
499 // purpose  :
500 //=================================================================================
501 void SMESHGUI_Preferences_ColorDlg::setStandardMarker( VTK::MarkerType theMarkerType,
502                                                        VTK::MarkerScale theMarkerScale )
503 {
504   MarkerWidget->setStandardMarker( theMarkerType, theMarkerScale );
505 }
506
507 //=================================================================================
508 // function : setCustomMarker()
509 // purpose  :
510 //=================================================================================
511 void SMESHGUI_Preferences_ColorDlg::setCustomMarker( int theId )
512 {
513   MarkerWidget->setCustomMarker( theId );
514 }
515
516 //=================================================================================
517 // function : getMarkerType()
518 // purpose  :
519 //=================================================================================
520 VTK::MarkerType SMESHGUI_Preferences_ColorDlg::getMarkerType() const
521 {
522   return MarkerWidget->getMarkerType();
523 }
524
525 //=================================================================================
526 // function : getStandardMarkerScale()
527 // purpose  :
528 //=================================================================================
529 VTK::MarkerScale SMESHGUI_Preferences_ColorDlg::getStandardMarkerScale() const
530 {
531   return MarkerWidget->getStandardMarkerScale();
532 }
533
534 //=================================================================================
535 // function : getCustomMarkerID()
536 // purpose  :
537 //=================================================================================
538 int SMESHGUI_Preferences_ColorDlg::getCustomMarkerID() const
539 {
540   return MarkerWidget->getCustomMarkerID();
541 }
542
543 //=================================================================================
544 // function : SetDeltaBrightness(int)
545 // purpose  :
546 //=================================================================================
547 void SMESHGUI_Preferences_ColorDlg::SetDeltaBrightness(int delta) 
548 {
549   toolSurfColor->setDelta(delta);
550 }
551 //=================================================================================
552 // function : GetDeltaBrightness()
553 // purpose  :
554 //=================================================================================
555 int SMESHGUI_Preferences_ColorDlg::GetDeltaBrightness() 
556 {
557   return toolSurfColor->delta();
558 }
559
560 //=================================================================================
561 // function : keyPressEvent()
562 // purpose  :
563 //=================================================================================
564 void SMESHGUI_Preferences_ColorDlg::keyPressEvent( QKeyEvent* e )
565 {
566   QDialog::keyPressEvent( e );
567   if ( e->isAccepted() )
568     return;
569
570   if ( e->key() == Qt::Key_F1 ) {
571     e->accept();
572     ClickOnHelp();
573   }
574 }