QtiPlot  0.9.8.2
PlotDialog.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : PlotDialog.h
3  Project : QtiPlot
4  --------------------------------------------------------------------
5  Copyright : (C) 2006 - 2011 by Ion Vasilief
6  Email (use @ for *) : ion_vasilief*yahoo.fr
7  Description : Custom curves dialog
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  * This program is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21  * GNU General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU General Public License *
24  * along with this program; if not, write to the Free Software *
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26  * Boston, MA 02110-1301 USA *
27  * *
28  ***************************************************************************/
29 #ifndef PLOTDIALOG_H
30 #define PLOTDIALOG_H
31 
32 #include <QDialog>
33 #include <QTreeWidgetItem>
34 #include <MultiLayer.h>
35 
36 class QCheckBox;
37 class QComboBox;
38 class QCompleter;
39 class QLabel;
40 class QLineEdit;
41 class QListWidget;
42 class QPushButton;
43 class QSpinBox;
44 class QTabWidget;
45 class QWidget;
46 class QStringList;
47 class QGroupBox;
48 class QDoubleSpinBox;
49 class QRadioButton;
50 class QTreeWidget;
51 class QSlider;
52 
53 class LayerItem;
54 class CurveTreeItem;
55 class ColorBox;
56 class PatternBox;
57 class ColorButton;
58 class MultiLayer;
59 class SymbolBox;
60 class ColorMapEditor;
61 class QwtPlotItem;
62 class DoubleSpinBox;
63 class PenStyleBox;
64 class Spectrogram;
65 class ErrorBarsCurve;
66 class BoxCurve;
67 class DataCurve;
68 class ContourLinesEditor;
69 class FunctionDialog;
70 class EnrichmentDialog;
71 
73 class PlotDialog : public QDialog
74 {
75  Q_OBJECT
76 
77 public:
78  PlotDialog(bool showExtended, QWidget* parent = 0, Qt::WFlags fl = 0 );
79  void initFonts(const QFont& titlefont, const QFont& axesfont, const QFont& numbersfont, const QFont& legendfont);
80  void insertColumnsList(const QStringList& names){columnNames = names;};
81  void setMultiLayer(MultiLayer *ml);
82  void selectMultiLayerItem();
83 
84 public slots:
85  void showAll(bool all);
86  void selectCurve(int index);
87 
88 private slots:
89  void showBoxStatistics();
90  void showStatistics();
91  void customVectorsPage(bool angleMag);
92  void updateEndPointColumns(const QString& text);
93 
94  void fillBoxSymbols();
95  void fillSymbols();
96  bool acceptParams();
97  void showWorksheet();
98  void quit();
99 
100  int setPlotType(CurveTreeItem *item);
101  void changePlotType(int plotType);
102  void setActiveCurve(CurveTreeItem *item);
103 
104  void raiseCurve();
105  void shiftCurveBy(int offset = 1);
106 
107  void insertTabs(int plot_type);
108  void updateTabWindow(QTreeWidgetItem *currentItem, QTreeWidgetItem *previousItem);
109  void showAreaColor(bool show);
110 
111  void removeSelectedObject();
112 
113  void chooseBackgroundImageFile(const QString& fn = QString());
114  void resizeCanvasToFitImage();
115 
116  void chooseSymbolImageFile();
117 
118  void pickErrorBarsColor();
119  void enableBoxApplyColor(int);
120 
121  void setAutomaticBinning(bool on = true);
122 
123  //box plots
124  void setBoxType(int index);
125  void setBoxRangeType(int index);
126  void setWhiskersRange(int index);
127  void enableLabelsPage();
128 
129  //spectrograms
130  void showDefaultContourLinesBox(bool show);
131  void showColorMapEditor(bool show);
132 
133  //layer geometry
134  void adjustLayerHeight(double width);
135  void adjustLayerWidth(double height);
136  void displayCoordinates(int unit, Graph *g = 0);
137  //plot window geometry
138  void displayPlotCoordinates(int unit);
139  void adjustPlotWidth(double height);
140  void adjustPlotHeight(double width);
141 
142  void setCanvasDefaultValues();
143 
144  void setActiveLayer(LayerItem *item);
145  void updateTreeWidgetItem(QTreeWidgetItem *item);
146  void updateVisibility();
147  void updateVisibility(QTreeWidgetItem *item, int column);
148  void updateBackgroundTransparency(int alpha);
149  void updateCanvasTransparency(int alpha);
150  void setTitlesFont();
151  void setAxesLabelsFont();
152  void setAxesNumbersFont();
153  void setLegendsFont();
154  void editCurve();
155  void editCurveRange();
156  void chooseLabelsFont();
157  void applyLayerFormat();
158  void applyCanvasFormat();
159  void setLayerDefaultValues();
160  void setEquidistantLevels();
161  void showCustomPenColumn(bool on);
163 
164 private:
165  void resizeLayerToFitImage(Graph *g);
167  void applyCanvasSize();
168 
169  void applyFormatToLayer(Graph *g);
170  void applySymbolsFormatToCurve(QwtPlotCurve *c, bool fillColor = true, bool penColor = true);
172  void applySymbolsFormat(QwtPlotCurve *c);
173 
174  void applyLineFormatToLayer(Graph *g);
175  void applyLineFormat(QwtPlotCurve *c);
176 
177  void applyErrorBarFormatToCurve(ErrorBarsCurve *err, bool color = true);
180 
184 
188 
189  void applyLabelsFormatToItem(QwtPlotItem *);
191  void applyLabelsFormat(QwtPlotItem *);
192 
193  void applyGapToLayer(Graph *g);
194  void applyGap(Graph *g);
195 
196  void setLabelsFont(const QFont& font, Graph *, const QwtPlotItem *);
197  void setLabelsFontToPlotItem(const QFont& font, const QwtPlotItem *);
198  void setLabelsFontToLayer(const QFont& font, Graph *);
199 
200  int labelsAlignment();
201  void closeEvent(QCloseEvent* e);
202 
203  void clearTabWidget();
204  void initAxesPage();
205  void initLinePage();
206  void initSymbolsPage();
207  void initHistogramPage();
208  void initErrorsPage();
209  void initSpacingPage();
210  void initVectPage();
211  void initBoxPage();
212  void initPercentilePage();
213  void initSpectrogramPage();
215  void initContourLinesPage();
216  void initLayerPage();
217  void initCanvasPage();
218  void initLayerGeometryPage();
219  void initPlotGeometryPage();
220  void initLayerDisplayPage();
221  void initLayerSpeedPage();
222  void initFontsPage();
223  void initMiscPage();
224  void initPiePage();
225  void initPieGeometryPage();
226  void initPieLabelsPage();
227  void initPrintPage();
228  void initLabelsPage();
229  void initFunctionPage();
230  void contextMenuEvent(QContextMenuEvent *e);
231  void showAllLabelControls(bool show = true, int curveType = 0);
233  QRect layerCanvasRect(QWidget *widget, double x, double y, double w, double h, FrameWidget::Unit unit);
234 
236 
238 
240  QStringList columnNames;
241 
243  QCheckBox *keepRatioBox;
244 
249  QTreeWidget* listBox;
253  QSpinBox *boxRadius;