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 (0),
154 m_digitizeStateContext (0),
155 m_transformationStateContext (0),
156 m_backgroundStateContext (0),
158 m_isGnuplot (isGnuplot),
159 m_commandLineWithoutLoadStartupFiles (commandLineWithoutLoadStartupFiles),
161 m_timerRegressionErrorReport(0),
163 m_isErrorReportRegressionTest (isRegressionTest),
164 m_timerRegressionFileCmdScript(0),
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()
232 void MainWindow::addDockWindow (QDockWidget *dockWidget,
234 const QString &settingsTokenArea,
235 const QString &settingsTokenGeometry,
236 Qt::DockWidgetArea dockWidgetArea)
241 const bool DOCKED_EQUALS_NOT_FLOATING =
false;
242 Qt::DockWidgetArea area = (Qt::DockWidgetArea) settings.value (settingsTokenArea,
243 Qt::NoDockWidgetArea).toInt();
245 if (area == Qt::NoDockWidgetArea) {
247 addDockWidget (dockWidgetArea,
249 dockWidget->setFloating(DOCKED_EQUALS_NOT_FLOATING);
250 if (settings.contains (settingsTokenGeometry)) {
251 dockWidget->restoreGeometry (settings.value (settingsTokenGeometry).toByteArray());
262 void MainWindow::applyZoomFactorAfterLoad()
264 ZoomFactor zoomFactor;
267 if (m_zoomMapFromInitial.contains (zoomFactorInitial)) {
268 zoomFactor = m_zoomMapFromInitial [zoomFactorInitial];
269 }
else if (zoomFactorInitial == ZOOM_INITIAL_PREVIOUS) {
270 zoomFactor = currentZoomFactor ();
272 ENGAUGE_ASSERT (
false);
273 zoomFactor = currentZoomFactor();
276 slotViewZoom (zoomFactor);
279 void MainWindow::closeEvent(QCloseEvent *event)
291 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileClose";
293 setWindowModified (
false);
299 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileExport";
308 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileImport";
310 m_regressionFile = exportRegressionFilenameFromInputFilename (fileName);
311 fileImport (fileName,
317 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::cmdFileOpen";
319 m_regressionFile = exportRegressionFilenameFromInputFilename (fileName);
320 loadDocumentFile(fileName);
326 return m_cmdMediator;
329 ZoomFactor MainWindow::currentZoomFactor ()
const 332 for (
int z = 0; z < NUMBER_ZOOM_FACTORS; z++) {
333 ZoomFactor zoomFactor = (ZoomFactor) z;
334 if (m_zoomMapToAction [zoomFactor]->isChecked ()) {
340 ENGAUGE_ASSERT (
false);
346 if (event->type () == QEvent::KeyPress) {
348 QKeyEvent *eventKeyPress = (QKeyEvent *) event;
351 if ((eventKeyPress->key() == Qt::Key_E) &&
352 ((eventKeyPress->modifiers() & Qt::ShiftModifier) != 0) &&
353 ((eventKeyPress->modifiers() & Qt::ControlModifier) != 0)) {
363 return QObject::eventFilter (target, event);
366 #if !defined(OSX_DEBUG) && !defined(OSX_RELEASE) 367 void MainWindow::exportAllCoordinateSystemsAfterRegressionTests()
369 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::exportAllCoordinateSystemsAfterRegressionTests curDir=" << QDir::currentPath().toLatin1().data();
376 QString regressionFile = QString (
"%1_%2")
377 .arg (m_regressionFile)
391 fileExport (regressionFile,
398 QString MainWindow::exportRegressionFilenameFromInputFilename (
const QString &fileName)
const 400 QString outFileName = fileName;
402 outFileName = outFileName.replace (
".xml",
".csv_actual", Qt::CaseInsensitive);
403 outFileName = outFileName.replace (
".dig",
".csv_actual", Qt::CaseInsensitive);
404 outFileName = outFileName.replace (
".pdf",
".csv_actual", Qt::CaseInsensitive);
409 void MainWindow::fileExport(
const QString &fileName,
412 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileExport" 413 <<
" curDir=" << QDir::currentPath().toLatin1().data()
414 <<
" fileName=" << fileName.toLatin1().data();
416 QFile file (fileName);
417 if (file.open(QIODevice::WriteOnly)) {
419 QTextStream str (&file);
430 m_isDocumentExported =
true;
432 updateChecklistGuide ();
437 LOG4CPP_ERROR_S ((*mainCat)) <<
"MainWindow::fileExport" 438 <<
" file=" << fileName.toLatin1().data()
439 <<
" curDir=" << QDir::currentPath().toLatin1().data();
440 QMessageBox::critical (0,
441 engaugeWindowTitle(),
442 tr (
"Unable to export to file") +
" " + fileName);
446 void MainWindow::fileExtractImage (
const QString &fileName)
448 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileExtractImage" 449 <<
" curDir=" << QDir::currentPath().toLatin1().data()
450 <<
" fileName=" << fileName.toLatin1().data();
452 QFile file (fileName);
453 if (file.open(QIODevice::WriteOnly)) {
455 QPixmap pixmap = m_cmdMediator->
pixmap();
459 if (m_isErrorReportRegressionTest) {
460 QString csvFile = QString (
"%1_1")
461 .arg (exportRegressionFilenameFromInputFilename (m_regressionFile));
465 process.start (
"bash -c \"cksum " + fileName +
" | awk '{print $1}' > " + csvFile +
"\"");
466 process.waitForFinished (-1);
471 LOG4CPP_ERROR_S ((*mainCat)) <<
"MainWindow::fileExtractImage" 472 <<
" file=" << fileName.toLatin1().data()
473 <<
" curDir=" << QDir::currentPath().toLatin1().data();
474 QMessageBox::critical (0,
475 engaugeWindowTitle(),
476 tr (
"Unable to extract image to file") +
" " + fileName);
480 void MainWindow::fileImport (
const QString &fileName,
481 ImportType importType)
483 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileImport" 484 <<
" fileName=" << fileName.toLatin1 ().data ()
485 <<
" curDir=" << QDir::currentPath().toLatin1().data()
486 <<
" importType=" << importType;
488 QString originalFileOld = m_originalFile;
489 bool originalFileWasImported = m_originalFileWasImported;
491 m_originalFile = fileName;
492 m_originalFileWasImported =
true;
494 if (importType == IMPORT_TYPE_ADVANCED) {
507 #ifdef ENGAUGE_JPEG2000 509 loaded = jpeg2000.
load (fileName,
511 #endif // ENGAUGE_JPEG2000 517 PdfReturn pdfReturn = pdf.
load (fileName,
521 m_isErrorReportRegressionTest);
522 if (pdfReturn == PDF_RETURN_CANCELED) {
529 loaded = (pdfReturn == PDF_RETURN_SUCCESS);
531 #endif // ENGAUGE_PDF 535 NonPdfReturn nonPdfReturn = nonPdf.
load (fileName,
538 m_isErrorReportRegressionTest);
539 if (nonPdfReturn == NON_PDF_RETURN_CANCELED) {
546 loaded = (nonPdfReturn == NON_PDF_RETURN_SUCCESS);
550 QString msg = QString(
"%1 %2 %3 %4.")
551 .arg (tr (
"Cannot read file"))
553 .arg (tr (
"from directory"))
554 .arg (QDir::currentPath());
556 if (fileName.contains (
"???")) {
561 msg += QObject::tr (
"The file appears to have characters from multiple language " 562 "alphabets, which does not work in the Windows command line");
565 QMessageBox::warning (
this,
566 engaugeWindowTitle(),
570 m_originalFile = originalFileOld;
571 m_originalFileWasImported = originalFileWasImported;
575 loaded = loadImage (fileName,
582 if (importType == IMPORT_TYPE_ADVANCED) {
592 m_originalFile = originalFileOld;
593 m_originalFileWasImported = originalFileWasImported;
599 void MainWindow::fileImportWithPrompts (ImportType importType)
601 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::fileImportWithPrompts" 602 <<
" importType=" << importType;
606 bool okToContinue =
true;
607 if (importType != IMPORT_TYPE_IMAGE_REPLACE) {
608 okToContinue = maybeSave ();
614 QTextStream str (&filter);
619 str <<
"Image Files (" << supportedImageFormatStrings.join (
" ") <<
")";
623 str <<
";; All Files (*.*)";
626 QString fileName = QFileDialog::getOpenFileName (
this,
630 if (!fileName.isEmpty ()) {
635 fileImport (fileName,
641 QString MainWindow::fileNameForExportOnly ()
const 646 if (m_isErrorReportRegressionTest) {
649 fileName = QString (
"%1_1")
650 .arg (exportRegressionFilenameFromInputFilename (m_regressionFile));
655 QString dir = QFileInfo (m_currentFileWithPathAndFileExtension).absolutePath();
656 fileName = QString (
"%1/%2.%3")
665 QString MainWindow::fileNameForExtractImageOnly ()
const 668 QString dir = QFileInfo (m_currentFileWithPathAndFileExtension).absolutePath();
669 QString fileName = QString (
"%1/%2.%3")
672 .arg (m_extractImageOnlyExtension);
677 void MainWindow::filePaste (ImportType importType)
679 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::filePaste" 680 <<
" importType=" << importType;
682 QString originalFileOld = m_originalFile;
683 bool originalFileWasImported = m_originalFileWasImported;
685 QString fileName (
"clipboard");
686 m_originalFile = fileName;
687 m_originalFileWasImported =
true;
689 if (importType == IMPORT_TYPE_ADVANCED) {
700 QImage image = QApplication::clipboard()->image();
704 loaded = !image.isNull();
708 QMessageBox::warning (
this,
709 engaugeWindowTitle(),
710 QString(
"%1 %2 %3 %4.")
711 .arg (tr (
"Cannot read file"))
713 .arg (tr (
"from directory"))
714 .arg (QDir::currentPath ()));
717 m_originalFile = originalFileOld;
718 m_originalFileWasImported = originalFileWasImported;
722 loaded = loadImage (fileName,
729 if (importType == IMPORT_TYPE_ADVANCED) {
739 m_originalFile = originalFileOld;
740 m_originalFileWasImported = originalFileWasImported;
746 void MainWindow::ghostsCreate ()
748 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::ghostsCreate";
750 ENGAUGE_ASSERT (m_ghosts == 0);
772 void MainWindow::ghostsDestroy ()
774 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::ghostsDestroy";
776 ENGAUGE_CHECK_PTR (m_ghosts);
784 void MainWindow::handlerFileExtractImage ()
786 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::handlerFileExtractImage";
788 if (m_isExtractImageOnly) {
789 QString fileName = fileNameForExtractImageOnly ();
794 fileExtractImage(fileName);
808 void MainWindow::loadCoordSystemListFromCmdMediator ()
810 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadCoordSystemListFromCmdMediator";
812 m_cmbCoordSystem->clear();
816 for (
unsigned int i = 0; i < numberCoordSystem; i++) {
817 int index1Based = i + 1;
818 m_cmbCoordSystem->addItem (QString::number (index1Based),
823 m_cmbCoordSystem->setCurrentIndex (0);
826 bool enable = (m_cmbCoordSystem->count() > 1);
827 m_cmbCoordSystem->setEnabled (enable);
828 m_btnShowAll->setEnabled (enable);
829 m_btnPrintAll->setEnabled (enable);
832 void MainWindow::loadCurveListFromCmdMediator ()
834 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadCurveListFromCmdMediator";
836 m_cmbCurve->clear ();
838 QStringList::iterator itr;
839 for (itr = curvesGraphsNames.begin (); itr != curvesGraphsNames.end (); itr++) {
841 QString curvesGraphName = *itr;
842 m_cmbCurve->addItem (curvesGraphName);
849 void MainWindow::loadDocumentFile (
const QString &fileName)
851 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadDocumentFile fileName=" << fileName.toLatin1 ().data ();
853 QApplication::setOverrideCursor(Qt::WaitCursor);
859 setCurrentPathFromFile (fileName);
860 rebuildRecentFileListForCurrentFile(fileName);
861 m_currentFile = fileName;
863 delete m_cmdMediator;
866 setupAfterLoadNewDocument (fileName,
871 m_actionDigitizeSelect->setChecked (
true);
872 slotDigitizeSelect();
874 m_engaugeFile = fileName;
875 m_originalFile = fileName;
876 m_originalFileWasImported =
false;
881 QApplication::restoreOverrideCursor();
885 QApplication::restoreOverrideCursor();
887 QMessageBox::warning (
this,
888 engaugeWindowTitle(),
889 QString(
"%1 %2 %3 %4:\n%5.")
890 .arg (tr (
"Cannot read file"))
892 .arg (tr (
"from directory"))
893 .arg (QDir::currentPath ())
900 void MainWindow::loadErrorReportFile(
const QString &errorReportFile)
902 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadErrorReportFile" 903 <<
" file=" << errorReportFile.toLatin1().data();
905 QFile file (errorReportFile);
906 if (!file.exists()) {
908 QFileInfo fileInfo (errorReportFile);
910 QMessageBox::critical (
this,
911 engaugeWindowTitle(),
912 tr (
"File not found") +
": " + fileInfo.absoluteFilePath());
917 QXmlStreamReader reader (&file);
918 file.open(QIODevice::ReadOnly | QIODevice::Text);
928 setupAfterLoadNewDocument (errorReportFile,
929 tr (
"Error report opened"),
933 m_actionDigitizeSelect->setChecked (
true);
934 slotDigitizeSelect();
939 bool MainWindow::loadImage (
const QString &fileName,
941 ImportType importType)
943 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadImage" 944 <<
" fileName=" << fileName.toLatin1 ().data ()
945 <<
" importType=" << importType;
948 if (importType == IMPORT_TYPE_IMAGE_REPLACE) {
949 success = loadImageReplacingImage (fileName,
953 success = loadImageNewDocument (fileName,
961 bool MainWindow::loadImageNewDocument (
const QString &fileName,
963 ImportType importType)
965 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadImageNewDocument" 966 <<
" fileName=" << fileName.toLatin1 ().data ()
967 <<
" importType=" << importType;
969 ENGAUGE_ASSERT (importType != IMPORT_TYPE_IMAGE_REPLACE);
971 QApplication::setOverrideCursor(Qt::WaitCursor);
974 QApplication::restoreOverrideCursor();
976 setCurrentPathFromFile (fileName);
978 m_engaugeFile = EMPTY_FILENAME;
980 delete m_cmdMediator;
983 bool accepted = setupAfterLoadNewDocument (fileName,
984 tr (
"File imported"),
990 if (m_actionHelpChecklistGuideWizard->isChecked () &&
991 (m_fileCmdScript == 0)) {
996 if (wizard->exec() == QDialog::Accepted) {
998 for (CoordSystemIndex coordSystemIndex = 0; coordSystemIndex < m_cmdMediator->
document().
coordSystemCount(); coordSystemIndex++) {
1012 m_actionViewChecklistGuide->setChecked (
true);
1015 loadCurveListFromCmdMediator();
1018 loadCoordSystemListFromCmdMediator();
1024 m_actionDigitizeAxis->setChecked (
true);
1028 slotDigitizeScale ();
1029 }
else if (modeGraph ()) {
1030 slotDigitizeAxis ();
1039 bool MainWindow::loadImageReplacingImage (
const QString &fileName,
1040 const QImage &image,
1041 ImportType importType)
1043 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::loadImageReplacingImage" 1044 <<
" fileName=" << fileName.toLatin1 ().data ()
1045 <<
" importType=" << importType;
1047 ENGAUGE_ASSERT (importType == IMPORT_TYPE_IMAGE_REPLACE);
1049 setCurrentPathFromFile (fileName);
1051 m_engaugeFile = EMPTY_FILENAME;
1053 ENGAUGE_ASSERT (m_cmdMediator != 0);
1057 bool accepted = setupAfterLoadReplacingImage (fileName,
1058 tr (
"File imported"),
1066 void MainWindow::loadInputFileForErrorReport(QDomDocument &domInputFile)
const 1068 QFile file (m_originalFile);
1072 if (!file.open (QIODevice::ReadOnly)) {
1076 domInputFile.setContent (&file);
1080 void MainWindow::loadToolTips()
1082 if (m_actionViewToolTips->isChecked ()) {
1085 m_actionDigitizeSelect->setToolTip (m_actionDigitizeSelect->text());
1086 m_actionDigitizeAxis->setToolTip (m_actionDigitizeAxis->text());
1087 m_actionDigitizeScale->setToolTip (m_actionDigitizeScale->text());
1088 m_actionDigitizeCurve->setToolTip (m_actionDigitizeCurve->text());
1089 m_actionDigitizePointMatch->setToolTip (m_actionDigitizePointMatch->text());
1090 m_actionDigitizeColorPicker->setToolTip (m_actionDigitizeColorPicker->text());
1091 m_actionDigitizeSegment->setToolTip (m_actionDigitizeSegment->text());
1092 m_cmbBackground->setToolTip (tr (
"Background image."));
1093 m_cmbCurve->setToolTip (tr (
"Currently selected curve."));
1094 m_viewPointStyle->setToolTip (tr (
"Point style for currently selected curve."));
1095 m_viewSegmentFilter->setToolTip (tr (
"Segment Fill filter for currently selected curve."));
1100 m_actionDigitizeSelect->setToolTip (
"");
1101 m_actionDigitizeAxis->setToolTip (
"");
1102 m_actionDigitizeScale->setToolTip (
"");
1103 m_actionDigitizeCurve->setToolTip (
"");
1104 m_actionDigitizePointMatch->setToolTip (
"");
1105 m_actionDigitizeColorPicker->setToolTip (
"");
1106 m_actionDigitizeSegment->setToolTip (
"");
1107 m_cmbBackground->setToolTip (
"");
1108 m_cmbCurve->setToolTip (
"");
1109 m_viewPointStyle->setToolTip (
"");
1110 m_viewSegmentFilter->setToolTip (
"");
1115 bool MainWindow::modeGraph ()
const 1117 bool success =
false;
1119 if (m_cmdMediator != 0) {
1128 bool success =
false;
1130 if (m_cmdMediator != 0) {
1137 bool MainWindow::maybeSave()
1139 if (m_cmdMediator != 0) {
1141 QMessageBox::StandardButton ret = QMessageBox::warning (
this,
1142 engaugeWindowTitle(),
1143 tr(
"The document has been modified.\n" 1144 "Do you want to save your changes?"),
1145 QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
1146 if (ret == QMessageBox::Save) {
1147 return slotFileSave();
1148 }
else if (ret == QMessageBox::Cancel) {
1159 const QString &fileName)
const 1167 QString csvExtension = QString (
".%1")
1169 QString tsvExtension = QString (
".%1")
1171 QString fileExtensionVersusCsv = fileName.right (csvExtension.size());
1172 QString fileExtensionVersusTsv = fileName.right (tsvExtension.size());
1176 if (csvExtension.compare (fileExtensionVersusCsv, Qt::CaseInsensitive) == 0) {
1177 modelExportFormatAfter.
setDelimiter (EXPORT_DELIMITER_COMMA);
1178 }
else if (tsvExtension.compare (fileExtensionVersusTsv, Qt::CaseInsensitive) == 0) {
1179 modelExportFormatAfter.
setDelimiter (EXPORT_DELIMITER_TAB);
1183 return modelExportFormatAfter;
1188 return m_modelMainWindow;
1191 void MainWindow::rebuildRecentFileListForCurrentFile(
const QString &filePath)
1193 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::rebuildRecentFileListForCurrentFile";
1195 setWindowFilePath (filePath);
1197 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
1198 QStringList recentFilePaths = settings.value (SETTINGS_RECENT_FILE_LIST).toStringList();
1199 recentFilePaths.removeAll (filePath);
1200 recentFilePaths.prepend (filePath);
1201 while (recentFilePaths.count () > (int) MAX_RECENT_FILE_LIST_SIZE) {
1202 recentFilePaths.removeLast ();
1204 settings.setValue (SETTINGS_RECENT_FILE_LIST, recentFilePaths);
1206 updateRecentFileList();
1211 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::resizeEvent";
1213 if (m_actionZoomFill->isChecked ()) {
1214 slotViewZoomFactor (ZOOM_FILL);
1218 bool MainWindow::saveDocumentFile (
const QString &fileName)
1220 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::saveDocumentFile fileName=" << fileName.toLatin1 ().data ();
1222 QFile file(fileName);
1223 if (!file.open(QFile::WriteOnly)) {
1224 QMessageBox::warning (
this,
1225 engaugeWindowTitle(),
1226 QString (
"%1 %2: \n%3.")
1227 .arg(tr (
"Cannot write file"))
1229 .arg(file.errorString()));
1233 rebuildRecentFileListForCurrentFile (fileName);
1235 QApplication::setOverrideCursor (Qt::WaitCursor);
1236 QXmlStreamWriter writer(&file);
1237 writer.setAutoFormatting(
true);
1238 writer.writeStartDocument();
1239 writer.writeDTD(
"<!DOCTYPE engauge>");
1241 writer.writeEndDocument();
1242 QApplication::restoreOverrideCursor ();
1246 m_cmdMediator->setClean ();
1248 setCurrentFile(fileName);
1249 m_engaugeFile = fileName;
1259 const char *comment)
1263 if ((m_cmdMediator != 0) && !m_isErrorReportRegressionTest) {
1265 QString report = saveErrorReportFileAndExitXml (context,
1271 if (dlg.exec() == QDialog::Accepted) {
1274 QString fileName = dlg.getSaveFileName (
this,
1276 "error_report.xml");
1277 if (!fileName.isEmpty ()) {
1279 QFile fileError (fileName);
1280 QTextStream str (&fileError);
1281 fileError.open (QIODevice::WriteOnly | QIODevice::Text);
1291 QString MainWindow::saveErrorReportFileAndExitXml (
const char *context,
1294 const char *comment)
const 1296 const bool DEEP_COPY =
true;
1298 QString xmlErrorReport;
1299 QXmlStreamWriter writer (&xmlErrorReport);
1300 writer.setAutoFormatting(
true);
1303 writer.writeStartElement(DOCUMENT_SERIALIZE_ERROR_REPORT);
1306 writer.writeStartElement(DOCUMENT_SERIALIZE_APPLICATION);
1307 writer.writeAttribute(DOCUMENT_SERIALIZE_APPLICATION_VERSION_NUMBER, VERSION_NUMBER);
1308 writer.writeEndElement();
1312 QXmlStreamReader reader (m_startingDocumentSnapshot);
1313 while (!reader.atEnd ()) {
1315 if (reader.tokenType() != QXmlStreamReader::StartDocument &&
1316 reader.tokenType() != QXmlStreamReader::EndDocument &&
1317 reader.tokenType() != QXmlStreamReader::Invalid) {
1318 writer.writeCurrentToken (reader);
1323 writer.writeStartElement(DOCUMENT_SERIALIZE_OPERATING_SYSTEM);
1324 writer.writeAttribute(DOCUMENT_SERIALIZE_OPERATING_SYSTEM_ENDIAN, EndianToString (QSysInfo::ByteOrder));
1325 writer.writeAttribute(DOCUMENT_SERIALIZE_OPERATING_SYSTEM_WORD_SIZE, QString::number (QSysInfo::WordSize));
1326 writer.writeEndElement();
1329 writer.writeStartElement(DOCUMENT_SERIALIZE_FILE);
1330 writer.writeAttribute(DOCUMENT_SERIALIZE_FILE_IMPORTED,
1331 m_originalFileWasImported ? DOCUMENT_SERIALIZE_BOOL_TRUE : DOCUMENT_SERIALIZE_BOOL_FALSE);
1332 writer.writeEndElement();
1335 m_cmdMediator->
saveXml(writer);
1338 writer.writeStartElement(DOCUMENT_SERIALIZE_ERROR);
1339 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_CONTEXT, context);
1340 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_FILE, file);
1341 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_LINE, QString::number (line));
1342 writer.writeAttribute(DOCUMENT_SERIALIZE_ERROR_COMMENT, comment);
1343 writer.writeEndElement();
1345 writer.writeEndElement();
1348 QDomDocument domErrorReport (
"ErrorReport");
1349 domErrorReport.setContent (xmlErrorReport);
1352 if (!m_originalFileWasImported) {
1356 QDomDocument domInputFile;
1357 loadInputFileForErrorReport (domInputFile);
1358 QDomDocumentFragment fragmentFileFrom = domErrorReport.createDocumentFragment();
1359 if (!domInputFile.isNull()) {
1360 fragmentFileFrom.appendChild (domErrorReport.importNode (domInputFile.documentElement(), DEEP_COPY));
1362 QDomNodeList nodesFileTo = domErrorReport.elementsByTagName (DOCUMENT_SERIALIZE_FILE);
1363 if (nodesFileTo.count () > 0) {
1364 QDomNode nodeFileTo = nodesFileTo.at (0);
1365 nodeFileTo.appendChild (fragmentFileFrom);
1372 QDomNodeList nodesDocument = domErrorReport.elementsByTagName (DOCUMENT_SERIALIZE_DOCUMENT);
1373 for (
int i = 0 ; i < nodesDocument.count(); i++) {
1374 QDomNode nodeDocument = nodesDocument.at (i);
1375 QDomElement elemImage = nodeDocument.firstChildElement(DOCUMENT_SERIALIZE_IMAGE);
1376 if (!elemImage.isNull()) {
1379 if (elemImage.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_WIDTH) &&
1380 elemImage.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_HEIGHT)) {
1382 int width = elemImage.attribute(DOCUMENT_SERIALIZE_IMAGE_WIDTH).toInt();
1383 int height = elemImage.attribute(DOCUMENT_SERIALIZE_IMAGE_HEIGHT).toInt();
1385 QDomNode nodeReplacement;
1386 QDomElement elemReplacement = nodeReplacement.toElement();
1387 elemReplacement.setAttribute (DOCUMENT_SERIALIZE_IMAGE_WIDTH, width);
1388 elemReplacement.setAttribute (DOCUMENT_SERIALIZE_IMAGE_HEIGHT, height);
1391 nodeDocument.insertBefore (nodeReplacement,
1393 nodeDocument.removeChild(elemImage);
1399 return domErrorReport.toString();
1402 void MainWindow::saveStartingDocumentSnapshot()
1404 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::saveStartingDocumentSnapshot";
1406 QXmlStreamWriter writer (&m_startingDocumentSnapshot);
1407 writer.setAutoFormatting (
true);
1413 ENGAUGE_CHECK_PTR (m_scene);
1419 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::selectBackgroundOriginal";
1421 BackgroundImage previousBackground = (BackgroundImage) m_cmbBackground->currentData().toInt();
1423 int index = m_cmbBackground->findData (backgroundImage);
1424 ENGAUGE_ASSERT (index >= 0);
1426 m_cmbBackground->setCurrentIndex(index);
1428 return previousBackground;
1433 return m_cmbCurve->currentText ();
1436 void MainWindow::setCurrentFile (
const QString &fileName)
1438 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setCurrentFile";
1440 QString fileNameStripped;
1441 if (!fileName.isEmpty()) {
1445 QFileInfo fileInfo (fileName);
1446 fileNameStripped = fileInfo.completeBaseName();
1449 m_currentFile = fileNameStripped;
1450 m_currentFileWithPathAndFileExtension = fileName;
1452 updateWindowTitle ();
1455 void MainWindow::setCurrentPathFromFile (
const QString &fileName)
1457 QDir dir = QFileInfo (fileName).absoluteDir();
1459 if (dir.exists ()) {
1461 bool success = QDir::setCurrent (dir.absolutePath ());
1462 ENGAUGE_ASSERT (success);
1470 void MainWindow::setNonFillZoomFactor (ZoomFactor newZoomFactor)
1472 ENGAUGE_ASSERT (newZoomFactor != ZOOM_FILL);
1475 m_zoomMapToAction [newZoomFactor]->setChecked (
true);
1476 slotViewZoomFactor (newZoomFactor);
1479 void MainWindow::setPixmap (
const QString &curveSelected,
1480 const QPixmap &pixmap)
1482 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setPixmap";
1489 m_backgroundStateContext->
setPixmap (m_isGnuplot,
1497 void MainWindow::settingsRead (
bool isReset)
1499 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
1506 settingsReadEnvironment (settings);
1507 settingsReadMainWindow (settings);
1510 void MainWindow::settingsReadEnvironment (QSettings &settings)
1512 settings.beginGroup (SETTINGS_GROUP_ENVIRONMENT);
1513 QDir::setCurrent (settings.value (SETTINGS_CURRENT_DIRECTORY,
1514 QDir::currentPath ()).toString ());
1515 settings.endGroup ();
1518 void MainWindow::settingsReadMainWindow (QSettings &settings)
1520 settings.beginGroup(SETTINGS_GROUP_MAIN_WINDOW);
1523 resize (settings.value (SETTINGS_SIZE,
1524 QSize (600, 600)).toSize ());
1525 move (settings.value (SETTINGS_POS,
1526 QPoint (200, 200)).toPoint ());
1529 #if !defined(OSX_DEBUG) && !defined(OSX_RELEASE) 1530 QSize helpSize = settings.value (SETTINGS_HELP_SIZE,
1531 QSize (900, 600)).toSize();
1532 m_helpWindow->resize (helpSize);
1533 if (settings.contains (SETTINGS_HELP_POS)) {
1534 QPoint helpPos = settings.value (SETTINGS_HELP_POS).toPoint();
1535 m_helpWindow->move (helpPos);
1540 m_actionHelpChecklistGuideWizard->setChecked (settings.value (SETTINGS_CHECKLIST_GUIDE_WIZARD,
1544 bool viewBackgroundToolBar = settings.value (SETTINGS_VIEW_BACKGROUND_TOOLBAR,
1546 m_actionViewBackground->setChecked (viewBackgroundToolBar);
1547 m_toolBackground->setVisible (viewBackgroundToolBar);
1548 BackgroundImage backgroundImage = (BackgroundImage) settings.value (SETTINGS_BACKGROUND_IMAGE,
1549 BACKGROUND_IMAGE_FILTERED).toInt ();
1550 int indexBackground = m_cmbBackground->findData (QVariant (backgroundImage));
1551 m_cmbBackground->setCurrentIndex (indexBackground);
1554 bool viewDigitizeToolBar = settings.value (SETTINGS_VIEW_DIGITIZE_TOOLBAR,
1556 m_actionViewDigitize->setChecked (viewDigitizeToolBar);
1557 m_toolDigitize->setVisible (viewDigitizeToolBar);
1560 bool viewSettingsViewsToolBar = settings.value (SETTINGS_VIEW_SETTINGS_VIEWS_TOOLBAR,
1562 m_actionViewSettingsViews->setChecked (viewSettingsViewsToolBar);
1563 m_toolSettingsViews->setVisible (viewSettingsViewsToolBar);
1566 bool viewCoordSystemToolbar = settings.value (SETTINGS_VIEW_COORD_SYSTEM_TOOLBAR,
1568 m_actionViewCoordSystem->setChecked (viewCoordSystemToolbar);
1569 m_toolCoordSystem->setVisible (viewCoordSystemToolbar);
1572 bool viewToolTips = settings.value (SETTINGS_VIEW_TOOL_TIPS,
1574 m_actionViewToolTips->setChecked (viewToolTips);
1578 StatusBarMode statusBarMode = (StatusBarMode) settings.value (SETTINGS_VIEW_STATUS_BAR,
1581 m_actionStatusNever->setChecked (statusBarMode == STATUS_BAR_MODE_NEVER);
1582 m_actionStatusTemporary->setChecked (statusBarMode == STATUS_BAR_MODE_TEMPORARY);
1583 m_actionStatusAlways->setChecked (statusBarMode == STATUS_BAR_MODE_ALWAYS);
1585 addDockWindow (m_dockChecklistGuide,
1587 SETTINGS_CHECKLIST_GUIDE_DOCK_AREA,
1588 SETTINGS_CHECKLIST_GUIDE_DOCK_GEOMETRY,
1589 Qt::RightDockWidgetArea);
1590 addDockWindow (m_dockFittingWindow,
1592 SETTINGS_FITTING_WINDOW_DOCK_AREA,
1593 SETTINGS_FITTING_WINDOW_DOCK_GEOMETRY,
1594 Qt::RightDockWidgetArea);
1595 addDockWindow (m_dockGeometryWindow,
1597 SETTINGS_GEOMETRY_WINDOW_DOCK_AREA,
1598 SETTINGS_GEOMETRY_WINDOW_DOCK_GEOMETRY,
1599 Qt::RightDockWidgetArea);
1604 QLocale localeDefault;
1605 QLocale::Language language = (QLocale::Language) settings.value (SETTINGS_LOCALE_LANGUAGE,
1606 QVariant (localeDefault.language())).toInt();
1607 QLocale::Country country = (QLocale::Country) settings.value (SETTINGS_LOCALE_COUNTRY,
1608 QVariant (localeDefault.country())).toInt();
1609 QLocale locale (language,
1611 slotViewZoom ((ZoomFactor) settings.value (SETTINGS_ZOOM_FACTOR,
1612 QVariant (ZOOM_1_TO_1)).toInt());
1614 m_modelMainWindow.
setZoomFactorInitial((ZoomFactorInitial) settings.value (SETTINGS_ZOOM_FACTOR_INITIAL,
1615 QVariant (DEFAULT_ZOOM_FACTOR_INITIAL)).toInt());
1616 m_modelMainWindow.
setZoomControl ((ZoomControl) settings.value (SETTINGS_ZOOM_CONTROL,
1617 QVariant (ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS)).toInt());
1618 m_modelMainWindow.
setMainTitleBarFormat ((MainTitleBarFormat) settings.value (SETTINGS_MAIN_TITLE_BAR_FORMAT,
1619 QVariant (MAIN_TITLE_BAR_FORMAT_PATH)).toInt());
1620 m_modelMainWindow.
setPdfResolution (settings.value (SETTINGS_IMPORT_PDF_RESOLUTION,
1621 QVariant (DEFAULT_IMPORT_PDF_RESOLUTION)).toInt ());
1622 m_modelMainWindow.
setImportCropping ((ImportCropping) settings.value (SETTINGS_IMPORT_CROPPING,
1623 QVariant (DEFAULT_IMPORT_CROPPING)).toInt ());
1625 QVariant (DEFAULT_MAXIMUM_GRID_LINES)).toInt ());
1627 QVariant (DEFAULT_HIGHLIGHT_OPACITY)).toDouble ());
1628 m_modelMainWindow.
setSmallDialogs (settings.value (SETTINGS_SMALL_DIALOGS,
1629 QVariant (DEFAULT_SMALL_DIALOGS)).toBool ());
1631 QVariant (DEFAULT_DRAG_DROP_EXPORT)).toBool ());
1633 QVariant (DEFAULT_SIGNIFICANT_DIGITS)).toInt ());
1636 updateSmallDialogs();
1638 settings.endGroup();
1641 void MainWindow::settingsWrite ()
1643 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
1645 settings.beginGroup (SETTINGS_GROUP_ENVIRONMENT);
1646 settings.setValue (SETTINGS_CURRENT_DIRECTORY, QDir::currentPath ());
1647 settings.endGroup ();
1649 settings.beginGroup (SETTINGS_GROUP_MAIN_WINDOW);
1650 settings.setValue (SETTINGS_SIZE, size ());
1651 settings.setValue (SETTINGS_POS, pos ());
1652 #if !defined(OSX_DEBUG) && !defined(OSX_RELEASE) 1653 settings.setValue (SETTINGS_HELP_SIZE, m_helpWindow->size());
1654 settings.setValue (SETTINGS_HELP_POS, m_helpWindow->pos ());
1656 if (m_dockChecklistGuide->isFloating()) {
1658 settings.setValue (SETTINGS_CHECKLIST_GUIDE_DOCK_AREA, Qt::NoDockWidgetArea);
1659 settings.setValue (SETTINGS_CHECKLIST_GUIDE_DOCK_GEOMETRY, m_dockChecklistGuide->saveGeometry ());
1663 settings.setValue (SETTINGS_CHECKLIST_GUIDE_DOCK_AREA, dockWidgetArea (m_dockChecklistGuide));
1666 if (m_dockFittingWindow->isFloating()) {
1668 settings.setValue (SETTINGS_FITTING_WINDOW_DOCK_AREA, Qt::NoDockWidgetArea);
1669 settings.setValue (SETTINGS_FITTING_WINDOW_DOCK_GEOMETRY, m_dockFittingWindow->saveGeometry());
1672 settings.setValue (SETTINGS_FITTING_WINDOW_DOCK_AREA, dockWidgetArea (m_dockFittingWindow));
1674 if (m_dockGeometryWindow->isFloating()) {
1676 settings.setValue (SETTINGS_GEOMETRY_WINDOW_DOCK_AREA, Qt::NoDockWidgetArea);
1677 settings.setValue (SETTINGS_GEOMETRY_WINDOW_DOCK_GEOMETRY, m_dockGeometryWindow->saveGeometry ());
1681 settings.setValue (SETTINGS_GEOMETRY_WINDOW_DOCK_AREA, dockWidgetArea (m_dockGeometryWindow));
1684 settings.setValue (SETTINGS_BACKGROUND_IMAGE, m_cmbBackground->currentData().toInt());
1685 settings.setValue (SETTINGS_CHECKLIST_GUIDE_WIZARD, m_actionHelpChecklistGuideWizard->isChecked ());
1686 settings.setValue (SETTINGS_DRAG_DROP_EXPORT, m_modelMainWindow.
dragDropExport ());
1687 settings.setValue (SETTINGS_HIGHLIGHT_OPACITY, m_modelMainWindow.
highlightOpacity());
1688 settings.setValue (SETTINGS_IMPORT_CROPPING, m_modelMainWindow.
importCropping());
1689 settings.setValue (SETTINGS_IMPORT_PDF_RESOLUTION, m_modelMainWindow.
pdfResolution ());
1690 settings.setValue (SETTINGS_LOCALE_LANGUAGE, m_modelMainWindow.
locale().language());
1691 settings.setValue (SETTINGS_LOCALE_COUNTRY, m_modelMainWindow.
locale().country());
1692 settings.setValue (SETTINGS_MAIN_TITLE_BAR_FORMAT, m_modelMainWindow.
mainTitleBarFormat());
1693 settings.setValue (SETTINGS_MAXIMUM_GRID_LINES, m_modelMainWindow.
maximumGridLines());
1694 settings.setValue (SETTINGS_SMALL_DIALOGS, m_modelMainWindow.
smallDialogs());
1695 settings.setValue (SETTINGS_VIEW_BACKGROUND_TOOLBAR, m_actionViewBackground->isChecked());
1696 settings.setValue (SETTINGS_VIEW_DIGITIZE_TOOLBAR, m_actionViewDigitize->isChecked ());
1697 settings.setValue (SETTINGS_VIEW_STATUS_BAR, m_statusBar->
statusBarMode ());
1698 settings.setValue (SETTINGS_VIEW_SETTINGS_VIEWS_TOOLBAR, m_actionViewSettingsViews->isChecked ());
1699 settings.setValue (SETTINGS_VIEW_COORD_SYSTEM_TOOLBAR, m_actionViewCoordSystem->isChecked ());
1700 settings.setValue (SETTINGS_VIEW_TOOL_TIPS, m_actionViewToolTips->isChecked ());
1701 settings.setValue (SETTINGS_ZOOM_CONTROL, m_modelMainWindow.
zoomControl());
1702 settings.setValue (SETTINGS_ZOOM_FACTOR, currentZoomFactor ());
1703 settings.setValue (SETTINGS_ZOOM_FACTOR_INITIAL, m_modelMainWindow.
zoomFactorInitial());
1704 settings.endGroup ();
1707 bool MainWindow::setupAfterLoadNewDocument (
const QString &fileName,
1708 const QString &temporaryMessage ,
1709 ImportType importType)
1711 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setupAfterLoadNewDocument" 1712 <<
" file=" << fileName.toLatin1().data()
1713 <<
" message=" << temporaryMessage.toLatin1().data()
1714 <<
" importType=" << importType;
1719 const QString EMPTY_CURVE_NAME_TO_SKIP_BACKGROUND_PROCESSING;
1723 m_digitizeStateContext->
resetOnLoad (m_cmdMediator);
1728 EMPTY_CURVE_NAME_TO_SKIP_BACKGROUND_PROCESSING);
1730 m_cmdMediator->
pixmap ());
1734 if (importType == IMPORT_TYPE_ADVANCED) {
1736 applyZoomFactorAfterLoad();
1739 dlgImportAdvanced.exec();
1741 if (dlgImportAdvanced.result() == QDialog::Rejected) {
1745 int numberCoordSystem = dlgImportAdvanced.numberCoordSystem();
1754 connect (m_actionEditUndo, SIGNAL (triggered ()), m_cmdMediator, SLOT (undo ()));
1755 connect (m_actionEditUndo, SIGNAL (triggered ()), m_cmdStackShadow, SLOT (slotUndo ()));
1756 connect (m_actionEditRedo, SIGNAL (triggered ()), m_cmdMediator, SLOT (redo ()));
1757 connect (m_actionEditRedo, SIGNAL (triggered ()), m_cmdStackShadow, SLOT (slotRedo ()));
1758 connect (m_cmdMediator, SIGNAL (canRedoChanged(
bool)),
this, SLOT (slotCanRedoChanged (
bool)));
1759 connect (m_cmdMediator, SIGNAL (canUndoChanged(
bool)),
this, SLOT (slotCanUndoChanged (
bool)));
1760 connect (m_cmdMediator, SIGNAL (redoTextChanged (
const QString &)),
this, SLOT (slotRedoTextChanged (
const QString &)));
1761 connect (m_cmdMediator, SIGNAL (undoTextChanged (
const QString &)),
this, SLOT (slotUndoTextChanged (
const QString &)));
1762 loadCurveListFromCmdMediator ();
1763 loadCoordSystemListFromCmdMediator ();
1766 m_isDocumentExported =
false;
1776 m_cmbCurve->currentText ());
1777 m_backgroundStateContext->
setBackgroundImage ((BackgroundImage) m_cmbBackground->currentIndex ());
1779 applyZoomFactorAfterLoad();
1781 setCurrentFile(fileName);
1785 saveStartingDocumentSnapshot();
1792 bool MainWindow::setupAfterLoadReplacingImage (
const QString &fileName,
1793 const QString &temporaryMessage ,
1794 ImportType importType)
1796 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::setupAfterLoadReplacingImage" 1797 <<
" file=" << fileName.toLatin1().data()
1798 <<
" message=" << temporaryMessage.toLatin1().data()
1799 <<
" importType=" << importType;
1804 m_cmdMediator->clear();
1807 m_cmdMediator->
pixmap ());
1809 m_isDocumentExported =
false;
1811 m_backgroundStateContext->
setBackgroundImage ((BackgroundImage) m_cmbBackground->currentIndex ());
1813 applyZoomFactorAfterLoad();
1815 setCurrentFile(fileName);
1819 saveStartingDocumentSnapshot();
1828 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::showEvent" 1829 <<
" files=" << m_loadStartupFiles.join (
",").toLatin1().data();
1831 QMainWindow::showEvent (event);
1833 if (m_loadStartupFiles.count() > 0) {
1835 m_timerLoadStartupFiles =
new QTimer;
1836 m_timerLoadStartupFiles->setSingleShot (
true);
1837 connect (m_timerLoadStartupFiles, SIGNAL (timeout ()),
this, SLOT (slotLoadStartupFiles ()));
1838 m_timerLoadStartupFiles->start (0);
1848 void MainWindow::slotBtnPrintAll ()
1850 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotBtnPrintAll";
1854 QPrinter printer (QPrinter::HighResolution);
1855 QPrintDialog dlg (&printer,
this);
1856 if (dlg.exec() == QDialog::Accepted) {
1857 QPainter painter (&printer);
1858 m_view->render (&painter);
1865 void MainWindow::slotBtnShowAllPressed ()
1867 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotBtnShowAllPressed";
1873 void MainWindow::slotBtnShowAllReleased ()
1875 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotBtnShowAllReleased";
1881 void MainWindow::slotCanRedoChanged (
bool canRedo)
1883 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotCanRedoChanged";
1885 m_actionEditRedo->setEnabled (canRedo || m_cmdStackShadow->
canRedo());
1888 void MainWindow::slotCanUndoChanged (
bool canUndo)
1890 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotCanUndoChanged";
1892 m_actionEditUndo->setEnabled (canUndo);
1895 void MainWindow::slotChecklistClosed()
1897 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotChecklistClosed";
1899 m_actionViewChecklistGuide->setChecked (
false);
1902 void MainWindow::slotCleanChanged(
bool clean)
1904 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCleanChanged";
1906 setWindowModified (!clean);
1909 void MainWindow::slotCmbBackground(
int currentIndex)
1911 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCmbBackground";
1913 switch (currentIndex) {
1914 case BACKGROUND_IMAGE_NONE:
1915 if (!m_actionViewBackgroundNone->isChecked()) {
1916 m_actionViewBackgroundNone->toggle();
1920 case BACKGROUND_IMAGE_ORIGINAL:
1921 if (!m_actionViewBackgroundOriginal->isChecked ()) {
1922 m_actionViewBackgroundOriginal->toggle();
1926 case BACKGROUND_IMAGE_FILTERED:
1927 if (!m_actionViewBackgroundFiltered->isChecked ()) {
1928 m_actionViewBackgroundFiltered->toggle();
1936 void MainWindow::slotCmbCoordSystem(
int index)
1938 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCmbCoordSystem";
1944 m_cmdMediator->push (cmd);
1947 void MainWindow::slotCmbCurve(
int )
1949 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotCmbCurve";
1955 m_cmbCurve->currentText ());
1959 updateViewedCurves();
1961 updateFittingWindow();
1962 updateGeometryWindow();
1965 void MainWindow::slotContextMenuEventAxis (QString pointIdentifier)
1967 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotContextMenuEventAxis point=" << pointIdentifier.toLatin1 ().data ();
1973 void MainWindow::slotContextMenuEventGraph (QStringList pointIdentifiers)
1975 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotContextMenuEventGraph point=" << pointIdentifiers.join(
",").toLatin1 ().data ();
1981 void MainWindow::slotDigitizeAxis ()
1983 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeAxis";
1986 DIGITIZE_STATE_AXIS);
1987 m_cmbCurve->setEnabled (
false);
1993 void MainWindow::slotDigitizeColorPicker ()
1995 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeColorPicker";
1998 DIGITIZE_STATE_COLOR_PICKER);
1999 m_cmbCurve->setEnabled (
true);
2005 void MainWindow::slotDigitizeCurve ()
2007 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeCurve";
2010 DIGITIZE_STATE_CURVE);
2011 m_cmbCurve->setEnabled (
true);
2017 void MainWindow::slotDigitizePointMatch ()
2019 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizePointMatch";
2022 DIGITIZE_STATE_POINT_MATCH);
2023 m_cmbCurve->setEnabled (
true);
2029 void MainWindow::slotDigitizeScale ()
2031 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeScale";
2034 DIGITIZE_STATE_SCALE);
2035 m_cmbCurve->setEnabled (
false);
2041 void MainWindow::slotDigitizeSegment ()
2043 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeSegment";
2046 DIGITIZE_STATE_SEGMENT);
2047 m_cmbCurve->setEnabled (
true);
2053 void MainWindow::slotDigitizeSelect ()
2055 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotDigitizeSelect";
2058 DIGITIZE_STATE_SELECT);
2059 m_cmbCurve->setEnabled (
false);
2065 void MainWindow::slotEditCopy ()
2067 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditCopy";
2070 bool tableFittingIsActive, tableFittingIsCopyable;
2071 bool tableGeometryIsActive, tableGeometryIsCopyable;
2072 m_dockFittingWindow->
getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
2073 m_dockGeometryWindow->
getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
2075 if (tableFittingIsActive) {
2078 m_dockFittingWindow->
doCopy ();
2080 }
else if (tableGeometryIsActive) {
2083 m_dockGeometryWindow->
doCopy ();
2089 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
2100 void MainWindow::slotEditCut ()
2102 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditCut";
2105 bool tableFittingIsActive, tableFittingIsCopyable;
2106 bool tableGeometryIsActive, tableGeometryIsCopyable;
2107 m_dockFittingWindow->
getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
2108 m_dockGeometryWindow->
getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
2110 if (tableFittingIsActive || tableGeometryIsActive) {
2118 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
2129 void MainWindow::slotEditDelete ()
2131 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditDelete";
2134 bool tableFittingIsActive, tableFittingIsCopyable;
2135 bool tableGeometryIsActive, tableGeometryIsCopyable;
2136 m_dockFittingWindow->
getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
2137 m_dockGeometryWindow->
getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
2139 if (tableFittingIsActive || tableGeometryIsActive) {
2152 const QList<QGraphicsItem*> &items = m_scene->selectedItems();
2153 QStringList pointIdentifiers = scaleBarAxisPoints.
unite (m_cmdMediator,
2164 void MainWindow::slotEditMenu ()
2166 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditMenu";
2168 m_actionEditPasteAsNew->setEnabled (!QApplication::clipboard()->image().isNull());
2169 m_actionEditPasteAsNewAdvanced->setEnabled (!QApplication::clipboard()->image().isNull());
2172 void MainWindow::slotEditPaste ()
2174 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditPaste";
2176 QList<QPoint> points;
2177 QList<double> ordinals;
2186 m_cmbCurve->currentText (),
2193 void MainWindow::slotEditPasteAsNew ()
2195 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditPasteAsNew";
2197 filePaste (IMPORT_TYPE_SIMPLE);
2200 void MainWindow::slotEditPasteAsNewAdvanced ()
2202 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotEditPasteAsNewAdvanced";
2204 filePaste (IMPORT_TYPE_ADVANCED);
2207 void MainWindow::slotFileClose()
2209 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileClose";
2216 TRANSFORMATION_STATE_UNDEFINED,
2224 DIGITIZE_STATE_EMPTY);
2227 if (m_fittingCurve != 0) {
2228 m_scene->removeItem (m_fittingCurve);
2236 m_backgroundStateContext->
close ();
2239 m_scene->setSceneRect (QRectF (0, 0, 1, 1));
2242 m_dockFittingWindow->
clear ();
2245 m_dockGeometryWindow->
clear ();
2248 delete m_cmdMediator;
2254 setWindowTitle (engaugeWindowTitle ());
2256 m_gridLines.
clear();
2261 void MainWindow::slotFileExport ()
2263 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileExport";
2271 if (m_isExportOnly) {
2272 fileName = fileNameForExportOnly ();
2275 QString filter = QString (
"%1;;%2;;All files (*.*)")
2280 QString defaultFileName = QString (
"%1/%2.%3")
2282 .arg (m_currentFile)
2285 QString filterCsv = exportStrategy.
filterCsv ();
2287 fileName = dlg.getSaveFileName (
this,
2294 if (!fileName.isEmpty ()) {
2297 fileExport(fileName,
2306 void MainWindow::slotFileImport ()
2308 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImport";
2310 fileImportWithPrompts (IMPORT_TYPE_SIMPLE);
2313 void MainWindow::slotFileImportAdvanced ()
2315 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportAdvanced";
2317 fileImportWithPrompts (IMPORT_TYPE_ADVANCED);
2320 void MainWindow::slotFileImportDraggedImage(QImage image)
2322 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportDraggedImage";
2327 IMPORT_TYPE_SIMPLE);
2330 void MainWindow::slotFileImportDraggedImageUrl(QUrl url)
2332 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportDraggedImageUrl url=" << url.toString ().toLatin1 ().data ();
2339 void MainWindow::slotFileImportImage(QString fileName, QImage image)
2341 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportImage fileName=" << fileName.toLatin1 ().data ();
2344 loadImage (fileName,
2346 IMPORT_TYPE_SIMPLE);
2349 void MainWindow::slotFileImportImageReplace ()
2351 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileImportImageReplace";
2353 fileImportWithPrompts (IMPORT_TYPE_IMAGE_REPLACE);
2356 void MainWindow::slotFileOpen()
2358 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileOpen";
2364 QString filter = QString (
"%1 (*.%2);; All Files (*.*)")
2365 .arg (ENGAUGE_FILENAME_DESCRIPTION)
2366 .arg (ENGAUGE_FILENAME_EXTENSION);
2369 QString fileName = QFileDialog::getOpenFileName (
this,
2370 tr(
"Open Document"),
2373 if (!fileName.isEmpty ()) {
2376 loadDocumentFile (fileName);
2382 void MainWindow::slotFileOpenDraggedDigFile (QString fileName)
2384 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileOpenDraggedDigFile";
2386 loadDocumentFile (fileName);
2389 void MainWindow::slotFilePrint()
2391 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFilePrint";
2393 QPrinter printer (QPrinter::HighResolution);
2394 QPrintDialog dlg (&printer,
this);
2395 if (dlg.exec() == QDialog::Accepted) {
2396 QPainter painter (&printer);
2397 m_view->render (&painter);
2402 bool MainWindow::slotFileSave()
2404 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileSave";
2406 if (m_engaugeFile.isEmpty()) {
2407 return slotFileSaveAs();
2409 return saveDocumentFile (m_engaugeFile);
2413 bool MainWindow::slotFileSaveAs()
2415 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFileSaveAs";
2418 QString filenameDefault = m_currentFile;
2419 if (!m_currentFile.endsWith (ENGAUGE_FILENAME_EXTENSION)) {
2420 filenameDefault = QString (
"%1.%2")
2421 .arg (m_currentFile)
2422 .arg (ENGAUGE_FILENAME_EXTENSION);
2425 if (!m_engaugeFile.isEmpty()) {
2426 filenameDefault = m_engaugeFile;
2429 QString filterDigitizer = QString (
"%1 (*.%2)")
2430 .arg (ENGAUGE_FILENAME_DESCRIPTION)
2431 .arg (ENGAUGE_FILENAME_EXTENSION);
2432 QString filterAll (
"All files (*. *)");
2434 QStringList filters;
2435 filters << filterDigitizer;
2436 filters << filterAll;
2440 QFileDialog dlg(
this);
2441 dlg.setFileMode (QFileDialog::AnyFile);
2442 dlg.selectNameFilter (filterDigitizer);
2443 dlg.setNameFilters (filters);
2444 #if !defined(OSX_DEBUG) && !defined(OSX_RELEASE) 2446 dlg.setWindowModality(Qt::WindowModal);
2448 dlg.setAcceptMode(QFileDialog::AcceptSave);
2449 dlg.selectFile(filenameDefault);
2453 QStringList files = dlg.selectedFiles();
2455 return saveDocumentFile(files.at(0));
2461 void MainWindow::slotFittingWindowClosed()
2463 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFittingWindowClosed";
2465 m_actionViewFittingWindow->setChecked (
false);
2468 void MainWindow::slotFittingWindowCurveFit(FittingCurveCoefficients fittingCurveCoef,
2475 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotFittingWindowCurveFit" 2476 <<
" order=" << fittingCurveCoef.size() - 1;
2478 if (m_fittingCurve != 0) {
2479 m_scene->removeItem (m_fittingCurve);
2480 delete m_fittingCurve;
2489 m_fittingCurve->setVisible (m_actionViewFittingWindow->isChecked ());
2490 m_scene->addItem (m_fittingCurve);
2493 void MainWindow::slotGeometryWindowClosed()
2495 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotGeometryWindowClosed";
2497 m_actionViewGeometryWindow->setChecked (
false);
2500 void MainWindow::slotHelpAbout()
2502 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotHelpAbout";
2508 void MainWindow::slotHelpTutorial()
2510 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotHelpTutorial";
2512 m_tutorialDlg->show ();
2513 m_tutorialDlg->exec ();
2516 void MainWindow::slotKeyPress (Qt::Key key,
2517 bool atLeastOneSelectedItem)
2519 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotKeyPress" 2520 <<
" key=" << QKeySequence (key).toString().toLatin1 ().data ()
2521 <<
" atLeastOneSelectedItem=" << (atLeastOneSelectedItem ?
"true" :
"false");
2525 atLeastOneSelectedItem);
2528 void MainWindow::slotLoadStartupFiles ()
2530 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotLoadStartupFiles";
2532 ENGAUGE_ASSERT (m_loadStartupFiles.count() > 0);
2534 QString fileName = m_loadStartupFiles.front();
2535 m_loadStartupFiles.pop_front();
2541 loadDocumentFile (fileName);
2545 fileImport (fileName,
2546 IMPORT_TYPE_SIMPLE);
2550 if (m_loadStartupFiles.count() > 0) {
2554 QProcess::startDetached (QCoreApplication::applicationFilePath(),
2555 m_commandLineWithoutLoadStartupFiles + m_loadStartupFiles);
2559 void MainWindow::slotMouseMove (QPointF pos)
2564 if (m_cmdMediator != 0) {
2567 QString coordsScreen, coordsGraph, resolutionGraph;
2587 void MainWindow::slotMousePress (QPointF pos)
2589 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotMousePress";
2597 void MainWindow::slotMouseRelease (QPointF pos)
2599 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotMouseRelease";
2601 if (pos.x() < 0 || pos.y() < 0) {
2615 void MainWindow::slotRecentFileAction ()
2617 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotRecentFileAction";
2619 QAction *action = qobject_cast<QAction*>(sender ());
2622 QString fileName = action->data().toString();
2623 loadDocumentFile (fileName);
2627 void MainWindow::slotRecentFileClear ()
2629 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotRecentFileClear";
2631 QStringList emptyList;
2633 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
2634 settings.setValue (SETTINGS_RECENT_FILE_LIST,
2637 updateRecentFileList();
2640 void MainWindow::slotRedoTextChanged (
const QString &text)
2642 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotRedoTextChanged";
2644 QString completeText (
"Redo");
2645 if (!text.isEmpty ()) {
2646 completeText += QString (
" \"%1\"").arg (text);
2648 m_actionEditRedo->setText (completeText);
2651 void MainWindow::slotSettingsAxesChecker ()
2653 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsAxesChecker";
2655 m_dlgSettingsAxesChecker->
load (*m_cmdMediator);
2656 m_dlgSettingsAxesChecker->show ();
2659 void MainWindow::slotSettingsColorFilter ()
2661 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsColorFilter";
2663 m_dlgSettingsColorFilter->
load (*m_cmdMediator);
2664 m_dlgSettingsColorFilter->show ();
2667 void MainWindow::slotSettingsCoords ()
2669 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsCoords";
2671 m_dlgSettingsCoords->
load (*m_cmdMediator);
2672 m_dlgSettingsCoords->show ();
2675 void MainWindow::slotSettingsCurveList ()
2677 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsCurveList";
2679 m_dlgSettingsCurveList->
load (*m_cmdMediator);
2680 m_dlgSettingsCurveList->show ();
2683 void MainWindow::slotSettingsCurveProperties ()
2685 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsCurveProperties";
2687 m_dlgSettingsCurveProperties->
load (*m_cmdMediator);
2689 m_dlgSettingsCurveProperties->show ();
2692 void MainWindow::slotSettingsDigitizeCurve ()
2694 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsDigitizeCurve";
2696 m_dlgSettingsDigitizeCurve->
load (*m_cmdMediator);
2697 m_dlgSettingsDigitizeCurve->show ();
2700 void MainWindow::slotSettingsExportFormat ()
2702 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsExportFormat";
2705 m_dlgSettingsExportFormat->
load (*m_cmdMediator);
2706 m_dlgSettingsExportFormat->show ();
2713 void MainWindow::slotSettingsGeneral ()
2715 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsGeneral";
2717 m_dlgSettingsGeneral->
load (*m_cmdMediator);
2718 m_dlgSettingsGeneral->show ();
2721 void MainWindow::slotSettingsGridDisplay()
2723 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsGridDisplay";
2725 m_dlgSettingsGridDisplay->
load (*m_cmdMediator);
2726 m_dlgSettingsGridDisplay->show ();
2729 void MainWindow::slotSettingsGridRemoval ()
2731 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsGridRemoval";
2733 m_dlgSettingsGridRemoval->
load (*m_cmdMediator);
2734 m_dlgSettingsGridRemoval->show ();
2737 void MainWindow::slotSettingsPointMatch ()
2739 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsPointMatch";
2741 m_dlgSettingsPointMatch->
load (*m_cmdMediator);
2742 m_dlgSettingsPointMatch->show ();
2745 void MainWindow::slotSettingsSegments ()
2747 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsSegments";
2749 m_dlgSettingsSegments->
load (*m_cmdMediator);
2750 m_dlgSettingsSegments->show ();
2753 void MainWindow::slotTableStatusChange ()
2755 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotTableStatusChange";
2762 void MainWindow::slotSettingsMainWindow ()
2764 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotSettingsMainWindow";
2768 m_dlgSettingsMainWindow->show ();
2771 void MainWindow::slotTimeoutRegressionErrorReport ()
2773 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotTimeoutRegressionErrorReport" 2774 <<
" cmdStackIndex=" << m_cmdMediator->index()
2775 <<
" cmdStackCount=" << m_cmdMediator->count();
2777 if (m_cmdStackShadow->
canRedo()) {
2780 QDir::setCurrent (m_startupDirectory);
2785 QDir::setCurrent (m_startupDirectory);
2789 #if !defined(OSX_DEBUG) && !defined(OSX_RELEASE) 2790 exportAllCoordinateSystemsAfterRegressionTests ();
2794 m_cmdMediator->setClean();
2800 void MainWindow::slotTimeoutRegressionFileCmdScript ()
2802 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotTimeoutRegressionFileCmdScript";
2804 if (m_fileCmdScript->
canRedo()) {
2807 QDir::setCurrent (m_startupDirectory);
2809 m_fileCmdScript->
redo(*
this);
2812 QDir::setCurrent (m_startupDirectory);
2817 if (m_cmdMediator != 0) {
2819 #if !defined(OSX_DEBUG) && !defined(OSX_RELEASE) 2820 exportAllCoordinateSystemsAfterRegressionTests ();
2824 m_cmdMediator->setClean();
2834 void MainWindow::slotUndoTextChanged (
const QString &text)
2836 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotUndoTextChanged";
2838 QString completeText (
"Undo");
2839 if (!text.isEmpty ()) {
2840 completeText += QString (
" \"%1\"").arg (text);
2842 m_actionEditUndo->setText (completeText);
2845 void MainWindow::slotViewGridLines ()
2847 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::slotViewGridLines";
2852 void MainWindow::slotViewGroupBackground(QAction *action)
2854 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewGroupBackground";
2857 BackgroundImage backgroundImage;
2858 int indexBackground;
2859 if (action == m_actionViewBackgroundNone) {
2860 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_NONE));
2861 backgroundImage = BACKGROUND_IMAGE_NONE;
2862 }
else if (action == m_actionViewBackgroundOriginal) {
2863 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_ORIGINAL));
2864 backgroundImage = BACKGROUND_IMAGE_ORIGINAL;
2865 }
else if (action == m_actionViewBackgroundFiltered) {
2866 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_FILTERED));
2867 backgroundImage = BACKGROUND_IMAGE_FILTERED;
2869 ENGAUGE_ASSERT (
false);
2872 indexBackground = m_cmbBackground->findData (QVariant (BACKGROUND_IMAGE_ORIGINAL));
2873 backgroundImage = BACKGROUND_IMAGE_ORIGINAL;
2876 m_cmbBackground->setCurrentIndex (indexBackground);
2880 void MainWindow::slotViewGroupCurves(QAction * )
2882 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewGroupCurves";
2884 updateViewedCurves ();
2887 void MainWindow::slotViewGroupStatus(QAction *action)
2889 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewGroupStatus";
2891 ENGAUGE_CHECK_PTR (m_statusBar);
2893 if (action == m_actionStatusNever) {
2895 }
else if (action == m_actionStatusTemporary) {
2902 void MainWindow::slotViewToolBarBackground ()
2904 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarBackground";
2906 if (m_actionViewBackground->isChecked ()) {
2907 m_toolBackground->show();
2909 m_toolBackground->hide();
2913 void MainWindow::slotViewToolBarChecklistGuide ()
2915 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarChecklistGuide";
2917 if (m_actionViewChecklistGuide->isChecked ()) {
2918 m_dockChecklistGuide->show();
2920 m_dockChecklistGuide->hide();
2924 void MainWindow::slotViewToolBarCoordSystem ()
2926 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarCoordSystem";
2928 if (m_actionViewCoordSystem->isChecked ()) {
2929 m_toolCoordSystem->show();
2931 m_toolCoordSystem->hide();
2935 void MainWindow::slotViewToolBarDigitize ()
2937 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarDigitize";
2939 if (m_actionViewDigitize->isChecked ()) {
2940 m_toolDigitize->show();
2942 m_toolDigitize->hide();
2946 void MainWindow::slotViewToolBarFittingWindow()
2948 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarFittingWindow";
2950 if (m_actionViewFittingWindow->isChecked()) {
2951 m_dockFittingWindow->show ();
2952 if (m_fittingCurve != 0) {
2953 m_fittingCurve->setVisible (
true);
2956 m_dockFittingWindow->hide ();
2957 if (m_fittingCurve != 0) {
2958 m_fittingCurve->setVisible (
false);
2963 void MainWindow::slotViewToolBarGeometryWindow ()
2965 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarGeometryWindow";
2967 if (m_actionViewGeometryWindow->isChecked ()) {
2968 m_dockGeometryWindow->show();
2970 m_dockGeometryWindow->hide();
2974 void MainWindow::slotViewToolBarSettingsViews ()
2976 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolBarSettingsViews";
2978 if (m_actionViewSettingsViews->isChecked ()) {
2979 m_toolSettingsViews->show();
2981 m_toolSettingsViews->hide();
2985 void MainWindow::slotViewToolTips ()
2987 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewToolTips";
2992 void MainWindow::slotViewZoom (
int zoom)
2994 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoom";
2997 ZoomFactor zoomFactor = (ZoomFactor) zoom;
2998 m_zoomMapToAction [zoomFactor]->setChecked (
true);
2999 slotViewZoomFactor ((ZoomFactor) zoom);
3002 void MainWindow::slotViewZoomFactor (ZoomFactor zoomFactor)
3004 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomFactor";
3006 if (zoomFactor == ZOOM_FILL) {
3007 m_backgroundStateContext->
fitInView (*m_view);
3011 double factor = zoomTransition.
mapToFactor (zoomFactor);
3013 QTransform transform;
3014 transform.scale (factor, factor);
3015 m_view->setTransform (transform);
3021 void MainWindow::slotViewZoomFactorInt (
int zoom)
3023 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomFactorInt";
3025 slotViewZoomFactor ((ZoomFactor) zoom);
3028 void MainWindow::slotViewZoomIn ()
3030 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomIn";
3033 ZoomFactor zoomFactorNew = zoomTransition.
zoomIn (currentZoomFactor (),
3034 m_view->transform ().m11 (),
3035 m_view->transform ().m22 (),
3036 m_actionZoomFill->isChecked ());
3037 setNonFillZoomFactor (zoomFactorNew);
3041 void MainWindow::slotViewZoomInFromWheelEvent ()
3043 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomInFromWheelEvent";
3045 if ((m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL) ||
3046 (m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS)) {
3049 m_view->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
3054 m_view->setTransformationAnchor(QGraphicsView::NoAnchor);
3058 void MainWindow::slotViewZoomOut ()
3060 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomOut";
3064 ZoomFactor zoomFactorNew = zoomTransition.
zoomOut (currentZoomFactor (),
3065 m_view->transform ().m11 (),
3066 m_view->transform ().m22 (),
3067 m_actionZoomFill->isChecked ());
3068 setNonFillZoomFactor (zoomFactorNew);
3071 void MainWindow::slotViewZoomOutFromWheelEvent ()
3073 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::slotViewZoomOutFromWheelEvent";
3075 if ((m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL) ||
3076 (m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS)) {
3079 m_view->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
3084 m_view->setTransformationAnchor(QGraphicsView::NoAnchor);
3088 void MainWindow::startRegressionTestErrorReport(
const QString ®ressionInputFile)
3090 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::startRegressionTestErrorReport";
3099 m_regressionFile = exportRegressionFilenameFromInputFilename (regressionInputFile);
3101 m_timerRegressionErrorReport =
new QTimer();
3102 m_timerRegressionErrorReport->setSingleShot(
false);
3103 connect (m_timerRegressionErrorReport, SIGNAL (timeout()),
this, SLOT (slotTimeoutRegressionErrorReport()));
3105 m_timerRegressionErrorReport->start(REGRESSION_INTERVAL);
3108 void MainWindow::startRegressionTestFileCmdScript()
3110 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::startRegressionTestFileCmdScript";
3112 m_timerRegressionFileCmdScript =
new QTimer();
3113 m_timerRegressionFileCmdScript->setSingleShot(
false);
3114 connect (m_timerRegressionFileCmdScript, SIGNAL (timeout()),
this, SLOT (slotTimeoutRegressionFileCmdScript()));
3116 m_timerRegressionFileCmdScript->start(REGRESSION_INTERVAL);
3121 return m_transformation;
3131 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateAfterCommand";
3133 ENGAUGE_CHECK_PTR (m_cmdMediator);
3137 updateAfterCommandStatusBarCoords ();
3139 updateHighlightOpacity ();
3145 updateChecklistGuide ();
3146 updateFittingWindow ();
3147 updateGeometryWindow();
3152 writeCheckpointToLogFile ();
3154 docScrub.
check (*
this,
3159 m_view->setFocus ();
3162 void MainWindow::updateAfterCommandStatusBarCoords ()
3164 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateAfterCommandStatusBarCoords";
3169 const QPoint HACK_SO_GRAPH_COORDINATE_MATCHES_INPUT (1, 1);
3173 updateTransformationAndItsDependencies();
3176 if (!m_transformationBefore.transformIsDefined() && m_transformation.
transformIsDefined()) {
3180 TRANSFORMATION_STATE_DEFINED,
3185 }
else if (m_transformationBefore.transformIsDefined() && !m_transformation.
transformIsDefined()) {
3189 TRANSFORMATION_STATE_UNDEFINED,
3194 }
else if (m_transformation.
transformIsDefined() && (m_transformationBefore != m_transformation)) {
3203 QPoint posLocal = m_view->mapFromGlobal (QCursor::pos ()) - HACK_SO_GRAPH_COORDINATE_MATCHES_INPUT;
3204 QPointF posScreen = m_view->mapToScene (posLocal);
3206 slotMouseMove (posScreen);
3211 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateAfterMouseRelease";
3216 void MainWindow::updateChecklistGuide ()
3218 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateChecklistGuide";
3220 m_dockChecklistGuide->
update (*m_cmdMediator,
3221 m_isDocumentExported);
3224 void MainWindow::updateControls ()
3226 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateControls" 3227 <<
" selectedItems=" << m_scene->selectedItems().count();
3229 m_cmbBackground->setEnabled (!m_currentFile.isEmpty ());
3231 m_actionImportImageReplace->setEnabled (m_cmdMediator != 0);
3232 #if !defined(OSX_DEBUG) && !defined(OSX_RELEASE) 3233 m_menuFileOpenRecent->setEnabled ((m_actionRecentFiles.count () > 0) &&
3234 (m_actionRecentFiles.at(0)->isVisible ()));
3236 m_actionClose->setEnabled (!m_currentFile.isEmpty ());
3237 m_actionSave->setEnabled (!m_currentFile.isEmpty ());
3238 m_actionSaveAs->setEnabled (!m_currentFile.isEmpty ());
3239 m_actionExport->setEnabled (!m_currentFile.isEmpty ());
3240 m_actionPrint->setEnabled (!m_currentFile.isEmpty ());
3242 if (m_cmdMediator == 0) {
3243 m_actionEditUndo->setEnabled (
false);
3244 m_actionEditRedo->setEnabled (
false);
3246 m_actionEditUndo->setEnabled (m_cmdMediator->canUndo ());
3247 m_actionEditRedo->setEnabled (m_cmdMediator->canRedo () || m_cmdStackShadow->
canRedo ());
3249 bool tableFittingIsActive, tableFittingIsCopyable;
3250 bool tableGeometryIsActive, tableGeometryIsCopyable;
3251 m_dockFittingWindow->
getTableStatus (tableFittingIsActive, tableFittingIsCopyable);
3252 m_dockGeometryWindow->
getTableStatus (tableGeometryIsActive, tableGeometryIsCopyable);
3253 m_actionEditCut->setEnabled (!tableFittingIsActive &&
3254 !tableGeometryIsActive &&
3255 m_scene->selectedItems().count () > 0);
3256 m_actionEditCopy->setEnabled ((!tableFittingIsActive && !tableGeometryIsActive && m_scene->selectedItems().count () > 0) ||
3257 (tableFittingIsActive && tableFittingIsCopyable) ||
3258 (tableGeometryIsActive && tableGeometryIsCopyable));
3259 m_actionEditPaste->setEnabled (m_digitizeStateContext->
canPaste (m_transformation,
3261 m_actionEditDelete->setEnabled (!tableFittingIsActive &&
3262 !tableGeometryIsActive &&
3263 m_scene->selectedItems().count () > 0);
3266 m_actionDigitizeAxis->setEnabled (modeGraph ());
3267 m_actionDigitizeScale->setEnabled (
modeMap ());
3268 m_actionDigitizeCurve ->setEnabled (!m_currentFile.isEmpty ());
3269 m_actionDigitizePointMatch->setEnabled (!m_currentFile.isEmpty ());
3270 m_actionDigitizeColorPicker->setEnabled (!m_currentFile.isEmpty ());
3271 m_actionDigitizeSegment->setEnabled (!m_currentFile.isEmpty ());
3272 m_actionDigitizeSelect->setEnabled (!m_currentFile.isEmpty ());
3274 m_actionViewGridLines->setEnabled (
true);
3276 m_actionViewGridLines->setEnabled (
false);
3277 m_actionViewGridLines->setChecked (
false);
3279 m_actionViewBackground->setEnabled (!m_currentFile.isEmpty());
3280 m_actionViewChecklistGuide->setEnabled (!m_dockChecklistGuide->
browserIsEmpty());
3281 m_actionViewDigitize->setEnabled (!m_currentFile.isEmpty ());
3282 m_actionViewSettingsViews->setEnabled (!m_currentFile.isEmpty ());
3284 m_actionSettingsCoords->setEnabled (!m_currentFile.isEmpty ());
3285 m_actionSettingsCurveList->setEnabled (!m_currentFile.isEmpty ());
3286 m_actionSettingsCurveProperties->setEnabled (!m_currentFile.isEmpty ());
3287 m_actionSettingsDigitizeCurve->setEnabled (!m_currentFile.isEmpty ());
3288 m_actionSettingsExport->setEnabled (!m_currentFile.isEmpty ());
3289 m_actionSettingsColorFilter->setEnabled (!m_currentFile.isEmpty ());
3290 m_actionSettingsAxesChecker->setEnabled (!m_currentFile.isEmpty ());
3291 m_actionSettingsGridDisplay->setEnabled (!m_currentFile.isEmpty () && m_transformation.
transformIsDefined());
3292 m_actionSettingsGridRemoval->setEnabled (!m_currentFile.isEmpty ());
3293 m_actionSettingsPointMatch->setEnabled (!m_currentFile.isEmpty ());
3294 m_actionSettingsSegments->setEnabled (!m_currentFile.isEmpty ());
3295 m_actionSettingsGeneral->setEnabled (!m_currentFile.isEmpty ());
3297 m_groupBackground->setEnabled (!m_currentFile.isEmpty ());
3298 m_groupCurves->setEnabled (!m_currentFile.isEmpty ());
3299 m_groupZoom->setEnabled (!m_currentFile.isEmpty ());
3301 m_actionZoomIn->setEnabled (!m_currentFile.isEmpty ());
3302 m_actionZoomOut->setEnabled (!m_currentFile.isEmpty ());
3307 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateCoordSystem";
3312 loadCurveListFromCmdMediator ();
3314 updateTransformationAndItsDependencies();
3326 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateDigitizeStateIfSoftwareTriggered";
3328 switch (digitizeState) {
3329 case DIGITIZE_STATE_AXIS:
3330 m_actionDigitizeAxis->setChecked(
true);
3334 case DIGITIZE_STATE_COLOR_PICKER:
3335 m_actionDigitizeColorPicker->setChecked(
true);
3336 slotDigitizeColorPicker();
3339 case DIGITIZE_STATE_CURVE:
3340 m_actionDigitizeCurve->setChecked(
true);
3341 slotDigitizeCurve();
3344 case DIGITIZE_STATE_EMPTY:
3347 case DIGITIZE_STATE_POINT_MATCH:
3348 m_actionDigitizePointMatch->setChecked(
true);
3349 slotDigitizePointMatch();
3352 case DIGITIZE_STATE_SCALE:
3353 m_actionDigitizeScale->setChecked(
true);
3354 slotDigitizeScale();
3357 case DIGITIZE_STATE_SEGMENT:
3358 m_actionDigitizeSegment->setChecked(
true);
3359 slotDigitizeSegment();
3362 case DIGITIZE_STATE_SELECT:
3363 m_actionDigitizeSelect->setChecked(
true);
3364 slotDigitizeSelect();
3368 LOG4CPP_ERROR_S ((*mainCat)) <<
"MainWindow::updateDigitizeStateIfSoftwareTriggered";
3373 void MainWindow::updateFittingWindow ()
3375 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateFittingWindow";
3377 if (m_cmdMediator != 0 &&
3381 m_dockFittingWindow->
update (*m_cmdMediator,
3383 m_cmbCurve->currentText (),
3388 void MainWindow::updateGeometryWindow ()
3390 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateGeometryWindow";
3392 if (m_cmdMediator != 0 &&
3396 m_dockGeometryWindow->
update (*m_cmdMediator,
3398 m_cmbCurve->currentText (),
3405 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateGraphicsLinesToMatchGraphicsPoints";
3411 void MainWindow::updateGridLines ()
3413 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateGridLines";
3416 m_gridLines.
clear ();
3427 m_gridLines.
setVisible (m_actionViewGridLines->isChecked());
3430 void MainWindow::updateHighlightOpacity ()
3432 if (m_cmdMediator != 0) {
3438 m_dockGeometryWindow,
3443 void MainWindow::updateRecentFileList()
3445 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateRecentFileList";
3447 #if !defined(OSX_DEBUG) && !defined(OSX_RELEASE) 3448 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
3449 QStringList recentFilePaths = settings.value(SETTINGS_RECENT_FILE_LIST).toStringList();
3452 unsigned int count = recentFilePaths.size();
3453 if (count > MAX_RECENT_FILE_LIST_SIZE) {
3454 count = MAX_RECENT_FILE_LIST_SIZE;
3459 for (i = 0; i < count; i++) {
3460 QString strippedName = QFileInfo (recentFilePaths.at(i)).fileName();
3461 m_actionRecentFiles.at (i)->setText (strippedName);
3462 m_actionRecentFiles.at (i)->setData (recentFilePaths.at (i));
3463 m_actionRecentFiles.at (i)->setVisible (
true);
3467 for (i = count; i < MAX_RECENT_FILE_LIST_SIZE; i++) {
3468 m_actionRecentFiles.at (i)->setVisible (
false);
3475 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsAxesChecker";
3478 if (m_transformation.transformIsDefined()) {
3480 TRANSFORMATION_STATE_DEFINED,
3483 m_cmbCurve->currentText());
3486 TRANSFORMATION_STATE_UNDEFINED,
3489 m_cmbCurve->currentText());
3495 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsColorFilter";
3502 m_cmbCurve->currentText());
3509 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsCoords";
3516 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsCurveList";
3519 loadCurveListFromCmdMediator();
3525 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsCurveStyles";
3534 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsDigitizeCurve";
3538 modelDigitizeCurve);
3543 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsExportFormat";
3550 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsGeneral";
3557 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsGridDisplay";
3565 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsGridRemoval";
3570 void MainWindow::updateSettingsMainWindow()
3572 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsMainWindow";
3574 if (m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_ONLY ||
3575 m_modelMainWindow.
zoomControl() == ZOOM_CONTROL_MENU_WHEEL) {
3577 m_actionZoomIn->setShortcut (tr (
""));
3578 m_actionZoomOut->setShortcut (tr (
""));
3582 m_actionZoomIn->setShortcut (tr (
"+"));
3583 m_actionZoomOut->setShortcut (tr (
"-"));
3587 if ((m_scene != 0) &&
3588 (m_cmdMediator != 0)) {
3592 updateHighlightOpacity();
3593 updateWindowTitle();
3594 updateFittingWindow();
3595 updateGeometryWindow();
3600 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsMainWindow";
3608 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsPointMatch";
3615 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateSettingsSegments";
3621 void MainWindow::updateSmallDialogs ()
3638 void MainWindow::updateTransformationAndItsDependencies()
3640 m_transformation.update (!m_currentFile.isEmpty (),
3649 m_cmbCurve->currentText ());
3656 void MainWindow::updateViewedCurves ()
3658 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateViewedCurves";
3660 if (m_actionViewCurvesAll->isChecked ()) {
3664 }
else if (m_actionViewCurvesSelected->isChecked ()) {
3668 }
else if (m_actionViewCurvesNone->isChecked ()) {
3673 ENGAUGE_ASSERT (
false);
3679 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateViewsOfSettings";
3681 QString activeCurve = m_digitizeStateContext->
activeCurve ();
3688 if (activeCurve.isEmpty ()) {
3701 m_cmdMediator->
pixmap ());
3706 void MainWindow::updateWindowTitle ()
3708 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindow::updateWindowTitle";
3710 const QString PLACEHOLDER (
"[*]");
3712 QString title = QString (
"%1 %2")
3713 .arg (tr (
"Engauge Digitizer"))
3714 .arg (VERSION_NUMBER);
3716 QString fileNameMaybeStripped;
3717 if (!m_currentFileWithPathAndFileExtension.isEmpty()) {
3719 QFileInfo fileInfo (m_currentFileWithPathAndFileExtension);
3723 case MAIN_TITLE_BAR_FORMAT_NO_PATH:
3726 fileNameMaybeStripped = fileInfo.completeBaseName();
3729 case MAIN_TITLE_BAR_FORMAT_PATH:
3730 fileNameMaybeStripped = m_currentFileWithPathAndFileExtension;
3734 title += QString (
": %1")
3735 .arg (fileNameMaybeStripped);
3740 title += PLACEHOLDER;
3742 setWindowTitle (title);
3747 ENGAUGE_CHECK_PTR (m_view);
3753 ENGAUGE_CHECK_PTR (m_view);
3757 void MainWindow::writeCheckpointToLogFile ()
3760 QString checkpointDoc;
3761 QTextStream strDoc (&checkpointDoc);
3766 QString checkpointScene;
3767 QTextStream strScene (&checkpointScene);
3772 if (mainCat->
getPriority() == log4cpp::Priority::DEBUG) {
3774 LOG4CPP_DEBUG_S ((*mainCat)) <<
"MainWindow::writeCheckpointToLogFile\n" 3775 <<
"--------------DOCUMENT CHECKPOINT START----------" <<
"\n" 3776 << checkpointDoc.toLatin1().data()
3777 <<
"---------------DOCUMENT CHECKPOINT END-----------" <<
"\n" 3778 <<
"----------------SCENE CHECKPOINT START-----------" <<
"\n" 3779 << checkpointScene.toLatin1().data()
3780 <<
"-----------------SCENE CHECKPOINT END------------" ;
void addCoordSystems(unsigned int numberCoordSystemToAdd)
Add some number (0 or more) of additional coordinate systems.
bool canRedo() const
Return true if there is a command available.
void load(CmdMediator &cmdMediator)
Load settings from Document.
Factory class for generating the points, composed of QGraphicsItem objects, along a GridLine...
void updateGraphicsLinesToMatchGraphicsPoints(const CurveStyles &modelCurveStyles, const Transformation &transformation)
A mouse move has just occurred so move the selected points, since they were dragged.
QImage imageFiltered() const
Background image that has been filtered for the current curve. This asserts if a curve-specific image...
void updateCoordSystem(CoordSystemIndex coordSystemIndex)
Select a different CoordSystem.
Model for DlgSettingsGeneral and CmdSettingsGeneral.
CurveStyle curveStyle(const QString &curveName) const
CurveStyle in specified curve.
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 ...
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 setCurveName(const QString &curveName)
Load information for the specified curve name. When called externally, the load method must have been...
bool canRedo() const
Returns true if there is at least one command on the stack.
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.
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.
static void setIdentifierIndex(unsigned int identifierIndex)
Reset the current index while performing a Redo.
double mapToFactor(ZoomFactor zoomFactor) const
Return the floating precision zoom factor given the enum value.
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.
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.
DocumentModelGridRemoval modelGridRemoval() const
Get method for DocumentModelGridRemoval.
Wrapper around the QImage class for read and importing non-PDF files.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
bool loadsAsDigFile(const QString &urlString) const
Returns true if specified file name can be loaded as a DIG file.
void setModelSegments(const DocumentModelSegments &modelSegments)
Set method for DocumentModelSegments.
unsigned int coordSystemIndexToBeRestored() const
Coordinate system index that was active before the ghosts.
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 exportToFile(const DocumentModelExportFormat &modelExport, const Document &document, const MainWindowModel &modelMainWindow, const Transformation &transformation, QTextStream &str) const
Export Document points according to the settings.
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...
QDir getDirectoryExportSave() const
Get the current Export/Save directory.
ZoomFactor zoomIn(ZoomFactor currentZoomFactor, double m11, double m22, bool actionZoomFillIsChecked) const
Zoom in.
void handleContextMenuEventGraph(CmdMediator *cmdMediator, const QStringList &pointIdentifiers)
See DigitizeStateAbstractBase::handleContextMenuEventGraph.
PointStyle pointStyle() const
Get method for PointStyle.
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.
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...
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...
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void retrievePoints(const Transformation &transformation, QList< QPoint > &points, QList< double > &ordinals) const
Retrieve points from clipboard.
QString activeCurve() const
Curve name for active Curve. This can include AXIS_CURVE_NAME, and empty string.
void slotRedo()
Move next command from list to CmdMediator. Noop if there are no more commands.
DocumentAxesPointsRequired documentAxesPointsRequired() const
Get method for DocumentAxesPointsRequired.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
DocumentModelColorFilter modelColorFilter() const
Get method for DocumentModelColorFilter.
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.
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.
double highlightOpacity() const
Get method for highlight opacity.
CmdMediator * cmdMediator()
Accessor for commands to process the Document.
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.
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 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.
Priority::Value getPriority() const
Returns unused priority.
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.
void updateAfterCommand(CmdMediator &cmdMediator, double highlightOpacity, GeometryWindow *geometryWindow, const Transformation &transformation)
Update the Points and their Curves after executing a command.
ZoomFactorInitial zoomFactorInitial() const
Get method for initial zoom factor.
QString filterCsv() const
QFileDialog filter for CSV files.
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.
bool smallDialogs() const
Get method for small dialogs flag.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
Transformation transformation() const
Return read-only copy of transformation.
void showTemporaryMessage(const QString &temporaryMessage)
Show temporary message in status bar.
static void bindToMainWindow(MainWindow *mainWindow)
Bind to MainWindow so this class can access the command stack.
StatusBarMode statusBarMode() const
Current mode for status bar visibility. This is tracked locally so this class knows when to hide/show...
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.
void setCoordSystemIndex(CoordSystemIndex coordSystemIndex)
Set the index of current active CoordSystem.
void updateSettingsDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Update with new curve digitization styles.
bool load(const QString &filename, QImage &image) const
Load image from jpeg2000 file.
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.
QDir getDirectoryImportOpen() const
Get the current Import/Open directory.
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.
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.
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...
ZoomControl zoomControl() const
Get method for zoom control.
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.
ImportCropping importCropping() const
Get method for import cropping.
void setModelCurveStyles(const CurveStyles &modelCurveStyles)
Set method for CurveStyles.
bool transformIsDefined() const
Return true if all three axis points have been defined.
Facade class that wraps around all of the create classes for MainWindow.
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.
bool isGnuplot() const
Get method for gnuplot flag.
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.
CoordSystemIndex coordSystemIndex() const
Index of current active CoordSystem.
void updateModelSegments(const DocumentModelSegments &modelSegments)
Update the segments given the new settings.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
int maximumGridLines() const
Maximum number of grid lines.
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.
DocumentModelGridDisplay modelGridDisplay() const
Get method for DocumentModelGridDisplay.
QStringList unite(CmdMediator *cmdMediator, const QStringList &pointIdentifiersIn) const
Add.
void setModelColorFilter(const DocumentModelColorFilter &modelColorFilter)
Set method for DocumentModelColorFilter.
void close()
Open Document is being closed so remove the background.
Model for DlgSettingsCoords and CmdSettingsCoords.
void setVisible(bool visible)
Make all grid lines visible or hidden.
void updateAfterCommand()
See GraphicsScene::updateAfterCommand.
Curve that overlays the current scene so the regression-fitted curve is visible.
void updateSettingsColorFilter(const DocumentModelColorFilter &modelColorFilter)
Update with new color filter properties.
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.
int pdfResolution() const
Get method for resolution of imported PDF files, in dots per inch.
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.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
bool canPaste(const Transformation &transformation, const QSize &viewSize) const
Return true if there is good data in the clipboard for pasting, and that operation is compatible with...
void 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 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.
void unsetColorFilterSettings()
Apply no color filter.
Dialog for setting the advanced parameters in a newly imported Document.
Wizard for setting up the checklist guide.
void handleMouseMove(CmdMediator *cmdMediator, QPointF pos)
See DigitizeStateAbstractBase::handleMouseMove.
MainWindowModel modelMainWindow() const
Get method for main window model.
MainTitleBarFormat mainTitleBarFormat() const
Get method for MainWindow titlebar filename format.
QLocale locale() const
Get method for locale.
Model for DlgSettingsAxesChecker and CmdSettingsAxesChecker.
unsigned int coordSystemCount() const
Number of CoordSystem.
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.
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.
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.
QString fileExtensionTsv() const
File extension for tsv export files.
QStringList curveNames(CoordSystemIndex coordSystemIndex) const
Curve names to be placed into Document.
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.
bool dragDropExport() const
Get method for drag and drop export.
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.
QImage imageForCurveState() const
Image for the Curve state, even if the current state is different.
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 check(MainWindow &mainWindow, const Document &document) const
Check document state.
void loadCommands(MainWindow &mainWindow, Document &document, QXmlStreamReader &reader)
Load commands from serialized xml.
DocumentModelExportFormat modelExport() const
Get method for DocumentModelExportFormat.
void update(const CmdMediator &cmdMediator, bool documentIsExported)
Update using current CmdMediator/Document state.
void saveXml(QXmlStreamWriter &writer) const
Save document to xml.
File that manages a command stack for regression testing of file import/open/export/close.
QString fileExtensionCsv() const
File extension for csv export files.
ZoomFactor zoomOut(ZoomFactor currentZoomFactor, double m11, double m22, bool actionZoomFillIsChecked) const
Zoom out.
void setSmallDialogs(bool smallDialogs)
Set method for small dialogs flag.
void handleMousePress(CmdMediator *cmdMediator, QPointF pos)
See DigitizeStateAbstractBase::handleMousePress.
Add point and line handling to generic QGraphicsScene.
CurveStyles modelCurveStyles() const
Get method for CurveStyles.
QStringList fileExtensionsWithAsterisks() const
File extensions for use in file dialogs.
QString selectedGraphCurve() const
Curve name that is currently selected in m_cmbCurve.
Command for moving all selected Points by a specified translation.
bool browserIsEmpty() const
When browser is empty, it is pointless to show it.
Model for DlgSettingsGridRemoval and CmdSettingsGridRemoval. The settings are unstable until the user...
bool modeMap() const
True if document scale is set using a scale bar, otherwise using axis points.
QString filterTsv() const
QFileDialog filter for TSV files.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
void fileExport(const QString &filename) const
Export to the specified file. This is called when the Transformation has not been defined...
void updateSettingsSegments(const DocumentModelSegments &modelSegments)
Update with new segments properties.
Command for changing the currently selected CoordSystem.
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.
QString templateHtml(CoordSystemIndex coordSystemIndex) const
Template html comprising the checklist for display.
Persist the directory between successive Import/Open operations, or successive Export/Save operations...
DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
void populateCurvesGraphs(CoordSystemIndex coordSystemIndex, CurvesGraphs &curvesGraphs)
Create entries in CurvesGraphs for each curve name that user provided.
void setImportCropping(ImportCropping importCropping)
Set method for import cropping.
QStringList curvesGraphsNames() const
See CurvesGraphs::curvesGraphsNames.
void setTemplateHtml(const QString &html, const QStringList &curveNames)
Populate the browser with template html.
virtual void clear()
Clear stale information.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
About Engauge dialog. This provides a hidden shortcut for triggering ENGAUGE_ASSERT.
DocumentModelAxesChecker modelAxesChecker() const
Get method for DocumentModelAxesChecker.
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.
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 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.