1 // Copyright (C) 2007-2013 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"
29 #include <SUIT_Session.h>
30 #include <SUIT_Application.h>
32 #include <QtxColorButton.h>
33 #include <QtxFontEdit.h>
39 #include <QGridLayout>
40 #include <QHBoxLayout>
43 #include <QPushButton>
46 const int MARGIN_SIZE = 11;
47 const int SPACING_SIZE = 6;
48 const int MIN_EDIT_WIDTH = 200;
49 const int MIN_COMBO_WIDTH = 100;
50 const int MIN_SPIN_WIDTH = 70;
53 \class Plot2d_SetupViewDlg
54 \brief Dialog box to setup Plot2d view window.
59 \param parent parent widget
60 \param showDefCheck if \c true, show "Set settings as default" check box
61 \param secondAxisY if \c true, show widgets for the second (right) vertical axis
63 Plot2d_SetupViewDlg::Plot2d_SetupViewDlg( QWidget* parent,
67 mySecondAxisY( secondAxisY )
70 setWindowTitle( tr("TLT_SETUP_PLOT2D_VIEW") );
71 setSizeGripEnabled( TRUE );
73 QGridLayout* topLayout = new QGridLayout( this );
74 topLayout->setSpacing( SPACING_SIZE );
75 topLayout->setMargin( MARGIN_SIZE );
78 myTitleCheck = new QCheckBox( tr( "PLOT2D_ENABLE_MAIN_TITLE" ), this );
79 myTitleEdit = new QLineEdit( this );
80 myTitleEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
81 myTitleEdit->setMinimumWidth( MIN_EDIT_WIDTH );
83 // curve type : points, lines, spline
84 QLabel* aCurveLab = new QLabel( tr( "PLOT2D_CURVE_TYPE_LBL" ), this );
85 myCurveCombo = new QComboBox( this );
86 myCurveCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
87 myCurveCombo->setMinimumWidth( MIN_COMBO_WIDTH );
88 myCurveCombo->addItem( tr( "PLOT2D_CURVE_TYPE_POINTS" ) );
89 myCurveCombo->addItem( tr( "PLOT2D_CURVE_TYPE_LINES" ) );
90 myCurveCombo->addItem( tr( "PLOT2D_CURVE_TYPE_SPLINE" ) );
93 myLegendCheck = new QCheckBox( tr( "PLOT2D_ENABLE_LEGEND" ), this );
94 myLegendCombo = new QComboBox( this );
95 myLegendFont = new QtxFontEdit( this );
96 myLegendColor = new QtxColorButton( this );
97 QLabel* aLegendFontLab = new QLabel( tr( "PLOT2D_LEGEND_FONT" ), this );
98 myLegendCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
99 myLegendCombo->setMinimumWidth( MIN_COMBO_WIDTH );
100 myLegendCombo->addItem( tr( "PLOT2D_LEGEND_POSITION_LEFT" ) );
101 myLegendCombo->addItem( tr( "PLOT2D_LEGEND_POSITION_RIGHT" ) );
102 myLegendCombo->addItem( tr( "PLOT2D_LEGEND_POSITION_TOP" ) );
103 myLegendCombo->addItem( tr( "PLOT2D_LEGEND_POSITION_BOTTOM" ) );
106 QLabel* aMarkerLab = new QLabel( tr( "PLOT2D_MARKER_SIZE_LBL" ), this );
107 myMarkerSpin = new QSpinBox( this );
108 myMarkerSpin->setMinimum( 0 );
109 myMarkerSpin->setMaximum( 100 );
110 myMarkerSpin->setSingleStep( 1 );
111 myMarkerSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
112 myMarkerSpin->setMinimumWidth( MIN_SPIN_WIDTH );
115 QLabel* aBGLab = new QLabel( tr( "PLOT2D_BACKGROUND_COLOR_LBL" ), this );
116 myBackgroundBtn = new QtxColorButton( this );
118 //Deviation marker parameters
119 QGroupBox* aDeviationGrp = new QGroupBox( tr( "PLOT2D_DEVIATION_MARKER_TLT" ), this );
120 QHBoxLayout* aDeviationLayout = new QHBoxLayout(aDeviationGrp);
122 //Deviation marker parameters : Line width
123 QLabel* aDeviationLwLbl = new QLabel( tr( "PLOT2D_DEVIATION_LW_LBL" ), aDeviationGrp );
124 myDeviationLw = new QSpinBox( aDeviationGrp );
125 myDeviationLw->setMinimum( 1 );
126 myDeviationLw->setMaximum( 5 );
127 myDeviationLw->setSingleStep( 1 );
128 myDeviationLw->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
130 //Deviation marker parameters : Line width
131 QLabel* aDeviationTsLbl = new QLabel( tr( "PLOT2D_DEVIATION_TS_LBL" ), aDeviationGrp );
132 myDeviationTs = new QSpinBox( aDeviationGrp );
133 myDeviationTs->setMinimum( 1 );
134 myDeviationTs->setMaximum( 5 );
135 myDeviationTs->setSingleStep( 1 );
136 myDeviationTs->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
138 //Deviation marker parameters : Color
139 QLabel* aDeviationClLbl = new QLabel( tr( "PLOT2D_DEVIATION_CL_LBL" ), aDeviationGrp );
140 myDeviationCl = new QtxColorButton( aDeviationGrp );
142 aDeviationLayout->addWidget( aDeviationLwLbl );
143 aDeviationLayout->addWidget( myDeviationLw );
144 aDeviationLayout->addWidget( aDeviationTsLbl );
145 aDeviationLayout->addWidget( myDeviationTs );
146 aDeviationLayout->addWidget( aDeviationClLbl );
147 aDeviationLayout->addWidget( myDeviationCl );
150 QGroupBox* aNormalizeGrp = new QGroupBox( tr( "PLOT2D_NORMALIZE_TLT" ), this );
151 QGridLayout* aNormalizeLayout = new QGridLayout( aNormalizeGrp );
152 aNormalizeLayout->setMargin( MARGIN_SIZE ); aNormalizeLayout->setSpacing( SPACING_SIZE );
153 aNormalizeGrp->setLayout( aNormalizeLayout );
154 QLabel* aYLeftLab = new QLabel( tr( "PLOT2D_NORMALIZE_LEFT_AXIS" ), aNormalizeGrp );
155 myNormLMinCheck = new QCheckBox( tr( "PLOT2D_NORMALIZE_MODE_MIN" ), aNormalizeGrp );
156 myNormLMaxCheck = new QCheckBox( tr( "PLOT2D_NORMALIZE_MODE_MAX" ), aNormalizeGrp );
157 QLabel* aYRightLab = new QLabel( tr( "PLOT2D_NORMALIZE_RIGHT_AXIS" ), aNormalizeGrp );
158 myNormRMinCheck = new QCheckBox( tr( "PLOT2D_NORMALIZE_MODE_MIN" ), aNormalizeGrp );
159 myNormRMaxCheck = new QCheckBox( tr( "PLOT2D_NORMALIZE_MODE_MAX" ), aNormalizeGrp );
161 aNormalizeLayout->addWidget( aYLeftLab, 0, 0 );
162 aNormalizeLayout->addWidget( myNormLMaxCheck, 0, 1 );
163 aNormalizeLayout->addWidget( myNormLMinCheck, 0, 2 );
164 aNormalizeLayout->addWidget( aYRightLab, 1, 0 );
165 aNormalizeLayout->addWidget( myNormRMaxCheck, 1, 1 );
166 aNormalizeLayout->addWidget( myNormRMinCheck, 1, 2 );
169 QGroupBox* aScaleGrp = new QGroupBox( tr( "PLOT2D_SCALE_TLT" ), this );
170 QGridLayout* aScaleLayout = new QGridLayout( aScaleGrp );
171 aScaleLayout->setMargin( MARGIN_SIZE ); aScaleLayout->setSpacing( SPACING_SIZE );
172 aScaleGrp->setLayout( aScaleLayout );
174 QLabel* xScaleLab = new QLabel( tr( "PLOT2D_SCALE_MODE_HOR" ), aScaleGrp );
175 myXModeCombo = new QComboBox( aScaleGrp );
176 myXModeCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
177 myXModeCombo->setMinimumWidth( MIN_COMBO_WIDTH );
178 myXModeCombo->addItem( tr( "PLOT2D_SCALE_MODE_LINEAR" ) );
179 myXModeCombo->addItem( tr( "PLOT2D_SCALE_MODE_LOGARITHMIC" ) );
181 QLabel* yScaleLab = new QLabel( tr( "PLOT2D_SCALE_MODE_VER" ), aScaleGrp );
182 myYModeCombo = new QComboBox( aScaleGrp );
183 myYModeCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
184 myYModeCombo->setMinimumWidth( MIN_COMBO_WIDTH );
185 myYModeCombo->addItem( tr( "PLOT2D_SCALE_MODE_LINEAR" ) );
186 myYModeCombo->addItem( tr( "PLOT2D_SCALE_MODE_LOGARITHMIC" ) );
188 aScaleLayout->addWidget( xScaleLab, 0, 0 );
189 aScaleLayout->addWidget( myXModeCombo, 0, 1 );
190 aScaleLayout->addWidget( yScaleLab, 0, 2 );
191 aScaleLayout->addWidget( myYModeCombo, 0, 3 );
193 // tab widget for choose properties of axis
194 QTabWidget* aTabWidget = new QTabWidget( this );
196 // widget for parameters on Ox
197 QWidget* aXWidget = new QWidget(aTabWidget);
198 QGridLayout* aXLayout = new QGridLayout( aXWidget );
199 aXLayout->setSpacing( SPACING_SIZE );
200 aXLayout->setMargin( MARGIN_SIZE );
203 myTitleXCheck = new QCheckBox( tr( "PLOT2D_ENABLE_HOR_TITLE" ), aXWidget );
204 myTitleXEdit = new QLineEdit( aXWidget );
205 myTitleXEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
206 myTitleXEdit->setMinimumWidth( MIN_EDIT_WIDTH );
207 aXLayout->addWidget( myTitleXCheck,1, 0 );
208 aXLayout->addWidget( myTitleXEdit, 1, 1, 1, 3 );
211 QGroupBox* aGridGrpX = new QGroupBox( tr( "PLOT2D_GRID_TLT" ), aXWidget );
212 QGridLayout* aGridLayoutX = new QGridLayout( aGridGrpX );
213 aGridLayoutX->setMargin( MARGIN_SIZE );
214 aGridLayoutX->setSpacing( SPACING_SIZE );
216 myXGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_HOR_MAJOR" ), aGridGrpX );
218 QLabel* aXMajLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpX);
219 myXGridSpin = new QSpinBox( aGridGrpX );
220 myXGridSpin->setMinimum( 1 );
221 myXGridSpin->setMaximum( 100 );
222 myXGridSpin->setSingleStep( 1 );
223 myXGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
224 myXGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
226 myXMinGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_HOR_MINOR" ), aGridGrpX );
228 QLabel* aXMinLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpX);
229 myXMinGridSpin = new QSpinBox( aGridGrpX );
230 myXMinGridSpin->setMinimum( 1 );
231 myXMinGridSpin->setMaximum( 100 );
232 myXMinGridSpin->setSingleStep( 1 );
233 myXMinGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
234 myXMinGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
236 aGridLayoutX->addWidget( myXGridCheck, 0, 0 );
237 aGridLayoutX->addWidget( aXMajLbl, 0, 1 );
238 aGridLayoutX->addWidget( myXGridSpin, 0, 2 );
239 aGridLayoutX->addWidget( myXMinGridCheck, 1, 0 );
240 aGridLayoutX->addWidget( aXMinLbl, 1, 1 );
241 aGridLayoutX->addWidget( myXMinGridSpin, 1, 2 );
242 aXLayout->addWidget( aGridGrpX, 3, 0, 1, 4 );
244 aTabWidget->addTab( aXWidget, tr( "INF_AXES_X" ) );
246 // widget for parameters on Oy
247 QWidget* aYWidget = new QWidget(aTabWidget);
248 QGridLayout* aYLayout = new QGridLayout( aYWidget );
249 aYLayout->setSpacing( SPACING_SIZE );
250 aYLayout->setMargin( MARGIN_SIZE );
253 myTitleYCheck = new QCheckBox( tr( "PLOT2D_ENABLE_VER_TITLE" ), aYWidget );
254 myTitleYEdit = new QLineEdit( aYWidget );
255 myTitleYEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
256 myTitleYEdit->setMinimumWidth( MIN_EDIT_WIDTH );
257 aYLayout->addWidget( myTitleYCheck,1, 0 );
258 aYLayout->addWidget( myTitleYEdit, 1, 1, 1, 3 );
261 QGroupBox* aGridGrpY = new QGroupBox( tr( "PLOT2D_GRID_TLT" ), aYWidget );
262 QGridLayout* aGridLayoutY = new QGridLayout( aGridGrpY );
263 aGridGrpY->setLayout( aGridLayoutY );
264 aGridLayoutY->setMargin( MARGIN_SIZE ); aGridLayoutY->setSpacing( SPACING_SIZE );
266 myYGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MAJOR" ), aGridGrpY );
268 QLabel* aYMajLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpY);
269 myYGridSpin = new QSpinBox( aGridGrpY );
270 myYGridSpin->setMinimum( 1 );
271 myYGridSpin->setMaximum( 100 );
272 myYGridSpin->setSingleStep( 1 );
273 myYGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
274 myYGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
276 myYMinGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MINOR" ), aGridGrpY );
278 QLabel* aYMinLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpY);
279 myYMinGridSpin = new QSpinBox( aGridGrpY );
280 myYMinGridSpin->setMinimum( 1 );
281 myYMinGridSpin->setMaximum( 100 );
282 myYMinGridSpin->setSingleStep( 1 );
283 myYMinGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
284 myYMinGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
286 aGridLayoutY->addWidget( myYGridCheck, 0, 0 );
287 aGridLayoutY->addWidget( aYMajLbl, 0, 1 );
288 aGridLayoutY->addWidget( myYGridSpin, 0, 2 );
289 aGridLayoutY->addWidget( myYMinGridCheck, 1, 0 );
290 aGridLayoutY->addWidget( aYMinLbl, 1, 1 );
291 aGridLayoutY->addWidget( myYMinGridSpin, 1, 2 );
292 aYLayout->addWidget( aGridGrpY, 3, 0, 1, 4 );
294 aTabWidget->addTab( aYWidget, tr( "INF_AXES_Y_LEFT" ) );
296 // if exist second axis Oy, addition new tab widget for right axis
297 if ( mySecondAxisY ) {
298 // widget for parameters on Oy
299 QWidget* aYWidget2 = new QWidget( aTabWidget );
300 QGridLayout* aYLayout2 = new QGridLayout( aYWidget2 );
301 aYLayout2->setSpacing( SPACING_SIZE );
302 aYLayout2->setMargin( MARGIN_SIZE );
305 myTitleY2Check = new QCheckBox( tr( "PLOT2D_ENABLE_VER_TITLE" ), aYWidget2 );
306 myTitleY2Edit = new QLineEdit( aYWidget2 );
307 myTitleY2Edit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
308 myTitleY2Edit->setMinimumWidth( MIN_EDIT_WIDTH );
309 aYLayout2->addWidget( myTitleY2Check,1, 0 );
310 aYLayout2->addWidget( myTitleY2Edit, 1, 1, 1, 3 );
313 QGroupBox* aGridGrpY2 = new QGroupBox( tr( "PLOT2D_GRID_TLT" ), aYWidget2 );
314 QGridLayout* aGridLayoutY2 = new QGridLayout( aGridGrpY2 );
315 aGridGrpY2->setLayout( aGridLayoutY2 );
316 aGridLayoutY2->setMargin( MARGIN_SIZE ); aGridLayoutY2->setSpacing( SPACING_SIZE );
318 myY2GridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MAJOR" ), aGridGrpY2 );
320 QLabel* aY2MajLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpY2);
321 myY2GridSpin = new QSpinBox( aGridGrpY2 );
322 myY2GridSpin->setMinimum( 1 );
323 myY2GridSpin->setMaximum( 100 );
324 myY2GridSpin->setSingleStep( 1 );
325 myY2GridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
326 myY2GridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
328 myY2MinGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MINOR" ), aGridGrpY2 );
330 QLabel* aY2MinLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpY2);
331 myY2MinGridSpin = new QSpinBox( aGridGrpY2 );
332 myY2MinGridSpin->setMinimum( 1 );
333 myY2MinGridSpin->setMaximum( 100 );
334 myY2MinGridSpin->setSingleStep( 1 );
335 myY2MinGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
336 myY2MinGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
338 aGridLayoutY2->addWidget( myY2GridCheck, 0, 0 );
339 aGridLayoutY2->addWidget( aY2MajLbl, 0, 1 );
340 aGridLayoutY2->addWidget( myY2GridSpin, 0, 2 );
341 aGridLayoutY2->addWidget( myY2MinGridCheck, 1, 0 );
342 aGridLayoutY2->addWidget( aY2MinLbl, 1, 1 );
343 aGridLayoutY2->addWidget( myY2MinGridSpin, 1, 2 );
344 aYLayout2->addWidget( aGridGrpY2, 3, 0, 1, 4 );
346 aTabWidget->addTab( aYWidget2, tr( "INF_AXES_Y_RIGHT" ) );
353 myY2MinGridCheck = 0;
358 aTabWidget->setCurrentIndex( 0 );
359 /* "Set as default" check box */
361 myDefCheck = new QCheckBox( tr( "PLOT2D_SET_AS_DEFAULT_CHECK" ), this );
363 /* OK/Cancel buttons */
364 myOkBtn = new QPushButton( tr( "BUT_OK" ), this );
365 myOkBtn->setAutoDefault( TRUE );
366 myOkBtn->setDefault( TRUE );
367 myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this );
368 myCancelBtn->setAutoDefault( TRUE );
369 myHelpBtn = new QPushButton( tr( "BUT_HELP" ), this );
370 myHelpBtn->setAutoDefault( TRUE );
371 QHBoxLayout* btnLayout = new QHBoxLayout;
372 btnLayout->addWidget( myOkBtn );
373 btnLayout->addStretch();
374 btnLayout->addWidget( myCancelBtn );
375 btnLayout->addWidget( myHelpBtn );
378 topLayout->addWidget( myTitleCheck, 0, 0 );
379 topLayout->addWidget( myTitleEdit, 0, 1, 1, 3 );
380 topLayout->addWidget( myLegendCheck, 1, 0 );
381 topLayout->addWidget( myLegendCombo, 1, 1 );
382 topLayout->addWidget( aCurveLab, 1, 2 );
383 topLayout->addWidget( myCurveCombo, 1, 3 );
384 topLayout->addWidget( aLegendFontLab,2, 0 );
385 topLayout->addWidget( myLegendFont, 2, 1 );
386 topLayout->addWidget( myLegendColor, 2, 2 );
388 topLayout->addWidget( aMarkerLab, 3, 0 );
389 topLayout->addWidget( myMarkerSpin, 3, 1 );
390 QHBoxLayout* bgLayout = new QHBoxLayout;
391 bgLayout->addWidget( myBackgroundBtn ); bgLayout->addStretch();
392 topLayout->addWidget( aBGLab, 3, 2 );
393 topLayout->addLayout( bgLayout, 3, 3 );
394 topLayout->addWidget( aDeviationGrp, 4, 0, 1, 4 );
395 topLayout->addWidget( aNormalizeGrp, 5, 0, 1, 4 );
396 topLayout->addWidget( aScaleGrp, 6, 0, 1, 4 );
397 topLayout->addWidget( aTabWidget, 7, 0, 1, 4 );
398 topLayout->addWidget( myDefCheck, 8, 0, 1, 4 );
399 topLayout->setRowStretch( 9, 5 );
401 topLayout->addLayout( btnLayout, 10, 0, 1, 4 );
406 connect( myTitleCheck, SIGNAL( clicked() ), this, SLOT( onMainTitleChecked() ) );
407 connect( myTitleXCheck, SIGNAL( clicked() ), this, SLOT( onXTitleChecked() ) );
408 connect( myTitleYCheck, SIGNAL( clicked() ), this, SLOT( onYTitleChecked() ) );
409 connect( myLegendCheck, SIGNAL( clicked() ), this, SLOT( onLegendChecked() ) );
410 connect( myXGridCheck, SIGNAL( clicked() ), this, SLOT( onXGridMajorChecked() ) );
411 connect( myYGridCheck, SIGNAL( clicked() ), this, SLOT( onYGridMajorChecked() ) );
412 connect( myXMinGridCheck, SIGNAL( clicked() ), this, SLOT( onXGridMinorChecked() ) );
413 connect( myYMinGridCheck, SIGNAL( clicked() ), this, SLOT( onYGridMinorChecked() ) );
414 connect( myNormLMaxCheck, SIGNAL( clicked() ), this, SLOT( onNormLMaxChecked() ) );
415 connect( myNormLMinCheck, SIGNAL( clicked() ), this, SLOT( onNormLMinChecked() ) );
416 connect( myNormRMaxCheck, SIGNAL( clicked() ), this, SLOT( onNormRMaxChecked() ) );
417 connect( myNormRMinCheck, SIGNAL( clicked() ), this, SLOT( onNormRMinChecked() ) );
420 connect( myOkBtn, SIGNAL( clicked() ), this, SLOT( accept() ) );
421 connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
422 connect( myHelpBtn, SIGNAL( clicked() ), this, SLOT( onHelp() ) );
424 if ( mySecondAxisY ) {
425 connect( myTitleY2Check, SIGNAL( clicked() ), this, SLOT( onY2TitleChecked() ) );
426 connect( myY2GridCheck, SIGNAL( clicked() ), this, SLOT( onY2GridMajorChecked() ) );
427 connect( myY2MinGridCheck, SIGNAL( clicked() ), this, SLOT( onY2GridMinorChecked() ) );
431 setBackgroundColor( Qt::gray );
432 onMainTitleChecked();
436 onXGridMajorChecked();
437 onYGridMajorChecked();
438 onXGridMinorChecked();
443 if ( mySecondAxisY ) {
445 onY2GridMajorChecked();
446 onY2GridMinorChecked();
453 Plot2d_SetupViewDlg::~Plot2d_SetupViewDlg()
458 \brief Set main title attributes.
459 \param enable if \c true main title is enabled
460 \param title main title
461 \sa isMainTitleEnabled(), getMainTitle()
463 void Plot2d_SetupViewDlg::setMainTitle( bool enable, const QString& title )
465 myTitleCheck->setChecked( enable );
466 if ( !title.isNull() )
467 myTitleEdit->setText( title );
468 onMainTitleChecked();
472 \brief Check if main title is enabled.
473 \return \c true if main title is enabled
476 bool Plot2d_SetupViewDlg::isMainTitleEnabled()
478 return myTitleCheck->isChecked();
482 \brief Get main title.
486 QString Plot2d_SetupViewDlg::getMainTitle()
488 return myTitleEdit->text();
492 \brief Set horizontal axis title attributes.
493 \param enable if \c true horizontal axis title is enabled
494 \param title horizontal axis title
495 \sa isXTitleEnabled(), getXTitle()
497 void Plot2d_SetupViewDlg::setXTitle( bool enable, const QString& title )
499 myTitleXCheck->setChecked( enable );
500 if ( !title.isNull() )
501 myTitleXEdit->setText( title );
506 \brief Check if main title is enabled.
507 \return \c true if horizontal axis title is enabled
510 bool Plot2d_SetupViewDlg::isXTitleEnabled()
512 return myTitleXCheck->isChecked();
516 \brief Get horizontal axis title.
517 \return horizontal axis title
520 QString Plot2d_SetupViewDlg::getXTitle()
522 return myTitleXEdit->text();
526 \brief Set left vertical axis title attributes.
527 \param enable if \c true left vertical axis title is enabled
528 \param title left vertical axis title
529 \sa setY2Title(), isYTitleEnabled(), getYTitle()
531 void Plot2d_SetupViewDlg::setYTitle( bool enable, const QString& title )
533 myTitleYCheck->setChecked( enable );
534 if ( !title.isNull() )
535 myTitleYEdit->setText( title );
540 \brief Set right vertical axis title attributes.
541 \param enable if \c true right vertical axis title is enabled
542 \param title right vertical axis title
543 \sa setYTitle(), isY2TitleEnabled(), getY2Title()
545 void Plot2d_SetupViewDlg::setY2Title( bool enable, const QString& title )
547 myTitleY2Check->setChecked( enable );
548 if ( !title.isNull() )
549 myTitleY2Edit->setText( title );
554 \brief Check if left vertical axis title is enabled.
555 \return \c true if right vertical axis title is enabled
558 bool Plot2d_SetupViewDlg::isYTitleEnabled()
560 return myTitleYCheck->isChecked();
564 \brief Check if right vertical axis title is enabled.
565 \return \c true if right vertical axis title is enabled
568 bool Plot2d_SetupViewDlg::isY2TitleEnabled()
570 return myTitleY2Check->isChecked();
574 \brief Get left vertical axis title.
575 \return left vertical axis title
578 QString Plot2d_SetupViewDlg::getYTitle()
580 return myTitleYEdit->text();
584 \brief Get right vertical axis title.
585 \return right vertical axis title
588 QString Plot2d_SetupViewDlg::getY2Title()
590 return myTitleY2Edit->text();
594 \brief Set curve type.
595 \param type curve type: 0 (points), 1 (lines) or 2 (splines)
598 void Plot2d_SetupViewDlg::setCurveType( const int type )
600 myCurveCombo->setCurrentIndex( type );
604 \brief Get curve type.
605 \return curve type: 0 (points), 1 (lines) or 2 (splines)
608 int Plot2d_SetupViewDlg::getCurveType()
610 return myCurveCombo->currentIndex();
614 \brief Set normalization to maximum by left Y axis.
615 \param type normalizatoin type: true,false
618 void Plot2d_SetupViewDlg::setLMaxNormMode( const bool type )
620 myNormLMaxCheck->setChecked( type );
624 \brief Check if normalization to maximum by left Y axis sets.
625 \return curve normalizatoin type: true,false
628 bool Plot2d_SetupViewDlg::getLMaxNormMode()
630 return myNormLMaxCheck->isChecked();
634 \brief Set normalization to minimum by left Y axis.
635 \param type normalizatoin type: true,false
638 void Plot2d_SetupViewDlg::setLMinNormMode( const bool type )
640 myNormLMinCheck->setChecked( type );
644 \brief Check if normalization to minimum by left Y axis sets.
645 \return curve normalizatoin type: true,false
648 bool Plot2d_SetupViewDlg::getLMinNormMode()
650 return myNormLMinCheck->isChecked();
654 \brief Set normalization to maximum by right Y axis.
655 \param type normalizatoin type: true,false
658 void Plot2d_SetupViewDlg::setRMaxNormMode( const bool type )
660 myNormRMaxCheck->setChecked( type );
664 \brief Check if normalization to maximum by right Y axis sets.
665 \return curve normalizatoin type: true,false
668 bool Plot2d_SetupViewDlg::getRMaxNormMode()
670 return myNormRMaxCheck->isChecked();
674 \brief Set normalization to minimum by right Y axis.
675 \param type normalizatoin type: true,false
678 void Plot2d_SetupViewDlg::setRMinNormMode( const bool type )
680 myNormRMinCheck->setChecked( type );
684 \brief Check if normalization to minimum by right Y axis sets.
685 \return curve normalizatoin type: true,false
688 bool Plot2d_SetupViewDlg::getRMinNormMode()
690 return myNormRMinCheck->isChecked();
694 \brief Set legend attribute.
695 \param if \c true legend is shown
696 \param pos legend position: 0 (left), 1 (right), 2 (top), 3 (bottom)
697 \param fnt legend font
698 \param col legend font color
699 \sa isLegendEnabled(), getLegendPos(), getLegendFont()
701 void Plot2d_SetupViewDlg::setLegend( bool enable, int pos, const QFont& fnt, const QColor& col )
703 myLegendCheck->setChecked( enable );
704 myLegendCombo->setCurrentIndex( pos );
705 myLegendFont->setCurrentFont( fnt );
706 myLegendColor->setColor( col );
711 \brief Check if legend is enabled.
712 \return \c true if legend is enabled
715 bool Plot2d_SetupViewDlg::isLegendEnabled()
717 return myLegendCheck->isChecked();
721 \brief Get legend position.
722 \return legend position: 0 (left), 1 (right), 2 (top), 3 (bottom)
725 int Plot2d_SetupViewDlg::getLegendPos()
727 return myLegendCombo->currentIndex();
731 \brief Get legend font.
735 QFont Plot2d_SetupViewDlg::getLegendFont()
737 return myLegendFont->currentFont();
741 \brief Get legend font color.
742 \return legend font color
745 QColor Plot2d_SetupViewDlg::getLegendColor()
747 return myLegendColor->color();
751 \brief Set marker size.
752 \param size marker size
755 void Plot2d_SetupViewDlg::setMarkerSize( const int size )
757 myMarkerSpin->setValue( size );
761 \brief Get marker size.
765 int Plot2d_SetupViewDlg::getMarkerSize()
767 return myMarkerSpin->value();
770 \brief Set deviation marker line width.
771 \param width marker line width
772 \sa getDeviationMarkerLw()
774 void Plot2d_SetupViewDlg::setDeviationMarkerLw( const int width ){
775 myDeviationLw->setValue(width);
779 \brief Get deviation marker line width.
780 \return marker line width
783 int Plot2d_SetupViewDlg::getDeviationMarkerLw() const {
784 return myDeviationLw->value();
788 \brief Set deviation marker tick size.
789 \param size marker tick size
790 \sa getDeviationMarkerTs()
792 void Plot2d_SetupViewDlg::setDeviationMarkerTs( const int size) {
793 myDeviationTs->setValue(size);
797 \brief Get deviation marker tick size.
798 \return marker tick size
799 \sa setDeviationMarkerTs()
801 int Plot2d_SetupViewDlg::getDeviationMarkerTs() const {
802 return myDeviationTs->value();
806 \brief Set color of the deviation marker.
807 \param color marker color
808 \sa getDeviationMarkerCl()
810 void Plot2d_SetupViewDlg::setDeviationMarkerCl( const QColor& col) {
811 myDeviationCl->setColor( col );
815 \brief Get color of the deviation marker.
817 \sa setDeviationMarkerCl()
819 QColor Plot2d_SetupViewDlg::getDeviationMarkerCl() const {
820 return myDeviationCl->color();
824 \brief Set background color.
825 \param color background color
826 \sa getBackgroundColor()
828 void Plot2d_SetupViewDlg::setBackgroundColor( const QColor& color )
830 myBackgroundBtn->setColor( color );
834 \brief Get background color.
835 \return background color
836 \sa setBackgroundColor()
838 QColor Plot2d_SetupViewDlg::getBackgroundColor()
840 return myBackgroundBtn->color();
844 \brief Set major grid parameters.
845 \param enableX if \c true, horizontal major grid is enabled
846 \param divX maximum number of ticks for horizontal major grid
847 \param enableY if \c true, left vertical major grid is enabled
848 \param divY maximum number of ticks for left vertical major grid
849 \param enableY2 if \c true, right vertical major grid is enabled
850 \param divY2 maximum number of ticks for right vertical major grid
853 void Plot2d_SetupViewDlg::setMajorGrid( bool enableX, const int divX,
854 bool enableY, const int divY,
855 bool enableY2, const int divY2 )
857 myXGridCheck->setChecked( enableX );
858 myXGridSpin->setValue( divX );
859 myYGridCheck->setChecked( enableY );
860 myYGridSpin->setValue( divY );
861 onXGridMajorChecked();
862 onYGridMajorChecked();
864 myY2GridCheck->setChecked( enableY2 );
865 myY2GridSpin->setValue( divY2 );
866 onY2GridMajorChecked();
871 \brief Get major grid parameters.
872 \param enableX \c true if horizontal major grid is enabled
873 \param divX maximum number of ticks for horizontal major grid
874 \param enableY \c true if left vertical major grid is enabled
875 \param divY maximum number of ticks for left vertical major grid
876 \param enableY2 \c true if right vertical major grid is enabled
877 \param divY2 maximum number of ticks for right vertical major grid
880 void Plot2d_SetupViewDlg::getMajorGrid( bool& enableX, int& divX,
881 bool& enableY, int& divY,
882 bool& enableY2, int& divY2 )
884 enableX = myXGridCheck->isChecked();
885 divX = myXGridSpin->value();
886 enableY = myYGridCheck->isChecked();
887 divY = myYGridSpin->value();
889 enableY2 = myY2GridCheck->isChecked();
890 divY2 = myY2GridSpin->value();
899 \brief Set minor grid parameters.
900 \param enableX if \c true, horizontal minor grid is enabled
901 \param divX maximum number of ticks for horizontal minor grid
902 \param enableY if \c true, left vertical minor grid is enabled
903 \param divY maximum number of ticks for left vertical minor grid
904 \param enableY2 if \c true, right vertical minor grid is enabled
905 \param divY2 maximum number of ticks for right vertical minor grid
908 void Plot2d_SetupViewDlg::setMinorGrid( bool enableX, const int divX,
909 bool enableY, const int divY,
910 bool enableY2, const int divY2 )
912 myXMinGridCheck->setChecked( enableX );
913 myXMinGridSpin->setValue( divX );
914 myYMinGridCheck->setChecked( enableY );
915 myYMinGridSpin->setValue( divY );
916 onXGridMinorChecked();
917 onYGridMinorChecked();
919 myY2MinGridCheck->setChecked( enableY2 );
920 myY2MinGridSpin->setValue( divY2 );
921 onY2GridMinorChecked();
926 \brief Get minor grid parameters.
927 \param enableX \c true if horizontal minor grid is enabled
928 \param divX maximum number of ticks for horizontal minor grid
929 \param enableY \c true if left vertical minor grid is enabled
930 \param divY maximum number of ticks for left vertical minor grid
931 \param enableY2 \c true if right vertical minor grid is enabled
932 \param divY2 maximum number of ticks for right vertical minor grid
935 void Plot2d_SetupViewDlg::getMinorGrid( bool& enableX, int& divX,
936 bool& enableY, int& divY,
937 bool& enableY2, int& divY2 )
939 enableX = myXMinGridCheck->isChecked();
940 divX = myXMinGridSpin->value();
941 enableY = myYMinGridCheck->isChecked();
942 divY = myYMinGridSpin->value();
943 if ( mySecondAxisY ) {
944 enableY2 = myY2MinGridCheck->isChecked();
945 divY2 = myY2MinGridSpin->value();
954 \brief Set scale mode for horizontal and vertical axes.
955 \param xMode horizontal axis scale mode: 0 (linear), 1 (logarithmic)
956 \param yMode vertical axis scale mode: 0 (linear), 1 (logarithmic)
957 \sa getXScaleMode(), getYScaleMode()
959 void Plot2d_SetupViewDlg::setScaleMode( const int xMode, const int yMode )
961 myXModeCombo->setCurrentIndex( xMode );
962 myYModeCombo->setCurrentIndex( yMode );
966 \brief Get scale mode for horizontal axis.
967 \return horizontal axis scale mode: 0 (linear), 1 (logarithmic)
970 int Plot2d_SetupViewDlg::getXScaleMode()
972 return myXModeCombo->currentIndex();
976 \brief Get scale mode for vertical axis.
977 \return vertical axis scale mode: 0 (linear), 1 (logarithmic)
980 int Plot2d_SetupViewDlg::getYScaleMode()
982 return myYModeCombo->currentIndex();
986 \brief Called when user clicks "Show main title" check box.
988 void Plot2d_SetupViewDlg::onMainTitleChecked()
990 myTitleEdit->setEnabled( myTitleCheck->isChecked() );
994 \brief Called when user clicks "Show horizontal axis title" check box.
996 void Plot2d_SetupViewDlg::onXTitleChecked()
998 myTitleXEdit->setEnabled( myTitleXCheck->isChecked() );
1002 \brief Called when user clicks "Show vertical left axis title" check box.
1004 void Plot2d_SetupViewDlg::onYTitleChecked()
1006 myTitleYEdit->setEnabled( myTitleYCheck->isChecked() );
1010 \brief Called when user clicks "Show vertical right axis title" check box.
1012 void Plot2d_SetupViewDlg::onY2TitleChecked()
1014 myTitleY2Edit->setEnabled( myTitleY2Check->isChecked() );
1018 \brief Called when user clicks "Show Legend" check box.
1020 void Plot2d_SetupViewDlg::onLegendChecked()
1022 myLegendCombo->setEnabled( myLegendCheck->isChecked() );
1026 \brief Called when user clicks "Enable horizontal major grid" check box.
1028 void Plot2d_SetupViewDlg::onXGridMajorChecked()
1030 myXMinGridCheck->setEnabled( myXGridCheck->isChecked() );
1034 \brief Called when user clicks "Enable left vertical major grid" check box.
1036 void Plot2d_SetupViewDlg::onYGridMajorChecked()
1038 myYMinGridCheck->setEnabled( myYGridCheck->isChecked() );
1042 \brief Called when user clicks "Enable right vertical major grid" check box.
1044 void Plot2d_SetupViewDlg::onY2GridMajorChecked()
1046 myY2MinGridCheck->setEnabled( myY2GridCheck->isChecked() );
1050 \brief Called when user clicks "Enable horizontal minor grid" check box.
1052 void Plot2d_SetupViewDlg::onXGridMinorChecked()
1057 \brief Called when user clicks "Enable left vertical minor grid" check box.
1059 void Plot2d_SetupViewDlg::onYGridMinorChecked()
1064 \brief Called when user clicks "Enable right vertical minor grid" check box.
1066 void Plot2d_SetupViewDlg::onY2GridMinorChecked()
1071 \brief Called when user clicks "Left Y Axis: Normalize to maximum" check box.
1073 void Plot2d_SetupViewDlg::onNormLMaxChecked()
1078 \brief Called when user clicks "Left Y Axis: Normalize to minimum" check box.
1080 void Plot2d_SetupViewDlg::onNormLMinChecked()
1085 \brief Called when user clicks "Right Y Axis: Normalize to maximum" check box.
1087 void Plot2d_SetupViewDlg::onNormRMaxChecked()
1092 \brief Called when user clicks "Right Y Axis: Normalize to minimum" check box.
1094 void Plot2d_SetupViewDlg::onNormRMinChecked()
1099 \brief Get "Set settings as default" check box value.
1100 \return \c true if "Set settings as default" check box is on
1102 bool Plot2d_SetupViewDlg::isSetAsDefault()
1104 return myDefCheck->isChecked();
1108 Slot, called when user clicks "Help" button
1110 void Plot2d_SetupViewDlg::onHelp()
1113 SUIT_Application* app = SUIT_Session::session()->activeApplication();
1115 app->onHelpContextModule( "GUI", "plot2d_viewer_page.html", "settings" );