57#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
61#ifdef ENGAUGE_JPEG2000
80#include <QApplication>
85#include <QDesktopServices>
87#include <QDomDocument>
90#include <QImageReader>
92#include <QKeySequence>
96#include <QPrintDialog>
101#include <QSignalMapper>
102#include <QTextStream>
103#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
108#include <QToolButton>
110#include <QVBoxLayout>
112#include <QXmlStreamReader>
113#include <QXmlStreamWriter>
127static const char *ENGAUGE_FILENAME_DESCRIPTION =
"Engauge Document";
145 m_originalFileWasImported (
false),
146 m_isDocumentExported (
false),
154 m_digitizeStateContext (
nullptr),
155 m_transformationStateContext (
nullptr),
156 m_backgroundStateContext (
nullptr),
158 m_isGnuplot (isGnuplot),
161 m_timerRegressionErrorReport(
nullptr),
164 m_timerRegressionFileCmdScript(
nullptr),
171 <<
" curDir=" << QDir::currentPath().toLatin1().data();
173#if defined(OSX_DEBUG) || defined(OSX_RELEASE)
174 qApp->setApplicationName (
"Engauge Digitizer");
175 qApp->setOrganizationDomain (
"Mark Mitchell");
180 m_startupDirectory = QDir::currentPath();
198 QDir::setCurrent (m_startupDirectory);
201 m_regressionFile = exportRegressionFilenameFromInputFilename (
loadStartupFiles.first ());
202 slotLoadStartupFiles ();
207 m_regressionFile = exportRegressionFilenameFromInputFilename (
loadStartupFiles.first ());
208 slotLoadStartupFiles ();
209 handlerFileExtractImage ();
213 if (m_isErrorReportRegressionTest) {
218 startRegressionTestFileCmdScript();
233#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
236 delete m_tutorialDlg;
237 delete m_cmdMediator;
238 delete m_cmdStackShadow;
239 delete m_digitizeStateContext;
240 delete m_transformationStateContext;
241 delete m_backgroundStateContext;
242 delete m_dlgSettingsAxesChecker;
243 delete m_dlgSettingsColorFilter;
244 delete m_dlgSettingsCoords;
245 delete m_dlgSettingsCurveList;
246 delete m_dlgSettingsCurveProperties;
247 delete m_dlgSettingsDigitizeCurve;
248 delete m_dlgSettingsExportFormat;
249 delete m_dlgSettingsGeneral;
250 delete m_dlgSettingsGridDisplay;
251 delete m_dlgSettingsGridRemoval;
252 delete m_dlgSettingsMainWindow;
253 delete m_dlgSettingsPointMatch;
254 delete m_dlgSettingsSegments;
255 delete m_fileCmdScript;
256 m_gridLines.
clear ();
259void MainWindow::addDockWindow (QDockWidget *
dockWidget,
270 Qt::NoDockWidgetArea).toInt());
272 if (
area == Qt::NoDockWidgetArea) {
289void MainWindow::applyZoomFactorAfterLoad()
294 if (m_zoomMapFromInitial.contains (zoomFactorInitial)) {
295 zoomFactor = m_zoomMapFromInitial [zoomFactorInitial];
337 m_regressionFile = exportRegressionFilenameFromInputFilename (
fileName);
346 m_regressionFile = exportRegressionFilenameFromInputFilename (
fileName);
353 return m_cmdMediator;
356ZoomFactor MainWindow::currentZoomFactor ()
const
373 if (
event->type () == QEvent::KeyPress) {
393#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
394void MainWindow::exportAllCoordinateSystemsAfterRegressionTests()
396 LOG4CPP_INFO_S ((*
mainCat)) <<
"MainWindow::exportAllCoordinateSystemsAfterRegressionTests curDir=" << QDir::currentPath().toLatin1().data();
404 .arg (m_regressionFile)
430 befores <<
".dig" <<
".gif" <<
".html" <<
".htm" <<
".jp2" <<
".jpg" <<
".pbm"
431 <<
".pdf" <<
".pgm" <<
".png" <<
".ppm" <<
".xbm" <<
".xpm" <<
".xml";
435 QStringList::iterator
itr;
449 <<
" curDir=" << QDir::currentPath().toLatin1().data()
450 <<
" fileName=" <<
fileName.toLatin1().data();
453 if (
file.open(QIODevice::WriteOnly)) {
466 m_isDocumentExported =
true;
468 updateChecklistGuide ();
474 <<
" file=" <<
fileName.toLatin1().data()
475 <<
" curDir=" << QDir::currentPath().toLatin1().data();
476 QMessageBox::critical (
nullptr,
478 tr (
"Unable to export to file") +
" " +
fileName);
485 <<
" curDir=" << QDir::currentPath().toLatin1().data()
486 <<
" fileName=" <<
fileName.toLatin1().data();
489 if (
file.open(QIODevice::WriteOnly)) {
495 if (m_isErrorReportRegressionTest) {
497 .arg (exportRegressionFilenameFromInputFilename (m_regressionFile));
508 <<
" file=" <<
fileName.toLatin1().data()
509 <<
" curDir=" << QDir::currentPath().toLatin1().data();
510 QMessageBox::critical (
nullptr,
512 tr (
"Unable to extract image to file") +
" " +
fileName);
520 <<
" fileName=" <<
fileName.toLatin1 ().data ()
521 <<
" curDir=" << QDir::currentPath().toLatin1().data()
528 m_originalFileWasImported =
true;
543#ifdef ENGAUGE_JPEG2000
557 m_isErrorReportRegressionTest);
574 m_isErrorReportRegressionTest);
587 .arg (
tr (
"Cannot read file"))
589 .arg (
tr (
"from directory"))
590 .arg (QDir::currentPath());
597 msg += QObject::tr (
"The file appears to have characters from multiple language "
598 "alphabets, which does not work in the Windows command line");
601 QMessageBox::warning (
this,
619 ! m_actionViewCoordSystem->isChecked ()) {
622 m_actionViewCoordSystem->trigger ();
645void MainWindow::fileImportWithPrompts (ImportType
importType)
653 if (
importType != IMPORT_TYPE_IMAGE_REPLACE) {
669 str <<
";; All Files (*.*)";
687QString MainWindow::fileNameForExportOnly ()
const
692 if (m_isErrorReportRegressionTest) {
696 .arg (exportRegressionFilenameFromInputFilename (m_regressionFile));
711QString MainWindow::fileNameForExtractImageOnly ()
const
718 .arg (m_extractImageOnlyExtension);
723void MainWindow::filePaste (ImportType
importType)
733 m_originalFileWasImported =
true;
746 QImage image = QApplication::clipboard()->image();
754 QMessageBox::warning (
this,
757 .
arg (
tr (
"Cannot read file"))
759 .
arg (
tr (
"from directory"))
760 .
arg (QDir::currentPath ()));
792void MainWindow::ghostsCreate ()
799 for (
unsigned int index = 0; index < m_cmdMediator->
document().coordSystemCount(); index++) {
818void MainWindow::ghostsDestroy ()
830void MainWindow::handlerFileExtractImage ()
834 if (m_isExtractImageOnly) {
854void MainWindow::loadCoordSystemListFromCmdMediator ()
858 m_cmbCoordSystem->clear();
862 for (
unsigned int i = 0;
i < numberCoordSystem;
i++) {
864 m_cmbCoordSystem->addItem (QString::number (
index1Based),
869 m_cmbCoordSystem->setCurrentIndex (0);
872 bool enable = (m_cmbCoordSystem->count() > 1);
873 m_cmbCoordSystem->setEnabled (
enable);
874 m_btnShowAll->setEnabled (
enable);
875 m_btnPrintAll->setEnabled (
enable);
878void MainWindow::loadCurveListFromCmdMediator ()
882 m_cmbCurve->clear ();
884 QStringList::iterator
itr;
885 for (
itr = curvesGraphsNames.begin ();
itr != curvesGraphsNames.end ();
itr++) {
899 QApplication::setOverrideCursor(Qt::WaitCursor);
906 rebuildRecentFileListForCurrentFile(
fileName);
909 delete m_cmdMediator;
912 setupAfterLoadNewDocument (
fileName,
917 m_actionDigitizeSelect->setChecked (
true);
918 slotDigitizeSelect();
922 m_originalFileWasImported =
false;
927 QApplication::restoreOverrideCursor();
931 QApplication::restoreOverrideCursor();
933 QMessageBox::warning (
this,
936 .
arg (
tr (
"Cannot read file"))
938 .
arg (
tr (
"from directory"))
939 .
arg (QDir::currentPath ())
952 if (!
file.exists()) {
956 QMessageBox::critical (
this,
958 tr (
"File not found") +
": " +
fileInfo.absoluteFilePath());
964 file.open(QIODevice::ReadOnly | QIODevice::Text);
975 tr (
"Error report opened"),
979 m_actionDigitizeSelect->setChecked (
true);
980 slotDigitizeSelect();
990 <<
" fileName=" <<
fileName.toLatin1 ().data ()
994 if (
importType == IMPORT_TYPE_IMAGE_REPLACE) {
995 success = loadImageReplacingImage (
fileName,
999 success = loadImageNewDocument (
fileName,
1012 <<
" fileName=" <<
fileName.toLatin1 ().data ()
1017 QApplication::setOverrideCursor(Qt::WaitCursor);
1020 QApplication::restoreOverrideCursor();
1026 delete m_cmdMediator;
1030 tr (
"File imported"),
1036 if (m_actionHelpChecklistGuideWizard->isChecked () &&
1037 (m_fileCmdScript ==
nullptr)) {
1042 if (
wizard->exec() == QDialog::Accepted) {
1044 for (
CoordSystemIndex coordSystemIndex = 0; coordSystemIndex < m_cmdMediator->
document().coordSystemCount(); coordSystemIndex++) {
1048 wizard->curveNames(coordSystemIndex));
1052 wizard->populateCurvesGraphs (coordSystemIndex,
1058 m_actionViewChecklistGuide->setChecked (
true);
1061 loadCurveListFromCmdMediator();
1064 loadCoordSystemListFromCmdMediator();
1070 m_actionDigitizeAxis->setChecked (
true);
1074 slotDigitizeScale ();
1075 }
else if (modeGraph ()) {
1076 slotDigitizeAxis ();
1090 <<
" fileName=" <<
fileName.toLatin1 ().data ()
1104 tr (
"File imported"),
1118 if (!
file.open (QIODevice::ReadOnly)) {
1126void MainWindow::loadToolTips()
1128 if (m_actionViewToolTips->isChecked ()) {
1131 m_actionDigitizeSelect->setToolTip (m_actionDigitizeSelect->text());
1132 m_actionDigitizeAxis->setToolTip (m_actionDigitizeAxis->text());
1133 m_actionDigitizeScale->setToolTip (m_actionDigitizeScale->text());
1134 m_actionDigitizeCurve->setToolTip (m_actionDigitizeCurve->text());
1135 m_actionDigitizePointMatch->setToolTip (m_actionDigitizePointMatch->text());
1136 m_actionDigitizeColorPicker->setToolTip (m_actionDigitizeColorPicker->text());
1137 m_actionDigitizeSegment->setToolTip (m_actionDigitizeSegment->text());
1138 m_cmbBackground->setToolTip (
tr (
"Background image."));
1139 m_cmbCurve->setToolTip (
tr (
"Currently selected curve."));
1140 m_viewPointStyle->setToolTip (
tr (
"Point style for currently selected curve."));
1141 m_viewSegmentFilter->setToolTip (
tr (
"Segment Fill filter for currently selected curve."));
1146 m_actionDigitizeSelect->setToolTip (
"");
1147 m_actionDigitizeAxis->setToolTip (
"");
1148 m_actionDigitizeScale->setToolTip (
"");
1149 m_actionDigitizeCurve->setToolTip (
"");
1150 m_actionDigitizePointMatch->setToolTip (
"");
1151 m_actionDigitizeColorPicker->setToolTip (
"");
1152 m_actionDigitizeSegment->setToolTip (
"");
1153 m_cmbBackground->setToolTip (
"");
1154 m_cmbCurve->setToolTip (
"");
1155 m_viewPointStyle->setToolTip (
"");
1156 m_viewSegmentFilter->setToolTip (
"");
1161bool MainWindow::modeGraph ()
const
1163 bool success =
false;
1165 if (m_cmdMediator !=
nullptr) {
1174 bool success =
false;
1176 if (m_cmdMediator !=
nullptr) {
1183bool MainWindow::maybeSave()
1185 if (m_cmdMediator !=
nullptr) {
1187 QMessageBox::StandardButton
ret = QMessageBox::warning (
this,
1189 tr(
"The document has been modified.\n"
1190 "Do you want to save your changes?"),
1191 QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
1192 if (
ret == QMessageBox::Save) {
1193 return slotFileSave();
1194 }
else if (
ret == QMessageBox::Cancel) {
1234 return m_modelMainWindow;
1237void MainWindow::rebuildRecentFileListForCurrentFile(
const QString &
filePath)
1252 updateRecentFileList();
1259 if (m_actionZoomFill->isChecked ()) {
1263 QMainWindow::resizeEvent(
event);
1271 if (!
file.open(QFile::WriteOnly)) {
1272 QMessageBox::warning (
this,
1275 .
arg(
tr (
"Cannot write file"))
1281 rebuildRecentFileListForCurrentFile (
fileName);
1283 QApplication::setOverrideCursor (Qt::WaitCursor);
1285 writer.setAutoFormatting(
true);
1286 writer.writeStartDocument();
1287 writer.writeDTD(
"<!DOCTYPE engauge>");
1289 writer.writeEndDocument();
1290 QApplication::restoreOverrideCursor ();
1294 m_cmdMediator->setClean ();
1311 if ((m_cmdMediator !=
nullptr) && !m_isErrorReportRegressionTest) {
1319 if (
dlg.exec() == QDialog::Accepted) {
1324 "error_report.xml");
1329 fileError.open (QIODevice::WriteOnly | QIODevice::Text);
1339QString MainWindow::saveErrorReportFileAndExitXml (
const char *context,
1348 writer.setAutoFormatting(
true);
1356 writer.writeEndElement();
1361 while (!
reader.atEnd ()) {
1363 if (
reader.tokenType() != QXmlStreamReader::StartDocument &&
1364 reader.tokenType() != QXmlStreamReader::EndDocument &&
1365 reader.tokenType() != QXmlStreamReader::Invalid) {
1374 writer.writeEndElement();
1380 writer.writeEndElement();
1391 writer.writeEndElement();
1393 writer.writeEndElement();
1400 if (!m_originalFileWasImported) {
1450void MainWindow::saveStartingDocumentSnapshot()
1455 writer.setAutoFormatting (
true);
1474 m_cmbBackground->setCurrentIndex(index);
1481 return m_cmbCurve->currentText ();
1498 m_currentFileWithPathAndFileExtension =
fileName;
1500 updateWindowTitle ();
1507 if (
dir.exists ()) {
1509 bool success = QDir::setCurrent (
dir.absolutePath ());
1537 m_backgroundStateContext->
setPixmap (m_isGnuplot,
1545void MainWindow::settingsRead (
bool isReset)
1554 settingsReadEnvironment (
settings);
1562 QDir::currentPath ()).toString ());
1577#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
1579 QSize (900, 600)).toSize();
1633 addDockWindow (m_dockChecklistGuide,
1637 Qt::RightDockWidgetArea);
1638 addDockWindow (m_dockFittingWindow,
1642 Qt::RightDockWidgetArea);
1643 addDockWindow (m_dockGeometryWindow,
1647 Qt::RightDockWidgetArea);
1688 QVariant (QDir::currentPath())).toString ());
1690 QVariant (QDir::currentPath())).toString ());
1693 updateSmallDialogs();
1698void MainWindow::settingsWrite ()
1711#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
1715 if (m_dockChecklistGuide->isFloating()) {
1725 if (m_dockFittingWindow->isFloating()) {
1733 if (m_dockGeometryWindow->isFloating()) {
1776 <<
" file=" <<
fileName.toLatin1().data()
1787 m_digitizeStateContext->
resetOnLoad (m_cmdMediator);
1794 m_cmdMediator->
pixmap ());
1800 applyZoomFactorAfterLoad();
1826 loadCurveListFromCmdMediator ();
1827 loadCoordSystemListFromCmdMediator ();
1830 m_isDocumentExported =
false;
1840 m_cmbCurve->currentText ());
1843 applyZoomFactorAfterLoad();
1849 saveStartingDocumentSnapshot();
1856bool MainWindow::setupAfterLoadReplacingImage (
const QString &
fileName,
1861 <<
" file=" <<
fileName.toLatin1().data()
1868 m_cmdMediator->clear();
1871 m_cmdMediator->
pixmap ());
1873 m_isDocumentExported =
false;
1877 applyZoomFactorAfterLoad();
1887 saveStartingDocumentSnapshot();
1897 <<
" files=" << m_loadStartupFiles.join (
",").toLatin1().data();
1899 QMainWindow::showEvent (
event);
1901 if (m_loadStartupFiles.count() > 0) {
1903 m_timerLoadStartupFiles =
new QTimer;
1904 m_timerLoadStartupFiles->setSingleShot (
true);
1906 m_timerLoadStartupFiles->start (0);
1916void MainWindow::slotBtnPrintAll ()
1924 if (
dlg.exec() == QDialog::Accepted) {
1933void MainWindow::slotBtnShowAllPressed ()
1941void MainWindow::slotBtnShowAllReleased ()
1949void MainWindow::slotCanRedoChanged (
bool canRedo)
1953 m_actionEditRedo->setEnabled (canRedo || m_cmdStackShadow->
canRedo());
1956void MainWindow::slotCanUndoChanged (
bool canUndo)
1960 m_actionEditUndo->setEnabled (
canUndo);
1963void MainWindow::slotChecklistClosed()
1967 m_actionViewChecklistGuide->setChecked (
false);
1970void MainWindow::slotCleanChanged(
bool clean)
1983 if (!m_actionViewBackgroundNone->isChecked()) {
1984 m_actionViewBackgroundNone->toggle();
1989 if (!m_actionViewBackgroundOriginal->isChecked ()) {
1990 m_actionViewBackgroundOriginal->toggle();
1995 if (!m_actionViewBackgroundFiltered->isChecked ()) {
1996 m_actionViewBackgroundFiltered->toggle();
2004void MainWindow::slotCmbCoordSystem(
int index)
2012 m_cmdMediator->push (
cmd);
2015void MainWindow::slotCmbCurve(
int )
2023 m_cmbCurve->currentText ());
2027 updateViewedCurves();
2029 updateFittingWindow();
2030 updateGeometryWindow();
2049void MainWindow::slotDigitizeAxis ()
2055 m_cmbCurve->setEnabled (
false);
2061void MainWindow::slotDigitizeColorPicker ()
2067 m_cmbCurve->setEnabled (
true);
2073void MainWindow::slotDigitizeCurve ()
2079 m_cmbCurve->setEnabled (
true);
2085void MainWindow::slotDigitizePointMatch ()
2091 m_cmbCurve->setEnabled (
true);
2097void MainWindow::slotDigitizeScale ()
2103 m_cmbCurve->setEnabled (
false);
2109void MainWindow::slotDigitizeSegment ()
2115 m_cmbCurve->setEnabled (
true);
2121void MainWindow::slotDigitizeSelect ()
2127 m_cmbCurve->setEnabled (
false);
2133void MainWindow::slotEditCopy ()
2146 m_dockFittingWindow->
doCopy ();
2151 m_dockGeometryWindow->
doCopy ();
2168void MainWindow::slotEditCut ()
2197void MainWindow::slotEditDelete ()
2232void MainWindow::slotEditMenu ()
2236 m_actionEditPasteAsNew->setEnabled (!QApplication::clipboard()->image().
isNull());
2237 m_actionEditPasteAsNewAdvanced->setEnabled (!QApplication::clipboard()->image().
isNull());
2240void MainWindow::slotEditPaste ()
2254 m_cmbCurve->currentText (),
2261void MainWindow::slotEditPasteAsNew ()
2265 filePaste (IMPORT_TYPE_SIMPLE);
2268void MainWindow::slotEditPasteAsNewAdvanced ()
2272 filePaste (IMPORT_TYPE_ADVANCED);
2275void MainWindow::slotFileClose()
2295 if (m_fittingCurve !=
nullptr) {
2296 m_scene->removeItem (m_fittingCurve);
2297 m_fittingCurve =
nullptr;
2304 m_backgroundStateContext->
close ();
2307 m_scene->setSceneRect (
QRectF (0, 0, 1, 1));
2310 m_dockFittingWindow->
clear ();
2313 m_dockGeometryWindow->
clear ();
2316 delete m_cmdMediator;
2319 m_cmdMediator =
nullptr;
2324 m_gridLines.
clear();
2329void MainWindow::slotFileExport ()
2339 if (m_isExportOnly) {
2340 fileName = fileNameForExportOnly ();
2350 .arg (m_currentFile)
2374void MainWindow::slotFileImport ()
2378 fileImportWithPrompts (IMPORT_TYPE_SIMPLE);
2381void MainWindow::slotFileImportAdvanced ()
2385 fileImportWithPrompts (IMPORT_TYPE_ADVANCED);
2388void MainWindow::slotFileImportDraggedImage(
QImage image)
2395 IMPORT_TYPE_SIMPLE);
2398void MainWindow::slotFileImportDraggedImageUrl(
QUrl url)
2400 LOG4CPP_INFO_S ((*
mainCat)) <<
"MainWindow::slotFileImportDraggedImageUrl url=" <<
url.toString ().toLatin1 ().data ();
2414 IMPORT_TYPE_SIMPLE);
2417void MainWindow::slotFileImportImageReplace ()
2421 fileImportWithPrompts (IMPORT_TYPE_IMAGE_REPLACE);
2424void MainWindow::slotFileOpen()
2433 .arg (ENGAUGE_FILENAME_DESCRIPTION)
2438 tr(
"Open Document"),
2457void MainWindow::slotFilePrint()
2463 if (
dlg.exec() == QDialog::Accepted) {
2470bool MainWindow::slotFileSave()
2474 if (m_engaugeFile.isEmpty()) {
2475 return slotFileSaveAs();
2477 return saveDocumentFile (m_engaugeFile);
2481bool MainWindow::slotFileSaveAs()
2489 .arg (m_currentFile)
2493 if (!m_engaugeFile.isEmpty()) {
2498 .arg (ENGAUGE_FILENAME_DESCRIPTION)
2509 dlg.setFileMode (QFileDialog::AnyFile);
2512#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
2514 dlg.setWindowModality(Qt::WindowModal);
2516 dlg.setAcceptMode(QFileDialog::AcceptSave);
2523 return saveDocumentFile(
files.at(0));
2529void MainWindow::slotFittingWindowClosed()
2533 m_actionViewFittingWindow->setChecked (
false);
2546 if (m_fittingCurve !=
nullptr) {
2547 m_scene->removeItem (m_fittingCurve);
2548 delete m_fittingCurve;
2557 m_fittingCurve->setVisible (m_actionViewFittingWindow->isChecked ());
2558 m_scene->addItem (m_fittingCurve);
2561void MainWindow::slotGeometryWindowClosed()
2565 m_actionViewGeometryWindow->setChecked (
false);
2568void MainWindow::slotHelpAbout()
2576void MainWindow::slotHelpTutorial()
2580 m_tutorialDlg->show ();
2581 m_tutorialDlg->exec ();
2584void MainWindow::slotKeyPress (Qt::Key
key,
2596void MainWindow::slotLoadStartupFiles ()
2603 m_loadStartupFiles.pop_front();
2614 IMPORT_TYPE_SIMPLE);
2618 if (m_loadStartupFiles.count() > 0) {
2622 QProcess::startDetached (QCoreApplication::applicationFilePath(),
2623 m_commandLineWithoutLoadStartupFiles + m_loadStartupFiles);
2627void MainWindow::slotMouseMove (
QPointF pos)
2632 if (m_cmdMediator !=
nullptr) {
2655void MainWindow::slotMousePress (
QPointF pos)
2665void MainWindow::slotMouseRelease (
QPointF pos)
2669 if (pos.x() < 0 || pos.y() < 0) {
2683void MainWindow::slotRecentFileAction ()
2695void MainWindow::slotRecentFileClear ()
2705 updateRecentFileList();
2708void MainWindow::slotRedoTextChanged (
const QString &
text)
2713 if (!
text.isEmpty ()) {
2719void MainWindow::slotSettingsAxesChecker ()
2723 m_dlgSettingsAxesChecker->
load (*m_cmdMediator);
2724 m_dlgSettingsAxesChecker->show ();
2727void MainWindow::slotSettingsColorFilter ()
2731 m_dlgSettingsColorFilter->
load (*m_cmdMediator);
2732 m_dlgSettingsColorFilter->show ();
2735void MainWindow::slotSettingsCoords ()
2739 m_dlgSettingsCoords->
load (*m_cmdMediator);
2740 m_dlgSettingsCoords->show ();
2743void MainWindow::slotSettingsCurveList ()
2747 m_dlgSettingsCurveList->
load (*m_cmdMediator);
2748 m_dlgSettingsCurveList->show ();
2751void MainWindow::slotSettingsCurveProperties ()
2755 m_dlgSettingsCurveProperties->
load (*m_cmdMediator);
2757 m_dlgSettingsCurveProperties->show ();
2760void MainWindow::slotSettingsDigitizeCurve ()
2764 m_dlgSettingsDigitizeCurve->
load (*m_cmdMediator);
2765 m_dlgSettingsDigitizeCurve->show ();
2768void MainWindow::slotSettingsExportFormat ()
2773 m_dlgSettingsExportFormat->
load (*m_cmdMediator);
2774 m_dlgSettingsExportFormat->show ();
2781void MainWindow::slotSettingsGeneral ()
2785 m_dlgSettingsGeneral->
load (*m_cmdMediator);
2786 m_dlgSettingsGeneral->show ();
2789void MainWindow::slotSettingsGridDisplay()
2793 m_dlgSettingsGridDisplay->
load (*m_cmdMediator);
2794 m_dlgSettingsGridDisplay->show ();
2797void MainWindow::slotSettingsGridRemoval ()
2801 m_dlgSettingsGridRemoval->
load (*m_cmdMediator);
2802 m_dlgSettingsGridRemoval->show ();
2805void MainWindow::slotSettingsPointMatch ()
2809 m_dlgSettingsPointMatch->
load (*m_cmdMediator);
2810 m_dlgSettingsPointMatch->show ();
2813void MainWindow::slotSettingsSegments ()
2817 m_dlgSettingsSegments->
load (*m_cmdMediator);
2818 m_dlgSettingsSegments->show ();
2821void MainWindow::slotTableStatusChange ()
2830void MainWindow::slotSettingsMainWindow ()
2836 m_dlgSettingsMainWindow->show ();
2839void MainWindow::slotTimeoutRegressionErrorReport ()
2842 <<
" cmdStackIndex=" << m_cmdMediator->index()
2843 <<
" cmdStackCount=" << m_cmdMediator->count();
2845 if (m_cmdStackShadow->
canRedo()) {
2848 QDir::setCurrent (m_startupDirectory);
2853 QDir::setCurrent (m_startupDirectory);
2857#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
2858 exportAllCoordinateSystemsAfterRegressionTests ();
2862 m_cmdMediator->setClean();
2868void MainWindow::slotTimeoutRegressionFileCmdScript ()
2872 if (m_fileCmdScript->
canRedo()) {
2875 QDir::setCurrent (m_startupDirectory);
2877 m_fileCmdScript->
redo(*
this);
2880 QDir::setCurrent (m_startupDirectory);
2885 if (m_cmdMediator !=
nullptr) {
2887#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
2888 exportAllCoordinateSystemsAfterRegressionTests ();
2892 m_cmdMediator->setClean();
2902void MainWindow::slotUndoTextChanged (
const QString &
text)
2907 if (!
text.isEmpty ()) {
2913void MainWindow::slotViewGridLines ()
2927 if (
action == m_actionViewBackgroundNone) {
2930 }
else if (
action == m_actionViewBackgroundOriginal) {
2933 }
else if (
action == m_actionViewBackgroundFiltered) {
2948void MainWindow::slotViewGroupCurves(
QAction * )
2952 updateViewedCurves ();
2961 if (
action == m_actionStatusNever) {
2963 }
else if (
action == m_actionStatusTemporary) {
2970void MainWindow::slotViewToolBarBackground ()
2974 if (m_actionViewBackground->isChecked ()) {
2975 m_toolBackground->show();
2977 m_toolBackground->hide();
2981void MainWindow::slotViewToolBarChecklistGuide ()
2985 if (m_actionViewChecklistGuide->isChecked ()) {
2986 m_dockChecklistGuide->show();
2988 m_dockChecklistGuide->hide();
2992void MainWindow::slotViewToolBarCoordSystem ()
2996 if (m_actionViewCoordSystem->isChecked ()) {
2997 m_toolCoordSystem->show();
2999 m_toolCoordSystem->hide();
3003void MainWindow::slotViewToolBarDigitize ()
3007 if (m_actionViewDigitize->isChecked ()) {
3008 m_toolDigitize->show();
3010 m_toolDigitize->hide();
3014void MainWindow::slotViewToolBarFittingWindow()
3018 if (m_actionViewFittingWindow->isChecked()) {
3019 m_dockFittingWindow->show ();
3020 if (m_fittingCurve !=
nullptr) {
3021 m_fittingCurve->setVisible (
true);
3024 m_dockFittingWindow->hide ();
3025 if (m_fittingCurve !=
nullptr) {
3026 m_fittingCurve->setVisible (
false);
3031void MainWindow::slotViewToolBarGeometryWindow ()
3035 if (m_actionViewGeometryWindow->isChecked ()) {
3036 m_dockGeometryWindow->show();
3038 m_dockGeometryWindow->hide();
3042void MainWindow::slotViewToolBarSettingsViews ()
3046 if (m_actionViewSettingsViews->isChecked ()) {
3047 m_toolSettingsViews->show();
3049 m_toolSettingsViews->hide();
3053void MainWindow::slotViewToolTips ()
3060void MainWindow::slotViewZoom (
int zoom)
3066 m_zoomMapToAction [
zoomFactor]->setChecked (
true);
3075 m_backgroundStateContext->
fitInView (*m_view);
3089void MainWindow::slotViewZoomFactorInt (
int zoom)
3096void MainWindow::slotViewZoomIn ()
3102 m_view->transform ().m11 (),
3103 m_view->transform ().m22 (),
3104 m_actionZoomFill->isChecked ());
3109void MainWindow::slotViewZoomInFromWheelEvent ()
3117 m_view->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
3122 m_view->setTransformationAnchor(QGraphicsView::NoAnchor);
3126void MainWindow::slotViewZoomOut ()
3133 m_view->transform ().m11 (),
3134 m_view->transform ().m22 (),
3135 m_actionZoomFill->isChecked ());
3139void MainWindow::slotViewZoomOutFromWheelEvent ()
3147 m_view->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
3152 m_view->setTransformationAnchor(QGraphicsView::NoAnchor);
3180 filenameCsv =
"../test/drag_and_drop_http.csv_actual_1";
3186 .arg (exportRegressionFilenameFromInputFilename (
filenameDrop))
3191 file.open (QIODevice::WriteOnly);
3193 str <<
siz.width() <<
"x" <<
siz.height() <<
"\n";
3213 m_timerRegressionErrorReport =
new QTimer();
3214 m_timerRegressionErrorReport->setSingleShot(
false);
3220void MainWindow::startRegressionTestFileCmdScript()
3224 m_timerRegressionFileCmdScript =
new QTimer();
3225 m_timerRegressionFileCmdScript->setSingleShot(
false);
3233 return m_transformation;
3249 updateAfterCommandStatusBarCoords ();
3251 updateHighlightOpacity ();
3257 updateChecklistGuide ();
3258 updateFittingWindow ();
3259 updateGeometryWindow();
3264 writeCheckpointToLogFile ();
3271 m_view->setFocus ();
3274void MainWindow::updateAfterCommandStatusBarCoords ()
3285 updateTransformationAndItsDependencies();
3318 slotMouseMove (posScreen);
3328void MainWindow::updateChecklistGuide ()
3332 m_dockChecklistGuide->
update (*m_cmdMediator,
3333 m_isDocumentExported);
3336void MainWindow::updateControls ()
3339 <<
" selectedItems=" << m_scene->selectedItems().count();
3341 m_cmbBackground->setEnabled (!m_currentFile.isEmpty ());
3343 m_actionImportImageReplace->setEnabled (m_cmdMediator !=
nullptr);
3344#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
3345 m_menuFileOpenRecent->setEnabled ((m_actionRecentFiles.count () > 0) &&
3346 (m_actionRecentFiles.at(0)->isVisible ()));
3348 m_actionClose->setEnabled (!m_currentFile.isEmpty ());
3349 m_actionSave->setEnabled (!m_currentFile.isEmpty ());
3350 m_actionSaveAs->setEnabled (!m_currentFile.isEmpty ());
3351 m_actionExport->setEnabled (!m_currentFile.isEmpty ());
3352 m_actionPrint->setEnabled (!m_currentFile.isEmpty ());
3354 if (m_cmdMediator ==
nullptr) {
3355 m_actionEditUndo->setEnabled (
false);
3356 m_actionEditRedo->setEnabled (
false);
3358 m_actionEditUndo->setEnabled (m_cmdMediator->canUndo ());
3359 m_actionEditRedo->setEnabled (m_cmdMediator->canRedo () || m_cmdStackShadow->
canRedo ());
3367 m_scene->selectedItems().count () > 0);
3371 m_actionEditPaste->setEnabled (m_digitizeStateContext->
canPaste (m_transformation,
3375 m_scene->selectedItems().count () > 0);
3378 m_actionDigitizeAxis->setEnabled (modeGraph ());
3379 m_actionDigitizeScale->setEnabled (
modeMap ());
3380 m_actionDigitizeCurve ->setEnabled (!m_currentFile.isEmpty ());
3381 m_actionDigitizePointMatch->setEnabled (!m_currentFile.isEmpty ());
3382 m_actionDigitizeColorPicker->setEnabled (!m_currentFile.isEmpty ());
3383 m_actionDigitizeSegment->setEnabled (!m_currentFile.isEmpty ());
3384 m_actionDigitizeSelect->setEnabled (!m_currentFile.isEmpty ());
3386 m_actionViewGridLines->setEnabled (
true);
3388 m_actionViewGridLines->setEnabled (
false);
3389 m_actionViewGridLines->setChecked (
false);
3391 m_actionViewBackground->setEnabled (!m_currentFile.isEmpty());
3392 m_actionViewChecklistGuide->setEnabled (!m_dockChecklistGuide->
browserIsEmpty());
3393 m_actionViewDigitize->setEnabled (!m_currentFile.isEmpty ());
3394 m_actionViewSettingsViews->setEnabled (!m_currentFile.isEmpty ());
3396 m_actionSettingsCoords->setEnabled (!m_currentFile.isEmpty ());
3397 m_actionSettingsCurveList->setEnabled (!m_currentFile.isEmpty ());
3398 m_actionSettingsCurveProperties->setEnabled (!m_currentFile.isEmpty ());
3399 m_actionSettingsDigitizeCurve->setEnabled (!m_currentFile.isEmpty ());
3400 m_actionSettingsExport->setEnabled (!m_currentFile.isEmpty ());
3401 m_actionSettingsColorFilter->setEnabled (!m_currentFile.isEmpty ());
3402 m_actionSettingsAxesChecker->setEnabled (!m_currentFile.isEmpty ());
3403 m_actionSettingsGridDisplay->setEnabled (!m_currentFile.isEmpty () && m_transformation.
transformIsDefined());
3404 m_actionSettingsGridRemoval->setEnabled (!m_currentFile.isEmpty ());
3405 m_actionSettingsPointMatch->setEnabled (!m_currentFile.isEmpty ());
3406 m_actionSettingsSegments->setEnabled (!m_currentFile.isEmpty ());
3407 m_actionSettingsGeneral->setEnabled (!m_currentFile.isEmpty ());
3409 m_groupBackground->setEnabled (!m_currentFile.isEmpty ());
3410 m_groupCurves->setEnabled (!m_currentFile.isEmpty ());
3411 m_groupZoom->setEnabled (!m_currentFile.isEmpty ());
3413 m_actionZoomIn->setEnabled (!m_currentFile.isEmpty ());
3414 m_actionZoomOut->setEnabled (!m_currentFile.isEmpty ());
3424 loadCurveListFromCmdMediator ();
3426 updateTransformationAndItsDependencies();
3442 m_actionDigitizeAxis->setChecked(
true);
3447 m_actionDigitizeColorPicker->setChecked(
true);
3448 slotDigitizeColorPicker();
3452 m_actionDigitizeCurve->setChecked(
true);
3453 slotDigitizeCurve();
3460 m_actionDigitizePointMatch->setChecked(
true);
3461 slotDigitizePointMatch();
3465 m_actionDigitizeScale->setChecked(
true);
3466 slotDigitizeScale();
3470 m_actionDigitizeSegment->setChecked(
true);
3471 slotDigitizeSegment();
3475 m_actionDigitizeSelect->setChecked(
true);
3476 slotDigitizeSelect();
3485void MainWindow::updateFittingWindow ()
3489 if (m_cmdMediator !=
nullptr &&
3490 m_cmbCurve !=
nullptr) {
3493 m_dockFittingWindow->
update (*m_cmdMediator,
3495 m_cmbCurve->currentText (),
3500void MainWindow::updateGeometryWindow ()
3504 if (m_cmdMediator !=
nullptr &&
3505 m_cmbCurve !=
nullptr) {
3508 m_dockGeometryWindow->
update (*m_cmdMediator,
3510 m_cmbCurve->currentText (),
3523void MainWindow::updateGridLines ()
3528 m_gridLines.
clear ();
3539 m_gridLines.
setVisible (m_actionViewGridLines->isChecked());
3542void MainWindow::updateHighlightOpacity ()
3544 if (m_cmdMediator !=
nullptr) {
3550 m_dockGeometryWindow,
3555void MainWindow::updateRecentFileList()
3559#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
3575 m_actionRecentFiles.at (
i)->setVisible (
true);
3580 m_actionRecentFiles.at (
i)->setVisible (
false);
3595 m_cmbCurve->currentText());
3601 m_cmbCurve->currentText());
3614 m_cmbCurve->currentText());
3631 loadCurveListFromCmdMediator();
3650 modelDigitizeCurve);
3682void MainWindow::updateSettingsMainWindow()
3689 m_actionZoomIn->setShortcut (
tr (
""));
3690 m_actionZoomOut->setShortcut (
tr (
""));
3694 m_actionZoomIn->setShortcut (
tr (
"+"));
3695 m_actionZoomOut->setShortcut (
tr (
"-"));
3699 if ((m_scene !=
nullptr) &&
3700 (m_cmdMediator !=
nullptr)) {
3704 updateHighlightOpacity();
3705 updateWindowTitle();
3706 updateFittingWindow();
3707 updateGeometryWindow();
3733void MainWindow::updateSmallDialogs ()
3750void MainWindow::updateTransformationAndItsDependencies()
3752 m_transformation.
update (!m_currentFile.isEmpty (),
3761 m_cmbCurve->currentText ());
3768void MainWindow::updateViewedCurves ()
3772 if (m_actionViewCurvesAll->isChecked ()) {
3776 }
else if (m_actionViewCurvesSelected->isChecked ()) {
3780 }
else if (m_actionViewCurvesNone->isChecked ()) {
3800 if (activeCurve.isEmpty ()) {
3813 m_cmdMediator->
pixmap ());
3818void MainWindow::updateWindowTitle ()
3825 .arg (
tr (
"Engauge Digitizer"))
3829 if (!m_currentFileWithPathAndFileExtension.isEmpty()) {
3869void MainWindow::writeCheckpointToLogFile ()
3887 <<
"--------------DOCUMENT CHECKPOINT START----------" <<
"\n"
3889 <<
"---------------DOCUMENT CHECKPOINT END-----------" <<
"\n"
3890 <<
"----------------SCENE CHECKPOINT START-----------" <<
"\n"
3892 <<
"-----------------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
const int INNER_RADIUS_MIN
@ 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 if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...
#define ENGAUGE_CHECK_PTR(ptr)
#endif
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.
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.
bool DEFAULT_DRAG_DROP_EXPORT
bool DEFAULT_IMAGE_REPLACE_RENAMES_DOCUMENT
int DEFAULT_SIGNIFICANT_DIGITS
bool DEFAULT_SMALL_DIALOGS
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_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.
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.
Command for adding one or more graph points. This is for Segment Fill mode.
Command for moving all selected Points by a specified translation.
Command for cutting all selected Points.
Command for deleting all selected Points.
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.
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.
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 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.
DocumentAxesPointsRequired documentAxesPointsRequired() const
Get method for DocumentAxesPointsRequired.
void setModelSegments(const DocumentModelSegments &modelSegments)
Set method for DocumentModelSegments.
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.
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...
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.
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.
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 setDirectoryExportSaveFromFilename(const QString &fileName)
Save the current Export/Save directory, after user has accepted the Export/Save dialog.
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.
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
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.
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 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 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.
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 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 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 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,...
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.
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 ...
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)