~valavanisalex/ubuntu/maverick/scidavis/fix-604811

« back to all changes in this revision

Viewing changes to scidavis/src/PlotDialog.h

  • Committer: Bazaar Package Importer
  • Author(s): Ruben Molina
  • Date: 2009-09-06 11:34:04 UTC
  • Revision ID: james.westby@ubuntu.com-20090906113404-4awaey82l3686w4q
Tags: upstream-0.2.3
ImportĀ upstreamĀ versionĀ 0.2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
61
//! Custom plot/curves dialog
 
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
 
 
158
                QFont titleFont, legendFont, axesFont, numbersFont;
 
159
 
 
160
                MultiLayer *d_ml;
 
161
                QStringList columnNames;
 
162
 
 
163
                QPushButton *btnTitle, *btnAxesLabels, *btnAxesNumbers, *btnLegend;
 
164
                ColorMapEditor *colorMapEditor;
 
165
                QWidget *curvePlotTypeBox, *layerPage, *piePage, *fontsPage, *printPage;
 
166
                QTreeWidget* listBox;
 
167
                QCheckBox *boxAntialiasing, *boxAll, *boxScaleLayers, *boxPrintCrops;
 
168
                ColorButton *boxBorderColor, *boxBackgroundColor, *boxCanvasColor;
 
169
                QSpinBox *boxBackgroundTransparency, *boxCanvasTransparency, *boxBorderWidth, *boxMargin;
 
170
                QSpinBox *boxRadius, *boxPieLineWidth;
 
171
                ColorBox *boxFirstColor, *boxPieLineColor;
 
172
                PatternBox *boxPiePattern;
 
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;
 
182
                QSpinBox* boxLineWidth, *boxPenWidth;
 
183
                ColorBox* boxLineColor, *boxAreaColor;
 
184
                QWidget* symbolPage;
 
185
                QSpinBox* boxSymbolSize;
 
186
                ColorBox* boxSymbolColor,*boxFillColor;
 
187
                SymbolBox* boxSymbolStyle;
 
188
                PatternBox *boxPattern;
 
189
                QTabWidget* privateTabWidget;
 
190
                QWidget *errorsPage, *spectrogramPage;
 
191
                QGroupBox* fillGroupBox;
 
192
                QCheckBox* plusBox;
 
193
                QCheckBox* minusBox;
 
194
                QCheckBox* xBox;
 
195
                ColorButton *colorBox, *levelsColorBox;
 
196
                ColorBox* vectColorBox;
 
197
                QComboBox* widthBox;
 
198
                QComboBox* capBox;
 
199
                QCheckBox* throughBox;
 
200
                QLabel *labelPosition, *labelXEnd, *labelYEnd;
 
201
                QGroupBox* GroupBoxH;
 
202
                QWidget *histogramPage, *spacingPage;
 
203
                QLineEdit *binSizeBox, *histogramBeginBox, *histogramEndBox;
 
204
                QCheckBox *automaticBox;
 
205
                QPushButton* buttonStatistics, *btnEditCurve;
 
206
                QSpinBox* gapBox, *offsetBox, *boxWidth;
 
207
                QWidget *vectPage, *boxPage, *percentilePage, *axesPage;
 
208
                QComboBox *xEndBox, *yEndBox, *boxType, *boxWhiskersType, *boxWhiskersRange, *boxRange;
 
209
                QSpinBox* headAngleBox, *headLengthBox, *vectWidthBox, *boxPercSize, *boxEdgeWidth;
 
210
                QCheckBox *filledHeadBox;
 
211
                QSpinBox *boxCoef, *boxWhiskersCoef;
 
212
                QCheckBox *boxFillSymbols, *boxFillSymbol;
 
213
                ColorBox *boxPercFillColor, *boxEdgeColor;
 
214
                QLabel  *whiskerCoeffLabel, *whiskerRangeLabel, *boxCoeffLabel;
 
215
                QLabel *boxRangeLabel, *whiskerCntLabel, *boxCntLabel;
 
216
                QGroupBox *GroupBoxVectEnd;
 
217
                QComboBox *vectPosBox, *boxXAxis, *boxYAxis, *colorScaleBox, *boxContourStyle;
 
218
                QSpinBox *levelsBox, *contourWidthBox, *colorScaleWidthBox;
 
219
                QGroupBox *levelsGroupBox, *axisScaleBox, *imageGroupBox;
 
220
                QGroupBox *defaultPenBox;
 
221
                QRadioButton *defaultScaleBox, *grayScaleBox, *customScaleBox, *defaultContourBox, *autoContourBox;
 
222
 
 
223
                SymbolBox *boxMaxStyle, *boxMinStyle, *boxMeanStyle, *box99Style, *box1Style;
 
224
                QDoubleSpinBox *whiskerCnt, *boxCnt;
 
225
};
 
226
 
 
227
/*****************************************************************************
 
228
 *
 
229
 * Class LayerItem
 
230
 *
 
231
 *****************************************************************************/
 
232
//! LayerItem tree widget item class
 
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();
 
244
                Graph *d_graph;
 
245
};
 
246
 
 
247
/*****************************************************************************
 
248
 *
 
249
 * Class CurveTreeItem
 
250
 *
 
251
 *****************************************************************************/
 
252
//! CurveTreeItem tree widget item class
 
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