PlotDialog.h

Go to the documentation of this file.
00001 /***************************************************************************
00002     File                 : PlotDialog.h
00003     Project              : QtiPlot
00004     --------------------------------------------------------------------
00005     Copyright            : (C) 2006 by Ion Vasilief, Tilman Hoener zu Siederdissen
00006     Email (use @ for *)  : ion_vasilief*yahoo.fr, thzs*gmx.net
00007     Description          : Custom curves dialog
00008 
00009  ***************************************************************************/
00010 
00011 /***************************************************************************
00012  *                                                                         *
00013  *  This program is free software; you can redistribute it and/or modify   *
00014  *  it under the terms of the GNU General Public License as published by   *
00015  *  the Free Software Foundation; either version 2 of the License, or      *
00016  *  (at your option) any later version.                                    *
00017  *                                                                         *
00018  *  This program is distributed in the hope that it will be useful,        *
00019  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
00020  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
00021  *  GNU General Public License for more details.                           *
00022  *                                                                         *
00023  *   You should have received a copy of the GNU General Public License     *
00024  *   along with this program; if not, write to the Free Software           *
00025  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
00026  *   Boston, MA  02110-1301  USA                                           *
00027  *                                                                         *
00028  ***************************************************************************/
00029 #ifndef PLOTDIALOG_H
00030 #define PLOTDIALOG_H
00031 
00032 #include <QDialog>
00033 #include <QTreeWidgetItem>
00034 #include "MultiLayer.h"
00035 
00036 class QCheckBox;
00037 class QComboBox;
00038 class QLabel;
00039 class QLineEdit;
00040 class QListWidget;
00041 class QPushButton;
00042 class QSpinBox;
00043 class QTabWidget;
00044 class QWidget;
00045 class QStringList;
00046 class QGroupBox;
00047 class QDoubleSpinBox;
00048 class QRadioButton;
00049 class QTreeWidget;
00050 
00051 class LayerItem;
00052 class CurveTreeItem;
00053 class ColorBox;
00054 class PatternBox;
00055 class ColorButton;
00056 class MultiLayer;
00057 class SymbolBox;
00058 class ColorMapEditor;
00059 class QwtPlotItem;
00060 
00061 static const char* folder_closed[]={
00062     "16 16 9 1",
00063     "g c #808080",
00064     "b c #c0c000",
00065     "e c #c0c0c0",
00066     "# c #000000",
00067     "c c #ffff00",
00068     ". c None",
00069     "a c #585858",
00070     "f c #a0a0a4",
00071     "d c #ffffff",
00072     "..###...........",
00073     ".#abc##.........",
00074     ".#daabc#####....",
00075     ".#ddeaabbccc#...",
00076     ".#dedeeabbbba...",
00077     ".#edeeeeaaaab#..",
00078     ".#deeeeeeefe#ba.",
00079     ".#eeeeeeefef#ba.",
00080     ".#eeeeeefeff#ba.",
00081     ".#eeeeefefff#ba.",
00082     ".##geefeffff#ba.",
00083     "...##gefffff#ba.",
00084     ".....##fffff#ba.",
00085     ".......##fff#b##",
00086     ".........##f#b##",
00087     "...........####."};
00088 
00089 static const char* folder_open[]={
00090     "16 16 11 1",
00091     "# c #000000",
00092     "g c #c0c0c0",
00093     "e c #303030",
00094     "a c #ffa858",
00095     "b c #808080",
00096     "d c #a0a0a4",
00097     "f c #585858",
00098     "c c #ffdca8",
00099     "h c #dcdcdc",
00100     "i c #ffffff",
00101     ". c None",
00102     "....###.........",
00103     "....#ab##.......",
00104     "....#acab####...",
00105     "###.#acccccca#..",
00106     "#ddefaaaccccca#.",
00107     "#bdddbaaaacccab#",
00108     ".eddddbbaaaacab#",
00109     ".#bddggdbbaaaab#",
00110     "..edgdggggbbaab#",
00111     "..#bgggghghdaab#",
00112     "...ebhggghicfab#",
00113     "....#edhhiiidab#",
00114     "......#egiiicfb#",
00115     "........#egiibb#",
00116     "..........#egib#",
00117     "............#ee#"};
00118 
00120 class PlotDialog : public QDialog
00121 {
00122     Q_OBJECT
00123 
00124 public:
00125     PlotDialog(bool showExtended, QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WFlags fl = 0 );
00126     void initFonts(const QFont& titlefont, const QFont& axesfont, const QFont& numbersfont, const QFont& legendfont);
00127     void insertColumnsList(const QStringList& names){columnNames = names;};
00128     void setMultiLayer(MultiLayer *ml);
00129 
00130 public slots:
00131     void showAll(bool all);
00132     void selectCurve(int index);
00133 
00134 private slots:
00135     void showStatistics();
00136     void customVectorsPage(bool angleMag);
00137     void updateEndPointColumns(const QString& text);
00138 
00139     void fillBoxSymbols();
00140     void fillSymbols();
00141     bool acceptParams();
00142     void showWorksheet();
00143     void quit();
00144 
00145     int setPlotType(CurveTreeItem *item);
00146     void changePlotType(int plotType);
00147     void setActiveCurve(CurveTreeItem *item);
00148 
00149     void insertTabs(int plot_type);
00150     void updateTabWindow(QTreeWidgetItem *currentItem, QTreeWidgetItem *previousItem);
00151     void showAreaColor(bool show);
00152 
00153     void removeSelectedCurve();
00154 
00155     /******* error bars options **************/
00156     void pickErrorBarsColor();
00157     void changeErrorBarsType();
00158     void changeErrorBarsPlus();
00159     void changeErrorBarsMinus();
00160     void changeErrorBarsThrough();
00161 
00162     void setAutomaticBinning();
00163     bool validInput();
00164     void showPlotAssociations(QTreeWidgetItem *item, int);
00165 
00166     void setPenStyle(Qt::PenStyle style);
00167     void setPiePenStyle(const Qt::PenStyle& style);
00168 
00169     //box plots
00170     void setBoxType(int index);
00171     void setBoxRangeType(int index);
00172     void setWhiskersRange(int index);
00173 
00174     //spectrograms
00175     void pickContourLinesColor();
00176     void showDefaultContourLinesBox(bool show);
00177     void showColorMapEditor(bool show);
00178 
00179 protected slots:
00180     void setActiveLayer(LayerItem *item);
00181     void updateTreeWidgetItem(QTreeWidgetItem *item);
00182     void updateBackgroundTransparency(int alpha);
00183     void updateCanvasTransparency(int alpha);
00184     void updateAntialiasing(bool on);
00185     void updateBorder(int width);
00186     void pickBackgroundColor();
00187     void pickCanvasColor();
00188     void pickBorderColor();
00189     void changeMargin(int);
00190     void setTitlesFont();
00191     void setAxesLabelsFont();
00192     void setAxesNumbersFont();
00193     void setLegendsFont();
00194     void editCurve();
00195 
00196 private:
00197     void closeEvent(QCloseEvent* e);
00198 
00199     void clearTabWidget();
00200     void initAxesPage();
00201     void initLinePage();
00202     void initSymbolsPage();
00203     void initHistogramPage();
00204     void initErrorsPage();
00205     void initSpacingPage();
00206     void initVectPage();
00207     void initBoxPage();
00208     void initPercentilePage();
00209     void initSpectrogramPage();
00210     void initLayerPage();
00211     void initFontsPage();
00212     void initPiePage();
00213     void initPrintPage();
00214     void contextMenuEvent(QContextMenuEvent *e);
00215 
00216     QFont titleFont, legendFont, axesFont, numbersFont;
00217 
00218     MultiLayer *d_ml;
00219     QStringList columnNames;
00220 
00221     QPushButton *btnTitle, *btnAxesLabels, *btnAxesNumbers, *btnLegend;
00222     ColorMapEditor *colorMapEditor;
00223     QWidget *curvePlotTypeBox, *layerPage, *piePage, *fontsPage, *printPage;
00224     QTreeWidget* listBox;
00225     QCheckBox *boxAntialiasing, *boxAll, *boxScaleLayers, *boxPrintCrops;
00226     ColorButton *boxBorderColor, *boxBackgroundColor, *boxCanvasColor;
00227     QSpinBox *boxBackgroundTransparency, *boxCanvasTransparency, *boxBorderWidth, *boxMargin;
00228     QSpinBox *boxRadius, *boxPieLineWidth;
00229     ColorBox *boxFirstColor, *boxPieLineColor;
00230     PatternBox *boxPiePattern;
00231     QComboBox* boxPieLineStyle;
00232 
00233     QPushButton* buttonApply, *btnWorksheet;
00234     QPushButton* buttonOk, *btnMore;
00235     QPushButton* buttonCancel;
00236     QComboBox* boxPlotType;
00237     QWidget* linePage;
00238     QComboBox* boxConnect;
00239     QComboBox* boxLineStyle;
00240     QSpinBox* boxLineWidth, *boxPenWidth;
00241     ColorBox* boxLineColor, *boxAreaColor;
00242     QWidget* symbolPage;
00243     QSpinBox* boxSymbolSize;
00244     ColorBox* boxSymbolColor,*boxFillColor;
00245     SymbolBox* boxSymbolStyle;
00246     PatternBox *boxPattern;
00247     QTabWidget* privateTabWidget;
00248     QWidget *errorsPage, *spectrogramPage;
00249     QGroupBox* fillGroupBox;
00250     QCheckBox* plusBox;
00251     QCheckBox* minusBox;
00252     QCheckBox* xBox;
00253     ColorButton *colorBox, *levelsColorBox;
00254     ColorBox* vectColorBox;
00255     QComboBox* widthBox;
00256     QComboBox* capBox;
00257     QCheckBox* throughBox;
00258     QLabel *labelPosition, *labelXEnd, *labelYEnd;
00259     QGroupBox* GroupBoxH;
00260     QWidget *histogramPage, *spacingPage;
00261     QLineEdit *binSizeBox, *histogramBeginBox, *histogramEndBox;
00262     QCheckBox *automaticBox;
00263     QPushButton* buttonStatistics, *btnEditCurve;
00264     QSpinBox* gapBox, *offsetBox, *boxWidth;
00265     QWidget *vectPage, *boxPage, *percentilePage, *axesPage;
00266     QComboBox *xEndBox, *yEndBox, *boxType, *boxWhiskersType, *boxWhiskersRange, *boxRange;
00267     QSpinBox* headAngleBox, *headLengthBox, *vectWidthBox, *boxPercSize, *boxEdgeWidth;
00268     QCheckBox *filledHeadBox;
00269     QSpinBox *boxCoef, *boxWhiskersCoef;
00270     QCheckBox *boxFillSymbols, *boxFillSymbol;
00271     ColorBox *boxPercFillColor, *boxEdgeColor;
00272     QLabel  *whiskerCoeffLabel, *whiskerRangeLabel, *boxCoeffLabel;
00273     QLabel *boxRangeLabel, *whiskerCntLabel, *boxCntLabel;
00274     QGroupBox *GroupBoxVectEnd;
00275     QComboBox *vectPosBox, *boxXAxis, *boxYAxis, *colorScaleBox, *boxContourStyle;
00276     QSpinBox *levelsBox, *contourWidthBox, *colorScaleWidthBox;
00277     QGroupBox *levelsGroupBox, *axisScaleBox, *imageGroupBox;
00278     QGroupBox *defaultPenBox;
00279     QRadioButton *defaultScaleBox, *grayScaleBox, *customScaleBox, *defaultContourBox, *autoContourBox;
00280 
00281     SymbolBox *boxMaxStyle, *boxMinStyle, *boxMeanStyle, *box99Style, *box1Style;
00282     QDoubleSpinBox *whiskerCnt, *boxCnt;
00283 };
00284 
00285 /*****************************************************************************
00286  *
00287  * Class LayerItem
00288  *
00289  *****************************************************************************/
00291 class LayerItem : public QTreeWidgetItem
00292 {
00293 public:
00294     enum {LayerTreeItem = 1001};
00295     LayerItem(Graph *g, QTreeWidgetItem *parent, const QString& s);
00296 
00297     Graph *graph() { return d_graph; };
00298     void setActive(bool select);
00299 
00300 protected:
00301     void insertCurvesList();
00302     Graph *d_graph;
00303 };
00304 
00305 /*****************************************************************************
00306  *
00307  * Class CurveTreeItem
00308  *
00309  *****************************************************************************/
00311 class CurveTreeItem : public QTreeWidgetItem
00312 {
00313 public:
00314     enum {PlotCurveTreeItem = 1002};
00315     CurveTreeItem(const QwtPlotItem *curve, LayerItem *parent, const QString& s);
00316 
00317     Graph* graph(){return ((LayerItem *)parent())->graph();};
00318     void setActive(bool on);
00319 
00320     const QwtPlotItem *plotItem() { return d_curve; };
00321     int plotItemType();
00322     int plotItemIndex();
00323 
00324 protected:
00325     const QwtPlotItem *d_curve;
00326 };
00327 
00328 #endif

Generated on Mon Oct 15 06:11:42 2007 for QtiPlot by  doxygen 1.5.3