1 /***************************************************************************
2     File                 : ApplicationWindow.h
3     Project              : SciDAVis
4     Description          : SciDAVis's main window
5     --------------------------------------------------------------------
6     Copyright            : (C) 2006-2009 Knut Franke (knut.franke*gmx.de)
7     Copyright            : (C) 2006-2009 Tilman Benkert (thzs*gmx.net)
8     Copyright            : (C) 2004-2007 by Ion Vasilief (ion_vasilief*yahoo.fr)
9                            (replace * with @ in the email address)
10 
11  ***************************************************************************/
12 
13 /***************************************************************************
14  *                                                                         *
15  *  This program is free software; you can redistribute it and/or modify   *
16  *  it under the terms of the GNU General Public License as published by   *
17  *  the Free Software Foundation; either version 2 of the License, or      *
18  *  (at your option) any later version.                                    *
19  *                                                                         *
20  *  This program is distributed in the hope that it will be useful,        *
21  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
22  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
23  *  GNU General Public License for more details.                           *
24  *                                                                         *
25  *   You should have received a copy of the GNU General Public License     *
26  *   along with this program; if not, write to the Free Software           *
27  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
28  *   Boston, MA  02110-1301  USA                                           *
29  *                                                                         *
30  ***************************************************************************/
31 #ifndef APPLICATION_H
32 #define APPLICATION_H
33 
34 #include <QMainWindow>
35 #include <QTreeWidget>
36 #include <QTreeWidgetItem>
37 #ifdef SEARCH_FOR_UPDATES
38 #include <QNetworkAccessManager>
39 #include <QNetworkReply>
40 #endif
41 #include <QFile>
42 #include <QSplitter>
43 #include <QDesktopServices>
44 #include <QBuffer>
45 #include <QLocale>
46 #include <QMenu>
47 #include <QDockWidget>
48 #include <QMdiArea>
49 #include <QSettings>
50 
51 #ifdef _MSC_VER
52 #define NOMINMAX
53 #endif
54 #include "Folder.h"
55 #include "Table.h"
56 #include "ScriptingEnv.h"
57 #include "Script.h"
58 #include "SciDAVisObject.h"
59 
60 class QPixmap;
61 class QCloseEvent;
62 class QDropEvent;
63 class QTimerEvent;
64 class QDragEnterEvent;
65 class QTranslator;
66 class QAction;
67 class QActionGroup;
68 class QLineEdit;
69 class QTranslator;
70 class QToolButton;
71 class QShortcut;
72 class QMenu;
73 class QToolBar;
74 class QStatusBar;
75 class QSignalMapper;
76 class IconLoader;
77 
78 class Matrix;
79 class Table;
80 class Graph;
81 class ScalePicker;
82 class Graph3D;
83 class Note;
84 class MultiLayer;
85 class FunctionDialog;
86 class Plot3DDialog;
87 class MyWidget;
88 class TableStatistics;
89 class CurveRangeDialog;
90 class Project;
91 class AbstractAspect;
92 class AxesDialog;
93 
94 #ifndef TS_PATH
95 #define TS_PATH (qApp->applicationDirPath() + "/translations")
96 #endif
97 
98 /**
99  * \brief SciDAVis's main window.
100  *
101  * This class contains the main part of the user interface as well as the central project management
102  * facilities.
103  *
104  * It manages all MyWidget MDI Windows in a project, knows about their organization in Folder
105  * objects and contains the parts of the project explorer not implemented in Folder, FolderListItem
106  * or FolderListView.
107  *
108  * Furthermore, it is responsible for displaying most MDI Windows' context menus and opening all
109  * sorts of dialogs.
110  *
111  * \section future_plans Future Plans
112  * Split out the project management part into a new Project class.
113  * If MyWidget maintains a reference to its parent Project, it should be possible to have its
114  * subclasses display their own context menus and dialogs. This is necessary for implementing new
115  * plot types or even completely new MyWidget subclasses in plug-ins. It will also make
116  * ApplicationWindow more manageable by removing those parts not directly related to the main
117  * window.
118  *
119  * Project would also take care of basic project file reading/writing (using Qt's XML framework),
120  * but delegate most of the work to MyWidget and its subclasses. This is necessary for providing
121  * save/restore of classes implemented in plug-ins. Support for foreign formats on the other hand
122  * could go into import/export classes (which could also be implemented in plug-ins). Those would
123  * interface directly with Project and the MyWidgets it manages. Thus, in addition to supporting
124  * QtXML-based save/restore, Project, MyWidget and subclasses will also have to provide generalized
125  * save/restore methods/constructors.
126  *
127  * Maybe split out the project explorer into a new ProjectExplorer class, depending on how much code
128  * is left in ApplicationWindow after the above reorganizations. Think about whether a Model/View
129  * approach can be used for Project/ProjectExplorer.
130  */
131 class ApplicationWindow : public SciDAVisObject<QMainWindow>, public scripted
132 {
133     Q_OBJECT
134 public:
135     ApplicationWindow();
136     ApplicationWindow(const QStringList &l);
137     ~ApplicationWindow();
138 
139     enum ShowWindowsPolicy { HideAll, ActiveFolder, SubFolders };
140 
141     QTranslator *appTranslator, *qtTranslator;
142     QDockWidget logWindow;
143     QDockWidget explorerWindow;
144     // TODO - convert to a statically owned member, but SIP currently requires it to be pointer
145     QTextEdit *results { new QTextEdit(&logWindow) };
146 #ifdef SCRIPTING_CONSOLE
147     QDockWidget consoleWindow;
148     QTextEdit console;
149 #endif
150     QMdiArea d_workspace;
151     QToolBar *file_tools, *graph_tools, *table_tools, *plot_tools, *graph_3D_tools, *edit_tools,
152             *matrix_plot_tools;
153     FolderListView lv;
154     FolderListView folders;
155     QToolButton *btnResults;
156     QList<MyWidget *> hiddenWindows;
157     QList<MyWidget *> outWindows;
158     MyWidget *lastModified;
159 
160 public:
161     /*! Generates a new unique name starting with string /param name.
162       You can force the output to be a name different from /param name,
163       even if 'name' is not used in the project, by setting /param increment = true (the default)
164     */
165     QString generateUniqueName(const QString &name, bool increment = true);
166 
batchMode()167     bool batchMode() const { return m_batch; } ///< running a python batch script
168     static QSettings &getSettings();
169 
170 public slots:
171     //! Copy the status bar text to the clipboard
172     void copyStatusBarText();
173     //! Show the context menu for the status bar
174     void showStatusBarContextMenu(const QPoint &pos);
175     //! Set status bar text
176     void setStatusBarText(const QString &);
177     //! \name Projects and Project Files
178     //@{
179     void open();
180     /// args are any argument to be passed to fn if a script
181     ApplicationWindow *open(const QString &fn, const QStringList &args = QStringList());
182     //! Returns temporary file ready for reading uncompressed content
183     /**
184      * Close and delete after you're done with it.
185      */
186     QFile *openCompressedFile(const QString &fn);
187     ApplicationWindow *openProject(const QString &fn);
188     ///* load project file \a into this
189     ///* @return true if project load successful
190     bool loadProject(const QString &fn);
191     ApplicationWindow *importOPJ(const QString &filename);
192     void showHistory();
193 
194     /**
195      * \brief Create a new project from a data file.
196      *
197      * \param fn is read as a data file with the default column separator (as set by the user)
198      * and inserted as a table into a new, empty project.
199      * This table is then plotted with the Graph::LineSymbols style.
200      */
201     ApplicationWindow *plotFile(const QString &fn);
202 
203     /**
204      * \brief Create a new project from a script file.
205      *
206      * \param fn is read as a Python script file and loaded in the command script window.
207      * \param execute specifies if the script should be executed after opening.
208      */
209     /// args are any argument to be passed to the script
210     ApplicationWindow *loadScript(const QString &fn, const QStringList &args = QStringList(),
211                                   bool execute = false);
212 
213     QList<MyWidget *> windowsList();
214     void updateWindowLists(MyWidget *w);
215     /*!
216       Arranges all the visible project windows in a cascade pattern.
217     */
218     void cascade();
219 
220     void saveProjectAs();
221     bool saveProject();
222 
223     //! Set the project status to modifed
224     void modifiedProject();
225     //! Set the project status to saved (not modified)
226     void savedProject();
227     //! Set the project status to modified and save 'w' as the last modified widget
228     void modifiedProject(MyWidget *w);
229     //@}
230 
231     //! \name Settings
232     //@{
233     void readSettings();
234     void saveSettings();
235     void applyUserSettings();
236     void setSaveSettings(bool autoSaving, int min);
237     void changeAppStyle(const QString &s);
238     void changeAppFont(const QFont &f);
239     void updateAppFonts();
240     void setAppColors(const QColor &wc, const QColor &pc, const QColor &tpc);
241     //@}
242 
243     //! \name Multilayer Plots
244     //@{
245     MultiLayer *multilayerPlot(int c, int r, int style);
246     MultiLayer *multilayerPlot(Table *w, const QStringList &colList, int style, int startRow = 0,
247                                int endRow = -1);
248     //! used when restoring a plot from a project file
249     MultiLayer *multilayerPlot(const QString &caption);
250     //! used by the plot wizard
251     MultiLayer *multilayerPlot(const QStringList &colList);
252     void connectMultilayerPlot(MultiLayer *g);
253     void addLayer();
254     void deleteLayer();
255 
256     //! Creates a new spectrogram graph
257     MultiLayer *plotSpectrogram(Matrix *m, Graph::CurveType type);
258     void plotGrayScale();
259     MultiLayer *plotGrayScale(Matrix *m);
260     void plotContour();
261     MultiLayer *plotContour(Matrix *m);
262     void plotColorMap();
263     MultiLayer *plotColorMap(Matrix *m);
264 
265     //! Rearrange the layersin order to fit to the size of the plot window
266     void autoArrangeLayers();
267     void initMultilayerPlot(MultiLayer *g, const QString &name);
268     void initBareMultilayerPlot(MultiLayer *g, const QString &name);
269     void polishGraph(Graph *g, int style);
270     void plot2VerticalLayers();
271     void plot2HorizontalLayers();
272     void plot4Layers();
273     void plotStackedLayers();
274     void plotStackedHistograms();
275     //@}
276 
277     //! \name 3D Data Plots
278     //@{
279     Graph3D *openMatrixPlot3D(const QString &caption, const QString &matrix_name, double xl,
280                               double xr, double yl, double yr, double zl, double zr);
281     Graph3D *dataPlot3D(Table *table, const QString &colName);
282     Graph3D *dataPlotXYZ(Table *table, const QString &zColName, int type);
283     Graph3D *dataPlot3D(const QString &caption, const QString &formula, double xl, double xr,
284                         double yl, double yr, double zl, double zr);
285     Graph3D *dataPlotXYZ(const QString &caption, const QString &formula, double xl, double xr,
286                          double yl, double yr, double zl, double zr);
287     //@}
288 
289     //! \name Surface Plots
290     //@{
291     Graph3D *newPlot3D();
292     Graph3D *newPlot3D(const QString &formula, double xl, double xr, double yl, double yr,
293                        double zl, double zr);
294     Graph3D *newPlot3D(const QString &caption, const QString &formula, double xl, double xr,
295                        double yl, double yr, double zl, double zr);
296     void connectSurfacePlot(Graph3D *plot);
297     void newSurfacePlot();
298     void editSurfacePlot();
299     void remove3DMatrixPlots(Matrix *m);
300     void updateMatrixPlots(MyWidget *);
301     void add3DData();
302     void change3DData();
303     void change3DData(const QString &colName);
304     void change3DMatrix();
305     void change3DMatrix(const QString &matrix_name);
306     void insertNew3DData(const QString &colName);
307     void add3DMatrixPlot();
308     void insert3DMatrixPlot(const QString &matrix_name);
309     void initPlot3D(Graph3D *plot);
310     void customPlot3D(Graph3D *plot);
311     void setPlot3DOptions();
312 
313     void plot3DWireframe();
314     void plot3DHiddenLine();
315     void plot3DPolygons();
316     void plot3DWireSurface();
317 
318     void plot3DMatrix(int style);
319 
320     void plot3DRibbon();
321     void plot3DScatter();
322     void plot3DTrajectory();
323     void plot3DBars();
324     //@}
325 
326     //! \name User-defined Functions
327     //@{
328     bool newFunctionPlot(int type, QStringList &formulas, const QString &var, QList<double> &ranges,
329                          int points);
330 
331     FunctionDialog *functionDialog();
332     void showFunctionDialog();
333     void showFunctionDialog(Graph *g, int curve);
334     void addFunctionCurve();
335     void clearFitFunctionsList();
336     void saveFitFunctionsList(const QStringList &l);
337     void clearSurfaceFunctionsList();
338     void clearLogInfo();
339     void clearParamFunctionsList();
340     void clearPolarFunctionsList();
341     void updateFunctionLists(int type, QStringList &formulas);
342     void updateSurfaceFuncList(const QString &s);
343     //@}
344 
345     //! \name Matrices
346     //@{
347     //! Creates a new empty matrix
348     Matrix *newMatrix(int rows = 32, int columns = 32);
349     //! To be used when opening a project file only!
350     Matrix *newMatrix(const QString &caption, int r, int c);
351     Matrix *matrix(const QString &name);
352     Matrix *convertTableToMatrix();
353     void initMatrix(Matrix *m);
354     void invertMatrix();
355     void matrixDeterminant();
356     //@}
357 
358     //! \name Tables
359     //@{
360     //! Creates an empty table
361     Table *newTable();
362     //! Used when importing an ASCII file
363     Table *newTable(const QString &fname, const QString &sep, int lines, bool renameCols,
364                     bool stripSpaces, bool simplifySpaces, bool convertToNumeric,
365                     QLocale numericLocale);
366     //! Used when loading a table from a project file
367     Table *newTable(const QString &caption, int r, int c);
368     Table *newTable(int r, int c, const QString &name = QString(),
369                     const QString &legend = QString());
370     Table *newTable(const QString &name, const QString &legend, QList<Column *> columns);
371     /**
372      * \brief Create a Table which is initially hidden; used to return the result of an analysis
373      * operation.
374      *
375      * \param name window name (compare MyWidget::MyWidget)
376      * \param label window label (compare MyWidget::MyWidget)
377      * \param r number of rows
378      * \param c number of columns
379      * \param text tab/newline - seperated initial content; may be empty
380      */
381     Table *newHiddenTable(const QString &name, const QString &label, QList<Column *> columns);
382     Table *table(const QString &name);
383     Table *convertMatrixToTable();
384     QList<MyWidget *> *tableList();
385 
386     void connectTable(Table *w);
387     void newWrksheetPlot(const QString &name, const QString &label, QList<Column *> columns);
388     void initTable(Table *w);
389     void customTable(Table *w);
390     void customizeTables(const QColor &bgColor, const QColor &textColor, const QColor &headerColor,
391                          const QFont &textFont, const QFont &headerFont, bool showComments);
392 
393     void importASCII();
394     void importASCII(const QStringList &files, int import_mode,
395                      const QString &local_column_separator, int local_ignored_lines,
396                      bool local_rename_columns, bool local_strip_spaces, bool local_simplify_spaces,
397                      bool local_convert_to_numeric, QLocale local_numeric_locale);
398     void exportAllTables(const QString &sep, bool colNames, bool expSelection);
399     void exportASCII(const QString &tableName, const QString &sep, bool colNames,
400                      bool expSelection);
401 
402     TableStatistics *newTableStatistics(Table *base, int type, QList<int>,
403                                         const QString &caption = {});
404     //@}
405 
406     //! \name Graphs
407     //@{
408     void setPreferences(Graph *g);
409     void setGraphDefaultSettings(bool autoscale, bool scaleFonts, bool resizeLayers,
410                                  bool antialiasing);
411     void setLegendDefaultSettings(int frame, const QFont &font, const QColor &textCol,
412                                   const QColor &backgroundCol);
413     void setArrowDefaultSettings(const QPen &pen, int headLength, int headAngle, bool fillHead);
414     void plotPie();
415     void plotVectXYXY();
416     void plotVectXYAM();
417     //@}
418 
419     //! \name Image Analysis
420     //@{
421     void intensityTable();
422     void pixelLineProfile();
423     void loadImage();
424     void loadImage(const QString &fn);
425     Matrix *importImage();
426     Matrix *importImage(const QString &fn);
427     //@}
428 
429     //! \name Export and Print
430     //@{
431     void exportLayer();
432     void exportGraph();
433     void exportAllGraphs();
434     void exportPDF();
435     void print();
436     void print(MyWidget *w);
437     void printAllPlots();
438     //@}
439 
440     QStringList columnsList(SciDAVis::PlotDesignation plotType);
441     QStringList columnsList();
442 
443     void undo();
444     void redo();
445 
446     //! \name MDI Windows
447     //@{
448     MyWidget *clone();
449     MyWidget *clone(MyWidget *);
450     void renameActiveWindow();
451 
452     //!  Called when the user presses F2 and an item is selected in lv.
453     void renameWindow(QTreeWidgetItem *item, int, const QString &s);
454 
455     //!  Checks weather the new window name is valid and modifies the name.
456     bool renameWindow(MyWidget *w, const QString &text);
457 
458     void maximizeWindow();
459     void minimizeWindow();
460     //! Changes the geometry of the active MDI window
461     void setWindowGeometry(int x, int y, int w, int h);
462 
463     void updateWindowStatus(MyWidget *);
464 
465     bool hidden(MyWidget *window);
466     void closeActiveWindow();
467     void closeWindow(MyWidget *window);
468 
469     //!  Does all the cleaning work before actually deleting a window!
470     void removeWindowFromLists(MyWidget *w);
471 
472     void hideWindow(MyWidget *window);
473     void hideActiveWindow();
474     void activateSubWindow();
475     void activateSubWindow(MyWidget *);
476     void printWindow();
477     //@}
478 
479     //! Show about dialog
480     static void about();
481     //! Return a version string ("SciDAVis x.y.z")
482     static QString versionString();
qtVersion()483     static int qtVersion() { return QT_VERSION; }
484     void windowsMenuAboutToShow();
485     void windowsMenuActivated(bool);
486     void removeCurves(const QString &name);
487     QStringList dependingPlots(const QString &caption);
488     QStringList depending3DPlots(Matrix *m);
489     QStringList multilayerDependencies(MyWidget *w);
490 
491     void saveAsTemplate();
492     void openTemplate();
493 
494     QString windowGeometryInfo(MyWidget *w);
495     void restoreWindowGeometry(ApplicationWindow *app, MyWidget *w, const QString s);
496 
497     void resizeActiveWindow();
498     void resizeWindow();
499 
500     //! \name List View in Project Explorer
501     //@{
502     void setListView(const QString &caption, const QString &view);
503     void renameListViewItem(const QString &oldName, const QString &newName);
504     void setListViewDate(const QString &caption, const QString &date);
505     void setListViewLabel(const QString &caption, const QString &label);
506     //@}
507 
508     void updateColNames(const QString &oldName, const QString &newName);
509     void updateTableNames(const QString &oldName, const QString &newName);
510     void changeMatrixName(const QString &oldName, const QString &newName);
511     void updateCurves(Table *t, const QString &name);
512 
513     void showTable(const QString &curve);
514 
515     void addColToTable();
516     void cutSelection();
517     void copySelection();
518     void copyMarker();
519     void pasteSelection();
520     void clearSelection();
521     void copyActiveLayer();
522 
523     void newProject();
524 
525     //! Creates a new empty multilayer plot
526     MultiLayer *newGraph(const QString &caption = tr("Graph"));
527 
528     //! \name Reading from a Project File
529     //@{
530     Matrix *openMatrix(ApplicationWindow *app, const QStringList &flist);
531     Table *openTable(ApplicationWindow *app, QTextStream &stream);
532     TableStatistics *openTableStatistics(const QStringList &flist);
533     Graph3D *openSurfacePlot(ApplicationWindow *app, const QStringList &lst);
534     Graph *openGraph(ApplicationWindow *app, MultiLayer *plot, const QStringList &list);
535 
536     void openRecentProject();
537     //@}
538 
539     //! \name Initialization
540     //@{
541     void insertTranslatedStrings();
542     void translateActionsStrings();
543     void initFonts();
544     void createActions();
545     void initMainMenu();
546     void initPlotMenu();
547     void initTableAnalysisMenu();
548     void initPlotDataMenu();
549     void initToolBars();
550     void initPlot3DToolBar();
551     void disableActions();
552     void customToolBars(MyWidget *w);
553     void customMenu(MyWidget *w);
554     void windowActivated(QMdiSubWindow *w);
555     //@}
556 
557     //! \name Table Tools
558     //@{
559     void correlate();
560     void autoCorrelate();
561     void convolute();
562     void deconvolute();
563     void clearTable();
564     //@}
565 
566     //! \name Plot Tools
567     //@{
568     void newLegend();
569     void addTimeStamp();
570     void drawLine();
571     void drawArrow();
572     void addText();
573     void disableAddText();
574     void addImage();
575     void zoomIn();
576     void zoomOut();
577     void setAutoScale();
578     void showRangeSelectors();
579     void showCursor();
580     void showScreenReader();
581     void pickPointerCursor();
582     void pickDataTool(QAction *action);
583 
584     void updateLog(const QString &result);
585     //@}
586 
587     //! \name Fitting
588     //@{
589     void deleteFitTables();
590     void fitLinear();
591     void fitSigmoidal();
592     void fitGauss();
593     void fitLorentz();
594     void fitMultiPeak(int profile);
595     void fitMultiPeakGauss();
596     void fitMultiPeakLorentz();
597     //@}
598 
599     //! \name Calculus
600     //@{
601     void differentiate();
602     void analysis(const QString &whichFit);
603     void analyzeCurve(Graph *g, const QString &whichFit, const QString &curveTitle);
604     void showDataSetDialog(const QString &whichFit);
605     //@}
606 
607     void addErrorBars();
608     void defineErrorBars(const QString &name, int type, const QString &percent, int direction);
609     void defineErrorBars(const QString &curveName, const QString &errColumnName, int direction);
610     void movePoints();
611     void removePoints();
612 
613     //! \name Event Handlers
614     //@{
615     void closeEvent(QCloseEvent *);
616     void timerEvent(QTimerEvent *e);
617     void dragEnterEvent(QDragEnterEvent *e);
618     void dropEvent(QDropEvent *e);
619     void customEvent(QEvent *e);
620     //@}
621 
622     //! \name Dialogs
623     //@{
624     void showFindDialogue();
625     //! Show plot style dialog for the active MultiLayer / activeGraph / specified curve or the activeGraph options dialog if no curve is specified (curveKey = -1).
626     void showPlotDialog(int curveKey = -1);
627     QDialog *showScaleDialog();
628     QDialog *showPlot3dDialog();
629     AxesDialog *showScalePageFromAxisDialog(int axisPos);
630     AxesDialog *showAxisPageFromAxisDialog(int axisPos);
631     void showAxisDialog();
632     void showGridDialog();
633     void showGeneralPlotDialog();
634     void showResults(bool ok);
635     void showResults(const QString &s, bool ok = true);
636     void showTextDialog();
637     void showLineDialog();
638     void showTitleDialog();
639     void showExportASCIIDialog();
640     void showCurvesDialog();
641     void showCurveRangeDialog();
642     CurveRangeDialog *showCurveRangeDialog(Graph *g, int curve);
643     void showPlotAssociations(int curve);
644 
645     void showXAxisTitleDialog();
646     void showYAxisTitleDialog();
647     void showRightAxisTitleDialog();
648     void showTopAxisTitleDialog();
649 
650     void showGraphContextMenu();
651     void showLayerButtonContextMenu();
652     void showWindowContextMenu();
653     void showWindowTitleBarMenu();
654     QMenu *showCurveContextMenuImpl(int);
showCurveContextMenu(int curveKey)655     void showCurveContextMenu(int curveKey)
656     {
657         auto m = showCurveContextMenuImpl(curveKey);
658         if (m)
659             m->exec(QCursor::pos());
660     }
661     void showCurvePlotDialog();
662     void showCurveWorksheet();
663     void showCurveWorksheet(Graph *g, int curveIndex);
664     /// @return the menu item, which is owned by this. May be null
665     QMenu *showWindowPopupMenuImpl(QTreeWidgetItem *it);
666     void showWindowPopupMenu(const QPoint &p);
667 
668     //! Connected to the context menu signal from lv; it's called when there are several items selected in the list
669     QMenu *showListViewSelectionMenuImpl();
showListViewSelectionMenu(const QPoint & p)670     void showListViewSelectionMenu(const QPoint &p) { showListViewSelectionMenuImpl()->exec(p); }
671 
672     //! Connected to the context menu signal from lv; it's called when there are no items selected in the list
673     QMenu *showListViewPopupMenuImpl();
showListViewPopupMenu(const QPoint & p)674     void showListViewPopupMenu(const QPoint &p) { showListViewPopupMenuImpl()->exec(p); }
675 
676     void showMoreWindows();
677     QMenu *showMarkerPopupMenuImpl();
showMarkerPopupMenu()678     void showMarkerPopupMenu()
679     {
680         auto m = showMarkerPopupMenuImpl();
681         if (m)
682             m->exec(QCursor::pos());
683     }
684     void showPlotWizard();
685     void showFitPolynomDialog();
686     void showIntegrationDialog();
687     void showInterpolationDialog();
688     void showExpGrowthDialog();
689     void showExpDecayDialog();
690     void showExpDecayDialog(int type);
691     void showTwoExpDecayDialog();
692     void showExpDecay3Dialog();
693     void showRowStatistics();
694     void showColStatistics();
695     void showFitDialog();
696     void showImageDialog();
697     void showPlotGeometryDialog();
698     void showLayerDialog();
699     void showPreferencesDialog();
700     void showSmoothSavGolDialog();
701     void showSmoothFFTDialog();
702     void showSmoothAverageDialog();
703     void showSmoothDialog(int m);
704     void showFilterDialog(int filter);
705     void lowPassFilterDialog();
706     void highPassFilterDialog();
707     void bandPassFilterDialog();
708     void bandBlockFilterDialog();
709     void showFFTDialog();
710     //@}
711 
712     void translateCurveHor();
713     void translateCurveVert();
714 
715     //! Removes the curve identified by a key stored in the data() of actionRemoveCurve.
716     void removeCurve();
717     void hideCurve();
718     void hideOtherCurves();
719     void showAllCurves();
720     void setCurveFullRange();
721 
722     void updateConfirmOptions(bool askTables, bool askMatrixes, bool askPlots2D, bool askPlots3D,
723                               bool askNotes);
724 
725     //! \name Plot3D Tools
726     //@{
727     void toggle3DAnimation(bool on = true);
728     //! Turns perspective mode on or off
729     void togglePerspective(bool on = true);
730     //! Resets rotation of 3D plots to default values
731     void resetRotation();
732     //! Finds best layout for the 3D plot
733     void fitFrameToLayer();
734     void setFramed3DPlot();
735     void setBoxed3DPlot();
736     void removeAxes3DPlot();
737     void removeGrid3DPlot();
738     void setHiddenLineGrid3DPlot();
739     void setLineGrid3DPlot();
740     void setPoints3DPlot();
741     void setCrosses3DPlot();
742     void setCones3DPlot();
743     void setBars3DPlot();
744     void setFilledMesh3DPlot();
745     void setEmptyFloor3DPlot();
746     void setFloorData3DPlot();
747     void setFloorIso3DPlot();
748     void setFloorGrid3DPlot(bool on);
749     void setCeilGrid3DPlot(bool on);
750     void setRightGrid3DPlot(bool on);
751     void setLeftGrid3DPlot(bool on);
752     void setFrontGrid3DPlot(bool on);
753     void setBackGrid3DPlot(bool on);
754     void pickPlotStyle(QAction *action);
755     void pickCoordSystem(QAction *action);
756     void pickFloorStyle(QAction *action);
757     void custom3DActions(MyWidget *w);
758     void custom3DGrids(int grids);
759     //@}
760 
761     void updateRecentProjectsList();
762 
763 #ifdef SEARCH_FOR_UPDATES
764     //!  connected to the finished(QNetworkReply*) signal of the http object
765     void receivedVersionFile(QNetworkReply *);
766     //!  called when the user presses the actionCheckUpdates
767     void searchForUpdates();
768 #endif
769 
770     //! Open SciDAVis homepage in external browser
771     void showHomePage();
772     //! Open forums page at SF.net in external browser
773     void showForums();
774     //! Open bug tracking system at SF.net in external browser
775     void showBugTracker();
776 #ifdef DOWNLOAD_LINKS
777     //! Show download page in external browser
778     void downloadManual();
779 #endif
780 
781     void parseCommandLineArguments(const QStringList &args);
782     void createLanguagesList();
783     void switchToLanguage(int param);
784     void switchToLanguage(const QString &locale);
785 
786     bool alreadyUsedName(const QString &label);
787     bool projectHas2DPlots();
788     bool projectHas3DPlots();
789     bool projectHasMatrices();
790 
791     //! Returns a pointer to the window named "name"
792     MyWidget *window(const QString &name);
793 
794     //! Returns a list with the names of all the matrices in the project
795     QStringList matrixNames();
796 
797     //! \name Notes
798     //@{
799     //! Creates a new empty note window
800     Note *newNote(const QString &caption = QString());
801     Note *openNote(ApplicationWindow *app, const QStringList &flist);
802     void initNote(Note *m, const QString &caption);
803     void saveNoteAs();
804     //@}
805 
806     //! \name Folders
807     //@{
808     //! Returns a to the current folder in the project
currentFolder()809     Folder *currentFolder() { return current_folder; };
810     //! Adds a new folder to the project
811     void addFolder();
812     //! Deletes the current folder
813     void deleteFolder();
814 
815     //! Ask confirmation from user, deletes the folder f if user confirms and returns true, otherwise returns false;
816     bool deleteFolder(Folder *f);
817 
818     //! Deletes the currently selected items from the list view #lv.
819     void deleteSelectedItems();
820 
821     //! Sets all items in the folders list view to be deactivated
822     void deactivateFolders();
823 
824     //! Changes the current folder
825     bool changeFolder(Folder *newFolder, bool force = false);
826 
827     //! Changes the current folder when the user changes the current item in the QListView "folders"
828     void folderItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
829     //! Changes the current folder when the user double-clicks on a folder item in the QListView "lv"
830     void folderItemDoubleClicked(QTreeWidgetItem *it, int column);
831 
832     //!  creates and opens the context menu of a folder list view item
833     /**
834      * \param it list view item
835      * \param p mouse global position
836      * \param fromFolders: true means that the user clicked right mouse buttom on an item from
837      *QListView "folders" false means that the user clicked right mouse buttom on an item from
838      *QListView "lv"
839      */
840     QMenu *showFolderPopupMenuImpl(QTreeWidgetItem *, bool fromFolders);
841     //!  connected to the SIGNAL contextMenuRequested from the list views
842     void showFolderPopupMenu(const QPoint &p, bool fromFolders = true);
843 
844     //!  starts renaming the selected folder by creating a built-in text editor
845     void startRenameFolder();
846 
847     //  //!  starts renaming the selected folder by creating a built-in text editor
848     void startRenameFolder(QTreeWidgetItem *item, int);
849 
850     //!  checks whether the new folder name is valid and modifies the name
851     void renameFolder(QTreeWidgetItem *it, int col, const QString &);
852 
853     //!  forces showing all windows in the current folder and subfolders, depending on the user's viewing policy
854     void showAllFolderWindows();
855 
856     //!  forces hidding all windows in the current folder and subfolders, depending on the user's viewing policy
857     void hideAllFolderWindows();
858 
859     //!  hides all windows in folder f
860     void hideFolderWindows(Folder *f);
861 
862     //!  pops up folder information
863     void folderProperties();
864 
865     //!  pops up information about the selected window item
866     void windowProperties();
867 
868     //!  pops up information about the current project
869     void projectProperties();
870 
871     //! Pops up a file dialog and invokes appendProject(const QString&) on the result.
872     void appendProject();
873     //! Open the specified project file and add it as a subfolder to the current folder.
874     void appendProject(const QString &file_name);
875     void saveAsProject();
876     void saveFolderAsProject(Folder *f);
877     void saveFolder(Folder *folder, const QString &fn);
878     void rawSaveFolder(Folder *folder, QIODevice *device);
879 
880     //!  adds a folder list item to the list view "lv"
881     void addFolderListViewItem(Folder *f);
882 
883     //!  adds a widget list item to the list view "lv"
884     void addListViewItem(MyWidget *w);
885 
886     //!  hides or shows windows in the current folder and changes the view windows policy
887     void setShowWindowsPolicy(bool);
888 
889     //!  returns a pointer to the root project folder
890     Folder *projectFolder();
891 
892     //!  used by the findDialog
893     void find(const QString &s, bool windowNames, bool labels, bool folderNames, bool caseSensitive,
894               bool partialMatch, bool subfolders);
895 
896     //!  initializes the list of items dragged by the user
dragFolderItems(QList<QTreeWidgetItem * > items)897     void dragFolderItems(QList<QTreeWidgetItem *> items) { draggedItems = items; };
898 
899     //!  Drop the objects in the list draggedItems to the folder of the destination item
900     void dropFolderItems(QTreeWidgetItem *dest);
901 
902     //!  moves a folder item to another
903     /**
904      * \param src source folder item
905      * \param dest destination folder item
906      */
907     void moveFolder(FolderListItem *src, FolderListItem *dest);
908     //@}
909 
910     //! \name Scripting
911     //@{
912     //! notify the user that an error occured in the scripting system
913     void scriptError(const QString &message, const QString &scriptName, int lineNumber);
914     //! execute all notes marked auto-exec
915     void executeNotes();
916     //! show scripting language selection dialog
917     void showScriptingLangDialog();
918     //! create a new environment for the current scripting language
919     void restartScriptingEnv();
920     //! print to scripting console (if available) or to stdout
921     void scriptPrint(const QString &text);
922     //! switches to the given scripting language; if this is the same as the current one and force is true, restart it
923     bool setScriptingLang(const QString &lang, bool force = false, bool batch = false);
setScriptingLangForBatch(const QString & lang)924     void setScriptingLangForBatch(const QString &lang) { setScriptingLang(lang, false, true); }
925     //@}
926 
927 signals:
928     void modified();
929 
930 private slots:
931     void showHelp();
932     void chooseHelpFolder();
933 
934     // TODO: a lot of this stuff should be private
935 public:
936     //! Last selected filter in export image dialog
937     QString d_image_export_filter;
938     bool d_keep_plot_aspect;
939     int d_export_vector_size;
940     bool d_export_transparency;
941     int d_export_quality;
942     int d_export_resolution;
943     bool d_export_color;
944     //! Default paper orientation for image exports.
945     int d_export_orientation;
946     //! Locale used to specify the decimal separators in imported ASCII files
947     QLocale d_ASCII_import_locale;
948     //! Last selected filter in import ASCII dialog
949     QString d_ASCII_file_filter;
950     bool d_convert_to_numeric;
951     //! Specifies if only the Tables/Matrices in the current folder should be displayed in the Add/remove curve dialog.
952     bool d_show_current_folder;
953     bool d_scale_plots_on_print, d_print_cropmarks;
954     bool d_show_table_comments;
955     bool d_extended_plot_dialog;
956     bool d_extended_import_ASCII_dialog;
957     bool d_extended_export_dialog;
958     bool d_extended_open_dialog;
959     bool generateUniformFitPoints;
960     bool generatePeakCurves;
961     QColor peakCurvesColor;
962     //! User defined size for the Add/Remove curves dialog
963     QSize d_add_curves_dialog_size;
964 
965     //! Scale the errors output in fit operations with reduced chi^2
966     bool fit_scale_errors;
967 
968     //! Number of points in a generated fit curve
969     int fitPoints;
970 
971     //! Calculate only 2 points in a generated linear fit function curve
972     bool d_2_linear_fit_points;
973 
974     bool pasteFitResultsToPlot;
975 
976     //! Write fit output information to Result Log
977     bool writeFitResultsToLog;
978 
979     //! precision used for the output of the fit operations
980     int fit_output_precision;
981 
982     //! default precision to be used for all other operations than fitting
983     int d_decimal_digits;
984 
985     char d_default_numeric_format;
986 
987     //! pointer to the current folder in the project
988     Folder *current_folder;
989     //! Describes which windows are shown when the folder becomes the current folder
990     ShowWindowsPolicy show_windows_policy;
991     enum { MaxRecentProjects = 10 };
992     //! File version code used when opening project files (= maj * 100 + min * 10 + patch)
993     int d_file_version;
994 
995     QColor workspaceColor, panelsColor, panelsTextColor;
996     QString appStyle, workingDir;
997 
998     //! Path to the folder where the last template file was opened/saved
999     QString templatesDir;
1000     bool smooth3DMesh, autoScaleFonts, autoResizeLayers;
1001 #ifdef SEARCH_FOR_UPDATES
1002     bool autoSearchUpdates;
1003 #endif
1004     bool confirmCloseTable, confirmCloseMatrix, confirmClosePlot2D, confirmClosePlot3D;
1005     bool confirmCloseFolder, confirmCloseNotes;
1006     bool canvasFrameOn, titleOn, autoSave, drawBackbones, allAxesOn, autoscale2DPlots,
1007             antialiasing2DPlots;
1008     int majTicksStyle, minTicksStyle, legendFrameStyle, autoSaveTime, axesLineWidth,
1009             canvasFrameWidth;
1010     QColor legendBackground, legendTextColor, defaultArrowColor;
1011     int defaultArrowLineWidth, defaultArrowHeadLength, defaultArrowHeadAngle;
1012     bool defaultArrowHeadFill;
1013     Qt::PenStyle defaultArrowLineStyle;
1014     int majTicksLength, minTicksLength, defaultPlotMargin;
1015     int defaultCurveStyle, defaultCurveLineWidth, defaultSymbolSize;
1016     int undoLimit;
1017     QFont appFont, plot3DTitleFont, plot3DNumbersFont, plot3DAxesFont;
1018     QFont tableTextFont, tableHeaderFont, plotAxesFont, plotLegendFont, plotNumbersFont,
1019             plotTitleFont;
1020     QColor tableBkgdColor, tableTextColor, tableHeaderColor;
1021     QString projectname, columnSeparator, appLanguage;
1022     QString configFilePath, logInfo, fitPluginsPath, asciiDirPath, imagesDirPath;
1023     int logID, asciiID, closeID, exportID, printAllID, ignoredLines, savingTimerId,
1024             plot3DResolution;
1025     bool renameColumns, copiedLayer, strip_spaces, simplify_spaces;
1026     QStringList recentProjects;
1027     QStringList tableWindows();
1028     bool saved, showPlot3DProjection, showPlot3DLegend, orthogonal3DPlots = false, autoscale3DPlots;
1029     QStringList plot3DColors, locales;
1030     QStringList functions; // user-defined functions;
1031     QStringList xFunctions, yFunctions, rFunctions,
1032             thetaFunctions; // user functions for parametric and polar plots
1033     QStringList fitFunctions; // user-defined fit functions;
1034     QStringList surfaceFunc; // user-defined surface functions;
1035 
1036     //! List of tables and matrices renamed in order to avoid conflicts when appending a project to a folder
1037     QStringList renamedTables;
1038     Graph::MarkerType copiedMarkerType;
1039 
1040     //! \name variables used when user copy/paste markers
1041     //@{
1042     QString auxMrkText;
1043     QFont auxMrkFont;
1044     QColor auxMrkColor, auxMrkBkgColor;
1045     QPoint auxMrkStart, auxMrkEnd;
1046     Qt::PenStyle auxMrkStyle;
1047     QString auxMrkFileName;
1048     int auxMrkBkg, auxMrkWidth;
1049     //@}
1050 
1051     bool startArrowOn, endArrowOn, fillArrowHead;
1052     int arrowHeadLength, arrowHeadAngle, specialPlotMenuID, statMenuID, panelMenuID, plot3dID;
1053     int plotMenuID, newMenuID, recentMenuID, setAsMenuID, fillMenuID;
1054     int translateMenuID, smoothMenuID, filterMenuID, fitExpMenuID, multiPeakMenuID;
1055 
1056 #ifdef SEARCH_FOR_UPDATES
1057     //! Equals true if an automatical search for updates was performed on start-up otherwise is set to false;
1058     bool autoSearchUpdatesRequest;
1059 #endif
1060 
1061     //! The scripting language to use for new projects.
1062     QString defaultScriptingLang;
1063     /// location of translation resources
1064     QString qmPath;
1065 
1066 protected:
1067     //! Show a context menu for the widget
1068     QMenu *showWindowMenuImpl(MyWidget *widget);
showWindowMenu(MyWidget * widget)1069     void showWindowMenu(MyWidget *widget) { showWindowMenuImpl(widget)->exec(QCursor::pos()); }
1070 
1071 private:
1072     bool m_batch;
1073 
1074     //! Create a menu for toggeling the toolbars
1075     QMenu *createToolbarsMenu();
1076 
1077     //! Check whether a table is valid for a 3D plot and display an appropriate error if not
1078     bool validFor3DPlot(Table *table);
1079     //! Check whether a table is valid for a 2D plot and display an appropriate error if not
1080     bool validFor2DPlot(Table *table, int type);
1081 
1082     //! Workaround for the new colors introduced in rev 447
1083     unsigned int convertOldToNewColorIndex(unsigned int cindex);
1084 
1085     //! Stores the pointers to the dragged items from the FolderListViews objects
1086     QList<QTreeWidgetItem *> draggedItems;
1087 
1088     QString helpFilePath;
1089 
1090 #ifdef SEARCH_FOR_UPDATES
1091     //! Used when checking for new versions
1092     QNetworkAccessManager http;
1093     //! Used when checking for new versions
1094     QByteArray version_buffer;
1095 #endif
1096 
1097     Graph *lastCopiedLayer;
1098     QSplitter *explorerSplitter;
1099 
1100     QMenu *windowsMenu, *view, *graph, *file, *format, *calcul, *edit, *dataMenu, *recent,
1101             *exportPlot, *toolbarsMenu;
1102     QMenu *d_quick_fit_menu;
1103     QMenu *help, *type, *plot2D, *plot3D, *specialPlot, *panels, *stat, *decay, *filter;
1104     QMenu *matrixMenu, *plot3DMenu, *plotDataMenu, *tableMenu;
1105     QMenu *smooth, *translateMenu, *multiPeakMenu;
1106     QMenu *scriptingMenu;
1107     QAction *actionCopyStatusBarText;
1108     QAction *actionEditCurveRange, *actionCurveFullRange, *actionShowAllCurves, *actionHideCurve,
1109             *actionHideOtherCurves;
1110     QAction *actionEditFunction, *actionRemoveCurve, *actionShowCurveWorksheet,
1111             *actionShowCurvePlotDialog;
1112     QAction *actionNewProject, *actionNewNote, *actionNewTable, *actionNewFunctionPlot,
1113             *actionNewSurfacePlot, *actionNewMatrix, *actionNewGraph;
1114     QAction *actionOpen, *actionLoadImage, *actionSaveProject, *actionSaveProjectAs,
1115             *actionImportImage;
1116     QAction *actionLoad, *actionUndo, *actionRedo;
1117     QAction *actionCopyWindow;
1118     QAction *actionCutSelection, *actionCopySelection, *actionPasteSelection, *actionClearSelection;
1119     QAction *locktoolbar;
1120     QAction *actionShowExplorer, *actionShowLog, *actionAddLayer, *actionShowLayerDialog,
1121             *actionAutomaticLayout;
1122     QAction *actionShowHistory;
1123 #ifdef SCRIPTING_CONSOLE
1124     QAction *actionShowConsole;
1125 #endif
1126 
1127     QAction *actionExportGraph, *actionExportAllGraphs, *actionPrint, *actionPrintAllPlots,
1128             *actionShowExportASCIIDialog;
1129     QAction *actionExportPDF;
1130     QAction *actionCloseAllWindows, *actionClearLogInfo, *actionShowPlotWizard,
1131             *actionShowConfigureDialog;
1132     QAction *actionShowCurvesDialog, *actionAddErrorBars, *actionAddFunctionCurve, *actionUnzoom,
1133             *actionNewLegend, *actionAddImage, *actionAddText;
1134     QAction *actionPlotL, *actionPlotP, *actionPlotLP, *actionPlotVerticalDropLines,
1135             *actionPlotSpline;
1136     QAction *actionPlotVertSteps, *actionPlotHorSteps, *actionPlotVerticalBars;
1137     QAction *actionPlotHorizontalBars, *actionPlotArea, *actionPlotPie, *actionPlotVectXYAM,
1138             *actionPlotVectXYXY;
1139     QAction *actionPlotHistogram, *actionPlotStackedHistograms, *actionPlot2VerticalLayers,
1140             *actionPlot2HorizontalLayers, *actionPlot4Layers, *actionPlotStackedLayers;
1141     QAction *actionPlot3DRibbon, *actionPlot3DBars, *actionPlot3DScatter, *actionPlot3DTrajectory;
1142     QAction *actionShowColStatistics, *actionShowRowStatistics, *actionShowIntDialog;
1143     QAction *actionDifferentiate, *actionFitLinear, *actionShowFitPolynomDialog;
1144     QAction *actionShowExpDecayDialog, *actionShowTwoExpDecayDialog, *actionShowExpDecay3Dialog;
1145     QAction *actionFitExpGrowth, *actionFitSigmoidal, *actionFitGauss, *actionFitLorentz,
1146             *actionShowFitDialog;
1147     QAction *actionShowAxisDialog, *actionShowTitleDialog;
1148     QAction *actionAbout;
1149     QAction *actionShowHelp;
1150 #ifdef DYNAMIC_MANUAL_PATH
1151     QAction *actionChooseHelpFolder;
1152 #endif
1153     QAction *actionRename, *actionCloseWindow, *actionConvertTable;
1154     QAction *actionAddColToTable, *actionDeleteLayer, *actionInterpolate;
1155     QAction *actionResizeActiveWindow, *actionHideActiveWindow;
1156     QAction *actionShowMoreWindows, *actionPixelLineProfile, *actionIntensityTable;
1157     QAction *actionShowLineDialog, *actionShowImageDialog, *actionShowTextDialog;
1158     QAction *actionActivateWindow, *actionMinimizeWindow, *actionMaximizeWindow,
1159             *actionResizeWindow, *actionPrintWindow;
1160     QAction *actionShowPlotGeometryDialog, *actionEditSurfacePlot, *actionAdd3DData;
1161     QAction *actionMatrixDeterminant;
1162     QAction *actionConvertMatrix, *actionInvertMatrix;
1163     QAction *actionPlot3DWireFrame, *actionPlot3DHiddenLine, *actionPlot3DPolygons,
1164             *actionPlot3DWireSurface;
1165     QAction *actionColorMap, *actionContourMap, *actionGrayMap;
1166     QAction *actionDeleteFitTables, *actionShowGridDialog, *actionTimeStamp;
1167     QAction *actionSmoothSavGol, *actionSmoothFFT, *actionSmoothAverage, *actionFFT;
1168     QAction *actionLowPassFilter, *actionHighPassFilter, *actionBandPassFilter,
1169             *actionBandBlockFilter;
1170     QAction *actionConvolute, *actionDeconvolute, *actionCorrelate, *actionAutoCorrelate;
1171     QAction *actionTranslateHor, *actionTranslateVert;
1172     QAction *actionBoxPlot, *actionMultiPeakGauss, *actionMultiPeakLorentz;
1173 #ifdef SEARCH_FOR_UPDATES
1174     QAction *actionCheckUpdates;
1175 #endif
1176     QAction *actionHomePage;
1177 #ifdef DOWNLOAD_LINKS
1178     QAction *actionDownloadManual;
1179 #endif
1180     QAction *actionHelpForums;
1181     QAction *actionHelpBugReports;
1182     QAction *actionShowPlotDialog, *actionShowScaleDialog, *actionOpenTemplate, *actionSaveTemplate;
1183     QAction *actionNextWindow;
1184     QAction *actionPrevWindow;
1185     QAction *actionScriptingLang, *actionRestartScripting, *actionClearTable, *actionGoToCell;
1186     QAction *actionNoteExecute, *actionNoteExecuteAll, *actionNoteEvaluate, *actionSaveNote;
1187     QAction *actionAnimate, *actionPerspective, *actionFitFrame, *actionResetRotation;
1188 
1189     QActionGroup *dataTools;
1190     QAction *btnCursor, *btnSelect, *btnPicker, *btnRemovePoints, *btnMovePoints;
1191     QAction *btnZoomIn, *btnZoomOut, *btnPointer, *btnLine, *btnArrow;
1192 
1193     QActionGroup *coord;
1194     QAction *Box;
1195     QAction *Frame;
1196     QAction *None;
1197 
1198     QActionGroup *grids;
1199     QAction *front;
1200     QAction *back;
1201     QAction *right;
1202     QAction *left;
1203     QAction *ceil;
1204     QAction *floor;
1205 
1206     QActionGroup *floorstyle;
1207     QAction *floordata;
1208     QAction *flooriso;
1209     QAction *floornone;
1210 
1211     QActionGroup *plotstyle;
1212     QAction *wireframe;
1213     QAction *hiddenline;
1214     QAction *polygon;
1215     QAction *filledmesh;
1216     QAction *pointstyle;
1217     QAction *barstyle;
1218     QAction *conestyle, *crossHairStyle;
1219 
1220     //! Manages connection between plot actions and Graph::CurveType values (not used by all plot actions).
1221     QSignalMapper *d_plot_mapper;
1222 
1223     QLabel *d_status_info;
1224 
1225     Project *d_project;
1226 
1227 private slots:
1228     void removeDependentTableStatistics(const AbstractAspect *aspect);
1229     //! Set the active window selected from the context menu's dependency list
1230     /**
1231      * See also: http://doc.trolltech.com/4.3/mainwindows-recentfiles-mainwindow-cpp.html
1232      */
1233     void setActiveWindowFromAction();
1234     //! Manage plot type selection.
1235     /**
1236      * If the current window is a Table, generate a new graph from the selected data.
1237      * If it is a Graph, change the plot type of the last curve.
1238      * For everything else, do nothing.
1239      */
1240     void selectPlotType(int type);
1241 
1242     void handleAspectAdded(const AbstractAspect *aspect, int index);
1243     void handleAspectAboutToBeRemoved(const AbstractAspect *aspect, int index);
1244 protected slots:
1245     void lockToolbar(const bool status);
1246 };
1247 
1248 #endif
1249