7 #include "BackgroundImage.h"
8 #include "BackgroundStateContext.h"
9 #include "ChecklistGuide.h"
10 #include "ChecklistGuideWizard.h"
11 #include "CmdAddPointsGraph.h"
14 #include "CmdDelete.h"
15 #include "CmdMediator.h"
16 #include "CmdSelectCoordSystem.h"
17 #include "CmdStackShadow.h"
18 #include "ColorFilter.h"
19 #include "CreateFacade.h"
22 #include "DigitizeStateContext.h"
24 #include "DlgErrorReportLocal.h"
25 #include "DlgImportAdvanced.h"
26 #include "DlgRequiresTransform.h"
27 #include "DlgSettingsAxesChecker.h"
28 #include "DlgSettingsColorFilter.h"
29 #include "DlgSettingsCoords.h"
30 #include "DlgSettingsCurveList.h"
31 #include "DlgSettingsCurveProperties.h"
32 #include "DlgSettingsDigitizeCurve.h"
33 #include "DlgSettingsExportFormat.h"
34 #include "DlgSettingsGeneral.h"
35 #include "DlgSettingsGridDisplay.h"
36 #include "DlgSettingsGridRemoval.h"
37 #include "DlgSettingsMainWindow.h"
38 #include "DlgSettingsPointMatch.h"
39 #include "DlgSettingsSegments.h"
40 #include "DocumentScrub.h"
41 #include "DocumentSerialize.h"
42 #include "EngaugeAssert.h"
43 #include "EnumsToQt.h"
44 #include "ExportImageForRegression.h"
45 #include "ExportToFile.h"
46 #include "FileCmdScript.h"
47 #include "FittingCurve.h"
48 #include "FittingWindow.h"
49 #include "GeometryWindow.h"
51 #include "GraphicsItemsExtractor.h"
52 #include "GraphicsItemType.h"
53 #include "GraphicsScene.h"
54 #include "GraphicsView.h"
55 #include "GridLineFactory.h"
56 #include "GridLineLimiter.h"
57 #if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
58 #include "HelpWindow.h"
60 #include "ImportImageExtensions.h"
61 #ifdef ENGAUGE_JPEG2000
63 #endif // ENGAUGE_JPEG2000
64 #include "LoadFileInfo.h"
66 #include "LoadImageFromUrl.h"
69 #include "MainDirectoryPersist.h"
70 #include "MainTitleBarFormat.h"
71 #include "MainWindow.h"
72 #include "MimePointsImport.h"
74 #include "NetworkClient.h"
80 #include "PdfResolution.h"
82 #include <QApplication>
84 #include <QCloseEvent>
87 #include <QDesktopServices>
88 #include <QDockWidget>
89 #include <QDomDocument>
90 #include <QFileDialog>
92 #include <QImageReader>
94 #include <QKeySequence>
96 #include <QMessageBox>
97 #include <QMouseEvent>
98 #include <QPrintDialog>
101 #include <QPushButton>
103 #include <QSignalMapper>
104 #include <QTextStream>
105 #if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
110 #include <QToolButton>
111 #include "QtToString.h"
112 #include <QVBoxLayout>
113 #include <QWhatsThis>
114 #include <QXmlStreamReader>
115 #include <QXmlStreamWriter>
116 #include "ScaleBarAxisPointsUnite.h"
117 #include "Settings.h"
118 #include "StatusBar.h"
119 #include "TransformationStateContext.h"
120 #include "TutorialDlg.h"
122 #include "ViewPointStyle.h"
123 #include "ViewSegmentFilter.h"
124 #include "ZoomFactor.h"
125 #include "ZoomFactorInitial.h"
126 #include "ZoomTransition.h"
128 const QString EMPTY_FILENAME (
"");
129 const char *ENGAUGE_FILENAME_DESCRIPTION =
"Engauge Document";
130 const QString ENGAUGE_FILENAME_EXTENSION (
"dig");
131 const int REGRESSION_INTERVAL = 400;
132 const unsigned int MAX_RECENT_FILE_LIST_SIZE = 8;
135 const QString &fileCmdScriptFile,
136 bool isRegressionTest,
140 bool isExtractImageOnly,
141 const QString &extractImageOnlyExtension,
142 const QStringList &loadStartupFiles,
143 const QStringList &commandLineWithoutLoadStartupFiles,
146 m_isDocumentExported (false),
147 m_engaugeFile (EMPTY_FILENAME),
148 m_currentFile (EMPTY_FILENAME),
152 m_loadImageFromUrl (nullptr),
153 m_cmdMediator (nullptr),
154 m_digitizeStateContext (nullptr),
155 m_transformationStateContext (nullptr),
156 m_backgroundStateContext (nullptr),
157 m_networkClient (nullptr),
158 m_isGnuplot (isGnuplot),
159 m_commandLineWithoutLoadStartupFiles (commandLineWithoutLoadStartupFiles),
161 m_timerRegressionErrorReport(nullptr),
162 m_fileCmdScript (nullptr),
163 m_isErrorReportRegressionTest (isRegressionTest),
164 m_timerRegressionFileCmdScript(nullptr),
165 m_fittingCurve (nullptr),
166 m_isExportOnly (isExportOnly),
167 m_isExtractImageOnly (isExtractImageOnly),
168 m_extractImageOnlyExtension (extractImageOnlyExtension)
170 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::MainWindow"
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();
185 createFacade.
create (*
this);
189 settingsRead (isReset);
191 setUnifiedTitleAndToolBarOnMac(
true);
193 installEventFilter(
this);
197 QString originalPath = QDir::currentPath();
198 QDir::setCurrent (m_startupDirectory);
200 m_loadStartupFiles = loadStartupFiles;
201 m_regressionFile = exportRegressionFilenameFromInputFilename (loadStartupFiles.first ());
202 slotLoadStartupFiles ();
205 }
else if (isExtractImageOnly) {
206 m_loadStartupFiles = loadStartupFiles;
207 m_regressionFile = exportRegressionFilenameFromInputFilename (loadStartupFiles.first ());
208 slotLoadStartupFiles ();
209 handlerFileExtractImage ();
211 }
else if (!errorReportFile.isEmpty()) {
212 loadErrorReportFile(errorReportFile);
213 if (m_isErrorReportRegressionTest) {
214 startRegressionTestErrorReport(errorReportFile);
216 }
else if (!fileCmdScriptFile.isEmpty()) {
218 startRegressionTestFileCmdScript();
223 m_loadStartupFiles = loadStartupFiles;
225 QDir::setCurrent (originalPath);
228 MainWindow::~MainWindow()
230 delete m_fileCmdScript;
233 void MainWindow::addDockWindow (QDockWidget *dockWidget,
235 const QString &settingsTokenArea,
236 const QString &settingsTokenGeometry,
237 Qt::DockWidgetArea dockWidgetArea)
242 const bool DOCKED_EQUALS_NOT_FLOATING =
false;
243 Qt::DockWidgetArea area =
static_cast<Qt::DockWidgetArea
> (settings.value (settingsTokenArea,
244 Qt::NoDockWidgetArea).toInt());
246 if (area == Qt::NoDockWidgetArea) {
248 addDockWidget (dockWidgetArea,
250 dockWidget->setFloating(DOCKED_EQUALS_NOT_FLOATING);
251 if (settings.contains (settingsTokenGeometry)) {
252 dockWidget->restoreGeometry (settings.value (settingsTokenGeometry).toByteArray());
263 void MainWindow::applyZoomFactorAfterLoad()
265 ZoomFactor zoomFactor;
268 if (m_zoomMapFromInitial.contains (zoomFactorInitial)) {
269 zoomFactor = m_zoomMapFromInitial [zoomFactorInitial];
270 }
else if (zoomFactorInitial == ZOOM_INITIAL_PREVIOUS) {
271 zoomFactor = currentZoomFactor ();
273 ENGAUGE_ASSERT (
false);
274 zoomFactor = currentZoomFactor();
277 slotViewZoom (zoomFactor);
280 void MainWindow::closeEvent(QCloseEvent *event)
292 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileClose";
294 setWindowModified (
false);
300 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileExport";
309 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileImport";
311 m_regressionFile = exportRegressionFilenameFromInputFilename (fileName);
312 fileImport (fileName,
318 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileOpen";
320 m_regressionFile = exportRegressionFilenameFromInputFilename (fileName);
321 loadDocumentFile(fileName);
327 return m_cmdMediator;
330 ZoomFactor MainWindow::currentZoomFactor ()
const
333 for (
int z = 0; z < NUMBER_ZOOM_FACTORS; z++) {
334 ZoomFactor zoomFactor =
static_cast<ZoomFactor
> (z);
335 if (m_zoomMapToAction [zoomFactor]->isChecked ()) {
341 ENGAUGE_ASSERT (
false);
347 if (event->type () == QEvent::KeyPress) {
349 QKeyEvent *eventKeyPress =
static_cast<QKeyEvent *
> (event);
352 if ((eventKeyPress->key() == Qt::Key_E) &&
353 ((eventKeyPress->modifiers() & Qt::ShiftModifier) != 0) &&
354 ((eventKeyPress->modifiers() & Qt::ControlModifier) != 0)) {
364 return QObject::eventFilter (target, event);
367 #if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
368 void MainWindow::exportAllCoordinateSystemsAfterRegressionTests()
370 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::exportAllCoordinateSystemsAfterRegressionTests curDir=" << QDir::currentPath().toLatin1().data();
377 QString regressionFile = QString (
"%1_%2")
378 .arg (m_regressionFile)
392 fileExport (regressionFile,
399 QString MainWindow::exportRegressionFilenameFromInputFilename (
const QString &fileName)
const
401 QString outFileName = fileName;
403 outFileName = outFileName.replace (
".xml",
".csv_actual", Qt::CaseInsensitive);
404 outFileName = outFileName.replace (
".dig",
".csv_actual", Qt::CaseInsensitive);
405 outFileName = outFileName.replace (
".pdf",
".csv_actual", Qt::CaseInsensitive);
410 void MainWindow::fileExport(
const QString &fileName,
413 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileExport"
414 <<
" curDir=" << QDir::currentPath().toLatin1().data()
415 <<
" fileName=" << fileName.toLatin1().data();
417 QFile file (fileName);
418 if (file.open(QIODevice::WriteOnly)) {
420 QTextStream str (&file);
431 m_isDocumentExported =
true;
433 updateChecklistGuide ();
438 LOG4CPP_ERROR_S ((*mainCat)) <<
"MainWindow::fileExport"
439 <<
" file=" << fileName.toLatin1().data()
440 <<
" curDir=" << QDir::currentPath().toLatin1().data();
441 QMessageBox::critical (
nullptr,
442 engaugeWindowTitle(),
443 tr (
"Unable to export to file") +
" " + fileName);
447 void MainWindow::fileExtractImage (
const QString &fileName)
449 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileExtractImage"
450 <<
" curDir=" << QDir::currentPath().toLatin1().data()
451 <<
" fileName=" << fileName.toLatin1().data();
453 QFile file (fileName);
454 if (file.open(QIODevice::WriteOnly)) {
456 QPixmap pixmap = m_cmdMediator->
pixmap();
460 if (m_isErrorReportRegressionTest) {
461 QString csvFile = QString (
"%1_1")
462 .arg (exportRegressionFilenameFromInputFilename (m_regressionFile));
466 process.start (
"bash -c \"cksum " + fileName +
" | awk '{print $1}' > " + csvFile +
"\"");
467 process.waitForFinished (-1);
472 LOG4CPP_ERROR_S ((*mainCat)) <<
"MainWindow::fileExtractImage"
473 <<
" file=" << fileName.toLatin1().data()
474 <<
" curDir=" << QDir::currentPath().toLatin1().data();
475 QMessageBox::critical (
nullptr,
476 engaugeWindowTitle(),
477 tr (
"Unable to extract image to file") +
" " + fileName);
481 void MainWindow::fileImport (
const QString &fileName,
482 ImportType importType)
484 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileImport"
485 <<
" fileName=" << fileName.toLatin1 ().data ()
486 <<
" curDir=" << QDir::currentPath().toLatin1().data()
487 <<
" importType=" << importType;
489 QString originalFileOld = m_originalFile;
490 bool originalFileWasImported = m_originalFileWasImported;
492 m_originalFile = fileName;
493 m_originalFileWasImported =
true;
495 if (importType == IMPORT_TYPE_ADVANCED) {
508 #ifdef ENGAUGE_JPEG2000
510 loaded = jpeg2000.
load (fileName,
512 #endif // ENGAUGE_JPEG2000
518 PdfReturn pdfReturn = pdf.
load (fileName,
522 m_isErrorReportRegressionTest);
523 if (pdfReturn == PDF_RETURN_CANCELED) {
530 loaded = (pdfReturn == PDF_RETURN_SUCCESS);
532 #endif // ENGAUGE_PDF
536 NonPdfReturn nonPdfReturn = nonPdf.
load (fileName,
539 m_isErrorReportRegressionTest);
540 if (nonPdfReturn == NON_PDF_RETURN_CANCELED) {
547 loaded = (nonPdfReturn == NON_PDF_RETURN_SUCCESS);
551 QString msg = QString(
"%1 %2 %3 %4.")
552 .arg (tr (
"Cannot read file"))
554 .arg (tr (
"from directory"))
555 .arg (QDir::currentPath());
557 if (fileName.contains (
"???")) {
562 msg += QObject::tr (
"The file appears to have characters from multiple language "
563 "alphabets, which does not work in the Windows command line");
566 QMessageBox::warning (
this,
567 engaugeWindowTitle(),
571 m_originalFile = originalFileOld;
572 m_originalFileWasImported = originalFileWasImported;
576 loaded = loadImage (fileName,
583 if (importType == IMPORT_TYPE_ADVANCED) {
593 m_originalFile = originalFileOld;
594 m_originalFileWasImported = originalFileWasImported;
600 void MainWindow::fileImportWithPrompts (ImportType importType)
602 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileImportWithPrompts"
603 <<
" importType=" << importType;
607 bool okToContinue =
true;
608 if (importType != IMPORT_TYPE_IMAGE_REPLACE) {
609 okToContinue = maybeSave ();
615 QTextStream str (&filter);
620 str <<
"Image Files (" << supportedImageFormatStrings.join (
" ") <<
")";
624 str <<
";; All Files (*.*)";
627 QString fileName = QFileDialog::getOpenFileName (
this,
631 if (!fileName.isEmpty ()) {
636 fileImport (fileName,
642 QString MainWindow::fileNameForExportOnly ()
const
647 if (m_isErrorReportRegressionTest) {
650 fileName = QString (
"%1_1")
651 .arg (exportRegressionFilenameFromInputFilename (m_regressionFile));
656 QString dir = QFileInfo (m_currentFileWithPathAndFileExtension).absolutePath();
657 fileName = QString (
"%1/%2.%3")
666 QString MainWindow::fileNameForExtractImageOnly ()
const
669 QString dir = QFileInfo (m_currentFileWithPathAndFileExtension).absolutePath();
670 QString fileName = QString (
"%1/%2.%3")
673 .arg (m_extractImageOnlyExtension);
678 void MainWindow::filePaste (ImportType importType)
680 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::filePaste"
681 <<
" importType=" << importType;
683 QString originalFileOld = m_originalFile;
684 bool originalFileWasImported = m_originalFileWasImported;
686 QString fileName (
"clipboard");
687 m_originalFile = fileName;
688 m_originalFileWasImported =
true;
690 if (importType == IMPORT_TYPE_ADVANCED) {
701 QImage image = QApplication::clipboard()->image();
705 loaded = !image.isNull();
709 QMessageBox::warning (
this,
710 engaugeWindowTitle(),
711 QString(
"%1 %2 %3 %4.")
712 .arg (tr (
"Cannot read file"))
714 .arg (tr (
"from directory"))
715 .arg (QDir::currentPath ()));
718 m_originalFile = originalFileOld;
719 m_originalFileWasImported = originalFileWasImported;
723 loaded = loadImage (fileName,
730 if (importType == IMPORT_TYPE_ADVANCED) {
740 m_originalFile = originalFileOld;
741 m_originalFileWasImported = originalFileWasImported;
747 void MainWindow::ghostsCreate ()
749 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::ghostsCreate";
751 ENGAUGE_ASSERT (m_ghosts ==
nullptr);
773 void MainWindow::ghostsDestroy ()
775 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::ghostsDestroy";
777 ENGAUGE_CHECK_PTR (m_ghosts);
785 void MainWindow::handlerFileExtractImage ()
787 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::handlerFileExtractImage";
789 if (m_isExtractImageOnly) {
790 QString fileName = fileNameForExtractImageOnly ();
795 fileExtractImage(fileName);
809 void MainWindow::loadCoordSystemListFromCmdMediator ()
811 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadCoordSystemListFromCmdMediator";
813 m_cmbCoordSystem->clear();
817 for (
unsigned int i = 0; i < numberCoordSystem; i++) {
818 int index1Based = signed (i + 1);
819 m_cmbCoordSystem->addItem (QString::number (index1Based),
824 m_cmbCoordSystem->setCurrentIndex (0);
827 bool enable = (m_cmbCoordSystem->count() > 1);
828 m_cmbCoordSystem->setEnabled (enable);
829 m_btnShowAll->setEnabled (enable);
830 m_btnPrintAll->setEnabled (enable);
833 void MainWindow::loadCurveListFromCmdMediator ()
835 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadCurveListFromCmdMediator";
837 m_cmbCurve->clear ();
839 QStringList::iterator itr;
840 for (itr = curvesGraphsNames.begin (); itr != curvesGraphsNames.end (); itr++) {
842 QString curvesGraphName = *itr;
843 m_cmbCurve->addItem (curvesGraphName);
850 void MainWindow::loadDocumentFile (
const QString &fileName)
852 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadDocumentFile fileName=" << fileName.toLatin1 ().data ();
854 QApplication::setOverrideCursor(Qt::WaitCursor);
860 setCurrentPathFromFile (fileName);
861 rebuildRecentFileListForCurrentFile(fileName);
862 m_currentFile = fileName;
864 delete m_cmdMediator;
867 setupAfterLoadNewDocument (fileName,
872 m_actionDigitizeSelect->setChecked (
true);
873 slotDigitizeSelect();
875 m_engaugeFile = fileName;
876 m_originalFile = fileName;
877 m_originalFileWasImported =
false;
882 QApplication::restoreOverrideCursor();
886 QApplication::restoreOverrideCursor();
888 QMessageBox::warning (
this,
889 engaugeWindowTitle(),
890 QString(
"%1 %2 %3 %4:\n%5.")
891 .arg (tr (
"Cannot read file"))
893 .arg (tr (
"from directory"))
894 .arg (QDir::currentPath ())
901 void MainWindow::loadErrorReportFile(
const QString &errorReportFile)
903 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadErrorReportFile"
904 <<
" file=" << errorReportFile.toLatin1().data();
906 QFile file (errorReportFile);
907 if (!file.exists()) {
909 QFileInfo fileInfo (errorReportFile);
911 QMessageBox::critical (
this,
912 engaugeWindowTitle(),
913 tr (
"File not found") +
": " + fileInfo.absoluteFilePath());
918 QXmlStreamReader reader (&file);
919 file.open(QIODevice::ReadOnly | QIODevice::Text);
929 setupAfterLoadNewDocument (errorReportFile,
930 tr (
"Error report opened"),
934 m_actionDigitizeSelect->setChecked (
true);
935 slotDigitizeSelect();
940 bool MainWindow::loadImage (
const QString &fileName,
942 ImportType importType)
944 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadImage"
945 <<
" fileName=" << fileName.toLatin1 ().data ()
946 <<
" importType=" << importType;
949 if (importType == IMPORT_TYPE_IMAGE_REPLACE) {
950 success = loadImageReplacingImage (fileName,
954 success = loadImageNewDocument (fileName,
962 bool MainWindow::loadImageNewDocument (
const QString &fileName,
964 ImportType importType)
966 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadImageNewDocument"
967 <<
" fileName=" << fileName.toLatin1 ().data ()
968 <<
" importType=" << importType;
970 ENGAUGE_ASSERT (importType != IMPORT_TYPE_IMAGE_REPLACE);
972 QApplication::setOverrideCursor(Qt::WaitCursor);
975 QApplication::restoreOverrideCursor();
977 setCurrentPathFromFile (fileName);
979 m_engaugeFile = EMPTY_FILENAME;
981 delete m_cmdMediator;
984 bool accepted = setupAfterLoadNewDocument (fileName,
985 tr (
"File imported"),
991 if (m_actionHelpChecklistGuideWizard->isChecked () &&
992 (m_fileCmdScript ==
nullptr)) {
997 if (wizard->exec() == QDialog::Accepted) {
999 for (CoordSystemIndex coordSystemIndex = 0; coordSystemIndex < m_cmdMediator->
document().
coordSystemCount(); coordSystemIndex++) {
1013 m_actionViewChecklistGuide->setChecked (
true);
1016 loadCurveListFromCmdMediator();
1019 loadCoordSystemListFromCmdMediator();
1025 m_actionDigitizeAxis->setChecked (
true);
1029 slotDigitizeScale ();
1030 }
else if (modeGraph ()) {
1031 slotDigitizeAxis ();
1040 bool MainWindow::loadImageReplacingImage (
const QString &fileName,
1041 const QImage &image,
1042 ImportType importType)
1044 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadImageReplacingImage"
1045 <<
" fileName=" << fileName.toLatin1 ().data ()
1046 <<
" importType=" << importType;
1048 ENGAUGE_ASSERT (importType == IMPORT_TYPE_IMAGE_REPLACE);
1050 setCurrentPathFromFile (fileName);
1052 m_engaugeFile = EMPTY_FILENAME;
1054 ENGAUGE_ASSERT (m_cmdMediator !=
nullptr);
1058 bool accepted = setupAfterLoadReplacingImage (fileName,
1059 tr (
"File imported"),
1067 void MainWindow::loadInputFileForErrorReport(QDomDocument &domInputFile)
const
1069 QFile file (m_originalFile);
1073 if (!file.open (QIODevice::ReadOnly)) {
1077 domInputFile.setContent (&file);
1081 void MainWindow::loadToolTips()
1083 if (m_actionViewToolTips->isChecked ()) {
1086 m_actionDigitizeSelect->setToolTip (m_actionDigitizeSelect->text());
1087 m_actionDigitizeAxis->setToolTip (m_actionDigitizeAxis->text());
1088 m_actionDigitizeScale->setToolTip (m_actionDigitizeScale->text());
1089 m_actionDigitizeCurve->setToolTip (m_actionDigitizeCurve->text());
1090 m_actionDigitizePointMatch->setToolTip (m_actionDigitizePointMatch->text());
1091 m_actionDigitizeColorPicker->setToolTip (m_actionDigitizeColorPicker->text());
1092 m_actionDigitizeSegment->setToolTip (m_actionDigitizeSegment->text());
1093 m_cmbBackground->setToolTip (tr (
"Background image."));
1094 m_cmbCurve->setToolTip (tr (
"Currently selected curve."));
1095 m_viewPointStyle->setToolTip (tr (
"Point style for currently selected curve."));
1096 m_viewSegmentFilter->setToolTip (tr (
"Segment Fill filter for currently selected curve."));
1101 m_actionDigitizeSelect->setToolTip (
"");
1102 m_actionDigitizeAxis->setToolTip (
"");
1103 m_actionDigitizeScale->setToolTip (
"");
1104 m_actionDigitizeCurve->setToolTip (
"");
1105 m_actionDigitizePointMatch->setToolTip (
"");
1106 m_actionDigitizeColorPicker->setToolTip (
"");
1107 m_actionDigitizeSegment->setToolTip (
"");
1108 m_cmbBackground->setToolTip (
"");
1109 m_cmbCurve->setToolTip (
"");
1110 m_viewPointStyle->setToolTip (
"");
1111 m_viewSegmentFilter->setToolTip (
"");
1116 bool MainWindow::modeGraph ()
const
1118 bool success =
false;
1120 if (m_cmdMediator !=
nullptr) {
1129 bool success =
false;
1131 if (m_cmdMediator !=
nullptr) {
1138 bool MainWindow::maybeSave()
1140 if (m_cmdMediator !=
nullptr) {
1142 QMessageBox::StandardButton ret = QMessageBox::warning (
this,
1143 engaugeWindowTitle(),
1144 tr(
"The document has been modified.\n"
1145 "Do you want to save your changes?"),
1146 QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
1147 if (ret == QMessageBox::Save) {
1148 return slotFileSave();
1149 }
else if (ret == QMessageBox::Cancel) {
1160 const QString &fileName)
const
1168 QString csvExtension = QString (
".%1")
1170 QString tsvExtension = QString (
".%1")
1172 QString fileExtensionVersusCsv = fileName.right (csvExtension.size());
1173 QString fileExtensionVersusTsv = fileName.right (tsvExtension.size());
1177 if (csvExtension.compare (fileExtensionVersusCsv, Qt::CaseInsensitive) == 0) {
1178 modelExportFormatAfter.
setDelimiter (EXPORT_DELIMITER_COMMA);
1179 }
else if (tsvExtension.compare (fileExtensionVersusTsv, Qt::CaseInsensitive) == 0) {
1180 modelExportFormatAfter.
setDelimiter (EXPORT_DELIMITER_TAB);
1184 return modelExportFormatAfter;
1189 return m_modelMainWindow;
1192 void MainWindow::rebuildRecentFileListForCurrentFile(
const QString &filePath)
1194 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::rebuildRecentFileListForCurrentFile";
1196 setWindowFilePath (filePath);
1198 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
1199 QStringList recentFilePaths = settings.value (SETTINGS_RECENT_FILE_LIST).toStringList();
1200 recentFilePaths.removeAll (filePath);
1201 recentFilePaths.prepend (filePath);
1202 while (recentFilePaths.count () > qFloor (MAX_RECENT_FILE_LIST_SIZE)) {
1203 recentFilePaths.removeLast ();
1205 settings.setValue (SETTINGS_RECENT_FILE_LIST, recentFilePaths);
1207 updateRecentFileList();
1212 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::resizeEvent";
1214 if (m_actionZoomFill->isChecked ()) {
1215 slotViewZoomFactor (ZOOM_FILL);
1219 bool MainWindow::saveDocumentFile (
const QString &fileName)
1221 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::saveDocumentFile fileName=" << fileName.toLatin1 ().data ();
1223 QFile file(fileName);
1224 if (!file.open(QFile::WriteOnly)) {
1225 QMessageBox::warning (
this,
1226 engaugeWindowTitle(),
1227 QString (
"%1 %2: \n%3.")
1228 .arg(tr (
"Cannot write file"))
1230 .arg(file.errorString()));
1234 rebuildRecentFileListForCurrentFile (fileName);
1236 QApplication::setOverrideCursor (Qt::WaitCursor);
1237 QXmlStreamWriter writer(&file);
1238 writer.setAutoFormatting(
true);
1239 writer.writeStartDocument();
1240 writer.writeDTD(
"<!DOCTYPE engauge>");
1242 writer.writeEndDocument();
1243 QApplication::restoreOverrideCursor ();
1247 m_cmdMediator->setClean ();
1249 setCurrentFile(fileName);
1250 m_engaugeFile = fileName;
1260 const char *comment)
1264 if ((m_cmdMediator !=
nullptr) && !m_isErrorReportRegressionTest) {
1266 QString report = saveErrorReportFileAndExitXml (context,
1272 if (dlg.exec() == QDialog::Accepted) {
1275 QString fileName = dlg.getSaveFileName (
this,
1277 "error_report.xml");
1278 if (!fileName.isEmpty ()) {
1280 QFile fileError (fileName);
1281 QTextStream str (&fileError);
1282 fileError.open (QIODevice::WriteOnly | QIODevice::Text);
1292 QString MainWindow::saveErrorReportFileAndExitXml (
const char *context,
1295 const char *comment)
const
1297 const bool DEEP_COPY =
true;
1299 QString xmlErrorReport;
1300 QXmlStreamWriter writer (&xmlErrorReport);
1301 writer.setAutoFormatting(
true);
1304 writer.writeStartElement(DOCUMENT_SERIALIZE_ERROR_REPORT);
1307 writer.writeStartElement(DOCUMENT_SERIALIZE_APPLICATION);
1308 writer.writeAttribute(DOCUMENT_SERIALIZE_APPLICATION_VERSION_NUMBER, VERSION_NUMBER);
1309 writer.writeEndElement();
1313 QXmlStreamReader reader (m_startingDocumentSnapshot);
1314 while (!reader.atEnd ()) {
1316 if (reader.tokenType() != QXmlStreamReader::StartDocument &&
1317 reader.tokenType() != QXmlStreamReader::EndDocument &&
1318 reader.tokenType() != QXmlStreamReader::Invalid) {
1319 writer.writeCurrentToken (reader);
1324 writer.writeStartElement(DOCUMENT_SERIALIZE_OPERATING_SYSTEM);
1325 writer.writeAttribute(DOCUMENT_SERIALIZE_OPERATING_SYSTEM_ENDIAN, EndianToString (QSysInfo::ByteOrder));
1326 writer.writeAttribute(DOCUMENT_SERIALIZE_OPERATING_SYSTEM_WORD_SIZE, QString::number (QSysInfo::WordSize));
1327 writer.writeEndElement();
1330 writer.writeStartElement(DOCUMENT_SERIALIZE_FILE);
1331 writer.writeAttribute(DOCUMENT_SERIALIZE_FILE_IMPORTED,
1332 m_originalFileWasImported ? DOCUMENT_SERIALIZE_BOOL_TRUE : DOCUMENT_SERIALIZE_BOOL_FALSE);
1333 writer.writeEndElement();
1336 m_cmdMediator->
saveXml(writer);
1339 writer.writeStartElement(DOCUMENT_SERIALIZE_ERROR);
1340 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_CONTEXT, context);
1341 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_FILE, file);
1342 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_LINE, QString::number (line));
1343 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_COMMENT, comment);
1344 writer.writeEndElement();
1346 writer.writeEndElement();
1349 QDomDocument domErrorReport (
"ErrorReport");
1350 domErrorReport.setContent (xmlErrorReport);
1353 if (!m_originalFileWasImported) {
1357 QDomDocument domInputFile;
1358 loadInputFileForErrorReport (domInputFile);
1359 QDomDocumentFragment fragmentFileFrom = domErrorReport.createDocumentFragment();
1360 if (!domInputFile.isNull()) {
1361 fragmentFileFrom.appendChild (domErrorReport.importNode (domInputFile.documentElement(), DEEP_COPY));
1363 QDomNodeList nodesFileTo = domErrorReport.elementsByTagName (DOCUMENT_SERIALIZE_FILE);
1364 if (nodesFileTo.count () > 0) {
1365 QDomNode nodeFileTo = nodesFileTo.at (0);
1366 nodeFileTo.appendChild (fragmentFileFrom);
1373 QDomNodeList nodesDocument = domErrorReport.elementsByTagName (DOCUMENT_SERIALIZE_DOCUMENT);
1374 for (
int i = 0 ; i < nodesDocument.count(); i++) {
1375 QDomNode nodeDocument = nodesDocument.at (i);
1376 QDomElement elemImage = nodeDocument.firstChildElement(DOCUMENT_SERIALIZE_IMAGE);
1377 if (!elemImage.isNull()) {
1380 if (elemImage.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_WIDTH) &&
1381 elemImage.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_HEIGHT)) {
1383 int width = elemImage.attribute(DOCUMENT_SERIALIZE_IMAGE_WIDTH).toInt();
1384 int height = elemImage.attribute(DOCUMENT_SERIALIZE_IMAGE_HEIGHT).toInt();
1386 QDomNode nodeReplacement;
1387 QDomElement elemReplacement = nodeReplacement.toElement();
1388 elemReplacement.setAttribute (DOCUMENT_SERIALIZE_IMAGE_WIDTH, width);
1389 elemReplacement.setAttribute (DOCUMENT_SERIALIZE_IMAGE_HEIGHT, height);
1392 nodeDocument.insertBefore (nodeReplacement,
1394 nodeDocument.removeChild(elemImage);
1400 return domErrorReport.toString();
1403 void MainWindow::saveStartingDocumentSnapshot()
1405 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::saveStartingDocumentSnapshot";
1407 QXmlStreamWriter writer (&m_startingDocumentSnapshot);
1408 writer.setAutoFormatting (
true);
1414 ENGAUGE_CHECK_PTR (m_scene);
1420 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::selectBackgroundOriginal";
1422 BackgroundImage previousBackground =
static_cast<BackgroundImage
> (m_cmbBackground->currentData().toInt());
1424 int index = m_cmbBackground->findData (backgroundImage);
1425 ENGAUGE_ASSERT (index >= 0);
1427 m_cmbBackground->setCurrentIndex(index);
1429 return previousBackground;
1434 return m_cmbCurve->currentText ();
1437 void MainWindow::setCurrentFile (
const QString &fileName)
1439 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setCurrentFile";
1441 QString fileNameStripped;
1442 if (!fileName.isEmpty()) {
1446 QFileInfo fileInfo (fileName);
1447 fileNameStripped = fileInfo.completeBaseName();
1450 m_currentFile = fileNameStripped;
1451 m_currentFileWithPathAndFileExtension = fileName;
1453 updateWindowTitle ();
1456 void MainWindow::setCurrentPathFromFile (
const QString &fileName)
1458 QDir dir = QFileInfo (fileName).absoluteDir();
1460 if (dir.exists ()) {
1462 bool success = QDir::setCurrent (dir.absolutePath ());
1463 ENGAUGE_ASSERT (success);
1471 void MainWindow::setNonFillZoomFactor (ZoomFactor newZoomFactor)
1473 ENGAUGE_ASSERT (newZoomFactor != ZOOM_FILL);
1476 m_zoomMapToAction [newZoomFactor]->setChecked (
true);
1477 slotViewZoomFactor (newZoomFactor);
1480 void MainWindow::setPixmap (
const QString &curveSelected,
1481 const QPixmap &pixmap)
1483 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setPixmap";
1490 m_backgroundStateContext->
setPixmap (m_isGnuplot,
1498 void MainWindow::settingsRead (
bool isReset)
1500 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
1507 settingsReadEnvironment (settings);
1508 settingsReadMainWindow (settings);
1511 void MainWindow::settingsReadEnvironment (QSettings &settings)
1513 settings.beginGroup (SETTINGS_GROUP_ENVIRONMENT);
1514 QDir::setCurrent (settings.value (SETTINGS_CURRENT_DIRECTORY,
1515 QDir::currentPath ()).toString ());
1516 settings.endGroup ();
1519 void MainWindow::settingsReadMainWindow (QSettings &settings)
1521 settings.beginGroup(SETTINGS_GROUP_MAIN_WINDOW);
1524 resize (settings.value (SETTINGS_SIZE,
1525 QSize (600, 600)).toSize ());
1526 move (settings.value (SETTINGS_POS,
1527 QPoint (200, 200)).toPoint ());
1530 #if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
1531 QSize helpSize = settings.value (SETTINGS_HELP_SIZE,
1532 QSize (900, 600)).toSize();
1533 m_helpWindow->resize (helpSize);
1534 if (settings.contains (SETTINGS_HELP_POS)) {
1535 QPoint helpPos = settings.value (SETTINGS_HELP_POS).toPoint();
1536 m_helpWindow->move (helpPos);
1541 m_actionHelpChecklistGuideWizard->setChecked (settings.value (SETTINGS_CHECKLIST_GUIDE_WIZARD,
1545 bool viewBackgroundToolBar = settings.value (SETTINGS_VIEW_BACKGROUND_TOOLBAR,
1547 m_actionViewBackground->setChecked (viewBackgroundToolBar);
1548 m_toolBackground->setVisible (viewBackgroundToolBar);
1549 BackgroundImage backgroundImage =
static_cast<BackgroundImage
> (settings.value (SETTINGS_BACKGROUND_IMAGE,
1550 BACKGROUND_IMAGE_FILTERED).toInt ());
1551 int indexBackground = m_cmbBackground->findData (QVariant (backgroundImage));
1552 m_cmbBackground->setCurrentIndex (indexBackground);
1555 bool viewDigitizeToolBar = settings.value (SETTINGS_VIEW_DIGITIZE_TOOLBAR,
1557 m_actionViewDigitize->setChecked (viewDigitizeToolBar);
1558 m_toolDigitize->setVisible (viewDigitizeToolBar);
1561 bool viewSettingsViewsToolBar = settings.value (SETTINGS_VIEW_SETTINGS_VIEWS_TOOLBAR,
1563 m_actionViewSettingsViews->setChecked (viewSettingsViewsToolBar);
1564 m_toolSettingsViews->setVisible (viewSettingsViewsToolBar);
1567 bool viewCoordSystemToolbar = settings.value (SETTINGS_VIEW_COORD_SYSTEM_TOOLBAR,
1569 m_actionViewCoordSystem->setChecked (viewCoordSystemToolbar);
1570 m_toolCoordSystem->setVisible (viewCoordSystemToolbar);
1573 bool viewToolTips = settings.value (SETTINGS_VIEW_TOOL_TIPS,
1575 m_actionViewToolTips->setChecked (viewToolTips);
1579 StatusBarMode statusBarMode =
static_cast<StatusBarMode
> (settings.value (SETTINGS_VIEW_STATUS_BAR,
1582 m_actionStatusNever->setChecked (statusBarMode == STATUS_BAR_MODE_NEVER);
1583 m_actionStatusTemporary->setChecked (statusBarMode == STATUS_BAR_MODE_TEMPORARY);
1584 m_actionStatusAlways->setChecked (statusBarMode == STATUS_BAR_MODE_ALWAYS);
1586 addDockWindow (m_dockChecklistGuide,
1588 SETTINGS_CHECKLIST_GUIDE_DOCK_AREA,
1589 SETTINGS_CHECKLIST_GUIDE_DOCK_GEOMETRY,
1590 Qt::RightDockWidgetArea);
1591 addDockWindow (m_dockFittingWindow,
1593 SETTINGS_FITTING_WINDOW_DOCK_AREA,
1594 SETTINGS_FITTING_WINDOW_DOCK_GEOMETRY,
1595 Qt::RightDockWidgetArea);
1596 addDockWindow (m_dockGeometryWindow,
1598 SETTINGS_GEOMETRY_WINDOW_DOCK_AREA,
1599 SETTINGS_GEOMETRY_WINDOW_DOCK_GEOMETRY,
1600 Qt::RightDockWidgetArea);
1605 QLocale localeDefault;
1606 QLocale::Language language =
static_cast<QLocale::Language
> (settings.value (SETTINGS_LOCALE_LANGUAGE,
1607 QVariant (localeDefault.language())).toInt());
1608 QLocale::Country country =
static_cast<QLocale::Country
> (settings.value (SETTINGS_LOCALE_COUNTRY,
1609 QVariant (localeDefault.country())).toInt());
1610 QLocale locale (language,
1612 slotViewZoom (static_cast<ZoomFactor> (settings.value (SETTINGS_ZOOM_FACTOR,
1613 QVariant (ZOOM_1_TO_1)).toInt()));
1615 m_modelMainWindow.
setZoomFactorInitial(static_cast<ZoomFactorInitial> (settings.value (SETTINGS_ZOOM_FACTOR_INITIAL,
1616 QVariant (DEFAULT_ZOOM_FACTOR_INITIAL)).toInt()));
1617 m_modelMainWindow.
setZoomControl (static_cast<ZoomControl> (settings.value (SETTINGS_ZOOM_CONTROL,
1618 QVariant (ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS)).toInt()));
1619 m_modelMainWindow.
setMainTitleBarFormat (static_cast<MainTitleBarFormat> (settings.value (SETTINGS_MAIN_TITLE_BAR_FORMAT,
1620 QVariant (MAIN_TITLE_BAR_FORMAT_PATH)).toInt()));
1621 m_modelMainWindow.
setPdfResolution (settings.value (SETTINGS_IMPORT_PDF_RESOLUTION,
1622 QVariant (DEFAULT_IMPORT_PDF_RESOLUTION)).toInt ());
1623 m_modelMainWindow.
setImportCropping (static_cast<ImportCropping> (settings.value (SETTINGS_IMPORT_CROPPING,
1624 QVariant (DEFAULT_IMPORT_CROPPING)).toInt ()));
1626 QVariant (DEFAULT_MAXIMUM_GRID_LINES)).toInt ());
1628 QVariant (DEFAULT_HIGHLIGHT_OPACITY)).toDouble ());
1629 m_modelMainWindow.
setSmallDialogs (settings.value (SETTINGS_SMALL_DIALOGS,
1630 QVariant (DEFAULT_SMALL_DIALOGS)).toBool ());
1632 QVariant (DEFAULT_DRAG_DROP_EXPORT)).toBool ());
1634 QVariant (DEFAULT_SIGNIFICANT_DIGITS)).toInt ());
1637 updateSmallDialogs();
1639 settings.endGroup();
1642 void MainWindow::settingsWrite ()
1644 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
1646 settings.beginGroup (SETTINGS_GROUP_ENVIRONMENT);
1647 settings.setValue (SETTINGS_CURRENT_DIRECTORY, QDir::currentPath ());
1648 settings.endGroup ();
1650 settings.beginGroup (SETTINGS_GROUP_MAIN_WINDOW);
1651 settings.setValue (SETTINGS_SIZE, size ());
1652 settings.setValue (SETTINGS_POS, pos ());
1653 #if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
1654 settings.setValue (SETTINGS_HELP_SIZE, m_helpWindow->size());
1655 settings.setValue (SETTINGS_HELP_POS, m_helpWindow->pos ());
1657 if (m_dockChecklistGuide->isFloating()) {
1659 settings.setValue (SETTINGS_CHECKLIST_GUIDE_DOCK_AREA, Qt::NoDockWidgetArea);
1660 settings.setValue (SETTINGS_CHECKLIST_GUIDE_DOCK_GEOMETRY, m_dockChecklistGuide->saveGeometry ());
1664 settings.setValue (SETTINGS_CHECKLIST_GUIDE_DOCK_AREA, dockWidgetArea (m_dockChecklistGuide));
1667 if (m_dockFittingWindow->isFloating()) {
1669 settings.setValue (SETTINGS_FITTING_WINDOW_DOCK_AREA, Qt::NoDockWidgetArea);
1670 settings.setValue (SETTINGS_FITTING_WINDOW_DOCK_GEOMETRY, m_dockFittingWindow->saveGeometry());
1673 settings.setValue (SETTINGS_FITTING_WINDOW_DOCK_AREA, dockWidgetArea (m_dockFittingWindow));
1675 if (m_dockGeometryWindow->isFloating()) {
1677 settings.setValue (SETTINGS_GEOMETRY_WINDOW_DOCK_AREA, Qt::NoDockWidgetArea);
1678 settings.setValue (SETTINGS_GEOMETRY_WINDOW_DOCK_GEOMETRY, m_dockGeometryWindow->saveGeometry ());
1682 settings.setValue (SETTINGS_GEOMETRY_WINDOW_DOCK_AREA, dockWidgetArea (m_dockGeometryWindow));
1685 settings.setValue (SETTINGS_BACKGROUND_IMAGE, m_cmbBackground->currentData().toInt());
1686 settings.setValue (SETTINGS_CHECKLIST_GUIDE_WIZARD, m_actionHelpChecklistGuideWizard->isChecked ());
1687 settings.setValue (SETTINGS_DRAG_DROP_EXPORT, m_modelMainWindow.
dragDropExport ());
1688 settings.setValue (SETTINGS_HIGHLIGHT_OPACITY, m_modelMainWindow.
highlightOpacity());
1689 settings.setValue (SETTINGS_IMPORT_CROPPING, m_modelMainWindow.
importCropping());
1690 settings.setValue (SETTINGS_IMPORT_PDF_RESOLUTION, m_modelMainWindow.
pdfResolution ());
1691 settings.setValue (SETTINGS_LOCALE_LANGUAGE, m_modelMainWindow.
locale().language());
1692 settings.setValue (SETTINGS_LOCALE_COUNTRY, m_modelMainWindow.
locale().country());
1693 settings.setValue (SETTINGS_MAIN_TITLE_BAR_FORMAT, m_modelMainWindow.
mainTitleBarFormat());
1694 settings.setValue (SETTINGS_MAXIMUM_GRID_LINES, m_modelMainWindow.
maximumGridLines());
1695 settings.setValue (SETTINGS_SMALL_DIALOGS, m_modelMainWindow.
smallDialogs());
1696 settings.setValue (SETTINGS_VIEW_BACKGROUND_TOOLBAR, m_actionViewBackground->isChecked());
1697 settings.setValue (SETTINGS_VIEW_DIGITIZE_TOOLBAR, m_actionViewDigitize->isChecked ());
1698 settings.setValue (SETTINGS_VIEW_STATUS_BAR, m_statusBar->
statusBarMode ());
1699 settings.setValue (SETTINGS_VIEW_SETTINGS_VIEWS_TOOLBAR, m_actionViewSettingsViews->isChecked ());
1700 settings.setValue (SETTINGS_VIEW_COORD_SYSTEM_TOOLBAR, m_actionViewCoordSystem->isChecked ());
1701 settings.setValue (SETTINGS_VIEW_TOOL_TIPS, m_actionViewToolTips->isChecked ());
1702 settings.setValue (SETTINGS_ZOOM_CONTROL, m_modelMainWindow.
zoomControl());
1703 settings.setValue (SETTINGS_ZOOM_FACTOR, currentZoomFactor ());
1704 settings.setValue (SETTINGS_ZOOM_FACTOR_INITIAL, m_modelMainWindow.
zoomFactorInitial());
1705 settings.endGroup ();
1708 bool MainWindow::setupAfterLoadNewDocument (
const QString &fileName,
1709 const QString &temporaryMessage ,
1710 ImportType importType)
1712 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setupAfterLoadNewDocument"
1713 <<
" file=" << fileName.toLatin1().data()
1714 <<
" message=" << temporaryMessage.toLatin1().data()
1715 <<
" importType=" << importType;
1720 const QString EMPTY_CURVE_NAME_TO_SKIP_BACKGROUND_PROCESSING;
1724 m_digitizeStateContext->
resetOnLoad (m_cmdMediator);
1729 EMPTY_CURVE_NAME_TO_SKIP_BACKGROUND_PROCESSING);
1731 m_cmdMediator->
pixmap ());
1735 if (importType == IMPORT_TYPE_ADVANCED) {
1737 applyZoomFactorAfterLoad();
1740 dlgImportAdvanced.exec();
1742 if (dlgImportAdvanced.result() == QDialog::Rejected) {
1746 int numberCoordSystem = signed (dlgImportAdvanced.numberCoordSystem());
1755 connect (m_actionEditUndo, SIGNAL (triggered ()), m_cmdMediator, SLOT (undo ()));
1756 connect (m_actionEditUndo, SIGNAL (triggered ()), m_cmdStackShadow, SLOT (slotUndo ()));
1757 connect (m_actionEditRedo, SIGNAL (triggered ()), m_cmdMediator, SLOT (redo ()));
1758 connect (m_actionEditRedo, SIGNAL (triggered ()), m_cmdStackShadow, SLOT (slotRedo ()));
1759 connect (m_cmdMediator, SIGNAL (canRedoChanged(
bool)),
this, SLOT (slotCanRedoChanged (
bool)));
1760 connect (m_cmdMediator, SIGNAL (canUndoChanged(
bool)),
this, SLOT (slotCanUndoChanged (
bool)));
1761 connect (m_cmdMediator, SIGNAL (redoTextChanged (
const QString &)),
this, SLOT (slotRedoTextChanged (
const QString &)));
1762 connect (m_cmdMediator, SIGNAL (undoTextChanged (
const QString &)),
this, SLOT (slotUndoTextChanged (
const QString &)));
1763 loadCurveListFromCmdMediator ();
1764 loadCoordSystemListFromCmdMediator ();
1767 m_isDocumentExported =
false;
1777 m_cmbCurve->currentText ());
1778 m_backgroundStateContext->
setBackgroundImage (static_cast<BackgroundImage> (m_cmbBackground->currentIndex ()));
1780 applyZoomFactorAfterLoad();
1782 setCurrentFile(fileName);
1786 saveStartingDocumentSnapshot();
1793 bool MainWindow::setupAfterLoadReplacingImage (
const QString &fileName,
1794 const QString &temporaryMessage ,
1795 ImportType importType)
1797 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setupAfterLoadReplacingImage"
1798 <<
" file=" << fileName.toLatin1().data()
1799 <<
" message=" << temporaryMessage.toLatin1().data()
1800 <<
" importType=" << importType;
1805 m_cmdMediator->clear();
1808 m_cmdMediator->
pixmap ());
1810 m_isDocumentExported =
false;
1812 m_backgroundStateContext->
setBackgroundImage (static_cast<BackgroundImage> (m_cmbBackground->currentIndex ()));
1814 applyZoomFactorAfterLoad();
1816 setCurrentFile(fileName);
1820 saveStartingDocumentSnapshot();
1829 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::showEvent"
1830 <<
" files=" << m_loadStartupFiles.join (
",").toLatin1().data();
1832 QMainWindow::showEvent (event);
1834 if (m_loadStartupFiles.count() > 0) {
1836 m_timerLoadStartupFiles =
new QTimer;
1837 m_timerLoadStartupFiles->setSingleShot (
true);
1838 connect (m_timerLoadStartupFiles, SIGNAL (timeout ()),
this, SLOT (slotLoadStartupFiles ()));
1839 m_timerLoadStartupFiles->start (0);
1849 void MainWindow::slotBtnPrintAll ()
1851 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotBtnPrintAll";
1855 QPrinter printer (QPrinter::HighResolution);
1856 QPrintDialog dlg (&printer,
this);
1857 if (dlg.exec() == QDialog::Accepted) {
1858 QPainter painter (&printer);
1859 m_view->render (&painter);
1866 void MainWindow::slotBtnShowAllPressed ()
1868 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotBtnShowAllPressed";
1874 void MainWindow::slotBtnShowAllReleased ()
1876 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotBtnShowAllReleased";
1882 void MainWindow::slotCanRedoChanged (
bool canRedo)
1884 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotCanRedoChanged";
1886 m_actionEditRedo->setEnabled (canRedo || m_cmdStackShadow->
canRedo());
1889 void MainWindow::slotCanUndoChanged (
bool canUndo)
1891 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotCanUndoChanged";
1893 m_actionEditUndo->setEnabled (canUndo);
1896 void MainWindow::slotChecklistClosed()
1898 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotChecklistClosed";
1900 m_actionViewChecklistGuide->setChecked (
false);
1903 void MainWindow::slotCleanChanged(
bool clean)
1905 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCleanChanged";
1907 setWindowModified (!clean);
1910 void MainWindow::slotCmbBackground(
int currentIndex)
1912 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCmbBackground";
1914 switch (currentIndex) {
1915 case BACKGROUND_IMAGE_NONE:
1916 if (!m_actionViewBackgroundNone->isChecked()) {
1917 m_actionViewBackgroundNone->toggle();
1921 case BACKGROUND_IMAGE_ORIGINAL:
1922 if (!m_actionViewBackgroundOriginal->isChecked ()) {
1923 m_actionViewBackgroundOriginal->toggle();
1927 case BACKGROUND_IMAGE_FILTERED:
1928 if (!m_actionViewBackgroundFiltered->isChecked ()) {
1929 m_actionViewBackgroundFiltered->toggle();
1934 m_backgroundStateContext->
setBackgroundImage (static_cast<BackgroundImage> (currentIndex));
1937 void MainWindow::slotCmbCoordSystem(
int index)
1939 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCmbCoordSystem";
1943 static_cast<CoordSystemIndex
> (index));
1945 m_cmdMediator->push (cmd);
1948 void MainWindow::slotCmbCurve(
int )
1950 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCmbCurve";
1956 m_cmbCurve->currentText ());
1960 updateViewedCurves();
1962 updateFittingWindow();
1963 updateGeometryWindow();
1966 void MainWindow::slotContextMenuEventAxis (QString pointIdentifier)
1968 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotContextMenuEventAxis point=" << pointIdentifier.toLatin1 ().data ();
1974 void MainWindow::slotContextMenuEventGraph (QStringList pointIdentifiers)
1976 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotContextMenuEventGraph point=" << pointIdentifiers.join(
",").toLatin1 ().data ();
1982 void MainWindow::slotDigitizeAxis ()
1984 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeAxis";
1987 DIGITIZE_STATE_AXIS);
1988 m_cmbCurve->setEnabled (
false);
1994 void MainWindow::slotDigitizeColorPicker ()
1996 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeColorPicker";
1999 DIGITIZE_STATE_COLOR_PICKER);
2000 m_cmbCurve->setEnabled (
true);
2006 void MainWindow::slotDigitizeCurve ()
2008 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeCurve";
2011 DIGITIZE_STATE_CURVE);
2012 m_cmbCurve->setEnabled (
true);
2018 void MainWindow::slotDigitizePointMatch ()
2020 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizePointMatch";
2023 DIGITIZE_STATE_POINT_MATCH);
2024 m_cmbCurve->setEnabled (
true);
2030 void MainWindow::slotDigitizeScale ()
2032 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeScale";
2035 DIGITIZE_STATE_SCALE);
2036 m_cmbCurve->setEnabled (
false);
2042 void MainWindow::slotDigitizeSegment ()
2044 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeSegment";
2047 DIGITIZE_STATE_SEGMENT);
2048 m_cmbCurve->setEnabled (
true);
2054 void MainWindow::slotDigitizeSelect ()
2056 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeSelect";
2059 DIGITIZE_STATE_SELECT);
2060 m_cmbCurve->setEnabled (
false);
2066 void MainWindow::slotEditCopy ()
2068 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditCopy";
2071 bool tableFittingIsActive, tableFittingIsCopyable;
2072 bool tableGeometryIsActive, tableGeometryIsCopyable;
2073 m_dockFittingWindow->
getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
2074 m_dockGeometryWindow->
getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
2076 if (tableFittingIsActive) {
2079 m_dockFittingWindow->
doCopy ();
2081 }
else if (tableGeometryIsActive) {
2084 m_dockGeometryWindow->
doCopy ();
2090 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
2101 void MainWindow::slotEditCut ()
2103 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditCut";
2106 bool tableFittingIsActive, tableFittingIsCopyable;
2107 bool tableGeometryIsActive, tableGeometryIsCopyable;
2108 m_dockFittingWindow->
getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
2109 m_dockGeometryWindow->
getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
2111 if (tableFittingIsActive || tableGeometryIsActive) {
2119 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
2130 void MainWindow::slotEditDelete ()
2132 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditDelete";
2135 bool tableFittingIsActive, tableFittingIsCopyable;
2136 bool tableGeometryIsActive, tableGeometryIsCopyable;
2137 m_dockFittingWindow->
getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
2138 m_dockGeometryWindow->
getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
2140 if (tableFittingIsActive || tableGeometryIsActive) {
2153 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
2154 QStringList pointIdentifiers = scaleBarAxisPoints.
unite (m_cmdMediator,
2165 void MainWindow::slotEditMenu ()
2167 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditMenu";
2169 m_actionEditPasteAsNew->setEnabled (!QApplication::clipboard()->image().isNull());
2170 m_actionEditPasteAsNewAdvanced->setEnabled (!QApplication::clipboard()->image().isNull());
2173 void MainWindow::slotEditPaste ()
2175 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditPaste";
2177 QList<QPoint> points;
2178 QList<double> ordinals;
2187 m_cmbCurve->currentText (),
2194 void MainWindow::slotEditPasteAsNew ()
2196 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditPasteAsNew";
2198 filePaste (IMPORT_TYPE_SIMPLE);
2201 void MainWindow::slotEditPasteAsNewAdvanced ()
2203 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditPasteAsNewAdvanced";
2205 filePaste (IMPORT_TYPE_ADVANCED);
2208 void MainWindow::slotFileClose()
2210 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileClose";
2217 TRANSFORMATION_STATE_UNDEFINED,
2225 DIGITIZE_STATE_EMPTY);
2228 if (m_fittingCurve !=
nullptr) {
2229 m_scene->removeItem (m_fittingCurve);
2230 m_fittingCurve =
nullptr;
2237 m_backgroundStateContext->
close ();
2240 m_scene->setSceneRect (QRectF (0, 0, 1, 1));
2243 m_dockFittingWindow->
clear ();
2246 m_dockGeometryWindow->
clear ();
2249 delete m_cmdMediator;
2252 m_cmdMediator =
nullptr;
2255 setWindowTitle (engaugeWindowTitle ());
2257 m_gridLines.
clear();
2262 void MainWindow::slotFileExport ()
2264 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileExport";
2272 if (m_isExportOnly) {
2273 fileName = fileNameForExportOnly ();
2276 QString filter = QString (
"%1;;%2;;All files (*.*)")
2281 QString defaultFileName = QString (
"%1/%2.%3")
2283 .arg (m_currentFile)
2286 QString filterCsv = exportStrategy.
filterCsv ();
2288 fileName = dlg.getSaveFileName (
this,
2295 if (!fileName.isEmpty ()) {
2298 fileExport(fileName,
2307 void MainWindow::slotFileImport ()
2309 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImport";
2311 fileImportWithPrompts (IMPORT_TYPE_SIMPLE);
2314 void MainWindow::slotFileImportAdvanced ()
2316 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportAdvanced";
2318 fileImportWithPrompts (IMPORT_TYPE_ADVANCED);
2321 void MainWindow::slotFileImportDraggedImage(QImage image)
2323 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportDraggedImage";
2328 IMPORT_TYPE_SIMPLE);
2331 void MainWindow::slotFileImportDraggedImageUrl(QUrl url)
2333 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportDraggedImageUrl url=" << url.toString ().toLatin1 ().data ();
2340 void MainWindow::slotFileImportImage(QString fileName, QImage image)
2342 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportImage fileName=" << fileName.toLatin1 ().data ();
2345 loadImage (fileName,
2347 IMPORT_TYPE_SIMPLE);
2350 void MainWindow::slotFileImportImageReplace ()
2352 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportImageReplace";
2354 fileImportWithPrompts (IMPORT_TYPE_IMAGE_REPLACE);
2357 void MainWindow::slotFileOpen()
2359 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileOpen";
2365 QString filter = QString (
"%1 (*.%2);; All Files (*.*)")
2366 .arg (ENGAUGE_FILENAME_DESCRIPTION)
2367 .arg (ENGAUGE_FILENAME_EXTENSION);
2370 QString fileName = QFileDialog::getOpenFileName (
this,
2371 tr(
"Open Document"),
2374 if (!fileName.isEmpty ()) {
2377 loadDocumentFile (fileName);
2383 void MainWindow::slotFileOpenDraggedDigFile (QString fileName)
2385 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileOpenDraggedDigFile";
2387 loadDocumentFile (fileName);
2390 void MainWindow::slotFilePrint()
2392 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFilePrint";
2394 QPrinter printer (QPrinter::HighResolution);
2395 QPrintDialog dlg (&printer,
this);
2396 if (dlg.exec() == QDialog::Accepted) {
2397 QPainter painter (&printer);
2398 m_view->render (&painter);
2403 bool MainWindow::slotFileSave()
2405 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileSave";
2407 if (m_engaugeFile.isEmpty()) {
2408 return slotFileSaveAs();
2410 return saveDocumentFile (m_engaugeFile);
2414 bool MainWindow::slotFileSaveAs()
2416 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileSaveAs";
2419 QString filenameDefault = m_currentFile;
2420 if (!m_currentFile.endsWith (ENGAUGE_FILENAME_EXTENSION)) {
2421 filenameDefault = QString (
"%1.%2")
2422 .arg (m_currentFile)
2423 .arg (ENGAUGE_FILENAME_EXTENSION);
2426 if (!m_engaugeFile.isEmpty()) {
2427 filenameDefault = m_engaugeFile;
2430 QString filterDigitizer = QString (
"%1 (*.%2)")
2431 .arg (ENGAUGE_FILENAME_DESCRIPTION)
2432 .arg (ENGAUGE_FILENAME_EXTENSION);
2433 QString filterAll (
"All files (*. *)");
2435 QStringList filters;
2436 filters << filterDigitizer;
2437 filters << filterAll;
2441 QFileDialog dlg(
this);
2442 dlg.setFileMode (QFileDialog::AnyFile);
2443 dlg.selectNameFilter (filterDigitizer);
2444 dlg.setNameFilters (filters);
2445 #if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
2447 dlg.setWindowModality(Qt::WindowModal);
2449 dlg.setAcceptMode(QFileDialog::AcceptSave);
2450 dlg.selectFile(filenameDefault);
2454 QStringList files = dlg.selectedFiles();
2456 return saveDocumentFile(files.at(0));
2462 void MainWindow::slotFittingWindowClosed()
2464 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFittingWindowClosed";
2466 m_actionViewFittingWindow->setChecked (
false);
2469 void MainWindow::slotFittingWindowCurveFit(FittingCurveCoefficients fittingCurveCoef,
2476 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFittingWindowCurveFit"
2477 <<
" order=" << fittingCurveCoef.size() - 1;
2479 if (m_fittingCurve !=
nullptr) {
2480 m_scene->removeItem (m_fittingCurve);
2481 delete m_fittingCurve;
2490 m_fittingCurve->setVisible (m_actionViewFittingWindow->isChecked ());
2491 m_scene->addItem (m_fittingCurve);
2494 void MainWindow::slotGeometryWindowClosed()
2496 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotGeometryWindowClosed";
2498 m_actionViewGeometryWindow->setChecked (
false);
2501 void MainWindow::slotHelpAbout()
2503 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotHelpAbout";
2509 void MainWindow::slotHelpTutorial()
2511 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotHelpTutorial";
2513 m_tutorialDlg->show ();
2514 m_tutorialDlg->exec ();
2517 void MainWindow::slotKeyPress (Qt::Key key,
2518 bool atLeastOneSelectedItem)
2520 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotKeyPress"
2521 <<
" key=" << QKeySequence (key).toString().toLatin1 ().data ()
2522 <<
" atLeastOneSelectedItem=" << (atLeastOneSelectedItem ?
"true" :
"false");
2526 atLeastOneSelectedItem);
2529 void MainWindow::slotLoadStartupFiles ()
2531 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotLoadStartupFiles";
2533 ENGAUGE_ASSERT (m_loadStartupFiles.count() > 0);
2535 QString fileName = m_loadStartupFiles.front();
2536 m_loadStartupFiles.pop_front();
2542 loadDocumentFile (fileName);
2546 fileImport (fileName,
2547 IMPORT_TYPE_SIMPLE);
2551 if (m_loadStartupFiles.count() > 0) {
2555 QProcess::startDetached (QCoreApplication::applicationFilePath(),
2556 m_commandLineWithoutLoadStartupFiles + m_loadStartupFiles);
2560 void MainWindow::slotMouseMove (QPointF pos)
2565 if (m_cmdMediator !=
nullptr) {
2568 QString coordsScreen, coordsGraph, resolutionGraph;
2588 void MainWindow::slotMousePress (QPointF pos)
2590 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotMousePress";
2598 void MainWindow::slotMouseRelease (QPointF pos)
2600 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotMouseRelease";
2602 if (pos.x() < 0 || pos.y() < 0) {
2616 void MainWindow::slotRecentFileAction ()
2618 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotRecentFileAction";
2620 QAction *action = qobject_cast<QAction*>(sender ());
2623 QString fileName = action->data().toString();
2624 loadDocumentFile (fileName);
2628 void MainWindow::slotRecentFileClear ()
2630 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotRecentFileClear";
2632 QStringList emptyList;
2634 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
2635 settings.setValue (SETTINGS_RECENT_FILE_LIST,
2638 updateRecentFileList();
2641 void MainWindow::slotRedoTextChanged (
const QString &text)
2643 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotRedoTextChanged";
2645 QString completeText (
"Redo");
2646 if (!text.isEmpty ()) {
2647 completeText += QString (
" \"%1\"").arg (text);
2649 m_actionEditRedo->setText (completeText);
2652 void MainWindow::slotSettingsAxesChecker ()
2654 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsAxesChecker";
2656 m_dlgSettingsAxesChecker->
load (*m_cmdMediator);
2657 m_dlgSettingsAxesChecker->show ();
2660 void MainWindow::slotSettingsColorFilter ()
2662 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsColorFilter";
2664 m_dlgSettingsColorFilter->
load (*m_cmdMediator);
2665 m_dlgSettingsColorFilter->show ();
2668 void MainWindow::slotSettingsCoords ()
2670 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsCoords";
2672 m_dlgSettingsCoords->
load (*m_cmdMediator);
2673 m_dlgSettingsCoords->show ();
2676 void MainWindow::slotSettingsCurveList ()
2678 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsCurveList";
2680 m_dlgSettingsCurveList->
load (*m_cmdMediator);
2681 m_dlgSettingsCurveList->show ();
2684 void MainWindow::slotSettingsCurveProperties ()
2686 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsCurveProperties";
2688 m_dlgSettingsCurveProperties->
load (*m_cmdMediator);
2690 m_dlgSettingsCurveProperties->show ();
2693 void MainWindow::slotSettingsDigitizeCurve ()
2695 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsDigitizeCurve";
2697 m_dlgSettingsDigitizeCurve->
load (*m_cmdMediator);
2698 m_dlgSettingsDigitizeCurve->show ();
2701 void MainWindow::slotSettingsExportFormat ()
2703 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsExportFormat";
2706 m_dlgSettingsExportFormat->
load (*m_cmdMediator);
2707 m_dlgSettingsExportFormat->show ();
2714 void MainWindow::slotSettingsGeneral ()
2716 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsGeneral";
2718 m_dlgSettingsGeneral->
load (*m_cmdMediator);
2719 m_dlgSettingsGeneral->show ();
2722 void MainWindow::slotSettingsGridDisplay()
2724 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsGridDisplay";
2726 m_dlgSettingsGridDisplay->
load (*m_cmdMediator);
2727 m_dlgSettingsGridDisplay->show ();
2730 void MainWindow::slotSettingsGridRemoval ()
2732 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsGridRemoval";
2734 m_dlgSettingsGridRemoval->
load (*m_cmdMediator);
2735 m_dlgSettingsGridRemoval->show ();
2738 void MainWindow::slotSettingsPointMatch ()
2740 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsPointMatch";
2742 m_dlgSettingsPointMatch->
load (*m_cmdMediator);
2743 m_dlgSettingsPointMatch->show ();
2746 void MainWindow::slotSettingsSegments ()
2748 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsSegments";
2750 m_dlgSettingsSegments->
load (*m_cmdMediator);
2751 m_dlgSettingsSegments->show ();
2754 void MainWindow::slotTableStatusChange ()
2756 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotTableStatusChange";
2763 void MainWindow::slotSettingsMainWindow ()
2765 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsMainWindow";
2769 m_dlgSettingsMainWindow->show ();
2772 void MainWindow::slotTimeoutRegressionErrorReport ()
2774 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotTimeoutRegressionErrorReport"
2775 <<
" cmdStackIndex=" << m_cmdMediator->index()
2776 <<
" cmdStackCount=" << m_cmdMediator->count();
2778 if (m_cmdStackShadow->
canRedo()) {
2781 QDir::setCurrent (m_startupDirectory);
2786 QDir::setCurrent (m_startupDirectory);
2790 #if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
2791 exportAllCoordinateSystemsAfterRegressionTests ();
2795 m_cmdMediator->setClean();
2801 void MainWindow::slotTimeoutRegressionFileCmdScript ()
2803 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotTimeoutRegressionFileCmdScript";
2805 if (m_fileCmdScript->
canRedo()) {
2808 QDir::setCurrent (m_startupDirectory);
2810 m_fileCmdScript->
redo(*
this);
2813 QDir::setCurrent (m_startupDirectory);
2818 if (m_cmdMediator !=
nullptr) {
2820 #if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
2821 exportAllCoordinateSystemsAfterRegressionTests ();
2825 m_cmdMediator->setClean();
2835 void MainWindow::slotUndoTextChanged (
const QString &text)
2837 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotUndoTextChanged";
2839 QString completeText (
"Undo");
2840 if (!text.isEmpty ()) {
2841 completeText += QString (
" \"%1\"").arg (text);
2843 m_actionEditUndo->setText (completeText);
2846 void MainWindow::slotViewGridLines ()
2848 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotViewGridLines";
2853 void MainWindow::slotViewGroupBackground(QAction *action)
2855 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewGroupBackground";
2858 BackgroundImage backgroundImage;
2859 int indexBackground;
2860 if (action == m_actionViewBackgroundNone) {
2861 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_NONE));
2862 backgroundImage = BACKGROUND_IMAGE_NONE;
2863 }
else if (action == m_actionViewBackgroundOriginal) {
2864 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_ORIGINAL));
2865 backgroundImage = BACKGROUND_IMAGE_ORIGINAL;
2866 }
else if (action == m_actionViewBackgroundFiltered) {
2867 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_FILTERED));
2868 backgroundImage = BACKGROUND_IMAGE_FILTERED;
2870 ENGAUGE_ASSERT (
false);
2873 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_ORIGINAL));
2874 backgroundImage = BACKGROUND_IMAGE_ORIGINAL;
2877 m_cmbBackground->setCurrentIndex (indexBackground);
2881 void MainWindow::slotViewGroupCurves(QAction * )
2883 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewGroupCurves";
2885 updateViewedCurves ();
2888 void MainWindow::slotViewGroupStatus(QAction *action)
2890 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewGroupStatus";
2892 ENGAUGE_CHECK_PTR (m_statusBar);
2894 if (action == m_actionStatusNever) {
2896 }
else if (action == m_actionStatusTemporary) {
2903 void MainWindow::slotViewToolBarBackground ()
2905 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarBackground";
2907 if (m_actionViewBackground->isChecked ()) {
2908 m_toolBackground->show();
2910 m_toolBackground->hide();
2914 void MainWindow::slotViewToolBarChecklistGuide ()
2916 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarChecklistGuide";
2918 if (m_actionViewChecklistGuide->isChecked ()) {
2919 m_dockChecklistGuide->show();
2921 m_dockChecklistGuide->hide();
2925 void MainWindow::slotViewToolBarCoordSystem ()
2927 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarCoordSystem";
2929 if (m_actionViewCoordSystem->isChecked ()) {
2930 m_toolCoordSystem->show();
2932 m_toolCoordSystem->hide();
2936 void MainWindow::slotViewToolBarDigitize ()
2938 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarDigitize";
2940 if (m_actionViewDigitize->isChecked ()) {
2941 m_toolDigitize->show();
2943 m_toolDigitize->hide();
2947 void MainWindow::slotViewToolBarFittingWindow()
2949 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarFittingWindow";
2951 if (m_actionViewFittingWindow->isChecked()) {
2952 m_dockFittingWindow->show ();
2953 if (m_fittingCurve !=
nullptr) {
2954 m_fittingCurve->setVisible (
true);
2957 m_dockFittingWindow->hide ();
2958 if (m_fittingCurve !=
nullptr) {
2959 m_fittingCurve->setVisible (
false);
2964 void MainWindow::slotViewToolBarGeometryWindow ()
2966 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarGeometryWindow";
2968 if (m_actionViewGeometryWindow->isChecked ()) {
2969 m_dockGeometryWindow->show();
2971 m_dockGeometryWindow->hide();
2975 void MainWindow::slotViewToolBarSettingsViews ()
2977 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarSettingsViews";
2979 if (m_actionViewSettingsViews->isChecked ()) {
2980 m_toolSettingsViews->show();
2982 m_toolSettingsViews->hide();
2986 void MainWindow::slotViewToolTips ()
2988 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolTips";
2993 void MainWindow::slotViewZoom (
int zoom)
2995 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom";
2998 ZoomFactor zoomFactor =
static_cast<ZoomFactor
> (zoom);
2999 m_zoomMapToAction [zoomFactor]->setChecked (
true);
3000 slotViewZoomFactor (static_cast<ZoomFactor> (zoom));
3003 void MainWindow::slotViewZoomFactor (ZoomFactor zoomFactor)
3005 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomFactor";
3007 if (zoomFactor == ZOOM_FILL) {
3008 m_backgroundStateContext->
fitInView (*m_view);
3012 double factor = zoomTransition.
mapToFactor (zoomFactor);
3014 QTransform transform;
3015 transform.scale (factor, factor);
3016 m_view->setTransform (transform);
3022 void MainWindow::slotViewZoomFactorInt (
int zoom)
3024 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomFactorInt";
3026 slotViewZoomFactor (static_cast<ZoomFactor> (zoom));
3029 void MainWindow::slotViewZoomIn ()
3031 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomIn";
3034 ZoomFactor zoomFactorNew = zoomTransition.
zoomIn (currentZoomFactor (),
3035 m_view->transform ().m11 (),
3036 m_view->transform ().m22 (),
3037 m_actionZoomFill->isChecked ());
3038 setNonFillZoomFactor (zoomFactorNew);
3042 void MainWindow::slotViewZoomInFromWheelEvent ()
3044 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomInFromWheelEvent";
3046 if ((m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL) ||
3047 (m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS)) {
3050 m_view->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
3055 m_view->setTransformationAnchor(QGraphicsView::NoAnchor);
3059 void MainWindow::slotViewZoomOut ()
3061 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomOut";
3065 ZoomFactor zoomFactorNew = zoomTransition.
zoomOut (currentZoomFactor (),
3066 m_view->transform ().m11 (),
3067 m_view->transform ().m22 (),
3068 m_actionZoomFill->isChecked ());
3069 setNonFillZoomFactor (zoomFactorNew);
3072 void MainWindow::slotViewZoomOutFromWheelEvent ()
3074 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomOutFromWheelEvent";
3076 if ((m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL) ||
3077 (m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS)) {
3080 m_view->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
3085 m_view->setTransformationAnchor(QGraphicsView::NoAnchor);
3089 void MainWindow::startRegressionTestErrorReport(
const QString ®ressionInputFile)
3091 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::startRegressionTestErrorReport";
3100 m_regressionFile = exportRegressionFilenameFromInputFilename (regressionInputFile);
3102 m_timerRegressionErrorReport =
new QTimer();
3103 m_timerRegressionErrorReport->setSingleShot(
false);
3104 connect (m_timerRegressionErrorReport, SIGNAL (timeout()),
this, SLOT (slotTimeoutRegressionErrorReport()));
3106 m_timerRegressionErrorReport->start(REGRESSION_INTERVAL);
3109 void MainWindow::startRegressionTestFileCmdScript()
3111 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::startRegressionTestFileCmdScript";
3113 m_timerRegressionFileCmdScript =
new QTimer();
3114 m_timerRegressionFileCmdScript->setSingleShot(
false);
3115 connect (m_timerRegressionFileCmdScript, SIGNAL (timeout()),
this, SLOT (slotTimeoutRegressionFileCmdScript()));
3117 m_timerRegressionFileCmdScript->start(REGRESSION_INTERVAL);
3122 return m_transformation;
3132 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateAfterCommand";
3134 ENGAUGE_CHECK_PTR (m_cmdMediator);
3138 updateAfterCommandStatusBarCoords ();
3140 updateHighlightOpacity ();
3146 updateChecklistGuide ();
3147 updateFittingWindow ();
3148 updateGeometryWindow();
3153 writeCheckpointToLogFile ();
3155 docScrub.
check (*
this,
3160 m_view->setFocus ();
3163 void MainWindow::updateAfterCommandStatusBarCoords ()
3165 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateAfterCommandStatusBarCoords";
3170 const QPoint HACK_SO_GRAPH_COORDINATE_MATCHES_INPUT (1, 1);
3174 updateTransformationAndItsDependencies();
3177 if (!m_transformationBefore.transformIsDefined() && m_transformation.
transformIsDefined()) {
3181 TRANSFORMATION_STATE_DEFINED,
3186 }
else if (m_transformationBefore.transformIsDefined() && !m_transformation.
transformIsDefined()) {
3190 TRANSFORMATION_STATE_UNDEFINED,
3195 }
else if (m_transformation.
transformIsDefined() && (m_transformationBefore != m_transformation)) {
3204 QPoint posLocal = m_view->mapFromGlobal (QCursor::pos ()) - HACK_SO_GRAPH_COORDINATE_MATCHES_INPUT;
3205 QPointF posScreen = m_view->mapToScene (posLocal);
3207 slotMouseMove (posScreen);
3212 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateAfterMouseRelease";
3217 void MainWindow::updateChecklistGuide ()
3219 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateChecklistGuide";
3221 m_dockChecklistGuide->
update (*m_cmdMediator,
3222 m_isDocumentExported);
3225 void MainWindow::updateControls ()
3227 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateControls"
3228 <<
" selectedItems=" << m_scene->selectedItems().count();
3230 m_cmbBackground->setEnabled (!m_currentFile.isEmpty ());
3232 m_actionImportImageReplace->setEnabled (m_cmdMediator !=
nullptr);
3233 #if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
3234 m_menuFileOpenRecent->setEnabled ((m_actionRecentFiles.count () > 0) &&
3235 (m_actionRecentFiles.at(0)->isVisible ()));
3237 m_actionClose->setEnabled (!m_currentFile.isEmpty ());
3238 m_actionSave->setEnabled (!m_currentFile.isEmpty ());
3239 m_actionSaveAs->setEnabled (!m_currentFile.isEmpty ());
3240 m_actionExport->setEnabled (!m_currentFile.isEmpty ());
3241 m_actionPrint->setEnabled (!m_currentFile.isEmpty ());
3243 if (m_cmdMediator ==
nullptr) {
3244 m_actionEditUndo->setEnabled (
false);
3245 m_actionEditRedo->setEnabled (
false);
3247 m_actionEditUndo->setEnabled (m_cmdMediator->canUndo ());
3248 m_actionEditRedo->setEnabled (m_cmdMediator->canRedo () || m_cmdStackShadow->
canRedo ());
3250 bool tableFittingIsActive, tableFittingIsCopyable;
3251 bool tableGeometryIsActive, tableGeometryIsCopyable;
3252 m_dockFittingWindow->
getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
3253 m_dockGeometryWindow->
getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
3254 m_actionEditCut->setEnabled (!tableFittingIsActive &&
3255 !tableGeometryIsActive &&
3256 m_scene->selectedItems().count () > 0);
3257 m_actionEditCopy->setEnabled ((!tableFittingIsActive && !tableGeometryIsActive && m_scene->selectedItems().count () > 0) ||
3258 (tableFittingIsActive && tableFittingIsCopyable) ||
3259 (tableGeometryIsActive && tableGeometryIsCopyable));
3260 m_actionEditPaste->setEnabled (m_digitizeStateContext->
canPaste (m_transformation,
3262 m_actionEditDelete->setEnabled (!tableFittingIsActive &&
3263 !tableGeometryIsActive &&
3264 m_scene->selectedItems().count () > 0);
3267 m_actionDigitizeAxis->setEnabled (modeGraph ());
3268 m_actionDigitizeScale->setEnabled (
modeMap ());
3269 m_actionDigitizeCurve ->setEnabled (!m_currentFile.isEmpty ());
3270 m_actionDigitizePointMatch->setEnabled (!m_currentFile.isEmpty ());
3271 m_actionDigitizeColorPicker->setEnabled (!m_currentFile.isEmpty ());
3272 m_actionDigitizeSegment->setEnabled (!m_currentFile.isEmpty ());
3273 m_actionDigitizeSelect->setEnabled (!m_currentFile.isEmpty ());
3275 m_actionViewGridLines->setEnabled (
true);
3277 m_actionViewGridLines->setEnabled (
false);
3278 m_actionViewGridLines->setChecked (
false);
3280 m_actionViewBackground->setEnabled (!m_currentFile.isEmpty());
3281 m_actionViewChecklistGuide->setEnabled (!m_dockChecklistGuide->
browserIsEmpty());
3282 m_actionViewDigitize->setEnabled (!m_currentFile.isEmpty ());
3283 m_actionViewSettingsViews->setEnabled (!m_currentFile.isEmpty ());
3285 m_actionSettingsCoords->setEnabled (!m_currentFile.isEmpty ());
3286 m_actionSettingsCurveList->setEnabled (!m_currentFile.isEmpty ());
3287 m_actionSettingsCurveProperties->setEnabled (!m_currentFile.isEmpty ());
3288 m_actionSettingsDigitizeCurve->setEnabled (!m_currentFile.isEmpty ());
3289 m_actionSettingsExport->setEnabled (!m_currentFile.isEmpty ());
3290 m_actionSettingsColorFilter->setEnabled (!m_currentFile.isEmpty ());
3291 m_actionSettingsAxesChecker->setEnabled (!m_currentFile.isEmpty ());
3292 m_actionSettingsGridDisplay->setEnabled (!m_currentFile.isEmpty () && m_transformation.
transformIsDefined());
3293 m_actionSettingsGridRemoval->setEnabled (!m_currentFile.isEmpty ());
3294 m_actionSettingsPointMatch->setEnabled (!m_currentFile.isEmpty ());
3295 m_actionSettingsSegments->setEnabled (!m_currentFile.isEmpty ());
3296 m_actionSettingsGeneral->setEnabled (!m_currentFile.isEmpty ());
3298 m_groupBackground->setEnabled (!m_currentFile.isEmpty ());
3299 m_groupCurves->setEnabled (!m_currentFile.isEmpty ());
3300 m_groupZoom->setEnabled (!m_currentFile.isEmpty ());
3302 m_actionZoomIn->setEnabled (!m_currentFile.isEmpty ());
3303 m_actionZoomOut->setEnabled (!m_currentFile.isEmpty ());
3308 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateCoordSystem";
3313 loadCurveListFromCmdMediator ();
3315 updateTransformationAndItsDependencies();
3327 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateDigitizeStateIfSoftwareTriggered";
3329 switch (digitizeState) {
3330 case DIGITIZE_STATE_AXIS:
3331 m_actionDigitizeAxis->setChecked(
true);
3335 case DIGITIZE_STATE_COLOR_PICKER:
3336 m_actionDigitizeColorPicker->setChecked(
true);
3337 slotDigitizeColorPicker();
3340 case DIGITIZE_STATE_CURVE:
3341 m_actionDigitizeCurve->setChecked(
true);
3342 slotDigitizeCurve();
3345 case DIGITIZE_STATE_EMPTY:
3348 case DIGITIZE_STATE_POINT_MATCH:
3349 m_actionDigitizePointMatch->setChecked(
true);
3350 slotDigitizePointMatch();
3353 case DIGITIZE_STATE_SCALE:
3354 m_actionDigitizeScale->setChecked(
true);
3355 slotDigitizeScale();
3358 case DIGITIZE_STATE_SEGMENT:
3359 m_actionDigitizeSegment->setChecked(
true);
3360 slotDigitizeSegment();
3363 case DIGITIZE_STATE_SELECT:
3364 m_actionDigitizeSelect->setChecked(
true);
3365 slotDigitizeSelect();
3369 LOG4CPP_ERROR_S ((*mainCat)) <<
"MainWindow::updateDigitizeStateIfSoftwareTriggered";
3374 void MainWindow::updateFittingWindow ()
3376 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateFittingWindow";
3378 if (m_cmdMediator !=
nullptr &&
3379 m_cmbCurve !=
nullptr) {
3382 m_dockFittingWindow->
update (*m_cmdMediator,
3384 m_cmbCurve->currentText (),
3389 void MainWindow::updateGeometryWindow ()
3391 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateGeometryWindow";
3393 if (m_cmdMediator !=
nullptr &&
3394 m_cmbCurve !=
nullptr) {
3397 m_dockGeometryWindow->
update (*m_cmdMediator,
3399 m_cmbCurve->currentText (),
3406 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateGraphicsLinesToMatchGraphicsPoints";
3412 void MainWindow::updateGridLines ()
3414 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateGridLines";
3417 m_gridLines.
clear ();
3428 m_gridLines.
setVisible (m_actionViewGridLines->isChecked());
3431 void MainWindow::updateHighlightOpacity ()
3433 if (m_cmdMediator !=
nullptr) {
3439 m_dockGeometryWindow,
3444 void MainWindow::updateRecentFileList()
3446 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateRecentFileList";
3448 #if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
3449 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
3450 QStringList recentFilePaths = settings.value(SETTINGS_RECENT_FILE_LIST).toStringList();
3453 unsigned int count = unsigned (recentFilePaths.size());
3454 if (count > MAX_RECENT_FILE_LIST_SIZE) {
3455 count = MAX_RECENT_FILE_LIST_SIZE;
3460 for (i = 0; i < signed (count); i++) {
3461 QString strippedName = QFileInfo (recentFilePaths.at(i)).fileName();
3462 m_actionRecentFiles.at (i)->setText (strippedName);
3463 m_actionRecentFiles.at (i)->setData (recentFilePaths.at (i));
3464 m_actionRecentFiles.at (i)->setVisible (
true);
3468 for (i =
signed (count); i < signed (MAX_RECENT_FILE_LIST_SIZE); i++) {
3469 m_actionRecentFiles.at (i)->setVisible (
false);
3476 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsAxesChecker";
3479 if (m_transformation.transformIsDefined()) {
3481 TRANSFORMATION_STATE_DEFINED,
3484 m_cmbCurve->currentText());
3487 TRANSFORMATION_STATE_UNDEFINED,
3490 m_cmbCurve->currentText());
3496 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsColorFilter";
3503 m_cmbCurve->currentText());
3510 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsCoords";
3517 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsCurveList";
3520 loadCurveListFromCmdMediator();
3526 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsCurveStyles";
3535 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsDigitizeCurve";
3539 modelDigitizeCurve);
3544 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsExportFormat";
3551 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsGeneral";
3558 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsGridDisplay";
3566 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsGridRemoval";
3571 void MainWindow::updateSettingsMainWindow()
3573 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsMainWindow";
3575 if (m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_ONLY ||
3576 m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL) {
3578 m_actionZoomIn->setShortcut (tr (
""));
3579 m_actionZoomOut->setShortcut (tr (
""));
3583 m_actionZoomIn->setShortcut (tr (
"+"));
3584 m_actionZoomOut->setShortcut (tr (
"-"));
3588 if ((m_scene !=
nullptr) &&
3589 (m_cmdMediator !=
nullptr)) {
3593 updateHighlightOpacity();
3594 updateWindowTitle();
3595 updateFittingWindow();
3596 updateGeometryWindow();
3601 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsMainWindow";
3609 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsPointMatch";
3616 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsSegments";
3622 void MainWindow::updateSmallDialogs ()
3639 void MainWindow::updateTransformationAndItsDependencies()
3641 m_transformation.update (!m_currentFile.isEmpty (),
3650 m_cmbCurve->currentText ());
3657 void MainWindow::updateViewedCurves ()
3659 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateViewedCurves";
3661 if (m_actionViewCurvesAll->isChecked ()) {
3665 }
else if (m_actionViewCurvesSelected->isChecked ()) {
3669 }
else if (m_actionViewCurvesNone->isChecked ()) {
3674 ENGAUGE_ASSERT (
false);
3680 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateViewsOfSettings";
3682 QString activeCurve = m_digitizeStateContext->
activeCurve ();
3689 if (activeCurve.isEmpty ()) {
3702 m_cmdMediator->
pixmap ());
3707 void MainWindow::updateWindowTitle ()
3709 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateWindowTitle";
3711 const QString PLACEHOLDER (
"[*]");
3713 QString title = QString (
"%1 %2")
3714 .arg (tr (
"Engauge Digitizer"))
3715 .arg (VERSION_NUMBER);
3717 QString fileNameMaybeStripped;
3718 if (!m_currentFileWithPathAndFileExtension.isEmpty()) {
3720 QFileInfo fileInfo (m_currentFileWithPathAndFileExtension);
3724 case MAIN_TITLE_BAR_FORMAT_NO_PATH:
3727 fileNameMaybeStripped = fileInfo.completeBaseName();
3730 case MAIN_TITLE_BAR_FORMAT_PATH:
3731 fileNameMaybeStripped = m_currentFileWithPathAndFileExtension;
3735 title += QString (
": %1")
3736 .arg (fileNameMaybeStripped);
3741 title += PLACEHOLDER;
3743 setWindowTitle (title);
3748 ENGAUGE_CHECK_PTR (m_view);
3754 ENGAUGE_CHECK_PTR (m_view);
3758 void MainWindow::writeCheckpointToLogFile ()
3761 QString checkpointDoc;
3762 QTextStream strDoc (&checkpointDoc);
3767 QString checkpointScene;
3768 QTextStream strScene (&checkpointScene);
3773 if (mainCat->
getPriority() == log4cpp::Priority::DEBUG) {
3775 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::writeCheckpointToLogFile\n"
3776 <<
"--------------DOCUMENT CHECKPOINT START----------" <<
"\n"
3777 << checkpointDoc.toLatin1().data()
3778 <<
"---------------DOCUMENT CHECKPOINT END-----------" <<
"\n"
3779 <<
"----------------SCENE CHECKPOINT START-----------" <<
"\n"
3780 << checkpointScene.toLatin1().data()
3781 <<
"-----------------SCENE CHECKPOINT END------------" ;
void addCoordSystems(unsigned int numberCoordSystemToAdd)
Add some number (0 or more) of additional coordinate systems.
void load(CmdMediator &cmdMediator)
Load settings from Document.
Factory class for generating the points, composed of QGraphicsItem objects, along a GridLine...
QDir getDirectoryImportOpen() const
Get the current Import/Open directory.
void updateGraphicsLinesToMatchGraphicsPoints(const CurveStyles &modelCurveStyles, const Transformation &transformation)
A mouse move has just occurred so move the selected points, since they were dragged.
void updateCoordSystem(CoordSystemIndex coordSystemIndex)
Select a different CoordSystem.
Model for DlgSettingsGeneral and CmdSettingsGeneral.
void unsetPointStyle()
Apply no PointStyle.
Given a set of point identifiers, if a map is in effect (with its two axis endpoints) then both axis ...
DocumentAxesPointsRequired documentAxesPointsRequired() const
Get method for DocumentAxesPointsRequired.
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 printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
unsigned int coordSystemCount() const
Number of CoordSystem.
void setCurveName(const QString &curveName)
Load information for the specified curve name. When called externally, the load method must have been...
void createGhosts(QGraphicsScene &scene)
Create ghosts from the path/rect/polygon lists.
Model for DlgSettingsPointMatch and CmdSettingsPointMatch.
Returns information about files.
void updateAfterPointAddition()
Update the graphics attributes.
Color filter parameters for one curve. For a class, this is handled the same as LineStyle and PointSt...
void resetOnLoad(CmdMediator *cmdMediator)
Resetting makes re-initializes for documents after the first.
void updateSettingsMainWindow(const MainWindowModel &modelMainWindow)
Update with new main window properties.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
void setStatusBarMode(StatusBarMode statusBarMode)
Set the status bar visibility mode.
Model for DlgSettingsGridDisplay and CmdSettingsGridDisplay.
DocumentModelColorFilter modelColorFilter() const
Get method for DocumentModelColorFilter.
Command for cutting all selected Points.
void setModelAxesChecker(const DocumentModelAxesChecker &modelAxesChecker)
Set method for DocumentModelAxesChecker.
void setModelGridRemoval(const DocumentModelGridRemoval &modelGridRemoval)
Set method for DocumentModelGridRemoval.
Dialog for saving error report for later transmission to the developers.
void clear()
Deallocate and remove all grid lines.
void updateDigitizeStateIfSoftwareTriggered(DigitizeState digitizeState)
After software-triggered state transition, this method manually triggers the action as if user had cl...
void setDragDropExport(bool dragDropExport)
Set method for drag and drop export.
unsigned int coordSystemIndexToBeRestored() const
Coordinate system index that was active before the ghosts.
static void setIdentifierIndex(unsigned int identifierIndex)
Reset the current index while performing a Redo.
void printStream(QString indentation, QTextStream &str)
Debugging method that supports print method of this class and printStream method of some other class(...
Wrapper around the Poppler library.
Wrapper around OpenJPEG library, in C, for opening jpeg2000 files.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void fitInView(GraphicsView &view)
Zoom so background fills the window.
void setModelPointMatch(const DocumentModelPointMatch &modelPointMatch)
Set method for DocumentModelPointMatch.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
Transformation transformation() const
Return read-only copy of transformation.
void updateModelDigitizeCurve(CmdMediator *cmdMediator, const DocumentModelDigitizeCurve &modelDigitizeCurve)
Update the digitize curve settings.
void setModelGeneral(const DocumentModelGeneral &modelGeneral)
Set method for DocumentModelGeneral.
void setEnabled(bool enabled)
Show the style with semi-transparency or full-transparency to indicate if associated Curve is active ...
void setSignificantDigits(int significantDigits)
Set method for significant digits.
Model for DlgSettingsCurveProperties and CmdSettingsCurveProperties.
void createGridLinesForEvenlySpacedGrid(const DocumentModelGridDisplay &modelGridDisplay, const Document &document, const MainWindowModel &modelMainWindow, const Transformation &transformation, GridLines &gridLines)
Create a rectangular (cartesian) or annular (polar) grid of evenly spaced grid lines.
Wrapper around the QImage class for read and importing non-PDF files.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
bool canRedo() const
Returns true if there is at least one command on the stack.
QString activeCurve() const
Curve name for active Curve. This can include AXIS_CURVE_NAME, and empty string.
void setModelSegments(const DocumentModelSegments &modelSegments)
Set method for DocumentModelSegments.
MainTitleBarFormat mainTitleBarFormat() const
Get method for MainWindow titlebar filename format.
void handleContextMenuEventAxis(CmdMediator *cmdMediator, const QString &pointIdentifier)
See DigitizeStateAbstractBase::handleContextMenuEventAxis.
void updateColorFilter(bool isGnuplot, const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &colorFilter, const QString &curveSelected)
Apply color filter settings.
void updateAfterMouseRelease()
Call MainWindow::updateControls (which is private) after the very specific case - a mouse press/relea...
void saveErrorReportFileAndExit(const char *comment, const char *file, int line, const char *context)
Save error report and exit.
void handleCurveChange(CmdMediator *cmdMediator)
See DigitizeStateAbstractBase::handleCurveChange.
void setDirectoryExportSaveFromFilename(const QString &fileName)
Save the current Export/Save directory, after user has accepted the Export/Save dialog.
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 handleContextMenuEventGraph(CmdMediator *cmdMediator, const QStringList &pointIdentifiers)
See DigitizeStateAbstractBase::handleContextMenuEventGraph.
void cmdFileClose()
Close file. This is called from a file script command.
void setModelGridDisplay(const DocumentModelGridDisplay &modelGridDisplay)
Set method for DocumentModelGridDisplay.
Provides list of file extensions for import.
bool modeMap() const
True if document scale is set using a scale bar, otherwise using axis points.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
void updateViewsOfSettings(const QString &activeCurve)
Update curve-specific view of settings. Private version gets active curve name from DigitizeStateCont...
QString selectedGraphCurve() const
Curve name that is currently selected in m_cmbCurve.
void setHighlightOpacity(double highlightOpacity)
Set method for highlight opacity.
Class for showing points and lines for all coordinate systems simultaneously, even though the code no...
DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void slotRedo()
Move next command from list to CmdMediator. Noop if there are no more commands.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
virtual void update(const CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow, const QString &curveSelected, const Transformation &transformation)
Populate the table with the specified Curve.
void getTableStatus(bool &tableIsActive, bool &tableIsCopyable) const
Give table status so MainWindow can determine if table can be copied.
void setModelDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Set method for DocumentModelDigitizeCurve.
PointStyle pointStyle() const
Get method for PointStyle.
ZoomFactor zoomOut(ZoomFactor currentZoomFactor, double m11, double m22, bool actionZoomFillIsChecked) const
Zoom out.
void cmdFileOpen(const QString &fileName)
Open file. This is called from a file script command.
virtual void update(const CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow, const QString &curveSelected, const Transformation &transformation)
Populate the table with the specified Curve.
CmdMediator * cmdMediator()
Accessor for commands to process the Document.
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.
MainWindow(const QString &errorReportFile, const QString &fileCmdScriptFile, bool isRegressionTest, bool isGnuplot, bool isReset, bool isExportOnly, bool isExtractImageOnly, const QString &extractImageOnlyExtension, const QStringList &loadStartupFiles, const QStringList &commandLineWithoutLoadStartupFiles, QWidget *parent=0)
Single constructor.
void setModelCoords(const DocumentModelCoords &modelCoords)
Set method for DocumentModelCoords.
void wakeUp()
Enable all widgets in the status bar. This is called just after a Document becomes active...
BackgroundImage selectOriginal(BackgroundImage backgroundImage)
Make original background visible, for DigitizeStateColorPicker.
void setDirectoryImportOpenFromFilename(const QString &fileName)
Save the current Import/Open directory, after user has accepted the Import/Open dialog.
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.
double mapToFactor(ZoomFactor zoomFactor) const
Return the floating precision zoom factor given the enum value.
void updateAfterCommand(CmdMediator &cmdMediator, double highlightOpacity, GeometryWindow *geometryWindow, const Transformation &transformation)
Update the Points and their Curves after executing a command.
void setLocale(QLocale::Language language, QLocale::Country country)
Set method for locale given attributes.
void handleKeyPress(CmdMediator *cmdMediator, Qt::Key key, bool atLeastOneSelectedItem)
See DigitizeStateAbstractBase::handleKeyPress.
void setPixmap(const QImage &image)
Set method for the background pixmap.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void showTemporaryMessage(const QString &temporaryMessage)
Show temporary message in status bar.
void retrievePoints(const Transformation &transformation, QList< QPoint > &points, QList< double > &ordinals) const
Retrieve points from clipboard.
bool load(const QString &filename, QImage &image) const
Load image from jpeg2000 file.
static void bindToMainWindow(MainWindow *mainWindow)
Bind to MainWindow so this class can access the command stack.
void setImageIsLoaded(CmdMediator *cmdMediator, bool imageIsLoaded)
Set the image so QGraphicsView cursor and drag mode are accessible.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
int maximumGridLines() const
Maximum number of grid lines.
void setCoordSystemIndex(CoordSystemIndex coordSystemIndex)
Set the index of current active CoordSystem.
void updateSettingsDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Update with new curve digitization styles.
bool dragDropExport() const
Get method for drag and drop export.
void loadMainWindowModel(CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow)
Replaced load method since the main window settings are independent of document, unlike other DlgSett...
void cmdFileExport(const QString &fileName)
Export file. This is called from a file script command.
bool smallDialogs() const
Get method for small dialogs flag.
Strategy class for exporting to a file. This strategy is external to the Document class so that class...
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
CoordSystemIndex coordSystemIndex() const
Index of current active CoordSystem.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void setModelExport(const DocumentModelExportFormat &modelExport)
Set method for DocumentModelExportFormat.
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
GraphicsView & view()
View for the QImage and QGraphicsItems, without const.
StatusBarMode statusBarMode() const
Current mode for status bar visibility. This is tracked locally so this class knows when to hide/show...
ZoomControl zoomControl() const
Get method for zoom control.
QString fileExtensionTsv() const
File extension for tsv export files.
Details for a specific Point.
Class for exporting during regression, when the Transformation has not yet been defined.
Container for all graph curves. The axes point curve is external to this class.
void setBackgroundImage(BackgroundImage backgroundImage)
Transition to the specified state. This method is used by classes outside of the state machine to tri...
Model for DlgSettingsColorFilter and CmdSettingsColorFilter.
GraphicsScene & scene()
Scene container for the QImage and QGraphicsItems.
void updateSettingsGridDisplay(const DocumentModelGridDisplay &modelGridDisplay)
Update with new grid display properties.
void setEnabled(bool enabled)
Show the style with semi-transparency or full-transparency to indicate if associated Curve is active ...
void updateSettingsCurveStyles(const CurveStyles &modelCurveStyles)
Update with new curve styles.
void setModelCurveStyles(const CurveStyles &modelCurveStyles)
Set method for CurveStyles.
bool browserIsEmpty() const
When browser is empty, it is pointless to show it.
Facade class that wraps around all of the create classes for MainWindow.
CurveStyles modelCurveStyles() const
Get method for CurveStyles.
QGraphicsView class with event handling added. Typically the events are sent to the active digitizing...
virtual void doCopy()
Copy the current selection to the clipboard.
Model for DlgSettingsMainWindow.
void appendNewCmd(CmdMediator *cmdMediator, QUndoCommand *cmd)
Append just-created QUndoCommand to command stack. This is called from DigitizeStateAbstractBase subc...
void create(MainWindow &mw)
Create QAction facade.
bool canRedo() const
Return true if there is a command available.
DocumentModelAxesChecker modelAxesChecker() const
Get method for DocumentModelAxesChecker.
void updateModelSegments(const DocumentModelSegments &modelSegments)
Update the segments given the new settings.
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...
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
void resetOnLoad()
Reset, when loading a document after the first, to same state that first document was at when loaded...
Command for adding one or more graph points. This is for Segment Fill mode.
void setCurveSelected(bool isGnuplot, const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &modelColorFilter, const QString &curveSelected)
Update the selected curve.
void resetPositionHasChangedFlags()
Reset positionHasChanged flag for all items. Typically this is done as part of mousePressEvent.
void fileExport(const QString &filename) const
Export to the specified file. This is called when the Transformation has not been defined...
void setModelColorFilter(const DocumentModelColorFilter &modelColorFilter)
Set method for DocumentModelColorFilter.
void close()
Open Document is being closed so remove the background.
QImage imageForCurveState() const
Image for the Curve state, even if the current state is different.
Priority::Value getPriority() const
Returns unused priority.
Model for DlgSettingsCoords and CmdSettingsCoords.
void setVisible(bool visible)
Make all grid lines visible or hidden.
void updateAfterCommand()
See GraphicsScene::updateAfterCommand.
QString fileExtensionCsv() const
File extension for csv export files.
Curve that overlays the current scene so the regression-fitted curve is visible.
void updateSettingsColorFilter(const DocumentModelColorFilter &modelColorFilter)
Update with new color filter properties.
Command for deleting all selected Points.
void setMaximumGridLines(int maximumGridLines)
Set method for maximum number of grid lines.
void updateSettingsAxesChecker(const DocumentModelAxesChecker &modelAxesChecker)
Update with new axes indicator properties.
void updateSettingsPointMatch(const DocumentModelPointMatch &modelPointMatch)
Update with new point match properties.
void updateSettingsGeneral(const DocumentModelGeneral &modelGeneral)
Update with new general properties.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
void redo(MainWindow &mainWindow)
Apply the next command. Requires non-empty stack.
void setPointStyle(const PointStyle &pointStyle)
Apply the PointStyle of the currently selected curve.
QImage imageFiltered() const
Background image that has been filtered for the current curve. This asserts if a curve-specific image...
void updateSettingsGridRemoval(const DocumentModelGridRemoval &modelGridRemoval)
Update with new grid removal properties.
void showTemporaryMessage(const QString &message)
Show temporary message in status bar. After a short interval the message will disappear.
void exportToFile(const DocumentModelExportFormat &modelExport, const Document &document, const MainWindowModel &modelMainWindow, const Transformation &transformation, QTextStream &str) const
Export Document points according to the settings.
double highlightOpacity() const
Get method for highlight opacity.
void updateCurveStyles(const CurveStyles &modelCurveStyles)
Update curve styles after settings changed.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
QStringList curvesGraphsNames() const
See CurvesGraphs::curvesGraphsNames.
void unsetColorFilterSettings()
Apply no color filter.
Dialog for setting the advanced parameters in a newly imported Document.
Wizard for setting up the checklist guide.
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...
void handleMouseMove(CmdMediator *cmdMediator, QPointF pos)
See DigitizeStateAbstractBase::handleMouseMove.
int pdfResolution() const
Get method for resolution of imported PDF files, in dots per inch.
QDir getDirectoryExportSave() const
Get the current Export/Save directory.
Model for DlgSettingsAxesChecker and CmdSettingsAxesChecker.
QString filterTsv() const
QFileDialog filter for TSV files.
void updateSettingsExportFormat(const DocumentModelExportFormat &modelExport)
Update with new export properties.
Import of point data from clipboard.
virtual bool eventFilter(QObject *, QEvent *)
Catch secret keypresses.
void startLoadImage(const QUrl &url)
Start the asynchronous loading of an image from the specified url.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
bool loadsAsDigFile(const QString &urlString) const
Returns true if specified file name can be loaded as a DIG file.
void resetOnLoad()
Reset, when loading a document after the first, to same state that first document was at when loaded...
Perform calculations to determine the next zoom setting given the current zoom setting, when zooming in or out.
bool isGnuplot() const
Get method for gnuplot flag.
CurveStyle curveStyle(const QString &curveName) const
CurveStyle in specified curve.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
void setZoomControl(ZoomControl zoomControl)
Set method for zoom control.
void setMainTitleBarFormat(MainTitleBarFormat mainTitleBarFormat)
Set method for MainWindow titlebar filename format.
void handleMouseRelease(CmdMediator *cmdMediator, QPointF pos)
See DigitizeStateAbstractBase::handleMouseRelease.
void captureGraphicsItems(QGraphicsScene &scene)
Take a snapshot of the graphics items.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void setZoomFactorInitial(ZoomFactorInitial zoomFactorInitial)
Set method for initial zoom factor.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
void signalZoom(int)
Send zoom selection, picked from menu or keystroke, to StatusBar.
Model for DlgSettingsSegments and CmdSettingsSegments.
void destroyGhosts(QGraphicsScene &scene)
Destory ghosts. Called at end of algorithm.
void cmdFileImport(const QString &fileName)
Import file. This is called from a file script command.
void setCurvesGraphs(const CurvesGraphs &curvesGraphs)
Let CmdAbstract classes overwrite CurvesGraphs.
void updateAxesChecker(CmdMediator &cmdMediator, const Transformation &transformation)
Apply the new DocumentModelAxesChecker.
void resizeEvent(QResizeEvent *event)
Intercept resize event so graphics scene can be appropriately resized when in Fill mode...
void updateSettingsCoords(const DocumentModelCoords &modelCoords)
Update with new coordinate properties.
void triggerStateTransition(bool isGnuplot, TransformationState transformationState, CmdMediator &cmdMediator, const Transformation &transformation, const QString &selectedGraphCurve)
Trigger a state transition to be performed immediately.
void loadCommands(MainWindow &mainWindow, Document &document, QXmlStreamReader &reader)
Load commands from serialized xml.
void update(const CmdMediator &cmdMediator, bool documentIsExported)
Update using current CmdMediator/Document state.
ZoomFactorInitial zoomFactorInitial() const
Get method for initial zoom factor.
File that manages a command stack for regression testing of file import/open/export/close.
void setSmallDialogs(bool smallDialogs)
Set method for small dialogs flag.
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.
void check(MainWindow &mainWindow, const Document &document) const
Check document state.
void handleMousePress(CmdMediator *cmdMediator, QPointF pos)
See DigitizeStateAbstractBase::handleMousePress.
Add point and line handling to generic QGraphicsScene.
QString filterCsv() const
QFileDialog filter for CSV files.
QStringList fileExtensionsWithAsterisks() const
File extensions for use in file dialogs.
ImportCropping importCropping() const
Get method for import cropping.
Command for moving all selected Points by a specified translation.
DocumentModelGridDisplay modelGridDisplay() const
Get method for DocumentModelGridDisplay.
void saveXml(QXmlStreamWriter &writer) const
Save document to xml.
QLocale locale() const
Get method for locale.
Model for DlgSettingsGridRemoval and CmdSettingsGridRemoval. The settings are unstable until the user...
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void updateSettingsSegments(const DocumentModelSegments &modelSegments)
Update with new segments properties.
Command for changing the currently selected CoordSystem.
ZoomFactor zoomIn(ZoomFactor currentZoomFactor, double m11, double m22, bool actionZoomFillIsChecked) const
Zoom in.
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 setPdfResolution(int resolution)
Set method for resolution of imported PDF files, in dots per inch.
void updateGraphicsLinesToMatchGraphicsPoints()
Update the graphics lines so they follow the graphics points, after a drag, addition, removal, and such.
Persist the directory between successive Import/Open operations, or successive Export/Save operations...
void populateCurvesGraphs(CoordSystemIndex coordSystemIndex, CurvesGraphs &curvesGraphs)
Create entries in CurvesGraphs for each curve name that user provided.
DocumentModelGridRemoval modelGridRemoval() const
Get method for DocumentModelGridRemoval.
void setImportCropping(ImportCropping importCropping)
Set method for import cropping.
MainWindowModel modelMainWindow() const
Get method for main window model.
QString templateHtml(CoordSystemIndex coordSystemIndex) const
Template html comprising the checklist for display.
QStringList unite(CmdMediator *cmdMediator, const QStringList &pointIdentifiersIn) const
Add.
void setTemplateHtml(const QString &html, const QStringList &curveNames)
Populate the browser with template html.
DocumentModelExportFormat modelExport() const
Get method for DocumentModelExportFormat.
virtual void clear()
Clear stale information.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
QStringList curveNames(CoordSystemIndex coordSystemIndex) const
Curve names to be placed into Document.
About Engauge dialog. This provides a hidden shortcut for triggering ENGAUGE_ASSERT.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
virtual void clear()
Clear stale information.
virtual void showEvent(QShowEvent *)
Processing performed after gui becomes available.
bool transformIsDefined() const
Return true if all three axis points have been defined.
void requestImmediateStateTransition(CmdMediator *cmdMediator, DigitizeState digitizeState)
Perform immediate state transition. Called from outside state machine.
virtual void doCopy()
Copy the current selection to the clipboard.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
void updateSettingsCurveList(const CurvesGraphs &curvesGraphs)
Update with new curves.