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 class DoubleSpinBox;
00061 
00062 static const char* folder_closed[]={
00063     "16 16 9 1",
00064     "g c #808080",
00065     "b c #c0c000",
00066     "e c #c0c0c0",
00067     "# c #000000",
00068     "c c #ffff00",
00069     ". c None",
00070     "a c #585858",
00071     "f c #a0a0a4",
00072     "d c #ffffff",
00073     "..###...........",
00074     ".#abc##.........",
00075     ".#daabc#####....",
00076     ".#ddeaabbccc#...",
00077     ".#dedeeabbbba...",
00078     ".#edeeeeaaaab#..",
00079     ".#deeeeeeefe#ba.",
00080     ".#eeeeeeefef#ba.",
00081     ".#eeeeeefeff#ba.",
00082     ".#eeeeefefff#ba.",
00083     ".##geefeffff#ba.",
00084     "...##gefffff#ba.",
00085     ".....##fffff#ba.",
00086     ".......##fff#b##",
00087     ".........##f#b##",
00088     "...........####."};
00089 
00090 static const char* folder_open[]={
00091     "16 16 11 1",
00092     "# c #000000",
00093     "g c #c0c0c0",
00094     "e c #303030",
00095     "a c #ffa858",
00096     "b c #808080",
00097     "d c #a0a0a4",
00098     "f c #585858",
00099     "c c #ffdca8",
00100     "h c #dcdcdc",
00101     "i c #ffffff",
00102     ". c None",
00103     "....###.........",
00104     "....#ab##.......",
00105     "....#acab####...",
00106     "###.#acccccca#..",
00107     "#ddefaaaccccca#.",
00108     "#bdddbaaaacccab#",
00109     ".eddddbbaaaacab#",
00110     ".#bddggdbbaaaab#",
00111     "..edgdggggbbaab#",
00112     "..#bgggghghdaab#",
00113     "...ebhggghicfab#",
00114     "....#edhhiiidab#",
00115     "......#egiiicfb#",
00116     "........#egiibb#",
00117     "..........#egib#",
00118     "............#ee#"};
00119 
00121 class PlotDialog : public QDialog
00122 {
00123     Q_OBJECT
00124 
00125 public:
00126     PlotDialog(bool showExtended, QWidget* parent = 0, Qt::WFlags fl = 0 );
00127     void initFonts(const QFont& titlefont, const QFont& axesfont, const QFont& numbersfont, const QFont& legendfont);
00128     void insertColumnsList(const QStringList& names){columnNames = names;};
00129     void setMultiLayer(MultiLayer *ml);
00130 
00131 public slots:
00132     void showAll(bool all);
00133     void selectCurve(int index);
00134 
00135 private slots:
00136     void showStatistics();
00137     void customVectorsPage(bool angleMag);
00138     void updateEndPointColumns(const QString& text);
00139 
00140     void fillBoxSymbols();
00141     void fillSymbols();
00142     bool acceptParams();
00143     void showWorksheet();
00144     void quit();
00145 
00146     int setPlotType(CurveTreeItem *item);
00147     void changePlotType(int plotType);
00148     void setActiveCurve(CurveTreeItem *item);
00149 
00150     void insertTabs(int plot_type);
00151     void updateTabWindow(QTreeWidgetItem *currentItem, QTreeWidgetItem *previousItem);
00152     void showAreaColor(bool show);
00153 
00154     void removeSelectedCurve();
00155 
00156     /******* error bars options **************/
00157     void pickErrorBarsColor();
00158     void changeErrorBarsType();
00159     void changeErrorBarsPlus();
00160     void changeErrorBarsMinus();
00161     void changeErrorBarsThrough();
00162 
00163     void setAutomaticBinning();
00164     bool validInput();
00165     void showPlotAssociations(QTreeWidgetItem *item, int);
00166 
00167     void setPenStyle(Qt::PenStyle style);
00168     void setPiePenStyle(const Qt::PenStyle& style);
00169 
00170     //box plots
00171     void setBoxType(int index);
00172     void setBoxRangeType(int index);
00173     void setWhiskersRange(int index);
00174 
00175     //spectrograms
00176     void showDefaultContourLinesBox(bool show);
00177     void showColorMapEditor(bool show);
00178 
00179     //layer geometry
00180     void adjustLayerHeight(int width);
00181     void adjustLayerWidth(int height);
00182 
00183 protected slots:
00184     void setActiveLayer(LayerItem *item);
00185     void updateTreeWidgetItem(QTreeWidgetItem *item);
00186     void updateBackgroundTransparency(int alpha);
00187     void updateCanvasTransparency(int alpha);
00188     void updateAntialiasing(bool on);
00189     void updateBorder(int width);
00190     void pickBackgroundColor();
00191     void pickCanvasColor();
00192     void pickBorderColor();
00193     void changeMargin(int);
00194     void setTitlesFont();
00195     void setAxesLabelsFont();
00196     void setAxesNumbersFont();
00197     void setLegendsFont();
00198     void editCurve();
00199     void chooseLabelsFont();
00200 
00201 private:
00202     int labelsAlignment();
00203     void closeEvent(QCloseEvent* e);
00204 
00205     void clearTabWidget();
00206     void initAxesPage();
00207     void initLinePage();
00208     void initSymbolsPage();
00209     void initHistogramPage();
00210     void initErrorsPage();
00211     void initSpacingPage();
00212     void initVectPage();
00213     void initBoxPage();
00214     void initPercentilePage();
00215     void initSpectrogramPage();
00216     void initLayerPage();
00217     void initLayerGeometryPage();
00218     void initFontsPage();
00219     void initPiePage();
00220     void initPrintPage();
00221     void initLabelsPage();
00222     void contextMenuEvent(QContextMenuEvent *e);
00223 
00224     double aspect_ratio;
00225 
00226     QFont titleFont, legendFont, axesFont, numbersFont;
00227 
00228     MultiLayer *d_ml;
00229     QStringList columnNames;
00230 
00231     QSpinBox* boxX, *boxY, *boxLayerWidth, *boxLayerHeight;
00232     QCheckBox *keepRatioBox;
00233 
00234     QPushButton *btnTitle, *btnAxesLabels, *btnAxesNumbers, *btnLegend;
00235     ColorMapEditor *colorMapEditor;
00236     QWidget *curvePlotTypeBox, *layerPage, *layerGeometryPage, *piePage, *fontsPage, *printPage;
00237     QTreeWidget* listBox;
00238     QCheckBox *boxAntialiasing, *boxAll, *boxScaleLayers, *boxPrintCrops;
00239     ColorButton *boxBorderColor, *boxBackgroundColor, *boxCanvasColor;
00240     QSpinBox *boxBackgroundTransparency, *boxCanvasTransparency, *boxBorderWidth, *boxMargin;
00241     QSpinBox *boxRadius, *boxPieLineWidth;
00242     ColorBox *boxFirstColor, *boxPieLineColor;
00243     PatternBox *boxPiePattern;
00244     QComboBox* boxPieLineStyle;
00245 
00246     QPushButton* buttonApply, *btnWorksheet;
00247     QPushButton* buttonOk, *btnMore;
00248     QPushButton* buttonCancel;
00249     QComboBox* boxPlotType;
00250     QWidget* linePage;
00251     QComboBox* boxConnect;
00252     QComboBox* boxLineStyle;
00253     QSpinBox* boxLineWidth, *boxPenWidth;
00254     ColorBox* boxLineColor, *boxAreaColor;
00255     QWidget* symbolPage;
00256     QSpinBox* boxSymbolSize;
00257     ColorBox* boxSymbolColor,*boxFillColor;
00258     SymbolBox* boxSymbolStyle;
00259     PatternBox *boxPattern;
00260     QTabWidget* privateTabWidget;
00261     QWidget *errorsPage, *spectrogramPage;
00262     QGroupBox* fillGroupBox;
00263     QCheckBox* plusBox;
00264     QCheckBox* minusBox;
00265     QCheckBox* xBox;
00266     ColorButton *colorBox, *levelsColorBox;
00267     ColorBox* vectColorBox;
00268     QComboBox* widthBox;
00269     QComboBox* capBox;
00270     QCheckBox* throughBox;
00271     QLabel *labelPosition, *labelXEnd, *labelYEnd;
00272     QGroupBox* GroupBoxH;
00273     QWidget *histogramPage, *spacingPage;
00274     QLineEdit *binSizeBox, *histogramBeginBox, *histogramEndBox;
00275     QCheckBox *automaticBox;
00276     QPushButton* buttonStatistics, *btnEditCurve;
00277     QSpinBox* gapBox, *offsetBox, *boxWidth;
00278     QWidget *vectPage, *boxPage, *percentilePage, *axesPage;
00279     QComboBox *xEndBox, *yEndBox, *boxType, *boxWhiskersType, *boxWhiskersRange, *boxRange;
00280     QSpinBox* headAngleBox, *headLengthBox, *vectWidthBox, *boxPercSize, *boxEdgeWidth;
00281     QCheckBox *filledHeadBox;
00282     QSpinBox *boxCoef, *boxWhiskersCoef;
00283     QCheckBox *boxFillSymbols, *boxFillSymbol;
00284     ColorBox *boxPercFillColor, *boxEdgeColor;
00285     QLabel  *whiskerCoeffLabel, *whiskerRangeLabel, *boxCoeffLabel;
00286     QLabel *boxRangeLabel, *whiskerCntLabel, *boxCntLabel;
00287     QGroupBox *GroupBoxVectEnd;
00288     QComboBox *vectPosBox, *boxXAxis, *boxYAxis, *colorScaleBox, *boxContourStyle;
00289     QSpinBox *levelsBox, *contourWidthBox, *colorScaleWidthBox;
00290     QGroupBox *levelsGroupBox, *axisScaleBox, *imageGroupBox;
00291     QGroupBox *defaultPenBox;
00292     QRadioButton *defaultScaleBox, *grayScaleBox, *customScaleBox, *defaultContourBox, *autoContourBox;
00293 
00294     SymbolBox *boxMaxStyle, *boxMinStyle, *boxMeanStyle, *box99Style, *box1Style;
00295     QDoubleSpinBox *whiskerCnt, *boxCnt;
00297     QGroupBox *labelsGroupBox;
00298     DoubleSpinBox *boxLabelsAngle;
00299     QSpinBox *boxLabelsXOffset, *boxLabelsYOffset;
00300     QCheckBox *boxLabelsWhiteOut;
00301     QPushButton *btnLabelsFont;
00302     QComboBox *boxLabelsAlign, *boxLabelsColumn;
00303     ColorBox* boxLabelsColor;
00304     QWidget *labelsPage;
00305 };
00306 
00307 /*****************************************************************************
00308  *
00309  * Class LayerItem
00310  *
00311  *****************************************************************************/
00313 class LayerItem : public QTreeWidgetItem
00314 {
00315 public:
00316     enum {LayerTreeItem = 1001};
00317     LayerItem(Graph *g, QTreeWidgetItem *parent, const QString& s);
00318 
00319     Graph *graph() { return d_graph; };
00320     void setActive(bool select);
00321 
00322 protected:
00323     void insertCurvesList();
00324     Graph *d_graph;
00325 };
00326 
00327 /*****************************************************************************
00328  *
00329  * Class CurveTreeItem
00330  *
00331  *****************************************************************************/
00333 class CurveTreeItem : public QTreeWidgetItem
00334 {
00335 public:
00336     enum {PlotCurveTreeItem = 1002};
00337     CurveTreeItem(const QwtPlotItem *curve, LayerItem *parent, const QString& s);
00338 
00339     Graph* graph(){return ((LayerItem *)parent())->graph();};
00340     void setActive(bool on);
00341 
00342     const QwtPlotItem *plotItem() { return d_curve; };
00343     int plotItemType();
00344     int plotItemIndex();
00345 
00346 protected:
00347     const QwtPlotItem *d_curve;
00348 };
00349 
00350 #endif

Generated on Thu Feb 7 13:59:27 2008 for QtiPlot by  doxygen 1.5.4