Engauge Digitizer 2
Loading...
Searching...
No Matches
Signals | Public Member Functions | Friends | List of all members
MainWindow Class Reference

Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document Interface. More...

#include <MainWindow.h>

Inheritance diagram for MainWindow:
Inheritance graph
Collaboration diagram for MainWindow:
Collaboration graph

Signals

void signalDropRegression (QString)
 Send drag and drop regression test url.
 
void signalZoom (int)
 Send zoom selection, picked from menu or keystroke, to StatusBar.
 

Public Member Functions

 MainWindow (const QString &errorReportFile, const QString &fileCmdScriptFile, bool isDropRegression, bool isRegressionTest, bool isGnuplot, bool isReset, bool isExportOnly, bool isExtractImageOnly, const QString &extractImageOnlyExtension, const QStringList &loadStartupFiles, const QStringList &commandLineWithoutLoadStartupFiles, QWidget *parent=nullptr)
 Single constructor.
 
 ~MainWindow ()
 
void cmdFileClose ()
 Close file. This is called from a file script command.
 
void cmdFileExport (const QString &fileName)
 Export file. This is called from a file script command.
 
void cmdFileImport (const QString &fileName)
 Import file. This is called from a file script command.
 
void cmdFileOpen (const QString &fileName)
 Open file. This is called from a file script command.
 
CmdMediatorcmdMediator ()
 Accessor for commands to process the Document.
 
virtual bool eventFilter (QObject *, QEvent *)
 Catch secret keypresses.
 
QImage imageFiltered () const
 Background image that has been filtered for the current curve. This asserts if a curve-specific image is not being shown.
 
bool isGnuplot () const
 Get method for gnuplot flag.
 
MainWindowModel modelMainWindow () const
 Get method for main window model.
 
bool modeMap () const
 True if document scale is set using a scale bar, otherwise using axis points.
 
void resizeEvent (QResizeEvent *event)
 Intercept resize event so graphics scene can be appropriately resized when in Fill mode.
 
void saveErrorReportFileAndExit (const char *comment, const char *file, int line, const char *context)
 Save error report and exit.
 
GraphicsScenescene ()
 Scene container for the QImage and QGraphicsItems.
 
BackgroundImage selectOriginal (BackgroundImage backgroundImage)
 Make original background visible, for DigitizeStateColorPicker.
 
QString selectedGraphCurve () const
 Curve name that is currently selected in m_cmbCurve.
 
virtual void showEvent (QShowEvent *)
 Processing performed after gui becomes available.
 
void showTemporaryMessage (const QString &temporaryMessage)
 Show temporary message in status bar.
 
Transformation transformation () const
 Return read-only copy of transformation.
 
bool transformIsDefined () const
 Return true if all three axis points have been defined.
 
void updateAfterCommand ()
 See GraphicsScene::updateAfterCommand.
 
void updateAfterMouseRelease ()
 Call MainWindow::updateControls (which is private) after the very specific case - a mouse press/release.
 
void updateCoordSystem (CoordSystemIndex coordSystemIndex)
 Select a different CoordSystem.
 
void updateDigitizeStateIfSoftwareTriggered (DigitizeState digitizeState)
 After software-triggered state transition, this method manually triggers the action as if user had clicked on digitize button.
 
void updateGraphicsLinesToMatchGraphicsPoints ()
 Update the graphics lines so they follow the graphics points, after a drag, addition, removal, and such.
 
void updateSettingsAxesChecker (const DocumentModelAxesChecker &modelAxesChecker)
 Update with new axes indicator properties.
 
void updateSettingsColorFilter (const DocumentModelColorFilter &modelColorFilter)
 Update with new color filter properties.
 
void updateSettingsCoords (const DocumentModelCoords &modelCoords)
 Update with new coordinate properties.
 
void updateSettingsCurveList (const CurvesGraphs &curvesGraphs)
 Update with new curves.
 
void updateSettingsCurveStyles (const CurveStyles &modelCurveStyles)
 Update with new curve styles.
 
void updateSettingsDigitizeCurve (const DocumentModelDigitizeCurve &modelDigitizeCurve)
 Update with new curve digitization styles.
 
void updateSettingsExportFormat (const DocumentModelExportFormat &modelExport)
 Update with new export properties.
 
void updateSettingsGeneral (const DocumentModelGeneral &modelGeneral)
 Update with new general properties.
 
void updateSettingsGridDisplay (const DocumentModelGridDisplay &modelGridDisplay)
 Update with new grid display properties.
 
void updateSettingsGridRemoval (const DocumentModelGridRemoval &modelGridRemoval)
 Update with new grid removal properties.
 
void updateSettingsMainWindow (const MainWindowModel &modelMainWindow)
 Update with new main window properties.
 
void updateSettingsPointMatch (const DocumentModelPointMatch &modelPointMatch)
 Update with new point match properties.
 
void updateSettingsSegments (const DocumentModelSegments &modelSegments)
 Update with new segments properties.
 
void updateViewsOfSettings (const QString &activeCurve)
 Update curve-specific view of settings. Private version gets active curve name from DigitizeStateContext.
 
GraphicsViewview ()
 View for the QImage and QGraphicsItems, without const.
 
const GraphicsViewview () const
 View for the QImage and QGraphicsItems, without const.
 

Friends

class CreateActions
 For simplifying this class by moving initialization to other classes.
 
class CreateCentralWidget
 
class CreateCommandStackShadow
 
class CreateDockableWidgets
 
class CreateFacade
 
class CreateHelpWindow
 
class CreateIcons
 
class CreateLoadImage
 
class CreateMenus
 
class CreateNetwork
 
class CreateScene
 
class CreateSettingsDialogs
 
class CreateStateContexts
 
class CreateStatusBar
 
class CreateToolBars
 
class CreateTutorial
 
class CreateZoomMaps
 
class TestExport
 For unit testing.
 

Detailed Description

Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document Interface.

Definition at line 91 of file MainWindow.h.

Constructor & Destructor Documentation

◆ MainWindow()

MainWindow::MainWindow ( const QString & errorReportFile,
const QString & fileCmdScriptFile,
bool isDropRegression,
bool isRegressionTest,
bool isGnuplot,
bool isReset,
bool isExportOnly,
bool isExtractImageOnly,
const QString & extractImageOnlyExtension,
const QStringList & loadStartupFiles,
const QStringList & commandLineWithoutLoadStartupFiles,
QWidget * parent = nullptr )

Single constructor.

Parameters
errorReportFileOptional error report file to be read at startup. Empty if unused. Incompatible with fileCmdScript
fileCmdScriptFileOptional file command script file to be read at startup. Empty if unused. Incompatible with errorReportFile
isDropRegressionTrue if files loaded at startup are for drag and drop testing
isRegressionTestTrue if errorReportFile or fileCmdScript is for regression testing, in which case it is executed and the program exits
isGnuplotTrue if diagnostic gnuplot files are generated for math-intense sections of the code. Used for development and debugging
isResetTrue to reset all settings that would otherwise be restored from the previous execution of Engauge
isExportOnlyTrue to export the loaded startup file and then exit
isExtractImageOnlyTrue to extract the image from the loaded startup file and then exit
extractImageOnlyExtensionFile extension for extracted image for isExtractImageOnly
loadStartupFilesZero or more Engauge document files to load at startup. A separate instance of Engauge is created for each file
commandLineWithoutLoadStartupFilesCommand line arguments without load startup files. Used for spawning additional processes
parentOptional parent widget for this widget

Definition at line 132 of file MainWindow.cpp.

143 :
144 QMainWindow(parent),
145 m_originalFileWasImported (false),
146 m_isDocumentExported (false),
147 m_engaugeFile (EMPTY_FILENAME),
148 m_currentFile (EMPTY_FILENAME),
149 m_layout (nullptr),
150 m_scene (nullptr),
151 m_view (nullptr),
152 m_loadImageFromUrl (nullptr),
153 m_cmdMediator (nullptr),
154 m_digitizeStateContext (nullptr),
155 m_transformationStateContext (nullptr),
156 m_backgroundStateContext (nullptr),
157 m_networkClient (nullptr),
158 m_isGnuplot (isGnuplot),
159 m_commandLineWithoutLoadStartupFiles (commandLineWithoutLoadStartupFiles),
160 m_ghosts (nullptr),
161 m_timerRegressionErrorReport(nullptr),
162 m_fileCmdScript (nullptr),
163 m_isErrorReportRegressionTest (isRegressionTest),
164 m_timerRegressionFileCmdScript(nullptr),
165 m_fittingCurve (nullptr),
166 m_isExportOnly (isExportOnly),
167 m_isExtractImageOnly (isExtractImageOnly),
168 m_extractImageOnlyExtension (extractImageOnlyExtension)
169{
170 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::MainWindow"
171 << " curDir=" << QDir::currentPath().toLatin1().data();
172
173#if defined(OSX_DEBUG) || defined(OSX_RELEASE)
174 qApp->setApplicationName ("Engauge Digitizer");
175 qApp->setOrganizationDomain ("Mark Mitchell");
176#endif
177
179
180 m_startupDirectory = QDir::currentPath();
181
182 setCurrentFile ("");
183
185 createFacade.create (*this);
186
187 updateControls ();
188
189 settingsRead (isReset); // This changes the current directory when not regression testing
190 setCurrentFile ("");
192
193 installEventFilter(this);
194
195 // Start regression scripting if appropriate. Regression scripts assume current directory is the original
196 // current directory, so we temporarily reset the current directory
197 QString originalPath = QDir::currentPath();
198 QDir::setCurrent (m_startupDirectory);
199 if (isExportOnly) {
200 m_loadStartupFiles = loadStartupFiles;
201 m_regressionFile = exportRegressionFilenameFromInputFilename (loadStartupFiles.first ()); // For regression test
202 slotLoadStartupFiles ();
203 slotFileExport (); // Export one file. QProcess::startDetached will be called for each remaining file
204 exit (0);
205 } else if (isExtractImageOnly) {
206 m_loadStartupFiles = loadStartupFiles;
207 m_regressionFile = exportRegressionFilenameFromInputFilename (loadStartupFiles.first ()); // For regression test
208 slotLoadStartupFiles ();
209 handlerFileExtractImage (); // Extract one file. QProcess::startDetached will be called for each remaining file
210 exit (0);
211 } else if (!errorReportFile.isEmpty()) {
212 loadErrorReportFile(errorReportFile);
213 if (m_isErrorReportRegressionTest) {
214 startRegressionTestErrorReport(errorReportFile);
215 }
216 } else if (!fileCmdScriptFile.isEmpty()) {
217 m_fileCmdScript = new FileCmdScript (fileCmdScriptFile);
218 startRegressionTestFileCmdScript();
219 } else if (isDropRegression) {
220 m_fileCmdScript = new FileCmdScript (""); // Hack to keep dialogs from popping up
221 startRegressionDropTest (loadStartupFiles);
222 } else {
223
224 // Save file names for later, after gui becomes available. The file names are dropped if error report file is specified
225 // since only one of the two modes is available at any time, for simplicity
226 m_loadStartupFiles = loadStartupFiles;
227 }
228 QDir::setCurrent (originalPath);
229}
const int INNER_RADIUS_MIN
log4cpp::Category * mainCat
Definition Logger.cpp:14
const QString EMPTY_FILENAME("")
Facade class that wraps around all of the create classes for MainWindow.
void create(MainWindow &mw)
Create QAction facade.
File that manages a command stack for regression testing of file import/open/export/close.
static void bindToMainWindow(MainWindow *mainWindow)
Bind to MainWindow so this class can access the command stack.
bool isGnuplot() const
Get method for gnuplot flag.
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18

◆ ~MainWindow()

MainWindow::~MainWindow ( )

Definition at line 231 of file MainWindow.cpp.

232{
233#if !defined(OSX_DEBUG) && !defined(OSX_RELEASE)
234 delete m_helpWindow;
235#endif
236 delete m_tutorialDlg;
237 delete m_cmdMediator;
238 delete m_cmdStackShadow;
239 delete m_digitizeStateContext;
240 delete m_transformationStateContext;
241 delete m_backgroundStateContext;
242 delete m_dlgSettingsAxesChecker;
243 delete m_dlgSettingsColorFilter;
244 delete m_dlgSettingsCoords;
245 delete m_dlgSettingsCurveList;
246 delete m_dlgSettingsCurveProperties;
247 delete m_dlgSettingsDigitizeCurve;
248 delete m_dlgSettingsExportFormat;
249 delete m_dlgSettingsGeneral;
250 delete m_dlgSettingsGridDisplay;
251 delete m_dlgSettingsGridRemoval;
252 delete m_dlgSettingsMainWindow;
253 delete m_dlgSettingsPointMatch;
254 delete m_dlgSettingsSegments;
255 delete m_fileCmdScript;
256 m_gridLines.clear ();
257}
void clear()
Deallocate and remove all grid lines.
Definition GridLines.cpp:24

Member Function Documentation

◆ cmdFileClose()

void MainWindow::cmdFileClose ( )

Close file. This is called from a file script command.

Definition at line 316 of file MainWindow.cpp.

317{
318 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::cmdFileClose";
319
320 setWindowModified (false); // Prevent popup query asking if changes should be saved
321 slotFileClose();
322}

◆ cmdFileExport()

void MainWindow::cmdFileExport ( const QString & fileName)

Export file. This is called from a file script command.

Definition at line 324 of file MainWindow.cpp.

325{
326 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::cmdFileExport";
327
329 fileExport(fileName,
331}
Strategy class for exporting to a file. This strategy is external to the Document class so that class...

◆ cmdFileImport()

void MainWindow::cmdFileImport ( const QString & fileName)

Import file. This is called from a file script command.

Definition at line 333 of file MainWindow.cpp.

334{
335 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::cmdFileImport";
336
337 m_regressionFile = exportRegressionFilenameFromInputFilename (fileName);
338 fileImport (fileName,
339 IMPORT_TYPE_SIMPLE);
340}

◆ cmdFileOpen()

void MainWindow::cmdFileOpen ( const QString & fileName)

Open file. This is called from a file script command.

Definition at line 342 of file MainWindow.cpp.

343{
344 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::cmdFileOpen";
345
346 m_regressionFile = exportRegressionFilenameFromInputFilename (fileName);
347 loadDocumentFile(fileName);
348}

◆ cmdMediator()

CmdMediator * MainWindow::cmdMediator ( )

Accessor for commands to process the Document.

Definition at line 350 of file MainWindow.cpp.

351{
352 // We do not check m_cmdMediator with ENGAUGE_CHECK_PTR since calling code is expected to deal with null pointer at startup
353 return m_cmdMediator;
354}

◆ eventFilter()

bool MainWindow::eventFilter ( QObject * target,
QEvent * event )
virtual

Catch secret keypresses.

Definition at line 371 of file MainWindow.cpp.

372{
373 if (event->type () == QEvent::KeyPress) {
374
375 QKeyEvent *eventKeyPress = static_cast<QKeyEvent *> (event);
376
377 // Special shortcuts. All of these are probably only useful for debugging and/or regression testing
378 if ((eventKeyPress->key() == Qt::Key_E) &&
379 ((eventKeyPress->modifiers() & Qt::ShiftModifier) != 0) &&
380 ((eventKeyPress->modifiers() & Qt::ControlModifier) != 0)) {
381
382 saveErrorReportFileAndExit ("Shift+Control+E",
383 __FILE__,
384 __LINE__,
385 "userTriggered");
386
387 }
388 }
389
390 return QObject::eventFilter (target, event);
391}
void saveErrorReportFileAndExit(const char *comment, const char *file, int line, const char *context)
Save error report and exit.

◆ imageFiltered()

QImage MainWindow::imageFiltered ( ) const

Background image that has been filtered for the current curve. This asserts if a curve-specific image is not being shown.

Definition at line 844 of file MainWindow.cpp.

845{
846 return m_backgroundStateContext->imageForCurveState();
847}
QImage imageForCurveState() const
Image for the Curve state, even if the current state is different.

◆ isGnuplot()

bool MainWindow::isGnuplot ( ) const

Get method for gnuplot flag.

Definition at line 849 of file MainWindow.cpp.

850{
851 return m_isGnuplot;
852}

◆ modelMainWindow()

MainWindowModel MainWindow::modelMainWindow ( ) const

Get method for main window model.

Definition at line 1232 of file MainWindow.cpp.

1233{
1234 return m_modelMainWindow;
1235}

◆ modeMap()

bool MainWindow::modeMap ( ) const

True if document scale is set using a scale bar, otherwise using axis points.

Definition at line 1172 of file MainWindow.cpp.

1173{
1174 bool success = false;
1175
1176 if (m_cmdMediator != nullptr) {
1178 }
1179
1180 return success;
1181}
@ DOCUMENT_AXES_POINTS_REQUIRED_2
Document & document()
Provide the Document to commands, primarily for undo/redo processing.
DocumentAxesPointsRequired documentAxesPointsRequired() const
Get method for DocumentAxesPointsRequired.
Definition Document.cpp:363

◆ resizeEvent()

void MainWindow::resizeEvent ( QResizeEvent * event)

Intercept resize event so graphics scene can be appropriately resized when in Fill mode.

Definition at line 1255 of file MainWindow.cpp.

1256{
1257 LOG4CPP_DEBUG_S ((*mainCat)) << "MainWindow::resizeEvent";
1258
1259 if (m_actionZoomFill->isChecked ()) {
1260 slotViewZoomFactor (ZOOM_FILL);
1261 }
1262
1263 QMainWindow::resizeEvent(event);
1264}
@ ZOOM_FILL
Definition ZoomFactor.h:37
#define LOG4CPP_DEBUG_S(logger)
Definition convenience.h:20

◆ saveErrorReportFileAndExit()

void MainWindow::saveErrorReportFileAndExit ( const char * comment,
const char * file,
int line,
const char * context )

Save error report and exit.

Definition at line 1304 of file MainWindow.cpp.

1308{
1309 // Skip if currently performing a regression test - in which case the preferred behavior is to let the current test fail and
1310 // continue on to execute the remaining tests
1311 if ((m_cmdMediator != nullptr) && !m_isErrorReportRegressionTest) {
1312
1313 QString report = saveErrorReportFileAndExitXml (context,
1314 file,
1315 line,
1316 comment);
1317
1319 if (dlg.exec() == QDialog::Accepted) {
1321
1322 QString fileName = dlg.getSaveFileName (this,
1323 tr("Save"),
1324 "error_report.xml");
1325 if (!fileName.isEmpty ()) {
1326 // Save the error report
1329 fileError.open (QIODevice::WriteOnly | QIODevice::Text);
1330 str << report;
1331 fileError.close ();
1332 }
1333 }
1334
1335 exit (-1);
1336 }
1337}
Dialog for saving error report for later transmission to the developers.

◆ scene()

GraphicsScene & MainWindow::scene ( )

Scene container for the QImage and QGraphicsItems.

Definition at line 1459 of file MainWindow.cpp.

1460{
1461 ENGAUGE_CHECK_PTR (m_scene);
1462 return *m_scene;
1463}
#define ENGAUGE_CHECK_PTR(ptr)
#endif

◆ selectedGraphCurve()

QString MainWindow::selectedGraphCurve ( ) const

Curve name that is currently selected in m_cmbCurve.

Definition at line 1479 of file MainWindow.cpp.

1480{
1481 return m_cmbCurve->currentText ();
1482}

◆ selectOriginal()

BackgroundImage MainWindow::selectOriginal ( BackgroundImage backgroundImage)

Make original background visible, for DigitizeStateColorPicker.

This returns the previous background state for restoring when state finishes

Definition at line 1465 of file MainWindow.cpp.

1466{
1467 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::selectBackgroundOriginal";
1468
1469 BackgroundImage previousBackground = static_cast<BackgroundImage> (m_cmbBackground->currentData().toInt());
1470
1471 int index = m_cmbBackground->findData (backgroundImage);
1472 ENGAUGE_ASSERT (index >= 0);
1473
1474 m_cmbBackground->setCurrentIndex(index);
1475
1476 return previousBackground;
1477}
BackgroundImage
Background selection.
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...

◆ showEvent()

void MainWindow::showEvent ( QShowEvent * event)
virtual

Processing performed after gui becomes available.

Definition at line 1894 of file MainWindow.cpp.

1895{
1896 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::showEvent"
1897 << " files=" << m_loadStartupFiles.join (",").toLatin1().data();
1898
1899 QMainWindow::showEvent (event);
1900
1901 if (m_loadStartupFiles.count() > 0) {
1902
1903 m_timerLoadStartupFiles = new QTimer;
1904 m_timerLoadStartupFiles->setSingleShot (true);
1905 connect (m_timerLoadStartupFiles, SIGNAL (timeout ()), this, SLOT (slotLoadStartupFiles ()));
1906 m_timerLoadStartupFiles->start (0); // Zero delay still waits until execution finishes and gui is available
1907
1908 }
1909}

◆ showTemporaryMessage()

void MainWindow::showTemporaryMessage ( const QString & temporaryMessage)

Show temporary message in status bar.

Definition at line 1911 of file MainWindow.cpp.

1912{
1914}
void showTemporaryMessage(const QString &message)
Show temporary message in status bar. After a short interval the message will disappear.

◆ signalDropRegression

void MainWindow::signalDropRegression ( QString )
signal

Send drag and drop regression test url.

◆ signalZoom

void MainWindow::signalZoom ( int )
signal

Send zoom selection, picked from menu or keystroke, to StatusBar.

◆ transformation()

Transformation MainWindow::transformation ( ) const

Return read-only copy of transformation.

Definition at line 3231 of file MainWindow.cpp.

3232{
3233 return m_transformation;
3234}

◆ transformIsDefined()

bool MainWindow::transformIsDefined ( ) const

Return true if all three axis points have been defined.

Definition at line 3236 of file MainWindow.cpp.

3237{
3238 return m_transformation.transformIsDefined();
3239}
bool transformIsDefined() const
Transform is defined when at least three axis points have been digitized.

◆ updateAfterCommand()

void MainWindow::updateAfterCommand ( )

See GraphicsScene::updateAfterCommand.

Definition at line 3241 of file MainWindow.cpp.

3242{
3243 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateAfterCommand";
3244
3245 ENGAUGE_CHECK_PTR (m_cmdMediator);
3246
3247 // Update transformation stuff, including the graph coordinates of every point in the Document, so coordinates in
3248 // status bar are up to date. Point coordinates in Document are also updated
3249 updateAfterCommandStatusBarCoords ();
3250
3251 updateHighlightOpacity ();
3252
3253 // Update graphics. Effectively, these steps do very little (just needed for highlight opacity)
3254 m_digitizeStateContext->updateAfterPointAddition (); // May or may not be needed due to point addition
3255
3256 updateControls ();
3257 updateChecklistGuide ();
3258 updateFittingWindow ();
3259 updateGeometryWindow();
3260
3261 // Final actions at the end of a redo/undo are:
3262 // 1) checkpoint the Document and GraphicsScene to log files so proper state can be verified
3263 // 2) run sanity check on state
3264 writeCheckpointToLogFile ();
3266 docScrub.check (*this,
3267 m_cmdMediator->document ());
3268
3269 // Since focus may have drifted over to Geometry Window or some other control we se focus on the GraphicsView
3270 // so the cursor is appropriate for the current state (otherwise it often ends up as default arrow)
3271 m_view->setFocus ();
3272}
void updateAfterPointAddition()
Update the graphics attributes.
Check Document state.
void check(MainWindow &mainWindow, const Document &document) const
Check document state.

◆ updateAfterMouseRelease()

void MainWindow::updateAfterMouseRelease ( )

Call MainWindow::updateControls (which is private) after the very specific case - a mouse press/release.

Definition at line 3321 of file MainWindow.cpp.

3322{
3323 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateAfterMouseRelease";
3324
3325 updateControls ();
3326}

◆ updateCoordSystem()

void MainWindow::updateCoordSystem ( CoordSystemIndex coordSystemIndex)

Select a different CoordSystem.

Definition at line 3417 of file MainWindow.cpp.

3418{
3419 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateCoordSystem";
3420
3421 // Set current curve in the Document and in the MainWindow combobox together so they are in sync. Setting
3422 // the selected curve prevents a crash in updateTransformationAndItsDependencies
3423 m_cmdMediator->document().setCoordSystemIndex (coordSystemIndex);
3424 loadCurveListFromCmdMediator ();
3425
3426 updateTransformationAndItsDependencies(); // Transformation state may have changed
3427 updateSettingsAxesChecker(m_cmdMediator->document().modelAxesChecker()); // Axes checker dependes on transformation state
3428
3429 // Nice trick for showing that a new coordinate system is in effect is to show the axes checker
3430 m_transformationStateContext->updateAxesChecker (*m_cmdMediator,
3431 m_transformation);
3432
3434}
void setCoordSystemIndex(CoordSystemIndex coordSystemIndex)
Set the index of current active CoordSystem.
Definition Document.cpp:918
DocumentModelAxesChecker modelAxesChecker() const
Get method for DocumentModelAxesChecker.
Definition Document.cpp:681
void updateSettingsAxesChecker(const DocumentModelAxesChecker &modelAxesChecker)
Update with new axes indicator properties.
void updateAfterCommand()
See GraphicsScene::updateAfterCommand.
void updateAxesChecker(CmdMediator &cmdMediator, const Transformation &transformation)
Apply the new DocumentModelAxesChecker.

◆ updateDigitizeStateIfSoftwareTriggered()

void MainWindow::updateDigitizeStateIfSoftwareTriggered ( DigitizeState digitizeState)

After software-triggered state transition, this method manually triggers the action as if user had clicked on digitize button.

Definition at line 3436 of file MainWindow.cpp.

3437{
3438 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateDigitizeStateIfSoftwareTriggered";
3439
3440 switch (digitizeState) {
3442 m_actionDigitizeAxis->setChecked(true);
3443 slotDigitizeAxis(); // Call the slot that the setChecked call fails to trigger
3444 break;
3445
3447 m_actionDigitizeColorPicker->setChecked(true);
3448 slotDigitizeColorPicker(); // Call the slot that the setChecked call fails to trigger
3449 break;
3450
3452 m_actionDigitizeCurve->setChecked(true);
3453 slotDigitizeCurve(); // Call the slot that the setChecked call fails to trigger
3454 break;
3455
3457 break;
3458
3460 m_actionDigitizePointMatch->setChecked(true);
3461 slotDigitizePointMatch(); // Call the slot that the setChecked call fails to trigger
3462 break;
3463
3465 m_actionDigitizeScale->setChecked(true);
3466 slotDigitizeScale(); // Call the slot that the setChecked call fails to trigger
3467 break;
3468
3470 m_actionDigitizeSegment->setChecked(true);
3471 slotDigitizeSegment(); // Call the slot that the setChecked call fails to trigger
3472 break;
3473
3475 m_actionDigitizeSelect->setChecked(true);
3476 slotDigitizeSelect(); // Call the slot that the setChecked call fails to trigger
3477 break;
3478
3479 default:
3480 LOG4CPP_ERROR_S ((*mainCat)) << "MainWindow::updateDigitizeStateIfSoftwareTriggered";
3481 break;
3482 }
3483}
@ DIGITIZE_STATE_POINT_MATCH
@ DIGITIZE_STATE_SELECT
@ DIGITIZE_STATE_COLOR_PICKER
@ DIGITIZE_STATE_SEGMENT
#define LOG4CPP_ERROR_S(logger)
Definition convenience.h:12

◆ updateGraphicsLinesToMatchGraphicsPoints()

void MainWindow::updateGraphicsLinesToMatchGraphicsPoints ( )

Update the graphics lines so they follow the graphics points, after a drag, addition, removal, and such.

The points in the Document may (and probably are) out of date with respect to the graphics points

Definition at line 3515 of file MainWindow.cpp.

3516{
3517 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateGraphicsLinesToMatchGraphicsPoints";
3518
3520 m_transformation);
3521}
CurveStyles modelCurveStyles() const
Get method for CurveStyles.
Definition Document.cpp:702
void updateGraphicsLinesToMatchGraphicsPoints(const CurveStyles &modelCurveStyles, const Transformation &transformation)
A mouse move has just occurred so move the selected points, since they were dragged.

◆ updateSettingsAxesChecker()

void MainWindow::updateSettingsAxesChecker ( const DocumentModelAxesChecker & modelAxesChecker)

Update with new axes indicator properties.

Definition at line 3585 of file MainWindow.cpp.

3586{
3587 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateSettingsAxesChecker";
3588
3589 m_cmdMediator->document().setModelAxesChecker(modelAxesChecker);
3590 if (m_transformation.transformIsDefined()) {
3591 m_transformationStateContext->triggerStateTransition(m_isGnuplot,
3593 *m_cmdMediator,
3594 m_transformation,
3595 m_cmbCurve->currentText());
3596 } else {
3597 m_transformationStateContext->triggerStateTransition(m_isGnuplot,
3599 *m_cmdMediator,
3600 m_transformation,
3601 m_cmbCurve->currentText());
3602 }
3603}
void setModelAxesChecker(const DocumentModelAxesChecker &modelAxesChecker)
Set method for DocumentModelAxesChecker.
Definition Document.cpp:951
void triggerStateTransition(bool isGnuplot, TransformationState transformationState, CmdMediator &cmdMediator, const Transformation &transformation, const QString &selectedGraphCurve)
Trigger a state transition to be performed immediately.

◆ updateSettingsColorFilter()

void MainWindow::updateSettingsColorFilter ( const DocumentModelColorFilter & modelColorFilter)

Update with new color filter properties.

Definition at line 3605 of file MainWindow.cpp.

3606{
3607 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateSettingsColorFilter";
3608
3609 m_cmdMediator->document().setModelColorFilter(modelColorFilter);
3610 m_backgroundStateContext->updateColorFilter (m_isGnuplot,
3611 m_transformation,
3612 m_cmdMediator->document().modelGridRemoval(),
3613 modelColorFilter,
3614 m_cmbCurve->currentText());
3615 m_digitizeStateContext->handleCurveChange (m_cmdMediator);
3617}
void updateColorFilter(bool isGnuplot, const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &colorFilter, const QString &curveSelected)
Apply color filter settings.
void handleCurveChange(CmdMediator *cmdMediator)
See DigitizeStateAbstractBase::handleCurveChange.
void setModelColorFilter(const DocumentModelColorFilter &modelColorFilter)
Set method for DocumentModelColorFilter.
Definition Document.cpp:958
DocumentModelGridRemoval modelGridRemoval() const
Get method for DocumentModelGridRemoval.
Definition Document.cpp:737
void updateViewsOfSettings(const QString &activeCurve)
Update curve-specific view of settings. Private version gets active curve name from DigitizeStateCont...

◆ updateSettingsCoords()

void MainWindow::updateSettingsCoords ( const DocumentModelCoords & modelCoords)

Update with new coordinate properties.

Definition at line 3619 of file MainWindow.cpp.

3620{
3621 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateSettingsCoords";
3622
3623 m_cmdMediator->document().setModelCoords(modelCoords);
3624}
void setModelCoords(const DocumentModelCoords &modelCoords)
Set method for DocumentModelCoords.
Definition Document.cpp:976

◆ updateSettingsCurveList()

void MainWindow::updateSettingsCurveList ( const CurvesGraphs & curvesGraphs)

Update with new curves.

Definition at line 3626 of file MainWindow.cpp.

3627{
3628 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateSettingsCurveList";
3629
3630 m_cmdMediator->document().setCurvesGraphs (curvesGraphs);
3631 loadCurveListFromCmdMediator();
3633}
void setCurvesGraphs(const CurvesGraphs &curvesGraphs)
Let CmdAbstract classes overwrite CurvesGraphs.
Definition Document.cpp:932

◆ updateSettingsCurveStyles()

void MainWindow::updateSettingsCurveStyles ( const CurveStyles & modelCurveStyles)

Update with new curve styles.

Definition at line 3635 of file MainWindow.cpp.

3636{
3637 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateSettingsCurveStyles";
3638
3639 m_scene->updateCurveStyles(modelCurveStyles);
3640 m_cmdMediator->document().setModelCurveStyles(modelCurveStyles);
3642}
void setModelCurveStyles(const CurveStyles &modelCurveStyles)
Set method for CurveStyles.
Definition Document.cpp:983
void updateCurveStyles(const CurveStyles &modelCurveStyles)
Update curve styles after settings changed.

◆ updateSettingsDigitizeCurve()

void MainWindow::updateSettingsDigitizeCurve ( const DocumentModelDigitizeCurve & modelDigitizeCurve)

Update with new curve digitization styles.

Definition at line 3644 of file MainWindow.cpp.

3645{
3646 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateSettingsDigitizeCurve";
3647
3648 m_cmdMediator->document().setModelDigitizeCurve(modelDigitizeCurve);
3649 m_digitizeStateContext->updateModelDigitizeCurve (m_cmdMediator,
3650 modelDigitizeCurve);
3651}
void updateModelDigitizeCurve(CmdMediator *cmdMediator, const DocumentModelDigitizeCurve &modelDigitizeCurve)
Update the digitize curve settings.
void setModelDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Set method for DocumentModelDigitizeCurve.

◆ updateSettingsExportFormat()

void MainWindow::updateSettingsExportFormat ( const DocumentModelExportFormat & modelExport)

Update with new export properties.

Definition at line 3653 of file MainWindow.cpp.

3654{
3655 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateSettingsExportFormat";
3656
3657 m_cmdMediator->document().setModelExport (modelExport);
3658}
void setModelExport(const DocumentModelExportFormat &modelExport)
Set method for DocumentModelExportFormat.

◆ updateSettingsGeneral()

void MainWindow::updateSettingsGeneral ( const DocumentModelGeneral & modelGeneral)

Update with new general properties.

Definition at line 3660 of file MainWindow.cpp.

3661{
3662 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateSettingsGeneral";
3663
3664 m_cmdMediator->document().setModelGeneral(modelGeneral);
3665}
void setModelGeneral(const DocumentModelGeneral &modelGeneral)
Set method for DocumentModelGeneral.

◆ updateSettingsGridDisplay()

void MainWindow::updateSettingsGridDisplay ( const DocumentModelGridDisplay & modelGridDisplay)

Update with new grid display properties.

Definition at line 3667 of file MainWindow.cpp.

3668{
3669 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateSettingsGridDisplay";
3670
3671 m_cmdMediator->document().setModelGridDisplay(modelGridDisplay);
3672 updateGridLines ();
3673}
void setModelGridDisplay(const DocumentModelGridDisplay &modelGridDisplay)
Set method for DocumentModelGridDisplay.

◆ updateSettingsGridRemoval()

void MainWindow::updateSettingsGridRemoval ( const DocumentModelGridRemoval & modelGridRemoval)

Update with new grid removal properties.

Definition at line 3675 of file MainWindow.cpp.

3676{
3677 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateSettingsGridRemoval";
3678
3679 m_cmdMediator->document().setModelGridRemoval(modelGridRemoval);
3680}
void setModelGridRemoval(const DocumentModelGridRemoval &modelGridRemoval)
Set method for DocumentModelGridRemoval.

◆ updateSettingsMainWindow()

void MainWindow::updateSettingsMainWindow ( const MainWindowModel & modelMainWindow)

Update with new main window properties.

Definition at line 3710 of file MainWindow.cpp.

3711{
3712 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateSettingsMainWindow";
3713
3714 m_modelMainWindow = modelMainWindow;
3716}
MainWindowModel modelMainWindow() const
Get method for main window model.
void updateSettingsMainWindow(const MainWindowModel &modelMainWindow)
Update with new main window properties.

◆ updateSettingsPointMatch()

void MainWindow::updateSettingsPointMatch ( const DocumentModelPointMatch & modelPointMatch)

Update with new point match properties.

Definition at line 3718 of file MainWindow.cpp.

3719{
3720 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateSettingsPointMatch";
3721
3722 m_cmdMediator->document().setModelPointMatch(modelPointMatch);
3723}
void setModelPointMatch(const DocumentModelPointMatch &modelPointMatch)
Set method for DocumentModelPointMatch.

◆ updateSettingsSegments()

void MainWindow::updateSettingsSegments ( const DocumentModelSegments & modelSegments)

Update with new segments properties.

Definition at line 3725 of file MainWindow.cpp.

3726{
3727 LOG4CPP_INFO_S ((*mainCat)) << "MainWindow::updateSettingsSegments";
3728
3729 m_cmdMediator->document().setModelSegments(modelSegments);
3730 m_digitizeStateContext->updateModelSegments(modelSegments);
3731}
void updateModelSegments(const DocumentModelSegments &modelSegments)
Update the segments given the new settings.
void setModelSegments(const DocumentModelSegments &modelSegments)
Set method for DocumentModelSegments.

◆ updateViewsOfSettings()

void MainWindow::updateViewsOfSettings ( const QString & activeCurve)

Update curve-specific view of settings. Private version gets active curve name from DigitizeStateContext.

Definition at line 3798 of file MainWindow.cpp.

3799{
3800 if (activeCurve.isEmpty ()) {
3801
3802 m_viewPointStyle->unsetPointStyle ();
3803 m_viewSegmentFilter->unsetColorFilterSettings ();
3804
3805
3806 } else {
3807
3808 PointStyle pointStyle = m_cmdMediator->document().modelCurveStyles().curveStyle(activeCurve).pointStyle();
3809 m_viewPointStyle->setPointStyle (pointStyle);
3810
3811 ColorFilterSettings colorFilterSettings = m_cmdMediator->document().modelColorFilter().colorFilterSettings(activeCurve);
3812 m_viewSegmentFilter->setColorFilterSettings (colorFilterSettings,
3813 m_cmdMediator->pixmap ());
3814
3815 }
3816}
QPixmap pixmap() const
See Document::pixmap.
Color filter parameters for one curve. For a class, this is handled the same as LineStyle and PointSt...
PointStyle pointStyle() const
Get method for PointStyle.
CurveStyle curveStyle(const QString &curveName) const
CurveStyle in specified curve.
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...
DocumentModelColorFilter modelColorFilter() const
Get method for DocumentModelColorFilter.
Definition Document.cpp:688
Details for a specific Point.
Definition PointStyle.h:21
void unsetPointStyle()
Apply no PointStyle.
void setPointStyle(const PointStyle &pointStyle)
Apply the PointStyle of the currently selected curve.
void unsetColorFilterSettings()
Apply no color filter.
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...

◆ view() [1/2]

GraphicsView & MainWindow::view ( )

View for the QImage and QGraphicsItems, without const.

Definition at line 3857 of file MainWindow.cpp.

3858{
3859 ENGAUGE_CHECK_PTR (m_view);
3860 return *m_view;
3861}

◆ view() [2/2]

const GraphicsView & MainWindow::view ( ) const

View for the QImage and QGraphicsItems, without const.

Definition at line 3863 of file MainWindow.cpp.

3864{
3865 ENGAUGE_CHECK_PTR (m_view);
3866 return *m_view;
3867}

Friends And Related Symbol Documentation

◆ CreateActions

For simplifying this class by moving initialization to other classes.

Definition at line 96 of file MainWindow.h.

◆ CreateCentralWidget

Definition at line 97 of file MainWindow.h.

◆ CreateCommandStackShadow

Definition at line 98 of file MainWindow.h.

◆ CreateDockableWidgets

Definition at line 99 of file MainWindow.h.

◆ CreateFacade

Definition at line 100 of file MainWindow.h.

◆ CreateHelpWindow

Definition at line 101 of file MainWindow.h.

◆ CreateIcons

Definition at line 102 of file MainWindow.h.

◆ CreateLoadImage

Definition at line 103 of file MainWindow.h.

◆ CreateMenus

Definition at line 104 of file MainWindow.h.

◆ CreateNetwork

Definition at line 105 of file MainWindow.h.

◆ CreateScene

Definition at line 106 of file MainWindow.h.

◆ CreateSettingsDialogs

Definition at line 107 of file MainWindow.h.

◆ CreateStateContexts

Definition at line 108 of file MainWindow.h.

◆ CreateStatusBar

Definition at line 109 of file MainWindow.h.

◆ CreateToolBars

Definition at line 110 of file MainWindow.h.

◆ CreateTutorial

Definition at line 111 of file MainWindow.h.

◆ CreateZoomMaps

Definition at line 112 of file MainWindow.h.

◆ TestExport

For unit testing.

Definition at line 115 of file MainWindow.h.


The documentation for this class was generated from the following files: