]> SALOME platform Git repositories - modules/gui.git/blob - src/Plot2d/Plot2d_SetupViewDlg.cxx
Salome HOME
0969b6b44d5b299a2722e6812ea5285c0ee927dc
[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   QLabel* aXMajLbl  = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpX);
125   myXGridSpin       = new QSpinBox( 1, 100, 1, aGridGrpX );
126   myXGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
127   myXGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
128   myXMinGridCheck      = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_HOR_MINOR" ), aGridGrpX );
129   QLabel* aXMinLbl     = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpX);
130   myXMinGridSpin       = new QSpinBox( 1, 100, 1, aGridGrpX );
131   myXMinGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
132   myXMinGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
133
134   aGridLayoutX->addWidget( myXGridCheck,    0, 0 );
135   aGridLayoutX->addWidget( aXMajLbl,        0, 1 );
136   aGridLayoutX->addWidget( myXGridSpin,     0, 2 );
137   aGridLayoutX->addWidget( myXMinGridCheck, 1, 0 );
138   aGridLayoutX->addWidget( aXMinLbl,        1, 1 );
139   aGridLayoutX->addWidget( myXMinGridSpin,  1, 2 );
140   aXLayout->addMultiCellWidget( aGridGrpX, 3, 3, 0, 3 );
141
142   aTabWidget->addTab( aXWidget, tr( "INF_AXES_X" ) );
143
144   // widget for parameters on Oy
145   QWidget* aYWidget = new QWidget(aTabWidget);
146   QGridLayout* aYLayout = new QGridLayout( aYWidget ); 
147   aYLayout->setSpacing( SPACING_SIZE );
148   aYLayout->setMargin( MARGIN_SIZE );
149   // axis title
150   myTitleYCheck = new QCheckBox( tr( "PLOT2D_ENABLE_VER_TITLE" ), aYWidget );
151   myTitleYEdit  = new QLineEdit( aYWidget );
152   myTitleYEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
153   myTitleYEdit->setMinimumWidth( MIN_EDIT_WIDTH );
154   aYLayout->addWidget( myTitleYCheck,         1,    0    );
155   aYLayout->addMultiCellWidget( myTitleYEdit, 1, 1, 1, 3 );
156   // grid
157   QGroupBox* aGridGrpY = new QGroupBox( tr( "PLOT2D_GRID_TLT" ), aYWidget );
158   aGridGrpY->setColumnLayout(0, Qt::Vertical );
159   aGridGrpY->layout()->setSpacing( 0 );  aGridGrpY->layout()->setMargin( 0 );
160   QGridLayout* aGridLayoutY = new QGridLayout( aGridGrpY->layout() );
161   aGridLayoutY->setMargin( MARGIN_SIZE ); aGridLayoutY->setSpacing( SPACING_SIZE );
162   myYGridCheck      = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MAJOR" ), aGridGrpY );
163   QLabel* aYMajLbl  = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpY);
164   myYGridSpin       = new QSpinBox( 1, 100, 1, aGridGrpY );
165   myYGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
166   myYGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
167   myYMinGridCheck      = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MINOR" ), aGridGrpY );
168   QLabel* aYMinLbl     = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpY);
169   myYMinGridSpin       = new QSpinBox( 1, 100, 1, aGridGrpY );
170   myYMinGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
171   myYMinGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
172
173   aGridLayoutY->addWidget( myYGridCheck,    0, 0 );
174   aGridLayoutY->addWidget( aYMajLbl,        0, 1 );
175   aGridLayoutY->addWidget( myYGridSpin,     0, 2 );
176   aGridLayoutY->addWidget( myYMinGridCheck, 1, 0 );
177   aGridLayoutY->addWidget( aYMinLbl,        1, 1 );
178   aGridLayoutY->addWidget( myYMinGridSpin,  1, 2 );
179   aYLayout->addMultiCellWidget( aGridGrpY, 3, 3, 0, 3 );
180
181   aTabWidget->addTab( aYWidget, tr( "INF_AXES_Y_LEFT" ) );
182
183   // if exist second axis Oy, addition new tab widget for right axis
184   if (mySecondAxisY) {
185     // widget for parameters on Oy
186     QWidget* aYWidget2 = new QWidget(aTabWidget);
187     QGridLayout* aYLayout2 = new QGridLayout( aYWidget2 );
188     aYLayout2->setSpacing( SPACING_SIZE );
189     aYLayout2->setMargin( MARGIN_SIZE );
190     // axis title
191     myTitleY2Check = new QCheckBox( tr( "PLOT2D_ENABLE_VER_TITLE" ), aYWidget2 );
192     myTitleY2Edit  = new QLineEdit( aYWidget2 );
193     myTitleY2Edit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
194     myTitleY2Edit->setMinimumWidth( MIN_EDIT_WIDTH );
195     aYLayout2->addWidget( myTitleY2Check,         1,    0    );
196     aYLayout2->addMultiCellWidget( myTitleY2Edit, 1, 1, 1, 3 );
197     // grid
198     QGroupBox* aGridGrpY2 = new QGroupBox( tr( "PLOT2D_GRID_TLT" ), aYWidget2 );
199     aGridGrpY2->setColumnLayout(0, Qt::Vertical );
200     aGridGrpY2->layout()->setSpacing( 0 );  aGridGrpY2->layout()->setMargin( 0 );
201     QGridLayout* aGridLayoutY2 = new QGridLayout( aGridGrpY2->layout() );
202     aGridLayoutY2->setMargin( MARGIN_SIZE ); aGridLayoutY2->setSpacing( SPACING_SIZE );
203     myY2GridCheck      = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MAJOR" ), aGridGrpY2 );
204     QLabel* aY2MajLbl  = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpY2);
205     myY2GridSpin       = new QSpinBox( 1, 100, 1, aGridGrpY2 );
206     myY2GridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
207     myY2GridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
208     myY2MinGridCheck      = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MINOR" ), aGridGrpY2 );
209     QLabel* aY2MinLbl     = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpY2);
210     myY2MinGridSpin       = new QSpinBox( 1, 100, 1, aGridGrpY2 );
211     myY2MinGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
212     myY2MinGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
213
214     aGridLayoutY2->addWidget( myY2GridCheck,    0, 0 );
215     aGridLayoutY2->addWidget( aY2MajLbl,        0, 1 );
216     aGridLayoutY2->addWidget( myY2GridSpin,     0, 2 );
217     aGridLayoutY2->addWidget( myY2MinGridCheck, 1, 0 );
218     aGridLayoutY2->addWidget( aY2MinLbl,        1, 1 );
219     aGridLayoutY2->addWidget( myY2MinGridSpin,  1, 2 );
220     aYLayout2->addMultiCellWidget( aGridGrpY2, 3, 3, 0, 3 );
221
222     aTabWidget->addTab( aYWidget2, tr( "INF_AXES_Y_RIGHT" ) );
223   }
224   else {
225     myTitleY2Check   = 0;
226     myTitleY2Edit    = 0;
227     myY2GridCheck    = 0;
228     myY2GridSpin     = 0;
229     myY2MinGridCheck = 0;
230     myY2MinGridSpin  = 0;
231     myY2ModeCombo    = 0;
232   }
233   aTabWidget->setCurrentPage( 0 );
234   /* "Set as default" check box */
235   myDefCheck = new QCheckBox( tr( "PLOT2D_SET_AS_DEFAULT_CHECK" ), this );
236   /* OK/Cancel buttons */
237   myOkBtn = new QPushButton( tr( "BUT_OK" ), this );
238   myOkBtn->setAutoDefault( TRUE );
239   myOkBtn->setDefault( TRUE );
240   myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this );
241   myCancelBtn->setAutoDefault( TRUE );
242   QHBoxLayout* btnLayout = new QHBoxLayout;
243   btnLayout->addWidget( myOkBtn );
244   btnLayout->addStretch();
245   btnLayout->addWidget( myCancelBtn );
246   
247   // layout widgets
248   topLayout->addWidget( myTitleCheck,          0,    0    );
249   topLayout->addMultiCellWidget( myTitleEdit,  0, 0, 1, 3 );
250   topLayout->addWidget( aCurveLab,             1,    0    );
251   topLayout->addWidget( myCurveCombo,          1,    1    );
252   topLayout->addWidget( myLegendCheck,         1,    2    );
253   topLayout->addWidget( myLegendCombo,         1,    3    );
254   topLayout->addWidget( aMarkerLab,            2,    0    );
255   topLayout->addWidget( myMarkerSpin,          2,    1    );
256   QHBoxLayout* bgLayout = new QHBoxLayout;
257   bgLayout->addWidget( myBackgroundBtn ); bgLayout->addStretch();
258   topLayout->addWidget( aBGLab,                2,    2    );
259   topLayout->addLayout( bgLayout,              2,    3    );
260   topLayout->addMultiCellWidget( aScaleGrp,    3, 3, 0, 3 );
261   topLayout->addMultiCellWidget( aTabWidget,   4, 4, 0, 3 );
262   topLayout->addMultiCellWidget( myDefCheck,   5, 5, 0, 3 );
263   topLayout->setRowStretch( 5, 5 );
264
265   topLayout->addMultiCellLayout( btnLayout,    6, 6, 0, 3 );
266   
267   if ( !showDefCheck )
268     myDefCheck->hide();
269
270   connect( myTitleCheck,    SIGNAL( clicked() ), this, SLOT( onMainTitleChecked() ) );
271   connect( myTitleXCheck,   SIGNAL( clicked() ), this, SLOT( onXTitleChecked() ) );
272   connect( myTitleYCheck,   SIGNAL( clicked() ), this, SLOT( onYTitleChecked() ) );
273   connect( myBackgroundBtn, SIGNAL( clicked() ), this, SLOT( onBackgroundClicked() ) );
274   connect( myLegendCheck,   SIGNAL( clicked() ), this, SLOT( onLegendChecked() ) );
275   connect( myXGridCheck,    SIGNAL( clicked() ), this, SLOT( onXGridMajorChecked() ) );
276   connect( myYGridCheck,    SIGNAL( clicked() ), this, SLOT( onYGridMajorChecked() ) );
277   connect( myXMinGridCheck, SIGNAL( clicked() ), this, SLOT( onXGridMinorChecked() ) );
278   connect( myYMinGridCheck, SIGNAL( clicked() ), this, SLOT( onYGridMinorChecked() ) );
279
280   connect( myOkBtn,         SIGNAL( clicked() ), this, SLOT( accept() ) );
281   connect( myCancelBtn,     SIGNAL( clicked() ), this, SLOT( reject() ) );
282   
283   if (mySecondAxisY) {
284     connect( myTitleY2Check,   SIGNAL( clicked() ), this, SLOT( onY2TitleChecked() ) );
285     connect( myY2GridCheck,    SIGNAL( clicked() ), this, SLOT( onY2GridMajorChecked() ) );
286     connect( myY2MinGridCheck, SIGNAL( clicked() ), this, SLOT( onY2GridMinorChecked() ) );
287   }
288
289   // init fields
290   setBackgroundColor( Qt::gray );
291   onMainTitleChecked();
292   onXTitleChecked();
293   onYTitleChecked();
294   onLegendChecked();
295   onXGridMajorChecked();
296   onYGridMajorChecked();
297   onXGridMinorChecked();
298   if (mySecondAxisY) {
299     onY2TitleChecked();
300     onY2GridMajorChecked();
301     onY2GridMinorChecked();
302   }
303 }
304
305 /*!
306   Destructor
307 */
308 Plot2d_SetupViewDlg::~Plot2d_SetupViewDlg()
309 {
310 }
311 /*!
312   Sets main title attributes
313 */
314 void Plot2d_SetupViewDlg::setMainTitle( bool enable, const QString& title )
315 {
316   myTitleCheck->setChecked( enable );
317   if ( !title.isNull() )
318     myTitleEdit->setText( title );
319   onMainTitleChecked();
320 }
321 /*!
322   Returns TRUE if main title is enabled
323 */
324 bool Plot2d_SetupViewDlg::isMainTitleEnabled()
325 {
326   return myTitleCheck->isChecked();
327 }
328 /*!
329   Gets main title
330 */
331 QString Plot2d_SetupViewDlg::getMainTitle()
332 {
333   return myTitleEdit->text();
334 }
335 /*!
336   Sets horizontal axis title attributes
337 */
338 void Plot2d_SetupViewDlg::setXTitle( bool enable, const QString& title )
339 {
340   myTitleXCheck->setChecked( enable );
341   if ( !title.isNull() )
342     myTitleXEdit->setText( title );
343   onXTitleChecked();
344 }
345 /*!
346   Returns TRUE if horizontal axis title is enabled
347 */
348 bool Plot2d_SetupViewDlg::isXTitleEnabled()
349 {
350   return myTitleXCheck->isChecked();
351 }
352 /*!
353   Gets horizontal axis title
354 */
355 QString Plot2d_SetupViewDlg::getXTitle()
356 {
357   return myTitleXEdit->text();
358 }
359 /*!
360   Sets vertical left axis title attributes
361 */
362 void Plot2d_SetupViewDlg::setYTitle( bool enable, const QString& title )
363 {
364   myTitleYCheck->setChecked( enable );
365   if ( !title.isNull() )
366     myTitleYEdit->setText( title );
367   onYTitleChecked();
368 }
369 /*!
370   Sets vertical right axis title attributes
371 */
372 void Plot2d_SetupViewDlg::setY2Title( bool enable, const QString& title )
373 {
374   myTitleY2Check->setChecked( enable );
375   if ( !title.isNull() )
376     myTitleY2Edit->setText( title );
377   onY2TitleChecked();
378 }
379 /*!
380   Returns TRUE if vertical left axis title is enabled
381 */
382 bool Plot2d_SetupViewDlg::isYTitleEnabled()
383 {
384   return myTitleYCheck->isChecked();
385 }
386 /*!
387   Returns TRUE if vertical right axis title is enabled
388 */
389 bool Plot2d_SetupViewDlg::isY2TitleEnabled()
390 {
391   return myTitleY2Check->isChecked();
392 }
393 /*!
394   Gets vertical left axis title
395 */
396 QString Plot2d_SetupViewDlg::getYTitle()
397 {
398   return myTitleYEdit->text();
399 }
400 /*!
401   Gets vertical right axis title
402 */
403 QString Plot2d_SetupViewDlg::getY2Title()
404 {
405   return myTitleY2Edit->text();
406 }
407 /*!
408   Sets curve type : 0 - points, 1 - lines, 2 - splines
409 */
410 void Plot2d_SetupViewDlg::setCurveType( const int type )
411 {
412   myCurveCombo->setCurrentItem( type );
413 }
414 /*!
415   Gets curve type : 0 - points, 1 - lines, 2 - splines
416 */
417 int Plot2d_SetupViewDlg::getCurveType()
418 {
419   return myCurveCombo->currentItem();
420 }
421 /*!
422   Sets legend attributes : pos = 0 - left, 1 - right, 2 - top, 3 - bottom
423 */
424 void Plot2d_SetupViewDlg::setLegend( bool enable, int pos )
425 {
426   myLegendCheck->setChecked( enable );
427   myLegendCombo->setCurrentItem( pos );
428   onLegendChecked();
429 }
430 /*!
431   Returns TRUE if legend is enabled
432 */
433 bool Plot2d_SetupViewDlg::isLegendEnabled()
434 {
435   return myLegendCheck->isChecked();
436 }
437 /*!
438   Returns legend position
439 */
440 int Plot2d_SetupViewDlg::getLegendPos()
441 {
442   return myLegendCombo->currentItem();
443 }
444 /*!
445   Sets marker size
446 */
447 void Plot2d_SetupViewDlg::setMarkerSize( const int size )
448 {
449   myMarkerSpin->setValue( size );
450 }
451 /*!
452   Gets marker size
453 */
454 int Plot2d_SetupViewDlg::getMarkerSize()
455 {
456   return myMarkerSpin->value();
457 }
458 /*!
459   Sets background color
460 */
461 void Plot2d_SetupViewDlg::setBackgroundColor( const QColor& color )
462 {
463   QPalette pal = myBackgroundBtn->palette();
464   QColorGroup ca = pal.active();
465   ca.setColor( QColorGroup::Button, color );
466   QColorGroup ci = pal.inactive();
467   ci.setColor( QColorGroup::Button, color );
468   pal.setActive( ca );
469   pal.setInactive( ci );
470   myBackgroundBtn->setPalette( pal );
471 }
472 /*!
473   Gets background color
474 */
475 QColor Plot2d_SetupViewDlg::getBackgroundColor()
476 {
477   return myBackgroundBtn->palette().active().button();
478 }
479 /*!
480   Sets major grid parameters
481 */
482 void Plot2d_SetupViewDlg::setMajorGrid( bool enableX, const int divX,
483                                         bool enableY, const int divY,
484                                         bool enableY2, const int divY2  )
485 {
486   myXGridCheck->setChecked( enableX );
487   myXGridSpin->setValue( divX );
488   myYGridCheck->setChecked( enableY );
489   myYGridSpin->setValue( divY );
490   onXGridMajorChecked();
491   onYGridMajorChecked();
492   if (mySecondAxisY) {
493     myY2GridCheck->setChecked( enableY2 );
494     myY2GridSpin->setValue( divY2 );
495     onY2GridMajorChecked();
496   }
497 }
498 /*!
499   Gets major grid parameters
500 */
501 void Plot2d_SetupViewDlg::getMajorGrid( bool& enableX, int& divX,
502                                         bool& enableY, int& divY,
503                                         bool& enableY2, int& divY2)
504 {
505   enableX  = myXGridCheck->isChecked();
506   divX     = myXGridSpin->value();
507   enableY  = myYGridCheck->isChecked();
508   divY     = myYGridSpin->value();
509   if (mySecondAxisY) {
510     enableY2 = myY2GridCheck->isChecked();
511     divY2    = myY2GridSpin->value();
512   }
513   else {
514     enableY2 = false;
515     divY2    = 1;
516   }
517 }
518 /*!
519   Sets minor grid parameters
520 */
521 void Plot2d_SetupViewDlg::setMinorGrid( bool enableX, const int divX,
522                                         bool enableY, const int divY,
523                                         bool enableY2, const int divY2)
524 {
525   myXMinGridCheck->setChecked( enableX );
526   myXMinGridSpin->setValue( divX );
527   myYMinGridCheck->setChecked( enableY );
528   myYMinGridSpin->setValue( divY );
529   onXGridMinorChecked();
530   onYGridMinorChecked();
531   if (mySecondAxisY) {
532     myY2MinGridCheck->setChecked( enableY2 );
533     myY2MinGridSpin->setValue( divY2 );
534     onY2GridMinorChecked();
535   }
536 }
537 /*!
538   Gets minor grid parameters
539 */
540 void Plot2d_SetupViewDlg::getMinorGrid( bool& enableX, int& divX,
541                                         bool& enableY, int& divY,
542                                         bool& enableY2, int& divY2)
543 {
544   enableX  = myXMinGridCheck->isChecked();
545   divX     = myXMinGridSpin->value();
546   enableY  = myYMinGridCheck->isChecked();
547   divY     = myYMinGridSpin->value();
548   if (mySecondAxisY) {
549     enableY2 = myY2MinGridCheck->isChecked();
550     divY2    = myY2MinGridSpin->value();
551   }
552   else {
553     enableY2 = false;
554     divY2    = 1;
555   }
556 }
557 /*!
558   Sets scale mode for hor. and ver. axes : 0 - linear, 1 - logarithmic
559 */
560 void Plot2d_SetupViewDlg::setScaleMode( const int xMode, const int yMode )
561 {
562   myXModeCombo->setCurrentItem( xMode );
563   myYModeCombo->setCurrentItem( yMode );
564 }
565 /*!
566   Gets scale mode for hor. axis : 0 - linear, 1 - logarithmic
567 */
568 int  Plot2d_SetupViewDlg::getXScaleMode()
569 {
570   return myXModeCombo->currentItem();
571 }
572 /*!
573   Gets scale mode for hor. axis : 0 - linear, 1 - logarithmic
574 */
575 int  Plot2d_SetupViewDlg::getYScaleMode()
576 {
577   return myYModeCombo->currentItem();
578 }
579 /*!
580   Slot, called when user clicks "Show main title" check box
581 */
582 void Plot2d_SetupViewDlg::onMainTitleChecked()
583 {
584   myTitleEdit->setEnabled( myTitleCheck->isChecked() );
585 }
586 /*!
587   Slot, called when user clicks "Show horizontal axis title" check box
588 */
589 void Plot2d_SetupViewDlg::onXTitleChecked()
590 {
591   myTitleXEdit->setEnabled( myTitleXCheck->isChecked() );
592 }
593 /*!
594   Slot, called when user clicks "Show vertical left axis title" check box
595 */
596 void Plot2d_SetupViewDlg::onYTitleChecked()
597 {
598   myTitleYEdit->setEnabled( myTitleYCheck->isChecked() );
599 }
600 /*!
601   Slot, called when user clicks "Show vertical right axis title" check box
602 */
603 void Plot2d_SetupViewDlg::onY2TitleChecked()
604 {
605   myTitleY2Edit->setEnabled( myTitleY2Check->isChecked() );
606 }
607 /*!
608   Slot, called when user clicks "Change bacground color" button
609 */
610 void Plot2d_SetupViewDlg::onBackgroundClicked()
611 {
612   QColor color = QColorDialog::getColor( getBackgroundColor() );
613   if ( color.isValid() ) {
614     setBackgroundColor( color );
615   }
616 }
617 /*!
618   Slot, called when user clicks "Show Legend" check box
619 */
620 void Plot2d_SetupViewDlg::onLegendChecked()
621 {
622   myLegendCombo->setEnabled( myLegendCheck->isChecked() );
623 }
624 /*!
625   Slot, called when user clicks "Enable hor. major grid" check box
626 */
627 void Plot2d_SetupViewDlg::onXGridMajorChecked()
628 {
629   myXMinGridCheck->setEnabled( myXGridCheck->isChecked() );
630 }
631 /*!
632   Slot, called when user clicks  "Enable ver. major grid" check box
633 */
634 void Plot2d_SetupViewDlg::onYGridMajorChecked()
635 {
636   myYMinGridCheck->setEnabled( myYGridCheck->isChecked() );
637 }
638 /*!
639   Slot, called when user clicks  "Enable ver. major grid" check box
640 */
641 void Plot2d_SetupViewDlg::onY2GridMajorChecked()
642 {
643   myY2MinGridCheck->setEnabled( myY2GridCheck->isChecked() );
644 }
645 /*!
646   Slot, called when user clicks  "Enable hor. minor grid" check box
647 */
648 void Plot2d_SetupViewDlg::onXGridMinorChecked()
649 {
650 }
651 /*!
652   Slot, called when user clicks  "Enable ver. minor grid" check box
653 */
654 void Plot2d_SetupViewDlg::onYGridMinorChecked()
655 {
656 }
657 /*!
658   Slot, called when user clicks  "Enable ver. minor grid" check box
659 */
660 void Plot2d_SetupViewDlg::onY2GridMinorChecked()
661 {
662 }
663 /*!
664   Retursns true if "Set as default" check box is on
665 */
666 bool Plot2d_SetupViewDlg::isSetAsDefault()
667 {
668   return myDefCheck->isChecked();
669 }