10 #include "BackgroundImage.h"
11 #include "CoordSystemIndex.h"
12 #include "DigitizeStateAbstractBase.h"
13 #include "DocumentAxesPointsRequired.h"
14 #include "FittingCurveCoefficients.h"
15 #include "GridLines.h"
16 #include "MainWindowModel.h"
18 #include <QMainWindow>
21 #include "Transformation.h"
22 #include "ZoomControl.h"
23 #include "ZoomFactor.h"
24 #include "ZoomFactorInitial.h"
63 #if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
73 class QGraphicsLineItem;
88 extern const unsigned int MAX_RECENT_FILE_LIST_SIZE;
131 const QString &fileCmdScriptFile,
132 bool isDropRegression,
133 bool isRegressionTest,
137 bool isExtractImageOnly,
138 const QString &extractImageOnlyExtension,
139 const QStringList &loadStartupFiles,
140 const QStringList &commandLineWithoutLoadStartupFiles,
141 QWidget *parent = 0);
181 const char *context);
270 void slotBtnPrintAll();
271 void slotBtnShowAllPressed();
272 void slotBtnShowAllReleased();
273 void slotCanRedoChanged (
bool);
274 void slotCanUndoChanged (
bool);
275 void slotChecklistClosed ();
276 void slotCleanChanged (
bool);
277 void slotCmbBackground(
int);
278 void slotCmbCoordSystem(
int);
279 void slotCmbCurve(
int);
280 void slotContextMenuEventAxis (QString);
281 void slotContextMenuEventGraph (QStringList);
282 void slotDigitizeAxis ();
283 void slotDigitizeColorPicker ();
284 void slotDigitizeCurve ();
285 void slotDigitizePointMatch ();
286 void slotDigitizeScale ();
287 void slotDigitizeSegment ();
288 void slotDigitizeSelect ();
289 void slotEditCopy ();
291 void slotEditDelete ();
292 void slotEditMenu ();
293 void slotEditPaste ();
294 void slotEditPasteAsNew ();
295 void slotEditPasteAsNewAdvanced ();
296 void slotFileClose ();
297 void slotFileExport ();
298 void slotFileImport();
299 void slotFileImportAdvanced();
300 void slotFileImportDraggedImage(QImage);
301 void slotFileImportDraggedImageUrl(QUrl);
302 void slotFileImportImage(QString, QImage);
303 void slotFileImportImageReplace();
305 void slotFileOpenDraggedDigFile (QString);
306 void slotFilePrint();
308 bool slotFileSaveAs();
309 void slotFittingWindowClosed();
310 void slotFittingWindowCurveFit(FittingCurveCoefficients,
double,
double,
bool,
bool);
311 void slotGeometryWindowClosed();
312 void slotHelpAbout();
313 void slotHelpTutorial();
314 void slotKeyPress (Qt::Key,
bool);
315 void slotLoadStartupFiles ();
316 void slotMouseMove (QPointF);
317 void slotMousePress (QPointF);
318 void slotMouseRelease (QPointF);
319 void slotRecentFileAction ();
320 void slotRecentFileClear ();
321 void slotRedoTextChanged (
const QString &);
322 void slotSettingsAxesChecker ();
323 void slotSettingsColorFilter ();
324 void slotSettingsCoords ();
325 void slotSettingsCurveList ();
326 void slotSettingsCurveProperties ();
327 void slotSettingsDigitizeCurve ();
328 void slotSettingsExportFormat ();
329 void slotSettingsGeneral ();
330 void slotSettingsGridDisplay ();
331 void slotSettingsGridRemoval ();
332 void slotSettingsMainWindow ();
333 void slotSettingsPointMatch ();
334 void slotSettingsSegments ();
335 void slotTableStatusChange ();
336 void slotTimeoutRegressionErrorReport ();
337 void slotTimeoutRegressionFileCmdScript ();
338 void slotUndoTextChanged (
const QString &);
339 void slotViewGridLines ();
340 void slotViewGroupBackground(QAction*);
341 void slotViewGroupCurves(QAction*);
342 void slotViewGroupStatus(QAction*);
343 void slotViewToolBarBackground ();
344 void slotViewToolBarChecklistGuide ();
345 void slotViewToolBarCoordSystem ();
346 void slotViewToolBarDigitize ();
347 void slotViewToolBarFittingWindow ();
348 void slotViewToolBarGeometryWindow ();
349 void slotViewToolBarSettingsViews ();
350 void slotViewToolTips ();
351 void slotViewZoomFactor (ZoomFactor);
352 void slotViewZoomFactorInt (
int);
353 void slotViewZoom (
int);
354 void slotViewZoomIn ();
355 void slotViewZoomInFromWheelEvent ();
356 void slotViewZoomOut ();
357 void slotViewZoomOutFromWheelEvent ();
371 IMPORT_TYPE_ADVANCED,
372 IMPORT_TYPE_IMAGE_REPLACE
375 void addDockWindow (QDockWidget *dockWidget,
377 const QString &settingsTokenArea,
378 const QString &settingsTokenGeometry,
379 Qt::DockWidgetArea dockWidgetArea);
380 void applyZoomFactorAfterLoad();
381 virtual void closeEvent(QCloseEvent *event);
382 ZoomFactor currentZoomFactor ()
const;
383 #if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
384 void exportAllCoordinateSystemsAfterRegressionTests();
386 QString exportRegressionFilenameFromInputFilename (
const QString &fileName)
const;
387 void fileExport(
const QString &fileName,
389 void fileExtractImage (
const QString &fileName);
390 void fileImport (
const QString &fileName,
391 ImportType ImportType);
392 void fileImportWithPrompts (ImportType ImportType);
393 QString fileNameForExportOnly ()
const;
394 QString fileNameForExtractImageOnly ()
const;
395 void filePaste (ImportType importType);
396 void ghostsCreate ();
397 void ghostsDestroy ();
398 void handlerFileExtractImage ();
399 void loadCoordSystemListFromCmdMediator();
400 void loadCurveListFromCmdMediator();
401 void loadDocumentFile (
const QString &fileName);
402 void loadErrorReportFile(
const QString &errorReportFile);
403 bool loadImage (
const QString &fileName,
405 ImportType ImportType);
406 bool loadImageNewDocument (
const QString &fileName,
408 ImportType ImportType);
409 bool loadImageReplacingImage (
const QString &fileName,
411 ImportType ImportType);
412 void loadInputFileForErrorReport(QDomDocument &domInputFile)
const;
413 void loadToolTips ();
417 const QString &selectedNameFilter)
const;
418 bool modeGraph ()
const;
419 void rebuildRecentFileListForCurrentFile(
const QString &filePath);
420 bool saveDocumentFile(
const QString &fileName);
421 QString saveErrorReportFileAndExitXml (
const char *comment,
424 const char *context)
const;
425 void saveStartingDocumentSnapshot();
426 void setCurrentFile(
const QString &fileName);
427 void setCurrentPathFromFile (
const QString &fileName);
428 void setNonFillZoomFactor (ZoomFactor newZoomFactor);
429 void setPixmap (
const QString &curveSelected,
430 const QPixmap &pixmap);
431 void settingsRead (
bool isReset);
432 void settingsReadEnvironment (QSettings &settings);
433 void settingsReadMainWindow (QSettings &settings);
434 void settingsWrite ();
435 bool setupAfterLoadNewDocument (
const QString &fileName,
436 const QString &temporaryMessage,
437 ImportType ImportType);
438 bool setupAfterLoadReplacingImage (
const QString &fileName,
439 const QString &temporaryMessage,
440 ImportType ImportType);
441 void startRegressionTestErrorReport (
const QString ®ressionInputFile);
442 void startRegressionDropTest (
const QStringList &loadStartupFiles);
443 void startRegressionTestFileCmdScript ();
444 void updateAfterCommandStatusBarCoords ();
445 void updateChecklistGuide ();
446 void updateControls ();
447 void updateFittingWindow ();
448 void updateGeometryWindow ();
449 void updateGridLines();
450 void updateHighlightOpacity();
451 void updateRecentFileList();
452 void updateSettingsMainWindow();
453 void updateSmallDialogs();
454 void updateTransformationAndItsDependencies();
455 void updateViewedCurves ();
456 void updateViewsOfSettings ();
457 void updateWindowTitle ();
458 void writeCheckpointToLogFile();
460 QString m_originalFile;
461 bool m_originalFileWasImported;
462 bool m_isDocumentExported;
463 QString m_engaugeFile;
464 QString m_currentFile;
465 QString m_currentFileWithPathAndFileExtension;
466 MainTitleBarFormat m_titleBarFormat;
469 QAction *m_actionImport;
470 QAction *m_actionImportAdvanced;
471 QAction *m_actionImportImageReplace;
472 QAction *m_actionOpen;
473 QMenu *m_menuFileOpenRecent;
474 QList<QAction*> m_actionRecentFiles;
475 QAction *m_actionClose;
476 QAction *m_actionSave;
477 QAction *m_actionSaveAs;
478 QAction *m_actionExport;
479 QAction *m_actionPrint;
480 QAction *m_actionExit;
483 QAction *m_actionEditUndo;
484 QAction *m_actionEditRedo;
485 QAction *m_actionEditCut;
486 QAction *m_actionEditCopy;
487 QAction *m_actionEditPaste;
488 QAction *m_actionEditDelete;
489 QAction *m_actionEditPasteAsNew;
490 QAction *m_actionEditPasteAsNewAdvanced;
492 QMenu *m_menuDigitize;
493 QActionGroup *m_groupDigitize;
494 QAction *m_actionDigitizeSelect;
495 QAction *m_actionDigitizeAxis;
496 QAction *m_actionDigitizeScale;
497 QAction *m_actionDigitizeCurve;
498 QAction *m_actionDigitizePointMatch;
499 QAction *m_actionDigitizeColorPicker;
500 QAction *m_actionDigitizeSegment;
503 QAction *m_actionViewBackground;
504 QAction *m_actionViewChecklistGuide;
505 QAction *m_actionViewCoordSystem;
506 QAction *m_actionViewDigitize;
507 QAction *m_actionViewFittingWindow;
508 QAction *m_actionViewGeometryWindow;
509 QAction *m_actionViewSettingsViews;
510 QAction *m_actionViewToolTips;
511 QAction *m_actionViewGridLines;
512 QMenu *m_menuViewBackground;
513 QActionGroup *m_groupBackground;
514 QAction *m_actionViewBackgroundNone;
515 QAction *m_actionViewBackgroundOriginal;
516 QAction *m_actionViewBackgroundFiltered;
517 QMenu *m_menuViewCurves;
518 QActionGroup *m_groupCurves;
519 QAction *m_actionViewCurvesNone;
520 QAction *m_actionViewCurvesSelected;
521 QAction *m_actionViewCurvesAll;
522 QMenu *m_menuViewStatus;
523 QActionGroup *m_groupStatus;
524 QAction *m_actionStatusNever;
525 QAction *m_actionStatusTemporary;
526 QAction *m_actionStatusAlways;
527 QMenu *m_menuViewZoom;
528 QAction *m_actionZoomOut;
529 QAction *m_actionZoomIn;
530 QActionGroup *m_groupZoom;
531 QSignalMapper *m_mapperZoomFactor;
532 QAction *m_actionZoomFill;
533 QAction *m_actionZoom16To1;
534 QAction *m_actionZoom16To1Farther;
535 QAction *m_actionZoom8To1Closer;
536 QAction *m_actionZoom8To1;
537 QAction *m_actionZoom8To1Farther;
538 QAction *m_actionZoom4To1Closer;
539 QAction *m_actionZoom4To1;
540 QAction *m_actionZoom4To1Farther;
541 QAction *m_actionZoom2To1Closer;
542 QAction *m_actionZoom2To1;
543 QAction *m_actionZoom2To1Farther;
544 QAction *m_actionZoom1To1Closer;
545 QAction *m_actionZoom1To1;
546 QAction *m_actionZoom1To1Farther;
547 QAction *m_actionZoom1To2Closer;
548 QAction *m_actionZoom1To2;
549 QAction *m_actionZoom1To2Farther;
550 QAction *m_actionZoom1To4Closer;
551 QAction *m_actionZoom1To4;
552 QAction *m_actionZoom1To4Farther;
553 QAction *m_actionZoom1To8Closer;
554 QAction *m_actionZoom1To8;
555 QAction *m_actionZoom1To8Farther;
556 QAction *m_actionZoom1To16Closer;
557 QAction *m_actionZoom1To16;
559 QMenu *m_menuSettings;
560 QAction *m_actionSettingsAxesChecker;
561 QAction *m_actionSettingsColorFilter;
562 QAction *m_actionSettingsCoords;
563 QAction *m_actionSettingsCurveList;
564 QAction *m_actionSettingsCurveProperties;
565 QAction *m_actionSettingsDigitizeCurve;
566 QAction *m_actionSettingsExport;
567 QAction *m_actionSettingsGeneral;
568 QAction *m_actionSettingsGridDisplay;
569 QAction *m_actionSettingsGridRemoval;
570 QAction *m_actionSettingsMainWindow;
571 QAction *m_actionSettingsPointMatch;
572 QAction *m_actionSettingsSegments;
575 QAction *m_actionHelpAbout;
576 QAction *m_actionHelpChecklistGuideWizard;
577 QAction *m_actionHelpHelp;
578 QAction *m_actionHelpTutorial;
579 QAction *m_actionHelpWhatsThis;
581 QVBoxLayout *m_layout;
588 QComboBox *m_cmbCurve;
589 QToolBar *m_toolDigitize;
592 QComboBox *m_cmbBackground;
593 QToolBar *m_toolBackground;
597 QToolBar *m_toolSettingsViews;
602 QComboBox *m_cmbCoordSystem;
603 QPushButton *m_btnPrintAll;
604 QPushButton *m_btnShowAll;
605 QToolBar *m_toolCoordSystem;
607 #if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
639 QString m_startingDocumentSnapshot;
647 QTimer *m_timerLoadStartupFiles;
648 QStringList m_loadStartupFiles;
651 QStringList m_commandLineWithoutLoadStartupFiles;
659 QTimer *m_timerRegressionErrorReport;
661 bool m_isErrorReportRegressionTest;
662 QTimer *m_timerRegressionFileCmdScript;
663 QString m_regressionFile;
664 QString m_startupDirectory;
672 QMap<ZoomFactorInitial, ZoomFactor> m_zoomMapFromInitial;
673 QMap<ZoomFactor, QAction*> m_zoomMapToAction;
682 bool m_isExtractImageOnly;
683 QString m_extractImageOnlyExtension;
686 #endif // MAIN_WINDOW_H
void updateCoordSystem(CoordSystemIndex coordSystemIndex)
Select a different CoordSystem.
Model for DlgSettingsGeneral and CmdSettingsGeneral.
Model for DlgSettingsPointMatch and CmdSettingsPointMatch.
void updateSettingsMainWindow(const MainWindowModel &modelMainWindow)
Update with new main window properties.
Model for DlgSettingsGridDisplay and CmdSettingsGridDisplay.
void updateDigitizeStateIfSoftwareTriggered(DigitizeState digitizeState)
After software-triggered state transition, this method manually triggers the action as if user had cl...
Class to create actions for MainWindow class.
Class that displays the current Segment Filter in a MainWindow toolbar.
Dialog for editing Segments settings, for DigitizeStateSegment.
Dialog for editing point match settings, for DigitizeStatePointMatch.
Transformation transformation() const
Return read-only copy of transformation.
Context class for transformation state machine.
Model for DlgSettingsCurveProperties and CmdSettingsCurveProperties.
void updateAfterMouseRelease()
Call MainWindow::updateControls (which is private) after the very specific case - a mouse press/relea...
void saveErrorReportFileAndExit(const char *comment, const char *file, int line, const char *context)
Save error report and exit.
void cmdFileClose()
Close file. This is called from a file script command.
Class to create settings dialogs for MainWindow class.
Class to create state contexts, which wrap state machine design patterns, for MainWindow class...
Class to create zoom factor maps for MainWindow class.
bool modeMap() const
True if document scale is set using a scale bar, otherwise using axis points.
void updateViewsOfSettings(const QString &activeCurve)
Update curve-specific view of settings. Private version gets active curve name from DigitizeStateCont...
QString selectedGraphCurve() const
Curve name that is currently selected in m_cmbCurve.
Class for showing points and lines for all coordinate systems simultaneously, even though the code no...
Window that displays the geometry information, as a table, for the current curve. ...
void cmdFileOpen(const QString &fileName)
Open file. This is called from a file script command.
CmdMediator * cmdMediator()
Accessor for commands to process the Document.
Class to create LoadImageFromUrl for MainWindow class.
BackgroundImage selectOriginal(BackgroundImage backgroundImage)
Make original background visible, for DigitizeStateColorPicker.
Dialog for editing grid removal settings.
Class to create QGraphicsScene for MainWindow class.
Unit test of Export classes.
void showTemporaryMessage(const QString &temporaryMessage)
Show temporary message in status bar.
Class to TutorialDlg for MainWindow class.
void updateSettingsDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Update with new curve digitization styles.
Tutorial using a strategy like a comic strip with decision points deciding which panels appear...
void cmdFileExport(const QString &fileName)
Export file. This is called from a file script command.
Class to create status bar for MainWindow class.
Strategy class for exporting to a file. This strategy is external to the Document class so that class...
Dockable text window containing checklist guide.
Class to create help window for MainWindow class.
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
GraphicsView & view()
View for the QImage and QGraphicsItems, without const.
Dialog for editing filtering settings.
Container for all graph curves. The axes point curve is external to this class.
Model for DlgSettingsColorFilter and CmdSettingsColorFilter.
Wrapper around QStatusBar to manage permanent widgets.
GraphicsScene & scene()
Scene container for the QImage and QGraphicsItems.
void updateSettingsGridDisplay(const DocumentModelGridDisplay &modelGridDisplay)
Update with new grid display properties.
void updateSettingsCurveStyles(const CurveStyles &modelCurveStyles)
Update with new curve styles.
Client for interacting with Engauge server.
Context class that manages the background image state machine.
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...
Container for all DigitizeStateAbstractBase subclasses. This functions as the context class in a stan...
Model for DlgSettingsMainWindow.
Container class for GridLine objects.
Dialog for editing general settings.
void signalDropRegression(QString)
Send drag and drop regression test url.
Model for DlgSettingsCoords and CmdSettingsCoords.
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.
Dialog for editing grid display settings.
Dialog for editing DigitizeStateCurve settings.
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.
QImage imageFiltered() const
Background image that has been filtered for the current curve. This asserts if a curve-specific image...
void updateSettingsGridRemoval(const DocumentModelGridRemoval &modelGridRemoval)
Update with new grid removal properties.
Class that displays a view of the current Curve's point style.
Dialog for editing main window settings, which are entirely independent of all documents.
Model for DlgSettingsAxesChecker and CmdSettingsAxesChecker.
Command stack that shadows the CmdMediator command stack at startup when reading commands from an err...
void updateSettingsExportFormat(const DocumentModelExportFormat &modelExport)
Update with new export properties.
Dialog for editing coordinates settings.
Load QImage from url. This is trivial for a file, but requires an asynchronous download step for http...
virtual bool eventFilter(QObject *, QEvent *)
Catch secret keypresses.
bool isGnuplot() const
Get method for gnuplot flag.
Dialog for editing curve properties settings.
void signalZoom(int)
Send zoom selection, picked from menu or keystroke, to StatusBar.
Model for DlgSettingsSegments and CmdSettingsSegments.
void cmdFileImport(const QString &fileName)
Import file. This is called from a file script command.
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.
File that manages a command stack for regression testing of file import/open/export/close.
Add point and line handling to generic QGraphicsScene.
Window that displays curve fitting as applied to the currently selected curve.
Model for DlgSettingsGridRemoval and CmdSettingsGridRemoval. The settings are unstable until the user...
Class to create CmdStackShadow for MainWindow class.
void updateSettingsSegments(const DocumentModelSegments &modelSegments)
Update with new segments properties.
Dialog for editing curve names settings.
Dialog for editing axes checker settings.
void updateGraphicsLinesToMatchGraphicsPoints()
Update the graphics lines so they follow the graphics points, after a drag, addition, removal, and such.
Class to create network for MainWindow class.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
MainWindowModel modelMainWindow() const
Get method for main window model.
Class to create icons for MainWindow class.
virtual void showEvent(QShowEvent *)
Processing performed after gui becomes available.
bool transformIsDefined() const
Return true if all three axis points have been defined.
void updateSettingsCurveList(const CurvesGraphs &curvesGraphs)
Update with new curves.