Salome HOME
Merge from V6_main_20120808 08Aug12
[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( "0D_ELEMENTS_COLOR_LBL" ), ButtonGroup1 );
106   btnBallElemColor = new QtxColorButton( ButtonGroup1 );
107
108   QLabel* TextLabel_BallElem_Size = new QLabel( tr( "BALLELEM_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   ButtonGroup1Layout->addWidget( TextLabel_Fill,             0, 0 );
133   ButtonGroup1Layout->addWidget( toolSurfColor,              0, 1, 1, 3 );
134
135   ButtonGroup1Layout->addWidget( TextLabel_Outline,          1, 0 );
136   ButtonGroup1Layout->addWidget( btnOutlineColor,            1, 1 );
137   ButtonGroup1Layout->addWidget( TextLabel_Wireframe,        1, 2 );
138   ButtonGroup1Layout->addWidget( btnWireframeColor,         1, 3 );
139
140   ButtonGroup1Layout->addWidget( TextLabel_0DElements_Color, 2, 0 );
141   ButtonGroup1Layout->addWidget( btn0DElementsColor,         2, 1 );
142
143   ButtonGroup1Layout->addWidget( TextLabel_0DElements_Size,  2, 2 );
144   ButtonGroup1Layout->addWidget( SpinBox_0DElements_Size,    2, 3 );
145
146   ButtonGroup1Layout->addWidget( TextLabel_BallElem_Color, 2, 0 );
147   ButtonGroup1Layout->addWidget( btnBallElemColor,         2, 1 );
148
149   ButtonGroup1Layout->addWidget( TextLabel_BallElem_Size,  2, 2 );
150   ButtonGroup1Layout->addWidget( SpinBox_BallElem_Size,    2, 3 );
151
152   ButtonGroup1Layout->addWidget( TextLabel_Width,            3, 0 );
153   ButtonGroup1Layout->addWidget( SpinBox_Width,              3, 1 );
154   ButtonGroup1Layout->addWidget( TextLabel_ShrinkCoeff,      3, 2 );
155   ButtonGroup1Layout->addWidget( SpinBox_Shrink,             3, 3 );
156
157   // -------------------------------
158   QGroupBox* ButtonGroup2 = new QGroupBox( tr( "GRP_NODES" ), this );
159   QGridLayout* ButtonGroup2Layout = new QGridLayout( ButtonGroup2 );
160   ButtonGroup2Layout->setSpacing( SPACING );
161   ButtonGroup2Layout->setMargin( MARGIN );
162
163   QLabel* TextLabel_Nodes_Color = new QLabel( tr( "NODES_COLOR_LBL" ), ButtonGroup2 );
164   btnNodeColor = new QtxColorButton( ButtonGroup2 );
165
166   QGroupBox* MarkerGroup = new QGroupBox( tr( "NODES_MARKER_LBL" ), ButtonGroup2 );
167   QVBoxLayout* MarkerGroupLayout = new QVBoxLayout( MarkerGroup );
168   MarkerGroupLayout->setSpacing( 0 );
169   MarkerGroupLayout->setMargin( 0 );
170
171   MarkerWidget = new VTKViewer_MarkerWidget( MarkerGroup );
172
173   MarkerGroupLayout->addWidget( MarkerWidget );
174
175   ButtonGroup2Layout->addWidget( TextLabel_Nodes_Color, 0, 0 );
176   ButtonGroup2Layout->addWidget( btnNodeColor,          0, 1 );
177   ButtonGroup2Layout->addWidget( MarkerGroup,           1, 0, 1, 3 );
178   ButtonGroup2Layout->setColumnStretch( 2, 1 );
179
180   // -------------------------------
181   QGroupBox* ButtonGroup3 = new QGroupBox( tr( "GRP_ORIENTATION" ), this );
182   QGridLayout* ButtonGroup3Layout = new QGridLayout( ButtonGroup3 );
183   ButtonGroup3Layout->setSpacing( SPACING );
184   ButtonGroup3Layout->setMargin( MARGIN );
185
186   QLabel* TextLabel_Orientation_Color = new QLabel( tr( "ORIENTATION_COLOR_LBL" ), ButtonGroup3 );
187   btnOrientationColor = new QtxColorButton( ButtonGroup3 );
188
189   QLabel* TextLabel_Orientation_Scale = new QLabel( tr( "ORIENTATION_SCALE_LBL" ), ButtonGroup3 );
190   SpinBox_Orientation_Scale = new SMESHGUI_SpinBox( ButtonGroup3 );
191   SpinBox_Orientation_Scale->setAcceptNames( false ); // No Notebook variables allowed
192   SpinBox_Orientation_Scale->RangeStepAndValidator( .05, .5, .05, "parametric_precision" );
193   SpinBox_Orientation_Scale->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
194   SpinBox_Orientation_Scale->setButtonSymbols( QSpinBox::PlusMinus );
195
196   CheckBox_Orientation_3DVectors = new QCheckBox( tr( "3D_VECTORS_LBL" ), ButtonGroup3 );
197
198   ButtonGroup3Layout->addWidget( TextLabel_Orientation_Color,    0, 0 );
199   ButtonGroup3Layout->addWidget( btnOrientationColor,            0, 1 );
200   ButtonGroup3Layout->addWidget( TextLabel_Orientation_Scale,    0, 2 );
201   ButtonGroup3Layout->addWidget( SpinBox_Orientation_Scale,      0, 3 );
202   ButtonGroup3Layout->addWidget( CheckBox_Orientation_3DVectors, 1, 0, 1, 4 );
203
204   // -------------------------------
205   QGroupBox* ButtonGroup4 = new QGroupBox( tr( "GRP_SELECTION" ), this );
206   QGridLayout* ButtonGroup4Layout = new QGridLayout( ButtonGroup4 );
207   ButtonGroup3Layout->setSpacing( SPACING );
208   ButtonGroup3Layout->setMargin( MARGIN );
209   
210   QLabel* TextLabel_Selection_Color = new QLabel( tr( "SELECTION_COLOR_LBL" ), ButtonGroup4 );
211   btnSelectionColor = new QtxColorButton( ButtonGroup4 );
212   
213   QLabel* TextLabel_Preselection_Color = new QLabel( tr( "PRESELECTION_COLOR_LBL" ), ButtonGroup4 );
214   btnPreselectionColor = new QtxColorButton( ButtonGroup4 );
215   
216   ButtonGroup4Layout->addWidget( TextLabel_Selection_Color,      0, 0 );
217   ButtonGroup4Layout->addWidget( btnSelectionColor,              0, 1 );
218   ButtonGroup4Layout->addWidget( TextLabel_Preselection_Color,   0, 2 );
219   ButtonGroup4Layout->addWidget( btnPreselectionColor,           0, 3 );
220
221   // -------------------------------
222   QGroupBox* GroupButtons = new QGroupBox( this );
223   QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons );
224   GroupButtonsLayout->setSpacing( SPACING );
225   GroupButtonsLayout->setMargin( MARGIN );
226
227   QPushButton* buttonOk = new QPushButton( tr( "SMESH_BUT_OK" ), GroupButtons );
228   buttonOk->setAutoDefault( true );
229   buttonOk->setDefault( true );
230
231   QPushButton* buttonCancel = new QPushButton( tr( "SMESH_BUT_CANCEL" ), GroupButtons );
232   buttonCancel->setAutoDefault( true );
233
234   QPushButton* buttonHelp = new QPushButton( tr( "SMESH_BUT_HELP" ), GroupButtons );
235   buttonHelp->setAutoDefault( true );
236
237   GroupButtonsLayout->addWidget( buttonOk );
238   GroupButtonsLayout->addSpacing( 10 );
239   GroupButtonsLayout->addStretch();
240   GroupButtonsLayout->addWidget( buttonCancel );
241   GroupButtonsLayout->addWidget( buttonHelp );
242
243   // -------------------------------
244   topLayout->addWidget( ButtonGroup1 );
245   topLayout->addWidget( ButtonGroup2 );
246   topLayout->addWidget( ButtonGroup3 );
247   //  rnv: Selection and preselection colors are defined only in the Preferences 
248   //  topLayout->addWidget( ButtonGroup4 );
249   ButtonGroup4->hide();
250   topLayout->addWidget( GroupButtons );
251
252   // -------------------------------
253   mySMESHGUI->SetActiveDialogBox( this );
254
255   myHelpFileName = "colors_size_page.html";
256
257   /* signals and slots connections */
258   connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
259   connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) );
260   connect( buttonHelp,   SIGNAL( clicked() ), this, SLOT( ClickOnHelp() ) );
261
262   connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ),
263            this,       SLOT( DeactivateActiveDialog() ) );
264   /* to close dialog if study change */
265   connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ),
266            this,       SLOT( ClickOnCancel() ) );
267 }
268
269 //=================================================================================
270 // function : ~SMESHGUI_Preferences_ColorDlg()
271 // purpose  : Destructor
272 //=================================================================================
273 SMESHGUI_Preferences_ColorDlg::~SMESHGUI_Preferences_ColorDlg()
274 {
275 }
276
277 //=================================================================================
278 // function : ClickOnOk()
279 // purpose  :
280 //=================================================================================
281 void SMESHGUI_Preferences_ColorDlg::ClickOnOk()
282 {
283   mySMESHGUI->ResetState();
284   accept();
285 }
286
287 //=================================================================================
288 // function : ClickOnCancel()
289 // purpose  :
290 //=================================================================================
291 void SMESHGUI_Preferences_ColorDlg::ClickOnCancel()
292 {
293   mySMESHGUI->ResetState();
294   reject();
295 }
296
297 //=================================================================================
298 // function : ClickOnHelp()
299 // purpose  :
300 //=================================================================================
301 void SMESHGUI_Preferences_ColorDlg::ClickOnHelp()
302 {
303   LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
304   if (app) 
305     app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
306   else {
307     QString platform;
308 #ifdef WIN32
309     platform = "winapplication";
310 #else
311     platform = "application";
312 #endif
313     SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
314                              tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
315                              arg(app->resourceMgr()->stringValue("ExternalBrowser", 
316                                                                  platform)).
317                              arg(myHelpFileName));
318   }
319 }
320
321 //=================================================================================
322 // function : DeactivateActiveDialog()
323 // purpose  :
324 //=================================================================================
325 void SMESHGUI_Preferences_ColorDlg::DeactivateActiveDialog()
326 {
327 }
328
329 //=================================================================================
330 // function : closeEvent()
331 // purpose  :
332 //=================================================================================
333 void SMESHGUI_Preferences_ColorDlg::closeEvent( QCloseEvent* )
334 {
335   ClickOnCancel(); /* same than click on cancel button */
336 }
337
338 //=================================================================================
339 // function : ActivateThisDialog()
340 // purpose  :
341 //=================================================================================
342 void SMESHGUI_Preferences_ColorDlg::ActivateThisDialog()
343 {
344   /* Emit a signal to deactivate any active dialog */
345   mySMESHGUI->EmitSignalDeactivateDialog();
346 }
347
348 //=================================================================================
349 // function : SetColor()
350 // purpose  :
351 //=================================================================================
352 void SMESHGUI_Preferences_ColorDlg::SetColor( int type, const QColor& color )
353 {
354   switch ( type ) {
355   case 1 : toolSurfColor->setMainColor( color );     break; // fill
356   case 2 : btnWireframeColor->setColor( color );     break; // wireframe
357   case 3 : btnNodeColor->setColor( color );          break; // node
358   case 4 : btnOutlineColor->setColor( color );       break; // outline
359   case 5 : btn0DElementsColor->setColor( color );    break; // 0d elements
360   case 6 : btnBallElemColor->setColor( color );      break; // ball elements
361   case 7 : btnOrientationColor->setColor( color );   break; // orientation of faces
362   case 8 : btnSelectionColor->setColor( color );     break; // selection color
363   case 9 : btnPreselectionColor->setColor( color );  break; // pre-selection color
364   default: break;
365   }
366 }
367
368 //=================================================================================
369 // function : GetColor()
370 // purpose  :
371 //=================================================================================
372 QColor SMESHGUI_Preferences_ColorDlg::GetColor( int type )
373 {
374   QColor color;
375   switch ( type ) {
376   case 1 : color = toolSurfColor->mainColor();    break; // fill
377   case 2 : color = btnWireframeColor->color();    break; // outline
378   case 3 : color = btnNodeColor->color();         break; // node
379   case 4 : color = btnOutlineColor->color();      break; // node
380   case 5 : color = btn0DElementsColor->color();   break; // 0d elements
381   case 6 : color = btnBallElemColor->color();   break; // 0d elements
382   case 7 : color = btnOrientationColor->color();  break; // orientation of faces
383   case 8 : color = btnSelectionColor->color();    break; // selection color
384   case 9 : color = btnPreselectionColor->color(); break; // pre-selection color
385
386   default: break;
387   }
388   return color;
389 }
390
391 //=================================================================================
392 // function : SetIntValue()
393 // purpose  :
394 //=================================================================================
395 void SMESHGUI_Preferences_ColorDlg::SetIntValue( int type, int value )
396 {
397   switch ( type ) {
398   case 1 : SpinBox_Width->setValue( value );           break; // width
399   case 2 : SpinBox_Shrink->setValue( value );          break; // shrink coeff
400   case 3 : SpinBox_0DElements_Size->setValue( value ); break; // 0d elements
401   case 4 : SpinBox_BallElem_Size->setValue( value ); break; // 0d elements
402   default: break;
403   }
404 }
405
406 //=================================================================================
407 // function : GetIntValue()
408 // purpose  :
409 //=================================================================================
410 int SMESHGUI_Preferences_ColorDlg::GetIntValue( int type )
411 {
412   int res = 0;
413   switch ( type ) {
414   case 1 : res = SpinBox_Width->value();           break; // width
415   case 2 : res = SpinBox_Shrink->value();          break; // shrink coeff
416   case 3 : res = SpinBox_0DElements_Size->value(); break; // 0d elements
417   case 4 : res = SpinBox_BallElem_Size->value(); break; // 0d elements
418   default: break;
419   }
420   return res;
421 }
422
423 //=================================================================================
424 // function : SetDoubleValue()
425 // purpose  :
426 //=================================================================================
427 void SMESHGUI_Preferences_ColorDlg::SetDoubleValue( int type, double value )
428 {
429   switch ( type ) {
430   case 1 : SpinBox_Orientation_Scale->setValue( value ); break; // orientation scale
431   default: break;
432   }
433 }
434
435 //=================================================================================
436 // function : GetDoubleValue()
437 // purpose  :
438 //=================================================================================
439 double SMESHGUI_Preferences_ColorDlg::GetDoubleValue( int type )
440 {
441   double res = 0;
442   switch ( type ) {
443   case 1 : res = SpinBox_Orientation_Scale->value(); break; // orientation scale
444   default: break;
445   }
446   return res;
447 }
448
449 //=================================================================================
450 // function : SetBooleanValue()
451 // purpose  :
452 //=================================================================================
453 void SMESHGUI_Preferences_ColorDlg::SetBooleanValue( int type, bool value )
454 {
455   switch ( type ) {
456   case 1 : CheckBox_Orientation_3DVectors->setChecked( value ); break; // 3D vectors
457   default: break;
458   }
459 }
460
461 //=================================================================================
462 // function : GetBooleanValue()
463 // purpose  :
464 //=================================================================================
465 bool SMESHGUI_Preferences_ColorDlg::GetBooleanValue( int type )
466 {
467   bool res = false;
468   switch ( type ) {
469   case 1 : res = CheckBox_Orientation_3DVectors->isChecked(); break; // 3D vectors
470   default: break;
471   }
472   return res;
473 }
474
475 //=================================================================================
476 // function : setCustomMarkerMap()
477 // purpose  :
478 //=================================================================================
479 void SMESHGUI_Preferences_ColorDlg::setCustomMarkerMap( VTK::MarkerMap theMarkerMap )
480 {
481   MarkerWidget->setCustomMarkerMap( theMarkerMap );
482 }
483
484 //=================================================================================
485 // function : getCustomMarkerMap()
486 // purpose  :
487 //=================================================================================
488 VTK::MarkerMap SMESHGUI_Preferences_ColorDlg::getCustomMarkerMap()
489 {
490   return MarkerWidget->getCustomMarkerMap();
491 }
492
493 //=================================================================================
494 // function : setStandardMarker()
495 // purpose  :
496 //=================================================================================
497 void SMESHGUI_Preferences_ColorDlg::setStandardMarker( VTK::MarkerType theMarkerType,
498                                                        VTK::MarkerScale theMarkerScale )
499 {
500   MarkerWidget->setStandardMarker( theMarkerType, theMarkerScale );
501 }
502
503 //=================================================================================
504 // function : setCustomMarker()
505 // purpose  :
506 //=================================================================================
507 void SMESHGUI_Preferences_ColorDlg::setCustomMarker( int theId )
508 {
509   MarkerWidget->setCustomMarker( theId );
510 }
511
512 //=================================================================================
513 // function : getMarkerType()
514 // purpose  :
515 //=================================================================================
516 VTK::MarkerType SMESHGUI_Preferences_ColorDlg::getMarkerType() const
517 {
518   return MarkerWidget->getMarkerType();
519 }
520
521 //=================================================================================
522 // function : getStandardMarkerScale()
523 // purpose  :
524 //=================================================================================
525 VTK::MarkerScale SMESHGUI_Preferences_ColorDlg::getStandardMarkerScale() const
526 {
527   return MarkerWidget->getStandardMarkerScale();
528 }
529
530 //=================================================================================
531 // function : getCustomMarkerID()
532 // purpose  :
533 //=================================================================================
534 int SMESHGUI_Preferences_ColorDlg::getCustomMarkerID() const
535 {
536   return MarkerWidget->getCustomMarkerID();
537 }
538
539 //=================================================================================
540 // function : SetDeltaBrightness(int)
541 // purpose  :
542 //=================================================================================
543 void SMESHGUI_Preferences_ColorDlg::SetDeltaBrightness(int delta) 
544 {
545   toolSurfColor->setDelta(delta);
546 }
547 //=================================================================================
548 // function : GetDeltaBrightness()
549 // purpose  :
550 //=================================================================================
551 int SMESHGUI_Preferences_ColorDlg::GetDeltaBrightness() 
552 {
553   return toolSurfColor->delta();
554 }
555
556 //=================================================================================
557 // function : keyPressEvent()
558 // purpose  :
559 //=================================================================================
560 void SMESHGUI_Preferences_ColorDlg::keyPressEvent( QKeyEvent* e )
561 {
562   QDialog::keyPressEvent( e );
563   if ( e->isAccepted() )
564     return;
565
566   if ( e->key() == Qt::Key_F1 ) {
567     e->accept();
568     ClickOnHelp();
569   }
570 }