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);
145 const char *context)
const;
234 void slotBtnPrintAll();
235 void slotBtnShowAllPressed();
236 void slotBtnShowAllReleased();
237 void slotCanRedoChanged (
bool);
238 void slotCanUndoChanged (
bool);
239 void slotChecklistClosed ();
240 void slotCleanChanged (
bool);
241 void slotCmbBackground(
int);
242 void slotCmbCoordSystem(
int);
243 void slotCmbCurve(
int);
244 void slotContextMenuEventAxis (QString);
245 void slotContextMenuEventGraph (QStringList);
246 void slotDigitizeAxis ();
247 void slotDigitizeColorPicker ();
248 void slotDigitizeCurve ();
249 void slotDigitizePointMatch ();
250 void slotDigitizeScale ();
251 void slotDigitizeSegment ();
252 void slotDigitizeSelect ();
253 void slotEditCopy ();
255 void slotEditDelete ();
256 void slotEditMenu ();
257 void slotEditPaste ();
258 void slotEditPasteAsNew ();
259 void slotEditPasteAsNewAdvanced ();
260 void slotFileClose ();
261 void slotFileExport ();
262 void slotFileImport();
263 void slotFileImportAdvanced();
264 void slotFileImportDraggedImage(QImage);
265 void slotFileImportDraggedImageUrl(QUrl);
266 void slotFileImportImage(QString, QImage);
267 void slotFileImportImageReplace();
269 void slotFileOpenDraggedDigFile (QString);
270 void slotFilePrint();
272 bool slotFileSaveAs();
273 void slotFittingWindowClosed();
274 void slotFittingWindowCurveFit(FittingCurveCoefficients,
double,
double,
bool,
bool);
275 void slotGeometryWindowClosed();
276 void slotHelpAbout();
277 void slotHelpTutorial();
278 void slotKeyPress (Qt::Key,
bool);
279 void slotLoadStartupFiles ();
280 void slotMouseMove (QPointF);
281 void slotMousePress (QPointF);
282 void slotMouseRelease (QPointF);
283 void slotRecentFileAction ();
284 void slotRecentFileClear ();
285 void slotRedoTextChanged (
const QString &);
286 void slotSettingsAxesChecker ();
287 void slotSettingsColorFilter ();
288 void slotSettingsCoords ();
289 void slotSettingsCurveAddRemove ();
290 void slotSettingsCurveProperties ();
291 void slotSettingsDigitizeCurve ();
292 void slotSettingsExportFormat ();
293 void slotSettingsGeneral ();
294 void slotSettingsGridDisplay ();
295 void slotSettingsGridRemoval ();
296 void slotSettingsMainWindow ();
297 void slotSettingsPointMatch ();
298 void slotSettingsSegments ();
299 void slotTableStatusChange ();
300 void slotTimeoutRegressionErrorReport ();
301 void slotTimeoutRegressionFileCmdScript ();
302 void slotUndoTextChanged (
const QString &);
303 void slotViewGridLines ();
304 void slotViewGroupBackground(QAction*);
305 void slotViewGroupCurves(QAction*);
306 void slotViewGroupStatus(QAction*);
307 void slotViewToolBarBackground ();
308 void slotViewToolBarChecklistGuide ();
309 void slotViewToolBarCoordSystem ();
310 void slotViewToolBarDigitize ();
311 void slotViewToolBarFittingWindow ();
312 void slotViewToolBarGeometryWindow ();
313 void slotViewToolBarSettingsViews ();
314 void slotViewToolTips ();
315 void slotViewZoomFactor (ZoomFactor);
316 void slotViewZoomFactorInt (
int);
317 void slotViewZoom (
int);
318 void slotViewZoomIn ();
319 void slotViewZoomInFromWheelEvent ();
320 void slotViewZoomOut ();
321 void slotViewZoomOutFromWheelEvent ();
332 IMPORT_TYPE_ADVANCED,
333 IMPORT_TYPE_IMAGE_REPLACE
336 void addDockWindow (QDockWidget *dockWidget,
338 const QString &settingsTokenArea,
339 const QString &settingsTokenGeometry,
340 Qt::DockWidgetArea dockWidgetArea);
341 void applyZoomFactorAfterLoad();
342 virtual void closeEvent(QCloseEvent *event);
343 void createActions();
344 void createActionsDigitize ();
345 void createActionsEdit ();
346 void createActionsFile ();
347 void createActionsHelp ();
348 void createActionsSettings ();
349 void createActionsView ();
350 void createCentralWidget ();
351 void createCommandStackShadow ();
352 void createDockableWidgets ();
353 void createHelpWindow ();
355 void createLoadImageFromUrl ();
357 void createNetwork();
359 void createSettingsDialogs ();
360 void createStateContextBackground();
361 void createStateContextDigitize();
362 void createStateContextTransformation();
363 void createStatusBar();
364 void createToolBars();
365 void createTutorial();
366 void createZoomMaps ();
367 ZoomFactor currentZoomFactor ()
const;
368 #if !defined(OSX_DEBUG) && !defined(OSX_RELEASE) 369 void exportAllCoordinateSystemsAfterRegressionTests();
371 QString exportFilenameFromInputFilename (
const QString &fileName)
const;
372 void fileExport(
const QString &fileName,
374 void fileImport (
const QString &fileName,
375 ImportType ImportType);
376 void fileImportWithPrompts (ImportType ImportType);
377 void filePaste (ImportType importType);
378 void ghostsCreate ();
379 void ghostsDestroy ();
380 void loadCoordSystemListFromCmdMediator();
381 void loadCurveListFromCmdMediator();
382 void loadDocumentFile (
const QString &fileName);
383 void loadErrorReportFile(
const QString &errorReportFile);
384 bool loadImage (
const QString &fileName,
386 ImportType ImportType);
387 bool loadImageNewDocument (
const QString &fileName,
389 ImportType ImportType);
390 bool loadImageReplacingImage (
const QString &fileName,
392 ImportType ImportType);
393 void loadInputFileForErrorReport(QDomDocument &domInputFile)
const;
394 void loadToolTips ();
398 const QString &selectedNameFilter)
const;
399 bool modeGraph ()
const;
400 bool modeMap ()
const;
401 void rebuildRecentFileListForCurrentFile(
const QString &filePath);
402 bool saveDocumentFile(
const QString &fileName);
403 QString saveErrorReportFileAndExitXml (
const char *comment,
406 const char *context)
const;
407 void saveStartingDocumentSnapshot();
408 void setCurrentFile(
const QString &fileName);
409 void setCurrentPathFromFile (
const QString &fileName);
410 void setNonFillZoomFactor (ZoomFactor newZoomFactor);
411 void setPixmap (
const QString &curveSelected,
412 const QPixmap &pixmap);
413 void settingsRead (
bool isReset);
414 void settingsReadEnvironment (QSettings &settings);
415 void settingsReadMainWindow (QSettings &settings);
416 void settingsWrite ();
417 bool setupAfterLoadNewDocument (
const QString &fileName,
418 const QString &temporaryMessage,
419 ImportType ImportType);
420 bool setupAfterLoadReplacingImage (
const QString &fileName,
421 const QString &temporaryMessage,
422 ImportType ImportType);
423 void startRegressionTestErrorReport (
const QString ®ressionInputFile);
424 void startRegressionTestFileCmdScript ();
425 void updateAfterCommandStatusBarCoords ();
426 void updateChecklistGuide ();
427 void updateControls ();
428 void updateFittingWindow ();
429 void updateGeometryWindow ();
430 void updateGridLines();
431 void updateHighlightOpacity();
432 void updateRecentFileList();
433 void updateSettingsMainWindow();
434 void updateSmallDialogs();
435 void updateTransformationAndItsDependencies();
436 void updateViewedCurves ();
437 void updateViewsOfSettings ();
438 void updateWindowTitle ();
439 void writeCheckpointToLogFile();
441 QString m_originalFile;
442 bool m_originalFileWasImported;
443 bool m_isDocumentExported;
444 QString m_engaugeFile;
445 QString m_currentFile;
446 QString m_currentFileWithPathAndFileExtension;
447 MainTitleBarFormat m_titleBarFormat;
450 QAction *m_actionImport;
451 QAction *m_actionImportAdvanced;
452 QAction *m_actionImportImageReplace;
453 QAction *m_actionOpen;
454 QMenu *m_menuFileOpenRecent;
455 QList<QAction*> m_actionRecentFiles;
456 QAction *m_actionClose;
457 QAction *m_actionSave;
458 QAction *m_actionSaveAs;
459 QAction *m_actionExport;
460 QAction *m_actionPrint;
461 QAction *m_actionExit;
464 QAction *m_actionEditUndo;
465 QAction *m_actionEditRedo;
466 QAction *m_actionEditCut;
467 QAction *m_actionEditCopy;
468 QAction *m_actionEditPaste;
469 QAction *m_actionEditDelete;
470 QAction *m_actionEditPasteAsNew;
471 QAction *m_actionEditPasteAsNewAdvanced;
473 QMenu *m_menuDigitize;
474 QActionGroup *m_groupDigitize;
475 QAction *m_actionDigitizeSelect;
476 QAction *m_actionDigitizeAxis;
477 QAction *m_actionDigitizeScale;
478 QAction *m_actionDigitizeCurve;
479 QAction *m_actionDigitizePointMatch;
480 QAction *m_actionDigitizeColorPicker;
481 QAction *m_actionDigitizeSegment;
484 QAction *m_actionViewBackground;
485 QAction *m_actionViewChecklistGuide;
486 QAction *m_actionViewCoordSystem;
487 QAction *m_actionViewDigitize;
488 QAction *m_actionViewFittingWindow;
489 QAction *m_actionViewGeometryWindow;
490 QAction *m_actionViewSettingsViews;
491 QAction *m_actionViewToolTips;
492 QAction *m_actionViewGridLines;
493 QMenu *m_menuViewBackground;
494 QActionGroup *m_groupBackground;
495 QAction *m_actionViewBackgroundNone;
496 QAction *m_actionViewBackgroundOriginal;
497 QAction *m_actionViewBackgroundFiltered;
498 QMenu *m_menuViewCurves;
499 QActionGroup *m_groupCurves;
500 QAction *m_actionViewCurvesNone;
501 QAction *m_actionViewCurvesSelected;
502 QAction *m_actionViewCurvesAll;
503 QMenu *m_menuViewStatus;
504 QActionGroup *m_groupStatus;
505 QAction *m_actionStatusNever;
506 QAction *m_actionStatusTemporary;
507 QAction *m_actionStatusAlways;
508 QMenu *m_menuViewZoom;
509 QAction *m_actionZoomOut;
510 QAction *m_actionZoomIn;
511 QActionGroup *m_groupZoom;
512 QSignalMapper *m_mapperZoomFactor;
513 QAction *m_actionZoomFill;
514 QAction *m_actionZoom16To1;
515 QAction *m_actionZoom16To1Farther;
516 QAction *m_actionZoom8To1Closer;
517 QAction *m_actionZoom8To1;
518 QAction *m_actionZoom8To1Farther;
519 QAction *m_actionZoom4To1Closer;
520 QAction *m_actionZoom4To1;
521 QAction *m_actionZoom4To1Farther;
522 QAction *m_actionZoom2To1Closer;
523 QAction *m_actionZoom2To1;
524 QAction *m_actionZoom2To1Farther;
525 QAction *m_actionZoom1To1Closer;
526 QAction *m_actionZoom1To1;
527 QAction *m_actionZoom1To1Farther;
528 QAction *m_actionZoom1To2Closer;
529 QAction *m_actionZoom1To2;
530 QAction *m_actionZoom1To2Farther;
531 QAction *m_actionZoom1To4Closer;
532 QAction *m_actionZoom1To4;
533 QAction *m_actionZoom1To4Farther;
534 QAction *m_actionZoom1To8Closer;
535 QAction *m_actionZoom1To8;
536 QAction *m_actionZoom1To8Farther;
537 QAction *m_actionZoom1To16Closer;
538 QAction *m_actionZoom1To16;
540 QMenu *m_menuSettings;
541 QAction *m_actionSettingsAxesChecker;
542 QAction *m_actionSettingsColorFilter;
543 QAction *m_actionSettingsCoords;
544 QAction *m_actionSettingsCurveAddRemove;
545 QAction *m_actionSettingsCurveProperties;
546 QAction *m_actionSettingsDigitizeCurve;
547 QAction *m_actionSettingsExport;
548 QAction *m_actionSettingsGeneral;
549 QAction *m_actionSettingsGridDisplay;
550 QAction *m_actionSettingsGridRemoval;
551 QAction *m_actionSettingsMainWindow;
552 QAction *m_actionSettingsPointMatch;
553 QAction *m_actionSettingsSegments;
556 QAction *m_actionHelpAbout;
557 QAction *m_actionHelpChecklistGuideWizard;
558 QAction *m_actionHelpHelp;
559 QAction *m_actionHelpTutorial;
560 QAction *m_actionHelpWhatsThis;
562 QVBoxLayout *m_layout;
569 QComboBox *m_cmbCurve;
570 QToolBar *m_toolDigitize;
573 QComboBox *m_cmbBackground;
574 QToolBar *m_toolBackground;
578 QToolBar *m_toolSettingsViews;
583 QComboBox *m_cmbCoordSystem;
584 QPushButton *m_btnPrintAll;
585 QPushButton *m_btnShowAll;
586 QToolBar *m_toolCoordSystem;
588 #if !defined(OSX_DEBUG) && !defined(OSX_RELEASE) 620 QString m_startingDocumentSnapshot;
628 QTimer *m_timerLoadStartupFiles;
629 QStringList m_loadStartupFiles;
637 QTimer *m_timerRegressionErrorReport;
639 bool m_isErrorReportRegressionTest;
640 QTimer *m_timerRegressionFileCmdScript;
641 QString m_regressionFile;
642 QString m_startupDirectory;
650 QMap<ZoomFactorInitial, ZoomFactor> m_zoomMapFromInitial;
651 QMap<ZoomFactor, QAction*> m_zoomMapToAction;
657 #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...
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.