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;
103 const QString &fileCmdScriptFile,
104 bool isRegressionTest,
107 QStringList loadStartupFiles,
108 QWidget *parent = 0);
148 const char *context)
const;
237 void slotBtnPrintAll();
238 void slotBtnShowAllPressed();
239 void slotBtnShowAllReleased();
240 void slotCanRedoChanged (
bool);
241 void slotCanUndoChanged (
bool);
242 void slotChecklistClosed ();
243 void slotCleanChanged (
bool);
244 void slotCmbBackground(
int);
245 void slotCmbCoordSystem(
int);
246 void slotCmbCurve(
int);
247 void slotContextMenuEventAxis (QString);
248 void slotContextMenuEventGraph (QStringList);
249 void slotDigitizeAxis ();
250 void slotDigitizeColorPicker ();
251 void slotDigitizeCurve ();
252 void slotDigitizePointMatch ();
253 void slotDigitizeScale ();
254 void slotDigitizeSegment ();
255 void slotDigitizeSelect ();
256 void slotEditCopy ();
258 void slotEditDelete ();
259 void slotEditMenu ();
260 void slotEditPaste ();
261 void slotEditPasteAsNew ();
262 void slotEditPasteAsNewAdvanced ();
263 void slotFileClose ();
264 void slotFileExport ();
265 void slotFileImport();
266 void slotFileImportAdvanced();
267 void slotFileImportDraggedImage(QImage);
268 void slotFileImportDraggedImageUrl(QUrl);
269 void slotFileImportImage(QString, QImage);
270 void slotFileImportImageReplace();
272 void slotFileOpenDraggedDigFile (QString);
273 void slotFilePrint();
275 bool slotFileSaveAs();
276 void slotFittingWindowClosed();
277 void slotFittingWindowCurveFit(FittingCurveCoefficients,
double,
double,
bool,
bool);
278 void slotGeometryWindowClosed();
279 void slotHelpAbout();
280 void slotHelpTutorial();
281 void slotKeyPress (Qt::Key,
bool);
282 void slotLoadStartupFiles ();
283 void slotMouseMove (QPointF);
284 void slotMousePress (QPointF);
285 void slotMouseRelease (QPointF);
286 void slotRecentFileAction ();
287 void slotRecentFileClear ();
288 void slotRedoTextChanged (
const QString &);
289 void slotSettingsAxesChecker ();
290 void slotSettingsColorFilter ();
291 void slotSettingsCoords ();
292 void slotSettingsCurveAddRemove ();
293 void slotSettingsCurveProperties ();
294 void slotSettingsDigitizeCurve ();
295 void slotSettingsExportFormat ();
296 void slotSettingsGeneral ();
297 void slotSettingsGridDisplay ();
298 void slotSettingsGridRemoval ();
299 void slotSettingsMainWindow ();
300 void slotSettingsPointMatch ();
301 void slotSettingsSegments ();
302 void slotTableStatusChange ();
303 void slotTimeoutRegressionErrorReport ();
304 void slotTimeoutRegressionFileCmdScript ();
305 void slotUndoTextChanged (
const QString &);
306 void slotViewGridLines ();
307 void slotViewGroupBackground(QAction*);
308 void slotViewGroupCurves(QAction*);
309 void slotViewGroupStatus(QAction*);
310 void slotViewToolBarBackground ();
311 void slotViewToolBarChecklistGuide ();
312 void slotViewToolBarCoordSystem ();
313 void slotViewToolBarDigitize ();
314 void slotViewToolBarFittingWindow ();
315 void slotViewToolBarGeometryWindow ();
316 void slotViewToolBarSettingsViews ();
317 void slotViewToolTips ();
318 void slotViewZoomFactor (ZoomFactor);
319 void slotViewZoomFactorInt (
int);
320 void slotViewZoom (
int);
321 void slotViewZoomIn ();
322 void slotViewZoomInFromWheelEvent ();
323 void slotViewZoomOut ();
324 void slotViewZoomOutFromWheelEvent ();
335 IMPORT_TYPE_ADVANCED,
336 IMPORT_TYPE_IMAGE_REPLACE
339 void addDockWindow (QDockWidget *dockWidget,
341 const QString &settingsTokenArea,
342 const QString &settingsTokenGeometry,
343 Qt::DockWidgetArea dockWidgetArea);
344 void applyZoomFactorAfterLoad();
345 virtual void closeEvent(QCloseEvent *event);
346 void createActions();
347 void createActionsDigitize ();
348 void createActionsEdit ();
349 void createActionsFile ();
350 void createActionsHelp ();
351 void createActionsSettings ();
352 void createActionsView ();
353 void createCentralWidget ();
354 void createCommandStackShadow ();
355 void createDockableWidgets ();
356 void createHelpWindow ();
358 void createLoadImageFromUrl ();
360 void createNetwork();
362 void createSettingsDialogs ();
363 void createStateContextBackground();
364 void createStateContextDigitize();
365 void createStateContextTransformation();
366 void createStatusBar();
367 void createToolBars();
368 void createTutorial();
369 void createZoomMaps ();
370 ZoomFactor currentZoomFactor ()
const;
371 #if !defined(OSX_DEBUG) && !defined(OSX_RELEASE) 372 void exportAllCoordinateSystemsAfterRegressionTests();
374 QString exportFilenameFromInputFilename (
const QString &fileName)
const;
375 void fileExport(
const QString &fileName,
377 void fileImport (
const QString &fileName,
378 ImportType ImportType);
379 void fileImportWithPrompts (ImportType ImportType);
380 void filePaste (ImportType importType);
381 void ghostsCreate ();
382 void ghostsDestroy ();
383 void loadCoordSystemListFromCmdMediator();
384 void loadCurveListFromCmdMediator();
385 void loadDocumentFile (
const QString &fileName);
386 void loadErrorReportFile(
const QString &errorReportFile);
387 bool loadImage (
const QString &fileName,
389 ImportType ImportType);
390 bool loadImageNewDocument (
const QString &fileName,
392 ImportType ImportType);
393 bool loadImageReplacingImage (
const QString &fileName,
395 ImportType ImportType);
396 void loadInputFileForErrorReport(QDomDocument &domInputFile)
const;
397 void loadToolTips ();
401 const QString &selectedNameFilter)
const;
402 bool modeGraph ()
const;
403 void rebuildRecentFileListForCurrentFile(
const QString &filePath);
404 bool saveDocumentFile(
const QString &fileName);
405 QString saveErrorReportFileAndExitXml (
const char *comment,
408 const char *context)
const;
409 void saveStartingDocumentSnapshot();
410 void setCurrentFile(
const QString &fileName);
411 void setCurrentPathFromFile (
const QString &fileName);
412 void setNonFillZoomFactor (ZoomFactor newZoomFactor);
413 void setPixmap (
const QString &curveSelected,
414 const QPixmap &pixmap);
415 void settingsRead (
bool isReset);
416 void settingsReadEnvironment (QSettings &settings);
417 void settingsReadMainWindow (QSettings &settings);
418 void settingsWrite ();
419 bool setupAfterLoadNewDocument (
const QString &fileName,
420 const QString &temporaryMessage,
421 ImportType ImportType);
422 bool setupAfterLoadReplacingImage (
const QString &fileName,
423 const QString &temporaryMessage,
424 ImportType ImportType);
425 void startRegressionTestErrorReport (
const QString ®ressionInputFile);
426 void startRegressionTestFileCmdScript ();
427 void updateAfterCommandStatusBarCoords ();
428 void updateChecklistGuide ();
429 void updateControls ();
430 void updateFittingWindow ();
431 void updateGeometryWindow ();
432 void updateGridLines();
433 void updateHighlightOpacity();
434 void updateRecentFileList();
435 void updateSettingsMainWindow();
436 void updateSmallDialogs();
437 void updateTransformationAndItsDependencies();
438 void updateViewedCurves ();
439 void updateViewsOfSettings ();
440 void updateWindowTitle ();
441 void writeCheckpointToLogFile();
443 QString m_originalFile;
444 bool m_originalFileWasImported;
445 bool m_isDocumentExported;
446 QString m_engaugeFile;
447 QString m_currentFile;
448 QString m_currentFileWithPathAndFileExtension;
449 MainTitleBarFormat m_titleBarFormat;
452 QAction *m_actionImport;
453 QAction *m_actionImportAdvanced;
454 QAction *m_actionImportImageReplace;
455 QAction *m_actionOpen;
456 QMenu *m_menuFileOpenRecent;
457 QList<QAction*> m_actionRecentFiles;
458 QAction *m_actionClose;
459 QAction *m_actionSave;
460 QAction *m_actionSaveAs;
461 QAction *m_actionExport;
462 QAction *m_actionPrint;
463 QAction *m_actionExit;
466 QAction *m_actionEditUndo;
467 QAction *m_actionEditRedo;
468 QAction *m_actionEditCut;
469 QAction *m_actionEditCopy;
470 QAction *m_actionEditPaste;
471 QAction *m_actionEditDelete;
472 QAction *m_actionEditPasteAsNew;
473 QAction *m_actionEditPasteAsNewAdvanced;
475 QMenu *m_menuDigitize;
476 QActionGroup *m_groupDigitize;
477 QAction *m_actionDigitizeSelect;
478 QAction *m_actionDigitizeAxis;
479 QAction *m_actionDigitizeScale;
480 QAction *m_actionDigitizeCurve;
481 QAction *m_actionDigitizePointMatch;
482 QAction *m_actionDigitizeColorPicker;
483 QAction *m_actionDigitizeSegment;
486 QAction *m_actionViewBackground;
487 QAction *m_actionViewChecklistGuide;
488 QAction *m_actionViewCoordSystem;
489 QAction *m_actionViewDigitize;
490 QAction *m_actionViewFittingWindow;
491 QAction *m_actionViewGeometryWindow;
492 QAction *m_actionViewSettingsViews;
493 QAction *m_actionViewToolTips;
494 QAction *m_actionViewGridLines;
495 QMenu *m_menuViewBackground;
496 QActionGroup *m_groupBackground;
497 QAction *m_actionViewBackgroundNone;
498 QAction *m_actionViewBackgroundOriginal;
499 QAction *m_actionViewBackgroundFiltered;
500 QMenu *m_menuViewCurves;
501 QActionGroup *m_groupCurves;
502 QAction *m_actionViewCurvesNone;
503 QAction *m_actionViewCurvesSelected;
504 QAction *m_actionViewCurvesAll;
505 QMenu *m_menuViewStatus;
506 QActionGroup *m_groupStatus;
507 QAction *m_actionStatusNever;
508 QAction *m_actionStatusTemporary;
509 QAction *m_actionStatusAlways;
510 QMenu *m_menuViewZoom;
511 QAction *m_actionZoomOut;
512 QAction *m_actionZoomIn;
513 QActionGroup *m_groupZoom;
514 QSignalMapper *m_mapperZoomFactor;
515 QAction *m_actionZoomFill;
516 QAction *m_actionZoom16To1;
517 QAction *m_actionZoom16To1Farther;
518 QAction *m_actionZoom8To1Closer;
519 QAction *m_actionZoom8To1;
520 QAction *m_actionZoom8To1Farther;
521 QAction *m_actionZoom4To1Closer;
522 QAction *m_actionZoom4To1;
523 QAction *m_actionZoom4To1Farther;
524 QAction *m_actionZoom2To1Closer;
525 QAction *m_actionZoom2To1;
526 QAction *m_actionZoom2To1Farther;
527 QAction *m_actionZoom1To1Closer;
528 QAction *m_actionZoom1To1;
529 QAction *m_actionZoom1To1Farther;
530 QAction *m_actionZoom1To2Closer;
531 QAction *m_actionZoom1To2;
532 QAction *m_actionZoom1To2Farther;
533 QAction *m_actionZoom1To4Closer;
534 QAction *m_actionZoom1To4;
535 QAction *m_actionZoom1To4Farther;
536 QAction *m_actionZoom1To8Closer;
537 QAction *m_actionZoom1To8;
538 QAction *m_actionZoom1To8Farther;
539 QAction *m_actionZoom1To16Closer;
540 QAction *m_actionZoom1To16;
542 QMenu *m_menuSettings;
543 QAction *m_actionSettingsAxesChecker;
544 QAction *m_actionSettingsColorFilter;
545 QAction *m_actionSettingsCoords;
546 QAction *m_actionSettingsCurveAddRemove;
547 QAction *m_actionSettingsCurveProperties;
548 QAction *m_actionSettingsDigitizeCurve;
549 QAction *m_actionSettingsExport;
550 QAction *m_actionSettingsGeneral;
551 QAction *m_actionSettingsGridDisplay;
552 QAction *m_actionSettingsGridRemoval;
553 QAction *m_actionSettingsMainWindow;
554 QAction *m_actionSettingsPointMatch;
555 QAction *m_actionSettingsSegments;
558 QAction *m_actionHelpAbout;
559 QAction *m_actionHelpChecklistGuideWizard;
560 QAction *m_actionHelpHelp;
561 QAction *m_actionHelpTutorial;
562 QAction *m_actionHelpWhatsThis;
564 QVBoxLayout *m_layout;
571 QComboBox *m_cmbCurve;
572 QToolBar *m_toolDigitize;
575 QComboBox *m_cmbBackground;
576 QToolBar *m_toolBackground;
580 QToolBar *m_toolSettingsViews;
585 QComboBox *m_cmbCoordSystem;
586 QPushButton *m_btnPrintAll;
587 QPushButton *m_btnShowAll;
588 QToolBar *m_toolCoordSystem;
590 #if !defined(OSX_DEBUG) && !defined(OSX_RELEASE) 622 QString m_startingDocumentSnapshot;
630 QTimer *m_timerLoadStartupFiles;
631 QStringList m_loadStartupFiles;
639 QTimer *m_timerRegressionErrorReport;
641 bool m_isErrorReportRegressionTest;
642 QTimer *m_timerRegressionFileCmdScript;
643 QString m_regressionFile;
644 QString m_startupDirectory;
652 QMap<ZoomFactorInitial, ZoomFactor> m_zoomMapFromInitial;
653 QMap<ZoomFactor, QAction*> m_zoomMapToAction;
659 #endif // MAIN_WINDOW_H 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.
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 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.
Context class for transformation state machine.
Model for DlgSettingsCurveProperties and CmdSettingsCurveProperties.
void updateSettingsCurveAddRemove(const CurvesGraphs &curvesGraphs)
Update with new curves.
void updateAfterMouseRelease()
Call MainWindow::updateControls (which is private) after the very specific case - a mouse press/relea...
void cmdFileClose()
Close file. This is called from a file script command.
void updateViewsOfSettings(const QString &activeCurve)
Update curve-specific view of settings. Private version gets active curve name from DigitizeStateCont...
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.
BackgroundImage selectOriginal(BackgroundImage backgroundImage)
Make original background visible, for DigitizeStateColorPicker.
Dialog for editing grid removal settings.
Transformation transformation() const
Return read-only copy of transformation.
void showTemporaryMessage(const QString &temporaryMessage)
Show temporary message in status bar.
Dialog for editing curve names settings.
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.
Strategy class for exporting to a file. This strategy is external to the Document class so that class...
Dockable text window containing checklist guide.
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
GraphicsView & view()
View for the QImage and QGraphicsItems, without const.
void saveErrorReportFileAndExit(const char *comment, const char *file, int line, const char *context) const
Save error report and exit.
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.
bool transformIsDefined() const
Return true if all three axis points have been defined.
Context class that manages the background image state machine.
QGraphicsView class with event handling added. Typically the events are sent to the active digitizing...
bool isGnuplot() const
Get method for gnuplot flag.
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.
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.
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.
MainWindowModel modelMainWindow() const
Get method for main window model.
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.
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.
QString selectedGraphCurve() const
Curve name that is currently selected in m_cmbCurve.
Window that displays curve fitting as applied to the currently selected curve.
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.
void updateSettingsSegments(const DocumentModelSegments &modelSegments)
Update with new segments properties.
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.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
virtual void showEvent(QShowEvent *)
Processing performed after gui becomes available.