1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File : Plot2d_SetupViewDlg.cxx
24 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
26 #include "Plot2d_SetupViewDlg.h"
28 #include <SUIT_Session.h>
29 #include <SUIT_Application.h>
30 #include <QtxColorButton.h>
31 #include <QtxFontEdit.h>
37 #include <QGridLayout>
38 #include <QHBoxLayout>
41 #include <QPushButton>
44 const int MARGIN_SIZE = 11;
45 const int SPACING_SIZE = 6;
46 const int MIN_EDIT_WIDTH = 200;
47 const int MIN_COMBO_WIDTH = 100;
48 const int MIN_SPIN_WIDTH = 70;
51 \class Plot2d_SetupViewDlg
52 \brief Dialog box to setup Plot2d view window.
57 \param parent parent widget
58 \param showDefCheck if \c true, show "Set settings as default" check box
59 \param secondAxisY if \c true, show widgets for the second (right) vertical axis
61 Plot2d_SetupViewDlg::Plot2d_SetupViewDlg( QWidget* parent,
65 mySecondAxisY( secondAxisY )
68 setWindowTitle( tr("TLT_SETUP_PLOT2D_VIEW") );
69 setSizeGripEnabled( TRUE );
71 QGridLayout* topLayout = new QGridLayout( this );
72 topLayout->setSpacing( SPACING_SIZE );
73 topLayout->setMargin( MARGIN_SIZE );
76 myTitleCheck = new QCheckBox( tr( "PLOT2D_ENABLE_MAIN_TITLE" ), this );
77 myTitleEdit = new QLineEdit( this );
78 myTitleEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
79 myTitleEdit->setMinimumWidth( MIN_EDIT_WIDTH );
81 // curve type : points, lines, spline
82 QLabel* aCurveLab = new QLabel( tr( "PLOT2D_CURVE_TYPE_LBL" ), this );
83 myCurveCombo = new QComboBox( this );
84 myCurveCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
85 myCurveCombo->setMinimumWidth( MIN_COMBO_WIDTH );
86 myCurveCombo->addItem( tr( "PLOT2D_CURVE_TYPE_POINTS" ) );
87 myCurveCombo->addItem( tr( "PLOT2D_CURVE_TYPE_LINES" ) );
88 myCurveCombo->addItem( tr( "PLOT2D_CURVE_TYPE_SPLINE" ) );
91 myLegendCheck = new QCheckBox( tr( "PLOT2D_ENABLE_LEGEND" ), this );
92 myLegendCombo = new QComboBox( this );
93 myLegendFont = new QtxFontEdit( this );
94 myLegendColor = new QtxColorButton( this );
95 QLabel* aLegendFontLab = new QLabel( tr( "PLOT2D_LEGEND_FONT" ), this );
96 myLegendCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
97 myLegendCombo->setMinimumWidth( MIN_COMBO_WIDTH );
98 myLegendCombo->addItem( tr( "PLOT2D_LEGEND_POSITION_LEFT" ) );
99 myLegendCombo->addItem( tr( "PLOT2D_LEGEND_POSITION_RIGHT" ) );
100 myLegendCombo->addItem( tr( "PLOT2D_LEGEND_POSITION_TOP" ) );
101 myLegendCombo->addItem( tr( "PLOT2D_LEGEND_POSITION_BOTTOM" ) );
104 QLabel* aMarkerLab = new QLabel( tr( "PLOT2D_MARKER_SIZE_LBL" ), this );
105 myMarkerSpin = new QSpinBox( this );
106 myMarkerSpin->setMinimum( 0 );
107 myMarkerSpin->setMaximum( 100 );
108 myMarkerSpin->setSingleStep( 1 );
109 myMarkerSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
110 myMarkerSpin->setMinimumWidth( MIN_SPIN_WIDTH );
113 QLabel* aBGLab = new QLabel( tr( "PLOT2D_BACKGROUND_COLOR_LBL" ), this );
114 myBackgroundBtn = new QtxColorButton( this );
116 //Deviation marker parameters
117 QGroupBox* aDeviationGrp = new QGroupBox( tr( "PLOT2D_DEVIATION_MARKER_TLT" ), this );
118 QHBoxLayout* aDeviationLayout = new QHBoxLayout(aDeviationGrp);
120 //Deviation marker parameters : Line width
121 QLabel* aDeviationLwLbl = new QLabel( tr( "PLOT2D_DEVIATION_LW_LBL" ), aDeviationGrp );
122 myDeviationLw = new QSpinBox( aDeviationGrp );
123 myDeviationLw->setMinimum( 1 );
124 myDeviationLw->setMaximum( 5 );
125 myDeviationLw->setSingleStep( 1 );
126 myDeviationLw->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
128 //Deviation marker parameters : Line width
129 QLabel* aDeviationTsLbl = new QLabel( tr( "PLOT2D_DEVIATION_TS_LBL" ), aDeviationGrp );
130 myDeviationTs = new QSpinBox( aDeviationGrp );
131 myDeviationTs->setMinimum( 1 );
132 myDeviationTs->setMaximum( 5 );
133 myDeviationTs->setSingleStep( 1 );
134 myDeviationTs->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
136 //Deviation marker parameters : Color
137 QLabel* aDeviationClLbl = new QLabel( tr( "PLOT2D_DEVIATION_CL_LBL" ), aDeviationGrp );
138 myDeviationCl = new QtxColorButton( aDeviationGrp );
140 aDeviationLayout->addWidget( aDeviationLwLbl );
141 aDeviationLayout->addWidget( myDeviationLw );
142 aDeviationLayout->addWidget( aDeviationTsLbl );
143 aDeviationLayout->addWidget( myDeviationTs );
144 aDeviationLayout->addWidget( aDeviationClLbl );
145 aDeviationLayout->addWidget( myDeviationCl );
148 QGroupBox* aNormalizeGrp = new QGroupBox( tr( "PLOT2D_NORMALIZE_TLT" ), this );
149 QGridLayout* aNormalizeLayout = new QGridLayout( aNormalizeGrp );
150 aNormalizeLayout->setMargin( MARGIN_SIZE ); aNormalizeLayout->setSpacing( SPACING_SIZE );
151 aNormalizeGrp->setLayout( aNormalizeLayout );
152 QLabel* aYLeftLab = new QLabel( tr( "PLOT2D_NORMALIZE_LEFT_AXIS" ), aNormalizeGrp );
153 myNormLMinCheck = new QCheckBox( tr( "PLOT2D_NORMALIZE_MODE_MIN" ), aNormalizeGrp );
154 myNormLMaxCheck = new QCheckBox( tr( "PLOT2D_NORMALIZE_MODE_MAX" ), aNormalizeGrp );
155 QLabel* aYRightLab = new QLabel( tr( "PLOT2D_NORMALIZE_RIGHT_AXIS" ), aNormalizeGrp );
156 myNormRMinCheck = new QCheckBox( tr( "PLOT2D_NORMALIZE_MODE_MIN" ), aNormalizeGrp );
157 myNormRMaxCheck = new QCheckBox( tr( "PLOT2D_NORMALIZE_MODE_MAX" ), aNormalizeGrp );
159 aNormalizeLayout->addWidget( aYLeftLab, 0, 0 );
160 aNormalizeLayout->addWidget( myNormLMaxCheck, 0, 1 );
161 aNormalizeLayout->addWidget( myNormLMinCheck, 0, 2 );
162 aNormalizeLayout->addWidget( aYRightLab, 1, 0 );
163 aNormalizeLayout->addWidget( myNormRMaxCheck, 1, 1 );
164 aNormalizeLayout->addWidget( myNormRMinCheck, 1, 2 );
167 QGroupBox* aScaleGrp = new QGroupBox( tr( "PLOT2D_SCALE_TLT" ), this );
168 QGridLayout* aScaleLayout = new QGridLayout( aScaleGrp );
169 aScaleLayout->setMargin( MARGIN_SIZE ); aScaleLayout->setSpacing( SPACING_SIZE );
170 aScaleGrp->setLayout( aScaleLayout );
172 QLabel* xScaleLab = new QLabel( tr( "PLOT2D_SCALE_MODE_HOR" ), aScaleGrp );
173 myXModeCombo = new QComboBox( aScaleGrp );
174 myXModeCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
175 myXModeCombo->setMinimumWidth( MIN_COMBO_WIDTH );
176 myXModeCombo->addItem( tr( "PLOT2D_SCALE_MODE_LINEAR" ) );
177 myXModeCombo->addItem( tr( "PLOT2D_SCALE_MODE_LOGARITHMIC" ) );
179 QLabel* yScaleLab = new QLabel( tr( "PLOT2D_SCALE_MODE_VER" ), aScaleGrp );
180 myYModeCombo = new QComboBox( aScaleGrp );
181 myYModeCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
182 myYModeCombo->setMinimumWidth( MIN_COMBO_WIDTH );
183 myYModeCombo->addItem( tr( "PLOT2D_SCALE_MODE_LINEAR" ) );
184 myYModeCombo->addItem( tr( "PLOT2D_SCALE_MODE_LOGARITHMIC" ) );
186 aScaleLayout->addWidget( xScaleLab, 0, 0 );
187 aScaleLayout->addWidget( myXModeCombo, 0, 1 );
188 aScaleLayout->addWidget( yScaleLab, 0, 2 );
189 aScaleLayout->addWidget( myYModeCombo, 0, 3 );
191 // tab widget for choose properties of axis
192 QTabWidget* aTabWidget = new QTabWidget( this );
194 // widget for parameters on Ox
195 QWidget* aXWidget = new QWidget(aTabWidget);
196 QGridLayout* aXLayout = new QGridLayout( aXWidget );
197 aXLayout->setSpacing( SPACING_SIZE );
198 aXLayout->setMargin( MARGIN_SIZE );
201 myTitleXCheck = new QCheckBox( tr( "PLOT2D_ENABLE_HOR_TITLE" ), aXWidget );
202 myTitleXEdit = new QLineEdit( aXWidget );
203 myTitleXEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
204 myTitleXEdit->setMinimumWidth( MIN_EDIT_WIDTH );
205 aXLayout->addWidget( myTitleXCheck,1, 0 );
206 aXLayout->addWidget( myTitleXEdit, 1, 1, 1, 3 );
209 QGroupBox* aGridGrpX = new QGroupBox( tr( "PLOT2D_GRID_TLT" ), aXWidget );
210 QGridLayout* aGridLayoutX = new QGridLayout( aGridGrpX );
211 aGridLayoutX->setMargin( MARGIN_SIZE );
212 aGridLayoutX->setSpacing( SPACING_SIZE );
214 myXGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_HOR_MAJOR" ), aGridGrpX );
216 QLabel* aXMajLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpX);
217 myXGridSpin = new QSpinBox( aGridGrpX );
218 myXGridSpin->setMinimum( 1 );
219 myXGridSpin->setMaximum( 100 );
220 myXGridSpin->setSingleStep( 1 );
221 myXGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
222 myXGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
224 myXMinGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_HOR_MINOR" ), aGridGrpX );
226 QLabel* aXMinLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpX);
227 myXMinGridSpin = new QSpinBox( aGridGrpX );
228 myXMinGridSpin->setMinimum( 1 );
229 myXMinGridSpin->setMaximum( 100 );
230 myXMinGridSpin->setSingleStep( 1 );
231 myXMinGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
232 myXMinGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
234 aGridLayoutX->addWidget( myXGridCheck, 0, 0 );
235 aGridLayoutX->addWidget( aXMajLbl, 0, 1 );
236 aGridLayoutX->addWidget( myXGridSpin, 0, 2 );
237 aGridLayoutX->addWidget( myXMinGridCheck, 1, 0 );
238 aGridLayoutX->addWidget( aXMinLbl, 1, 1 );
239 aGridLayoutX->addWidget( myXMinGridSpin, 1, 2 );
240 aXLayout->addWidget( aGridGrpX, 3, 0, 1, 4 );
242 aTabWidget->addTab( aXWidget, tr( "INF_AXES_X" ) );
244 // widget for parameters on Oy
245 QWidget* aYWidget = new QWidget(aTabWidget);
246 QGridLayout* aYLayout = new QGridLayout( aYWidget );
247 aYLayout->setSpacing( SPACING_SIZE );
248 aYLayout->setMargin( MARGIN_SIZE );
251 myTitleYCheck = new QCheckBox( tr( "PLOT2D_ENABLE_VER_TITLE" ), aYWidget );
252 myTitleYEdit = new QLineEdit( aYWidget );
253 myTitleYEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
254 myTitleYEdit->setMinimumWidth( MIN_EDIT_WIDTH );
255 aYLayout->addWidget( myTitleYCheck,1, 0 );
256 aYLayout->addWidget( myTitleYEdit, 1, 1, 1, 3 );
259 QGroupBox* aGridGrpY = new QGroupBox( tr( "PLOT2D_GRID_TLT" ), aYWidget );
260 QGridLayout* aGridLayoutY = new QGridLayout( aGridGrpY );
261 aGridGrpY->setLayout( aGridLayoutY );
262 aGridLayoutY->setMargin( MARGIN_SIZE ); aGridLayoutY->setSpacing( SPACING_SIZE );
264 myYGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MAJOR" ), aGridGrpY );
266 QLabel* aYMajLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpY);
267 myYGridSpin = new QSpinBox( aGridGrpY );
268 myYGridSpin->setMinimum( 1 );
269 myYGridSpin->setMaximum( 100 );
270 myYGridSpin->setSingleStep( 1 );
271 myYGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
272 myYGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
274 myYMinGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MINOR" ), aGridGrpY );
276 QLabel* aYMinLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpY);
277 myYMinGridSpin = new QSpinBox( aGridGrpY );
278 myYMinGridSpin->setMinimum( 1 );
279 myYMinGridSpin->setMaximum( 100 );
280 myYMinGridSpin->setSingleStep( 1 );
281 myYMinGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
282 myYMinGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
284 aGridLayoutY->addWidget( myYGridCheck, 0, 0 );
285 aGridLayoutY->addWidget( aYMajLbl, 0, 1 );
286 aGridLayoutY->addWidget( myYGridSpin, 0, 2 );
287 aGridLayoutY->addWidget( myYMinGridCheck, 1, 0 );
288 aGridLayoutY->addWidget( aYMinLbl, 1, 1 );
289 aGridLayoutY->addWidget( myYMinGridSpin, 1, 2 );
290 aYLayout->addWidget( aGridGrpY, 3, 0, 1, 4 );
292 aTabWidget->addTab( aYWidget, tr( "INF_AXES_Y_LEFT" ) );
294 // if exist second axis Oy, addition new tab widget for right axis
295 if ( mySecondAxisY ) {
296 // widget for parameters on Oy
297 QWidget* aYWidget2 = new QWidget( aTabWidget );
298 QGridLayout* aYLayout2 = new QGridLayout( aYWidget2 );
299 aYLayout2->setSpacing( SPACING_SIZE );
300 aYLayout2->setMargin( MARGIN_SIZE );
303 myTitleY2Check = new QCheckBox( tr( "PLOT2D_ENABLE_VER_TITLE" ), aYWidget2 );
304 myTitleY2Edit = new QLineEdit( aYWidget2 );
305 myTitleY2Edit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
306 myTitleY2Edit->setMinimumWidth( MIN_EDIT_WIDTH );
307 aYLayout2->addWidget( myTitleY2Check,1, 0 );
308 aYLayout2->addWidget( myTitleY2Edit, 1, 1, 1, 3 );
311 QGroupBox* aGridGrpY2 = new QGroupBox( tr( "PLOT2D_GRID_TLT" ), aYWidget2 );
312 QGridLayout* aGridLayoutY2 = new QGridLayout( aGridGrpY2 );
313 aGridGrpY2->setLayout( aGridLayoutY2 );
314 aGridLayoutY2->setMargin( MARGIN_SIZE ); aGridLayoutY2->setSpacing( SPACING_SIZE );
316 myY2GridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MAJOR" ), aGridGrpY2 );
318 QLabel* aY2MajLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpY2);
319 myY2GridSpin = new QSpinBox( aGridGrpY2 );
320 myY2GridSpin->setMinimum( 1 );
321 myY2GridSpin->setMaximum( 100 );
322 myY2GridSpin->setSingleStep( 1 );
323 myY2GridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
324 myY2GridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
326 myY2MinGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MINOR" ), aGridGrpY2 );
328 QLabel* aY2MinLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpY2);
329 myY2MinGridSpin = new QSpinBox( aGridGrpY2 );
330 myY2MinGridSpin->setMinimum( 1 );
331 myY2MinGridSpin->setMaximum( 100 );
332 myY2MinGridSpin->setSingleStep( 1 );
333 myY2MinGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
334 myY2MinGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
336 aGridLayoutY2->addWidget( myY2GridCheck, 0, 0 );
337 aGridLayoutY2->addWidget( aY2MajLbl, 0, 1 );
338 aGridLayoutY2->addWidget( myY2GridSpin, 0, 2 );
339 aGridLayoutY2->addWidget( myY2MinGridCheck, 1, 0 );
340 aGridLayoutY2->addWidget( aY2MinLbl, 1, 1 );
341 aGridLayoutY2->addWidget( myY2MinGridSpin, 1, 2 );
342 aYLayout2->addWidget( aGridGrpY2, 3, 0, 1, 4 );
344 aTabWidget->addTab( aYWidget2, tr( "INF_AXES_Y_RIGHT" ) );
351 myY2MinGridCheck = 0;
356 aTabWidget->setCurrentIndex( 0 );
357 /* "Set as default" check box */
359 myDefCheck = new QCheckBox( tr( "PLOT2D_SET_AS_DEFAULT_CHECK" ), this );
361 /* OK/Cancel buttons */
362 myOkBtn = new QPushButton( tr( "BUT_OK" ), this );
363 myOkBtn->setAutoDefault( TRUE );
364 myOkBtn->setDefault( TRUE );
365 myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this );
366 myCancelBtn->setAutoDefault( TRUE );
367 myHelpBtn = new QPushButton( tr( "BUT_HELP" ), this );
368 myHelpBtn->setAutoDefault( TRUE );
369 QHBoxLayout* btnLayout = new QHBoxLayout;
370 btnLayout->addWidget( myOkBtn );
371 btnLayout->addStretch();
372 btnLayout->addWidget( myCancelBtn );
373 btnLayout->addWidget( myHelpBtn );
376 topLayout->addWidget( myTitleCheck, 0, 0 );
377 topLayout->addWidget( myTitleEdit, 0, 1, 1, 3 );
378 topLayout->addWidget( myLegendCheck, 1, 0 );
379 topLayout->addWidget( myLegendCombo, 1, 1 );
380 topLayout->addWidget( aCurveLab, 1, 2 );
381 topLayout->addWidget( myCurveCombo, 1, 3 );
382 topLayout->addWidget( aLegendFontLab,2, 0 );
383 topLayout->addWidget( myLegendFont, 2, 1 );
384 topLayout->addWidget( myLegendColor, 2, 2 );
386 topLayout->addWidget( aMarkerLab, 3, 0 );
387 topLayout->addWidget( myMarkerSpin, 3, 1 );
388 QHBoxLayout* bgLayout = new QHBoxLayout;
389 bgLayout->addWidget( myBackgroundBtn ); bgLayout->addStretch();
390 topLayout->addWidget( aBGLab, 3, 2 );
391 topLayout->addLayout( bgLayout, 3, 3 );
392 topLayout->addWidget( aDeviationGrp, 4, 0, 1, 4 );
393 topLayout->addWidget( aNormalizeGrp, 5, 0, 1, 4 );
394 topLayout->addWidget( aScaleGrp, 6, 0, 1, 4 );
395 topLayout->addWidget( aTabWidget, 7, 0, 1, 4 );
396 topLayout->addWidget( myDefCheck, 8, 0, 1, 4 );
397 topLayout->setRowStretch( 9, 5 );
399 topLayout->addLayout( btnLayout, 10, 0, 1, 4 );
404 connect( myTitleCheck, SIGNAL( clicked() ), this, SLOT( onMainTitleChecked() ) );
405 connect( myTitleXCheck, SIGNAL( clicked() ), this, SLOT( onXTitleChecked() ) );
406 connect( myTitleYCheck, SIGNAL( clicked() ), this, SLOT( onYTitleChecked() ) );
407 connect( myLegendCheck, SIGNAL( clicked() ), this, SLOT( onLegendChecked() ) );
408 connect( myXGridCheck, SIGNAL( clicked() ), this, SLOT( onXGridMajorChecked() ) );
409 connect( myYGridCheck, SIGNAL( clicked() ), this, SLOT( onYGridMajorChecked() ) );
410 connect( myXMinGridCheck, SIGNAL( clicked() ), this, SLOT( onXGridMinorChecked() ) );
411 connect( myYMinGridCheck, SIGNAL( clicked() ), this, SLOT( onYGridMinorChecked() ) );
412 connect( myNormLMaxCheck, SIGNAL( clicked() ), this, SLOT( onNormLMaxChecked() ) );
413 connect( myNormLMinCheck, SIGNAL( clicked() ), this, SLOT( onNormLMinChecked() ) );
414 connect( myNormRMaxCheck, SIGNAL( clicked() ), this, SLOT( onNormRMaxChecked() ) );
415 connect( myNormRMinCheck, SIGNAL( clicked() ), this, SLOT( onNormRMinChecked() ) );
418 connect( myOkBtn, SIGNAL( clicked() ), this, SLOT( accept() ) );
419 connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
420 connect( myHelpBtn, SIGNAL( clicked() ), this, SLOT( onHelp() ) );
422 if ( mySecondAxisY ) {
423 connect( myTitleY2Check, SIGNAL( clicked() ), this, SLOT( onY2TitleChecked() ) );
424 connect( myY2GridCheck, SIGNAL( clicked() ), this, SLOT( onY2GridMajorChecked() ) );
425 connect( myY2MinGridCheck, SIGNAL( clicked() ), this, SLOT( onY2GridMinorChecked() ) );
429 setBackgroundColor( Qt::gray );
430 onMainTitleChecked();
434 onXGridMajorChecked();
435 onYGridMajorChecked();
436 onXGridMinorChecked();
441 if ( mySecondAxisY ) {
443 onY2GridMajorChecked();
444 onY2GridMinorChecked();
451 Plot2d_SetupViewDlg::~Plot2d_SetupViewDlg()
456 \brief Set main title attributes.
457 \param enable if \c true main title is enabled
458 \param title main title
459 \sa isMainTitleEnabled(), getMainTitle()
461 void Plot2d_SetupViewDlg::setMainTitle( bool enable, const QString& title )
463 myTitleCheck->setChecked( enable );
464 if ( !title.isNull() )
465 myTitleEdit->setText( title );
466 onMainTitleChecked();
470 \brief Check if main title is enabled.
471 \return \c true if main title is enabled
474 bool Plot2d_SetupViewDlg::isMainTitleEnabled()
476 return myTitleCheck->isChecked();
480 \brief Get main title.
484 QString Plot2d_SetupViewDlg::getMainTitle()
486 return myTitleEdit->text();
490 \brief Set horizontal axis title attributes.
491 \param enable if \c true horizontal axis title is enabled
492 \param title horizontal axis title
493 \sa isXTitleEnabled(), getXTitle()
495 void Plot2d_SetupViewDlg::setXTitle( bool enable, const QString& title )
497 myTitleXCheck->setChecked( enable );
498 if ( !title.isNull() )
499 myTitleXEdit->setText( title );
504 \brief Check if main title is enabled.
505 \return \c true if horizontal axis title is enabled
508 bool Plot2d_SetupViewDlg::isXTitleEnabled()
510 return myTitleXCheck->isChecked();
514 \brief Get horizontal axis title.
515 \return horizontal axis title
518 QString Plot2d_SetupViewDlg::getXTitle()
520 return myTitleXEdit->text();
524 \brief Set left vertical axis title attributes.
525 \param enable if \c true left vertical axis title is enabled
526 \param title left vertical axis title
527 \sa setY2Title(), isYTitleEnabled(), getYTitle()
529 void Plot2d_SetupViewDlg::setYTitle( bool enable, const QString& title )
531 myTitleYCheck->setChecked( enable );
532 if ( !title.isNull() )
533 myTitleYEdit->setText( title );
538 \brief Set right vertical axis title attributes.
539 \param enable if \c true right vertical axis title is enabled
540 \param title right vertical axis title
541 \sa setYTitle(), isY2TitleEnabled(), getY2Title()
543 void Plot2d_SetupViewDlg::setY2Title( bool enable, const QString& title )
545 myTitleY2Check->setChecked( enable );
546 if ( !title.isNull() )
547 myTitleY2Edit->setText( title );
552 \brief Check if left vertical axis title is enabled.
553 \return \c true if right vertical axis title is enabled
556 bool Plot2d_SetupViewDlg::isYTitleEnabled()
558 return myTitleYCheck->isChecked();
562 \brief Check if right vertical axis title is enabled.
563 \return \c true if right vertical axis title is enabled
566 bool Plot2d_SetupViewDlg::isY2TitleEnabled()
568 return myTitleY2Check->isChecked();
572 \brief Get left vertical axis title.
573 \return left vertical axis title
576 QString Plot2d_SetupViewDlg::getYTitle()
578 return myTitleYEdit->text();
582 \brief Get right vertical axis title.
583 \return right vertical axis title
586 QString Plot2d_SetupViewDlg::getY2Title()
588 return myTitleY2Edit->text();
592 \brief Set curve type.
593 \param type curve type: 0 (points), 1 (lines) or 2 (splines)
596 void Plot2d_SetupViewDlg::setCurveType( const int type )
598 myCurveCombo->setCurrentIndex( type );
602 \brief Get curve type.
603 \return curve type: 0 (points), 1 (lines) or 2 (splines)
606 int Plot2d_SetupViewDlg::getCurveType()
608 return myCurveCombo->currentIndex();
612 \brief Set normalization to maximum by left Y axis.
613 \param type normalizatoin type: true,false
616 void Plot2d_SetupViewDlg::setLMaxNormMode( const bool type )
618 myNormLMaxCheck->setChecked( type );
622 \brief Check if normalization to maximum by left Y axis sets.
623 \return curve normalizatoin type: true,false
626 bool Plot2d_SetupViewDlg::getLMaxNormMode()
628 return myNormLMaxCheck->isChecked();
632 \brief Set normalization to minimum by left Y axis.
633 \param type normalizatoin type: true,false
636 void Plot2d_SetupViewDlg::setLMinNormMode( const bool type )
638 myNormLMinCheck->setChecked( type );
642 \brief Check if normalization to minimum by left Y axis sets.
643 \return curve normalizatoin type: true,false
646 bool Plot2d_SetupViewDlg::getLMinNormMode()
648 return myNormLMinCheck->isChecked();
652 \brief Set normalization to maximum by right Y axis.
653 \param type normalizatoin type: true,false
656 void Plot2d_SetupViewDlg::setRMaxNormMode( const bool type )
658 myNormRMaxCheck->setChecked( type );
662 \brief Check if normalization to maximum by right Y axis sets.
663 \return curve normalizatoin type: true,false
666 bool Plot2d_SetupViewDlg::getRMaxNormMode()
668 return myNormRMaxCheck->isChecked();
672 \brief Set normalization to minimum by right Y axis.
673 \param type normalizatoin type: true,false
676 void Plot2d_SetupViewDlg::setRMinNormMode( const bool type )
678 myNormRMinCheck->setChecked( type );
682 \brief Check if normalization to minimum by right Y axis sets.
683 \return curve normalizatoin type: true,false
686 bool Plot2d_SetupViewDlg::getRMinNormMode()
688 return myNormRMinCheck->isChecked();
692 \brief Set legend attribute.
693 \param if \c true legend is shown
694 \param pos legend position: 0 (left), 1 (right), 2 (top), 3 (bottom)
695 \param fnt legend font
696 \param col legend font color
697 \sa isLegendEnabled(), getLegendPos(), getLegendFont()
699 void Plot2d_SetupViewDlg::setLegend( bool enable, int pos, const QFont& fnt, const QColor& col )
701 myLegendCheck->setChecked( enable );
702 myLegendCombo->setCurrentIndex( pos );
703 myLegendFont->setCurrentFont( fnt );
704 myLegendColor->setColor( col );
709 \brief Check if legend is enabled.
710 \return \c true if legend is enabled
713 bool Plot2d_SetupViewDlg::isLegendEnabled()
715 return myLegendCheck->isChecked();
719 \brief Get legend position.
720 \return legend position: 0 (left), 1 (right), 2 (top), 3 (bottom)
723 int Plot2d_SetupViewDlg::getLegendPos()
725 return myLegendCombo->currentIndex();
729 \brief Get legend font.
733 QFont Plot2d_SetupViewDlg::getLegendFont()
735 return myLegendFont->currentFont();
739 \brief Get legend font color.
740 \return legend font color
743 QColor Plot2d_SetupViewDlg::getLegendColor()
745 return myLegendColor->color();
749 \brief Set marker size.
750 \param size marker size
753 void Plot2d_SetupViewDlg::setMarkerSize( const int size )
755 myMarkerSpin->setValue( size );
759 \brief Get marker size.
763 int Plot2d_SetupViewDlg::getMarkerSize()
765 return myMarkerSpin->value();
768 \brief Set deviation marker line width.
769 \param width marker line width
770 \sa getDeviationMarkerLw()
772 void Plot2d_SetupViewDlg::setDeviationMarkerLw( const int width ){
773 myDeviationLw->setValue(width);
777 \brief Get deviation marker line width.
778 \return marker line width
781 int Plot2d_SetupViewDlg::getDeviationMarkerLw() const {
782 return myDeviationLw->value();
786 \brief Set deviation marker tick size.
787 \param size marker tick size
788 \sa getDeviationMarkerTs()
790 void Plot2d_SetupViewDlg::setDeviationMarkerTs( const int size) {
791 myDeviationTs->setValue(size);
795 \brief Get deviation marker tick size.
796 \return marker tick size
797 \sa setDeviationMarkerTs()
799 int Plot2d_SetupViewDlg::getDeviationMarkerTs() const {
800 return myDeviationTs->value();
804 \brief Set color of the deviation marker.
805 \param color marker color
806 \sa getDeviationMarkerCl()
808 void Plot2d_SetupViewDlg::setDeviationMarkerCl( const QColor& col) {
809 myDeviationCl->setColor( col );
813 \brief Get color of the deviation marker.
815 \sa setDeviationMarkerCl()
817 QColor Plot2d_SetupViewDlg::getDeviationMarkerCl() const {
818 return myDeviationCl->color();
822 \brief Set background color.
823 \param color background color
824 \sa getBackgroundColor()
826 void Plot2d_SetupViewDlg::setBackgroundColor( const QColor& color )
828 myBackgroundBtn->setColor( color );
832 \brief Get background color.
833 \return background color
834 \sa setBackgroundColor()
836 QColor Plot2d_SetupViewDlg::getBackgroundColor()
838 return myBackgroundBtn->color();
842 \brief Set major grid parameters.
843 \param enableX if \c true, horizontal major grid is enabled
844 \param divX maximum number of ticks for horizontal major grid
845 \param enableY if \c true, left vertical major grid is enabled
846 \param divY maximum number of ticks for left vertical major grid
847 \param enableY2 if \c true, right vertical major grid is enabled
848 \param divY2 maximum number of ticks for right vertical major grid
851 void Plot2d_SetupViewDlg::setMajorGrid( bool enableX, const int divX,
852 bool enableY, const int divY,
853 bool enableY2, const int divY2 )
855 myXGridCheck->setChecked( enableX );
856 myXGridSpin->setValue( divX );
857 myYGridCheck->setChecked( enableY );
858 myYGridSpin->setValue( divY );
859 onXGridMajorChecked();
860 onYGridMajorChecked();
862 myY2GridCheck->setChecked( enableY2 );
863 myY2GridSpin->setValue( divY2 );
864 onY2GridMajorChecked();
869 \brief Get major grid parameters.
870 \param enableX \c true if horizontal major grid is enabled
871 \param divX maximum number of ticks for horizontal major grid
872 \param enableY \c true if left vertical major grid is enabled
873 \param divY maximum number of ticks for left vertical major grid
874 \param enableY2 \c true if right vertical major grid is enabled
875 \param divY2 maximum number of ticks for right vertical major grid
878 void Plot2d_SetupViewDlg::getMajorGrid( bool& enableX, int& divX,
879 bool& enableY, int& divY,
880 bool& enableY2, int& divY2 )
882 enableX = myXGridCheck->isChecked();
883 divX = myXGridSpin->value();
884 enableY = myYGridCheck->isChecked();
885 divY = myYGridSpin->value();
887 enableY2 = myY2GridCheck->isChecked();
888 divY2 = myY2GridSpin->value();
897 \brief Set minor grid parameters.
898 \param enableX if \c true, horizontal minor grid is enabled
899 \param divX maximum number of ticks for horizontal minor grid
900 \param enableY if \c true, left vertical minor grid is enabled
901 \param divY maximum number of ticks for left vertical minor grid
902 \param enableY2 if \c true, right vertical minor grid is enabled
903 \param divY2 maximum number of ticks for right vertical minor grid
906 void Plot2d_SetupViewDlg::setMinorGrid( bool enableX, const int divX,
907 bool enableY, const int divY,
908 bool enableY2, const int divY2 )
910 myXMinGridCheck->setChecked( enableX );
911 myXMinGridSpin->setValue( divX );
912 myYMinGridCheck->setChecked( enableY );
913 myYMinGridSpin->setValue( divY );
914 onXGridMinorChecked();
915 onYGridMinorChecked();
917 myY2MinGridCheck->setChecked( enableY2 );
918 myY2MinGridSpin->setValue( divY2 );
919 onY2GridMinorChecked();
924 \brief Get minor grid parameters.
925 \param enableX \c true if horizontal minor grid is enabled
926 \param divX maximum number of ticks for horizontal minor grid
927 \param enableY \c true if left vertical minor grid is enabled
928 \param divY maximum number of ticks for left vertical minor grid
929 \param enableY2 \c true if right vertical minor grid is enabled
930 \param divY2 maximum number of ticks for right vertical minor grid
933 void Plot2d_SetupViewDlg::getMinorGrid( bool& enableX, int& divX,
934 bool& enableY, int& divY,
935 bool& enableY2, int& divY2 )
937 enableX = myXMinGridCheck->isChecked();
938 divX = myXMinGridSpin->value();
939 enableY = myYMinGridCheck->isChecked();
940 divY = myYMinGridSpin->value();
941 if ( mySecondAxisY ) {
942 enableY2 = myY2MinGridCheck->isChecked();
943 divY2 = myY2MinGridSpin->value();
952 \brief Set scale mode for horizontal and vertical axes.
953 \param xMode horizontal axis scale mode: 0 (linear), 1 (logarithmic)
954 \param yMode vertical axis scale mode: 0 (linear), 1 (logarithmic)
955 \sa getXScaleMode(), getYScaleMode()
957 void Plot2d_SetupViewDlg::setScaleMode( const int xMode, const int yMode )
959 myXModeCombo->setCurrentIndex( xMode );
960 myYModeCombo->setCurrentIndex( yMode );
964 \brief Get scale mode for horizontal axis.
965 \return horizontal axis scale mode: 0 (linear), 1 (logarithmic)
968 int Plot2d_SetupViewDlg::getXScaleMode()
970 return myXModeCombo->currentIndex();
974 \brief Get scale mode for vertical axis.
975 \return vertical axis scale mode: 0 (linear), 1 (logarithmic)
978 int Plot2d_SetupViewDlg::getYScaleMode()
980 return myYModeCombo->currentIndex();
984 \brief Called when user clicks "Show main title" check box.
986 void Plot2d_SetupViewDlg::onMainTitleChecked()
988 myTitleEdit->setEnabled( myTitleCheck->isChecked() );
992 \brief Called when user clicks "Show horizontal axis title" check box.
994 void Plot2d_SetupViewDlg::onXTitleChecked()
996 myTitleXEdit->setEnabled( myTitleXCheck->isChecked() );
1000 \brief Called when user clicks "Show vertical left axis title" check box.
1002 void Plot2d_SetupViewDlg::onYTitleChecked()
1004 myTitleYEdit->setEnabled( myTitleYCheck->isChecked() );
1008 \brief Called when user clicks "Show vertical right axis title" check box.
1010 void Plot2d_SetupViewDlg::onY2TitleChecked()
1012 myTitleY2Edit->setEnabled( myTitleY2Check->isChecked() );
1016 \brief Called when user clicks "Show Legend" check box.
1018 void Plot2d_SetupViewDlg::onLegendChecked()
1020 myLegendCombo->setEnabled( myLegendCheck->isChecked() );
1024 \brief Called when user clicks "Enable horizontal major grid" check box.
1026 void Plot2d_SetupViewDlg::onXGridMajorChecked()
1028 myXMinGridCheck->setEnabled( myXGridCheck->isChecked() );
1032 \brief Called when user clicks "Enable left vertical major grid" check box.
1034 void Plot2d_SetupViewDlg::onYGridMajorChecked()
1036 myYMinGridCheck->setEnabled( myYGridCheck->isChecked() );
1040 \brief Called when user clicks "Enable right vertical major grid" check box.
1042 void Plot2d_SetupViewDlg::onY2GridMajorChecked()
1044 myY2MinGridCheck->setEnabled( myY2GridCheck->isChecked() );
1048 \brief Called when user clicks "Enable horizontal minor grid" check box.
1050 void Plot2d_SetupViewDlg::onXGridMinorChecked()
1055 \brief Called when user clicks "Enable left vertical minor grid" check box.
1057 void Plot2d_SetupViewDlg::onYGridMinorChecked()
1062 \brief Called when user clicks "Enable right vertical minor grid" check box.
1064 void Plot2d_SetupViewDlg::onY2GridMinorChecked()
1069 \brief Called when user clicks "Left Y Axis: Normalize to maximum" check box.
1071 void Plot2d_SetupViewDlg::onNormLMaxChecked()
1076 \brief Called when user clicks "Left Y Axis: Normalize to minimum" check box.
1078 void Plot2d_SetupViewDlg::onNormLMinChecked()
1083 \brief Called when user clicks "Right Y Axis: Normalize to maximum" check box.
1085 void Plot2d_SetupViewDlg::onNormRMaxChecked()
1090 \brief Called when user clicks "Right Y Axis: Normalize to minimum" check box.
1092 void Plot2d_SetupViewDlg::onNormRMinChecked()
1097 \brief Get "Set settings as default" check box value.
1098 \return \c true if "Set settings as default" check box is on
1100 bool Plot2d_SetupViewDlg::isSetAsDefault()
1102 return myDefCheck->isChecked();
1106 Slot, called when user clicks "Help" button
1108 void Plot2d_SetupViewDlg::onHelp()
1110 SUIT_Application* app = SUIT_Session::session()->activeApplication();
1112 app->onHelpContextModule( "GUI", "plot2d_viewer_page.html", "settings" );