Salome HOME
Initial version
[modules/gui.git] / src / Plot2d / Plot2d_SetupViewDlg.cxx
1 //  Copyright (C) 2003  CEA/DEN, EDF R&D
2 //
3 //
4 //
5 //  File   : Plot2d_SetupViewDlg.cxx
6 //  Author : Vadim SANDLER
7 //  Module : SALOME
8 //  $Header$
9
10 #include "Plot2d_SetupViewDlg.h"
11
12 #include <qcheckbox.h>
13 #include <qlineedit.h>
14 #include <qcombobox.h>
15 #include <qspinbox.h>
16 #include <qtoolbutton.h>
17 #include <qlayout.h>
18 #include <qgroupbox.h>
19 #include <qlabel.h>
20 #include <qpushbutton.h>
21 #include <qcolordialog.h>
22 #include <qtabwidget.h>
23
24 #define MARGIN_SIZE          11
25 #define SPACING_SIZE         6
26 #define MIN_EDIT_WIDTH       200
27 #define MIN_COMBO_WIDTH      100
28 #define MIN_SPIN_WIDTH       70
29
30 /*!
31   Constructor
32 */
33 Plot2d_SetupViewDlg::Plot2d_SetupViewDlg( QWidget* parent, bool showDefCheck, bool secondAxisY )
34     : QDialog( parent, "Plot2d_SetupViewDlg", true, 
35          WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
36 {
37   mySecondAxisY = secondAxisY;
38   setCaption( tr("TLT_SETUP_PLOT2D_VIEW") );
39   setSizeGripEnabled( TRUE );
40   QGridLayout* topLayout = new QGridLayout( this ); 
41   topLayout->setSpacing( SPACING_SIZE );
42   topLayout->setMargin( MARGIN_SIZE );
43   
44   // main title
45   myTitleCheck = new QCheckBox( tr( "PLOT2D_ENABLE_MAIN_TITLE" ), this );
46   myTitleEdit  = new QLineEdit( this );
47   myTitleEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
48   myTitleEdit->setMinimumWidth( MIN_EDIT_WIDTH );
49   // curve type : points, lines, spline
50   QLabel* aCurveLab = new QLabel( tr( "PLOT2D_CURVE_TYPE_LBL" ), this );
51   myCurveCombo      = new QComboBox( false, this );
52   myCurveCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
53   myCurveCombo->setMinimumWidth( MIN_COMBO_WIDTH );
54   myCurveCombo->insertItem( tr( "PLOT2D_CURVE_TYPE_POINTS" ) );
55   myCurveCombo->insertItem( tr( "PLOT2D_CURVE_TYPE_LINES" ) );
56   myCurveCombo->insertItem( tr( "PLOT2D_CURVE_TYPE_SPLINE" ) );
57   // legend
58   myLegendCheck = new QCheckBox( tr( "PLOT2D_ENABLE_LEGEND" ), this );
59   myLegendCombo = new QComboBox( false, this );
60   myLegendCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
61   myLegendCombo->setMinimumWidth( MIN_COMBO_WIDTH );
62   myLegendCombo->insertItem( tr( "PLOT2D_LEGEND_POSITION_LEFT" ) );
63   myLegendCombo->insertItem( tr( "PLOT2D_LEGEND_POSITION_RIGHT" ) );
64   myLegendCombo->insertItem( tr( "PLOT2D_LEGEND_POSITION_TOP" ) );
65   myLegendCombo->insertItem( tr( "PLOT2D_LEGEND_POSITION_BOTTOM" ) );
66   // marker size
67   QLabel* aMarkerLab  = new QLabel( tr( "PLOT2D_MARKER_SIZE_LBL" ), this );
68   myMarkerSpin = new QSpinBox( 0, 100, 1, this );
69   myMarkerSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
70   myMarkerSpin->setMinimumWidth( MIN_SPIN_WIDTH );
71
72   // background color
73   QLabel* aBGLab  = new QLabel( tr( "PLOT2D_BACKGROUND_COLOR_LBL" ), this );
74   myBackgroundBtn = new QToolButton( this );
75   myBackgroundBtn->setMinimumWidth(20);
76
77   // scale mode
78   QGroupBox* aScaleGrp = new QGroupBox( tr( "PLOT2D_SCALE_TLT" ), this );
79   aScaleGrp->setColumnLayout(0, Qt::Vertical );
80   aScaleGrp->layout()->setSpacing( 0 );  aScaleGrp->layout()->setMargin( 0 );
81   QGridLayout* aScaleLayout = new QGridLayout( aScaleGrp->layout() );
82   aScaleLayout->setMargin( MARGIN_SIZE ); aScaleLayout->setSpacing( SPACING_SIZE );
83
84   QLabel* xScaleLab = new QLabel( tr( "PLOT2D_SCALE_MODE_HOR" ), aScaleGrp );
85   myXModeCombo = new QComboBox( false, aScaleGrp );
86   myXModeCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
87   myXModeCombo->setMinimumWidth( MIN_COMBO_WIDTH );
88   myXModeCombo->insertItem( tr( "PLOT2D_SCALE_MODE_LINEAR" ) );
89   myXModeCombo->insertItem( tr( "PLOT2D_SCALE_MODE_LOGARITHMIC" ) );
90   QLabel* yScaleLab = new QLabel( tr( "PLOT2D_SCALE_MODE_VER" ), aScaleGrp );
91   myYModeCombo = new QComboBox( false, aScaleGrp );
92   myYModeCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
93   myYModeCombo->setMinimumWidth( MIN_COMBO_WIDTH );
94   myYModeCombo->insertItem( tr( "PLOT2D_SCALE_MODE_LINEAR" ) );
95   myYModeCombo->insertItem( tr( "PLOT2D_SCALE_MODE_LOGARITHMIC" ) );
96
97   aScaleLayout->addWidget( xScaleLab,    0, 0 );
98   aScaleLayout->addWidget( myXModeCombo, 0, 1 );
99   aScaleLayout->addWidget( yScaleLab,    0, 2 );
100   aScaleLayout->addWidget( myYModeCombo, 0, 3 );
101
102   // tab widget for choose properties of axis 
103   QTabWidget* aTabWidget = new QTabWidget( this, "tabWidget" );
104
105   // widget for parameters on Ox
106   QWidget* aXWidget = new QWidget(aTabWidget);
107   QGridLayout* aXLayout = new QGridLayout( aXWidget ); 
108   aXLayout->setSpacing( SPACING_SIZE );
109   aXLayout->setMargin( MARGIN_SIZE );
110   // axis title
111   myTitleXCheck = new QCheckBox( tr( "PLOT2D_ENABLE_HOR_TITLE" ), aXWidget );
112   myTitleXEdit  = new QLineEdit( aXWidget );
113   myTitleXEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
114   myTitleXEdit->setMinimumWidth( MIN_EDIT_WIDTH );
115   aXLayout->addWidget( myTitleXCheck,         1,    0    );
116   aXLayout->addMultiCellWidget( myTitleXEdit, 1, 1, 1, 3 );
117   // grid
118   QGroupBox* aGridGrpX = new QGroupBox( tr( "PLOT2D_GRID_TLT" ), aXWidget );
119   aGridGrpX->setColumnLayout(0, Qt::Vertical );
120   aGridGrpX->layout()->setSpacing( 0 );  aGridGrpX->layout()->setMargin( 0 );
121   QGridLayout* aGridLayoutX = new QGridLayout( aGridGrpX->layout() );
122   aGridLayoutX->setMargin( MARGIN_SIZE ); aGridLayoutX->setSpacing( SPACING_SIZE );
123   myXGridCheck      = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_HOR_MAJOR" ), aGridGrpX );
124   myXGridSpin       = new QSpinBox( 1, 100, 1, aGridGrpX );
125   myXGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
126   myXGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
127   myXMinGridCheck      = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_HOR_MINOR" ), aGridGrpX );
128   myXMinGridSpin       = new QSpinBox( 1, 100, 1, aGridGrpX );
129   myXMinGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
130   myXMinGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
131
132   aGridLayoutX->addWidget( myXGridCheck,    0, 0 );
133   aGridLayoutX->addWidget( myXGridSpin,     0, 1 );
134   aGridLayoutX->addWidget( myXMinGridCheck, 1, 0 );
135   aGridLayoutX->addWidget( myXMinGridSpin,  1, 1 );
136   aXLayout->addMultiCellWidget( aGridGrpX, 3, 3, 0, 3 );
137
138   aTabWidget->addTab( aXWidget, tr( "INF_AXES_X" ) );
139
140   // widget for parameters on Oy
141   QWidget* aYWidget = new QWidget(aTabWidget);
142   QGridLayout* aYLayout = new QGridLayout( aYWidget ); 
143   aYLayout->setSpacing( SPACING_SIZE );
144   aYLayout->setMargin( MARGIN_SIZE );
145   // axis title
146   myTitleYCheck = new QCheckBox( tr( "PLOT2D_ENABLE_VER_TITLE" ), aYWidget );
147   myTitleYEdit  = new QLineEdit( aYWidget );
148   myTitleYEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
149   myTitleYEdit->setMinimumWidth( MIN_EDIT_WIDTH );
150   aYLayout->addWidget( myTitleYCheck,         1,    0    );
151   aYLayout->addMultiCellWidget( myTitleYEdit, 1, 1, 1, 3 );
152   // grid
153   QGroupBox* aGridGrpY = new QGroupBox( tr( "PLOT2D_GRID_TLT" ), aYWidget );
154   aGridGrpY->setColumnLayout(0, Qt::Vertical );
155   aGridGrpY->layout()->setSpacing( 0 );  aGridGrpY->layout()->setMargin( 0 );
156   QGridLayout* aGridLayoutY = new QGridLayout( aGridGrpY->layout() );
157   aGridLayoutY->setMargin( MARGIN_SIZE ); aGridLayoutY->setSpacing( SPACING_SIZE );
158   myYGridCheck      = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MAJOR" ), aGridGrpY );
159   myYGridSpin       = new QSpinBox( 1, 100, 1, aGridGrpY );
160   myYGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
161   myYGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
162   myYMinGridCheck      = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MINOR" ), aGridGrpY );
163   myYMinGridSpin       = new QSpinBox( 1, 100, 1, aGridGrpY );
164   myYMinGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
165   myYMinGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
166
167   aGridLayoutY->addWidget( myYGridCheck,    0, 0 );
168   aGridLayoutY->addWidget( myYGridSpin,     0, 1 );
169   aGridLayoutY->addWidget( myYMinGridCheck, 1, 0 );
170   aGridLayoutY->addWidget( myYMinGridSpin,  1, 1 );
171   aYLayout->addMultiCellWidget( aGridGrpY, 3, 3, 0, 3 );
172
173   aTabWidget->addTab( aYWidget, tr( "INF_AXES_Y_LEFT" ) );
174
175   // if exist second axis Oy, addition new tab widget for right axis
176   if (mySecondAxisY) {
177     // widget for parameters on Oy
178     QWidget* aYWidget2 = new QWidget(aTabWidget);
179     QGridLayout* aYLayout2 = new QGridLayout( aYWidget2 );
180     aYLayout2->setSpacing( SPACING_SIZE );
181     aYLayout2->setMargin( MARGIN_SIZE );
182     // axis title
183     myTitleY2Check = new QCheckBox( tr( "PLOT2D_ENABLE_VER_TITLE" ), aYWidget2 );
184     myTitleY2Edit  = new QLineEdit( aYWidget2 );
185     myTitleY2Edit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
186     myTitleY2Edit->setMinimumWidth( MIN_EDIT_WIDTH );
187     aYLayout2->addWidget( myTitleY2Check,         1,    0    );
188     aYLayout2->addMultiCellWidget( myTitleY2Edit, 1, 1, 1, 3 );
189     // grid
190     QGroupBox* aGridGrpY2 = new QGroupBox( tr( "PLOT2D_GRID_TLT" ), aYWidget2 );
191     aGridGrpY2->setColumnLayout(0, Qt::Vertical );
192     aGridGrpY2->layout()->setSpacing( 0 );  aGridGrpY2->layout()->setMargin( 0 );
193     QGridLayout* aGridLayoutY2 = new QGridLayout( aGridGrpY2->layout() );
194     aGridLayoutY2->setMargin( MARGIN_SIZE ); aGridLayoutY2->setSpacing( SPACING_SIZE );
195     myY2GridCheck      = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MAJOR" ), aGridGrpY2 );
196     myY2GridSpin       = new QSpinBox( 1, 100, 1, aGridGrpY2 );
197     myY2GridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
198     myY2GridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
199     myY2MinGridCheck      = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MINOR" ), aGridGrpY2 );
200     myY2MinGridSpin       = new QSpinBox( 1, 100, 1, aGridGrpY2 );
201     myY2MinGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
202     myY2MinGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
203
204     aGridLayoutY2->addWidget( myY2GridCheck,    0, 0 );
205     aGridLayoutY2->addWidget( myY2GridSpin,     0, 1 );
206     aGridLayoutY2->addWidget( myY2MinGridCheck, 1, 0 );
207     aGridLayoutY2->addWidget( myY2MinGridSpin,  1, 1 );
208     aYLayout2->addMultiCellWidget( aGridGrpY2, 3, 3, 0, 3 );
209
210     aTabWidget->addTab( aYWidget2, tr( "INF_AXES_Y_RIGHT" ) );
211   }
212   else {
213     myTitleY2Check   = 0;
214     myTitleY2Edit    = 0;
215     myY2GridCheck    = 0;
216     myY2GridSpin     = 0;
217     myY2MinGridCheck = 0;
218     myY2MinGridSpin  = 0;
219     myY2ModeCombo    = 0;
220   }
221   aTabWidget->setCurrentPage( 0 );
222   /* "Set as default" check box */
223   myDefCheck = new QCheckBox( tr( "PLOT2D_SET_AS_DEFAULT_CHECK" ), this );
224   /* OK/Cancel buttons */
225   myOkBtn = new QPushButton( tr( "BUT_OK" ), this );
226   myOkBtn->setAutoDefault( TRUE );
227   myOkBtn->setDefault( TRUE );
228   myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this );
229   myCancelBtn->setAutoDefault( TRUE );
230   QHBoxLayout* btnLayout = new QHBoxLayout;
231   btnLayout->addWidget( myOkBtn );
232   btnLayout->addStretch();
233   btnLayout->addWidget( myCancelBtn );
234   
235   // layout widgets
236   topLayout->addWidget( myTitleCheck,          0,    0    );
237   topLayout->addMultiCellWidget( myTitleEdit,  0, 0, 1, 3 );
238   topLayout->addWidget( aCurveLab,             1,    0    );
239   topLayout->addWidget( myCurveCombo,          1,    1    );
240   topLayout->addWidget( myLegendCheck,         1,    2    );
241   topLayout->addWidget( myLegendCombo,         1,    3    );
242   topLayout->addWidget( aMarkerLab,            2,    0    );
243   topLayout->addWidget( myMarkerSpin,          2,    1    );
244   QHBoxLayout* bgLayout = new QHBoxLayout;
245   bgLayout->addWidget( myBackgroundBtn ); bgLayout->addStretch();
246   topLayout->addWidget( aBGLab,                2,    2    );
247   topLayout->addLayout( bgLayout,              2,    3    );
248   topLayout->addMultiCellWidget( aScaleGrp,    3, 3, 0, 3 );
249   topLayout->addMultiCellWidget( aTabWidget,   4, 4, 0, 3 );
250   topLayout->addMultiCellWidget( myDefCheck,   5, 5, 0, 3 );
251   topLayout->setRowStretch( 5, 5 );
252
253   topLayout->addMultiCellLayout( btnLayout,    6, 6, 0, 3 );
254   
255   if ( !showDefCheck )
256     myDefCheck->hide();
257
258   connect( myTitleCheck,    SIGNAL( clicked() ), this, SLOT( onMainTitleChecked() ) );
259   connect( myTitleXCheck,   SIGNAL( clicked() ), this, SLOT( onXTitleChecked() ) );
260   connect( myTitleYCheck,   SIGNAL( clicked() ), this, SLOT( onYTitleChecked() ) );
261   connect( myBackgroundBtn, SIGNAL( clicked() ), this, SLOT( onBackgroundClicked() ) );
262   connect( myLegendCheck,   SIGNAL( clicked() ), this, SLOT( onLegendChecked() ) );
263   connect( myXGridCheck,    SIGNAL( clicked() ), this, SLOT( onXGridMajorChecked() ) );
264   connect( myYGridCheck,    SIGNAL( clicked() ), this, SLOT( onYGridMajorChecked() ) );
265   connect( myXMinGridCheck, SIGNAL( clicked() ), this, SLOT( onXGridMinorChecked() ) );
266   connect( myYMinGridCheck, SIGNAL( clicked() ), this, SLOT( onYGridMinorChecked() ) );
267
268   connect( myOkBtn,         SIGNAL( clicked() ), this, SLOT( accept() ) );
269   connect( myCancelBtn,     SIGNAL( clicked() ), this, SLOT( reject() ) );
270   
271   if (mySecondAxisY) {
272     connect( myTitleY2Check,   SIGNAL( clicked() ), this, SLOT( onY2TitleChecked() ) );
273     connect( myY2GridCheck,    SIGNAL( clicked() ), this, SLOT( onY2GridMajorChecked() ) );
274     connect( myY2MinGridCheck, SIGNAL( clicked() ), this, SLOT( onY2GridMinorChecked() ) );
275   }
276
277   // init fields
278   setBackgroundColor( Qt::gray );
279   onMainTitleChecked();
280   onXTitleChecked();
281   onYTitleChecked();
282   onLegendChecked();
283   onXGridMajorChecked();
284   onYGridMajorChecked();
285   onXGridMinorChecked();
286   if (mySecondAxisY) {
287     onY2TitleChecked();
288     onY2GridMajorChecked();
289     onY2GridMinorChecked();
290   }
291 }
292
293 /*!
294   Destructor
295 */
296 Plot2d_SetupViewDlg::~Plot2d_SetupViewDlg()
297 {
298 }
299 /*!
300   Sets main title attributes
301 */
302 void Plot2d_SetupViewDlg::setMainTitle( bool enable, const QString& title )
303 {
304   myTitleCheck->setChecked( enable );
305   if ( !title.isNull() )
306     myTitleEdit->setText( title );
307   onMainTitleChecked();
308 }
309 /*!
310   Returns TRUE if main title is enabled
311 */
312 bool Plot2d_SetupViewDlg::isMainTitleEnabled()
313 {
314   return myTitleCheck->isChecked();
315 }
316 /*!
317   Gets main title
318 */
319 QString Plot2d_SetupViewDlg::getMainTitle()
320 {
321   return myTitleEdit->text();
322 }
323 /*!
324   Sets horizontal axis title attributes
325 */
326 void Plot2d_SetupViewDlg::setXTitle( bool enable, const QString& title )
327 {
328   myTitleXCheck->setChecked( enable );
329   if ( !title.isNull() )
330     myTitleXEdit->setText( title );
331   onXTitleChecked();
332 }
333 /*!
334   Returns TRUE if horizontal axis title is enabled
335 */
336 bool Plot2d_SetupViewDlg::isXTitleEnabled()
337 {
338   return myTitleXCheck->isChecked();
339 }
340 /*!
341   Gets horizontal axis title
342 */
343 QString Plot2d_SetupViewDlg::getXTitle()
344 {
345   return myTitleXEdit->text();
346 }
347 /*!
348   Sets vertical left axis title attributes
349 */
350 void Plot2d_SetupViewDlg::setYTitle( bool enable, const QString& title )
351 {
352   myTitleYCheck->setChecked( enable );
353   if ( !title.isNull() )
354     myTitleYEdit->setText( title );
355   onYTitleChecked();
356 }
357 /*!
358   Sets vertical right axis title attributes
359 */
360 void Plot2d_SetupViewDlg::setY2Title( bool enable, const QString& title )
361 {
362   myTitleY2Check->setChecked( enable );
363   if ( !title.isNull() )
364     myTitleY2Edit->setText( title );
365   onY2TitleChecked();
366 }
367 /*!
368   Returns TRUE if vertical left axis title is enabled
369 */
370 bool Plot2d_SetupViewDlg::isYTitleEnabled()
371 {
372   return myTitleYCheck->isChecked();
373 }
374 /*!
375   Returns TRUE if vertical right axis title is enabled
376 */
377 bool Plot2d_SetupViewDlg::isY2TitleEnabled()
378 {
379   return myTitleY2Check->isChecked();
380 }
381 /*!
382   Gets vertical left axis title
383 */
384 QString Plot2d_SetupViewDlg::getYTitle()
385 {
386   return myTitleYEdit->text();
387 }
388 /*!
389   Gets vertical right axis title
390 */
391 QString Plot2d_SetupViewDlg::getY2Title()
392 {
393   return myTitleY2Edit->text();
394 }
395 /*!
396   Sets curve type : 0 - points, 1 - lines, 2 - splines
397 */
398 void Plot2d_SetupViewDlg::setCurveType( const int type )
399 {
400   myCurveCombo->setCurrentItem( type );
401 }
402 /*!
403   Gets curve type : 0 - points, 1 - lines, 2 - splines
404 */
405 int Plot2d_SetupViewDlg::getCurveType()
406 {
407   return myCurveCombo->currentItem();
408 }
409 /*!
410   Sets legend attributes : pos = 0 - left, 1 - right, 2 - top, 3 - bottom
411 */
412 void Plot2d_SetupViewDlg::setLegend( bool enable, int pos )
413 {
414   myLegendCheck->setChecked( enable );
415   myLegendCombo->setCurrentItem( pos );
416   onLegendChecked();
417 }
418 /*!
419   Returns TRUE if legend is enabled
420 */
421 bool Plot2d_SetupViewDlg::isLegendEnabled()
422 {
423   return myLegendCheck->isChecked();
424 }
425 /*!
426   Returns legend position
427 */
428 int Plot2d_SetupViewDlg::getLegendPos()
429 {
430   return myLegendCombo->currentItem();
431 }
432 /*!
433   Sets marker size
434 */
435 void Plot2d_SetupViewDlg::setMarkerSize( const int size )
436 {
437   myMarkerSpin->setValue( size );
438 }
439 /*!
440   Gets marker size
441 */
442 int Plot2d_SetupViewDlg::getMarkerSize()
443 {
444   return myMarkerSpin->value();
445 }
446 /*!
447   Sets background color
448 */
449 void Plot2d_SetupViewDlg::setBackgroundColor( const QColor& color )
450 {
451   QPalette pal = myBackgroundBtn->palette();
452   QColorGroup ca = pal.active();
453   ca.setColor( QColorGroup::Button, color );
454   QColorGroup ci = pal.inactive();
455   ci.setColor( QColorGroup::Button, color );
456   pal.setActive( ca );
457   pal.setInactive( ci );
458   myBackgroundBtn->setPalette( pal );
459 }
460 /*!
461   Gets background color
462 */
463 QColor Plot2d_SetupViewDlg::getBackgroundColor()
464 {
465   return myBackgroundBtn->palette().active().button();
466 }
467 /*!
468   Sets major grid parameters
469 */
470 void Plot2d_SetupViewDlg::setMajorGrid( bool enableX, const int divX,
471                                         bool enableY, const int divY,
472                                         bool enableY2, const int divY2  )
473 {
474   myXGridCheck->setChecked( enableX );
475   myXGridSpin->setValue( divX );
476   myYGridCheck->setChecked( enableY );
477   myYGridSpin->setValue( divY );
478   onXGridMajorChecked();
479   onYGridMajorChecked();
480   if (mySecondAxisY) {
481     myY2GridCheck->setChecked( enableY2 );
482     myY2GridSpin->setValue( divY2 );
483     onY2GridMajorChecked();
484   }
485 }
486 /*!
487   Gets major grid parameters
488 */
489 void Plot2d_SetupViewDlg::getMajorGrid( bool& enableX, int& divX,
490                                         bool& enableY, int& divY,
491                                         bool& enableY2, int& divY2)
492 {
493   enableX  = myXGridCheck->isChecked();
494   divX     = myXGridSpin->value();
495   enableY  = myYGridCheck->isChecked();
496   divY     = myYGridSpin->value();
497   if (mySecondAxisY) {
498     enableY2 = myY2GridCheck->isChecked();
499     divY2    = myY2GridSpin->value();
500   }
501   else {
502     enableY2 = false;
503     divY2    = 1;
504   }
505 }
506 /*!
507   Sets minor grid parameters
508 */
509 void Plot2d_SetupViewDlg::setMinorGrid( bool enableX, const int divX,
510                                         bool enableY, const int divY,
511                                         bool enableY2, const int divY2)
512 {
513   myXMinGridCheck->setChecked( enableX );
514   myXMinGridSpin->setValue( divX );
515   myYMinGridCheck->setChecked( enableY );
516   myYMinGridSpin->setValue( divY );
517   onXGridMinorChecked();
518   onYGridMinorChecked();
519   if (mySecondAxisY) {
520     myY2MinGridCheck->setChecked( enableY2 );
521     myY2MinGridSpin->setValue( divY2 );
522     onY2GridMinorChecked();
523   }
524 }
525 /*!
526   Gets minor grid parameters
527 */
528 void Plot2d_SetupViewDlg::getMinorGrid( bool& enableX, int& divX,
529                                         bool& enableY, int& divY,
530                                         bool& enableY2, int& divY2)
531 {
532   enableX  = myXMinGridCheck->isChecked();
533   divX     = myXMinGridSpin->value();
534   enableY  = myYMinGridCheck->isChecked();
535   divY     = myYMinGridSpin->value();
536   if (mySecondAxisY) {
537     enableY2 = myY2MinGridCheck->isChecked();
538     divY2    = myY2MinGridSpin->value();
539   }
540   else {
541     enableY2 = false;
542     divY2    = 1;
543   }
544 }
545 /*!
546   Sets scale mode for hor. and ver. axes : 0 - linear, 1 - logarithmic
547 */
548 void Plot2d_SetupViewDlg::setScaleMode( const int xMode, const int yMode )
549 {
550   myXModeCombo->setCurrentItem( xMode );
551   myYModeCombo->setCurrentItem( yMode );
552 }
553 /*!
554   Gets scale mode for hor. axis : 0 - linear, 1 - logarithmic
555 */
556 int  Plot2d_SetupViewDlg::getXScaleMode()
557 {
558   return myXModeCombo->currentItem();
559 }
560 /*!
561   Gets scale mode for hor. axis : 0 - linear, 1 - logarithmic
562 */
563 int  Plot2d_SetupViewDlg::getYScaleMode()
564 {
565   return myYModeCombo->currentItem();
566 }
567 /*!
568   Slot, called when user clicks "Show main title" check box
569 */
570 void Plot2d_SetupViewDlg::onMainTitleChecked()
571 {
572   myTitleEdit->setEnabled( myTitleCheck->isChecked() );
573 }
574 /*!
575   Slot, called when user clicks "Show horizontal axis title" check box
576 */
577 void Plot2d_SetupViewDlg::onXTitleChecked()
578 {
579   myTitleXEdit->setEnabled( myTitleXCheck->isChecked() );
580 }
581 /*!
582   Slot, called when user clicks "Show vertical left axis title" check box
583 */
584 void Plot2d_SetupViewDlg::onYTitleChecked()
585 {
586   myTitleYEdit->setEnabled( myTitleYCheck->isChecked() );
587 }
588 /*!
589   Slot, called when user clicks "Show vertical right axis title" check box
590 */
591 void Plot2d_SetupViewDlg::onY2TitleChecked()
592 {
593   myTitleY2Edit->setEnabled( myTitleY2Check->isChecked() );
594 }
595 /*!
596   Slot, called when user clicks "Change bacground color" button
597 */
598 void Plot2d_SetupViewDlg::onBackgroundClicked()
599 {
600   QColor color = QColorDialog::getColor( getBackgroundColor() );
601   if ( color.isValid() ) {
602     setBackgroundColor( color );
603   }
604 }
605 /*!
606   Slot, called when user clicks "Show Legend" check box
607 */
608 void Plot2d_SetupViewDlg::onLegendChecked()
609 {
610   myLegendCombo->setEnabled( myLegendCheck->isChecked() );
611 }
612 /*!
613   Slot, called when user clicks "Enable hor. major grid" check box
614 */
615 void Plot2d_SetupViewDlg::onXGridMajorChecked()
616 {
617   myXMinGridCheck->setEnabled( myXGridCheck->isChecked() );
618 }
619 /*!
620   Slot, called when user clicks  "Enable ver. major grid" check box
621 */
622 void Plot2d_SetupViewDlg::onYGridMajorChecked()
623 {
624   myYMinGridCheck->setEnabled( myYGridCheck->isChecked() );
625 }
626 /*!
627   Slot, called when user clicks  "Enable ver. major grid" check box
628 */
629 void Plot2d_SetupViewDlg::onY2GridMajorChecked()
630 {
631   myY2MinGridCheck->setEnabled( myY2GridCheck->isChecked() );
632 }
633 /*!
634   Slot, called when user clicks  "Enable hor. minor grid" check box
635 */
636 void Plot2d_SetupViewDlg::onXGridMinorChecked()
637 {
638 }
639 /*!
640   Slot, called when user clicks  "Enable ver. minor grid" check box
641 */
642 void Plot2d_SetupViewDlg::onYGridMinorChecked()
643 {
644 }
645 /*!
646   Slot, called when user clicks  "Enable ver. minor grid" check box
647 */
648 void Plot2d_SetupViewDlg::onY2GridMinorChecked()
649 {
650 }
651 /*!
652   Retursns true if "Set as default" check box is on
653 */
654 bool Plot2d_SetupViewDlg::isSetAsDefault()
655 {
656   return myDefCheck->isChecked();
657 }