7 #include "CmdMediator.h" 8 #include "CmdSettingsGridDisplay.h" 9 #include "DlgSettingsGridDisplay.h" 10 #include "EngaugeAssert.h" 11 #include "GridInitializer.h" 12 #include "GridLineFactory.h" 14 #include "MainWindow.h" 17 #include <QDoubleValidator> 18 #include <QGraphicsScene> 19 #include <QGridLayout> 21 #include <QHBoxLayout> 24 #include "ViewPreview.h" 26 const int COUNT_MIN = 1;
27 const int COUNT_DECIMALS = 0;
28 const int MINIMUM_HEIGHT = 480;
32 "DlgSettingsGridDisplay",
36 m_modelGridDisplayBefore (0),
37 m_modelGridDisplayAfter (0)
39 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::DlgSettingsGridDisplay";
45 DlgSettingsGridDisplay::~DlgSettingsGridDisplay()
47 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::~DlgSettingsGridDisplay";
50 void DlgSettingsGridDisplay::createDisplayCommon (QGridLayout *layout,
int &row)
52 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::createDisplayCommon";
54 QWidget *widgetCommon =
new QWidget;
55 layout->addWidget (widgetCommon, row++, 2, 1, 2);
57 QGridLayout *layoutCommon =
new QGridLayout;
58 widgetCommon->setLayout (layoutCommon);
61 m_labelLimitWarning =
new QLabel;
62 m_labelLimitWarning->setStyleSheet (
"QLabel { color: red; }");
63 layoutCommon->addWidget (m_labelLimitWarning, rowCommon++, 0, 1, 4, Qt::AlignCenter);
65 QLabel *labelColor =
new QLabel (QString (
"%1:").arg (tr (
"Color")));
66 layoutCommon->addWidget (labelColor, rowCommon, 1);
68 m_cmbColor =
new QComboBox;
69 m_cmbColor->setWhatsThis (tr (
"Select a color for the lines"));
71 connect (m_cmbColor, SIGNAL (activated (
const QString &)),
this, SLOT (slotColor (
const QString &)));
72 layoutCommon->addWidget (m_cmbColor, rowCommon++, 2);
75 layoutCommon->setColumnStretch (0, 1);
76 layoutCommon->setColumnStretch (1, 0);
77 layoutCommon->setColumnStretch (2, 0);
78 layoutCommon->setColumnStretch (3, 1);
81 void DlgSettingsGridDisplay::createDisplayGridLinesX (QGridLayout *layout,
int &row)
83 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::createDisplayGridLinesX";
85 m_groupX =
new QGroupBox;
86 layout->addWidget (m_groupX, row, 2);
88 QGridLayout *layoutGroup =
new QGridLayout;
89 m_groupX->setLayout (layoutGroup);
91 QLabel *labelDisable =
new QLabel (QString (
"%1:").arg (tr (
"Disable")));
92 layoutGroup->addWidget (labelDisable, 0, 0);
94 m_cmbDisableX =
new QComboBox;
95 m_cmbDisableX->setWhatsThis (tr (
"Disabled value.\n\n" 96 "The X grid lines are specified using only three values at a time. For flexibility, four values " 97 "are offered so you must chose which value is disabled. Once disabled, that value is simply " 98 "updated as the other values change"));
99 m_cmbDisableX->addItem(gridCoordDisableToString (GRID_COORD_DISABLE_COUNT),
100 QVariant (GRID_COORD_DISABLE_COUNT));
101 m_cmbDisableX->addItem(gridCoordDisableToString (GRID_COORD_DISABLE_START),
102 QVariant (GRID_COORD_DISABLE_START));
103 m_cmbDisableX->addItem(gridCoordDisableToString (GRID_COORD_DISABLE_STEP),
104 QVariant (GRID_COORD_DISABLE_STEP));
105 m_cmbDisableX->addItem(gridCoordDisableToString (GRID_COORD_DISABLE_STOP),
106 QVariant (GRID_COORD_DISABLE_STOP));
107 connect (m_cmbDisableX, SIGNAL (activated (
const QString &)),
this, SLOT (slotDisableX (
const QString &)));
108 layoutGroup->addWidget (m_cmbDisableX, 0, 1);
110 QLabel *labelCount =
new QLabel (QString (
"%1:").arg (tr (
"Count")));
111 layoutGroup->addWidget (labelCount, 1, 0);
113 m_editCountX =
new QLineEdit;
114 m_editCountX->setWhatsThis (tr (
"Number of X grid lines.\n\n" 115 "The number of X grid lines must be entered as an integer greater than zero"));
116 m_validatorCountX =
new QDoubleValidator;
117 m_validatorCountX->setBottom (COUNT_MIN);
118 m_validatorCountX->setDecimals (COUNT_DECIMALS);
119 m_editCountX->setValidator (m_validatorCountX);
120 connect (m_editCountX, SIGNAL (textEdited (
const QString &)),
this, SLOT (slotCountX (
const QString &)));
121 layoutGroup->addWidget (m_editCountX, 1, 1);
123 QLabel *labelStart =
new QLabel (QString (
"%1:").arg (tr (
"Start")));
124 layoutGroup->addWidget (labelStart, 2, 0);
126 m_editStartX =
new QLineEdit;
127 m_editStartX->setWhatsThis (tr (
"Value of the first X grid line.\n\n" 128 "The start value cannot be greater than the stop value"));
129 m_validatorStartX =
new QDoubleValidator;
130 m_editStartX->setValidator (m_validatorStartX);
131 connect (m_editStartX, SIGNAL (textEdited (
const QString &)),
this, SLOT (slotStartX (
const QString &)));
132 layoutGroup->addWidget (m_editStartX, 2, 1);
134 QLabel *labelStep =
new QLabel (QString (
"%1:").arg (tr (
"Step")));
135 layoutGroup->addWidget (labelStep, 3, 0);
137 m_editStepX =
new QLineEdit;
138 m_editStepX->setWhatsThis (tr (
"Difference in value between two successive X grid lines.\n\n" 139 "The step value must be greater than zero"));
140 m_validatorStepX =
new QDoubleValidator;
141 m_editStepX->setValidator (m_validatorStepX);
142 connect (m_editStepX, SIGNAL (textEdited (
const QString &)),
this, SLOT (slotStepX (
const QString &)));
143 layoutGroup->addWidget (m_editStepX, 3, 1);
145 QLabel *labelStop =
new QLabel (QString (
"%1:").arg (tr (
"Stop")));
146 layoutGroup->addWidget (labelStop, 4, 0);
148 m_editStopX =
new QLineEdit;
149 m_editStopX->setWhatsThis (tr (
"Value of the last X grid line.\n\n" 150 "The stop value cannot be less than the start value"));
151 m_validatorStopX =
new QDoubleValidator;
152 m_editStopX->setValidator (m_validatorStopX);
153 connect (m_editStopX, SIGNAL (textEdited (
const QString &)),
this, SLOT (slotStopX (
const QString &)));
154 layoutGroup->addWidget (m_editStopX, 4, 1);
157 void DlgSettingsGridDisplay::createDisplayGridLinesY (QGridLayout *layout,
int &row)
159 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::createDisplayGridLinesY";
161 m_groupY =
new QGroupBox;
162 layout->addWidget (m_groupY, row++, 3);
164 QGridLayout *layoutGroup =
new QGridLayout;
165 m_groupY->setLayout (layoutGroup);
167 QLabel *labelDisable =
new QLabel (QString (
"%1:").arg (tr (
"Disable")));
168 layoutGroup->addWidget (labelDisable, 0, 0);
170 m_cmbDisableY =
new QComboBox;
171 m_cmbDisableY->setWhatsThis (tr (
"Disabled value.\n\n" 172 "The Y grid lines are specified using only three values at a time. For flexibility, four values " 173 "are offered so you must chose which value is disabled. Once disabled, that value is simply " 174 "updated as the other values change"));
175 m_cmbDisableY->addItem(gridCoordDisableToString (GRID_COORD_DISABLE_COUNT),
176 QVariant (GRID_COORD_DISABLE_COUNT));
177 m_cmbDisableY->addItem(gridCoordDisableToString (GRID_COORD_DISABLE_START),
178 QVariant (GRID_COORD_DISABLE_START));
179 m_cmbDisableY->addItem(gridCoordDisableToString (GRID_COORD_DISABLE_STEP),
180 QVariant (GRID_COORD_DISABLE_STEP));
181 m_cmbDisableY->addItem(gridCoordDisableToString (GRID_COORD_DISABLE_STOP),
182 QVariant (GRID_COORD_DISABLE_STOP));
183 connect (m_cmbDisableY, SIGNAL (activated (
const QString &)),
this, SLOT (slotDisableY (
const QString &)));
184 layoutGroup->addWidget (m_cmbDisableY, 0, 1);
186 QLabel *labelCount =
new QLabel (QString (
"%1:").arg (tr (
"Count")));
187 layoutGroup->addWidget (labelCount, 1, 0);
189 m_editCountY =
new QLineEdit;
190 m_editCountY->setWhatsThis (tr (
"Number of Y grid lines.\n\n" 191 "The number of Y grid lines must be entered as an integer greater than zero"));
192 m_validatorCountY =
new QDoubleValidator;
193 m_validatorCountY->setBottom (COUNT_MIN);
194 m_validatorCountY->setDecimals (COUNT_DECIMALS);
195 m_editCountY->setValidator (m_validatorCountY);
196 connect (m_editCountY, SIGNAL (textEdited (
const QString &)),
this, SLOT (slotCountY (
const QString &)));
197 layoutGroup->addWidget (m_editCountY, 1, 1);
199 QLabel *labelStart =
new QLabel (QString (
"%1:").arg (tr (
"Start")));
200 layoutGroup->addWidget (labelStart, 2, 0);
202 m_editStartY =
new QLineEdit;
203 m_editStartY->setWhatsThis (tr (
"Value of the first Y grid line.\n\n" 204 "The start value cannot be greater than the stop value"));
205 m_validatorStartY =
new QDoubleValidator;
206 m_editStartY->setValidator (m_validatorStartY);
207 connect (m_editStartY, SIGNAL (textEdited (
const QString &)),
this, SLOT (slotStartY (
const QString &)));
208 layoutGroup->addWidget (m_editStartY, 2, 1);
210 QLabel *labelStep =
new QLabel (QString (
"%1:").arg (tr (
"Step")));
211 layoutGroup->addWidget (labelStep, 3, 0);
213 m_editStepY =
new QLineEdit;
214 m_editStepY->setWhatsThis (tr (
"Difference in value between two successive Y grid lines.\n\n" 215 "The step value must be greater than zero"));
216 m_validatorStepY =
new QDoubleValidator;
217 m_editStepY->setValidator (m_validatorStepY);
218 connect (m_editStepY, SIGNAL (textEdited (
const QString &)),
this, SLOT (slotStepY (
const QString &)));
219 layoutGroup->addWidget (m_editStepY, 3, 1);
221 QLabel *labelStop =
new QLabel (QString (
"%1:").arg (tr (
"Stop")));
222 layoutGroup->addWidget (labelStop, 4, 0);
224 m_editStopY =
new QLineEdit;
225 m_editStopY->setWhatsThis (tr (
"Value of the last Y grid line.\n\n" 226 "The stop value cannot be less than the start value"));
227 m_validatorStopY =
new QDoubleValidator;
228 m_editStopY->setValidator (m_validatorStopY);
229 connect (m_editStopY, SIGNAL (textEdited (
const QString &)),
this, SLOT (slotStopY (
const QString &)));
230 layoutGroup->addWidget (m_editStopY, 4, 1);
237 void DlgSettingsGridDisplay::createPreview (QGridLayout *layout,
int &row)
239 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::createPreview";
241 QLabel *labelPreview =
new QLabel (tr (
"Preview"));
242 layout->addWidget (labelPreview, row++, 0, 1, 5);
244 m_scenePreview =
new QGraphicsScene (
this);
246 ViewPreview::VIEW_ASPECT_RATIO_VARIABLE,
248 m_viewPreview->setWhatsThis (tr (
"Preview window that shows how current settings affect grid display"));
249 m_viewPreview->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
250 m_viewPreview->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
252 layout->addWidget (m_viewPreview, row++, 0, 1, 5);
257 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::createSubPanel";
259 QWidget *subPanel =
new QWidget ();
260 QGridLayout *layout =
new QGridLayout (subPanel);
261 subPanel->setLayout (layout);
263 layout->setColumnStretch(0, 1);
264 layout->setColumnStretch(1, 0);
265 layout->setColumnStretch(2, 0);
266 layout->setColumnStretch(3, 0);
267 layout->setColumnStretch(4, 1);
270 createDisplayGridLinesX (layout, row);
271 createDisplayGridLinesY (layout, row);
272 createDisplayCommon (layout, row);
273 createPreview (layout, row);
280 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::handleOk";
283 m_modelGridDisplayAfter->
setStable (
true);
287 *m_modelGridDisplayBefore,
288 *m_modelGridDisplayAfter);
296 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::load";
301 delete m_modelGridDisplayBefore;
302 delete m_modelGridDisplayAfter;
305 QString titleX = tr (
"X Grid Lines");
307 titleX = QString (QChar (0x98, 0x03)) + QString (
" %1").arg (tr (
"Grid Lines"));
309 m_groupX->setTitle (titleX);
311 QString titleY = tr (
"Y Grid Lines");
313 titleY = QString (tr (
"Radius Grid Lines"));
315 m_groupY->setTitle (titleY);
322 int indexDisableX = m_cmbDisableX->findData (QVariant (m_modelGridDisplayAfter->
disableX()));
323 m_cmbDisableX->setCurrentIndex (indexDisableX);
325 m_editCountX->setText(QString::number(m_modelGridDisplayAfter->
countX()));
326 m_editStartX->setText(QString::number(m_modelGridDisplayAfter->
startX()));
327 m_editStepX->setText(QString::number(m_modelGridDisplayAfter->
stepX()));
328 m_editStopX->setText(QString::number(m_modelGridDisplayAfter->
stopX()));
330 int indexDisableY = m_cmbDisableY->findData (QVariant (m_modelGridDisplayAfter->
disableY()));
331 m_cmbDisableY->setCurrentIndex (indexDisableY);
333 m_editCountY->setText(QString::number(m_modelGridDisplayAfter->
countY()));
334 m_editStartY->setText(QString::number(m_modelGridDisplayAfter->
startY()));
335 m_editStepY->setText(QString::number(m_modelGridDisplayAfter->
stepY()));
336 m_editStopY->setText(QString::number(m_modelGridDisplayAfter->
stopY()));
338 int indexColor = m_cmbColor->findData(QVariant(m_modelGridDisplayAfter->
paletteColor()));
339 ENGAUGE_ASSERT (indexColor >= 0);
340 m_cmbColor->setCurrentIndex(indexColor);
352 setMinimumHeight (MINIMUM_HEIGHT);
356 void DlgSettingsGridDisplay::slotColor (QString
const &)
358 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::slotColor";
360 m_modelGridDisplayAfter->
setPaletteColor((ColorPalette) m_cmbColor->currentData().toInt());
365 void DlgSettingsGridDisplay::slotCountX(
const QString &count)
367 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::slotCountX";
369 m_modelGridDisplayAfter->
setCountX(count.toInt());
370 updateDisplayedVariableX ();
375 void DlgSettingsGridDisplay::slotCountY(
const QString &count)
377 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::slotCountY";
379 m_modelGridDisplayAfter->
setCountY(count.toInt());
380 updateDisplayedVariableY ();
385 void DlgSettingsGridDisplay::slotDisableX(
const QString &)
387 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::slotDisableX";
389 GridCoordDisable gridCoordDisable = (GridCoordDisable) m_cmbDisableX->currentData().toInt();
390 m_modelGridDisplayAfter->
setDisableX(gridCoordDisable);
391 updateDisplayedVariableX ();
396 void DlgSettingsGridDisplay::slotDisableY(
const QString &)
398 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::slotDisableY";
400 GridCoordDisable gridCoordDisable = (GridCoordDisable) m_cmbDisableY->currentData().toInt();
401 m_modelGridDisplayAfter->
setDisableY(gridCoordDisable);
402 updateDisplayedVariableY ();
407 void DlgSettingsGridDisplay::slotStartX(
const QString &startX)
409 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::slotStartX";
411 m_modelGridDisplayAfter->
setStartX(startX.toDouble());
412 updateDisplayedVariableX ();
417 void DlgSettingsGridDisplay::slotStartY(
const QString &startY)
419 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::slotStartY";
421 m_modelGridDisplayAfter->
setStartY(startY.toDouble());
422 updateDisplayedVariableY ();
427 void DlgSettingsGridDisplay::slotStepX(
const QString &stepX)
429 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::slotStepX";
431 m_modelGridDisplayAfter->
setStepX(stepX.toDouble());
432 updateDisplayedVariableX ();
437 void DlgSettingsGridDisplay::slotStepY(
const QString &stepY)
439 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::slotStepY";
441 m_modelGridDisplayAfter->
setStepY(stepY.toDouble());
442 updateDisplayedVariableY ();
447 void DlgSettingsGridDisplay::slotStopX(
const QString &stopX)
449 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::slotStopX";
451 m_modelGridDisplayAfter->
setStopX(stopX.toDouble());
452 updateDisplayedVariableX ();
457 void DlgSettingsGridDisplay::slotStopY(
const QString &stopY)
459 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::slotStopY";
461 m_modelGridDisplayAfter->
setStopY(stopY.toDouble());
462 updateDisplayedVariableY ();
467 bool DlgSettingsGridDisplay::textItemsAreValid ()
const 469 QString textCountX = m_editCountX->text();
470 QString textCountY = m_editCountY->text();
471 QString textStartX = m_editStartX->text();
472 QString textStartY = m_editStartY->text();
473 QString textStepX = m_editStepX->text();
474 QString textStepY = m_editStepY->text();
475 QString textStopX = m_editStopX->text();
476 QString textStopY = m_editStopY->text();
484 !textCountX.isEmpty() &&
485 !textCountY.isEmpty() &&
486 !textStartX.isEmpty() &&
487 !textStartY.isEmpty() &&
488 !textStepX.isEmpty() &&
489 !textStepY.isEmpty() &&
490 !textStopX.isEmpty() &&
491 !textStopY.isEmpty() &&
492 m_validatorCountX->validate(textCountX, pos) == QValidator::Acceptable &&
493 m_validatorCountY->validate(textCountY, pos) == QValidator::Acceptable &&
494 m_validatorStartX->validate(textStartX, pos) == QValidator::Acceptable &&
495 m_validatorStartY->validate(textStartY, pos) == QValidator::Acceptable &&
496 m_validatorStepX->validate(textStepX, pos) == QValidator::Acceptable &&
497 m_validatorStepY->validate(textStepY, pos) == QValidator::Acceptable &&
498 m_validatorStopX->validate(textStopX, pos) == QValidator::Acceptable &&
499 m_validatorStopY->validate(textStopY, pos) == QValidator::Acceptable) {
502 double stepX = textCountX.toDouble ();
503 double stepY = textCountY.toDouble ();
505 if (stepX != 0 && stepY != 0) {
514 bool DlgSettingsGridDisplay::textItemsDoNotBreakLineCountLimit ()
516 if (textItemsAreValid ()) {
517 QString textCountX = m_editCountX->text();
518 QString textCountY = m_editCountY->text();
519 QString textStartX = m_editStartX->text();
520 QString textStartY = m_editStartY->text();
521 QString textStepX = m_editStepX->text();
522 QString textStepY = m_editStepY->text();
523 QString textStopX = m_editStopX->text();
524 QString textStopY = m_editStopY->text();
532 int countX = textCountX.toInt ();
533 if (m_modelGridDisplayAfter->
disableX() == GRID_COORD_DISABLE_COUNT) {
535 textStartX.toDouble (),
536 textStopX.toDouble (),
537 textStepX.toDouble ());
539 int countY = textCountY.toInt ();
540 if (m_modelGridDisplayAfter->
disableY() == GRID_COORD_DISABLE_COUNT) {
542 textStartY.toDouble (),
543 textStopY.toDouble (),
544 textStepY.toDouble ());
554 void DlgSettingsGridDisplay::updateControls ()
556 GridCoordDisable disableX = (GridCoordDisable) m_cmbDisableX->currentData().toInt();
557 m_editCountX->setEnabled (disableX != GRID_COORD_DISABLE_COUNT);
558 m_editStartX->setEnabled (disableX != GRID_COORD_DISABLE_START);
559 m_editStepX->setEnabled (disableX != GRID_COORD_DISABLE_STEP);
560 m_editStopX->setEnabled (disableX != GRID_COORD_DISABLE_STOP);
562 GridCoordDisable disableY = (GridCoordDisable) m_cmbDisableY->currentData().toInt();
563 m_editCountY->setEnabled (disableY != GRID_COORD_DISABLE_COUNT);
564 m_editStartY->setEnabled (disableY != GRID_COORD_DISABLE_START);
565 m_editStepY->setEnabled (disableY != GRID_COORD_DISABLE_STEP);
566 m_editStopY->setEnabled (disableY != GRID_COORD_DISABLE_STOP);
568 if (textItemsDoNotBreakLineCountLimit ()) {
569 m_labelLimitWarning->setText (
"");
571 m_labelLimitWarning->setText (tr (
"Grid line count exceeds limit set by Settings / Main Window."));
574 enableOk (textItemsAreValid () && textItemsDoNotBreakLineCountLimit ());
577 void DlgSettingsGridDisplay::updateDisplayedVariableX ()
583 switch (m_modelGridDisplayAfter->
disableX()) {
584 case GRID_COORD_DISABLE_COUNT:
585 m_editCountX->setText (QString::number (initializer.
computeCount (linearAxis,
586 m_modelGridDisplayAfter->
startX (),
587 m_modelGridDisplayAfter->
stopX (),
588 m_modelGridDisplayAfter->
stepX ())));
591 case GRID_COORD_DISABLE_START:
592 m_editStartX->setText (QString::number (initializer.
computeStart (linearAxis,
593 m_modelGridDisplayAfter->
stopX (),
594 m_modelGridDisplayAfter->
stepX (),
595 m_modelGridDisplayAfter->
countX ())));
598 case GRID_COORD_DISABLE_STEP:
599 m_editStepX->setText (QString::number (initializer.
computeStep (linearAxis,
600 m_modelGridDisplayAfter->
startX (),
601 m_modelGridDisplayAfter->
stopX (),
602 m_modelGridDisplayAfter->
countX ())));
605 case GRID_COORD_DISABLE_STOP:
606 m_editStopX->setText (QString::number (initializer.
computeStop (linearAxis,
607 m_modelGridDisplayAfter->
startX (),
608 m_modelGridDisplayAfter->
stepX (),
609 m_modelGridDisplayAfter->
countX ())));
613 LOG4CPP_ERROR_S ((*mainCat)) <<
"DlgSettingsGridDisplay::updateDisplayedVariableX";
618 void DlgSettingsGridDisplay::updateDisplayedVariableY ()
624 switch (m_modelGridDisplayAfter->
disableY()) {
625 case GRID_COORD_DISABLE_COUNT:
626 m_editCountY->setText (QString::number (initializer.
computeCount (linearAxis,
627 m_modelGridDisplayAfter->
startY (),
628 m_modelGridDisplayAfter->
stopY (),
629 m_modelGridDisplayAfter->
stepY ())));
632 case GRID_COORD_DISABLE_START:
633 m_editStartY->setText (QString::number (initializer.
computeStart (linearAxis,
634 m_modelGridDisplayAfter->
stopY (),
635 m_modelGridDisplayAfter->
stepY (),
636 m_modelGridDisplayAfter->
countY ())));
639 case GRID_COORD_DISABLE_STEP:
640 m_editStepY->setText (QString::number (initializer.
computeStep (linearAxis,
641 m_modelGridDisplayAfter->
startY (),
642 m_modelGridDisplayAfter->
stopY (),
643 m_modelGridDisplayAfter->
countY ())));
646 case GRID_COORD_DISABLE_STOP:
647 m_editStopY->setText (QString::number (initializer.
computeStop (linearAxis,
648 m_modelGridDisplayAfter->
startY (),
649 m_modelGridDisplayAfter->
stepY (),
650 m_modelGridDisplayAfter->
countY ())));
654 LOG4CPP_ERROR_S ((*mainCat)) <<
"DlgSettingsGridDisplay::updateDisplayedVariableY";
659 void DlgSettingsGridDisplay::updatePreview ()
661 m_gridLines.
clear ();
663 if (textItemsAreValid ()) {
668 factory.createGridLinesForEvenlySpacedGrid (*m_modelGridDisplayAfter,
Factory class for generating the points, composed of QGraphicsItem objects, along a GridLine.
void setStartX(double startX)
Set method for x grid line lower bound (inclusive).
GridCoordDisable disableY() const
Get method for y grid line disabled variable.
Model for DlgSettingsGridDisplay and CmdSettingsGridDisplay.
void clear()
Deallocate and remove all grid lines.
void setCountY(unsigned int countY)
Set method for y grid line count.
void setStepX(double stepX)
Set method for x grid line increment.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
virtual void createOptionalSaveDefault(QHBoxLayout *layout)
Let subclass define an optional Save As Default button.
unsigned int countX() const
Get method for x grid line count.
Command for DlgSettingsGridDisplay.
void setCmdMediator(CmdMediator &cmdMediator)
Store CmdMediator for easy access by the leaf class.
double computeStart(bool linearAxis, double stop, double step, int count) const
Compute axis scale start from the other axis parameters.
void setStepY(double yStep)
Set method for y grid line increment.
unsigned int countY() const
Get method for y grid line count.
void finishPanel(QWidget *subPanel, int minimumWidth=MINIMUM_DIALOG_WIDTH, int minimumHeightOrZero=0)
Add Ok and Cancel buttons to subpanel to get the whole dialog.
DlgSettingsGridDisplay(MainWindow &mainWindow)
Single constructor.
void setStable(bool stable)
Set method for stable flag.
Class that modifies QGraphicsView to automatically expand/shrink the view to fit the window,...
GridCoordDisable disableX() const
Get method for x grid line disabled variable.
void setStopX(double stopX)
Set method for x grid line upper bound (inclusive).
void populateColorComboWithoutTransparent(QComboBox &combo)
Add colors in color palette to combobox, without transparent entry at end.
virtual QWidget * createSubPanel()
Create dialog-specific panel to which base class will add Ok and Cancel buttons.
int computeCount(bool linearAxis, double start, double stop, double step) const
Compute axis scale count from the other axis parameters.
This class initializes the count, start, step and stop parameters for one coordinate (either x/theta ...
virtual void handleOk()
Process slotOk.
int maximumGridLines() const
Maximum number of grid lines.
CoordScale coordScaleXTheta() const
Get method for linear/log scale on x/theta.
double stopY() const
Get method for y grid line upper bound (inclusive).
void setDisableX(GridCoordDisable disableX)
Set method for x grid line disabled variable.
double stopX() const
Get method for x grid line upper bound (inclusive).
ColorPalette paletteColor() const
Get method for color.
void setStopY(double yStop)
Set method for y grid line upper bound (inclusive).
void setDisableY(GridCoordDisable disableY)
Set method for y grid line disabled variable.
double startY() const
Get method for y grid line lower bound (inclusive).
void setCountX(unsigned int countX)
Set method for x grid line count.
MainWindowModel modelMainWindow() const
Get method for main window model.
CoordScale coordScaleYRadius() const
Get method for linear/log scale on y/radius.
void setStartY(double yStart)
Set method for y grid line lower bound (inclusive).
static int MINIMUM_PREVIEW_HEIGHT
Dialog layout constant that guarantees preview has sufficent room.
CoordsType coordsType() const
Get method for coordinates type.
void enableOk(bool enable)
Let leaf subclass control the Ok button.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
Abstract base class for all Settings dialogs.
double stepY() const
Get method for y grid line increment.
double computeStop(bool linearAxis, double start, double step, int count) const
Compute axis scale stop from the other axis parameters.
double startX() const
Get method for x grid line lower bound (inclusive).
QPixmap pixmap() const
Return the image that is being digitized.
double computeStep(bool linearAxis, double start, double stop, int count) const
Compute axis scale step from the other axis parameters.
double stepX() const
Get method for x grid line increment.
MainWindow & mainWindow()
Get method for MainWindow.
DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
void setPaletteColor(ColorPalette paletteColor)
Set method for color.
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.