SciDAVis  1.D4
PlotDialog.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : PlotDialog.h
3  Project : SciDAVis
4  --------------------------------------------------------------------
5  Copyright : (C) 2006 by Ion Vasilief, Tilman Benkert
6  Email (use @ for *) : ion_vasilief*yahoo.fr, thzs*gmx.net
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 QLabel;
39 class QLineEdit;
40 class QListWidget;
41 class QPushButton;
42 class QSpinBox;
43 class QTabWidget;
44 class QWidget;
45 class QStringList;
46 class QGroupBox;
47 class QDoubleSpinBox;
48 class QRadioButton;
49 class QTreeWidget;
50 
51 class LayerItem;
52 class CurveTreeItem;
53 class ColorBox;
54 class PatternBox;
55 class ColorButton;
56 class MultiLayer;
57 class SymbolBox;
58 class ColorMapEditor;
59 class QwtPlotItem;
60 
62 class PlotDialog : public QDialog
63 {
64  Q_OBJECT
65 
66  public:
67  PlotDialog(bool showExtended, QWidget* parent = 0, Qt::WFlags fl = 0 );
68  void initFonts(const QFont& titlefont, const QFont& axesfont, const QFont& numbersfont, const QFont& legendfont);
69  void insertColumnsList(const QStringList& names){columnNames = names;};
70  void setMultiLayer(MultiLayer *ml);
71 
72  public slots:
73  void showAll(bool all);
74  void selectCurve(int index);
75 
76  private slots:
77  void showStatistics();
78  void customVectorsPage(bool angleMag);
79  void updateEndPointColumns(const QString& text);
80 
81  void fillBoxSymbols();
82  void fillSymbols();
83  bool acceptParams();
84  void showWorksheet();
85  void quit();
86 
87  int setPlotType(CurveTreeItem *item);
88  void changePlotType(int plotType);
89  void setActiveCurve(CurveTreeItem *item);
90 
91  void insertTabs(int plot_type);
92  void updateTabWindow(QTreeWidgetItem *currentItem, QTreeWidgetItem *previousItem);
93  void showAreaColor(bool show);
94 
95  void removeSelectedCurve();
96 
97  /******* error bars options **************/
98  void pickErrorBarsColor();
99  void changeErrorBarsType();
100  void changeErrorBarsPlus();
101  void changeErrorBarsMinus();
102  void changeErrorBarsThrough();
103 
104  void setAutomaticBinning();
105  bool validInput();
106  void showPlotAssociations(QTreeWidgetItem *item, int);
107 
108  void setPenStyle(Qt::PenStyle style);
109  void setPiePenStyle(const Qt::PenStyle& style);
110 
111  //box plots
112  void setBoxType(int index);
113  void setBoxRangeType(int index);
114  void setWhiskersRange(int index);
115 
116  //spectrograms
117  void pickContourLinesColor();
118  void showDefaultContourLinesBox(bool show);
119  void showColorMapEditor(bool show);
120 
121  protected slots:
122  void setActiveLayer(LayerItem *item);
123  void updateTreeWidgetItem(QTreeWidgetItem *item);
124  void updateBackgroundTransparency(int alpha);
125  void updateCanvasTransparency(int alpha);
126  void updateAntialiasing(bool on);
127  void updateBorder(int width);
128  void pickBackgroundColor();
129  void pickCanvasColor();
130  void pickBorderColor();
131  void changeMargin(int);
132  void setTitlesFont();
133  void setAxesLabelsFont();
134  void setAxesNumbersFont();
135  void setLegendsFont();
136  void editCurve();
137 
138  private:
139  void closeEvent(QCloseEvent* e);
140 
141  void clearTabWidget();
142  void initAxesPage();
143  void initLinePage();
144  void initSymbolsPage();
145  void initHistogramPage();
146  void initErrorsPage();
147  void initSpacingPage();
148  void initVectPage();
149  void initBoxPage();
150  void initPercentilePage();
151  void initSpectrogramPage();
152  void initLayerPage();
153  void initFontsPage();
154  void initPiePage();
155  void initPrintPage();
156  void contextMenuEvent(QContextMenuEvent *e);
157 
159 
161  QStringList columnNames;
162 
166  QTreeWidget* listBox;
173  QComboBox* boxPieLineStyle;
174 
175  QPushButton* buttonApply, *btnWorksheet;
176  QPushButton* buttonOk, *btnMore;
177  QPushButton* buttonCancel;
178  QComboBox* boxPlotType;
179  QWidget* linePage;
180  QComboBox* boxConnect;
181  QComboBox* boxLineStyle;
184  QWidget* symbolPage;
185  QSpinBox* boxSymbolSize;
189  QTabWidget* privateTabWidget;
191  QGroupBox* fillGroupBox;
192  QCheckBox* plusBox;
193  QCheckBox* minusBox;
194  QCheckBox* xBox;
197  QComboBox* widthBox;
198  QComboBox* capBox;
199  QCheckBox* throughBox;
201  QGroupBox* GroupBoxH;
204  QCheckBox *automaticBox;
206  QSpinBox* gapBox, *offsetBox, *boxWidth;
210  QCheckBox *filledHeadBox;
216  QGroupBox *GroupBoxVectEnd;
220  QGroupBox *defaultPenBox;
222 
224  QDoubleSpinBox *whiskerCnt, *boxCnt;
225 };
226 
227 /*****************************************************************************
228  *
229  * Class LayerItem
230  *
231  *****************************************************************************/
233 class LayerItem : public QTreeWidgetItem
234 {
235  public:
236  enum {LayerTreeItem = 1001};
237  LayerItem(Graph *g, QTreeWidgetItem *parent, const QString& s);
238 
239  Graph *graph() { return d_graph; };
240  void setActive(bool select);
241 
242  protected:
243  void insertCurvesList();
245 };
246 
247 /*****************************************************************************
248  *
249  * Class CurveTreeItem
250  *
251  *****************************************************************************/
253 class CurveTreeItem : public QTreeWidgetItem
254 {
255  public:
256  enum {PlotCurveTreeItem = 1002};
257  CurveTreeItem(const QwtPlotItem *curve, LayerItem *parent, const QString& s);
258 
259  Graph* graph(){return ((LayerItem *)parent())->graph();};
260  void setActive(bool on);
261 
262  const QwtPlotItem *plotItem() { return d_curve; };
263  int plotItemType();
264  int plotItemIndex();
265 
266  protected:
267  const QwtPlotItem *d_curve;
268 };
269 
270 #endif