67#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
71#ifdef ENGAUGE_JPEG2000
91#include <QApplication>
96#include <QDesktopServices>
98#include <QDomDocument>
101#include <QImageReader>
103#include <QKeySequence>
105#include <QMessageBox>
106#include <QMouseEvent>
107#include <QPrintDialog>
110#include <QPushButton>
112#include <QSignalMapper>
113#include <QTextStream>
114#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
119#include <QToolButton>
121#include <QVBoxLayout>
123#include <QXmlStreamReader>
124#include <QXmlStreamWriter>
139static const char *ENGAUGE_FILENAME_DESCRIPTION =
"Engauge Document";
145 const QString &fileCmdScriptFile,
146 bool isDropRegression,
147 bool isRegressionTest,
151 bool isExtractImageOnly,
152 const QString &extractImageOnlyExtension,
153 const QStringList &loadStartupFiles,
154 const QStringList &commandLineWithoutLoadStartupFiles,
157 m_originalFileWasImported (false),
158 m_isDocumentExported (false),
164 m_loadImageFromUrl (nullptr),
165 m_cmdMediator (nullptr),
166 m_digitizeStateContext (nullptr),
167 m_transformationStateContext (nullptr),
168 m_backgroundStateContext (nullptr),
169 m_networkClient (nullptr),
171 m_timerLoadStartupFiles (nullptr),
172 m_commandLineWithoutLoadStartupFiles (commandLineWithoutLoadStartupFiles),
174 m_timerRegressionErrorReport(nullptr),
175 m_fileCmdScript (nullptr),
176 m_isErrorReportRegressionTest (isRegressionTest),
177 m_timerRegressionFileCmdScript(nullptr),
178 m_guidelines (*this),
179 m_fittingCurve (nullptr),
180 m_isExportOnly (isExportOnly),
181 m_isExtractImageOnly (isExtractImageOnly),
182 m_extractImageOnlyExtension (extractImageOnlyExtension),
183 m_timerChecklistGuideWizard (nullptr)
186 <<
" curDir=" << QDir::currentPath().toLatin1().data();
188#if defined(OSX_DEBUG) || defined(OSX_RELEASE)
189 qApp->setApplicationName (
"Engauge Digitizer");
190 qApp->setOrganizationDomain (
"Mark Mitchell");
195 m_startupDirectory = QDir::currentPath();
200 createFacade.
create (*
this);
204 settingsRead (isReset);
206 setUnifiedTitleAndToolBarOnMac(
true);
208 installEventFilter(
this);
212 QString originalPath = QDir::currentPath();
213 QDir::setCurrent (m_startupDirectory);
215 m_loadStartupFiles = loadStartupFiles;
216 m_regressionFile = exportRegressionFilenameFromInputFilename (loadStartupFiles.first ());
217 slotLoadStartupFiles ();
220 }
else if (isExtractImageOnly) {
221 m_loadStartupFiles = loadStartupFiles;
222 m_regressionFile = exportRegressionFilenameFromInputFilename (loadStartupFiles.first ());
223 slotLoadStartupFiles ();
224 handlerFileExtractImage ();
226 }
else if (!errorReportFile.isEmpty()) {
227 loadErrorReportFile(errorReportFile);
228 if (m_isErrorReportRegressionTest) {
229 startRegressionTestErrorReport(errorReportFile);
231 }
else if (!fileCmdScriptFile.isEmpty()) {
233 startRegressionTestFileCmdScript();
234 }
else if (isDropRegression) {
236 startRegressionDropTest (loadStartupFiles);
241 m_loadStartupFiles = loadStartupFiles;
243 QDir::setCurrent (originalPath);
248#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
251 delete m_tutorialDlg;
252 delete m_cmdMediator;
253 delete m_cmdStackShadow;
254 delete m_digitizeStateContext;
255 delete m_transformationStateContext;
256 delete m_backgroundStateContext;
257 delete m_dlgSettingsAxesChecker;
258 delete m_dlgSettingsColorFilter;
259 delete m_dlgSettingsCoords;
260 delete m_dlgSettingsCurveList;
261 delete m_dlgSettingsCurveProperties;
262 delete m_dlgSettingsDigitizeCurve;
263 delete m_dlgSettingsExportFormat;
264 delete m_dlgSettingsGeneral;
265 delete m_dlgSettingsGridDisplay;
266 delete m_dlgSettingsGridRemoval;
267 delete m_dlgSettingsGuideline;
268 delete m_dlgSettingsMainWindow;
269 delete m_dlgSettingsPointMatch;
270 delete m_dlgSettingsSegments;
271 delete m_fileCmdScript;
272 m_gridLines.clear ();
273 m_guidelines.clear ();
276void MainWindow::addDockWindow (QDockWidget *dockWidget,
278 const QString &settingsTokenArea,
279 const QString &settingsTokenGeometry,
280 Qt::DockWidgetArea dockWidgetArea)
285 const bool DOCKED_EQUALS_NOT_FLOATING =
false;
286 Qt::DockWidgetArea area =
static_cast<Qt::DockWidgetArea
> (settings.value (settingsTokenArea,
287 Qt::NoDockWidgetArea).toInt());
289 if (area == Qt::NoDockWidgetArea) {
291 addDockWidget (dockWidgetArea,
293 dockWidget->setFloating(DOCKED_EQUALS_NOT_FLOATING);
294 if (settings.contains (settingsTokenGeometry)) {
295 dockWidget->restoreGeometry (settings.value (settingsTokenGeometry).toByteArray());
306void MainWindow::applyZoomFactorAfterLoad()
311 if (m_zoomMapFromInitial.contains (zoomFactorInitial)) {
312 zoomFactor = m_zoomMapFromInitial [zoomFactorInitial];
314 zoomFactor = currentZoomFactor ();
316 LOG4CPP_ERROR_S ((*
mainCat)) <<
"MainWindow::applyZoomFactorAfterLoad unexpected zoom factor " << zoomFactorInitial;
318 zoomFactor = currentZoomFactor();
321 slotViewZoom (zoomFactor);
324void MainWindow::closeEvent(QCloseEvent *event)
338 setWindowModified (
false);
355 m_regressionFile = exportRegressionFilenameFromInputFilename (fileName);
356 fileImport (fileName,
364 m_regressionFile = exportRegressionFilenameFromInputFilename (fileName);
365 loadDocumentFile(fileName);
371 return m_cmdMediator;
374ZoomFactor MainWindow::currentZoomFactor ()
const
379 if (m_zoomMapToAction [zoomFactor]->isChecked ()) {
392 return m_digitizeStateContext->digitizeState ();
397 if (event->type () == QEvent::KeyPress) {
399 QKeyEvent *eventKeyPress =
static_cast<QKeyEvent *
> (event);
402 if ((eventKeyPress->key() == Qt::Key_E) &&
403 ((eventKeyPress->modifiers() & Qt::ShiftModifier) != 0) &&
404 ((eventKeyPress->modifiers() & Qt::ControlModifier) != 0)) {
414 return QObject::eventFilter (target, event);
417#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
418void MainWindow::exportAllCoordinateSystemsAfterRegressionTests()
420 LOG4CPP_INFO_S ((*
mainCat)) <<
"MainWindow::exportAllCoordinateSystemsAfterRegressionTests curDir=" << QDir::currentPath().toLatin1().data();
427 QString regressionFile = QString (
"%1_%2")
428 .arg (m_regressionFile)
436 exportStrategy.fileExport (regressionFile);
440 ExportToFile exportStrategy;
442 fileExport (regressionFile,
449QString MainWindow::exportRegressionFilenameFromInputFilename (
const QString &fileName)
const
454 befores <<
".dig" <<
".gif" <<
".html" <<
".htm" <<
".jp2" <<
".jpg" <<
".pbm"
455 <<
".pdf" <<
".pgm" <<
".png" <<
".ppm" <<
".webp" <<
".xbm" <<
".xpm" <<
".xml";
457 QString outFileName = fileName;
459 QStringList::iterator itr;
460 for (itr = befores.begin(); itr != befores.end(); itr++) {
461 QString suffix = *itr;
463 outFileName = outFileName.replace (suffix,
".csv_actual", Qt::CaseInsensitive);
469void MainWindow::fileExport(
const QString &fileName,
473 <<
" curDir=" << QDir::currentPath().toLatin1().data()
474 <<
" fileName=" << fileName.toLatin1().data();
476 QFile file (fileName);
477 if (file.open(QIODevice::WriteOnly)) {
479 QTextStream str (&file);
481 ExportFileExtensionOverride extensionOverride;
482 DocumentModelExportFormat modelExportFormat = extensionOverride.
modelExportOverride (m_cmdMediator->document().modelExport(),
486 m_cmdMediator->document(),
491 m_isDocumentExported =
true;
493 updateChecklistGuide ();
494 m_statusBar->showTemporaryMessage(
"File saved");
499 <<
" file=" << fileName.toLatin1().data()
500 <<
" curDir=" << QDir::currentPath().toLatin1().data();
501 QMessageBox::critical (
nullptr,
503 tr (
"Unable to export to file") +
" " + fileName);
507void MainWindow::fileExtractImage (
const QString &fileName)
510 <<
" curDir=" << QDir::currentPath().toLatin1().data()
511 <<
" fileName=" << fileName.toLatin1().data();
513 QFile file (fileName);
515 if (file.open(QIODevice::WriteOnly)) {
517 QPixmap pixmap = m_cmdMediator->pixmap();
521 if (m_isErrorReportRegressionTest) {
522 QString csvFile = QString (
"%1_1")
523 .arg (exportRegressionFilenameFromInputFilename (m_regressionFile));
527 unsigned crcResult = crc.
filecrc (fileName);
529 if (csv.open (QIODevice::WriteOnly | QIODevice::Text)) {
530 QTextStream str (&csv);
544 <<
" file=" << fileName.toLatin1().data()
545 <<
" curDir=" << QDir::currentPath().toLatin1().data();
546 QMessageBox::critical (
nullptr,
548 tr (
"Unable to extract image to file") +
" " + fileName);
552void MainWindow::fileImport (
const QString &fileName,
553 ImportType importType)
556 <<
" fileName=" << fileName.toLatin1 ().data ()
557 <<
" curDir=" << QDir::currentPath().toLatin1().data()
558 <<
" importType=" << importType;
560 QString originalFileOld = m_originalFile;
561 bool originalFileWasImported = m_originalFileWasImported;
563 m_originalFile = fileName;
564 m_originalFileWasImported =
true;
566 if (importType == IMPORT_TYPE_ADVANCED) {
579#ifdef ENGAUGE_JPEG2000
581 loaded = jpeg2000.
load (fileName,
591 m_modelMainWindow.pdfResolution(),
592 m_modelMainWindow.importCropping(),
593 m_isErrorReportRegressionTest);
609 m_modelMainWindow.importCropping(),
610 m_isErrorReportRegressionTest);
622 QString msg = messageCannotReadFile (fileName);
626 msg = QString (
"%1.\n\n%2.")
628 .arg (tr (
"In OSX, files loaded at startup must be in the Downloads, Pictures or "
629 "Library/Containers/Digitizer/Data directories"));
633 if (fileName.contains (
"???")) {
638 msg += QObject::tr (
"The file appears to have characters from multiple language "
639 "alphabets, which does not work in the Windows command line");
642 QMessageBox::warning (
this,
647 m_originalFile = originalFileOld;
648 m_originalFileWasImported = originalFileWasImported;
652 loaded = loadImage (fileName,
659 if ((m_cmdMediator->document().coordSystemCount() > 1) &&
660 ! m_actionViewCoordSystemToolBar->isChecked ()) {
663 m_actionViewCoordSystemToolBar->trigger ();
669 if (importType == IMPORT_TYPE_ADVANCED) {
679 m_originalFile = originalFileOld;
680 m_originalFileWasImported = originalFileWasImported;
686void MainWindow::fileImportWithPrompts (ImportType importType)
689 <<
" importType=" << importType;
693 bool okToContinue =
true;
694 if (importType != IMPORT_TYPE_IMAGE_REPLACE) {
695 okToContinue = maybeSave ();
701 QTextStream str (&filter);
703 ImportImageExtensions importImageExtensions;
706 str <<
"Image Files (" << supportedImageFormatStrings.join (
" ") <<
")";
710 str <<
";; All Files (*.*)";
712 MainDirectoryPersist directoryPersist;
713 QString fileName = QFileDialog::getOpenFileName (
this,
717 if (!fileName.isEmpty ()) {
722 fileImport (fileName,
728QString MainWindow::fileNameForExportOnly ()
const
730 ExportToFile exportStrategy;
733 if (m_isErrorReportRegressionTest) {
736 fileName = QString (
"%1_1")
737 .arg (exportRegressionFilenameFromInputFilename (m_regressionFile));
742 QString dir = QFileInfo (m_currentFileWithPathAndFileExtension).absolutePath();
743 fileName = QString (
"%1/%2.%3")
752QString MainWindow::fileNameForExtractImageOnly ()
const
755 QString dir = QFileInfo (m_currentFileWithPathAndFileExtension).absolutePath();
756 QString fileName = QString (
"%1/%2.%3")
759 .arg (m_extractImageOnlyExtension);
764void MainWindow::filePaste (ImportType importType)
767 <<
" importType=" << importType;
769 QString originalFileOld = m_originalFile;
770 bool originalFileWasImported = m_originalFileWasImported;
772 QString fileName (
"clipboard");
773 m_originalFile = fileName;
774 m_originalFileWasImported =
true;
776 if (importType == IMPORT_TYPE_ADVANCED) {
787 QImage image = QApplication::clipboard()->image();
791 loaded = !image.isNull();
795 QMessageBox::warning (
this,
797 messageCannotReadFile (fileName));
800 m_originalFile = originalFileOld;
801 m_originalFileWasImported = originalFileWasImported;
805 loaded = loadImage (fileName,
812 if (importType == IMPORT_TYPE_ADVANCED) {
822 m_originalFile = originalFileOld;
823 m_originalFileWasImported = originalFileWasImported;
829void MainWindow::ghostsCreate ()
834 m_ghosts =
new Ghosts (m_cmdMediator->document().coordSystemIndex());
836 for (
unsigned int index = 0; index < m_cmdMediator->document().coordSystemCount(); index++) {
839 if (index != m_ghosts->coordSystemIndexToBeRestored ()) {
844 m_ghosts->captureGraphicsItems (*m_scene);
852 m_ghosts->createGhosts (*m_scene);
855void MainWindow::ghostsDestroy ()
861 m_ghosts->destroyGhosts(*m_scene);
873 m_guidelines.createGuidelineX (identifier,
876 m_guidelines.createGuidelineT (identifier,
882 m_cmdMediator->document().setModelGuideline (modelGuidelineNew);
885void MainWindow::guidelineAddXTEnqueue (
double xT)
891 m_cmdMediator->push (cmd);
900 m_guidelines.createGuidelineY (identifier,
903 m_guidelines.createGuidelineR (identifier,
909 m_cmdMediator->document().setModelGuideline (modelGuidelineNew);
912void MainWindow::guidelineAddYREnqueue (
double yR)
918 m_cmdMediator->push (cmd);
926 m_guidelines.moveGuidelineXT (identifier,
931 m_cmdMediator->document().setModelGuideline (modelGuidelineNew);
939 m_guidelines.moveGuidelineYR (identifier,
944 m_cmdMediator->document().setModelGuideline (modelGuidelineNew);;
951 m_guidelines.removeGuideline (identifier);
955 m_cmdMediator->document().setModelGuideline (modelGuidelineNew);
970 m_guidelines.handleActiveChange (active);
973void MainWindow::handleGuidelineMode ()
979void MainWindow::handlerFileExtractImage ()
983 if (m_isExtractImageOnly) {
984 QString fileName = fileNameForExtractImageOnly ();
986 MainDirectoryPersist directoryPersist;
989 fileExtractImage(fileName);
995 return m_backgroundStateContext->imageForCurveState();
1003void MainWindow::loadCoordSystemListFromCmdMediator ()
1007 m_cmbCoordSystem->clear();
1011 for (
unsigned int i = 0; i < numberCoordSystem; i++) {
1012 int index1Based = signed (i + 1);
1013 m_cmbCoordSystem->addItem (QString::number (index1Based),
1018 m_cmbCoordSystem->setCurrentIndex (0);
1021 bool enable = (m_cmbCoordSystem->count() > 1);
1022 m_cmbCoordSystem->setEnabled (enable);
1023 m_btnShowAll->setEnabled (enable);
1024 m_btnPrintAll->setEnabled (enable);
1027void MainWindow::loadCurveListFromCmdMediator ()
1031 m_cmbCurve->clear ();
1032 QStringList curvesGraphsNames = m_cmdMediator->curvesGraphsNames ();
1033 QStringList::iterator itr;
1034 for (itr = curvesGraphsNames.begin (); itr != curvesGraphsNames.end (); itr++) {
1036 QString curvesGraphName = *itr;
1037 m_cmbCurve->addItem (curvesGraphName);
1041 m_cmbCurve->setCurrentText (m_cmdMediator->selectedCurveName ());
1044void MainWindow::loadDocumentFile (
const QString &fileName)
1046 LOG4CPP_INFO_S ((*
mainCat)) <<
"MainWindow::loadDocumentFile fileName=" << fileName.toLatin1 ().data ();
1048 QApplication::setOverrideCursor(Qt::WaitCursor);
1049 CmdMediator *
cmdMediator =
new CmdMediator (*
this,
1054 setCurrentPathFromFile (fileName);
1055 rebuildRecentFileListForCurrentFile(fileName);
1056 m_currentFile = fileName;
1058 delete m_cmdMediator;
1061 setupAfterLoadNewDocument (fileName,
1063 IMPORT_TYPE_SIMPLE);
1066 m_actionDigitizeSelect->setChecked (
true);
1067 slotDigitizeSelect();
1069 m_engaugeFile = fileName;
1070 m_originalFile = fileName;
1071 m_originalFileWasImported =
false;
1075 updateGuidelines ();
1078 QApplication::restoreOverrideCursor();
1082 QApplication::restoreOverrideCursor();
1084 QString msg = messageCannotReadFile (fileName);
1085 QMessageBox::warning (
this,
1095void MainWindow::loadErrorReportFile(
const QString &errorReportFile)
1098 <<
" file=" << errorReportFile.toLatin1().data();
1100 QFile file (errorReportFile);
1101 if (!file.exists()) {
1103 QFileInfo fileInfo (errorReportFile);
1105 QMessageBox::critical (
this,
1107 tr (
"File not found") +
": " + fileInfo.absoluteFilePath());
1112 QXmlStreamReader reader (&file);
1113 file.open(QIODevice::ReadOnly | QIODevice::Text);
1114 m_cmdMediator =
new CmdMediator(*
this,
1118 m_cmdStackShadow->loadCommands (*
this,
1119 m_cmdMediator->document(),
1123 setupAfterLoadNewDocument (errorReportFile,
1124 tr (
"Error report opened"),
1125 IMPORT_TYPE_SIMPLE);
1128 m_actionDigitizeSelect->setChecked (
true);
1129 slotDigitizeSelect();
1134void MainWindow::loadGuidelinesFromCmdMediator ()
1138 m_guidelines.setModelGuideline (m_cmdMediator->document().modelCoords().coordsType(),
1139 m_cmdMediator->document().modelGuideline());
1142bool MainWindow::loadImage (
const QString &fileName,
1143 const QImage &image,
1144 ImportType importType)
1147 <<
" fileName=" << fileName.toLatin1 ().data ()
1148 <<
" importType=" << importType;
1151 if (importType == IMPORT_TYPE_IMAGE_REPLACE) {
1152 success = loadImageReplacingImage (fileName,
1156 success = loadImageNewDocument (fileName,
1164bool MainWindow::loadImageNewDocument (
const QString &fileName,
1165 const QImage &image,
1166 ImportType importType)
1169 <<
" fileName=" << fileName.toLatin1 ().data ()
1170 <<
" importType=" << importType;
1174 QApplication::setOverrideCursor(Qt::WaitCursor);
1175 CmdMediator *
cmdMediator =
new CmdMediator (*
this,
1177 QApplication::restoreOverrideCursor();
1179 setCurrentPathFromFile (fileName);
1183 delete m_cmdMediator;
1186 bool accepted = setupAfterLoadNewDocument (fileName,
1187 tr (
"File imported"),
1193 if (m_actionHelpChecklistGuideWizard->isChecked () &&
1194 (m_fileCmdScript ==
nullptr)) {
1197 delete m_timerChecklistGuideWizard;
1198 m_timerChecklistGuideWizard =
new QTimer;
1199 m_timerChecklistGuideWizard->setSingleShot (
true);
1200 connect (m_timerChecklistGuideWizard, SIGNAL (timeout ()),
this, SLOT (slotTimeoutChecklistGuideWizard ()));
1201 m_timerChecklistGuideWizard->start (0);
1205 m_actionDigitizeAxis->setChecked (
true);
1209 slotDigitizeScale ();
1210 }
else if (modeGraph ()) {
1211 slotDigitizeAxis ();
1220bool MainWindow::loadImageReplacingImage (
const QString &fileName,
1221 const QImage &image,
1222 ImportType importType)
1225 <<
" fileName=" << fileName.toLatin1 ().data ()
1226 <<
" importType=" << importType;
1230 setCurrentPathFromFile (fileName);
1236 m_cmdMediator->document().setPixmap (image);
1238 bool accepted = setupAfterLoadReplacingImage (fileName,
1239 tr (
"File imported"),
1247void MainWindow::loadInputFileForErrorReport(QDomDocument &domInputFile)
const
1249 QFile file (m_originalFile);
1253 if (!file.open (QIODevice::ReadOnly)) {
1257 domInputFile.setContent (&file);
1261void MainWindow::loadToolTips()
1263 if (m_actionViewToolTips->isChecked ()) {
1266 m_actionDigitizeSelect->setToolTip (m_actionDigitizeSelect->text());
1267 m_actionDigitizeAxis->setToolTip (m_actionDigitizeAxis->text());
1268 m_actionDigitizeScale->setToolTip (m_actionDigitizeScale->text());
1269 m_actionDigitizeCurve->setToolTip (m_actionDigitizeCurve->text());
1270 m_actionDigitizePointMatch->setToolTip (m_actionDigitizePointMatch->text());
1271 m_actionDigitizeColorPicker->setToolTip (m_actionDigitizeColorPicker->text());
1272 m_actionDigitizeSegment->setToolTip (m_actionDigitizeSegment->text());
1273 m_cmbBackground->setToolTip (tr (
"Background image."));
1274 m_cmbCurve->setToolTip (tr (
"Currently selected curve."));
1275 m_viewPointStyle->setToolTip (tr (
"Point style for currently selected curve."));
1276 m_viewSegmentFilter->setToolTip (tr (
"Segment Fill filter for currently selected curve."));
1281 m_actionDigitizeSelect->setToolTip (
"");
1282 m_actionDigitizeAxis->setToolTip (
"");
1283 m_actionDigitizeScale->setToolTip (
"");
1284 m_actionDigitizeCurve->setToolTip (
"");
1285 m_actionDigitizePointMatch->setToolTip (
"");
1286 m_actionDigitizeColorPicker->setToolTip (
"");
1287 m_actionDigitizeSegment->setToolTip (
"");
1288 m_cmbBackground->setToolTip (
"");
1289 m_cmbCurve->setToolTip (
"");
1290 m_viewPointStyle->setToolTip (
"");
1291 m_viewSegmentFilter->setToolTip (
"");
1296void MainWindow::loadViewsLoad ()
1303 const DocumentModelLoadViews &modelLoadViews = m_cmdMediator->document().modelLoadViews();
1305 m_actionViewGridLines->setChecked (modelLoadViews.
gridlines ());
1306 m_actionViewGuidelines->setChecked (modelLoadViews.
guidelines ());
1310void MainWindow::loadViewsSave ()
1314 DocumentModelLoadViews modelLoadViews (m_actionViewGridLines->isChecked(),
1315 m_actionViewGuidelines->isChecked());
1316 m_cmdMediator->document().setModelLoadViews (modelLoadViews);
1319bool MainWindow::maybeSave()
1321 if (m_cmdMediator !=
nullptr) {
1322 if (m_cmdMediator->isModified()) {
1323 QMessageBox::StandardButton ret = QMessageBox::warning (
this,
1325 tr(
"The document has been modified.\n"
1326 "Do you want to save your changes?"),
1327 QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
1328 if (ret == QMessageBox::Save) {
1329 return slotFileSave();
1330 }
else if (ret == QMessageBox::Cancel) {
1339QString MainWindow::messageCannotReadFile (
const QString &fileName)
const
1341 return QString(
"%1 %2")
1342 .arg (tr (
"Cannot read file"))
1346bool MainWindow::modeGraph ()
const
1348 bool success =
false;
1350 if (m_cmdMediator !=
nullptr) {
1359 bool success =
false;
1361 if (m_cmdMediator !=
nullptr) {
1370 return m_modelMainWindow;
1373void MainWindow::rebuildRecentFileListForCurrentFile(
const QString &filePath)
1377 setWindowFilePath (filePath);
1381 recentFilePaths.removeAll (filePath);
1382 recentFilePaths.prepend (filePath);
1384 recentFilePaths.removeLast ();
1388 updateRecentFileList();
1395 if (m_actionZoomFill->isChecked ()) {
1399 QMainWindow::resizeEvent(event);
1402bool MainWindow::saveDocumentFile (
const QString &fileName)
1404 LOG4CPP_INFO_S ((*
mainCat)) <<
"MainWindow::saveDocumentFile fileName=" << fileName.toLatin1 ().data ();
1408 QFile file(fileName);
1409 if (!file.open(QFile::WriteOnly)) {
1410 QMessageBox::warning (
this,
1412 QString (
"%1 %2: \n%3.")
1413 .arg(tr (
"Cannot write file"))
1415 .arg(file.errorString()));
1419 rebuildRecentFileListForCurrentFile (fileName);
1421 QApplication::setOverrideCursor (Qt::WaitCursor);
1422 QXmlStreamWriter writer(&file);
1423 writer.setAutoFormatting(
true);
1424 writer.writeStartDocument();
1425 writer.writeDTD(
"<!DOCTYPE engauge>");
1426 m_cmdMediator->document().saveXml(writer);
1427 writer.writeEndDocument();
1428 QApplication::restoreOverrideCursor ();
1432 m_cmdMediator->setClean ();
1434 setCurrentFile(fileName);
1435 m_engaugeFile = fileName;
1437 m_statusBar->showTemporaryMessage(
"File saved");
1445 const char *comment)
1449 if ((m_cmdMediator !=
nullptr) && !m_isErrorReportRegressionTest) {
1451 QString report = saveErrorReportFileAndExitXml (context,
1457 if (dlg.exec() == QDialog::Accepted) {
1460 QString fileName = dlg.getSaveFileName (
this,
1462 "error_report.xml");
1463 if (!fileName.isEmpty ()) {
1465 QFile fileError (fileName);
1466 QTextStream str (&fileError);
1467 fileError.open (QIODevice::WriteOnly | QIODevice::Text);
1477QString MainWindow::saveErrorReportFileAndExitXml (
const char *context,
1480 const char *comment)
const
1482 const bool DEEP_COPY =
true;
1484 QString xmlErrorReport;
1485 QXmlStreamWriter writer (&xmlErrorReport);
1486 writer.setAutoFormatting(
true);
1494 writer.writeEndElement();
1498 QXmlStreamReader reader (m_startingDocumentSnapshot);
1499 while (!reader.atEnd ()) {
1501 if (reader.tokenType() != QXmlStreamReader::StartDocument &&
1502 reader.tokenType() != QXmlStreamReader::EndDocument &&
1503 reader.tokenType() != QXmlStreamReader::Invalid) {
1504 writer.writeCurrentToken (reader);
1512 writer.writeEndElement();
1518 writer.writeEndElement();
1521 m_cmdMediator->saveXml(writer);
1529 writer.writeEndElement();
1531 writer.writeEndElement();
1534 QDomDocument domErrorReport (
"ErrorReport");
1535 domErrorReport.setContent (xmlErrorReport);
1538 if (!m_originalFileWasImported) {
1542 QDomDocument domInputFile;
1543 loadInputFileForErrorReport (domInputFile);
1544 QDomDocumentFragment fragmentFileFrom = domErrorReport.createDocumentFragment();
1545 if (!domInputFile.isNull()) {
1546 fragmentFileFrom.appendChild (domErrorReport.importNode (domInputFile.documentElement(), DEEP_COPY));
1549 if (nodesFileTo.count () > 0) {
1550 QDomNode nodeFileTo = nodesFileTo.at (0);
1551 nodeFileTo.appendChild (fragmentFileFrom);
1559 for (
int i = 0 ; i < nodesDocument.count(); i++) {
1560 QDomNode nodeDocument = nodesDocument.at (i);
1562 if (!elemImage.isNull()) {
1571 QDomNode nodeReplacement;
1572 QDomElement elemReplacement = nodeReplacement.toElement();
1577 nodeDocument.insertBefore (nodeReplacement,
1579 nodeDocument.removeChild(elemImage);
1585 return domErrorReport.toString();
1588void MainWindow::saveStartingDocumentSnapshot()
1592 QXmlStreamWriter writer (&m_startingDocumentSnapshot);
1593 writer.setAutoFormatting (
true);
1594 m_cmdMediator->document().saveXml (writer);
1609 int index = m_cmbBackground->findData (backgroundImage);
1612 m_cmbBackground->setCurrentIndex(index);
1614 return previousBackground;
1619 return m_cmbCurve->currentText ();
1629void MainWindow::setCurrentFile (
const QString &fileName)
1633 QString fileNameStripped;
1634 if (!fileName.isEmpty()) {
1638 QFileInfo fileInfo (fileName);
1639 fileNameStripped = fileInfo.completeBaseName();
1642 m_currentFile = fileNameStripped;
1643 m_currentFileWithPathAndFileExtension = fileName;
1645 updateWindowTitle ();
1648void MainWindow::setCurrentPathFromFile (
const QString &fileName)
1650 QDir dir = QFileInfo (fileName).absoluteDir();
1652 if (dir.exists ()) {
1654 bool success = QDir::setCurrent (dir.absolutePath ());
1663void MainWindow::setNonFillZoomFactor (
ZoomFactor newZoomFactor)
1668 m_zoomMapToAction [newZoomFactor]->setChecked (
true);
1669 slotViewZoomFactor (newZoomFactor);
1672void MainWindow::setPixmap (
const QString &curveSelected,
1673 const QPixmap &pixmap)
1677 m_digitizeStateContext->setImageIsLoaded (m_cmdMediator,
1682 m_backgroundStateContext->setPixmap (m_isGnuplot,
1684 m_cmdMediator->document().modelGridRemoval(),
1685 m_cmdMediator->document().modelColorFilter(),
1689 m_guidelines.initialize (*m_scene);
1692void MainWindow::settingsRead (
bool isReset)
1701 settingsReadEnvironment (settings);
1702 settingsReadMainWindow (settings);
1705void MainWindow::settingsReadEnvironment (QSettings &settings)
1709 QDir::currentPath ()).toString ());
1710 settings.endGroup ();
1713void MainWindow::settingsReadMainWindow (QSettings &settings)
1718 const int DEFAULT_MAIN_WINDOW_WIDTH = 900, DEFAULT_MAIN_WINDOW_HEIGHT = 900;
1719 const int DEFAULT_MAIN_WINDOW_OFFSET_X = 100, DEFAULT_MAIN_WINDOW_OFFSET_Y = 100;
1723 QSize (DEFAULT_MAIN_WINDOW_WIDTH, DEFAULT_MAIN_WINDOW_HEIGHT)).toSize ());
1725 QPoint (DEFAULT_MAIN_WINDOW_OFFSET_X, DEFAULT_MAIN_WINDOW_OFFSET_Y)).toPoint ());
1728#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
1730 QSize (900, 600)).toSize();
1731 m_helpWindow->resize (helpSize);
1734 m_helpWindow->move (helpPos);
1745 m_actionViewBackgroundToolBar->setChecked (viewBackgroundToolBar);
1746 m_toolBackground->setVisible (viewBackgroundToolBar);
1749 int indexBackground = m_cmbBackground->findData (QVariant (backgroundImage));
1750 m_cmbBackground->setCurrentIndex (indexBackground);
1755 m_actionViewDigitizeToolBar->setChecked (viewDigitizeToolBar);
1756 m_toolDigitize->setVisible (viewDigitizeToolBar);
1761 m_actionViewSettingsViewsToolBar->setChecked (viewSettingsViewsToolBar);
1762 m_toolSettingsViews->setVisible (viewSettingsViewsToolBar);
1767 m_actionViewCoordSystemToolBar->setChecked (viewCoordSystemToolbar);
1768 m_toolCoordSystem->setVisible (viewCoordSystemToolbar);
1773 m_actionViewToolTips->setChecked (viewToolTips);
1779 m_statusBar->setStatusBarMode (statusBarMode);
1784 addDockWindow (m_dockChecklistGuide,
1788 Qt::RightDockWidgetArea);
1789 addDockWindow (m_dockFittingWindow,
1793 Qt::RightDockWidgetArea);
1794 addDockWindow (m_dockGeometryWindow,
1798 Qt::RightDockWidgetArea);
1803 QLocale localeDefault;
1805 QVariant (localeDefault.language())).toInt());
1807 QVariant (localeDefault.country())).toInt());
1808 QLocale locale (language,
1812 m_modelMainWindow.setLocale (locale);
1841 MainDirectoryPersist directoryPersist;
1843 QVariant (QDir::currentPath())).toString ());
1845 QVariant (QDir::currentPath())).toString ());
1848 updateSmallDialogs();
1850 settings.endGroup();
1853void MainWindow::settingsWrite ()
1855 MainDirectoryPersist directoryPersist;
1861 settings.endGroup ();
1866#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
1870 if (m_dockChecklistGuide->isFloating()) {
1880 if (m_dockFittingWindow->isFloating()) {
1888 if (m_dockGeometryWindow->isFloating()) {
1925 settings.endGroup ();
1928bool MainWindow::setupAfterLoadNewDocument (
const QString &fileName,
1929 const QString &temporaryMessage ,
1930 ImportType importType)
1933 <<
" file=" << fileName.toLatin1().data()
1934 <<
" message=" << temporaryMessage.toLatin1().data()
1935 <<
" importType=" << importType;
1940 const QString EMPTY_CURVE_NAME_TO_SKIP_BACKGROUND_PROCESSING;
1944 m_digitizeStateContext->resetOnLoad (m_cmdMediator);
1945 m_backgroundStateContext->setCurveSelected (m_isGnuplot,
1947 m_cmdMediator->document().modelGridRemoval(),
1948 m_cmdMediator->document().modelColorFilter(),
1949 EMPTY_CURVE_NAME_TO_SKIP_BACKGROUND_PROCESSING);
1950 setPixmap (m_cmdMediator->document().curvesGraphsNames().first(),
1951 m_cmdMediator->pixmap ());
1955 if (importType == IMPORT_TYPE_ADVANCED) {
1957 applyZoomFactorAfterLoad();
1959 DlgImportAdvanced dlgImportAdvanced (*
this);
1960 dlgImportAdvanced.exec();
1962 if (dlgImportAdvanced.result() == QDialog::Rejected) {
1966 int numberCoordSystem = signed (dlgImportAdvanced.numberCoordSystem());
1967 m_cmdMediator->document().addCoordSystems (
unsigned (numberCoordSystem - 1));
1968 m_cmdMediator->setDocumentAxesPointsRequired (dlgImportAdvanced.documentAxesPointsRequired());
1971 m_transformation.resetOnLoad();
1972 m_transformationStateContext->resetOnLoad();
1973 m_scene->resetOnLoad();
1975 connect (m_actionEditUndo, SIGNAL (triggered ()), m_cmdMediator, SLOT (undo ()));
1976 connect (m_actionEditUndo, SIGNAL (triggered ()), m_cmdStackShadow, SLOT (slotUndo ()));
1977 connect (m_actionEditRedo, SIGNAL (triggered ()), m_cmdMediator, SLOT (redo ()));
1978 connect (m_actionEditRedo, SIGNAL (triggered ()), m_cmdStackShadow, SLOT (slotRedo ()));
1979 connect (m_cmdMediator, SIGNAL (canRedoChanged(
bool)),
this, SLOT (slotCanRedoChanged (
bool)));
1980 connect (m_cmdMediator, SIGNAL (canUndoChanged(
bool)),
this, SLOT (slotCanUndoChanged (
bool)));
1981 connect (m_cmdMediator, SIGNAL (redoTextChanged (
const QString &)),
this, SLOT (slotRedoTextChanged (
const QString &)));
1982 connect (m_cmdMediator, SIGNAL (undoTextChanged (
const QString &)),
this, SLOT (slotUndoTextChanged (
const QString &)));
1983 loadCurveListFromCmdMediator ();
1984 loadCoordSystemListFromCmdMediator ();
1987 m_isDocumentExported =
false;
1993 m_backgroundStateContext->setCurveSelected (m_isGnuplot,
1995 m_cmdMediator->document().modelGridRemoval(),
1996 m_cmdMediator->document().modelColorFilter(),
1997 m_cmbCurve->currentText ());
1998 m_backgroundStateContext->setBackgroundImage (
static_cast<BackgroundImage> (m_cmbBackground->currentIndex ()));
2000 applyZoomFactorAfterLoad();
2002 setCurrentFile(fileName);
2003 m_statusBar->showTemporaryMessage (temporaryMessage);
2004 m_statusBar->wakeUp ();
2006 saveStartingDocumentSnapshot();
2010 loadGuidelinesFromCmdMediator ();
2011 handleGuidelineMode ();
2016bool MainWindow::setupAfterLoadReplacingImage (
const QString &fileName,
2017 const QString &temporaryMessage ,
2018 ImportType importType)
2021 <<
" file=" << fileName.toLatin1().data()
2022 <<
" message=" << temporaryMessage.toLatin1().data()
2023 <<
" importType=" << importType;
2028 m_cmdMediator->clear();
2030 setPixmap (m_cmdMediator->document().curvesGraphsNames().first(),
2031 m_cmdMediator->pixmap ());
2033 m_isDocumentExported =
false;
2035 m_backgroundStateContext->setBackgroundImage (
static_cast<BackgroundImage> (m_cmbBackground->currentIndex ()));
2037 applyZoomFactorAfterLoad();
2040 if (m_modelMainWindow.imageReplaceRenamesDocument()) {
2041 setCurrentFile(fileName);
2044 m_statusBar->showTemporaryMessage (temporaryMessage);
2045 m_statusBar->wakeUp ();
2047 saveStartingDocumentSnapshot();
2057 <<
" files=" << m_loadStartupFiles.join (
",").toLatin1().data();
2059 QMainWindow::showEvent (event);
2061 if (m_loadStartupFiles.count() > 0) {
2063 delete m_timerLoadStartupFiles;
2064 m_timerLoadStartupFiles =
new QTimer;
2065 m_timerLoadStartupFiles->setSingleShot (
true);
2066 connect (m_timerLoadStartupFiles, SIGNAL (timeout ()),
this, SLOT (slotLoadStartupFiles ()));
2067 m_timerLoadStartupFiles->start (0);
2074 m_statusBar->showTemporaryMessage (temporaryMessage);
2077void MainWindow::slotBtnPrintAll ()
2083 QPrinter printer (QPrinter::HighResolution);
2084 QPrintDialog dlg (&printer,
this);
2085 if (dlg.exec() == QDialog::Accepted) {
2086 QPainter painter (&printer);
2087 m_view->render (&painter);
2094void MainWindow::slotBtnShowAllPressed ()
2102void MainWindow::slotBtnShowAllReleased ()
2110void MainWindow::slotCanRedoChanged (
bool canRedo)
2114 m_actionEditRedo->setEnabled (canRedo || m_cmdStackShadow->canRedo());
2117void MainWindow::slotCanUndoChanged (
bool canUndo)
2121 m_actionEditUndo->setEnabled (canUndo);
2124void MainWindow::slotChecklistClosed()
2128 m_actionViewChecklistGuideWindow->setChecked (
false);
2131void MainWindow::slotCleanChanged(
bool clean)
2135 setWindowModified (!clean);
2138void MainWindow::slotCmbBackground(
int currentIndex)
2142 switch (currentIndex) {
2144 if (!m_actionViewBackgroundNone->isChecked()) {
2145 m_actionViewBackgroundNone->toggle();
2150 if (!m_actionViewBackgroundOriginal->isChecked ()) {
2151 m_actionViewBackgroundOriginal->toggle();
2156 if (!m_actionViewBackgroundFiltered->isChecked ()) {
2157 m_actionViewBackgroundFiltered->toggle();
2162 m_backgroundStateContext->setBackgroundImage (
static_cast<BackgroundImage> (currentIndex));
2165void MainWindow::slotCmbCoordSystem(
int index)
2169 CmdSelectCoordSystem *cmd =
new CmdSelectCoordSystem (*
this,
2170 m_cmdMediator->document(),
2173 m_cmdMediator->push (cmd);
2176void MainWindow::slotCmbCurve(
int )
2180 m_backgroundStateContext->setCurveSelected (m_isGnuplot,
2182 m_cmdMediator->document().modelGridRemoval(),
2183 m_cmdMediator->document().modelColorFilter(),
2184 m_cmbCurve->currentText ());
2185 m_digitizeStateContext->handleCurveChange (m_cmdMediator);
2186 m_cmdMediator->setSelectedCurveName (m_cmbCurve->currentText ());
2188 updateViewedCurves();
2190 updateFittingWindow();
2191 updateGeometryWindow();
2194void MainWindow::slotContextMenuEventAxis (QString pointIdentifier)
2196 LOG4CPP_INFO_S ((*
mainCat)) <<
"MainWindow::slotContextMenuEventAxis point=" << pointIdentifier.toLatin1 ().data ();
2198 m_digitizeStateContext->handleContextMenuEventAxis (m_cmdMediator,
2202void MainWindow::slotContextMenuEventGraph (QStringList pointIdentifiers)
2204 LOG4CPP_INFO_S ((*
mainCat)) <<
"MainWindow::slotContextMenuEventGraph point=" << pointIdentifiers.join(
",").toLatin1 ().data ();
2206 m_digitizeStateContext->handleContextMenuEventGraph (m_cmdMediator,
2210void MainWindow::slotDigitizeAxis ()
2214 m_digitizeStateContext->requestImmediateStateTransition (m_cmdMediator,
2216 m_cmbCurve->setEnabled (
false);
2217 m_viewPointStyle->setEnabled (
true);
2218 m_viewSegmentFilter->setEnabled (
true);
2222void MainWindow::slotDigitizeColorPicker ()
2226 m_digitizeStateContext->requestImmediateStateTransition (m_cmdMediator,
2228 m_cmbCurve->setEnabled (
true);
2229 m_viewPointStyle->setEnabled (
true);
2230 m_viewSegmentFilter->setEnabled (
true);
2234void MainWindow::slotDigitizeCurve ()
2238 m_digitizeStateContext->requestImmediateStateTransition (m_cmdMediator,
2240 m_cmbCurve->setEnabled (
true);
2241 m_viewPointStyle->setEnabled (
true);
2242 m_viewSegmentFilter->setEnabled (
true);
2246void MainWindow::slotDigitizeGuidelines ()
2250 m_digitizeStateContext->requestImmediateStateTransition (m_cmdMediator,
2252 m_cmbCurve->setEnabled (
false);
2253 m_viewPointStyle->setEnabled (
false);
2254 m_viewSegmentFilter->setEnabled (
false);
2258void MainWindow::slotDigitizePointMatch ()
2262 m_digitizeStateContext->requestImmediateStateTransition (m_cmdMediator,
2264 m_cmbCurve->setEnabled (
true);
2265 m_viewPointStyle->setEnabled (
true);
2266 m_viewSegmentFilter->setEnabled (
true);
2270void MainWindow::slotDigitizeScale ()
2274 m_digitizeStateContext->requestImmediateStateTransition (m_cmdMediator,
2276 m_cmbCurve->setEnabled (
false);
2277 m_viewPointStyle->setEnabled (
false);
2278 m_viewSegmentFilter->setEnabled (
false);
2282void MainWindow::slotDigitizeSegment ()
2286 m_digitizeStateContext->requestImmediateStateTransition (m_cmdMediator,
2288 m_cmbCurve->setEnabled (
true);
2289 m_viewPointStyle->setEnabled (
true);
2290 m_viewSegmentFilter->setEnabled (
true);
2294void MainWindow::slotDigitizeSelect ()
2298 m_digitizeStateContext->requestImmediateStateTransition (m_cmdMediator,
2300 m_cmbCurve->setEnabled (
false);
2301 m_viewPointStyle->setEnabled (
false);
2302 m_viewSegmentFilter->setEnabled (
false);
2306void MainWindow::slotEditCopy ()
2311 bool tableFittingIsActive, tableFittingIsCopyable;
2312 bool tableGeometryIsActive, tableGeometryIsCopyable;
2313 m_dockFittingWindow->getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
2314 m_dockGeometryWindow->getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
2316 if (tableFittingIsActive) {
2319 m_dockFittingWindow->doCopy ();
2321 }
else if (tableGeometryIsActive) {
2324 m_dockGeometryWindow->doCopy ();
2329 GraphicsItemsExtractor graphicsItemsExtractor;
2330 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
2333 CmdCopy *cmd =
new CmdCopy (*
this,
2334 m_cmdMediator->document(),
2336 m_digitizeStateContext->appendNewCmd (m_cmdMediator,
2341void MainWindow::slotEditCut ()
2346 bool tableFittingIsActive, tableFittingIsCopyable;
2347 bool tableGeometryIsActive, tableGeometryIsCopyable;
2348 m_dockFittingWindow->getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
2349 m_dockGeometryWindow->getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
2351 if (tableFittingIsActive || tableGeometryIsActive) {
2358 GraphicsItemsExtractor graphicsItemsExtractor;
2359 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
2362 CmdCut *cmd =
new CmdCut (*
this,
2363 m_cmdMediator->document(),
2365 m_digitizeStateContext->appendNewCmd (m_cmdMediator,
2370void MainWindow::slotEditDelete ()
2375 bool tableFittingIsActive, tableFittingIsCopyable;
2376 bool tableGeometryIsActive, tableGeometryIsCopyable;
2377 m_dockFittingWindow->getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
2378 m_dockGeometryWindow->getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
2380 if (tableFittingIsActive || tableGeometryIsActive) {
2389 ScaleBarAxisPointsUnite scaleBarAxisPoints;
2392 GraphicsItemsExtractor graphicsItemsExtractor;
2393 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
2394 QStringList pointIdentifiers = scaleBarAxisPoints.
unite (m_cmdMediator,
2397 CmdDelete *cmd =
new CmdDelete (*
this,
2398 m_cmdMediator->document(),
2400 m_digitizeStateContext->appendNewCmd (m_cmdMediator,
2405void MainWindow::slotEditMenu ()
2409 m_actionEditPasteAsNew->setEnabled (!QApplication::clipboard()->image().isNull());
2410 m_actionEditPasteAsNewAdvanced->setEnabled (!QApplication::clipboard()->image().isNull());
2413void MainWindow::slotEditPaste ()
2417 QList<QPoint> points;
2418 QList<double> ordinals;
2420 MimePointsImport mimePointsImport;
2425 CmdAddPointsGraph *cmd =
new CmdAddPointsGraph (*
this,
2426 m_cmdMediator->document(),
2427 m_cmbCurve->currentText (),
2430 m_digitizeStateContext->appendNewCmd (m_cmdMediator,
2434void MainWindow::slotEditPasteAsNew ()
2438 filePaste (IMPORT_TYPE_SIMPLE);
2441void MainWindow::slotEditPasteAsNewAdvanced ()
2445 filePaste (IMPORT_TYPE_ADVANCED);
2448void MainWindow::slotFileClose()
2456 m_transformationStateContext->triggerStateTransition(m_isGnuplot,
2464 m_digitizeStateContext->requestImmediateStateTransition (m_cmdMediator,
2468 if (m_fittingCurve !=
nullptr) {
2469 m_scene->removeItem (m_fittingCurve);
2470 m_fittingCurve =
nullptr;
2474 m_scene->resetOnLoad ();
2477 m_backgroundStateContext->close ();
2480 m_scene->setSceneRect (QRectF (0, 0, 1, 1));
2483 m_dockFittingWindow->clear ();
2486 m_dockGeometryWindow->clear ();
2489 delete m_cmdMediator;
2492 m_cmdMediator =
nullptr;
2497 m_gridLines.clear();
2498 m_guidelines.clear();
2503void MainWindow::slotFileExport ()
2507 if (m_transformation.transformIsDefined()) {
2509 MainDirectoryPersist directoryPersist;
2510 ExportToFile exportStrategy;
2513 if (m_isExportOnly) {
2514 fileName = fileNameForExportOnly ();
2517 QString filter = QString (
"%1;;%2;;All files (*.*)")
2522 QString defaultFileName = QString (
"%1/%2.%3")
2524 .arg (m_currentFile)
2527 QString filterCsv = exportStrategy.
filterCsv ();
2529 fileName = dlg.getSaveFileName (
this,
2536 if (!fileName.isEmpty ()) {
2539 fileExport(fileName,
2543 DlgRequiresTransform dlg (
"Export");
2548void MainWindow::slotFileImport ()
2552 fileImportWithPrompts (IMPORT_TYPE_SIMPLE);
2555void MainWindow::slotFileImportAdvanced ()
2559 fileImportWithPrompts (IMPORT_TYPE_ADVANCED);
2562void MainWindow::slotFileImportDraggedImage(QImage image)
2569 IMPORT_TYPE_SIMPLE);
2572void MainWindow::slotFileImportDraggedImageUrl(QUrl url)
2574 LOG4CPP_INFO_S ((*
mainCat)) <<
"MainWindow::slotFileImportDraggedImageUrl url=" << url.toString ().toLatin1 ().data ();
2578 UrlDirty urlDirty (url);
2579 m_loadImageFromUrl->startLoadImage (urlDirty);
2582void MainWindow::slotFileImportImage(QString fileName, QImage image)
2584 LOG4CPP_INFO_S ((*
mainCat)) <<
"MainWindow::slotFileImportImage fileName=" << fileName.toLatin1 ().data ();
2587 loadImage (fileName,
2589 IMPORT_TYPE_SIMPLE);
2592void MainWindow::slotFileImportImageReplace ()
2596 fileImportWithPrompts (IMPORT_TYPE_IMAGE_REPLACE);
2599void MainWindow::slotFileOpen()
2607 QString filter = QString (
"%1 (*.%2);; All Files (*.*)")
2608 .arg (ENGAUGE_FILENAME_DESCRIPTION)
2611 MainDirectoryPersist directoryPersist;
2612 QString fileName = QFileDialog::getOpenFileName (
this,
2613 tr(
"Open Document"),
2616 if (!fileName.isEmpty ()) {
2619 loadDocumentFile (fileName);
2625void MainWindow::slotFileOpenDraggedDigFile (QString fileName)
2629 loadDocumentFile (fileName);
2632void MainWindow::slotFilePrint()
2636 QPrinter printer (QPrinter::HighResolution);
2637 QPrintDialog dlg (&printer,
this);
2638 if (dlg.exec() == QDialog::Accepted) {
2639 QPainter painter (&printer);
2640 m_view->render (&painter);
2645bool MainWindow::slotFileSave()
2649 if (m_engaugeFile.isEmpty()) {
2650 return slotFileSaveAs();
2652 return saveDocumentFile (m_engaugeFile);
2656bool MainWindow::slotFileSaveAs()
2661 QString filenameDefault = m_currentFile;
2663 filenameDefault = QString (
"%1.%2")
2664 .arg (m_currentFile)
2668 if (!m_engaugeFile.isEmpty()) {
2669 filenameDefault = m_engaugeFile;
2672 QString filterDigitizer = QString (
"%1 (*.%2)")
2673 .arg (ENGAUGE_FILENAME_DESCRIPTION)
2675 QString filterAll (
"All files (*. *)");
2677 QStringList filters;
2678 filters << filterDigitizer;
2679 filters << filterAll;
2681 MainDirectoryPersist directoryPersist;
2683 QFileDialog dlg(
this);
2684 dlg.setFileMode (QFileDialog::AnyFile);
2685 dlg.selectNameFilter (filterDigitizer);
2686 dlg.setNameFilters (filters);
2687#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
2689 dlg.setWindowModality(Qt::WindowModal);
2691 dlg.setAcceptMode(QFileDialog::AcceptSave);
2692 dlg.selectFile(filenameDefault);
2696 QStringList files = dlg.selectedFiles();
2698 return saveDocumentFile(files.at(0));
2704void MainWindow::slotFittingWindowClosed()
2708 m_actionViewFittingWindow->setChecked (
false);
2719 <<
" order=" << fittingCurveCoef.size() - 1;
2721 if (m_fittingCurve !=
nullptr) {
2722 m_scene->removeItem (m_fittingCurve);
2723 delete m_fittingCurve;
2726 m_fittingCurve =
new FittingCurve (fittingCurveCoef,
2732 m_fittingCurve->setVisible (m_actionViewFittingWindow->isChecked ());
2733 m_scene->addItem (m_fittingCurve);
2736void MainWindow::slotGeometryWindowClosed()
2740 m_actionViewGeometryWindow->setChecked (
false);
2743void MainWindow::slotGuidelineDragged(QString identifierReplaced,
2745 bool draggedOffscreen,
2751 m_guidelines.createReplacementGuideline (identifierReplaced,
2753 guidelineStateForReplacement);
2756 GuidelineDragCommandFactory cmdFactory;
2759 m_cmdMediator->document(),
2761 m_cmdMediator->document().modelGuideline (),
2765 m_cmdMediator->push (cmd);
2768void MainWindow::slotHelpAbout()
2772 DlgAbout dlg (*
this);
2776void MainWindow::slotHelpTutorial()
2780 m_tutorialDlg->show ();
2781 m_tutorialDlg->exec ();
2784void MainWindow::slotKeyPress (Qt::Key key,
2785 bool atLeastOneSelectedItem)
2788 <<
" key=" << QKeySequence (key).toString().toLatin1 ().data ()
2789 <<
" atLeastOneSelectedItem=" << (atLeastOneSelectedItem ?
"true" :
"false");
2791 m_digitizeStateContext->handleKeyPress (m_cmdMediator,
2793 atLeastOneSelectedItem);
2796void MainWindow::slotLoadStartupFiles ()
2802 QString fileName = m_loadStartupFiles.front();
2803 m_loadStartupFiles.pop_front();
2806 LoadFileInfo loadFileInfo;
2809 loadDocumentFile (fileName);
2813 fileImport (fileName,
2814 IMPORT_TYPE_SIMPLE);
2818 if (m_loadStartupFiles.count() > 0) {
2822 QProcess::startDetached (QCoreApplication::applicationFilePath(),
2823 m_commandLineWithoutLoadStartupFiles + m_loadStartupFiles);
2827void MainWindow::slotMouseMove (QPointF pos)
2832 if (m_cmdMediator !=
nullptr) {
2835 QString coordsScreen, coordsGraph, resolutionGraph;
2836 m_transformation.coordTextForStatusBar (pos,
2843 m_statusBar->setCoordinates (coordsScreen,
2850 m_digitizeStateContext->handleMouseMove (m_cmdMediator,
2855void MainWindow::slotMousePress (QPointF pos)
2859 m_scene->resetPositionHasChangedFlags();
2861 m_digitizeStateContext->handleMousePress (m_cmdMediator,
2865void MainWindow::slotMouseRelease (QPointF pos)
2869 if (pos.x() < 0 || pos.y() < 0) {
2878 m_digitizeStateContext->handleMouseRelease (m_cmdMediator,
2883void MainWindow::slotRecentFileAction ()
2887 QAction *action = qobject_cast<QAction*>(sender ());
2890 QString fileName = action->data().toString();
2891 loadDocumentFile (fileName);
2895void MainWindow::slotRecentFileClear ()
2899 QStringList emptyList;
2905 updateRecentFileList();
2908void MainWindow::slotRedoTextChanged (
const QString &text)
2912 QString completeText (
"Redo");
2913 if (!text.isEmpty ()) {
2914 completeText += QString (
" \"%1\"").arg (text);
2916 m_actionEditRedo->setText (completeText);
2919void MainWindow::slotSettingsAxesChecker ()
2923 m_dlgSettingsAxesChecker->load (*m_cmdMediator);
2924 m_dlgSettingsAxesChecker->show ();
2927void MainWindow::slotSettingsColorFilter ()
2931 m_dlgSettingsColorFilter->load (*m_cmdMediator);
2932 m_dlgSettingsColorFilter->show ();
2935void MainWindow::slotSettingsCoords ()
2939 m_dlgSettingsCoords->load (*m_cmdMediator);
2940 m_dlgSettingsCoords->show ();
2943void MainWindow::slotSettingsCurveList ()
2947 m_dlgSettingsCurveList->load (*m_cmdMediator);
2948 m_dlgSettingsCurveList->show ();
2951void MainWindow::slotSettingsCurveProperties ()
2955 m_dlgSettingsCurveProperties->load (*m_cmdMediator);
2957 m_dlgSettingsCurveProperties->show ();
2960void MainWindow::slotSettingsDigitizeCurve ()
2964 m_dlgSettingsDigitizeCurve->load (*m_cmdMediator);
2965 m_dlgSettingsDigitizeCurve->show ();
2968void MainWindow::slotSettingsExportFormat ()
2973 m_dlgSettingsExportFormat->load (*m_cmdMediator);
2974 m_dlgSettingsExportFormat->show ();
2976 DlgRequiresTransform dlg (
"Export settings");
2981void MainWindow::slotSettingsGeneral ()
2985 m_dlgSettingsGeneral->load (*m_cmdMediator);
2986 m_dlgSettingsGeneral->show ();
2989void MainWindow::slotSettingsGridDisplay()
2993 m_dlgSettingsGridDisplay->load (*m_cmdMediator);
2994 m_dlgSettingsGridDisplay->show ();
2997void MainWindow::slotSettingsGridRemoval ()
3001 m_dlgSettingsGridRemoval->load (*m_cmdMediator);
3002 m_dlgSettingsGridRemoval->show ();
3005void MainWindow::slotSettingsGuideline ()
3009 m_dlgSettingsGuideline->load (*m_cmdMediator);
3010 m_dlgSettingsGuideline->show ();
3013void MainWindow::slotSettingsPointMatch ()
3017 m_dlgSettingsPointMatch->load (*m_cmdMediator);
3018 m_dlgSettingsPointMatch->show ();
3021void MainWindow::slotSettingsSegments ()
3025 m_dlgSettingsSegments->load (*m_cmdMediator);
3026 m_dlgSettingsSegments->show ();
3029void MainWindow::slotTableStatusChange ()
3038void MainWindow::slotSettingsMainWindow ()
3042 m_dlgSettingsMainWindow->loadMainWindowModel (*m_cmdMediator,
3044 m_dlgSettingsMainWindow->show ();
3047void MainWindow::slotTimeoutChecklistGuideWizard ()
3052 ChecklistGuideWizard *wizard =
new ChecklistGuideWizard (*
this,
3053 m_cmdMediator->document().coordSystemCount());
3054 if (wizard->exec() == QDialog::Accepted) {
3056 for (
CoordSystemIndex coordSystemIndex = 0; coordSystemIndex < m_cmdMediator->document().coordSystemCount(); coordSystemIndex++) {
3059 m_dockChecklistGuide->setTemplateHtml (wizard->
templateHtml(coordSystemIndex),
3063 CurvesGraphs curvesGraphs;
3066 m_cmdMediator->document().setCurvesGraphs(curvesGraphs);
3070 m_actionViewChecklistGuideWindow->setChecked (
true);
3073 loadCurveListFromCmdMediator();
3076 loadCoordSystemListFromCmdMediator();
3082void MainWindow::slotTimeoutRegressionErrorReport ()
3085 <<
" cmdStackIndex=" << m_cmdMediator->index()
3086 <<
" cmdStackCount=" << m_cmdMediator->count();
3088 if (m_cmdStackShadow->canRedo()) {
3091 QDir::setCurrent (m_startupDirectory);
3093 m_cmdStackShadow->slotRedo();
3096 QDir::setCurrent (m_startupDirectory);
3100#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
3101 exportAllCoordinateSystemsAfterRegressionTests ();
3105 m_cmdMediator->setClean();
3111void MainWindow::slotTimeoutRegressionFileCmdScript ()
3115 if (m_fileCmdScript->canRedo()) {
3118 QDir::setCurrent (m_startupDirectory);
3120 m_fileCmdScript->redo(*
this);
3123 QDir::setCurrent (m_startupDirectory);
3128 if (m_cmdMediator !=
nullptr) {
3130#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
3131 exportAllCoordinateSystemsAfterRegressionTests ();
3135 m_cmdMediator->setClean();
3145void MainWindow::slotUndoTextChanged (
const QString &text)
3149 QString completeText (
"Undo");
3150 if (!text.isEmpty ()) {
3151 completeText += QString (
" \"%1\"").arg (text);
3153 m_actionEditUndo->setText (completeText);
3156void MainWindow::slotViewGridLines ()
3163void MainWindow::slotViewGroupBackground(QAction *action)
3169 int indexBackground;
3170 if (action == m_actionViewBackgroundNone) {
3173 }
else if (action == m_actionViewBackgroundOriginal) {
3176 }
else if (action == m_actionViewBackgroundFiltered) {
3188 m_cmbBackground->setCurrentIndex (indexBackground);
3189 m_backgroundStateContext->setBackgroundImage (backgroundImage);
3192void MainWindow::slotViewGroupCurves(QAction * )
3196 updateViewedCurves ();
3199void MainWindow::slotViewGroupStatus(QAction *action)
3205 if (action == m_actionStatusNever) {
3207 }
else if (action == m_actionStatusTemporary) {
3214void MainWindow::slotViewGuidelines ()
3221void MainWindow::slotViewToolBarBackground ()
3225 if (m_actionViewBackgroundToolBar->isChecked ()) {
3226 m_toolBackground->show();
3228 m_toolBackground->hide();
3232void MainWindow::slotViewToolBarCoordSystem ()
3236 if (m_actionViewCoordSystemToolBar->isChecked ()) {
3237 m_toolCoordSystem->show();
3239 m_toolCoordSystem->hide();
3243void MainWindow::slotViewToolBarDigitize ()
3247 if (m_actionViewDigitizeToolBar->isChecked ()) {
3248 m_toolDigitize->show();
3250 m_toolDigitize->hide();
3254void MainWindow::slotViewToolBarSettingsViews ()
3258 if (m_actionViewSettingsViewsToolBar->isChecked ()) {
3259 m_toolSettingsViews->show();
3261 m_toolSettingsViews->hide();
3265void MainWindow::slotViewToolTips ()
3272void MainWindow::slotViewWindowChecklistGuide ()
3276 if (m_actionViewChecklistGuideWindow->isChecked ()) {
3277 m_dockChecklistGuide->show();
3279 m_dockChecklistGuide->hide();
3283void MainWindow::slotViewWindowFitting()
3287 if (m_actionViewFittingWindow->isChecked()) {
3288 m_dockFittingWindow->show ();
3289 if (m_fittingCurve !=
nullptr) {
3290 m_fittingCurve->setVisible (
true);
3293 m_dockFittingWindow->hide ();
3294 if (m_fittingCurve !=
nullptr) {
3295 m_fittingCurve->setVisible (
false);
3300void MainWindow::slotViewWindowGeometry ()
3304 if (m_actionViewGeometryWindow->isChecked ()) {
3305 m_dockGeometryWindow->show();
3307 m_dockGeometryWindow->hide();
3311void MainWindow::slotViewZoom (
int zoom)
3317 m_zoomMapToAction [zoomFactor]->setChecked (
true);
3318 slotViewZoomFactor (
static_cast<ZoomFactor> (zoom));
3321void MainWindow::slotViewZoomFactor (
ZoomFactor zoomFactor)
3326 m_backgroundStateContext->fitInView (*m_view);
3329 ZoomTransition zoomTransition;
3330 double factor = zoomTransition.
mapToFactor (zoomFactor);
3332 QTransform transform;
3333 transform.scale (factor, factor);
3334 m_view->setTransform (transform);
3340void MainWindow::slotViewZoomFactorInt (
int zoom)
3344 slotViewZoomFactor (
static_cast<ZoomFactor> (zoom));
3347void MainWindow::slotViewZoomIn ()
3351 ZoomTransition zoomTransition;
3353 m_view->transform ().m11 (),
3354 m_view->transform ().m22 (),
3355 m_actionZoomFill->isChecked ());
3356 setNonFillZoomFactor (zoomFactorNew);
3360void MainWindow::slotViewZoomInFromWheelEvent ()
3368 m_view->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
3373 m_view->setTransformationAnchor(QGraphicsView::NoAnchor);
3377void MainWindow::slotViewZoomOut ()
3382 ZoomTransition zoomTransition;
3384 m_view->transform ().m11 (),
3385 m_view->transform ().m22 (),
3386 m_actionZoomFill->isChecked ());
3387 setNonFillZoomFactor (zoomFactorNew);
3390void MainWindow::slotViewZoomOutFromWheelEvent ()
3398 m_view->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
3403 m_view->setTransformationAnchor(QGraphicsView::NoAnchor);
3407void MainWindow::startRegressionDropTest (
const QStringList &loadStartupFiles)
3416 connect (
this, SIGNAL (
signalDropRegression (QString)), m_view, SLOT (slotDropRegression (QString)));
3418 for (
int counter = 0; counter < loadStartupFiles.size (); counter++) {
3419 QString filenameDrop = loadStartupFiles.at (counter);
3424 QSize siz = m_view->size();
3426 QString filenameCsv;
3427 if (filenameDrop.startsWith (
"http")) {
3431 filenameCsv =
"../test/drag_and_drop_http.csv_actual_1";
3436 filenameCsv = QString (
"%1_%2")
3437 .arg (exportRegressionFilenameFromInputFilename (filenameDrop))
3441 QFile file (filenameCsv);
3442 file.open (QIODevice::WriteOnly);
3443 QTextStream str (&file);
3444 str << siz.width() <<
"x" << siz.height() <<
"\n";
3451void MainWindow::startRegressionTestErrorReport(
const QString ®ressionInputFile)
3462 m_regressionFile = exportRegressionFilenameFromInputFilename (regressionInputFile);
3464 delete m_timerRegressionErrorReport;
3465 m_timerRegressionErrorReport =
new QTimer();
3466 m_timerRegressionErrorReport->setSingleShot(
false);
3467 connect (m_timerRegressionErrorReport, SIGNAL (timeout()),
this, SLOT (slotTimeoutRegressionErrorReport()));
3472void MainWindow::startRegressionTestFileCmdScript()
3476 delete m_timerRegressionFileCmdScript;
3477 m_timerRegressionFileCmdScript =
new QTimer();
3478 m_timerRegressionFileCmdScript->setSingleShot(
false);
3479 connect (m_timerRegressionFileCmdScript, SIGNAL (timeout()),
this, SLOT (slotTimeoutRegressionFileCmdScript()));
3486 return m_transformation;
3502 updateAfterCommandStatusBarCoords ();
3504 updateHighlightOpacity ();
3507 m_digitizeStateContext->updateAfterPointAddition ();
3510 updateChecklistGuide ();
3511 updateFittingWindow ();
3512 updateGeometryWindow();
3517 writeCheckpointToLogFile ();
3519 docScrub.
check (*
this,
3520 m_cmdMediator->document ());
3524 m_view->setFocus ();
3527void MainWindow::updateAfterCommandStatusBarCoords ()
3534 const QPoint HACK_SO_GRAPH_COORDINATE_MATCHES_INPUT (1, 1);
3538 updateTransformationAndItsDependencies();
3541 if (!m_transformationBefore.transformIsDefined() && m_transformation.
transformIsDefined()) {
3550 }
else if (m_transformationBefore.transformIsDefined() && !m_transformation.transformIsDefined()) {
3553 m_transformationStateContext->triggerStateTransition(m_isGnuplot,
3559 }
else if (m_transformation.transformIsDefined() && (m_transformationBefore != m_transformation)) {
3563 m_transformationStateContext->updateAxesChecker(*m_cmdMediator,
3568 QPoint posLocal = m_view->mapFromGlobal (QCursor::pos ()) - HACK_SO_GRAPH_COORDINATE_MATCHES_INPUT;
3569 QPointF posScreen = m_view->mapToScene (posLocal);
3571 slotMouseMove (posScreen);
3581void MainWindow::updateChecklistGuide ()
3585 m_dockChecklistGuide->
update (*m_cmdMediator,
3586 m_isDocumentExported);
3589void MainWindow::updateControls ()
3592 <<
" selectedItems=" << m_scene->selectedItems().count();
3594 m_cmbBackground->setEnabled (!m_currentFile.isEmpty ());
3596 m_actionImportImageReplace->setEnabled (m_cmdMediator !=
nullptr);
3597#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
3598 m_menuFileOpenRecent->setEnabled ((m_actionRecentFiles.count () > 0) &&
3599 (m_actionRecentFiles.at(0)->isVisible ()));
3601 m_actionClose->setEnabled (!m_currentFile.isEmpty ());
3602 m_actionSave->setEnabled (!m_currentFile.isEmpty ());
3603 m_actionSaveAs->setEnabled (!m_currentFile.isEmpty ());
3604 m_actionExport->setEnabled (!m_currentFile.isEmpty ());
3605 m_actionPrint->setEnabled (!m_currentFile.isEmpty ());
3607 if (m_cmdMediator ==
nullptr) {
3608 m_actionEditUndo->setEnabled (
false);
3609 m_actionEditRedo->setEnabled (
false);
3611 m_actionEditUndo->setEnabled (m_cmdMediator->canUndo ());
3612 m_actionEditRedo->setEnabled (m_cmdMediator->canRedo () || m_cmdStackShadow->canRedo ());
3614 bool tableFittingIsActive, tableFittingIsCopyable;
3615 bool tableGeometryIsActive, tableGeometryIsCopyable;
3616 m_dockFittingWindow->getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
3617 m_dockGeometryWindow->getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
3618 m_actionEditCut->setEnabled (!tableFittingIsActive &&
3619 !tableGeometryIsActive &&
3620 m_scene->selectedItems().count () > 0);
3621 m_actionEditCopy->setEnabled ((!tableFittingIsActive && !tableGeometryIsActive && m_scene->selectedItems().count () > 0) ||
3622 (tableFittingIsActive && tableFittingIsCopyable) ||
3623 (tableGeometryIsActive && tableGeometryIsCopyable));
3624 m_actionEditPaste->setEnabled (m_digitizeStateContext->canPaste (m_transformation,
3626 m_actionEditDelete->setEnabled (!tableFittingIsActive &&
3627 !tableGeometryIsActive &&
3628 m_scene->selectedItems().count () > 0);
3631 m_actionDigitizeAxis->setEnabled (modeGraph ());
3632 m_actionDigitizeScale->setEnabled (
modeMap ());
3633 m_actionDigitizeCurve->setEnabled (!m_currentFile.isEmpty ());
3634 m_actionDigitizeGuideline->setEnabled (m_transformation.transformIsDefined ());
3635 m_actionDigitizePointMatch->setEnabled (!m_currentFile.isEmpty ());
3636 m_actionDigitizeColorPicker->setEnabled (!m_currentFile.isEmpty ());
3637 m_actionDigitizeSegment->setEnabled (!m_currentFile.isEmpty ());
3638 m_actionDigitizeSelect->setEnabled (!m_currentFile.isEmpty ());
3639 if (m_transformation.transformIsDefined()) {
3640 m_actionViewGridLines->setEnabled (
true);
3641 m_actionViewGuidelines->setEnabled (
true);
3643 m_actionViewGridLines->setEnabled (
false);
3644 m_actionViewGridLines->setChecked (
false);
3645 m_actionViewGuidelines->setEnabled (
false);
3647 m_actionViewBackgroundToolBar->setEnabled (!m_currentFile.isEmpty());
3648 m_actionViewDigitizeToolBar->setEnabled (!m_currentFile.isEmpty ());
3649 m_actionViewSettingsViewsToolBar->setEnabled (!m_currentFile.isEmpty ());
3650 m_actionViewCoordSystemToolBar->setEnabled (!m_currentFile.isEmpty ());
3651 m_actionViewChecklistGuideWindow->setEnabled (!m_dockChecklistGuide->browserIsEmpty());
3653 m_actionSettingsCoords->setEnabled (!m_currentFile.isEmpty ());
3654 m_actionSettingsCurveList->setEnabled (!m_currentFile.isEmpty ());
3655 m_actionSettingsCurveProperties->setEnabled (!m_currentFile.isEmpty ());
3656 m_actionSettingsDigitizeCurve->setEnabled (!m_currentFile.isEmpty ());
3657 m_actionSettingsExport->setEnabled (!m_currentFile.isEmpty ());
3658 m_actionSettingsColorFilter->setEnabled (!m_currentFile.isEmpty ());
3659 m_actionSettingsAxesChecker->setEnabled (!m_currentFile.isEmpty ());
3660 m_actionSettingsGridDisplay->setEnabled (!m_currentFile.isEmpty () && m_transformation.transformIsDefined());
3661 m_actionSettingsGridRemoval->setEnabled (!m_currentFile.isEmpty ());
3662 m_actionSettingsGuideline->setEnabled (!m_currentFile.isEmpty () && m_transformation.transformIsDefined());
3663 m_actionSettingsPointMatch->setEnabled (!m_currentFile.isEmpty ());
3664 m_actionSettingsSegments->setEnabled (!m_currentFile.isEmpty ());
3665 m_actionSettingsGeneral->setEnabled (!m_currentFile.isEmpty ());
3667 m_groupBackground->setEnabled (!m_currentFile.isEmpty ());
3668 m_groupCurves->setEnabled (!m_currentFile.isEmpty ());
3669 m_groupZoom->setEnabled (!m_currentFile.isEmpty ());
3671 m_actionZoomIn->setEnabled (!m_currentFile.isEmpty ());
3672 m_actionZoomOut->setEnabled (!m_currentFile.isEmpty ());
3680 if ((
CoordSystemIndex) m_cmbCoordSystem->currentIndex() != coordSystemIndex) {
3681 m_cmbCoordSystem->setCurrentIndex (coordSystemIndex);
3686 m_cmdMediator->document().setCoordSystemIndex (coordSystemIndex);
3687 loadCurveListFromCmdMediator ();
3689 updateTransformationAndItsDependencies();
3691 loadGuidelinesFromCmdMediator();
3694 m_transformationStateContext->updateAxesChecker (*m_cmdMediator,
3706 m_actionDigitizeAxis->setChecked(
true);
3711 m_actionDigitizeColorPicker->setChecked(
true);
3712 slotDigitizeColorPicker();
3716 m_actionDigitizeCurve->setChecked(
true);
3717 slotDigitizeCurve();
3724 m_actionDigitizePointMatch->setChecked(
true);
3725 slotDigitizePointMatch();
3729 m_actionDigitizeScale->setChecked(
true);
3730 slotDigitizeScale();
3734 m_actionDigitizeSegment->setChecked(
true);
3735 slotDigitizeSegment();
3739 m_actionDigitizeSelect->setChecked(
true);
3740 slotDigitizeSelect();
3749void MainWindow::updateFittingWindow ()
3753 if (m_cmdMediator !=
nullptr &&
3754 m_cmbCurve !=
nullptr) {
3757 m_dockFittingWindow->
update (*m_cmdMediator,
3759 m_cmbCurve->currentText (),
3764void MainWindow::updateGeometryWindow ()
3768 if (m_cmdMediator !=
nullptr &&
3769 m_cmbCurve !=
nullptr) {
3772 m_dockGeometryWindow->update (*m_cmdMediator,
3774 m_cmbCurve->currentText (),
3783 m_scene->updateGraphicsLinesToMatchGraphicsPoints(m_cmdMediator->document().modelCurveStyles(),
3787void MainWindow::updateGridLines ()
3792 m_gridLines.
clear ();
3803 m_gridLines.
setVisible (m_actionViewGridLines->isChecked());
3806void MainWindow::updateGuidelines ()
3811 m_guidelines.clear ();
3814 m_guidelines.setModelGuideline (m_cmdMediator->document().modelCoords().coordsType(),
3815 m_cmdMediator->document().modelGuideline());
3817 m_guidelines.handleGuidelineMode (m_actionViewGuidelines->isChecked(),
3818 !m_digitizeStateContext->guidelinesAreSelectable());
3821void MainWindow::updateHighlightOpacity ()
3823 if (m_cmdMediator !=
nullptr) {
3827 m_scene->updateAfterCommand (*m_cmdMediator,
3828 m_modelMainWindow.highlightOpacity(),
3829 m_dockGeometryWindow,
3834void MainWindow::updateRecentFileList()
3838#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
3843 unsigned int count = unsigned (recentFilePaths.size());
3850 for (i = 0; i < signed (count); i++) {
3851 QString strippedName = QFileInfo (recentFilePaths.at(i)).fileName();
3852 m_actionRecentFiles.at (i)->setText (strippedName);
3853 m_actionRecentFiles.at (i)->setData (recentFilePaths.at (i));
3854 m_actionRecentFiles.at (i)->setVisible (
true);
3859 m_actionRecentFiles.at (i)->setVisible (
false);
3868 m_cmdMediator->document().setModelAxesChecker(modelAxesChecker);
3869 if (m_transformation.transformIsDefined()) {
3870 m_transformationStateContext->triggerStateTransition(m_isGnuplot,
3874 m_cmbCurve->currentText());
3876 m_transformationStateContext->triggerStateTransition(m_isGnuplot,
3880 m_cmbCurve->currentText());
3888 m_cmdMediator->document().setModelColorFilter(modelColorFilter);
3889 m_backgroundStateContext->updateColorFilter (m_isGnuplot,
3891 m_cmdMediator->document().modelGridRemoval(),
3893 m_cmbCurve->currentText());
3894 m_digitizeStateContext->handleCurveChange (m_cmdMediator);
3902 m_cmdMediator->document().setModelCoords(modelCoords);
3909 m_cmdMediator->document().setCurvesGraphs (curvesGraphs);
3910 loadCurveListFromCmdMediator();
3918 m_scene->updateCurveStyles(modelCurveStyles);
3919 m_cmdMediator->document().setModelCurveStyles(modelCurveStyles);
3927 m_cmdMediator->document().setModelDigitizeCurve(modelDigitizeCurve);
3928 m_digitizeStateContext->updateModelDigitizeCurve (m_cmdMediator,
3929 modelDigitizeCurve);
3936 m_cmdMediator->document().setModelExport (modelExport);
3943 m_cmdMediator->document().setModelGeneral(modelGeneral);
3950 m_cmdMediator->document().setModelGridDisplay(modelGridDisplay);
3958 m_cmdMediator->document().setModelGridRemoval(modelGridRemoval);
3965 m_cmdMediator->document().setModelGuideline (modelGuideline);
3966 loadGuidelinesFromCmdMediator();
3976 m_actionZoomIn->setShortcut (tr (
""));
3977 m_actionZoomOut->setShortcut (tr (
""));
3981 m_actionZoomIn->setShortcut (tr (
"+"));
3982 m_actionZoomOut->setShortcut (tr (
"-"));
3986 if ((m_scene !=
nullptr) &&
3987 (m_cmdMediator !=
nullptr)) {
3988 m_scene->updateCurveStyles(m_cmdMediator->document().modelCurveStyles());
3991 updateHighlightOpacity();
3992 updateWindowTitle();
3993 updateFittingWindow();
3994 updateGeometryWindow();
3995 m_guidelines.updateColor ();
4010 m_cmdMediator->document().setModelPointMatch(modelPointMatch);
4017 m_digitizeStateContext->updateModelSegments(modelSegments);
4018 m_cmdMediator->document().setModelSegments(modelSegments);
4019 m_digitizeStateContext->handleCurveChange (m_cmdMediator);
4022void MainWindow::updateSmallDialogs ()
4040void MainWindow::updateTransformationAndItsDependencies()
4042 m_transformation.update (!m_currentFile.isEmpty (),
4047 m_backgroundStateContext->setCurveSelected (m_isGnuplot,
4049 m_cmdMediator->document().modelGridRemoval(),
4050 m_cmdMediator->document().modelColorFilter(),
4051 m_cmbCurve->currentText ());
4057 m_guidelines.updateWithLatestTransformation ();
4060void MainWindow::updateViewedCurves ()
4064 if (m_actionViewCurvesAll->isChecked ()) {
4066 m_scene->showCurves (
true,
true);
4068 }
else if (m_actionViewCurvesSelected->isChecked ()) {
4072 }
else if (m_actionViewCurvesNone->isChecked ()) {
4074 m_scene->showCurves (
false);
4086 QString activeCurve = m_digitizeStateContext->activeCurve ();
4093 if (activeCurve.isEmpty ()) {
4095 m_viewPointStyle->unsetPointStyle ();
4096 m_viewSegmentFilter->unsetColorFilterSettings ();
4101 PointStyle pointStyle = m_cmdMediator->document().modelCurveStyles().curveStyle(activeCurve).pointStyle();
4102 m_viewPointStyle->setPointStyle (pointStyle);
4104 ColorFilterSettings colorFilterSettings = m_cmdMediator->document().modelColorFilter().colorFilterSettings(activeCurve);
4105 m_viewSegmentFilter->setColorFilterSettings (colorFilterSettings,
4106 m_cmdMediator->pixmap ());
4111void MainWindow::updateWindowTitle ()
4115 const QString PLACEHOLDER (
"[*]");
4117 QString title = QString (
"%1 %2")
4118 .arg (tr (
"Engauge Digitizer"))
4121 QString fileNameMaybeStripped;
4122 if (!m_currentFileWithPathAndFileExtension.isEmpty()) {
4124 QFileInfo fileInfo (m_currentFileWithPathAndFileExtension);
4131 fileNameMaybeStripped = fileInfo.completeBaseName();
4135 fileNameMaybeStripped = m_currentFileWithPathAndFileExtension;
4139 title += QString (
": %1")
4140 .arg (fileNameMaybeStripped);
4145 title += PLACEHOLDER;
4147 setWindowTitle (title);
4162void MainWindow::writeCheckpointToLogFile ()
4165 QString checkpointDoc;
4166 QTextStream strDoc (&checkpointDoc);
4171 QString checkpointScene;
4172 QTextStream strScene (&checkpointScene);
4180 <<
"--------------DOCUMENT CHECKPOINT START----------" <<
"\n"
4181 << checkpointDoc.toLatin1().data()
4182 <<
"---------------DOCUMENT CHECKPOINT END-----------" <<
"\n"
4183 <<
"----------------SCENE CHECKPOINT START-----------" <<
"\n"
4184 << checkpointScene.toLatin1().data()
4185 <<
"-----------------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
@ DIGITIZE_STATE_GUIDELINE
@ 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.
const ImportCropping DEFAULT_IMPORT_CROPPING
LoadViews
Options for loading view states.
@ LOAD_VIEWS_USE_DOCUMENT
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 LoadViews DEFAULT_LOAD_VIEWS
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_LOAD_VIEWS
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.
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.
void update(const CmdMediator &cmdMediator, bool documentIsExported)
Update using current CmdMediator/Document state.
Command for adding one X/T Guideline value.
Command for adding one Y/R Guideline value.
Color filter parameters for one curve. For a class, this is handled the same as LineStyle and PointSt...
static QTextStream & endl(QTextStream &stream)
End of line.
unsigned filecrc(const QString &filename) const
Compute the checksum using data in file.
void create(MainWindow &mw)
Create QAction facade.
Model for DlgSettingsCurveProperties and CmdSettingsCurveProperties.
Container for all graph curves. The axes point curve is external to this class.
bool guidelinesAreSelectable() const
Enable/disable guidelines according to state.
Dialog for saving error report for later transmission to the developers.
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 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 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 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 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 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 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.
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.
Model for managing the coordinate values corresponding Guidelines.
bool gridlines() const
Get method for gridlines.
bool guidelines() const
Get method for guidelines.
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 printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
DocumentModelGuideline modelGuideline() const
Get method for DocumentModelGuideline.
DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
DocumentModelGridDisplay modelGridDisplay() const
Get method for DocumentModelGridDisplay.
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.
virtual void update(const CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow, const QString &curveSelected, const Transformation &transformation)
Populate the table with the specified Curve.
Add point and line handling to generic QGraphicsScene.
void printStream(QString indentation, QTextStream &str)
Debugging method that supports print method of this class and printStream method of some other class(...
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.
CmdAbstract * createAfterDrag(MainWindow &mainWindow, Document &document, double newValue, const DocumentModelGuideline &modelGuidelineDocument, const QString &identifier, bool draggedOffscreen)
Create delete or move Cmd.
This class contains all Guideline objects.
void handleGuidelineMode(bool visible, bool locked)
User toggled guideline mode.
QStringList fileExtensionsWithAsterisks() const
File extensions for use in file dialogs.
bool load(const QString &filename, QImage &image) const
Load image from jpeg2000 file.
bool loadsAsDigFile(const QString &urlString) const
Returns true if specified file name can be loaded as a DIG file.
static void bindToMainWindow(MainWindow *mainWindow)
Bind to MainWindow so this class can access the command stack.
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.
bool smallDialogs() const
Get method for small dialogs flag.
ZoomControl zoomControl() const
Get method for zoom control.
MainTitleBarFormat mainTitleBarFormat() const
Get method for MainWindow titlebar filename format.
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 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.
friend class CreateFacade
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.
DigitizeState digitizeState() const
Get DigitizeState. This should only be used to populate arguments in CmdAbstract constructor!
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 updateSettingsGuideline(const DocumentModelGuideline &modelGuideline)
Update with new guideline properties.
void updateSettingsCoords(const DocumentModelCoords &modelCoords)
Update with new coordinate properties.
GraphicsView & view()
View for the QImage and QGraphicsItems, without const.
void retrievePoints(const Transformation &transformation, QList< QPoint > &points, QList< double > &ordinals) const
Retrieve points from clipboard.
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.
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.
QStringList unite(CmdMediator *cmdMediator, const QStringList &pointIdentifiersIn) const
Add.
void triggerStateTransition(bool isGnuplot, TransformationState transformationState, CmdMediator &cmdMediator, const Transformation &transformation, const QString &selectedGraphCurve)
Trigger a state transition to be performed immediately.
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.
#define LOG4CPP_INFO_S(logger)
#define LOG4CPP_DEBUG_S(logger)
#define LOG4CPP_ERROR_S(logger)