65#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
69#ifdef ENGAUGE_JPEG2000
88#include <QApplication>
93#include <QDesktopServices>
95#include <QDomDocument>
98#include <QImageReader>
100#include <QKeySequence>
102#include <QMessageBox>
103#include <QMouseEvent>
104#include <QPrintDialog>
107#include <QPushButton>
109#include <QSignalMapper>
110#include <QTextStream>
111#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
116#include <QToolButton>
118#include <QVBoxLayout>
120#include <QXmlStreamReader>
121#include <QXmlStreamWriter>
135static const char *ENGAUGE_FILENAME_DESCRIPTION =
"Engauge Document";
141 const QString &fileCmdScriptFile,
142 bool isDropRegression,
143 bool isRegressionTest,
147 bool isExtractImageOnly,
148 const QString &extractImageOnlyExtension,
149 const QStringList &loadStartupFiles,
150 const QStringList &commandLineWithoutLoadStartupFiles,
153 m_originalFileWasImported (false),
154 m_isDocumentExported (false),
160 m_loadImageFromUrl (nullptr),
161 m_cmdMediator (nullptr),
162 m_digitizeStateContext (nullptr),
163 m_transformationStateContext (nullptr),
164 m_backgroundStateContext (nullptr),
165 m_networkClient (nullptr),
166 m_isGnuplot (isGnuplot),
167 m_commandLineWithoutLoadStartupFiles (commandLineWithoutLoadStartupFiles),
169 m_timerRegressionErrorReport(nullptr),
170 m_fileCmdScript (nullptr),
171 m_isErrorReportRegressionTest (isRegressionTest),
172 m_timerRegressionFileCmdScript(nullptr),
173 m_guidelines (*this),
174 m_fittingCurve (nullptr),
175 m_isExportOnly (isExportOnly),
176 m_isExtractImageOnly (isExtractImageOnly),
177 m_extractImageOnlyExtension (extractImageOnlyExtension)
180 <<
" curDir=" << QDir::currentPath().toLatin1().data();
182#if defined(OSX_DEBUG) || defined(OSX_RELEASE)
183 qApp->setApplicationName (
"Engauge Digitizer");
184 qApp->setOrganizationDomain (
"Mark Mitchell");
189 m_startupDirectory = QDir::currentPath();
194 createFacade.
create (*
this);
198 settingsRead (isReset);
200 setUnifiedTitleAndToolBarOnMac(
true);
202 installEventFilter(
this);
206 QString originalPath = QDir::currentPath();
207 QDir::setCurrent (m_startupDirectory);
209 m_loadStartupFiles = loadStartupFiles;
210 m_regressionFile = exportRegressionFilenameFromInputFilename (loadStartupFiles.first ());
211 slotLoadStartupFiles ();
214 }
else if (isExtractImageOnly) {
215 m_loadStartupFiles = loadStartupFiles;
216 m_regressionFile = exportRegressionFilenameFromInputFilename (loadStartupFiles.first ());
217 slotLoadStartupFiles ();
218 handlerFileExtractImage ();
220 }
else if (!errorReportFile.isEmpty()) {
221 loadErrorReportFile(errorReportFile);
222 if (m_isErrorReportRegressionTest) {
223 startRegressionTestErrorReport(errorReportFile);
225 }
else if (!fileCmdScriptFile.isEmpty()) {
227 startRegressionTestFileCmdScript();
228 }
else if (isDropRegression) {
230 startRegressionDropTest (loadStartupFiles);
235 m_loadStartupFiles = loadStartupFiles;
237 QDir::setCurrent (originalPath);
242#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
245 delete m_tutorialDlg;
246 delete m_cmdMediator;
247 delete m_cmdStackShadow;
248 delete m_digitizeStateContext;
249 delete m_transformationStateContext;
250 delete m_backgroundStateContext;
251 delete m_dlgSettingsAxesChecker;
252 delete m_dlgSettingsColorFilter;
253 delete m_dlgSettingsCoords;
254 delete m_dlgSettingsCurveList;
255 delete m_dlgSettingsCurveProperties;
256 delete m_dlgSettingsDigitizeCurve;
257 delete m_dlgSettingsExportFormat;
258 delete m_dlgSettingsGeneral;
259 delete m_dlgSettingsGridDisplay;
260 delete m_dlgSettingsGridRemoval;
261 delete m_dlgSettingsMainWindow;
262 delete m_dlgSettingsPointMatch;
263 delete m_dlgSettingsSegments;
264 delete m_fileCmdScript;
265 m_gridLines.
clear ();
266 m_guidelines.
clear ();
269void MainWindow::addDockWindow (QDockWidget *dockWidget,
271 const QString &settingsTokenArea,
272 const QString &settingsTokenGeometry,
273 Qt::DockWidgetArea dockWidgetArea)
278 const bool DOCKED_EQUALS_NOT_FLOATING =
false;
279 Qt::DockWidgetArea area =
static_cast<Qt::DockWidgetArea
> (settings.value (settingsTokenArea,
280 Qt::NoDockWidgetArea).toInt());
282 if (area == Qt::NoDockWidgetArea) {
284 addDockWidget (dockWidgetArea,
286 dockWidget->setFloating(DOCKED_EQUALS_NOT_FLOATING);
287 if (settings.contains (settingsTokenGeometry)) {
288 dockWidget->restoreGeometry (settings.value (settingsTokenGeometry).toByteArray());
299void MainWindow::applyZoomFactorAfterLoad()
304 if (m_zoomMapFromInitial.contains (zoomFactorInitial)) {
305 zoomFactor = m_zoomMapFromInitial [zoomFactorInitial];
307 zoomFactor = currentZoomFactor ();
309 LOG4CPP_ERROR_S ((*
mainCat)) <<
"MainWindow::applyZoomFactorAfterLoad unexpected zoom factor " << zoomFactorInitial;
311 zoomFactor = currentZoomFactor();
314 slotViewZoom (zoomFactor);
317void MainWindow::closeEvent(QCloseEvent *event)
331 setWindowModified (
false);
348 m_regressionFile = exportRegressionFilenameFromInputFilename (fileName);
349 fileImport (fileName,
357 m_regressionFile = exportRegressionFilenameFromInputFilename (fileName);
358 loadDocumentFile(fileName);
364 return m_cmdMediator;
367ZoomFactor MainWindow::currentZoomFactor ()
const
372 if (m_zoomMapToAction [zoomFactor]->isChecked ()) {
385 if (event->type () == QEvent::KeyPress) {
387 QKeyEvent *eventKeyPress =
static_cast<QKeyEvent *
> (event);
390 if ((eventKeyPress->key() == Qt::Key_E) &&
391 ((eventKeyPress->modifiers() & Qt::ShiftModifier) != 0) &&
392 ((eventKeyPress->modifiers() & Qt::ControlModifier) != 0)) {
402 return QObject::eventFilter (target, event);
405#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
406void MainWindow::exportAllCoordinateSystemsAfterRegressionTests()
408 LOG4CPP_INFO_S ((*
mainCat)) <<
"MainWindow::exportAllCoordinateSystemsAfterRegressionTests curDir=" << QDir::currentPath().toLatin1().data();
415 QString regressionFile = QString (
"%1_%2")
416 .arg (m_regressionFile)
424 exportStrategy.fileExport (regressionFile);
430 fileExport (regressionFile,
437QString MainWindow::exportRegressionFilenameFromInputFilename (
const QString &fileName)
const
442 befores <<
".dig" <<
".gif" <<
".html" <<
".htm" <<
".jp2" <<
".jpg" <<
".pbm"
443 <<
".pdf" <<
".pgm" <<
".png" <<
".ppm" <<
".webp" <<
".xbm" <<
".xpm" <<
".xml";
445 QString outFileName = fileName;
447 QStringList::iterator itr;
448 for (itr = befores.begin(); itr != befores.end(); itr++) {
449 QString suffix = *itr;
451 outFileName = outFileName.replace (suffix,
".csv_actual", Qt::CaseInsensitive);
457void MainWindow::fileExport(
const QString &fileName,
461 <<
" curDir=" << QDir::currentPath().toLatin1().data()
462 <<
" fileName=" << fileName.toLatin1().data();
464 QFile file (fileName);
465 if (file.open(QIODevice::WriteOnly)) {
467 QTextStream str (&file);
479 m_isDocumentExported =
true;
481 updateChecklistGuide ();
487 <<
" file=" << fileName.toLatin1().data()
488 <<
" curDir=" << QDir::currentPath().toLatin1().data();
489 QMessageBox::critical (
nullptr,
491 tr (
"Unable to export to file") +
" " + fileName);
495void MainWindow::fileExtractImage (
const QString &fileName)
498 <<
" curDir=" << QDir::currentPath().toLatin1().data()
499 <<
" fileName=" << fileName.toLatin1().data();
501 QFile file (fileName);
502 if (file.open(QIODevice::WriteOnly)) {
504 QPixmap pixmap = m_cmdMediator->
pixmap();
508 if (m_isErrorReportRegressionTest) {
509 QString csvFile = QString (
"%1_1")
510 .arg (exportRegressionFilenameFromInputFilename (m_regressionFile));
514 process.start (
"bash -c \"cksum " + fileName +
" | awk '{print $1}' > " + csvFile +
"\"");
515 process.waitForFinished (-1);
521 <<
" file=" << fileName.toLatin1().data()
522 <<
" curDir=" << QDir::currentPath().toLatin1().data();
523 QMessageBox::critical (
nullptr,
525 tr (
"Unable to extract image to file") +
" " + fileName);
529void MainWindow::fileImport (
const QString &fileName,
530 ImportType importType)
533 <<
" fileName=" << fileName.toLatin1 ().data ()
534 <<
" curDir=" << QDir::currentPath().toLatin1().data()
535 <<
" importType=" << importType;
537 QString originalFileOld = m_originalFile;
538 bool originalFileWasImported = m_originalFileWasImported;
540 m_originalFile = fileName;
541 m_originalFileWasImported =
true;
543 if (importType == IMPORT_TYPE_ADVANCED) {
556#ifdef ENGAUGE_JPEG2000
558 loaded = jpeg2000.
load (fileName,
570 m_isErrorReportRegressionTest);
587 m_isErrorReportRegressionTest);
599 QString msg = messageCannotReadFile (fileName);
603 msg = QString (
"%1.\n\n%2.")
605 .arg (tr (
"In OSX, files loaded at startup must be in the Downloads, Pictures or "
606 "Library/Containers/Digitizer/Data directories"));
610 if (fileName.contains (
"???")) {
615 msg += QObject::tr (
"The file appears to have characters from multiple language "
616 "alphabets, which does not work in the Windows command line");
619 QMessageBox::warning (
this,
624 m_originalFile = originalFileOld;
625 m_originalFileWasImported = originalFileWasImported;
629 loaded = loadImage (fileName,
637 ! m_actionViewCoordSystem->isChecked ()) {
640 m_actionViewCoordSystem->trigger ();
646 if (importType == IMPORT_TYPE_ADVANCED) {
656 m_originalFile = originalFileOld;
657 m_originalFileWasImported = originalFileWasImported;
663void MainWindow::fileImportWithPrompts (ImportType importType)
666 <<
" importType=" << importType;
670 bool okToContinue =
true;
671 if (importType != IMPORT_TYPE_IMAGE_REPLACE) {
672 okToContinue = maybeSave ();
678 QTextStream str (&filter);
683 str <<
"Image Files (" << supportedImageFormatStrings.join (
" ") <<
")";
687 str <<
";; All Files (*.*)";
690 QString fileName = QFileDialog::getOpenFileName (
this,
694 if (!fileName.isEmpty ()) {
699 fileImport (fileName,
705QString MainWindow::fileNameForExportOnly ()
const
710 if (m_isErrorReportRegressionTest) {
713 fileName = QString (
"%1_1")
714 .arg (exportRegressionFilenameFromInputFilename (m_regressionFile));
719 QString dir = QFileInfo (m_currentFileWithPathAndFileExtension).absolutePath();
720 fileName = QString (
"%1/%2.%3")
729QString MainWindow::fileNameForExtractImageOnly ()
const
732 QString dir = QFileInfo (m_currentFileWithPathAndFileExtension).absolutePath();
733 QString fileName = QString (
"%1/%2.%3")
736 .arg (m_extractImageOnlyExtension);
741void MainWindow::filePaste (ImportType importType)
744 <<
" importType=" << importType;
746 QString originalFileOld = m_originalFile;
747 bool originalFileWasImported = m_originalFileWasImported;
749 QString fileName (
"clipboard");
750 m_originalFile = fileName;
751 m_originalFileWasImported =
true;
753 if (importType == IMPORT_TYPE_ADVANCED) {
764 QImage image = QApplication::clipboard()->image();
768 loaded = !image.isNull();
772 QMessageBox::warning (
this,
774 messageCannotReadFile (fileName));
777 m_originalFile = originalFileOld;
778 m_originalFileWasImported = originalFileWasImported;
782 loaded = loadImage (fileName,
789 if (importType == IMPORT_TYPE_ADVANCED) {
799 m_originalFile = originalFileOld;
800 m_originalFileWasImported = originalFileWasImported;
806void MainWindow::ghostsCreate ()
813 for (
unsigned int index = 0; index < m_cmdMediator->
document().coordSystemCount(); index++) {
832void MainWindow::ghostsDestroy ()
860void MainWindow::guidelineAddXTEnqueue (
double xT)
866 m_cmdMediator->push (cmd);
885void MainWindow::guidelineAddYREnqueue (
double yR)
891 m_cmdMediator->push (cmd);
931 return (guidelinesVisibilityCanBeEnabled () &&
932 (m_actionViewGuidelinesEdit->isChecked() || m_actionViewGuidelinesLock->isChecked()));
935bool MainWindow::guidelinesVisibilityCanBeEnabled ()
const
946 return (!m_currentFile.isEmpty() &&
955 m_actionViewGuidelinesHide->setChecked (
true);
959 m_actionViewGuidelinesEdit->setChecked (
true);
963 m_actionViewGuidelinesLock->setChecked (
true);
977void MainWindow::handleGuidelineMode ()
980 m_actionViewGuidelinesLock->isChecked());
983void MainWindow::handlerFileExtractImage ()
987 if (m_isExtractImageOnly) {
988 QString fileName = fileNameForExtractImageOnly ();
993 fileExtractImage(fileName);
1007void MainWindow::loadCoordSystemListFromCmdMediator ()
1011 m_cmbCoordSystem->clear();
1015 for (
unsigned int i = 0; i < numberCoordSystem; i++) {
1016 int index1Based = signed (i + 1);
1017 m_cmbCoordSystem->addItem (QString::number (index1Based),
1022 m_cmbCoordSystem->setCurrentIndex (0);
1025 bool enable = (m_cmbCoordSystem->count() > 1);
1026 m_cmbCoordSystem->setEnabled (enable);
1027 m_btnShowAll->setEnabled (enable);
1028 m_btnPrintAll->setEnabled (enable);
1031void MainWindow::loadCurveListFromCmdMediator ()
1035 m_cmbCurve->clear ();
1037 QStringList::iterator itr;
1038 for (itr = curvesGraphsNames.begin (); itr != curvesGraphsNames.end (); itr++) {
1040 QString curvesGraphName = *itr;
1041 m_cmbCurve->addItem (curvesGraphName);
1048void MainWindow::loadDocumentFile (
const QString &fileName)
1050 LOG4CPP_INFO_S ((*
mainCat)) <<
"MainWindow::loadDocumentFile fileName=" << fileName.toLatin1 ().data ();
1052 QApplication::setOverrideCursor(Qt::WaitCursor);
1058 setCurrentPathFromFile (fileName);
1059 rebuildRecentFileListForCurrentFile(fileName);
1060 m_currentFile = fileName;
1062 delete m_cmdMediator;
1065 setupAfterLoadNewDocument (fileName,
1067 IMPORT_TYPE_SIMPLE);
1070 m_actionDigitizeSelect->setChecked (
true);
1071 slotDigitizeSelect();
1073 m_engaugeFile = fileName;
1074 m_originalFile = fileName;
1075 m_originalFileWasImported =
false;
1080 QApplication::restoreOverrideCursor();
1084 QApplication::restoreOverrideCursor();
1086 QString msg = messageCannotReadFile (fileName);
1087 QMessageBox::warning (
this,
1097void MainWindow::loadErrorReportFile(
const QString &errorReportFile)
1100 <<
" file=" << errorReportFile.toLatin1().data();
1102 QFile file (errorReportFile);
1103 if (!file.exists()) {
1105 QFileInfo fileInfo (errorReportFile);
1107 QMessageBox::critical (
this,
1109 tr (
"File not found") +
": " + fileInfo.absoluteFilePath());
1114 QXmlStreamReader reader (&file);
1115 file.open(QIODevice::ReadOnly | QIODevice::Text);
1125 setupAfterLoadNewDocument (errorReportFile,
1126 tr (
"Error report opened"),
1127 IMPORT_TYPE_SIMPLE);
1130 m_actionDigitizeSelect->setChecked (
true);
1131 slotDigitizeSelect();
1136void MainWindow::loadGuidelinesFromCmdMediator ()
1144bool MainWindow::loadImage (
const QString &fileName,
1145 const QImage &image,
1146 ImportType importType)
1149 <<
" fileName=" << fileName.toLatin1 ().data ()
1150 <<
" importType=" << importType;
1153 if (importType == IMPORT_TYPE_IMAGE_REPLACE) {
1154 success = loadImageReplacingImage (fileName,
1158 success = loadImageNewDocument (fileName,
1166bool MainWindow::loadImageNewDocument (
const QString &fileName,
1167 const QImage &image,
1168 ImportType importType)
1171 <<
" fileName=" << fileName.toLatin1 ().data ()
1172 <<
" importType=" << importType;
1176 QApplication::setOverrideCursor(Qt::WaitCursor);
1179 QApplication::restoreOverrideCursor();
1181 setCurrentPathFromFile (fileName);
1185 delete m_cmdMediator;
1188 bool accepted = setupAfterLoadNewDocument (fileName,
1189 tr (
"File imported"),
1195 if (m_actionHelpChecklistGuideWizard->isChecked () &&
1196 (m_fileCmdScript ==
nullptr)) {
1201 if (wizard->exec() == QDialog::Accepted) {
1203 for (
CoordSystemIndex coordSystemIndex = 0; coordSystemIndex < m_cmdMediator->
document().coordSystemCount(); coordSystemIndex++) {
1217 m_actionViewChecklistGuide->setChecked (
true);
1220 loadCurveListFromCmdMediator();
1223 loadCoordSystemListFromCmdMediator();
1229 m_actionDigitizeAxis->setChecked (
true);
1233 slotDigitizeScale ();
1234 }
else if (modeGraph ()) {
1235 slotDigitizeAxis ();
1244bool MainWindow::loadImageReplacingImage (
const QString &fileName,
1245 const QImage &image,
1246 ImportType importType)
1249 <<
" fileName=" << fileName.toLatin1 ().data ()
1250 <<
" importType=" << importType;
1254 setCurrentPathFromFile (fileName);
1262 bool accepted = setupAfterLoadReplacingImage (fileName,
1263 tr (
"File imported"),
1271void MainWindow::loadInputFileForErrorReport(QDomDocument &domInputFile)
const
1273 QFile file (m_originalFile);
1277 if (!file.open (QIODevice::ReadOnly)) {
1281 domInputFile.setContent (&file);
1285void MainWindow::loadToolTips()
1287 if (m_actionViewToolTips->isChecked ()) {
1290 m_actionDigitizeSelect->setToolTip (m_actionDigitizeSelect->text());
1291 m_actionDigitizeAxis->setToolTip (m_actionDigitizeAxis->text());
1292 m_actionDigitizeScale->setToolTip (m_actionDigitizeScale->text());
1293 m_actionDigitizeCurve->setToolTip (m_actionDigitizeCurve->text());
1294 m_actionDigitizePointMatch->setToolTip (m_actionDigitizePointMatch->text());
1295 m_actionDigitizeColorPicker->setToolTip (m_actionDigitizeColorPicker->text());
1296 m_actionDigitizeSegment->setToolTip (m_actionDigitizeSegment->text());
1297 m_cmbBackground->setToolTip (tr (
"Background image."));
1298 m_cmbCurve->setToolTip (tr (
"Currently selected curve."));
1299 m_viewPointStyle->setToolTip (tr (
"Point style for currently selected curve."));
1300 m_viewSegmentFilter->setToolTip (tr (
"Segment Fill filter for currently selected curve."));
1305 m_actionDigitizeSelect->setToolTip (
"");
1306 m_actionDigitizeAxis->setToolTip (
"");
1307 m_actionDigitizeScale->setToolTip (
"");
1308 m_actionDigitizeCurve->setToolTip (
"");
1309 m_actionDigitizePointMatch->setToolTip (
"");
1310 m_actionDigitizeColorPicker->setToolTip (
"");
1311 m_actionDigitizeSegment->setToolTip (
"");
1312 m_cmbBackground->setToolTip (
"");
1313 m_cmbCurve->setToolTip (
"");
1314 m_viewPointStyle->setToolTip (
"");
1315 m_viewSegmentFilter->setToolTip (
"");
1320bool MainWindow::maybeSave()
1322 if (m_cmdMediator !=
nullptr) {
1324 QMessageBox::StandardButton ret = QMessageBox::warning (
this,
1326 tr(
"The document has been modified.\n"
1327 "Do you want to save your changes?"),
1328 QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
1329 if (ret == QMessageBox::Save) {
1330 return slotFileSave();
1331 }
else if (ret == QMessageBox::Cancel) {
1340QString MainWindow::messageCannotReadFile (
const QString &fileName)
const
1342 return QString(
"%1 %2")
1343 .arg (tr (
"Cannot read file"))
1347bool MainWindow::modeGraph ()
const
1349 bool success =
false;
1351 if (m_cmdMediator !=
nullptr) {
1360 bool success =
false;
1362 if (m_cmdMediator !=
nullptr) {
1371 return m_modelMainWindow;
1374void MainWindow::rebuildRecentFileListForCurrentFile(
const QString &filePath)
1378 setWindowFilePath (filePath);
1382 recentFilePaths.removeAll (filePath);
1383 recentFilePaths.prepend (filePath);
1385 recentFilePaths.removeLast ();
1389 updateRecentFileList();
1396 if (m_actionZoomFill->isChecked ()) {
1400 QMainWindow::resizeEvent(event);
1403bool MainWindow::saveDocumentFile (
const QString &fileName)
1405 LOG4CPP_INFO_S ((*
mainCat)) <<
"MainWindow::saveDocumentFile fileName=" << fileName.toLatin1 ().data ();
1407 QFile file(fileName);
1408 if (!file.open(QFile::WriteOnly)) {
1409 QMessageBox::warning (
this,
1411 QString (
"%1 %2: \n%3.")
1412 .arg(tr (
"Cannot write file"))
1414 .arg(file.errorString()));
1418 rebuildRecentFileListForCurrentFile (fileName);
1420 QApplication::setOverrideCursor (Qt::WaitCursor);
1421 QXmlStreamWriter writer(&file);
1422 writer.setAutoFormatting(
true);
1423 writer.writeStartDocument();
1424 writer.writeDTD(
"<!DOCTYPE engauge>");
1426 writer.writeEndDocument();
1427 QApplication::restoreOverrideCursor ();
1431 m_cmdMediator->setClean ();
1433 setCurrentFile(fileName);
1434 m_engaugeFile = fileName;
1444 const char *comment)
1448 if ((m_cmdMediator !=
nullptr) && !m_isErrorReportRegressionTest) {
1450 QString report = saveErrorReportFileAndExitXml (context,
1456 if (dlg.exec() == QDialog::Accepted) {
1459 QString fileName = dlg.getSaveFileName (
this,
1461 "error_report.xml");
1462 if (!fileName.isEmpty ()) {
1464 QFile fileError (fileName);
1465 QTextStream str (&fileError);
1466 fileError.open (QIODevice::WriteOnly | QIODevice::Text);
1476QString MainWindow::saveErrorReportFileAndExitXml (
const char *context,
1479 const char *comment)
const
1481 const bool DEEP_COPY =
true;
1483 QString xmlErrorReport;
1484 QXmlStreamWriter writer (&xmlErrorReport);
1485 writer.setAutoFormatting(
true);
1493 writer.writeEndElement();
1497 QXmlStreamReader reader (m_startingDocumentSnapshot);
1498 while (!reader.atEnd ()) {
1500 if (reader.tokenType() != QXmlStreamReader::StartDocument &&
1501 reader.tokenType() != QXmlStreamReader::EndDocument &&
1502 reader.tokenType() != QXmlStreamReader::Invalid) {
1503 writer.writeCurrentToken (reader);
1511 writer.writeEndElement();
1517 writer.writeEndElement();
1520 m_cmdMediator->
saveXml(writer);
1528 writer.writeEndElement();
1530 writer.writeEndElement();
1533 QDomDocument domErrorReport (
"ErrorReport");
1534 domErrorReport.setContent (xmlErrorReport);
1537 if (!m_originalFileWasImported) {
1541 QDomDocument domInputFile;
1542 loadInputFileForErrorReport (domInputFile);
1543 QDomDocumentFragment fragmentFileFrom = domErrorReport.createDocumentFragment();
1544 if (!domInputFile.isNull()) {
1545 fragmentFileFrom.appendChild (domErrorReport.importNode (domInputFile.documentElement(), DEEP_COPY));
1548 if (nodesFileTo.count () > 0) {
1549 QDomNode nodeFileTo = nodesFileTo.at (0);
1550 nodeFileTo.appendChild (fragmentFileFrom);
1558 for (
int i = 0 ; i < nodesDocument.count(); i++) {
1559 QDomNode nodeDocument = nodesDocument.at (i);
1561 if (!elemImage.isNull()) {
1570 QDomNode nodeReplacement;
1571 QDomElement elemReplacement = nodeReplacement.toElement();
1576 nodeDocument.insertBefore (nodeReplacement,
1578 nodeDocument.removeChild(elemImage);
1584 return domErrorReport.toString();
1587void MainWindow::saveStartingDocumentSnapshot()
1591 QXmlStreamWriter writer (&m_startingDocumentSnapshot);
1592 writer.setAutoFormatting (
true);
1608 int index = m_cmbBackground->findData (backgroundImage);
1611 m_cmbBackground->setCurrentIndex(index);
1613 return previousBackground;
1618 return m_cmbCurve->currentText ();
1628void MainWindow::setCurrentFile (
const QString &fileName)
1632 QString fileNameStripped;
1633 if (!fileName.isEmpty()) {
1637 QFileInfo fileInfo (fileName);
1638 fileNameStripped = fileInfo.completeBaseName();
1641 m_currentFile = fileNameStripped;
1642 m_currentFileWithPathAndFileExtension = fileName;
1644 updateWindowTitle ();
1647void MainWindow::setCurrentPathFromFile (
const QString &fileName)
1649 QDir dir = QFileInfo (fileName).absoluteDir();
1651 if (dir.exists ()) {
1653 bool success = QDir::setCurrent (dir.absolutePath ());
1662void MainWindow::setNonFillZoomFactor (
ZoomFactor newZoomFactor)
1667 m_zoomMapToAction [newZoomFactor]->setChecked (
true);
1668 slotViewZoomFactor (newZoomFactor);
1671void MainWindow::setPixmap (
const QString &curveSelected,
1672 const QPixmap &pixmap)
1681 m_backgroundStateContext->
setPixmap (m_isGnuplot,
1691void MainWindow::settingsRead (
bool isReset)
1700 settingsReadEnvironment (settings);
1701 settingsReadMainWindow (settings);
1704void MainWindow::settingsReadEnvironment (QSettings &settings)
1708 QDir::currentPath ()).toString ());
1709 settings.endGroup ();
1712void MainWindow::settingsReadMainWindow (QSettings &settings)
1717 const int DEFAULT_MAIN_WINDOW_WIDTH = 800, DEFAULT_MAIN_WINDOW_HEIGHT = 800;
1718 const int DEFAULT_MAIN_WINDOW_OFFSET_X = 100, DEFAULT_MAIN_WINDOW_OFFSET_Y = 100;
1722 QSize (DEFAULT_MAIN_WINDOW_WIDTH, DEFAULT_MAIN_WINDOW_HEIGHT)).toSize ());
1724 QPoint (DEFAULT_MAIN_WINDOW_OFFSET_X, DEFAULT_MAIN_WINDOW_OFFSET_Y)).toPoint ());
1727#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
1729 QSize (900, 600)).toSize();
1730 m_helpWindow->resize (helpSize);
1733 m_helpWindow->move (helpPos);
1744 m_actionViewBackground->setChecked (viewBackgroundToolBar);
1745 m_toolBackground->setVisible (viewBackgroundToolBar);
1748 int indexBackground = m_cmbBackground->findData (QVariant (backgroundImage));
1749 m_cmbBackground->setCurrentIndex (indexBackground);
1754 m_actionViewDigitize->setChecked (viewDigitizeToolBar);
1755 m_toolDigitize->setVisible (viewDigitizeToolBar);
1760 m_actionViewSettingsViews->setChecked (viewSettingsViewsToolBar);
1761 m_toolSettingsViews->setVisible (viewSettingsViewsToolBar);
1766 m_actionViewCoordSystem->setChecked (viewCoordSystemToolbar);
1767 m_toolCoordSystem->setVisible (viewCoordSystemToolbar);
1772 m_actionViewToolTips->setChecked (viewToolTips);
1783 addDockWindow (m_dockChecklistGuide,
1787 Qt::RightDockWidgetArea);
1788 addDockWindow (m_dockFittingWindow,
1792 Qt::RightDockWidgetArea);
1793 addDockWindow (m_dockGeometryWindow,
1797 Qt::RightDockWidgetArea);
1802 QLocale localeDefault;
1804 QVariant (localeDefault.language())).toInt());
1806 QVariant (localeDefault.country())).toInt());
1807 QLocale locale (language,
1840 QVariant (QDir::currentPath())).toString ());
1842 QVariant (QDir::currentPath())).toString ());
1845 updateSmallDialogs();
1847 settings.endGroup();
1850void MainWindow::settingsWrite ()
1858 settings.endGroup ();
1863#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
1867 if (m_dockChecklistGuide->isFloating()) {
1877 if (m_dockFittingWindow->isFloating()) {
1885 if (m_dockGeometryWindow->isFloating()) {
1921 settings.endGroup ();
1924bool MainWindow::setupAfterLoadNewDocument (
const QString &fileName,
1925 const QString &temporaryMessage ,
1926 ImportType importType)
1929 <<
" file=" << fileName.toLatin1().data()
1930 <<
" message=" << temporaryMessage.toLatin1().data()
1931 <<
" importType=" << importType;
1936 const QString EMPTY_CURVE_NAME_TO_SKIP_BACKGROUND_PROCESSING;
1940 m_digitizeStateContext->
resetOnLoad (m_cmdMediator);
1945 EMPTY_CURVE_NAME_TO_SKIP_BACKGROUND_PROCESSING);
1947 m_cmdMediator->
pixmap ());
1951 if (importType == IMPORT_TYPE_ADVANCED) {
1953 applyZoomFactorAfterLoad();
1956 dlgImportAdvanced.exec();
1958 if (dlgImportAdvanced.result() == QDialog::Rejected) {
1962 int numberCoordSystem = signed (dlgImportAdvanced.numberCoordSystem());
1971 connect (m_actionEditUndo, SIGNAL (triggered ()), m_cmdMediator, SLOT (undo ()));
1972 connect (m_actionEditUndo, SIGNAL (triggered ()), m_cmdStackShadow, SLOT (slotUndo ()));
1973 connect (m_actionEditRedo, SIGNAL (triggered ()), m_cmdMediator, SLOT (redo ()));
1974 connect (m_actionEditRedo, SIGNAL (triggered ()), m_cmdStackShadow, SLOT (slotRedo ()));
1975 connect (m_cmdMediator, SIGNAL (canRedoChanged(
bool)),
this, SLOT (slotCanRedoChanged (
bool)));
1976 connect (m_cmdMediator, SIGNAL (canUndoChanged(
bool)),
this, SLOT (slotCanUndoChanged (
bool)));
1977 connect (m_cmdMediator, SIGNAL (redoTextChanged (
const QString &)),
this, SLOT (slotRedoTextChanged (
const QString &)));
1978 connect (m_cmdMediator, SIGNAL (undoTextChanged (
const QString &)),
this, SLOT (slotUndoTextChanged (
const QString &)));
1979 loadCurveListFromCmdMediator ();
1980 loadCoordSystemListFromCmdMediator ();
1983 m_isDocumentExported =
false;
1993 m_cmbCurve->currentText ());
1996 applyZoomFactorAfterLoad();
1998 setCurrentFile(fileName);
2002 saveStartingDocumentSnapshot();
2006 loadGuidelinesFromCmdMediator ();
2007 handleGuidelineMode ();
2012bool MainWindow::setupAfterLoadReplacingImage (
const QString &fileName,
2013 const QString &temporaryMessage ,
2014 ImportType importType)
2017 <<
" file=" << fileName.toLatin1().data()
2018 <<
" message=" << temporaryMessage.toLatin1().data()
2019 <<
" importType=" << importType;
2024 m_cmdMediator->clear();
2027 m_cmdMediator->
pixmap ());
2029 m_isDocumentExported =
false;
2033 applyZoomFactorAfterLoad();
2037 setCurrentFile(fileName);
2043 saveStartingDocumentSnapshot();
2053 <<
" files=" << m_loadStartupFiles.join (
",").toLatin1().data();
2055 QMainWindow::showEvent (event);
2057 if (m_loadStartupFiles.count() > 0) {
2059 m_timerLoadStartupFiles =
new QTimer;
2060 m_timerLoadStartupFiles->setSingleShot (
true);
2061 connect (m_timerLoadStartupFiles, SIGNAL (timeout ()),
this, SLOT (slotLoadStartupFiles ()));
2062 m_timerLoadStartupFiles->start (0);
2072void MainWindow::slotBtnGuidelineBottomCartesian ()
2075 QPointF posGraph = guidelineOffset.
bottom (*m_view,
2077 guidelineAddXTEnqueue (posGraph.x ());
2080void MainWindow::slotBtnGuidelineBottomPolar ()
2083 QPointF posGraph = guidelineOffset.
bottom (*m_view,
2085 guidelineAddXTEnqueue (posGraph.x ());
2088void MainWindow::slotBtnGuidelineLeftCartesian ()
2091 QPointF posGraph = guidelineOffset.
left (*m_view,
2093 guidelineAddYREnqueue (posGraph.y ());
2096void MainWindow::slotBtnGuidelineLeftPolar ()
2099 QPointF posGraph = guidelineOffset.
left (*m_view,
2101 guidelineAddYREnqueue (posGraph.y ());
2104void MainWindow::slotBtnGuidelineRightCartesian ()
2107 QPointF posGraph = guidelineOffset.
right (*m_view,
2109 guidelineAddYREnqueue (posGraph.y ());
2112void MainWindow::slotBtnGuidelineRightPolar ()
2115 QPointF posGraph = guidelineOffset.
right (*m_view,
2117 guidelineAddYREnqueue (posGraph.y ());
2120void MainWindow::slotBtnGuidelineTopCartesian ()
2123 QPointF posGraph = guidelineOffset.
top (*m_view,
2125 guidelineAddXTEnqueue (posGraph.x ());
2128void MainWindow::slotBtnGuidelineTopPolar ()
2131 QPointF posGraph = guidelineOffset.
top (*m_view,
2133 guidelineAddXTEnqueue (posGraph.x ());
2136void MainWindow::slotBtnPrintAll ()
2142 QPrinter printer (QPrinter::HighResolution);
2143 QPrintDialog dlg (&printer,
this);
2144 if (dlg.exec() == QDialog::Accepted) {
2145 QPainter painter (&printer);
2146 m_view->render (&painter);
2153void MainWindow::slotBtnShowAllPressed ()
2161void MainWindow::slotBtnShowAllReleased ()
2169void MainWindow::slotCanRedoChanged (
bool canRedo)
2173 m_actionEditRedo->setEnabled (canRedo || m_cmdStackShadow->
canRedo());
2176void MainWindow::slotCanUndoChanged (
bool canUndo)
2180 m_actionEditUndo->setEnabled (canUndo);
2183void MainWindow::slotChecklistClosed()
2187 m_actionViewChecklistGuide->setChecked (
false);
2190void MainWindow::slotCleanChanged(
bool clean)
2194 setWindowModified (!clean);
2197void MainWindow::slotCmbBackground(
int currentIndex)
2201 switch (currentIndex) {
2203 if (!m_actionViewBackgroundNone->isChecked()) {
2204 m_actionViewBackgroundNone->toggle();
2209 if (!m_actionViewBackgroundOriginal->isChecked ()) {
2210 m_actionViewBackgroundOriginal->toggle();
2215 if (!m_actionViewBackgroundFiltered->isChecked ()) {
2216 m_actionViewBackgroundFiltered->toggle();
2224void MainWindow::slotCmbCoordSystem(
int index)
2232 m_cmdMediator->push (cmd);
2235void MainWindow::slotCmbCurve(
int )
2243 m_cmbCurve->currentText ());
2247 updateViewedCurves();
2249 updateFittingWindow();
2250 updateGeometryWindow();
2253void MainWindow::slotContextMenuEventAxis (QString pointIdentifier)
2255 LOG4CPP_INFO_S ((*
mainCat)) <<
"MainWindow::slotContextMenuEventAxis point=" << pointIdentifier.toLatin1 ().data ();
2261void MainWindow::slotContextMenuEventGraph (QStringList pointIdentifiers)
2263 LOG4CPP_INFO_S ((*
mainCat)) <<
"MainWindow::slotContextMenuEventGraph point=" << pointIdentifiers.join(
",").toLatin1 ().data ();
2269void MainWindow::slotDigitizeAxis ()
2275 m_cmbCurve->setEnabled (
false);
2281void MainWindow::slotDigitizeColorPicker ()
2287 m_cmbCurve->setEnabled (
true);
2293void MainWindow::slotDigitizeCurve ()
2299 m_cmbCurve->setEnabled (
true);
2305void MainWindow::slotDigitizePointMatch ()
2311 m_cmbCurve->setEnabled (
true);
2317void MainWindow::slotDigitizeScale ()
2323 m_cmbCurve->setEnabled (
false);
2329void MainWindow::slotDigitizeSegment ()
2335 m_cmbCurve->setEnabled (
true);
2341void MainWindow::slotDigitizeSelect ()
2347 m_cmbCurve->setEnabled (
false);
2353void MainWindow::slotEditCopy ()
2358 bool tableFittingIsActive, tableFittingIsCopyable;
2359 bool tableGeometryIsActive, tableGeometryIsCopyable;
2360 m_dockFittingWindow->
getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
2361 m_dockGeometryWindow->
getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
2363 if (tableFittingIsActive) {
2366 m_dockFittingWindow->
doCopy ();
2368 }
else if (tableGeometryIsActive) {
2371 m_dockGeometryWindow->
doCopy ();
2377 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
2388void MainWindow::slotEditCut ()
2393 bool tableFittingIsActive, tableFittingIsCopyable;
2394 bool tableGeometryIsActive, tableGeometryIsCopyable;
2395 m_dockFittingWindow->
getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
2396 m_dockGeometryWindow->
getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
2398 if (tableFittingIsActive || tableGeometryIsActive) {
2406 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
2417void MainWindow::slotEditDelete ()
2422 bool tableFittingIsActive, tableFittingIsCopyable;
2423 bool tableGeometryIsActive, tableGeometryIsCopyable;
2424 m_dockFittingWindow->
getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
2425 m_dockGeometryWindow->
getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
2427 if (tableFittingIsActive || tableGeometryIsActive) {
2440 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
2441 QStringList pointIdentifiers = scaleBarAxisPoints.
unite (m_cmdMediator,
2452void MainWindow::slotEditMenu ()
2456 m_actionEditPasteAsNew->setEnabled (!QApplication::clipboard()->image().isNull());
2457 m_actionEditPasteAsNewAdvanced->setEnabled (!QApplication::clipboard()->image().isNull());
2460void MainWindow::slotEditPaste ()
2464 QList<QPoint> points;
2465 QList<double> ordinals;
2474 m_cmbCurve->currentText (),
2481void MainWindow::slotEditPasteAsNew ()
2485 filePaste (IMPORT_TYPE_SIMPLE);
2488void MainWindow::slotEditPasteAsNewAdvanced ()
2492 filePaste (IMPORT_TYPE_ADVANCED);
2495void MainWindow::slotFileClose()
2515 if (m_fittingCurve !=
nullptr) {
2516 m_scene->removeItem (m_fittingCurve);
2517 m_fittingCurve =
nullptr;
2524 m_backgroundStateContext->
close ();
2527 m_scene->setSceneRect (QRectF (0, 0, 1, 1));
2530 m_dockFittingWindow->
clear ();
2533 m_dockGeometryWindow->
clear ();
2536 delete m_cmdMediator;
2539 m_cmdMediator =
nullptr;
2544 m_gridLines.
clear();
2545 m_guidelines.
clear();
2550void MainWindow::slotFileExport ()
2560 if (m_isExportOnly) {
2561 fileName = fileNameForExportOnly ();
2564 QString filter = QString (
"%1;;%2;;All files (*.*)")
2569 QString defaultFileName = QString (
"%1/%2.%3")
2571 .arg (m_currentFile)
2574 QString filterCsv = exportStrategy.
filterCsv ();
2576 fileName = dlg.getSaveFileName (
this,
2583 if (!fileName.isEmpty ()) {
2586 fileExport(fileName,
2595void MainWindow::slotFileImport ()
2599 fileImportWithPrompts (IMPORT_TYPE_SIMPLE);
2602void MainWindow::slotFileImportAdvanced ()
2606 fileImportWithPrompts (IMPORT_TYPE_ADVANCED);
2609void MainWindow::slotFileImportDraggedImage(QImage image)
2616 IMPORT_TYPE_SIMPLE);
2619void MainWindow::slotFileImportDraggedImageUrl(QUrl url)
2621 LOG4CPP_INFO_S ((*
mainCat)) <<
"MainWindow::slotFileImportDraggedImageUrl url=" << url.toString ().toLatin1 ().data ();
2628void MainWindow::slotFileImportImage(QString fileName, QImage image)
2630 LOG4CPP_INFO_S ((*
mainCat)) <<
"MainWindow::slotFileImportImage fileName=" << fileName.toLatin1 ().data ();
2633 loadImage (fileName,
2635 IMPORT_TYPE_SIMPLE);
2638void MainWindow::slotFileImportImageReplace ()
2642 fileImportWithPrompts (IMPORT_TYPE_IMAGE_REPLACE);
2645void MainWindow::slotFileOpen()
2653 QString filter = QString (
"%1 (*.%2);; All Files (*.*)")
2654 .arg (ENGAUGE_FILENAME_DESCRIPTION)
2658 QString fileName = QFileDialog::getOpenFileName (
this,
2659 tr(
"Open Document"),
2662 if (!fileName.isEmpty ()) {
2665 loadDocumentFile (fileName);
2671void MainWindow::slotFileOpenDraggedDigFile (QString fileName)
2675 loadDocumentFile (fileName);
2678void MainWindow::slotFilePrint()
2682 QPrinter printer (QPrinter::HighResolution);
2683 QPrintDialog dlg (&printer,
this);
2684 if (dlg.exec() == QDialog::Accepted) {
2685 QPainter painter (&printer);
2686 m_view->render (&painter);
2691bool MainWindow::slotFileSave()
2695 if (m_engaugeFile.isEmpty()) {
2696 return slotFileSaveAs();
2698 return saveDocumentFile (m_engaugeFile);
2702bool MainWindow::slotFileSaveAs()
2707 QString filenameDefault = m_currentFile;
2709 filenameDefault = QString (
"%1.%2")
2710 .arg (m_currentFile)
2714 if (!m_engaugeFile.isEmpty()) {
2715 filenameDefault = m_engaugeFile;
2718 QString filterDigitizer = QString (
"%1 (*.%2)")
2719 .arg (ENGAUGE_FILENAME_DESCRIPTION)
2721 QString filterAll (
"All files (*. *)");
2723 QStringList filters;
2724 filters << filterDigitizer;
2725 filters << filterAll;
2729 QFileDialog dlg(
this);
2730 dlg.setFileMode (QFileDialog::AnyFile);
2731 dlg.selectNameFilter (filterDigitizer);
2732 dlg.setNameFilters (filters);
2733#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
2735 dlg.setWindowModality(Qt::WindowModal);
2737 dlg.setAcceptMode(QFileDialog::AcceptSave);
2738 dlg.selectFile(filenameDefault);
2742 QStringList files = dlg.selectedFiles();
2744 return saveDocumentFile(files.at(0));
2750void MainWindow::slotFittingWindowClosed()
2754 m_actionViewFittingWindow->setChecked (
false);
2765 <<
" order=" << fittingCurveCoef.size() - 1;
2767 if (m_fittingCurve !=
nullptr) {
2768 m_scene->removeItem (m_fittingCurve);
2769 delete m_fittingCurve;
2778 m_fittingCurve->setVisible (m_actionViewFittingWindow->isChecked ());
2779 m_scene->addItem (m_fittingCurve);
2782void MainWindow::slotGeometryWindowClosed()
2786 m_actionViewGeometryWindow->setChecked (
false);
2789void MainWindow::slotGuidelineDragged(QString identifierReplaced,
2791 bool draggedOffscreen,
2799 guidelineStateForReplacement);
2811 m_cmdMediator->push (cmd);
2814void MainWindow::slotHelpAbout()
2822void MainWindow::slotHelpTutorial()
2826 m_tutorialDlg->show ();
2827 m_tutorialDlg->exec ();
2830void MainWindow::slotKeyPress (Qt::Key key,
2831 bool atLeastOneSelectedItem)
2834 <<
" key=" << QKeySequence (key).toString().toLatin1 ().data ()
2835 <<
" atLeastOneSelectedItem=" << (atLeastOneSelectedItem ?
"true" :
"false");
2839 atLeastOneSelectedItem);
2842void MainWindow::slotLoadStartupFiles ()
2848 QString fileName = m_loadStartupFiles.front();
2849 m_loadStartupFiles.pop_front();
2855 loadDocumentFile (fileName);
2859 fileImport (fileName,
2860 IMPORT_TYPE_SIMPLE);
2864 if (m_loadStartupFiles.count() > 0) {
2868 QProcess::startDetached (QCoreApplication::applicationFilePath(),
2869 m_commandLineWithoutLoadStartupFiles + m_loadStartupFiles);
2873void MainWindow::slotMouseMove (QPointF pos)
2878 if (m_cmdMediator !=
nullptr) {
2881 QString coordsScreen, coordsGraph, resolutionGraph;
2901void MainWindow::slotMousePress (QPointF pos)
2911void MainWindow::slotMouseRelease (QPointF pos)
2915 if (pos.x() < 0 || pos.y() < 0) {
2929void MainWindow::slotRecentFileAction ()
2933 QAction *action = qobject_cast<QAction*>(sender ());
2936 QString fileName = action->data().toString();
2937 loadDocumentFile (fileName);
2941void MainWindow::slotRecentFileClear ()
2945 QStringList emptyList;
2951 updateRecentFileList();
2954void MainWindow::slotRedoTextChanged (
const QString &text)
2958 QString completeText (
"Redo");
2959 if (!text.isEmpty ()) {
2960 completeText += QString (
" \"%1\"").arg (text);
2962 m_actionEditRedo->setText (completeText);
2965void MainWindow::slotSettingsAxesChecker ()
2969 m_dlgSettingsAxesChecker->
load (*m_cmdMediator);
2970 m_dlgSettingsAxesChecker->show ();
2973void MainWindow::slotSettingsColorFilter ()
2977 m_dlgSettingsColorFilter->
load (*m_cmdMediator);
2978 m_dlgSettingsColorFilter->show ();
2981void MainWindow::slotSettingsCoords ()
2985 m_dlgSettingsCoords->
load (*m_cmdMediator);
2986 m_dlgSettingsCoords->show ();
2989void MainWindow::slotSettingsCurveList ()
2993 m_dlgSettingsCurveList->
load (*m_cmdMediator);
2994 m_dlgSettingsCurveList->show ();
2997void MainWindow::slotSettingsCurveProperties ()
3001 m_dlgSettingsCurveProperties->
load (*m_cmdMediator);
3003 m_dlgSettingsCurveProperties->show ();
3006void MainWindow::slotSettingsDigitizeCurve ()
3010 m_dlgSettingsDigitizeCurve->
load (*m_cmdMediator);
3011 m_dlgSettingsDigitizeCurve->show ();
3014void MainWindow::slotSettingsExportFormat ()
3019 m_dlgSettingsExportFormat->
load (*m_cmdMediator);
3020 m_dlgSettingsExportFormat->show ();
3027void MainWindow::slotSettingsGeneral ()
3031 m_dlgSettingsGeneral->
load (*m_cmdMediator);
3032 m_dlgSettingsGeneral->show ();
3035void MainWindow::slotSettingsGridDisplay()
3039 m_dlgSettingsGridDisplay->
load (*m_cmdMediator);
3040 m_dlgSettingsGridDisplay->show ();
3043void MainWindow::slotSettingsGridRemoval ()
3047 m_dlgSettingsGridRemoval->
load (*m_cmdMediator);
3048 m_dlgSettingsGridRemoval->show ();
3051void MainWindow::slotSettingsPointMatch ()
3055 m_dlgSettingsPointMatch->
load (*m_cmdMediator);
3056 m_dlgSettingsPointMatch->show ();
3059void MainWindow::slotSettingsSegments ()
3063 m_dlgSettingsSegments->
load (*m_cmdMediator);
3064 m_dlgSettingsSegments->show ();
3067void MainWindow::slotTableStatusChange ()
3076void MainWindow::slotSettingsMainWindow ()
3082 m_dlgSettingsMainWindow->show ();
3085void MainWindow::slotTimeoutRegressionErrorReport ()
3088 <<
" cmdStackIndex=" << m_cmdMediator->index()
3089 <<
" cmdStackCount=" << m_cmdMediator->count();
3091 if (m_cmdStackShadow->
canRedo()) {
3094 QDir::setCurrent (m_startupDirectory);
3099 QDir::setCurrent (m_startupDirectory);
3103#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
3104 exportAllCoordinateSystemsAfterRegressionTests ();
3108 m_cmdMediator->setClean();
3114void MainWindow::slotTimeoutRegressionFileCmdScript ()
3118 if (m_fileCmdScript->
canRedo()) {
3121 QDir::setCurrent (m_startupDirectory);
3123 m_fileCmdScript->
redo(*
this);
3126 QDir::setCurrent (m_startupDirectory);
3131 if (m_cmdMediator !=
nullptr) {
3133#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
3134 exportAllCoordinateSystemsAfterRegressionTests ();
3138 m_cmdMediator->setClean();
3148void MainWindow::slotUndoTextChanged (
const QString &text)
3152 QString completeText (
"Undo");
3153 if (!text.isEmpty ()) {
3154 completeText += QString (
" \"%1\"").arg (text);
3156 m_actionEditUndo->setText (completeText);
3159void MainWindow::slotViewGridLines ()
3166void MainWindow::slotViewGroupBackground(QAction *action)
3172 int indexBackground;
3173 if (action == m_actionViewBackgroundNone) {
3176 }
else if (action == m_actionViewBackgroundOriginal) {
3179 }
else if (action == m_actionViewBackgroundFiltered) {
3191 m_cmbBackground->setCurrentIndex (indexBackground);
3195void MainWindow::slotViewGroupCurves(QAction * )
3199 updateViewedCurves ();
3202void MainWindow::slotViewGroupGuidelines (QAction * )
3209 if (m_actionViewGuidelinesHide->isChecked ()) {
3211 }
else if (m_actionViewGuidelinesEdit->isChecked ()) {
3223 m_cmdMediator->push (cmd);
3226 handleGuidelineMode ();
3230void MainWindow::slotViewGroupStatus(QAction *action)
3236 if (action == m_actionStatusNever) {
3238 }
else if (action == m_actionStatusTemporary) {
3245void MainWindow::slotViewToolBarBackground ()
3249 if (m_actionViewBackground->isChecked ()) {
3250 m_toolBackground->show();
3252 m_toolBackground->hide();
3256void MainWindow::slotViewToolBarChecklistGuide ()
3260 if (m_actionViewChecklistGuide->isChecked ()) {
3261 m_dockChecklistGuide->show();
3263 m_dockChecklistGuide->hide();
3267void MainWindow::slotViewToolBarCoordSystem ()
3271 if (m_actionViewCoordSystem->isChecked ()) {
3272 m_toolCoordSystem->show();
3274 m_toolCoordSystem->hide();
3278void MainWindow::slotViewToolBarDigitize ()
3282 if (m_actionViewDigitize->isChecked ()) {
3283 m_toolDigitize->show();
3285 m_toolDigitize->hide();
3289void MainWindow::slotViewToolBarFittingWindow()
3293 if (m_actionViewFittingWindow->isChecked()) {
3294 m_dockFittingWindow->show ();
3295 if (m_fittingCurve !=
nullptr) {
3296 m_fittingCurve->setVisible (
true);
3299 m_dockFittingWindow->hide ();
3300 if (m_fittingCurve !=
nullptr) {
3301 m_fittingCurve->setVisible (
false);
3306void MainWindow::slotViewToolBarGeometryWindow ()
3310 if (m_actionViewGeometryWindow->isChecked ()) {
3311 m_dockGeometryWindow->show();
3313 m_dockGeometryWindow->hide();
3317void MainWindow::slotViewToolBarSettingsViews ()
3321 if (m_actionViewSettingsViews->isChecked ()) {
3322 m_toolSettingsViews->show();
3324 m_toolSettingsViews->hide();
3328void MainWindow::slotViewToolTips ()
3335void MainWindow::slotViewZoom (
int zoom)
3341 m_zoomMapToAction [zoomFactor]->setChecked (
true);
3342 slotViewZoomFactor (
static_cast<ZoomFactor> (zoom));
3345void MainWindow::slotViewZoomFactor (
ZoomFactor zoomFactor)
3350 m_backgroundStateContext->
fitInView (*m_view);
3354 double factor = zoomTransition.
mapToFactor (zoomFactor);
3356 QTransform transform;
3357 transform.scale (factor, factor);
3358 m_view->setTransform (transform);
3364void MainWindow::slotViewZoomFactorInt (
int zoom)
3368 slotViewZoomFactor (
static_cast<ZoomFactor> (zoom));
3371void MainWindow::slotViewZoomIn ()
3377 m_view->transform ().m11 (),
3378 m_view->transform ().m22 (),
3379 m_actionZoomFill->isChecked ());
3380 setNonFillZoomFactor (zoomFactorNew);
3384void MainWindow::slotViewZoomInFromWheelEvent ()
3392 m_view->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
3397 m_view->setTransformationAnchor(QGraphicsView::NoAnchor);
3401void MainWindow::slotViewZoomOut ()
3408 m_view->transform ().m11 (),
3409 m_view->transform ().m22 (),
3410 m_actionZoomFill->isChecked ());
3411 setNonFillZoomFactor (zoomFactorNew);
3414void MainWindow::slotViewZoomOutFromWheelEvent ()
3422 m_view->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
3427 m_view->setTransformationAnchor(QGraphicsView::NoAnchor);
3431void MainWindow::startRegressionDropTest (
const QStringList &loadStartupFiles)
3440 connect (
this, SIGNAL (
signalDropRegression (QString)), m_view, SLOT (slotDropRegression (QString)));
3442 for (
int counter = 0; counter < loadStartupFiles.size (); counter++) {
3443 QString filenameDrop = loadStartupFiles.at (counter);
3448 QSize siz = m_view->size();
3450 QString filenameCsv;
3451 if (filenameDrop.startsWith (
"http")) {
3455 filenameCsv =
"../test/drag_and_drop_http.csv_actual_1";
3460 filenameCsv = QString (
"%1_%2")
3461 .arg (exportRegressionFilenameFromInputFilename (filenameDrop))
3465 QFile file (filenameCsv);
3466 file.open (QIODevice::WriteOnly);
3467 QTextStream str (&file);
3468 str << siz.width() <<
"x" << siz.height() <<
"\n";
3475void MainWindow::startRegressionTestErrorReport(
const QString ®ressionInputFile)
3486 m_regressionFile = exportRegressionFilenameFromInputFilename (regressionInputFile);
3488 m_timerRegressionErrorReport =
new QTimer();
3489 m_timerRegressionErrorReport->setSingleShot(
false);
3490 connect (m_timerRegressionErrorReport, SIGNAL (timeout()),
this, SLOT (slotTimeoutRegressionErrorReport()));
3495void MainWindow::startRegressionTestFileCmdScript()
3499 m_timerRegressionFileCmdScript =
new QTimer();
3500 m_timerRegressionFileCmdScript->setSingleShot(
false);
3501 connect (m_timerRegressionFileCmdScript, SIGNAL (timeout()),
this, SLOT (slotTimeoutRegressionFileCmdScript()));
3508 return m_transformation;
3524 updateAfterCommandStatusBarCoords ();
3526 updateHighlightOpacity ();
3532 updateChecklistGuide ();
3533 updateFittingWindow ();
3534 updateGeometryWindow();
3539 writeCheckpointToLogFile ();
3541 docScrub.
check (*
this,
3546 m_view->setFocus ();
3549void MainWindow::updateAfterCommandStatusBarCoords ()
3556 const QPoint HACK_SO_GRAPH_COORDINATE_MATCHES_INPUT (1, 1);
3560 updateTransformationAndItsDependencies();
3563 if (!m_transformationBefore.transformIsDefined() && m_transformation.
transformIsDefined()) {
3572 }
else if (m_transformationBefore.transformIsDefined() && !m_transformation.
transformIsDefined()) {
3581 }
else if (m_transformation.
transformIsDefined() && (m_transformationBefore != m_transformation)) {
3590 QPoint posLocal = m_view->mapFromGlobal (QCursor::pos ()) - HACK_SO_GRAPH_COORDINATE_MATCHES_INPUT;
3591 QPointF posScreen = m_view->mapToScene (posLocal);
3593 slotMouseMove (posScreen);
3603void MainWindow::updateChecklistGuide ()
3607 m_dockChecklistGuide->
update (*m_cmdMediator,
3608 m_isDocumentExported);
3611void MainWindow::updateControls ()
3614 <<
" selectedItems=" << m_scene->selectedItems().count();
3616 m_cmbBackground->setEnabled (!m_currentFile.isEmpty ());
3618 m_actionImportImageReplace->setEnabled (m_cmdMediator !=
nullptr);
3619#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
3620 m_menuFileOpenRecent->setEnabled ((m_actionRecentFiles.count () > 0) &&
3621 (m_actionRecentFiles.at(0)->isVisible ()));
3623 m_actionClose->setEnabled (!m_currentFile.isEmpty ());
3624 m_actionSave->setEnabled (!m_currentFile.isEmpty ());
3625 m_actionSaveAs->setEnabled (!m_currentFile.isEmpty ());
3626 m_actionExport->setEnabled (!m_currentFile.isEmpty ());
3627 m_actionPrint->setEnabled (!m_currentFile.isEmpty ());
3629 if (m_cmdMediator ==
nullptr) {
3630 m_actionEditUndo->setEnabled (
false);
3631 m_actionEditRedo->setEnabled (
false);
3633 m_actionEditUndo->setEnabled (m_cmdMediator->canUndo ());
3634 m_actionEditRedo->setEnabled (m_cmdMediator->canRedo () || m_cmdStackShadow->
canRedo ());
3636 bool tableFittingIsActive, tableFittingIsCopyable;
3637 bool tableGeometryIsActive, tableGeometryIsCopyable;
3638 m_dockFittingWindow->
getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
3639 m_dockGeometryWindow->
getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
3640 m_actionEditCut->setEnabled (!tableFittingIsActive &&
3641 !tableGeometryIsActive &&
3642 m_scene->selectedItems().count () > 0);
3643 m_actionEditCopy->setEnabled ((!tableFittingIsActive && !tableGeometryIsActive && m_scene->selectedItems().count () > 0) ||
3644 (tableFittingIsActive && tableFittingIsCopyable) ||
3645 (tableGeometryIsActive && tableGeometryIsCopyable));
3646 m_actionEditPaste->setEnabled (m_digitizeStateContext->
canPaste (m_transformation,
3648 m_actionEditDelete->setEnabled (!tableFittingIsActive &&
3649 !tableGeometryIsActive &&
3650 m_scene->selectedItems().count () > 0);
3653 m_actionDigitizeAxis->setEnabled (modeGraph ());
3654 m_actionDigitizeScale->setEnabled (
modeMap ());
3655 m_actionDigitizeCurve ->setEnabled (!m_currentFile.isEmpty ());
3656 m_actionDigitizePointMatch->setEnabled (!m_currentFile.isEmpty ());
3657 m_actionDigitizeColorPicker->setEnabled (!m_currentFile.isEmpty ());
3658 m_actionDigitizeSegment->setEnabled (!m_currentFile.isEmpty ());
3659 m_actionDigitizeSelect->setEnabled (!m_currentFile.isEmpty ());
3661 m_actionViewGridLines->setEnabled (
true);
3663 m_actionViewGridLines->setEnabled (
false);
3664 m_actionViewGridLines->setChecked (
false);
3666 m_actionViewBackground->setEnabled (!m_currentFile.isEmpty());
3667 m_actionViewChecklistGuide->setEnabled (!m_dockChecklistGuide->
browserIsEmpty());
3668 m_actionViewDigitize->setEnabled (!m_currentFile.isEmpty ());
3672 bool editable = (m_actionViewGuidelinesEdit->isChecked ());
3675 m_actionViewGuidelinesHide->setEnabled (
true);
3676 m_actionViewGuidelinesEdit->setEnabled (selectable);
3677 m_actionViewGuidelinesLock->setEnabled (
true);
3688 m_btnGuidelineBottomCartesian->setEnabled (m_btnGuidelineBottomCartesian->isVisible() && selectable);
3689 m_btnGuidelineBottomPolar->setEnabled (m_btnGuidelineBottomPolar->isVisible() && selectable);
3690 m_btnGuidelineLeftCartesian->setEnabled (m_btnGuidelineLeftCartesian->isVisible() && selectable);
3691 m_btnGuidelineLeftPolar->setEnabled (m_btnGuidelineLeftPolar->isVisible() && selectable);
3692 m_btnGuidelineRightCartesian->setEnabled (m_btnGuidelineRightCartesian->isVisible() && selectable);
3693 m_btnGuidelineRightPolar->setEnabled (m_btnGuidelineRightPolar->isVisible() && selectable);
3694 m_btnGuidelineTopCartesian->setEnabled (m_btnGuidelineTopCartesian->isVisible() && selectable);
3695 m_btnGuidelineTopPolar->setEnabled (m_btnGuidelineTopPolar->isVisible() && selectable);
3699 m_actionViewGuidelinesHide->setEnabled (
false);
3700 m_actionViewGuidelinesEdit->setEnabled (
false);
3701 m_actionViewGuidelinesLock->setEnabled (
false);
3703 m_btnGuidelineBottomCartesian->setVisible (
false);
3704 m_btnGuidelineBottomPolar->setVisible (
false);
3705 m_btnGuidelineLeftCartesian->setVisible (
false);
3706 m_btnGuidelineLeftPolar->setVisible (
false);
3707 m_btnGuidelineRightCartesian->setVisible (
false);
3708 m_btnGuidelineRightPolar->setVisible (
false);
3709 m_btnGuidelineTopCartesian->setVisible (
false);
3710 m_btnGuidelineTopPolar->setVisible (
false);
3712 m_btnGuidelineBottomCartesian->setEnabled (
false);
3713 m_btnGuidelineBottomPolar->setEnabled (
false);
3714 m_btnGuidelineLeftCartesian->setEnabled (
false);
3715 m_btnGuidelineLeftPolar->setEnabled (
false);
3716 m_btnGuidelineRightCartesian->setEnabled (
false);
3717 m_btnGuidelineRightPolar->setEnabled (
false);
3718 m_btnGuidelineTopCartesian->setEnabled (
false);
3719 m_btnGuidelineTopPolar->setEnabled (
false);
3721 m_actionViewSettingsViews->setEnabled (!m_currentFile.isEmpty ());
3723 m_actionSettingsCoords->setEnabled (!m_currentFile.isEmpty ());
3724 m_actionSettingsCurveList->setEnabled (!m_currentFile.isEmpty ());
3725 m_actionSettingsCurveProperties->setEnabled (!m_currentFile.isEmpty ());
3726 m_actionSettingsDigitizeCurve->setEnabled (!m_currentFile.isEmpty ());
3727 m_actionSettingsExport->setEnabled (!m_currentFile.isEmpty ());
3728 m_actionSettingsColorFilter->setEnabled (!m_currentFile.isEmpty ());
3729 m_actionSettingsAxesChecker->setEnabled (!m_currentFile.isEmpty ());
3730 m_actionSettingsGridDisplay->setEnabled (!m_currentFile.isEmpty () && m_transformation.
transformIsDefined());
3731 m_actionSettingsGridRemoval->setEnabled (!m_currentFile.isEmpty ());
3732 m_actionSettingsPointMatch->setEnabled (!m_currentFile.isEmpty ());
3733 m_actionSettingsSegments->setEnabled (!m_currentFile.isEmpty ());
3734 m_actionSettingsGeneral->setEnabled (!m_currentFile.isEmpty ());
3736 m_groupBackground->setEnabled (!m_currentFile.isEmpty ());
3737 m_groupCurves->setEnabled (!m_currentFile.isEmpty ());
3739 m_groupZoom->setEnabled (!m_currentFile.isEmpty ());
3741 m_actionZoomIn->setEnabled (!m_currentFile.isEmpty ());
3742 m_actionZoomOut->setEnabled (!m_currentFile.isEmpty ());
3750 if ((
CoordSystemIndex) m_cmbCoordSystem->currentIndex() != coordSystemIndex) {
3751 m_cmbCoordSystem->setCurrentIndex (coordSystemIndex);
3757 loadCurveListFromCmdMediator ();
3759 updateTransformationAndItsDependencies();
3761 loadGuidelinesFromCmdMediator();
3774 switch (digitizeState) {
3776 m_actionDigitizeAxis->setChecked(
true);
3781 m_actionDigitizeColorPicker->setChecked(
true);
3782 slotDigitizeColorPicker();
3786 m_actionDigitizeCurve->setChecked(
true);
3787 slotDigitizeCurve();
3794 m_actionDigitizePointMatch->setChecked(
true);
3795 slotDigitizePointMatch();
3799 m_actionDigitizeScale->setChecked(
true);
3800 slotDigitizeScale();
3804 m_actionDigitizeSegment->setChecked(
true);
3805 slotDigitizeSegment();
3809 m_actionDigitizeSelect->setChecked(
true);
3810 slotDigitizeSelect();
3819void MainWindow::updateFittingWindow ()
3823 if (m_cmdMediator !=
nullptr &&
3824 m_cmbCurve !=
nullptr) {
3827 m_dockFittingWindow->
update (*m_cmdMediator,
3829 m_cmbCurve->currentText (),
3834void MainWindow::updateGeometryWindow ()
3838 if (m_cmdMediator !=
nullptr &&
3839 m_cmbCurve !=
nullptr) {
3842 m_dockGeometryWindow->
update (*m_cmdMediator,
3844 m_cmbCurve->currentText (),
3857void MainWindow::updateGridLines ()
3862 m_gridLines.
clear ();
3873 m_gridLines.
setVisible (m_actionViewGridLines->isChecked());
3876void MainWindow::updateHighlightOpacity ()
3878 if (m_cmdMediator !=
nullptr) {
3884 m_dockGeometryWindow,
3889void MainWindow::updateRecentFileList()
3893#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
3898 unsigned int count = unsigned (recentFilePaths.size());
3905 for (i = 0; i < signed (count); i++) {
3906 QString strippedName = QFileInfo (recentFilePaths.at(i)).fileName();
3907 m_actionRecentFiles.at (i)->setText (strippedName);
3908 m_actionRecentFiles.at (i)->setData (recentFilePaths.at (i));
3909 m_actionRecentFiles.at (i)->setVisible (
true);
3914 m_actionRecentFiles.at (i)->setVisible (
false);
3929 m_cmbCurve->currentText());
3935 m_cmbCurve->currentText());
3948 m_cmbCurve->currentText());
3965 loadCurveListFromCmdMediator();
3984 modelDigitizeCurve);
4016void MainWindow::updateSettingsMainWindow()
4023 m_actionZoomIn->setShortcut (tr (
""));
4024 m_actionZoomOut->setShortcut (tr (
""));
4028 m_actionZoomIn->setShortcut (tr (
"+"));
4029 m_actionZoomOut->setShortcut (tr (
"-"));
4033 if ((m_scene !=
nullptr) &&
4034 (m_cmdMediator !=
nullptr)) {
4038 updateHighlightOpacity();
4039 updateWindowTitle();
4040 updateFittingWindow();
4041 updateGeometryWindow();
4068void MainWindow::updateSmallDialogs ()
4085void MainWindow::updateTransformationAndItsDependencies()
4087 m_transformation.
update (!m_currentFile.isEmpty (),
4096 m_cmbCurve->currentText ());
4105void MainWindow::updateViewedCurves ()
4109 if (m_actionViewCurvesAll->isChecked ()) {
4113 }
else if (m_actionViewCurvesSelected->isChecked ()) {
4117 }
else if (m_actionViewCurvesNone->isChecked ()) {
4131 QString activeCurve = m_digitizeStateContext->
activeCurve ();
4138 if (activeCurve.isEmpty ()) {
4151 m_cmdMediator->
pixmap ());
4156void MainWindow::updateWindowTitle ()
4160 const QString PLACEHOLDER (
"[*]");
4162 QString title = QString (
"%1 %2")
4163 .arg (tr (
"Engauge Digitizer"))
4166 QString fileNameMaybeStripped;
4167 if (!m_currentFileWithPathAndFileExtension.isEmpty()) {
4169 QFileInfo fileInfo (m_currentFileWithPathAndFileExtension);
4176 fileNameMaybeStripped = fileInfo.completeBaseName();
4180 fileNameMaybeStripped = m_currentFileWithPathAndFileExtension;
4184 title += QString (
": %1")
4185 .arg (fileNameMaybeStripped);
4190 title += PLACEHOLDER;
4192 setWindowTitle (title);
4207void MainWindow::writeCheckpointToLogFile ()
4210 QString checkpointDoc;
4211 QTextStream strDoc (&checkpointDoc);
4216 QString checkpointScene;
4217 QTextStream strScene (&checkpointScene);
4225 <<
"--------------DOCUMENT CHECKPOINT START----------" <<
"\n"
4226 << checkpointDoc.toLatin1().data()
4227 <<
"---------------DOCUMENT CHECKPOINT END-----------" <<
"\n"
4228 <<
"----------------SCENE CHECKPOINT START-----------" <<
"\n"
4229 << checkpointScene.toLatin1().data()
4230 <<
"-----------------SCENE CHECKPOINT END------------" ;
BackgroundImage
Background selection.
@ BACKGROUND_IMAGE_ORIGINAL
@ BACKGROUND_IMAGE_FILTERED
unsigned int CoordSystemIndex
Zero-based index for identifying CoordSystem instantiations.
DigitizeState
Set of possible states of Digitize toolbar.
@ DIGITIZE_STATE_POINT_MATCH
@ DIGITIZE_STATE_COLOR_PICKER
@ DOCUMENT_AXES_POINTS_REQUIRED_2
const QString DOCUMENT_SERIALIZE_ERROR
const QString DOCUMENT_SERIALIZE_APPLICATION
const QString DOCUMENT_SERIALIZE_ERROR_CONTEXT
const QString DOCUMENT_SERIALIZE_OPERATING_SYSTEM_WORD_SIZE
const QString DOCUMENT_SERIALIZE_FILE
const QString DOCUMENT_SERIALIZE_ERROR_COMMENT
const QString DOCUMENT_SERIALIZE_IMAGE
const QString DOCUMENT_SERIALIZE_IMAGE_HEIGHT
const QString DOCUMENT_SERIALIZE_ERROR_LINE
const QString DOCUMENT_SERIALIZE_IMAGE_WIDTH
const QString DOCUMENT_SERIALIZE_ERROR_FILE
const QString DOCUMENT_SERIALIZE_DOCUMENT
const QString DOCUMENT_SERIALIZE_OPERATING_SYSTEM_ENDIAN
const QString DOCUMENT_SERIALIZE_APPLICATION_VERSION_NUMBER
const QString DOCUMENT_SERIALIZE_FILE_IMPORTED
const QString DOCUMENT_SERIALIZE_OPERATING_SYSTEM
const QString DOCUMENT_SERIALIZE_ERROR_REPORT
const QString DOCUMENT_SERIALIZE_BOOL_TRUE
const QString DOCUMENT_SERIALIZE_BOOL_FALSE
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT.
#define ENGAUGE_CHECK_PTR(ptr)
Drop in replacement for Q_CHECK_PTR.
QString EndianToString(QSysInfo::Endian endian)
QVector< double > FittingCurveCoefficients
Coefficients x0, x1, ... in y = a0 + a1 * x + a2 * x^2 + ...
const double DEFAULT_HIGHLIGHT_OPACITY
const int DEFAULT_MAXIMUM_GRID_LINES
Default for maximum number of grid lines.
GuidelineState
Set of possible Guideline states. See class Guideline for more information.
GuidelineViewState
Set of possible Guideline view states.
@ GUIDELINE_VIEW_STATE_HIDE
@ GUIDELINE_VIEW_STATE_EDIT
@ NUM_GUIDELINE_VIEW_STATES
@ GUIDELINE_VIEW_STATE_LOCK
const ImportCropping DEFAULT_IMPORT_CROPPING
log4cpp::Category * mainCat
const QString INDENTATION_PAST_TIMESTAMP
MainTitleBarFormat
Format format in MainWindow title bar.
@ MAIN_TITLE_BAR_FORMAT_NO_PATH
@ MAIN_TITLE_BAR_FORMAT_PATH
Filename without path.
const bool DEFAULT_SMALL_DIALOGS
const int DEFAULT_MAXIMUM_EXPORTED_POINTS_PER_CURVE
const bool DEFAULT_IMAGE_REPLACE_RENAMES_DOCUMENT
const int DEFAULT_SIGNIFICANT_DIGITS
const bool DEFAULT_DRAG_DROP_EXPORT
const int REGRESSION_INTERVAL
const unsigned int MAX_RECENT_FILE_LIST_SIZE
const QString ENGAUGE_FILENAME_EXTENSION("dig")
const QString EMPTY_FILENAME("")
const unsigned int MAX_RECENT_FILE_LIST_SIZE
NonPdfReturn
Return values from load operation.
@ NON_PDF_RETURN_CANCELED
int DEFAULT_IMPORT_PDF_RESOLUTION
PdfReturn
Return values from load operation.
const QString SETTINGS_ZOOM_FACTOR
const QString SETTINGS_SMALL_DIALOGS
const QString SETTINGS_IMPORT_PDF_RESOLUTION
const QString SETTINGS_ENGAUGE
const QString SETTINGS_CHECKLIST_GUIDE_DOCK_AREA
const QString SETTINGS_FITTING_WINDOW_DOCK_AREA
const QString SETTINGS_MAIN_TITLE_BAR_FORMAT
const QString SETTINGS_MAIN_DIRECTORY_EXPORT_SAVE
const QString SETTINGS_MAXIMUM_GRID_LINES
const QString SETTINGS_IMAGE_REPLACE_RENAMES_DOCUMENT
const QString SETTINGS_MAIN_DIRECTORY_IMPORT_LOAD
const QString SETTINGS_GROUP_ENVIRONMENT
const QString SETTINGS_HELP_SIZE
const QString SETTINGS_HIGHLIGHT_OPACITY
const QString SETTINGS_CHECKLIST_GUIDE_DOCK_GEOMETRY
const QString SETTINGS_LOCALE_LANGUAGE
const QString SETTINGS_SIZE
const QString SETTINGS_IMPORT_CROPPING
const QString SETTINGS_RECENT_FILE_LIST
const QString SETTINGS_HELP_POS
const QString SETTINGS_VIEW_COORD_SYSTEM_TOOLBAR
const QString SETTINGS_VIEW_DIGITIZE_TOOLBAR
const QString SETTINGS_ZOOM_FACTOR_INITIAL
const QString SETTINGS_SIGNIFICANT_DIGITS
const QString SETTINGS_VIEW_BACKGROUND_TOOLBAR
const QString SETTINGS_VIEW_SETTINGS_VIEWS_TOOLBAR
const QString SETTINGS_MAXIMUM_EXPORTED_POINTS_PER_CURVE
const QString SETTINGS_CHECKLIST_GUIDE_WIZARD
const QString SETTINGS_DRAG_DROP_EXPORT
const QString SETTINGS_VIEW_STATUS_BAR
const QString SETTINGS_ZOOM_CONTROL
const QString SETTINGS_GROUP_MAIN_WINDOW
const QString SETTINGS_VIEW_TOOL_TIPS
const QString SETTINGS_BACKGROUND_IMAGE
const QString SETTINGS_GEOMETRY_WINDOW_DOCK_GEOMETRY
const QString SETTINGS_POS
const QString SETTINGS_DIGITIZER
const QString SETTINGS_CURRENT_DIRECTORY
const QString SETTINGS_FITTING_WINDOW_DOCK_GEOMETRY
const QString SETTINGS_LOCALE_COUNTRY
const QString SETTINGS_GEOMETRY_WINDOW_DOCK_AREA
@ STATUS_BAR_MODE_TEMPORARY
QString engaugeWindowTitle()
Text for title bars of dialogs.
const char * VERSION_NUMBER
@ ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS
@ ZOOM_CONTROL_MENU_WHEEL
const ZoomFactorInitial DEFAULT_ZOOM_FACTOR_INITIAL
ZoomFactor
Zoom factors ordered by zoom level so next one above/below is the next zoom level.
void setPixmap(bool isGnuplot, const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &modelColorFilter, const QPixmap &pixmapOriginal, const QString &curveSelected)
Update the images of all states, rather than just the current state.
void setBackgroundImage(BackgroundImage backgroundImage)
Transition to the specified state. This method is used by classes outside of the state machine to tri...
QImage imageForCurveState() const
Image for the Curve state, even if the current state is different.
void fitInView(GraphicsView &view)
Zoom so background fills the window.
void updateColorFilter(bool isGnuplot, const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &colorFilter, const QString &curveSelected)
Apply color filter settings.
void close()
Open Document is being closed so remove the background.
void setCurveSelected(bool isGnuplot, const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &modelColorFilter, const QString &curveSelected)
Update the selected curve.
Wizard for setting up the checklist guide.
QStringList curveNames(CoordSystemIndex coordSystemIndex) const
Curve names to be placed into Document.
QString templateHtml(CoordSystemIndex coordSystemIndex) const
Template html comprising the checklist for display.
void populateCurvesGraphs(CoordSystemIndex coordSystemIndex, CurvesGraphs &curvesGraphs)
Create entries in CurvesGraphs for each curve name that user provided.
bool browserIsEmpty() const
When browser is empty, it is pointless to show it.
void setTemplateHtml(const QString &html, const QStringList &curveNames)
Populate the browser with template html.
void update(const CmdMediator &cmdMediator, bool documentIsExported)
Update using current CmdMediator/Document state.
Wrapper around QUndoCommand. This simplifies the more complicated feature set of QUndoCommand.
Command for adding one or more graph points. This is for Segment Fill mode.
Command for copying all selected Points to the clipboard.
Command for cutting all selected Points.
Command for deleting all selected Points.
Command for adding one X/T Guideline value.
Command for adding one Y/R Guideline value.
Command for changing the View / Guidelines state.
Command for changing the currently selected CoordSystem.
bool canRedo() const
Return true if there is a command available.
void slotRedo()
Move next command from list to CmdMediator. Noop if there are no more commands.
void loadCommands(MainWindow &mainWindow, Document &document, QXmlStreamReader &reader)
Load commands from serialized xml.
Color filter parameters for one curve. For a class, this is handled the same as LineStyle and PointSt...
Facade class that wraps around all of the create classes for MainWindow.
void create(MainWindow &mw)
Create QAction facade.
PointStyle pointStyle() const
Get method for PointStyle.
Model for DlgSettingsCurveProperties and CmdSettingsCurveProperties.
CurveStyle curveStyle(const QString &curveName) const
CurveStyle in specified curve.
Container for all graph curves. The axes point curve is external to this class.
void resetOnLoad(CmdMediator *cmdMediator)
Resetting makes re-initializes for documents after the first.
void handleMouseRelease(CmdMediator *cmdMediator, QPointF pos)
See DigitizeStateAbstractBase::handleMouseRelease.
bool canPaste(const Transformation &transformation, const QSize &viewSize) const
Return true if there is good data in the clipboard for pasting, and that operation is compatible with...
void handleMouseMove(CmdMediator *cmdMediator, QPointF pos)
See DigitizeStateAbstractBase::handleMouseMove.
void requestImmediateStateTransition(CmdMediator *cmdMediator, DigitizeState digitizeState)
Perform immediate state transition. Called from outside state machine.
void updateModelDigitizeCurve(CmdMediator *cmdMediator, const DocumentModelDigitizeCurve &modelDigitizeCurve)
Update the digitize curve settings.
void handleContextMenuEventGraph(CmdMediator *cmdMediator, const QStringList &pointIdentifiers)
See DigitizeStateAbstractBase::handleContextMenuEventGraph.
void handleMousePress(CmdMediator *cmdMediator, QPointF pos)
See DigitizeStateAbstractBase::handleMousePress.
void appendNewCmd(CmdMediator *cmdMediator, QUndoCommand *cmd)
Append just-created QUndoCommand to command stack. This is called from DigitizeStateAbstractBase subc...
void setImageIsLoaded(CmdMediator *cmdMediator, bool imageIsLoaded)
Set the image so QGraphicsView cursor and drag mode are accessible.
QString activeCurve() const
Curve name for active Curve. This can include AXIS_CURVE_NAME, and empty string.
void handleKeyPress(CmdMediator *cmdMediator, Qt::Key key, bool atLeastOneSelectedItem)
See DigitizeStateAbstractBase::handleKeyPress.
void updateModelSegments(const DocumentModelSegments &modelSegments)
Update the segments given the new settings.
bool guidelinesAreSelectable() const
Enable/disable guidelines according to state.
void updateAfterPointAddition()
Update the graphics attributes.
void handleCurveChange(CmdMediator *cmdMediator)
See DigitizeStateAbstractBase::handleCurveChange.
void handleContextMenuEventAxis(CmdMediator *cmdMediator, const QString &pointIdentifier)
See DigitizeStateAbstractBase::handleContextMenuEventAxis.
About Engauge dialog. This provides a hidden shortcut for triggering ENGAUGE_ASSERT.
Dialog for saving error report for later transmission to the developers.
Dialog for setting the advanced parameters in a newly imported Document.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void load(CmdMediator &cmdMediator)
Load settings from Document.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
void setCurveName(const QString &curveName)
Load information for the specified curve name. When called externally, the load method must have been...
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
void loadMainWindowModel(CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow)
Replaced load method since the main window settings are independent of document, unlike other DlgSett...
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
Model for DlgSettingsAxesChecker and CmdSettingsAxesChecker.
Model for DlgSettingsColorFilter and CmdSettingsColorFilter.
const ColorFilterSettings colorFilterSettings(const QString &curveName) const
Get method for copying one color filter. Cannot return just a reference or else there is a warning ab...
Model for DlgSettingsCoords and CmdSettingsCoords.
CoordsType coordsType() const
Get method for coordinates type.
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
Model for DlgSettingsGeneral and CmdSettingsGeneral.
Model for DlgSettingsGridDisplay and CmdSettingsGridDisplay.
Model for DlgSettingsGridRemoval and CmdSettingsGridRemoval. The settings are unstable until the user...
Model for DlgSettingsPointMatch and CmdSettingsPointMatch.
Model for DlgSettingsSegments and CmdSettingsSegments.
void check(MainWindow &mainWindow, const Document &document) const
Check document state.
unsigned int coordSystemCount() const
Number of CoordSystem.
void setModelGridRemoval(const DocumentModelGridRemoval &modelGridRemoval)
Set method for DocumentModelGridRemoval.
void setCoordSystemIndex(CoordSystemIndex coordSystemIndex)
Set the index of current active CoordSystem.
void setModelGuidelines(const DocumentModelGuidelines &modelGuidelines)
Set method for DocumentModelGuidelines.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
CoordSystemIndex coordSystemIndex() const
Index of current active CoordSystem.
QStringList curvesGraphsNames() const
See CurvesGraphs::curvesGraphsNames.
void setModelPointMatch(const DocumentModelPointMatch &modelPointMatch)
Set method for DocumentModelPointMatch.
void setModelCurveStyles(const CurveStyles &modelCurveStyles)
Set method for CurveStyles.
void setModelGridDisplay(const DocumentModelGridDisplay &modelGridDisplay)
Set method for DocumentModelGridDisplay.
void addCoordSystems(unsigned int numberCoordSystemToAdd)
Add some number (0 or more) of additional coordinate systems.
void setModelColorFilter(const DocumentModelColorFilter &modelColorFilter)
Set method for DocumentModelColorFilter.
void setModelDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Set method for DocumentModelDigitizeCurve.
void saveXml(QXmlStreamWriter &writer) const
Save document to xml.
DocumentModelAxesChecker modelAxesChecker() const
Get method for DocumentModelAxesChecker.
DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
DocumentModelColorFilter modelColorFilter() const
Get method for DocumentModelColorFilter.
void setCurvesGraphs(const CurvesGraphs &curvesGraphs)
Let CmdAbstract classes overwrite CurvesGraphs.
CurveStyles modelCurveStyles() const
Get method for CurveStyles.
void setModelCoords(const DocumentModelCoords &modelCoords)
Set method for DocumentModelCoords.
void setModelAxesChecker(const DocumentModelAxesChecker &modelAxesChecker)
Set method for DocumentModelAxesChecker.
void setModelSegments(const DocumentModelSegments &modelSegments)
Set method for DocumentModelSegments.
DocumentModelGuidelines modelGuidelines() const
Get method for DocumentModelGuidelines.
void setModelGeneral(const DocumentModelGeneral &modelGeneral)
Set method for DocumentModelGeneral.
void setModelExport(const DocumentModelExportFormat &modelExport)
Set method for DocumentModelExportFormat.
DocumentModelGridRemoval modelGridRemoval() const
Get method for DocumentModelGridRemoval.
DocumentModelGridDisplay modelGridDisplay() const
Get method for DocumentModelGridDisplay.
DocumentModelExportFormat modelExport() const
Get method for DocumentModelExportFormat.
void setPixmap(const QImage &image)
Set method for the background pixmap.
Utility class for adjusting export settings given filename extension.
DocumentModelExportFormat modelExportOverride(const DocumentModelExportFormat &modelExportFormatBefore, const ExportToFile &exportStrategy, const QString &selectedNameFilter) const
Adjust export settings given filename extension.
Class for exporting during regression, when the Transformation has not yet been defined.
Strategy class for exporting to a file. This strategy is external to the Document class so that class...
QString filterTsv() const
QFileDialog filter for TSV files.
QString filterCsv() const
QFileDialog filter for CSV files.
void exportToFile(const DocumentModelExportFormat &modelExport, const Document &document, const MainWindowModel &modelMainWindow, const Transformation &transformation, QTextStream &str) const
Export Document points according to the settings.
QString fileExtensionCsv() const
File extension for csv export files.
File that manages a command stack for regression testing of file import/open/export/close.
bool canRedo() const
Returns true if there is at least one command on the stack.
void redo(MainWindow &mainWindow)
Apply the next command. Requires non-empty stack.
Curve that overlays the current scene so the regression-fitted curve is visible.
virtual void clear()
Clear stale information.
virtual void doCopy()
Copy the current selection to the clipboard.
virtual void update(const CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow, const QString &curveSelected, const Transformation &transformation)
Populate the table with the specified Curve.
virtual void update(const CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow, const QString &curveSelected, const Transformation &transformation)
Populate the table with the specified Curve.
virtual void clear()
Clear stale information.
virtual void doCopy()
Copy the current selection to the clipboard.
Class for showing points and lines for all coordinate systems simultaneously, even though the code no...
unsigned int coordSystemIndexToBeRestored() const
Coordinate system index that was active before the ghosts.
void createGhosts(QGraphicsScene &scene)
Create ghosts from the path/rect/polygon lists.
void captureGraphicsItems(QGraphicsScene &scene)
Take a snapshot of the graphics items.
void destroyGhosts(QGraphicsScene &scene)
Destory ghosts. Called at end of algorithm.
Add point and line handling to generic QGraphicsScene.
void updateGraphicsLinesToMatchGraphicsPoints(const CurveStyles &modelCurveStyles, const Transformation &transformation)
A mouse move has just occurred so move the selected points, since they were dragged.
void resetOnLoad()
Reset, when loading a document after the first, to same state that first document was at when loaded.
void updateAfterCommand(CmdMediator &cmdMediator, double highlightOpacity, GeometryWindow *geometryWindow, const Transformation &transformation)
Update the Points and their Curves after executing a command.
void showCurves(bool show, bool showAll=false, const QString &curveName="")
Show or hide all Curves (if showAll is true) or just the selected Curve (if showAll is false);.
void resetPositionHasChangedFlags()
Reset positionHasChanged flag for all items. Typically this is done as part of mousePressEvent.
void printStream(QString indentation, QTextStream &str)
Debugging method that supports print method of this class and printStream method of some other class(...
void updateCurveStyles(const CurveStyles &modelCurveStyles)
Update curve styles after settings changed.
QGraphicsView class with event handling added. Typically the events are sent to the active digitizing...
Factory class for generating the points, composed of QGraphicsItem objects, along a GridLine.
void setVisible(bool visible)
Make all grid lines visible or hidden.
void clear()
Deallocate and remove all grid lines.
Determine if inputs that were collected after a Guideline drag should result in a Cmd to move or Cmd ...
CmdAbstract * createAfterDrag(MainWindow &mainWindow, Document &document, double newValue, const DocumentModelGuidelines &modelGuidelinesDocument, const QString &identifier, bool draggedOffscreen)
Create delete or move Cmd.
Calculate offset from edge for new Guidelines.
QPointF top(const QGraphicsView &view, const Transformation &transformation) const
Compute offset from top side and returns point in graph coordinates.
QPointF right(const QGraphicsView &view, const Transformation &transformation) const
Compute offset from right side and returns point in graph coordinates.
QPointF bottom(const QGraphicsView &view, const Transformation &transformation) const
Compute offset from bottom side and returns point in graph coordinates.
QPointF left(const QGraphicsView &view, const Transformation &transformation) const
Compute offset from left side and returns point in graph coordinates.
GuidelineViewState state() const
Current state for serializing.
void handleStateChange(GuidelineViewState state)
Handle user or code generated change in selected guideline view mode.
This class contains all Guideline objects.
void createGuidelineY(const QString &identifier, double y)
Factory method for creating a new GUIDELINE_STATE_DEPLOYED_CONSTANT_Y_ACTIVE.
void createGuidelineR(const QString &identifier, double r)
Factory method for creating a new GUIDELINE_STATE_DEPLOYED_CONSTANT_R_ACTIVE.
void createReplacementGuideline(const QString &identifierReplaced, double newValue, GuidelineState guidelineStateForReplacement)
Factory method for creating a new replacement Guideline, which replaces one handle and one visible Gu...
void setModelGuidelines(CoordsType coordsType, const DocumentModelGuidelines &modelGuidelines)
Load Guidelines from Document.
void clear()
Remove guidelines since the current Document is about to be closed.
void createGuidelineT(const QString &identifier, double t)
Factory method for creating a new GUIDELINE_STATE_DEPLOYED_CONSTANT_T_ACTIVE.
void moveGuidelineYR(const QString &identifier, double valueAfter)
Move an Y/R guideline from one value to another. Closest value wins.
void handleGuidelineMode(bool visible, bool locked)
User toggled guideline mode.
void removeGuideline(const QString &identifier)
Remove an X/T or Y/R guideline.
DocumentModelGuidelines modelGuidelines() const
Return complete set of guidelines information for Document.
void updateWithLatestTransformation()
Update transformation. This is called after a command has been executed.
void moveGuidelineXT(const QString &identifier, double valueAfter)
Move an X/T guideline from one value to another. Closest value wins.
void initialize(GraphicsScene &scene)
Initialize Guideline factory.
void createGuidelineX(const QString &identifier, double x)
Factory method for creating a new GUIDELINE_STATE_DEPLOYED_CONSTANT_X_ACTIVE.
void handleActiveChange(bool active)
DigitizeState change so active status may (or may not) be toggled.
void updateColor()
Force a color update.
Provides list of file extensions for import.
QStringList fileExtensionsWithAsterisks() const
File extensions for use in file dialogs.
Wrapper around OpenJPEG library, in C, for opening jpeg2000 files.
bool load(const QString &filename, QImage &image) const
Load image from jpeg2000 file.
Returns information about files.
bool loadsAsDigFile(const QString &urlString) const
Returns true if specified file name can be loaded as a DIG file.
void startLoadImage(const QUrl &url)
Start the asynchronous loading of an image from the specified url.
static void bindToMainWindow(MainWindow *mainWindow)
Bind to MainWindow so this class can access the command stack.
Persist the directory between successive Import/Open operations, or successive Export/Save operations...
void setDirectoryExportSaveFromSavedPath(const QString &path)
Set the current Export/Save directory at startup to path from previous execution.
void setDirectoryImportOpenFromFilename(const QString &fileName)
Save the current Import/Open directory, after user has accepted the Import/Open dialog.
void setDirectoryExportSaveFromFilename(const QString &fileName)
Save the current Export/Save directory, after user has accepted the Export/Save dialog.
QDir getDirectoryImportOpen() const
Get the current Import/Open directory.
void setDirectoryImportLoadFromSavedPath(const QString &path)
Set the current Import/Open directory at startup to path from previous execution.
QDir getDirectoryExportSave() const
Get the current Export/Save directory.
Model for DlgSettingsMainWindow.
void setSmallDialogs(bool smallDialogs)
Set method for small dialogs flag.
QLocale locale() const
Get method for locale.
void setImageReplaceRenamesDocument(bool imageReplaceRenamesDocument)
Set method for image replace renames document.
bool dragDropExport() const
Get method for drag and drop export.
bool imageReplaceRenamesDocument() const
Get method for image replaces renames document.
ZoomFactorInitial zoomFactorInitial() const
Get method for initial zoom factor.
void setImportCropping(ImportCropping importCropping)
Set method for import cropping.
void setMaximumExportedPointsPerCurve(int maximumExportedPointsPerCurve)
Set method for maximum number of exported points per curve.
ImportCropping importCropping() const
Get method for import cropping.
bool smallDialogs() const
Get method for small dialogs flag.
void setMainTitleBarFormat(MainTitleBarFormat mainTitleBarFormat)
Set method for MainWindow titlebar filename format.
void setDragDropExport(bool dragDropExport)
Set method for drag and drop export.
double highlightOpacity() const
Get method for highlight opacity.
void setZoomControl(ZoomControl zoomControl)
Set method for zoom control.
void setMaximumGridLines(int maximumGridLines)
Set method for maximum number of grid lines.
ZoomControl zoomControl() const
Get method for zoom control.
void setPdfResolution(int resolution)
Set method for resolution of imported PDF files, in dots per inch.
int maximumGridLines() const
Get method for maximum number of grid lines.
void setZoomFactorInitial(ZoomFactorInitial zoomFactorInitial)
Set method for initial zoom factor.
MainTitleBarFormat mainTitleBarFormat() const
Get method for MainWindow titlebar filename format.
void setHighlightOpacity(double highlightOpacity)
Set method for highlight opacity.
int maximumExportedPointsPerCurve() const
Get method for maximum number of exported points per curve.
void setLocale(QLocale::Language language, QLocale::Country country)
Set method for locale given attributes.
int pdfResolution() const
Get method for resolution of imported PDF files, in dots per inch.
void setSignificantDigits(int significantDigits)
Set method for significant digits.
void saveErrorReportFileAndExit(const char *comment, const char *file, int line, const char *context)
Save error report and exit.
void updateSettingsGridRemoval(const DocumentModelGridRemoval &modelGridRemoval)
Update with new grid removal properties.
void showTemporaryMessage(const QString &temporaryMessage)
Show temporary message in status bar.
CmdMediator * cmdMediator()
Accessor for commands to process the Document.
void sendGong()
Send signal to unit test framework indicating all commands have finished executing.
void guidelineRemove(const QString &identifier)
Remove a X/T or Y/R Guideline.
void updateSettingsGridDisplay(const DocumentModelGridDisplay &modelGridDisplay)
Update with new grid display properties.
virtual bool eventFilter(QObject *, QEvent *)
Catch secret keypresses.
void updateSettingsAxesChecker(const DocumentModelAxesChecker &modelAxesChecker)
Update with new axes indicator properties.
virtual void showEvent(QShowEvent *)
Processing performed after gui becomes available.
void updateSettingsDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Update with new curve digitization styles.
bool isGnuplot() const
Get method for gnuplot flag.
void guidelineViewState(GuidelineViewState state) const
Guideline view state in View menu.
void updateSettingsCurveStyles(const CurveStyles &modelCurveStyles)
Update with new curve styles.
bool transformIsDefined() const
Return true if all three axis points have been defined.
MainWindowModel modelMainWindow() const
Get method for main window model.
bool guidelinesAreVisible() const
True/false if guidelines are visible. Selectability is handled elsewhere.
void cmdFileOpen(const QString &fileName)
Open file. This is called from a file script command.
void updateSettingsCurveList(const CurvesGraphs &curvesGraphs)
Update with new curves.
void updateAfterCommand()
See GraphicsScene::updateAfterCommand.
void updateSettingsExportFormat(const DocumentModelExportFormat &modelExport)
Update with new export properties.
void guidelineMoveXT(const QString &identifier, double xTAfter)
Move a X/T Guideline.
void updateSettingsSegments(const DocumentModelSegments &modelSegments)
Update with new segments properties.
BackgroundImage selectOriginal(BackgroundImage backgroundImage)
Make original background visible, for DigitizeStateColorPicker.
void cmdFileExport(const QString &fileName)
Export file. This is called from a file script command.
void updateViewsOfSettings(const QString &activeCurve)
Update curve-specific view of settings. Private version gets active curve name from DigitizeStateCont...
void updateSettingsMainWindow(const MainWindowModel &modelMainWindow)
Update with new main window properties.
void cmdFileClose()
Close file. This is called from a file script command.
void updateDigitizeStateIfSoftwareTriggered(DigitizeState digitizeState)
After software-triggered state transition, this method manually triggers the action as if user had cl...
bool modeMap() const
True if document scale is set using a scale bar, otherwise using axis points.
void guidelineAddYR(const QString &identifier, double yR)
Add a Y/R Guideline.
void signalDropRegression(QString)
Send drag and drop regression test url.
void updateSettingsGeneral(const DocumentModelGeneral &modelGeneral)
Update with new general properties.
void signalZoom(int)
Send zoom selection, picked from menu or keystroke, to StatusBar.
void guidelineMoveYR(const QString &identifier, double yRAfter)
Move a Y/R Guideline.
void updateSettingsPointMatch(const DocumentModelPointMatch &modelPointMatch)
Update with new point match properties.
MainWindow(const QString &errorReportFile, const QString &fileCmdScriptFile, bool isDropRegression, bool isRegressionTest, bool isGnuplot, bool isReset, bool isExportOnly, bool isExtractImageOnly, const QString &extractImageOnlyExtension, const QStringList &loadStartupFiles, const QStringList &commandLineWithoutLoadStartupFiles, QWidget *parent=nullptr)
Single constructor.
void cmdFileImport(const QString &fileName)
Import file. This is called from a file script command.
void updateGraphicsLinesToMatchGraphicsPoints()
Update the graphics lines so they follow the graphics points, after a drag, addition,...
void handleGuidelinesActiveChange(bool active)
Handle Guidelines active status toggle.
void signalGong()
Send wakeup signal to unit test framework when all other commands have finished executing.
QImage imageFiltered() const
Background image that has been filtered for the current curve. This asserts if a curve-specific image...
QString selectedGraphCurve() const
Curve name that is currently selected in m_cmbCurve.
GraphicsScene & scene()
Scene container for the QImage and QGraphicsItems.
void updateAfterMouseRelease()
Call MainWindow::updateControls (which is private) after the very specific case - a mouse press/relea...
void resizeEvent(QResizeEvent *event)
Intercept resize event so graphics scene can be appropriately resized when in Fill mode.
void guidelineAddXT(const QString &identifier, double xT)
Add a X/T Guideline.
Transformation transformation() const
Return read-only copy of transformation.
void updateSettingsColorFilter(const DocumentModelColorFilter &modelColorFilter)
Update with new color filter properties.
void updateCoordSystem(CoordSystemIndex coordSystemIndex)
Select a different CoordSystem.
void updateSettingsCoords(const DocumentModelCoords &modelCoords)
Update with new coordinate properties.
GraphicsView & view()
View for the QImage and QGraphicsItems, without const.
Import of point data from clipboard.
void retrievePoints(const Transformation &transformation, QList< QPoint > &points, QList< double > &ordinals) const
Retrieve points from clipboard.
Wrapper around the QImage class for read and importing non-PDF files.
NonPdfReturn load(const QString &fileName, QImage &image, ImportCropping importCropping, bool isErrorReportRegressionTest) const
Try to load the specified file. Success is indicated in the function return value.
Wrapper around the Poppler library.
PdfReturn load(const QString &fileName, QImage &image, int resolution, ImportCropping importCropping, bool isErrorReportRegressionTest) const
Try to load the specified file. Success is indicated in the function return value.
Details for a specific Point.
static void setIdentifierIndex(unsigned int identifierIndex)
Reset the current index while performing a Redo.
Given a set of point identifiers, if a map is in effect (with its two axis endpoints) then both axis ...
QStringList unite(CmdMediator *cmdMediator, const QStringList &pointIdentifiersIn) const
Add.
void wakeUp()
Enable all widgets in the status bar. This is called just after a Document becomes active.
void setStatusBarMode(StatusBarMode statusBarMode)
Set the status bar visibility mode.
StatusBarMode statusBarMode() const
Current mode for status bar visibility. This is tracked locally so this class knows when to hide/show...
void showTemporaryMessage(const QString &message)
Show temporary message in status bar. After a short interval the message will disappear.
void setCoordinates(const QString &coordsScreen, const QString &coordsGraph, const QString &resolutionGraph)
Populate the coordinates fields. Unavailable values are empty. Html-encoding to highlight with colors...
void triggerStateTransition(bool isGnuplot, TransformationState transformationState, CmdMediator &cmdMediator, const Transformation &transformation, const QString &selectedGraphCurve)
Trigger a state transition to be performed immediately.
void resetOnLoad()
Reset, when loading a document after the first, to same state that first document was at when loaded.
void updateAxesChecker(CmdMediator &cmdMediator, const Transformation &transformation)
Apply the new DocumentModelAxesChecker.
void unsetPointStyle()
Apply no PointStyle.
void setPointStyle(const PointStyle &pointStyle)
Apply the PointStyle of the currently selected curve.
void setEnabled(bool enabled)
Show the style with semi-transparency or full-transparency to indicate if associated Curve is active ...
void unsetColorFilterSettings()
Apply no color filter.
void setColorFilterSettings(const ColorFilterSettings &colorFilterSettings, const QPixmap &pixmap)
Apply the color filter of the currently selected curve. The pixmap is included so the background colo...
void setEnabled(bool enabled)
Show the style with semi-transparency or full-transparency to indicate if associated Curve is active ...
void getTableStatus(bool &tableIsActive, bool &tableIsCopyable) const
Give table status so MainWindow can determine if table can be copied.
Perform calculations to determine the next zoom setting given the current zoom setting,...
double mapToFactor(ZoomFactor zoomFactor) const
Return the floating precision zoom factor given the enum value.
ZoomFactor zoomOut(ZoomFactor currentZoomFactor, double m11, double m22, bool actionZoomFillIsChecked) const
Zoom out.
ZoomFactor zoomIn(ZoomFactor currentZoomFactor, double m11, double m22, bool actionZoomFillIsChecked) const
Zoom in.
Priority::Value getPriority() const
Returns unused priority.
#define LOG4CPP_INFO_S(logger)
#define LOG4CPP_DEBUG_S(logger)
#define LOG4CPP_ERROR_S(logger)