1 // Copyright (C) 2007-2014 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, or (at your option) any later version.
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 QLabel* aMarkerLab = new QLabel( tr( "PLOT2D_MARKER_SIZE_LBL" ), this );
94 myMarkerSpin = new QSpinBox( this );
95 myMarkerSpin->setMinimum( 0 );
96 myMarkerSpin->setMaximum( 100 );
97 myMarkerSpin->setSingleStep( 1 );
98 myMarkerSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
99 myMarkerSpin->setMinimumWidth( MIN_SPIN_WIDTH );
102 QLabel* aBGLab = new QLabel( tr( "PLOT2D_BACKGROUND_COLOR_LBL" ), this );
103 myBackgroundBtn = new QtxColorButton( this );
106 QLabel* aSelectionLab = new QLabel( tr( "PLOT2D_SELECTION_COLOR_LBL" ), this );
107 mySelectionBtn = new QtxColorButton( this );
109 QHBoxLayout* ViewerColorLayout = new QHBoxLayout;
110 ViewerColorLayout->addWidget( aBGLab );
111 ViewerColorLayout->addWidget( myBackgroundBtn );
112 ViewerColorLayout->addStretch();
113 ViewerColorLayout->addWidget( aSelectionLab );
114 ViewerColorLayout->addWidget( mySelectionBtn );
115 ViewerColorLayout->addStretch();
118 QGroupBox* aLegendGrp = new QGroupBox( tr( "PLOT2D_LEGEND_GROUP" ), this );
119 QGridLayout* aLegendLayout = new QGridLayout( aLegendGrp );
120 aLegendLayout->setMargin( MARGIN_SIZE ); aLegendLayout->setSpacing( SPACING_SIZE );
121 aLegendGrp->setLayout( aLegendLayout );
123 myLegendCheck = new QCheckBox( tr( "PLOT2D_ENABLE_LEGEND" ), this );
125 QLabel* aLegendPosition = new QLabel( tr( "PLOT2D_LEGEND_POSITION" ), this );
126 myLegendCombo = new QComboBox( this );
127 myLegendCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
128 myLegendCombo->setMinimumWidth( MIN_COMBO_WIDTH );
129 myLegendCombo->addItem( tr( "PLOT2D_LEGEND_POSITION_LEFT" ) );
130 myLegendCombo->addItem( tr( "PLOT2D_LEGEND_POSITION_RIGHT" ) );
131 myLegendCombo->addItem( tr( "PLOT2D_LEGEND_POSITION_TOP" ) );
132 myLegendCombo->addItem( tr( "PLOT2D_LEGEND_POSITION_BOTTOM" ) );
134 QLabel* aLegendSymbolType = new QLabel( tr( "PLOT2D_LEGEND_SYMBOL_TYPE" ), this );
135 myLegendSymbolType = new QComboBox( this );
136 myLegendSymbolType->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
137 myLegendSymbolType->setMinimumWidth( MIN_COMBO_WIDTH );
138 myLegendSymbolType->addItem( tr( "PLOT2D_MARKER_ON_LINE" ) );
139 myLegendSymbolType->addItem( tr( "PLOT2D_MARKER_ABOVE_LINE" ) );
141 QLabel* aLegendFontLab = new QLabel( tr( "PLOT2D_LEGEND_FONT" ), this );
142 myLegendFont = new QtxFontEdit( this );
144 QLabel* aLegendFontColor = new QLabel( tr( "PLOT2D_LEGEND_FONT_COLOR" ), this );
145 myLegendFontColor = new QtxColorButton( this );
147 QLabel* aSelectLegendFontColor = new QLabel( tr( "PLOT2D_SELECTED_LEGEND_FONT_COLOR" ), this );
148 mySelectedLegendFontColor = new QtxColorButton( this );
150 QHBoxLayout* FontLayout = new QHBoxLayout;
151 FontLayout->addWidget( aLegendFontColor );
152 FontLayout->addWidget( myLegendFontColor );
153 FontLayout->addStretch();
154 FontLayout->addWidget( aSelectLegendFontColor );
155 FontLayout->addWidget( mySelectedLegendFontColor );
156 FontLayout->addStretch();
158 aLegendLayout->addWidget( myLegendCheck, 0, 0 );
159 aLegendLayout->addWidget( aLegendPosition, 1, 0 );
160 aLegendLayout->addWidget( myLegendCombo, 1, 1 );
161 aLegendLayout->addWidget( aLegendSymbolType, 2, 0 );
162 aLegendLayout->addWidget( myLegendSymbolType, 2, 1 );
163 aLegendLayout->addWidget( aLegendFontLab, 3, 0 );
164 aLegendLayout->addWidget( myLegendFont, 3, 1 );
165 aLegendLayout->addLayout( FontLayout, 4, 0, 1, 2 );
167 //Deviation marker parameters
168 QGroupBox* aDeviationGrp = new QGroupBox( tr( "PLOT2D_DEVIATION_MARKER_TLT" ), this );
169 QHBoxLayout* aDeviationLayout = new QHBoxLayout(aDeviationGrp);
171 //Deviation marker parameters : Line width
172 QLabel* aDeviationLwLbl = new QLabel( tr( "PLOT2D_DEVIATION_LW_LBL" ), aDeviationGrp );
173 myDeviationLw = new QSpinBox( aDeviationGrp );
174 myDeviationLw->setMinimum( 1 );
175 myDeviationLw->setMaximum( 5 );
176 myDeviationLw->setSingleStep( 1 );
177 myDeviationLw->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
179 //Deviation marker parameters : Line width
180 QLabel* aDeviationTsLbl = new QLabel( tr( "PLOT2D_DEVIATION_TS_LBL" ), aDeviationGrp );
181 myDeviationTs = new QSpinBox( aDeviationGrp );
182 myDeviationTs->setMinimum( 1 );
183 myDeviationTs->setMaximum( 5 );
184 myDeviationTs->setSingleStep( 1 );
185 myDeviationTs->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
187 //Deviation marker parameters : Color
188 QLabel* aDeviationClLbl = new QLabel( tr( "PLOT2D_DEVIATION_CL_LBL" ), aDeviationGrp );
189 myDeviationCl = new QtxColorButton( aDeviationGrp );
191 aDeviationLayout->addWidget( aDeviationLwLbl );
192 aDeviationLayout->addWidget( myDeviationLw );
193 aDeviationLayout->addWidget( aDeviationTsLbl );
194 aDeviationLayout->addWidget( myDeviationTs );
195 aDeviationLayout->addWidget( aDeviationClLbl );
196 aDeviationLayout->addWidget( myDeviationCl );
199 QGroupBox* aNormalizeGrp = new QGroupBox( tr( "PLOT2D_NORMALIZE_TLT" ), this );
200 QGridLayout* aNormalizeLayout = new QGridLayout( aNormalizeGrp );
201 aNormalizeLayout->setMargin( MARGIN_SIZE ); aNormalizeLayout->setSpacing( SPACING_SIZE );
202 aNormalizeGrp->setLayout( aNormalizeLayout );
203 QLabel* aYLeftLab = new QLabel( tr( "PLOT2D_NORMALIZE_LEFT_AXIS" ), aNormalizeGrp );
204 myNormLMinCheck = new QCheckBox( tr( "PLOT2D_NORMALIZE_MODE_MIN" ), aNormalizeGrp );
205 myNormLMaxCheck = new QCheckBox( tr( "PLOT2D_NORMALIZE_MODE_MAX" ), aNormalizeGrp );
206 QLabel* aYRightLab = new QLabel( tr( "PLOT2D_NORMALIZE_RIGHT_AXIS" ), aNormalizeGrp );
207 myNormRMinCheck = new QCheckBox( tr( "PLOT2D_NORMALIZE_MODE_MIN" ), aNormalizeGrp );
208 myNormRMaxCheck = new QCheckBox( tr( "PLOT2D_NORMALIZE_MODE_MAX" ), aNormalizeGrp );
210 aNormalizeLayout->addWidget( aYLeftLab, 0, 0 );
211 aNormalizeLayout->addWidget( myNormLMaxCheck, 0, 1 );
212 aNormalizeLayout->addWidget( myNormLMinCheck, 0, 2 );
213 aNormalizeLayout->addWidget( aYRightLab, 1, 0 );
214 aNormalizeLayout->addWidget( myNormRMaxCheck, 1, 1 );
215 aNormalizeLayout->addWidget( myNormRMinCheck, 1, 2 );
218 QGroupBox* aScaleGrp = new QGroupBox( tr( "PLOT2D_SCALE_TLT" ), this );
219 QGridLayout* aScaleLayout = new QGridLayout( aScaleGrp );
220 aScaleLayout->setMargin( MARGIN_SIZE ); aScaleLayout->setSpacing( SPACING_SIZE );
221 aScaleGrp->setLayout( aScaleLayout );
223 QLabel* xScaleLab = new QLabel( tr( "PLOT2D_SCALE_MODE_HOR" ), aScaleGrp );
224 myXModeCombo = new QComboBox( aScaleGrp );
225 myXModeCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
226 myXModeCombo->setMinimumWidth( MIN_COMBO_WIDTH );
227 myXModeCombo->addItem( tr( "PLOT2D_SCALE_MODE_LINEAR" ) );
228 myXModeCombo->addItem( tr( "PLOT2D_SCALE_MODE_LOGARITHMIC" ) );
230 QLabel* yScaleLab = new QLabel( tr( "PLOT2D_SCALE_MODE_VER" ), aScaleGrp );
231 myYModeCombo = new QComboBox( aScaleGrp );
232 myYModeCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
233 myYModeCombo->setMinimumWidth( MIN_COMBO_WIDTH );
234 myYModeCombo->addItem( tr( "PLOT2D_SCALE_MODE_LINEAR" ) );
235 myYModeCombo->addItem( tr( "PLOT2D_SCALE_MODE_LOGARITHMIC" ) );
237 aScaleLayout->addWidget( xScaleLab, 0, 0 );
238 aScaleLayout->addWidget( myXModeCombo, 0, 1 );
239 aScaleLayout->addWidget( yScaleLab, 0, 2 );
240 aScaleLayout->addWidget( myYModeCombo, 0, 3 );
242 // tab widget for choose properties of axis
243 QTabWidget* aTabWidget = new QTabWidget( this );
245 // widget for parameters on Ox
246 QWidget* aXWidget = new QWidget(aTabWidget);
247 QGridLayout* aXLayout = new QGridLayout( aXWidget );
248 aXLayout->setSpacing( SPACING_SIZE );
249 aXLayout->setMargin( MARGIN_SIZE );
252 myTitleXCheck = new QCheckBox( tr( "PLOT2D_ENABLE_HOR_TITLE" ), aXWidget );
253 myTitleXEdit = new QLineEdit( aXWidget );
254 myTitleXEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
255 myTitleXEdit->setMinimumWidth( MIN_EDIT_WIDTH );
256 aXLayout->addWidget( myTitleXCheck,1, 0 );
257 aXLayout->addWidget( myTitleXEdit, 1, 1, 1, 3 );
260 QGroupBox* aGridGrpX = new QGroupBox( tr( "PLOT2D_GRID_TLT" ), aXWidget );
261 QGridLayout* aGridLayoutX = new QGridLayout( aGridGrpX );
262 aGridLayoutX->setMargin( MARGIN_SIZE );
263 aGridLayoutX->setSpacing( SPACING_SIZE );
265 myXGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_HOR_MAJOR" ), aGridGrpX );
267 QLabel* aXMajLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpX);
268 myXGridSpin = new QSpinBox( aGridGrpX );
269 myXGridSpin->setMinimum( 1 );
270 myXGridSpin->setMaximum( 100 );
271 myXGridSpin->setSingleStep( 1 );
272 myXGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
273 myXGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
275 myXMinGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_HOR_MINOR" ), aGridGrpX );
277 QLabel* aXMinLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpX);
278 myXMinGridSpin = new QSpinBox( aGridGrpX );
279 myXMinGridSpin->setMinimum( 1 );
280 myXMinGridSpin->setMaximum( 100 );
281 myXMinGridSpin->setSingleStep( 1 );
282 myXMinGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
283 myXMinGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
285 aGridLayoutX->addWidget( myXGridCheck, 0, 0 );
286 aGridLayoutX->addWidget( aXMajLbl, 0, 1 );
287 aGridLayoutX->addWidget( myXGridSpin, 0, 2 );
288 aGridLayoutX->addWidget( myXMinGridCheck, 1, 0 );
289 aGridLayoutX->addWidget( aXMinLbl, 1, 1 );
290 aGridLayoutX->addWidget( myXMinGridSpin, 1, 2 );
291 aXLayout->addWidget( aGridGrpX, 3, 0, 1, 4 );
293 aTabWidget->addTab( aXWidget, tr( "INF_AXES_X" ) );
295 // widget for parameters on Oy
296 QWidget* aYWidget = new QWidget(aTabWidget);
297 QGridLayout* aYLayout = new QGridLayout( aYWidget );
298 aYLayout->setSpacing( SPACING_SIZE );
299 aYLayout->setMargin( MARGIN_SIZE );
302 myTitleYCheck = new QCheckBox( tr( "PLOT2D_ENABLE_VER_TITLE" ), aYWidget );
303 myTitleYEdit = new QLineEdit( aYWidget );
304 myTitleYEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
305 myTitleYEdit->setMinimumWidth( MIN_EDIT_WIDTH );
306 aYLayout->addWidget( myTitleYCheck,1, 0 );
307 aYLayout->addWidget( myTitleYEdit, 1, 1, 1, 3 );
310 QGroupBox* aGridGrpY = new QGroupBox( tr( "PLOT2D_GRID_TLT" ), aYWidget );
311 QGridLayout* aGridLayoutY = new QGridLayout( aGridGrpY );
312 aGridGrpY->setLayout( aGridLayoutY );
313 aGridLayoutY->setMargin( MARGIN_SIZE ); aGridLayoutY->setSpacing( SPACING_SIZE );
315 myYGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MAJOR" ), aGridGrpY );
317 QLabel* aYMajLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpY);
318 myYGridSpin = new QSpinBox( aGridGrpY );
319 myYGridSpin->setMinimum( 1 );
320 myYGridSpin->setMaximum( 100 );
321 myYGridSpin->setSingleStep( 1 );
322 myYGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
323 myYGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
325 myYMinGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MINOR" ), aGridGrpY );
327 QLabel* aYMinLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpY);
328 myYMinGridSpin = new QSpinBox( aGridGrpY );
329 myYMinGridSpin->setMinimum( 1 );
330 myYMinGridSpin->setMaximum( 100 );
331 myYMinGridSpin->setSingleStep( 1 );
332 myYMinGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
333 myYMinGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
335 aGridLayoutY->addWidget( myYGridCheck, 0, 0 );
336 aGridLayoutY->addWidget( aYMajLbl, 0, 1 );
337 aGridLayoutY->addWidget( myYGridSpin, 0, 2 );
338 aGridLayoutY->addWidget( myYMinGridCheck, 1, 0 );
339 aGridLayoutY->addWidget( aYMinLbl, 1, 1 );
340 aGridLayoutY->addWidget( myYMinGridSpin, 1, 2 );
341 aYLayout->addWidget( aGridGrpY, 3, 0, 1, 4 );
343 aTabWidget->addTab( aYWidget, tr( "INF_AXES_Y_LEFT" ) );
345 // if exist second axis Oy, addition new tab widget for right axis
346 if ( mySecondAxisY ) {
347 // widget for parameters on Oy
348 QWidget* aYWidget2 = new QWidget( aTabWidget );
349 QGridLayout* aYLayout2 = new QGridLayout( aYWidget2 );
350 aYLayout2->setSpacing( SPACING_SIZE );
351 aYLayout2->setMargin( MARGIN_SIZE );
354 myTitleY2Check = new QCheckBox( tr( "PLOT2D_ENABLE_VER_TITLE" ), aYWidget2 );
355 myTitleY2Edit = new QLineEdit( aYWidget2 );
356 myTitleY2Edit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
357 myTitleY2Edit->setMinimumWidth( MIN_EDIT_WIDTH );
358 aYLayout2->addWidget( myTitleY2Check,1, 0 );
359 aYLayout2->addWidget( myTitleY2Edit, 1, 1, 1, 3 );
362 QGroupBox* aGridGrpY2 = new QGroupBox( tr( "PLOT2D_GRID_TLT" ), aYWidget2 );
363 QGridLayout* aGridLayoutY2 = new QGridLayout( aGridGrpY2 );
364 aGridGrpY2->setLayout( aGridLayoutY2 );
365 aGridLayoutY2->setMargin( MARGIN_SIZE ); aGridLayoutY2->setSpacing( SPACING_SIZE );
367 myY2GridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MAJOR" ), aGridGrpY2 );
369 QLabel* aY2MajLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpY2);
370 myY2GridSpin = new QSpinBox( aGridGrpY2 );
371 myY2GridSpin->setMinimum( 1 );
372 myY2GridSpin->setMaximum( 100 );
373 myY2GridSpin->setSingleStep( 1 );
374 myY2GridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
375 myY2GridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
377 myY2MinGridCheck = new QCheckBox( tr( "PLOT2D_GRID_ENABLE_VER_MINOR" ), aGridGrpY2 );
379 QLabel* aY2MinLbl = new QLabel( tr( "PLOT2D_MAX_INTERVALS" ), aGridGrpY2);
380 myY2MinGridSpin = new QSpinBox( aGridGrpY2 );
381 myY2MinGridSpin->setMinimum( 1 );
382 myY2MinGridSpin->setMaximum( 100 );
383 myY2MinGridSpin->setSingleStep( 1 );
384 myY2MinGridSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
385 myY2MinGridSpin->setMinimumWidth( MIN_SPIN_WIDTH );
387 aGridLayoutY2->addWidget( myY2GridCheck, 0, 0 );
388 aGridLayoutY2->addWidget( aY2MajLbl, 0, 1 );
389 aGridLayoutY2->addWidget( myY2GridSpin, 0, 2 );
390 aGridLayoutY2->addWidget( myY2MinGridCheck, 1, 0 );
391 aGridLayoutY2->addWidget( aY2MinLbl, 1, 1 );
392 aGridLayoutY2->addWidget( myY2MinGridSpin, 1, 2 );
393 aYLayout2->addWidget( aGridGrpY2, 3, 0, 1, 4 );
395 aTabWidget->addTab( aYWidget2, tr( "INF_AXES_Y_RIGHT" ) );
402 myY2MinGridCheck = 0;
407 aTabWidget->setCurrentIndex( 0 );
408 /* "Set as default" check box */
410 myDefCheck = new QCheckBox( tr( "PLOT2D_SET_AS_DEFAULT_CHECK" ), this );
412 /* OK/Cancel buttons */
413 myOkBtn = new QPushButton( tr( "BUT_OK" ), this );
414 myOkBtn->setAutoDefault( TRUE );
415 myOkBtn->setDefault( TRUE );
416 myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this );
417 myCancelBtn->setAutoDefault( TRUE );
418 myHelpBtn = new QPushButton( tr( "BUT_HELP" ), this );
419 myHelpBtn->setAutoDefault( TRUE );
420 QHBoxLayout* btnLayout = new QHBoxLayout;
421 btnLayout->addWidget( myOkBtn );
422 btnLayout->addStretch();
423 btnLayout->addWidget( myCancelBtn );
424 btnLayout->addWidget( myHelpBtn );
427 topLayout->addWidget( myTitleCheck, 0, 0 );
428 topLayout->addWidget( myTitleEdit, 0, 1, 1, 3 );
429 topLayout->addWidget( aCurveLab, 1, 0 );
430 topLayout->addWidget( myCurveCombo, 1, 1 );
431 topLayout->addWidget( aMarkerLab, 2, 0 );
432 topLayout->addWidget( myMarkerSpin, 2, 1 );
433 topLayout->addLayout( ViewerColorLayout, 3, 0, 1, 4 );
434 topLayout->addWidget( aLegendGrp, 4, 0, 1, 4 );
435 topLayout->addWidget( aDeviationGrp, 5, 0, 1, 4 );
436 topLayout->addWidget( aNormalizeGrp, 6, 0, 1, 4 );
437 topLayout->addWidget( aScaleGrp, 7, 0, 1, 4 );
438 topLayout->addWidget( aTabWidget, 8, 0, 1, 4 );
439 topLayout->addWidget( myDefCheck, 9, 0, 1, 4 );
440 topLayout->setRowStretch( 10, 5 );
441 topLayout->addLayout( btnLayout, 11, 0, 1, 4 );
446 connect( myTitleCheck, SIGNAL( clicked() ), this, SLOT( onMainTitleChecked() ) );
447 connect( myTitleXCheck, SIGNAL( clicked() ), this, SLOT( onXTitleChecked() ) );
448 connect( myTitleYCheck, SIGNAL( clicked() ), this, SLOT( onYTitleChecked() ) );
449 connect( myLegendCheck, SIGNAL( clicked() ), this, SLOT( onLegendChecked() ) );
450 connect( myXGridCheck, SIGNAL( clicked() ), this, SLOT( onXGridMajorChecked() ) );
451 connect( myYGridCheck, SIGNAL( clicked() ), this, SLOT( onYGridMajorChecked() ) );
452 connect( myXMinGridCheck, SIGNAL( clicked() ), this, SLOT( onXGridMinorChecked() ) );
453 connect( myYMinGridCheck, SIGNAL( clicked() ), this, SLOT( onYGridMinorChecked() ) );
454 connect( myNormLMaxCheck, SIGNAL( clicked() ), this, SLOT( onNormLMaxChecked() ) );
455 connect( myNormLMinCheck, SIGNAL( clicked() ), this, SLOT( onNormLMinChecked() ) );
456 connect( myNormRMaxCheck, SIGNAL( clicked() ), this, SLOT( onNormRMaxChecked() ) );
457 connect( myNormRMinCheck, SIGNAL( clicked() ), this, SLOT( onNormRMinChecked() ) );
460 connect( myOkBtn, SIGNAL( clicked() ), this, SLOT( accept() ) );
461 connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
462 connect( myHelpBtn, SIGNAL( clicked() ), this, SLOT( onHelp() ) );
464 if ( mySecondAxisY ) {
465 connect( myTitleY2Check, SIGNAL( clicked() ), this, SLOT( onY2TitleChecked() ) );
466 connect( myY2GridCheck, SIGNAL( clicked() ), this, SLOT( onY2GridMajorChecked() ) );
467 connect( myY2MinGridCheck, SIGNAL( clicked() ), this, SLOT( onY2GridMinorChecked() ) );
471 setBackgroundColor( Qt::gray );
472 onMainTitleChecked();
476 onXGridMajorChecked();
477 onYGridMajorChecked();
478 onXGridMinorChecked();
483 if ( mySecondAxisY ) {
485 onY2GridMajorChecked();
486 onY2GridMinorChecked();
493 Plot2d_SetupViewDlg::~Plot2d_SetupViewDlg()
498 \brief Set main title attributes.
499 \param enable if \c true main title is enabled
500 \param title main title
501 \sa isMainTitleEnabled(), getMainTitle()
503 void Plot2d_SetupViewDlg::setMainTitle( bool enable, const QString& title )
505 myTitleCheck->setChecked( enable );
506 if ( !title.isNull() )
507 myTitleEdit->setText( title );
508 onMainTitleChecked();
512 \brief Check if main title is enabled.
513 \return \c true if main title is enabled
516 bool Plot2d_SetupViewDlg::isMainTitleEnabled()
518 return myTitleCheck->isChecked();
522 \brief Get main title.
526 QString Plot2d_SetupViewDlg::getMainTitle()
528 return myTitleEdit->text();
532 \brief Set horizontal axis title attributes.
533 \param enable if \c true horizontal axis title is enabled
534 \param title horizontal axis title
535 \sa isXTitleEnabled(), getXTitle()
537 void Plot2d_SetupViewDlg::setXTitle( bool enable, const QString& title )
539 myTitleXCheck->setChecked( enable );
540 if ( !title.isNull() )
541 myTitleXEdit->setText( title );
546 \brief Check if main title is enabled.
547 \return \c true if horizontal axis title is enabled
550 bool Plot2d_SetupViewDlg::isXTitleEnabled()
552 return myTitleXCheck->isChecked();
556 \brief Get horizontal axis title.
557 \return horizontal axis title
560 QString Plot2d_SetupViewDlg::getXTitle()
562 return myTitleXEdit->text();
566 \brief Set left vertical axis title attributes.
567 \param enable if \c true left vertical axis title is enabled
568 \param title left vertical axis title
569 \sa setY2Title(), isYTitleEnabled(), getYTitle()
571 void Plot2d_SetupViewDlg::setYTitle( bool enable, const QString& title )
573 myTitleYCheck->setChecked( enable );
574 if ( !title.isNull() )
575 myTitleYEdit->setText( title );
580 \brief Set right vertical axis title attributes.
581 \param enable if \c true right vertical axis title is enabled
582 \param title right vertical axis title
583 \sa setYTitle(), isY2TitleEnabled(), getY2Title()
585 void Plot2d_SetupViewDlg::setY2Title( bool enable, const QString& title )
587 myTitleY2Check->setChecked( enable );
588 if ( !title.isNull() )
589 myTitleY2Edit->setText( title );
594 \brief Check if left vertical axis title is enabled.
595 \return \c true if right vertical axis title is enabled
598 bool Plot2d_SetupViewDlg::isYTitleEnabled()
600 return myTitleYCheck->isChecked();
604 \brief Check if right vertical axis title is enabled.
605 \return \c true if right vertical axis title is enabled
608 bool Plot2d_SetupViewDlg::isY2TitleEnabled()
610 return myTitleY2Check->isChecked();
614 \brief Get left vertical axis title.
615 \return left vertical axis title
618 QString Plot2d_SetupViewDlg::getYTitle()
620 return myTitleYEdit->text();
624 \brief Get right vertical axis title.
625 \return right vertical axis title
628 QString Plot2d_SetupViewDlg::getY2Title()
630 return myTitleY2Edit->text();
634 \brief Set curve type.
635 \param type curve type: 0 (points), 1 (lines) or 2 (splines)
638 void Plot2d_SetupViewDlg::setCurveType( const int type )
640 myCurveCombo->setCurrentIndex( type );
644 \brief Get curve type.
645 \return curve type: 0 (points), 1 (lines) or 2 (splines)
648 int Plot2d_SetupViewDlg::getCurveType()
650 return myCurveCombo->currentIndex();
654 \brief Set normalization to maximum by left Y axis.
655 \param type normalizatoin type: true,false
658 void Plot2d_SetupViewDlg::setLMaxNormMode( const bool type )
660 myNormLMaxCheck->setChecked( type );
664 \brief Check if normalization to maximum by left Y axis sets.
665 \return curve normalizatoin type: true,false
668 bool Plot2d_SetupViewDlg::getLMaxNormMode()
670 return myNormLMaxCheck->isChecked();
674 \brief Set normalization to minimum by left Y axis.
675 \param type normalizatoin type: true,false
678 void Plot2d_SetupViewDlg::setLMinNormMode( const bool type )
680 myNormLMinCheck->setChecked( type );
684 \brief Check if normalization to minimum by left Y axis sets.
685 \return curve normalizatoin type: true,false
688 bool Plot2d_SetupViewDlg::getLMinNormMode()
690 return myNormLMinCheck->isChecked();
694 \brief Set normalization to maximum by right Y axis.
695 \param type normalizatoin type: true,false
698 void Plot2d_SetupViewDlg::setRMaxNormMode( const bool type )
700 myNormRMaxCheck->setChecked( type );
704 \brief Check if normalization to maximum by right Y axis sets.
705 \return curve normalizatoin type: true,false
708 bool Plot2d_SetupViewDlg::getRMaxNormMode()
710 return myNormRMaxCheck->isChecked();
714 \brief Set normalization to minimum by right Y axis.
715 \param type normalizatoin type: true,false
718 void Plot2d_SetupViewDlg::setRMinNormMode( const bool type )
720 myNormRMinCheck->setChecked( type );
724 \brief Check if normalization to minimum by right Y axis sets.
725 \return curve normalizatoin type: true,false
728 bool Plot2d_SetupViewDlg::getRMinNormMode()
730 return myNormRMinCheck->isChecked();
734 \brief Set legend attribute.
735 \param if \c true legend is shown
736 \param pos legend position: 0 (left), 1 (right), 2 (top), 3 (bottom)
737 \param fnt legend font
738 \param col legend font color
739 \sa isLegendEnabled(), getLegendPos(), getLegendFont()
741 void Plot2d_SetupViewDlg::setLegend( bool enable, int pos, int symbolType,
742 const QFont& fnt, const QColor& fontColor, const QColor& selFontColor )
744 myLegendCheck->setChecked( enable );
745 myLegendCombo->setCurrentIndex( pos );
746 myLegendSymbolType->setCurrentIndex( symbolType );
747 myLegendFont->setCurrentFont( fnt );
748 myLegendFontColor->setColor( fontColor );
749 mySelectedLegendFontColor->setColor( selFontColor );
754 \brief Check if legend is enabled.
755 \return \c true if legend is enabled
758 bool Plot2d_SetupViewDlg::isLegendEnabled()
760 return myLegendCheck->isChecked();
764 \brief Get legend position.
765 \return legend position: 0 (left), 1 (right), 2 (top), 3 (bottom)
768 int Plot2d_SetupViewDlg::getLegendPos()
770 return myLegendCombo->currentIndex();
774 \brief Get legend symbol type.
775 \return legend symbol type: 0 (marker on line), 1 (marker above line)
778 int Plot2d_SetupViewDlg::getLegendSymbolType()
780 return myLegendSymbolType->currentIndex();
784 \brief Get legend font.
788 QFont Plot2d_SetupViewDlg::getLegendFont()
790 return myLegendFont->currentFont();
794 \brief Get legend font color.
795 \return legend font color
798 QColor Plot2d_SetupViewDlg::getLegendColor()
800 return myLegendFontColor->color();
804 \brief Get selected legend font color.
805 \return selected legend font color
808 QColor Plot2d_SetupViewDlg::getSelectedLegendColor()
810 return mySelectedLegendFontColor->color();
814 \brief Set marker size.
815 \param size marker size
818 void Plot2d_SetupViewDlg::setMarkerSize( const int size )
820 myMarkerSpin->setValue( size );
824 \brief Get marker size.
828 int Plot2d_SetupViewDlg::getMarkerSize()
830 return myMarkerSpin->value();
833 \brief Set deviation marker line width.
834 \param width marker line width
835 \sa getDeviationMarkerLw()
837 void Plot2d_SetupViewDlg::setDeviationMarkerLw( const int width ){
838 myDeviationLw->setValue(width);
842 \brief Get deviation marker line width.
843 \return marker line width
846 int Plot2d_SetupViewDlg::getDeviationMarkerLw() const {
847 return myDeviationLw->value();
851 \brief Set deviation marker tick size.
852 \param size marker tick size
853 \sa getDeviationMarkerTs()
855 void Plot2d_SetupViewDlg::setDeviationMarkerTs( const int size) {
856 myDeviationTs->setValue(size);
860 \brief Get deviation marker tick size.
861 \return marker tick size
862 \sa setDeviationMarkerTs()
864 int Plot2d_SetupViewDlg::getDeviationMarkerTs() const {
865 return myDeviationTs->value();
869 \brief Set color of the deviation marker.
870 \param color marker color
871 \sa getDeviationMarkerCl()
873 void Plot2d_SetupViewDlg::setDeviationMarkerCl( const QColor& col) {
874 myDeviationCl->setColor( col );
878 \brief Get color of the deviation marker.
880 \sa setDeviationMarkerCl()
882 QColor Plot2d_SetupViewDlg::getDeviationMarkerCl() const {
883 return myDeviationCl->color();
887 \brief Set background color.
888 \param color background color
889 \sa getBackgroundColor()
891 void Plot2d_SetupViewDlg::setBackgroundColor( const QColor& color )
893 myBackgroundBtn->setColor( color );
897 \brief Get background color.
898 \return background color
899 \sa setBackgroundColor()
901 QColor Plot2d_SetupViewDlg::getBackgroundColor()
903 return myBackgroundBtn->color();
907 \brief Set selection color.
908 \param color selection color
909 \sa getSelectionColor()
911 void Plot2d_SetupViewDlg::setSelectionColor( const QColor& color )
913 mySelectionBtn->setColor( color );
917 \brief Get selection color.
918 \return selection color
919 \sa setSelectionColor()
921 QColor Plot2d_SetupViewDlg::getSelectionColor()
923 return mySelectionBtn->color();
927 \brief Set major grid parameters.
928 \param enableX if \c true, horizontal major grid is enabled
929 \param divX maximum number of ticks for horizontal major grid
930 \param enableY if \c true, left vertical major grid is enabled
931 \param divY maximum number of ticks for left vertical major grid
932 \param enableY2 if \c true, right vertical major grid is enabled
933 \param divY2 maximum number of ticks for right vertical major grid
936 void Plot2d_SetupViewDlg::setMajorGrid( bool enableX, const int divX,
937 bool enableY, const int divY,
938 bool enableY2, const int divY2 )
940 myXGridCheck->setChecked( enableX );
941 myXGridSpin->setValue( divX );
942 myYGridCheck->setChecked( enableY );
943 myYGridSpin->setValue( divY );
944 onXGridMajorChecked();
945 onYGridMajorChecked();
947 myY2GridCheck->setChecked( enableY2 );
948 myY2GridSpin->setValue( divY2 );
949 onY2GridMajorChecked();
954 \brief Get major grid parameters.
955 \param enableX \c true if horizontal major grid is enabled
956 \param divX maximum number of ticks for horizontal major grid
957 \param enableY \c true if left vertical major grid is enabled
958 \param divY maximum number of ticks for left vertical major grid
959 \param enableY2 \c true if right vertical major grid is enabled
960 \param divY2 maximum number of ticks for right vertical major grid
963 void Plot2d_SetupViewDlg::getMajorGrid( bool& enableX, int& divX,
964 bool& enableY, int& divY,
965 bool& enableY2, int& divY2 )
967 enableX = myXGridCheck->isChecked();
968 divX = myXGridSpin->value();
969 enableY = myYGridCheck->isChecked();
970 divY = myYGridSpin->value();
972 enableY2 = myY2GridCheck->isChecked();
973 divY2 = myY2GridSpin->value();
982 \brief Set minor grid parameters.
983 \param enableX if \c true, horizontal minor grid is enabled
984 \param divX maximum number of ticks for horizontal minor grid
985 \param enableY if \c true, left vertical minor grid is enabled
986 \param divY maximum number of ticks for left vertical minor grid
987 \param enableY2 if \c true, right vertical minor grid is enabled
988 \param divY2 maximum number of ticks for right vertical minor grid
991 void Plot2d_SetupViewDlg::setMinorGrid( bool enableX, const int divX,
992 bool enableY, const int divY,
993 bool enableY2, const int divY2 )
995 myXMinGridCheck->setChecked( enableX );
996 myXMinGridSpin->setValue( divX );
997 myYMinGridCheck->setChecked( enableY );
998 myYMinGridSpin->setValue( divY );
999 onXGridMinorChecked();
1000 onYGridMinorChecked();
1001 if (mySecondAxisY) {
1002 myY2MinGridCheck->setChecked( enableY2 );
1003 myY2MinGridSpin->setValue( divY2 );
1004 onY2GridMinorChecked();
1009 \brief Get minor grid parameters.
1010 \param enableX \c true if horizontal minor grid is enabled
1011 \param divX maximum number of ticks for horizontal minor grid
1012 \param enableY \c true if left vertical minor grid is enabled
1013 \param divY maximum number of ticks for left vertical minor grid
1014 \param enableY2 \c true if right vertical minor grid is enabled
1015 \param divY2 maximum number of ticks for right vertical minor grid
1018 void Plot2d_SetupViewDlg::getMinorGrid( bool& enableX, int& divX,
1019 bool& enableY, int& divY,
1020 bool& enableY2, int& divY2 )
1022 enableX = myXMinGridCheck->isChecked();
1023 divX = myXMinGridSpin->value();
1024 enableY = myYMinGridCheck->isChecked();
1025 divY = myYMinGridSpin->value();
1026 if ( mySecondAxisY ) {
1027 enableY2 = myY2MinGridCheck->isChecked();
1028 divY2 = myY2MinGridSpin->value();
1037 \brief Set scale mode for horizontal and vertical axes.
1038 \param xMode horizontal axis scale mode: 0 (linear), 1 (logarithmic)
1039 \param yMode vertical axis scale mode: 0 (linear), 1 (logarithmic)
1040 \sa getXScaleMode(), getYScaleMode()
1042 void Plot2d_SetupViewDlg::setScaleMode( const int xMode, const int yMode )
1044 myXModeCombo->setCurrentIndex( xMode );
1045 myYModeCombo->setCurrentIndex( yMode );
1049 \brief Get scale mode for horizontal axis.
1050 \return horizontal axis scale mode: 0 (linear), 1 (logarithmic)
1053 int Plot2d_SetupViewDlg::getXScaleMode()
1055 return myXModeCombo->currentIndex();
1059 \brief Get scale mode for vertical axis.
1060 \return vertical axis scale mode: 0 (linear), 1 (logarithmic)
1063 int Plot2d_SetupViewDlg::getYScaleMode()
1065 return myYModeCombo->currentIndex();
1069 \brief Called when user clicks "Show main title" check box.
1071 void Plot2d_SetupViewDlg::onMainTitleChecked()
1073 myTitleEdit->setEnabled( myTitleCheck->isChecked() );
1077 \brief Called when user clicks "Show horizontal axis title" check box.
1079 void Plot2d_SetupViewDlg::onXTitleChecked()
1081 myTitleXEdit->setEnabled( myTitleXCheck->isChecked() );
1085 \brief Called when user clicks "Show vertical left axis title" check box.
1087 void Plot2d_SetupViewDlg::onYTitleChecked()
1089 myTitleYEdit->setEnabled( myTitleYCheck->isChecked() );
1093 \brief Called when user clicks "Show vertical right axis title" check box.
1095 void Plot2d_SetupViewDlg::onY2TitleChecked()
1097 myTitleY2Edit->setEnabled( myTitleY2Check->isChecked() );
1101 \brief Called when user clicks "Show Legend" check box.
1103 void Plot2d_SetupViewDlg::onLegendChecked()
1105 myLegendCombo->setEnabled( myLegendCheck->isChecked() );
1109 \brief Called when user clicks "Enable horizontal major grid" check box.
1111 void Plot2d_SetupViewDlg::onXGridMajorChecked()
1113 myXMinGridCheck->setEnabled( myXGridCheck->isChecked() );
1117 \brief Called when user clicks "Enable left vertical major grid" check box.
1119 void Plot2d_SetupViewDlg::onYGridMajorChecked()
1121 myYMinGridCheck->setEnabled( myYGridCheck->isChecked() );
1125 \brief Called when user clicks "Enable right vertical major grid" check box.
1127 void Plot2d_SetupViewDlg::onY2GridMajorChecked()
1129 myY2MinGridCheck->setEnabled( myY2GridCheck->isChecked() );
1133 \brief Called when user clicks "Enable horizontal minor grid" check box.
1135 void Plot2d_SetupViewDlg::onXGridMinorChecked()
1140 \brief Called when user clicks "Enable left vertical minor grid" check box.
1142 void Plot2d_SetupViewDlg::onYGridMinorChecked()
1147 \brief Called when user clicks "Enable right vertical minor grid" check box.
1149 void Plot2d_SetupViewDlg::onY2GridMinorChecked()
1154 \brief Called when user clicks "Left Y Axis: Normalize to maximum" check box.
1156 void Plot2d_SetupViewDlg::onNormLMaxChecked()
1161 \brief Called when user clicks "Left Y Axis: Normalize to minimum" check box.
1163 void Plot2d_SetupViewDlg::onNormLMinChecked()
1168 \brief Called when user clicks "Right Y Axis: Normalize to maximum" check box.
1170 void Plot2d_SetupViewDlg::onNormRMaxChecked()
1175 \brief Called when user clicks "Right Y Axis: Normalize to minimum" check box.
1177 void Plot2d_SetupViewDlg::onNormRMinChecked()
1182 \brief Get "Set settings as default" check box value.
1183 \return \c true if "Set settings as default" check box is on
1185 bool Plot2d_SetupViewDlg::isSetAsDefault()
1187 return myDefCheck->isChecked();
1191 Slot, called when user clicks "Help" button
1193 void Plot2d_SetupViewDlg::onHelp()
1196 SUIT_Application* app = SUIT_Session::session()->activeApplication();
1198 app->onHelpContextModule( "GUI", "plot2d_viewer_page.html", "settings" );