10 #include "BackgroundImage.h"
11 #include "CoordSystemIndex.h"
12 #include "DigitizeStateAbstractBase.h"
13 #include "DocumentAxesPointsRequired.h"
14 #include "GridLines.h"
15 #include "MainWindowModel.h"
17 #include <QMainWindow>
20 #include "Transformation.h"
21 #include "ZoomControl.h"
22 #include "ZoomFactor.h"
23 #include "ZoomFactorInitial.h"
67 class QGraphicsLineItem;
95 const QString &fileCmdScriptFile,
96 bool isRegressionTest,
98 QStringList loadStartupFiles,
136 const char *context)
const;
225 void slotBtnPrintAll();
226 void slotBtnShowAllPressed();
227 void slotBtnShowAllReleased();
228 void slotCanRedoChanged (
bool);
229 void slotCanUndoChanged (
bool);
230 void slotChecklistClosed ();
231 void slotCleanChanged (
bool);
232 void slotCmbBackground(
int);
233 void slotCmbCoordSystem(
int);
234 void slotCmbCurve(
int);
235 void slotContextMenuEvent (QString);
236 void slotDigitizeAxis ();
237 void slotDigitizeColorPicker ();
238 void slotDigitizeCurve ();
239 void slotDigitizePointMatch ();
240 void slotDigitizeSegment ();
241 void slotDigitizeSelect ();
242 void slotEditCopy ();
244 void slotEditDelete ();
245 void slotEditMenu ();
246 void slotEditPaste ();
247 void slotEditPasteAsNew ();
248 void slotEditPasteAsNewAdvanced ();
249 void slotFileClose ();
250 void slotFileExport ();
251 void slotFileImport();
252 void slotFileImportAdvanced();
253 void slotFileImportDraggedImage(QImage);
254 void slotFileImportDraggedImageUrl(QUrl);
255 void slotFileImportImage(QString, QImage);
257 void slotFileOpenDraggedDigFile (QString);
258 void slotFilePrint();
260 bool slotFileSaveAs();
261 void slotHelpAbout();
262 void slotHelpTutorial();
263 void slotKeyPress (Qt::Key,
bool);
265 void slotLoadStartupFiles ();
266 void slotMouseMove (QPointF);
267 void slotMousePress (QPointF);
268 void slotMouseRelease (QPointF);
269 void slotRecentFileAction ();
270 void slotRecentFileClear ();
271 void slotRedoTextChanged (
const QString &);
272 void slotSetOverrideCursor (QCursor);
273 void slotSettingsAxesChecker ();
274 void slotSettingsColorFilter ();
275 void slotSettingsCoords ();
276 void slotSettingsCurveAddRemove ();
277 void slotSettingsCurveProperties ();
278 void slotSettingsDigitizeCurve ();
279 void slotSettingsExportFormat ();
280 void slotSettingsGeneral ();
281 void slotSettingsGridDisplay ();
282 void slotSettingsGridRemoval ();
283 void slotSettingsMainWindow ();
284 void slotSettingsPointMatch ();
285 void slotSettingsSegments ();
286 void slotTimeoutRegressionErrorReport ();
287 void slotTimeoutRegressionFileCmdScript ();
288 void slotUndoTextChanged (
const QString &);
289 void slotViewGridLines ();
290 void slotViewGroupBackground(QAction*);
291 void slotViewGroupCurves(QAction*);
292 void slotViewGroupStatus(QAction*);
293 void slotViewToolBarBackground ();
294 void slotViewToolBarChecklistGuide ();
295 void slotViewToolBarCoordSystem ();
296 void slotViewToolBarDigitize ();
297 void slotViewToolBarSettingsViews ();
298 void slotViewToolTips ();
299 void slotViewZoom16To1 ();
300 void slotViewZoom8To1 ();
301 void slotViewZoom4To1 ();
302 void slotViewZoom2To1 ();
303 void slotViewZoom1To1 ();
304 void slotViewZoom1To2 ();
305 void slotViewZoom1To4 ();
306 void slotViewZoom1To8 ();
307 void slotViewZoom1To16 ();
308 void slotViewZoom (
int);
309 void slotViewZoomFill ();
310 void slotViewZoomIn ();
311 void slotViewZoomInFromWheelEvent ();
312 void slotViewZoomOut ();
313 void slotViewZoomOutFromWheelEvent ();
327 void applyZoomFactorAfterLoad();
328 virtual void closeEvent(QCloseEvent *event);
329 void createActions();
330 void createActionsDigitize ();
331 void createActionsEdit ();
332 void createActionsFile ();
333 void createActionsHelp ();
334 void createActionsSettings ();
335 void createActionsView ();
336 void createCentralWidget ();
337 void createCommandStackShadow ();
338 void createHelpWindow ();
340 void createLoadImageFromUrl ();
342 void createNetwork();
344 void createSettingsDialogs ();
345 void createStateContextBackground();
346 void createStateContextDigitize();
347 void createStateContextTransformation();
348 void createStatusBar();
349 void createToolBars();
350 void createTutorial();
351 void createZoomMap ();
352 ZoomFactor currentZoomFactor ()
const;
354 void exportAllCoordinateSystems();
356 QString exportFilenameFromInputFilename (
const QString &fileName)
const;
357 void fileExport(
const QString &fileName,
359 void fileImport (
const QString &fileName,
360 ImportType ImportType);
361 void fileImportWithPrompts (ImportType ImportType);
362 void filePaste (ImportType importType);
363 void ghostsCreate ();
364 void ghostsDestroy ();
365 void loadCoordSystemListFromCmdMediator();
366 void loadCurveListFromCmdMediator();
367 void loadDocumentFile (
const QString &fileName);
368 void loadErrorReportFile(
const QString &initialPath,
369 const QString &errorReportFile);
370 bool loadImage (
const QString &fileName,
372 ImportType ImportType);
373 void loadInputFileForErrorReport(QDomDocument &domInputFile)
const;
374 void loadToolTips ();
378 const QString &selectedNameFilter)
const;
379 void rebuildRecentFileListForCurrentFile(
const QString &filePath);
380 bool saveDocumentFile(
const QString &fileName);
381 QString saveErrorReportFileAndExitXml (
const char *comment,
384 const char *context)
const;
385 void saveStartingDocumentSnapshot();
386 void setCurrentFile(
const QString &fileName);
387 void setCurrentPathFromFile (
const QString &fileName);
388 void setPixmap (
const QPixmap &pixmap);
389 void settingsRead ();
390 void settingsReadEnvironment (QSettings &settings);
391 void settingsReadMainWindow (QSettings &settings);
392 void settingsWrite ();
393 bool setupAfterLoad (
const QString &fileName,
394 const QString &temporaryMessage,
395 ImportType ImportType);
396 void startRegressionTestErrorReport (
const QString &initialPath,
397 const QString ®ressionInputFile);
398 void startRegressionTestFileCmdScript ();
399 void updateAfterCommandStatusBarCoords ();
400 void updateControls ();
401 void updateGridLines();
402 void updateRecentFileList();
403 void updateSettingsMainWindow();
404 void updateTransformationAndItsDependencies();
405 void updateViewedCurves ();
406 void updateViewsOfSettings ();
407 void updateWindowTitle ();
408 void writeCheckpointToLogFile();
410 QString m_originalFile;
411 bool m_originalFileWasImported;
412 bool m_isDocumentExported;
413 QString m_engaugeFile;
414 QString m_currentFile;
415 QString m_currentFileWithPathAndFileExtension;
416 MainTitleBarFormat m_titleBarFormat;
419 QAction *m_actionImport;
420 QAction *m_actionImportAdvanced;
421 QAction *m_actionOpen;
422 QMenu *m_menuFileOpenRecent;
423 QList<QAction*> m_actionRecentFiles;
424 QAction *m_actionClose;
425 QAction *m_actionSave;
426 QAction *m_actionSaveAs;
427 QAction *m_actionExport;
428 QAction *m_actionPrint;
429 QAction *m_actionExit;
432 QAction *m_actionEditUndo;
433 QAction *m_actionEditRedo;
434 QAction *m_actionEditCut;
435 QAction *m_actionEditCopy;
436 QAction *m_actionEditPaste;
437 QAction *m_actionEditDelete;
438 QAction *m_actionEditPasteAsNew;
439 QAction *m_actionEditPasteAsNewAdvanced;
441 QMenu *m_menuDigitize;
442 QActionGroup *m_groupDigitize;
443 QAction *m_actionDigitizeSelect;
444 QAction *m_actionDigitizeAxis;
445 QAction *m_actionDigitizeCurve;
446 QAction *m_actionDigitizePointMatch;
447 QAction *m_actionDigitizeColorPicker;
448 QAction *m_actionDigitizeSegment;
451 QAction *m_actionViewBackground;
452 QAction *m_actionViewChecklistGuide;
453 QAction *m_actionViewCoordSystem;
454 QAction *m_actionViewDigitize;
455 QAction *m_actionViewSettingsViews;
456 QAction *m_actionViewToolTips;
457 QAction *m_actionViewGridLines;
458 QMenu *m_menuViewBackground;
459 QActionGroup *m_groupBackground;
460 QAction *m_actionViewBackgroundNone;
461 QAction *m_actionViewBackgroundOriginal;
462 QAction *m_actionViewBackgroundFiltered;
463 QMenu *m_menuViewCurves;
464 QActionGroup *m_groupCurves;
465 QAction *m_actionViewCurvesNone;
466 QAction *m_actionViewCurvesSelected;
467 QAction *m_actionViewCurvesAll;
468 QMenu *m_menuViewStatus;
469 QActionGroup *m_groupStatus;
470 QAction *m_actionStatusNever;
471 QAction *m_actionStatusTemporary;
472 QAction *m_actionStatusAlways;
473 QMenu *m_menuViewZoom;
474 QAction *m_actionZoomOut;
475 QAction *m_actionZoomIn;
476 QActionGroup *m_groupZoom;
477 QAction *m_actionZoomFill;
478 QAction *m_actionZoom16To1;
479 QAction *m_actionZoom8To1;
480 QAction *m_actionZoom4To1;
481 QAction *m_actionZoom2To1;
482 QAction *m_actionZoom1To1;
483 QAction *m_actionZoom1To2;
484 QAction *m_actionZoom1To4;
485 QAction *m_actionZoom1To8;
486 QAction *m_actionZoom1To16;
488 QMenu *m_menuSettings;
489 QAction *m_actionSettingsAxesChecker;
490 QAction *m_actionSettingsColorFilter;
491 QAction *m_actionSettingsCoords;
492 QAction *m_actionSettingsCurveAddRemove;
493 QAction *m_actionSettingsCurveProperties;
494 QAction *m_actionSettingsDigitizeCurve;
495 QAction *m_actionSettingsExport;
496 QAction *m_actionSettingsGeneral;
497 QAction *m_actionSettingsGridDisplay;
498 QAction *m_actionSettingsGridRemoval;
499 QAction *m_actionSettingsMainWindow;
500 QAction *m_actionSettingsPointMatch;
501 QAction *m_actionSettingsSegments;
504 QAction *m_actionHelpAbout;
505 QAction *m_actionHelpChecklistGuideWizard;
506 QAction *m_actionHelpHelp;
507 QAction *m_actionHelpTutorial;
508 QAction *m_actionHelpWhatsThis;
510 QVBoxLayout *m_layout;
517 QComboBox *m_cmbCurve;
518 QToolBar *m_toolDigitize;
521 QComboBox *m_cmbBackground;
522 QToolBar *m_toolBackground;
526 QToolBar *m_toolSettingsViews;
529 QComboBox *m_cmbCoordSystem;
530 QPushButton *m_btnPrintAll;
531 QPushButton *m_btnShowAll;
532 QToolBar *m_toolCoordSystem;
564 QString m_startingDocumentSnapshot;
572 QTimer *m_timerLoadStartupFiles;
573 QStringList m_loadStartupFiles;
581 QTimer *m_timerRegressionErrorReport;
583 bool m_isRegressionTest;
584 QTimer *m_timerRegressionFileCmdScript;
585 QString m_regressionFile;
591 QMap<ZoomFactorInitial, ZoomFactor> m_zoomMap;
594 #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 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 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...
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...
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.
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.
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.
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.
Model for DlgSettingsCoords and CmdSettingsCoords.
void updateAfterCommand()
See GraphicsScene::updateAfterCommand.
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 saveErrorReportFileAndExit(const char *comment, const char *file, int line, const char *context) const
Save error report and exit.
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.
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...
MainWindowModel modelMainWindow() const
Get method for main window model.
virtual void showEvent(QShowEvent *)
Processing performed after gui becomes available.
bool transformIsDefined() const
Return true if all three axis points have been defined.