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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 if (m_modelGridDisplayBefore != 0) {
302 delete m_modelGridDisplayBefore;
304 if (m_modelGridDisplayAfter != 0) {
305 delete m_modelGridDisplayAfter;
309 QString titleX = tr (
"X Grid Lines");
311 titleX = QString (QChar (0x98, 0x03)) + QString (
" %1").arg (tr (
"Grid Lines"));
313 m_groupX->setTitle (titleX);
315 QString titleY = tr (
"Y Grid Lines");
317 titleY = QString (tr (
"Radius Grid Lines"));
319 m_groupY->setTitle (titleY);
326 int indexDisableX = m_cmbDisableX->findData (QVariant (m_modelGridDisplayAfter->
disableX()));
327 m_cmbDisableX->setCurrentIndex (indexDisableX);
329 m_editCountX->setText(QString::number(m_modelGridDisplayAfter->
countX()));
330 m_editStartX->setText(QString::number(m_modelGridDisplayAfter->
startX()));
331 m_editStepX->setText(QString::number(m_modelGridDisplayAfter->
stepX()));
332 m_editStopX->setText(QString::number(m_modelGridDisplayAfter->
stopX()));
334 int indexDisableY = m_cmbDisableY->findData (QVariant (m_modelGridDisplayAfter->
disableY()));
335 m_cmbDisableY->setCurrentIndex (indexDisableY);
337 m_editCountY->setText(QString::number(m_modelGridDisplayAfter->
countY()));
338 m_editStartY->setText(QString::number(m_modelGridDisplayAfter->
startY()));
339 m_editStepY->setText(QString::number(m_modelGridDisplayAfter->
stepY()));
340 m_editStopY->setText(QString::number(m_modelGridDisplayAfter->
stopY()));
342 int indexColor = m_cmbColor->findData(QVariant(m_modelGridDisplayAfter->
paletteColor()));
343 ENGAUGE_ASSERT (indexColor >= 0);
344 m_cmbColor->setCurrentIndex(indexColor);
356 setMinimumHeight (MINIMUM_HEIGHT);
360 void DlgSettingsGridDisplay::slotColor (QString
const &)
362 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::slotColor";
364 m_modelGridDisplayAfter->
setPaletteColor((ColorPalette) m_cmbColor->currentData().toInt());
369 void DlgSettingsGridDisplay::slotCountX(
const QString &count)
371 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::slotCountX";
373 m_modelGridDisplayAfter->
setCountX(count.toInt());
374 updateDisplayedVariableX ();
379 void DlgSettingsGridDisplay::slotCountY(
const QString &count)
381 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::slotCountY";
383 m_modelGridDisplayAfter->
setCountY(count.toInt());
384 updateDisplayedVariableY ();
389 void DlgSettingsGridDisplay::slotDisableX(
const QString &)
391 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::slotDisableX";
393 GridCoordDisable gridCoordDisable = (GridCoordDisable) m_cmbDisableX->currentData().toInt();
394 m_modelGridDisplayAfter->
setDisableX(gridCoordDisable);
395 updateDisplayedVariableX ();
400 void DlgSettingsGridDisplay::slotDisableY(
const QString &)
402 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::slotDisableY";
404 GridCoordDisable gridCoordDisable = (GridCoordDisable) m_cmbDisableY->currentData().toInt();
405 m_modelGridDisplayAfter->
setDisableY(gridCoordDisable);
406 updateDisplayedVariableY ();
411 void DlgSettingsGridDisplay::slotStartX(
const QString &startX)
413 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::slotStartX";
415 m_modelGridDisplayAfter->
setStartX(startX.toDouble());
416 updateDisplayedVariableX ();
421 void DlgSettingsGridDisplay::slotStartY(
const QString &startY)
423 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::slotStartY";
425 m_modelGridDisplayAfter->
setStartY(startY.toDouble());
426 updateDisplayedVariableY ();
431 void DlgSettingsGridDisplay::slotStepX(
const QString &stepX)
433 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::slotStepX";
435 m_modelGridDisplayAfter->
setStepX(stepX.toDouble());
436 updateDisplayedVariableX ();
441 void DlgSettingsGridDisplay::slotStepY(
const QString &stepY)
443 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::slotStepY";
445 m_modelGridDisplayAfter->
setStepY(stepY.toDouble());
446 updateDisplayedVariableY ();
451 void DlgSettingsGridDisplay::slotStopX(
const QString &stopX)
453 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::slotStopX";
455 m_modelGridDisplayAfter->
setStopX(stopX.toDouble());
456 updateDisplayedVariableX ();
461 void DlgSettingsGridDisplay::slotStopY(
const QString &stopY)
463 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgSettingsGridDisplay::slotStopY";
465 m_modelGridDisplayAfter->
setStopY(stopY.toDouble());
466 updateDisplayedVariableY ();
471 bool DlgSettingsGridDisplay::textItemsAreValid ()
const 473 QString textCountX = m_editCountX->text();
474 QString textCountY = m_editCountY->text();
475 QString textStartX = m_editStartX->text();
476 QString textStartY = m_editStartY->text();
477 QString textStepX = m_editStepX->text();
478 QString textStepY = m_editStepY->text();
479 QString textStopX = m_editStopX->text();
480 QString textStopY = m_editStopY->text();
488 !textCountX.isEmpty() &&
489 !textCountY.isEmpty() &&
490 !textStartX.isEmpty() &&
491 !textStartY.isEmpty() &&
492 !textStepX.isEmpty() &&
493 !textStepY.isEmpty() &&
494 !textStopX.isEmpty() &&
495 !textStopY.isEmpty() &&
496 m_validatorCountX->validate(textCountX, pos) == QValidator::Acceptable &&
497 m_validatorCountY->validate(textCountY, pos) == QValidator::Acceptable &&
498 m_validatorStartX->validate(textStartX, pos) == QValidator::Acceptable &&
499 m_validatorStartY->validate(textStartY, pos) == QValidator::Acceptable &&
500 m_validatorStepX->validate(textStepX, pos) == QValidator::Acceptable &&
501 m_validatorStepY->validate(textStepY, pos) == QValidator::Acceptable &&
502 m_validatorStopX->validate(textStopX, pos) == QValidator::Acceptable &&
503 m_validatorStopY->validate(textStopY, pos) == QValidator::Acceptable) {
506 double stepX = textCountX.toDouble ();
507 double stepY = textCountY.toDouble ();
509 if (stepX != 0 && stepY != 0) {
518 bool DlgSettingsGridDisplay::textItemsDoNotBreakLineCountLimit ()
520 if (textItemsAreValid ()) {
521 QString textCountX = m_editCountX->text();
522 QString textCountY = m_editCountY->text();
523 QString textStartX = m_editStartX->text();
524 QString textStartY = m_editStartY->text();
525 QString textStepX = m_editStepX->text();
526 QString textStepY = m_editStepY->text();
527 QString textStopX = m_editStopX->text();
528 QString textStopY = m_editStopY->text();
536 int countX = textCountX.toInt ();
537 if (m_modelGridDisplayAfter->
disableX() == GRID_COORD_DISABLE_COUNT) {
539 textStartX.toDouble (),
540 textStopX.toDouble (),
541 textStepX.toDouble ());
543 int countY = textCountY.toInt ();
544 if (m_modelGridDisplayAfter->
disableY() == GRID_COORD_DISABLE_COUNT) {
546 textStartY.toDouble (),
547 textStopY.toDouble (),
548 textStepY.toDouble ());
558 void DlgSettingsGridDisplay::updateControls ()
560 GridCoordDisable disableX = (GridCoordDisable) m_cmbDisableX->currentData().toInt();
561 m_editCountX->setEnabled (disableX != GRID_COORD_DISABLE_COUNT);
562 m_editStartX->setEnabled (disableX != GRID_COORD_DISABLE_START);
563 m_editStepX->setEnabled (disableX != GRID_COORD_DISABLE_STEP);
564 m_editStopX->setEnabled (disableX != GRID_COORD_DISABLE_STOP);
566 GridCoordDisable disableY = (GridCoordDisable) m_cmbDisableY->currentData().toInt();
567 m_editCountY->setEnabled (disableY != GRID_COORD_DISABLE_COUNT);
568 m_editStartY->setEnabled (disableY != GRID_COORD_DISABLE_START);
569 m_editStepY->setEnabled (disableY != GRID_COORD_DISABLE_STEP);
570 m_editStopY->setEnabled (disableY != GRID_COORD_DISABLE_STOP);
572 if (textItemsDoNotBreakLineCountLimit ()) {
573 m_labelLimitWarning->setText (
"");
575 m_labelLimitWarning->setText (tr (
"Grid line count exceeds limit set by Settings / Main Window."));
578 enableOk (textItemsAreValid () && textItemsDoNotBreakLineCountLimit ());
581 void DlgSettingsGridDisplay::updateDisplayedVariableX ()
587 switch (m_modelGridDisplayAfter->
disableX()) {
588 case GRID_COORD_DISABLE_COUNT:
589 m_editCountX->setText (QString::number (initializer.
computeCount (linearAxis,
590 m_modelGridDisplayAfter->
startX (),
591 m_modelGridDisplayAfter->
stopX (),
592 m_modelGridDisplayAfter->
stepX ())));
595 case GRID_COORD_DISABLE_START:
596 m_editStartX->setText (QString::number (initializer.
computeStart (linearAxis,
597 m_modelGridDisplayAfter->
stopX (),
598 m_modelGridDisplayAfter->
stepX (),
599 m_modelGridDisplayAfter->
countX ())));
602 case GRID_COORD_DISABLE_STEP:
603 m_editStepX->setText (QString::number (initializer.
computeStep (linearAxis,
604 m_modelGridDisplayAfter->
startX (),
605 m_modelGridDisplayAfter->
stopX (),
606 m_modelGridDisplayAfter->
countX ())));
609 case GRID_COORD_DISABLE_STOP:
610 m_editStopX->setText (QString::number (initializer.
computeStop (linearAxis,
611 m_modelGridDisplayAfter->
startX (),
612 m_modelGridDisplayAfter->
stepX (),
613 m_modelGridDisplayAfter->
countX ())));
617 LOG4CPP_ERROR_S ((*mainCat)) <<
"DlgSettingsGridDisplay::updateDisplayedVariableX";
622 void DlgSettingsGridDisplay::updateDisplayedVariableY ()
628 switch (m_modelGridDisplayAfter->
disableY()) {
629 case GRID_COORD_DISABLE_COUNT:
630 m_editCountY->setText (QString::number (initializer.
computeCount (linearAxis,
631 m_modelGridDisplayAfter->
startY (),
632 m_modelGridDisplayAfter->
stopY (),
633 m_modelGridDisplayAfter->
stepY ())));
636 case GRID_COORD_DISABLE_START:
637 m_editStartY->setText (QString::number (initializer.
computeStart (linearAxis,
638 m_modelGridDisplayAfter->
stopY (),
639 m_modelGridDisplayAfter->
stepY (),
640 m_modelGridDisplayAfter->
countY ())));
643 case GRID_COORD_DISABLE_STEP:
644 m_editStepY->setText (QString::number (initializer.
computeStep (linearAxis,
645 m_modelGridDisplayAfter->
startY (),
646 m_modelGridDisplayAfter->
stopY (),
647 m_modelGridDisplayAfter->
countY ())));
650 case GRID_COORD_DISABLE_STOP:
651 m_editStopY->setText (QString::number (initializer.
computeStop (linearAxis,
652 m_modelGridDisplayAfter->
startY (),
653 m_modelGridDisplayAfter->
stepY (),
654 m_modelGridDisplayAfter->
countY ())));
658 LOG4CPP_ERROR_S ((*mainCat)) <<
"DlgSettingsGridDisplay::updateDisplayedVariableY";
663 void DlgSettingsGridDisplay::updatePreview ()
665 m_gridLines.
clear ();
667 if (textItemsAreValid ()) {
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.
void createGridLinesForEvenlySpacedGrid(const DocumentModelGridDisplay &modelGridDisplay, const Document &document, const MainWindowModel &modelMainWindow, const Transformation &transformation, GridLines &gridLines)
Create a rectangular (cartesian) or annular (polar) grid of evenly spaced grid lines.
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.