1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // File : Plot2d_SetupViewDlg.cxx
20 // Author : Vadim SANDLER
24 #include "Plot2d_SetupViewDlg.h"
26 #include <qcheckbox.h>
27 #include <qlineedit.h>
28 #include <qcombobox.h>
30 #include <qtoolbutton.h>
32 #include <qgroupbox.h>
34 #include <qpushbutton.h>
35 #include <qcolordialog.h>
36 #include <qtabwidget.h>
38 #define MARGIN_SIZE 11
39 #define SPACING_SIZE 6
40 #define MIN_EDIT_WIDTH 200
41 #define MIN_COMBO_WIDTH 100
42 #define MIN_SPIN_WIDTH 70
47 Plot2d_SetupViewDlg::Plot2d_SetupViewDlg( QWidget* parent, bool showDefCheck, bool secondAxisY )
48 : QDialog( parent, "Plot2d_SetupViewDlg", true,
49 WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
51 mySecondAxisY = secondAxisY;
52 setCaption( tr("TLT_SETUP_PLOT2D_VIEW") );
53 setSizeGripEnabled( TRUE );
54 QGridLayout* topLayout = new QGridLayout( this );
55 topLayout->setSpacing( SPACING_SIZE );
56 topLayout->setMargin( MARGIN_SIZE );
59 myTitleCheck = new QCheckBox( tr( "PLOT2D_ENABLE_MAIN_TITLE" ), this );
60 myTitleEdit = new QLineEdit( this );
61 myTitleEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
62 myTitleEdit->setMinimumWidth( MIN_EDIT_WIDTH );
63 // curve type : points, lines, spline
64 QLabel* aCurveLab = new QLabel( tr( "PLOT2D_CURVE_TYPE_LBL" ), this );
65 myCurveCombo = new QComboBox( false, this );
66 myCurveCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
67 myCurveCombo->setMinimumWidth( MIN_COMBO_WIDTH );
68 myCurveCombo->insertItem( tr( "PLOT2D_CURVE_TYPE_POINTS" ) );
69 myCurveCombo->insertItem( tr( "PLOT2D_CURVE_TYPE_LINES" ) );
70 myCurveCombo->insertItem( tr( "PLOT2D_CURVE_TYPE_SPLINE" ) );
72 myLegendCheck = new QCheckBox( tr( "PLOT2D_ENABLE_LEGEND" ), this );
73 myLegendCombo = new QComboBox( false, this );
74 myLegendCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
75 myLegendCombo->setMinimumWidth( MIN_COMBO_WIDTH );
76 myLegendCombo->insertItem( tr( "PLOT2D_LEGEND_POSITION_LEFT" ) );
77 myLegendCombo->insertItem( tr( "PLOT2D_LEGEND_POSITION_RIGHT" ) );
78 myLegendCombo->insertItem( tr( "PLOT2D_LEGEND_POSITION_TOP" ) );
79 myLegendCombo->insertItem( tr( "PLOT2D_LEGEND_POSITION_BOTTOM" ) );
81 QLabel* aMarkerLab = new QLabel( tr( "PLOT2D_MARKER_SIZE_LBL" ), this );
82 myMarkerSpin = new QSpinBox( 0, 100, 1, this );
83 myMarkerSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
84 myMarkerSpin->setMinimumWidth( MIN_SPIN_WIDTH );
87 QLabel* aBGLab = new QLabel( tr( "PLOT2D_BACKGROUND_COLOR_LBL" ), this );
88 myBackgroundBtn = new QToolButton( this );
89 myBackgroundBtn->setMinimumWidth(20);
92 QGroupBox* aScaleGrp = new QGroupBox( tr( "PLOT2D_SCALE_TLT" ), this );
93 aScaleGrp->setColumnLayout(0, Qt::Vertical );
94 aScaleGrp->layout()->setSpacing( 0 ); aScaleGrp->layout()->setMargin( 0 );
95 QGridLayout* aScaleLayout = new QGridLayout( aScaleGrp->layout() );
96 aScaleLayout->setMargin( MARGIN_SIZE ); aScaleLayout->setSpacing( SPACING_SIZE );
98 QLabel* xScaleLab = new QLabel( tr( "PLOT2D_SCALE_MODE_HOR" ), aScaleGrp );
99 myXModeCombo = new QComboBox( false, aScaleGrp );
100 myXModeCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
101 myXModeCombo->setMinimumWidth( MIN_COMBO_WIDTH );
102 myXModeCombo->insertItem( tr( "PLOT2D_SCALE_MODE_LINEAR" ) );
103 myXModeCombo->insertItem( tr( "PLOT2D_SCALE_MODE_LOGARITHMIC" ) );
104 QLabel* yScaleLab = new QLabel( tr( "PLOT2D_SCALE_MODE_VER" ), aScaleGrp );
105 myYModeCombo = new QComboBox( false, aScaleGrp );
106 myYModeCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
107 myYModeCombo->setMinimumWidth( MIN_COMBO_WIDTH );
108 myYModeCombo->insertItem( tr( "PLOT2D_SCALE_MODE_LINEAR" ) );
109 myYModeCombo->insertItem( tr( "PLOT2D_SCALE_MODE_LOGARITHMIC" ) );
111 aScaleLayout->addWidget( xScaleLab, 0, 0 );
112 aScaleLayout->addWidget( myXModeCombo, 0, 1 );
113 aScaleLayout->addWidget( yScaleLab, 0, 2 );
114 aScaleLayout->addWidget( myYModeCombo, 0, 3 );
116 // tab widget for choose properties of axis
117 QTabWidget* aTabWidget = new QTabWidget( this, "tabWidget" );
119 // widget for parameters on Ox
120 QWidget* aXWidget = new QWidget(aTabWidget);
121 QGridLayout* aXLayout = new QGridLayout( aXWidget );
122 aXLayout->setSpacing( SPACING_SIZE );
123 aXLayout->setMargin( MARGIN_SIZE );
125 myTitleXCheck = new QCheckBox( tr( "PLOT2D_ENABLE_HOR_TITLE" ), aXWidget );
126 myTitleXEdit = new QLineEdit( aXWidget );
127 myTitleXEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
128 myTitleXEdit->setMinimumWidth( MIN_EDIT_WIDTH );
129 aXLayout->addWidget( myTitleXCheck, 1, 0 );
130 aXLayout->addMultiCellWidget( myTitleXEdit, 1, 1, 1, 3 );
132 QGroupBox* aGridGrpX = new QGroupBox( tr( "PLOT2D_GRID_TLT" ), aXWidget );
133 aGridGrpX->setColumnLayout(0, Qt::Vertical );
134 aGridGrpX->layout()->setSpacing( 0 ); aGridGrpX->layout()->setMargin( 0 );
135 QGridLayout* aGridLayoutX = new QGridLayout( aGridGrpX->layout() );
136 aGridLayoutX->setMargin( MARGIN_SIZE ); aGridLayoutX->setSpacing( SPACING_SIZE );
137 myXGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_HOR_MAJOR" ), aGridGrpX );
138 QLabel* aXMajLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpX);
139 myXGridSpin = new QSpinBox( 1, 100, 1, aGridGrpX );
140 myXGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
141 myXGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
142 myXMinGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_HOR_MINOR" ), aGridGrpX );
143 QLabel* aXMinLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpX);
144 myXMinGridSpin = new QSpinBox( 1, 100, 1, aGridGrpX );
145 myXMinGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
146 myXMinGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
148 aGridLayoutX->addWidget( myXGridCheck, 0, 0 );
149 aGridLayoutX->addWidget( aXMajLbl, 0, 1 );
150 aGridLayoutX->addWidget( myXGridSpin, 0, 2 );
151 aGridLayoutX->addWidget( myXMinGridCheck, 1, 0 );
152 aGridLayoutX->addWidget( aXMinLbl, 1, 1 );
153 aGridLayoutX->addWidget( myXMinGridSpin, 1, 2 );
154 aXLayout->addMultiCellWidget( aGridGrpX, 3, 3, 0, 3 );
156 aTabWidget->addTab( aXWidget, tr( "INF_AXES_X" ) );
158 // widget for parameters on Oy
159 QWidget* aYWidget = new QWidget(aTabWidget);
160 QGridLayout* aYLayout = new QGridLayout( aYWidget );
161 aYLayout->setSpacing( SPACING_SIZE );
162 aYLayout->setMargin( MARGIN_SIZE );
164 myTitleYCheck = new QCheckBox( tr( "PLOT2D_ENABLE_VER_TITLE" ), aYWidget );
165 myTitleYEdit = new QLineEdit( aYWidget );
166 myTitleYEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
167 myTitleYEdit->setMinimumWidth( MIN_EDIT_WIDTH );
168 aYLayout->addWidget( myTitleYCheck, 1, 0 );
169 aYLayout->addMultiCellWidget( myTitleYEdit, 1, 1, 1, 3 );
171 QGroupBox* aGridGrpY = new QGroupBox( tr( "PLOT2D_GRID_TLT" ), aYWidget );
172 aGridGrpY->setColumnLayout(0, Qt::Vertical );
173 aGridGrpY->layout()->setSpacing( 0 ); aGridGrpY->layout()->setMargin( 0 );
174 QGridLayout* aGridLayoutY = new QGridLayout( aGridGrpY->layout() );
175 aGridLayoutY->setMargin( MARGIN_SIZE ); aGridLayoutY->setSpacing( SPACING_SIZE );
176 myYGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MAJOR" ), aGridGrpY );
177 QLabel* aYMajLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpY);
178 myYGridSpin = new QSpinBox( 1, 100, 1, aGridGrpY );
179 myYGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
180 myYGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
181 myYMinGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MINOR" ), aGridGrpY );
182 QLabel* aYMinLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpY);
183 myYMinGridSpin = new QSpinBox( 1, 100, 1, aGridGrpY );
184 myYMinGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
185 myYMinGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
187 aGridLayoutY->addWidget( myYGridCheck, 0, 0 );
188 aGridLayoutY->addWidget( aYMajLbl, 0, 1 );
189 aGridLayoutY->addWidget( myYGridSpin, 0, 2 );
190 aGridLayoutY->addWidget( myYMinGridCheck, 1, 0 );
191 aGridLayoutY->addWidget( aYMinLbl, 1, 1 );
192 aGridLayoutY->addWidget( myYMinGridSpin, 1, 2 );
193 aYLayout->addMultiCellWidget( aGridGrpY, 3, 3, 0, 3 );
195 aTabWidget->addTab( aYWidget, tr( "INF_AXES_Y_LEFT" ) );
197 // if exist second axis Oy, addition new tab widget for right axis
199 // widget for parameters on Oy
200 QWidget* aYWidget2 = new QWidget(aTabWidget);
201 QGridLayout* aYLayout2 = new QGridLayout( aYWidget2 );
202 aYLayout2->setSpacing( SPACING_SIZE );
203 aYLayout2->setMargin( MARGIN_SIZE );
205 myTitleY2Check = new QCheckBox( tr( "PLOT2D_ENABLE_VER_TITLE" ), aYWidget2 );
206 myTitleY2Edit = new QLineEdit( aYWidget2 );
207 myTitleY2Edit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
208 myTitleY2Edit->setMinimumWidth( MIN_EDIT_WIDTH );
209 aYLayout2->addWidget( myTitleY2Check, 1, 0 );
210 aYLayout2->addMultiCellWidget( myTitleY2Edit, 1, 1, 1, 3 );
212 QGroupBox* aGridGrpY2 = new QGroupBox( tr( "PLOT2D_GRID_TLT" ), aYWidget2 );
213 aGridGrpY2->setColumnLayout(0, Qt::Vertical );
214 aGridGrpY2->layout()->setSpacing( 0 ); aGridGrpY2->layout()->setMargin( 0 );
215 QGridLayout* aGridLayoutY2 = new QGridLayout( aGridGrpY2->layout() );
216 aGridLayoutY2->setMargin( MARGIN_SIZE ); aGridLayoutY2->setSpacing( SPACING_SIZE );
217 myY2GridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MAJOR" ), aGridGrpY2 );
218 QLabel* aY2MajLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpY2);
219 myY2GridSpin = new QSpinBox( 1, 100, 1, aGridGrpY2 );
220 myY2GridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
221 myY2GridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
222 myY2MinGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MINOR" ), aGridGrpY2 );
223 QLabel* aY2MinLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpY2);
224 myY2MinGridSpin = new QSpinBox( 1, 100, 1, aGridGrpY2 );
225 myY2MinGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
226 myY2MinGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
228 aGridLayoutY2->addWidget( myY2GridCheck, 0, 0 );
229 aGridLayoutY2->addWidget( aY2MajLbl, 0, 1 );
230 aGridLayoutY2->addWidget( myY2GridSpin, 0, 2 );
231 aGridLayoutY2->addWidget( myY2MinGridCheck, 1, 0 );
232 aGridLayoutY2->addWidget( aY2MinLbl, 1, 1 );
233 aGridLayoutY2->addWidget( myY2MinGridSpin, 1, 2 );
234 aYLayout2->addMultiCellWidget( aGridGrpY2, 3, 3, 0, 3 );
236 aTabWidget->addTab( aYWidget2, tr( "INF_AXES_Y_RIGHT" ) );
243 myY2MinGridCheck = 0;
247 aTabWidget->setCurrentPage( 0 );
248 /* "Set as default" check box */
249 myDefCheck = new QCheckBox( tr( "PLOT2D_SET_AS_DEFAULT_CHECK" ), this );
250 /* OK/Cancel buttons */
251 myOkBtn = new QPushButton( tr( "BUT_OK" ), this );
252 myOkBtn->setAutoDefault( TRUE );
253 myOkBtn->setDefault( TRUE );
254 myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this );
255 myCancelBtn->setAutoDefault( TRUE );
256 QHBoxLayout* btnLayout = new QHBoxLayout;
257 btnLayout->addWidget( myOkBtn );
258 btnLayout->addStretch();
259 btnLayout->addWidget( myCancelBtn );
262 topLayout->addWidget( myTitleCheck, 0, 0 );
263 topLayout->addMultiCellWidget( myTitleEdit, 0, 0, 1, 3 );
264 topLayout->addWidget( aCurveLab, 1, 0 );
265 topLayout->addWidget( myCurveCombo, 1, 1 );
266 topLayout->addWidget( myLegendCheck, 1, 2 );
267 topLayout->addWidget( myLegendCombo, 1, 3 );
268 topLayout->addWidget( aMarkerLab, 2, 0 );
269 topLayout->addWidget( myMarkerSpin, 2, 1 );
270 QHBoxLayout* bgLayout = new QHBoxLayout;
271 bgLayout->addWidget( myBackgroundBtn ); bgLayout->addStretch();
272 topLayout->addWidget( aBGLab, 2, 2 );
273 topLayout->addLayout( bgLayout, 2, 3 );
274 topLayout->addMultiCellWidget( aScaleGrp, 3, 3, 0, 3 );
275 topLayout->addMultiCellWidget( aTabWidget, 4, 4, 0, 3 );
276 topLayout->addMultiCellWidget( myDefCheck, 5, 5, 0, 3 );
277 topLayout->setRowStretch( 5, 5 );
279 topLayout->addMultiCellLayout( btnLayout, 6, 6, 0, 3 );
284 connect( myTitleCheck, SIGNAL( clicked() ), this, SLOT( onMainTitleChecked() ) );
285 connect( myTitleXCheck, SIGNAL( clicked() ), this, SLOT( onXTitleChecked() ) );
286 connect( myTitleYCheck, SIGNAL( clicked() ), this, SLOT( onYTitleChecked() ) );
287 connect( myBackgroundBtn, SIGNAL( clicked() ), this, SLOT( onBackgroundClicked() ) );
288 connect( myLegendCheck, SIGNAL( clicked() ), this, SLOT( onLegendChecked() ) );
289 connect( myXGridCheck, SIGNAL( clicked() ), this, SLOT( onXGridMajorChecked() ) );
290 connect( myYGridCheck, SIGNAL( clicked() ), this, SLOT( onYGridMajorChecked() ) );
291 connect( myXMinGridCheck, SIGNAL( clicked() ), this, SLOT( onXGridMinorChecked() ) );
292 connect( myYMinGridCheck, SIGNAL( clicked() ), this, SLOT( onYGridMinorChecked() ) );
294 connect( myOkBtn, SIGNAL( clicked() ), this, SLOT( accept() ) );
295 connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
298 connect( myTitleY2Check, SIGNAL( clicked() ), this, SLOT( onY2TitleChecked() ) );
299 connect( myY2GridCheck, SIGNAL( clicked() ), this, SLOT( onY2GridMajorChecked() ) );
300 connect( myY2MinGridCheck, SIGNAL( clicked() ), this, SLOT( onY2GridMinorChecked() ) );
304 setBackgroundColor( Qt::gray );
305 onMainTitleChecked();
309 onXGridMajorChecked();
310 onYGridMajorChecked();
311 onXGridMinorChecked();
314 onY2GridMajorChecked();
315 onY2GridMinorChecked();
322 Plot2d_SetupViewDlg::~Plot2d_SetupViewDlg()
326 Sets main title attributes
328 void Plot2d_SetupViewDlg::setMainTitle( bool enable, const QString& title )
330 myTitleCheck->setChecked( enable );
331 if ( !title.isNull() )
332 myTitleEdit->setText( title );
333 onMainTitleChecked();
336 Returns TRUE if main title is enabled
338 bool Plot2d_SetupViewDlg::isMainTitleEnabled()
340 return myTitleCheck->isChecked();
345 QString Plot2d_SetupViewDlg::getMainTitle()
347 return myTitleEdit->text();
350 Sets horizontal axis title attributes
352 void Plot2d_SetupViewDlg::setXTitle( bool enable, const QString& title )
354 myTitleXCheck->setChecked( enable );
355 if ( !title.isNull() )
356 myTitleXEdit->setText( title );
360 Returns TRUE if horizontal axis title is enabled
362 bool Plot2d_SetupViewDlg::isXTitleEnabled()
364 return myTitleXCheck->isChecked();
367 Gets horizontal axis title
369 QString Plot2d_SetupViewDlg::getXTitle()
371 return myTitleXEdit->text();
374 Sets vertical left axis title attributes
376 void Plot2d_SetupViewDlg::setYTitle( bool enable, const QString& title )
378 myTitleYCheck->setChecked( enable );
379 if ( !title.isNull() )
380 myTitleYEdit->setText( title );
384 Sets vertical right axis title attributes
386 void Plot2d_SetupViewDlg::setY2Title( bool enable, const QString& title )
388 myTitleY2Check->setChecked( enable );
389 if ( !title.isNull() )
390 myTitleY2Edit->setText( title );
394 Returns TRUE if vertical left axis title is enabled
396 bool Plot2d_SetupViewDlg::isYTitleEnabled()
398 return myTitleYCheck->isChecked();
401 Returns TRUE if vertical right axis title is enabled
403 bool Plot2d_SetupViewDlg::isY2TitleEnabled()
405 return myTitleY2Check->isChecked();
408 Gets vertical left axis title
410 QString Plot2d_SetupViewDlg::getYTitle()
412 return myTitleYEdit->text();
415 Gets vertical right axis title
417 QString Plot2d_SetupViewDlg::getY2Title()
419 return myTitleY2Edit->text();
422 Sets curve type : 0 - points, 1 - lines, 2 - splines
424 void Plot2d_SetupViewDlg::setCurveType( const int type )
426 myCurveCombo->setCurrentItem( type );
429 Gets curve type : 0 - points, 1 - lines, 2 - splines
431 int Plot2d_SetupViewDlg::getCurveType()
433 return myCurveCombo->currentItem();
436 Sets legend attributes : pos = 0 - left, 1 - right, 2 - top, 3 - bottom
438 void Plot2d_SetupViewDlg::setLegend( bool enable, int pos )
440 myLegendCheck->setChecked( enable );
441 myLegendCombo->setCurrentItem( pos );
445 Returns TRUE if legend is enabled
447 bool Plot2d_SetupViewDlg::isLegendEnabled()
449 return myLegendCheck->isChecked();
452 Returns legend position
454 int Plot2d_SetupViewDlg::getLegendPos()
456 return myLegendCombo->currentItem();
461 void Plot2d_SetupViewDlg::setMarkerSize( const int size )
463 myMarkerSpin->setValue( size );
468 int Plot2d_SetupViewDlg::getMarkerSize()
470 return myMarkerSpin->value();
473 Sets background color
475 void Plot2d_SetupViewDlg::setBackgroundColor( const QColor& color )
477 QPalette pal = myBackgroundBtn->palette();
478 QColorGroup ca = pal.active();
479 ca.setColor( QColorGroup::Button, color );
480 QColorGroup ci = pal.inactive();
481 ci.setColor( QColorGroup::Button, color );
483 pal.setInactive( ci );
484 myBackgroundBtn->setPalette( pal );
487 Gets background color
489 QColor Plot2d_SetupViewDlg::getBackgroundColor()
491 return myBackgroundBtn->palette().active().button();
494 Sets major grid parameters
496 void Plot2d_SetupViewDlg::setMajorGrid( bool enableX, const int divX,
497 bool enableY, const int divY,
498 bool enableY2, const int divY2 )
500 myXGridCheck->setChecked( enableX );
501 myXGridSpin->setValue( divX );
502 myYGridCheck->setChecked( enableY );
503 myYGridSpin->setValue( divY );
504 onXGridMajorChecked();
505 onYGridMajorChecked();
507 myY2GridCheck->setChecked( enableY2 );
508 myY2GridSpin->setValue( divY2 );
509 onY2GridMajorChecked();
513 Gets major grid parameters
515 void Plot2d_SetupViewDlg::getMajorGrid( bool& enableX, int& divX,
516 bool& enableY, int& divY,
517 bool& enableY2, int& divY2)
519 enableX = myXGridCheck->isChecked();
520 divX = myXGridSpin->value();
521 enableY = myYGridCheck->isChecked();
522 divY = myYGridSpin->value();
524 enableY2 = myY2GridCheck->isChecked();
525 divY2 = myY2GridSpin->value();
533 Sets minor grid parameters
535 void Plot2d_SetupViewDlg::setMinorGrid( bool enableX, const int divX,
536 bool enableY, const int divY,
537 bool enableY2, const int divY2)
539 myXMinGridCheck->setChecked( enableX );
540 myXMinGridSpin->setValue( divX );
541 myYMinGridCheck->setChecked( enableY );
542 myYMinGridSpin->setValue( divY );
543 onXGridMinorChecked();
544 onYGridMinorChecked();
546 myY2MinGridCheck->setChecked( enableY2 );
547 myY2MinGridSpin->setValue( divY2 );
548 onY2GridMinorChecked();
552 Gets minor grid parameters
554 void Plot2d_SetupViewDlg::getMinorGrid( bool& enableX, int& divX,
555 bool& enableY, int& divY,
556 bool& enableY2, int& divY2)
558 enableX = myXMinGridCheck->isChecked();
559 divX = myXMinGridSpin->value();
560 enableY = myYMinGridCheck->isChecked();
561 divY = myYMinGridSpin->value();
563 enableY2 = myY2MinGridCheck->isChecked();
564 divY2 = myY2MinGridSpin->value();
572 Sets scale mode for hor. and ver. axes : 0 - linear, 1 - logarithmic
574 void Plot2d_SetupViewDlg::setScaleMode( const int xMode, const int yMode )
576 myXModeCombo->setCurrentItem( xMode );
577 myYModeCombo->setCurrentItem( yMode );
580 Gets scale mode for hor. axis : 0 - linear, 1 - logarithmic
582 int Plot2d_SetupViewDlg::getXScaleMode()
584 return myXModeCombo->currentItem();
587 Gets scale mode for hor. axis : 0 - linear, 1 - logarithmic
589 int Plot2d_SetupViewDlg::getYScaleMode()
591 return myYModeCombo->currentItem();
594 Slot, called when user clicks "Show main title" check box
596 void Plot2d_SetupViewDlg::onMainTitleChecked()
598 myTitleEdit->setEnabled( myTitleCheck->isChecked() );
601 Slot, called when user clicks "Show horizontal axis title" check box
603 void Plot2d_SetupViewDlg::onXTitleChecked()
605 myTitleXEdit->setEnabled( myTitleXCheck->isChecked() );
608 Slot, called when user clicks "Show vertical left axis title" check box
610 void Plot2d_SetupViewDlg::onYTitleChecked()
612 myTitleYEdit->setEnabled( myTitleYCheck->isChecked() );
615 Slot, called when user clicks "Show vertical right axis title" check box
617 void Plot2d_SetupViewDlg::onY2TitleChecked()
619 myTitleY2Edit->setEnabled( myTitleY2Check->isChecked() );
622 Slot, called when user clicks "Change bacground color" button
624 void Plot2d_SetupViewDlg::onBackgroundClicked()
626 QColor color = QColorDialog::getColor( getBackgroundColor() );
627 if ( color.isValid() ) {
628 setBackgroundColor( color );
632 Slot, called when user clicks "Show Legend" check box
634 void Plot2d_SetupViewDlg::onLegendChecked()
636 myLegendCombo->setEnabled( myLegendCheck->isChecked() );
639 Slot, called when user clicks "Enable hor. major grid" check box
641 void Plot2d_SetupViewDlg::onXGridMajorChecked()
643 myXMinGridCheck->setEnabled( myXGridCheck->isChecked() );
646 Slot, called when user clicks "Enable ver. major grid" check box
648 void Plot2d_SetupViewDlg::onYGridMajorChecked()
650 myYMinGridCheck->setEnabled( myYGridCheck->isChecked() );
653 Slot, called when user clicks "Enable ver. major grid" check box
655 void Plot2d_SetupViewDlg::onY2GridMajorChecked()
657 myY2MinGridCheck->setEnabled( myY2GridCheck->isChecked() );
660 Slot, called when user clicks "Enable hor. minor grid" check box
662 void Plot2d_SetupViewDlg::onXGridMinorChecked()
666 Slot, called when user clicks "Enable ver. minor grid" check box
668 void Plot2d_SetupViewDlg::onYGridMinorChecked()
672 Slot, called when user clicks "Enable ver. minor grid" check box
674 void Plot2d_SetupViewDlg::onY2GridMinorChecked()
678 Retursns true if "Set as default" check box is on
680 bool Plot2d_SetupViewDlg::isSetAsDefault()
682 return myDefCheck->isChecked();