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 
00120 static const char * layer_disabled_xpm[] = {
00121 "14 14 3 1",
00122 "   c None",
00123 ".  c #666666",
00124 "+  c #FFFFFF",
00125 "..............",
00126 ".++++++++++++.",
00127 ".+..+++++++++.",
00128 ".+..+++++++++.",
00129 ".+..+++++++++.",
00130 ".+..+++++++++.",
00131 ".+..+++++++++.",
00132 ".+..+++++++++.",
00133 ".+..+++++++++.",
00134 ".+..+++++++++.",
00135 ".+..........+.",
00136 ".+..........+.",
00137 ".++++++++++++.",
00138 ".............."};
00139 
00140 /* XPM */
00141 static const char * layer_enabled_xpm[] = {
00142 "14 14 4 1",
00143 "   c None",
00144 ".  c #1A1A1A",
00145 "+  c #FFFFFF",
00146 "@  c #CB1D08",
00147 "..............",
00148 ".++++++++++++.",
00149 ".+@@+++++++++.",
00150 ".+@@+++++++++.",
00151 ".+@@+++++++++.",
00152 ".+@@+++++++++.",
00153 ".+@@+++++++++.",
00154 ".+@@+++++++++.",
00155 ".+@@+++++++++.",
00156 ".+@@+++++++++.",
00157 ".+@@@@@@@@@@+.",
00158 ".+@@@@@@@@@@+.",
00159 ".++++++++++++.",
00160 ".............."};
00161 
00162 static const char * graph_disabled_xpm[] = {
00163 "14 14 5 1",
00164 "   c None",
00165 ".  c #666666",
00166 "+  c #FFFFFF",
00167 "@  c #999999",
00168 "#  c #747474",
00169 "..............",
00170 ".++++@@++++++.",
00171 ".++++@@++++++.",
00172 ".+++@++@+++++.",
00173 ".++@++++@@+++.",
00174 ".+@+++++@@++#.",
00175 ".++++##+++@+#.",
00176 ".++++##++++#+.",
00177 ".+++#++#++#+@.",
00178 ".++#++++##+++.",
00179 ".+#+++++##+++.",
00180 ".++++++++++++.",
00181 ".++++++++++++.",
00182 ".............."};
00183 
00184 static const char * graph_enabled_xpm[] = {
00185 "14 14 6 1",
00186 "   c None",
00187 ".  c #030003",
00188 "+  c #FFFFFF",
00189 "@  c #FC0D00",
00190 "#  c #2F28EF",
00191 "$  c #0000FC",
00192 "..............",
00193 ".++++@@++++++.",
00194 ".++++@@++++++.",
00195 ".+++@++@+++++.",
00196 ".++@++++@@+++.",
00197 ".+@+++++@@++#.",
00198 ".++++##+++@+#.",
00199 ".++++##++++$+.",
00200 ".+++#++#++$+@.",
00201 ".++#++++##+++.",
00202 ".+#+++++##+++.",
00203 ".++++++++++++.",
00204 ".++++++++++++.",
00205 ".............."};
00206 
00208 class PlotDialog : public QDialog
00209 {
00210     Q_OBJECT
00211 
00212 public:
00213     PlotDialog(bool showExtended, QWidget* parent = 0, Qt::WFlags fl = 0 );
00214     void initFonts(const QFont& titlefont, const QFont& axesfont, const QFont& numbersfont, const QFont& legendfont);
00215     void insertColumnsList(const QStringList& names){columnNames = names;};
00216     void setMultiLayer(MultiLayer *ml);
00217 
00218 public slots:
00219     void showAll(bool all);
00220     void selectCurve(int index);
00221 
00222 private slots:
00223     void showStatistics();
00224     void customVectorsPage(bool angleMag);
00225     void updateEndPointColumns(const QString& text);
00226 
00227     void fillBoxSymbols();
00228     void fillSymbols();
00229     bool acceptParams();
00230     void showWorksheet();
00231     void quit();
00232 
00233     int setPlotType(CurveTreeItem *item);
00234     void changePlotType(int plotType);
00235     void setActiveCurve(CurveTreeItem *item);
00236 
00237     void insertTabs(int plot_type);
00238     void updateTabWindow(QTreeWidgetItem *currentItem, QTreeWidgetItem *previousItem);
00239     void showAreaColor(bool show);
00240 
00241     void removeSelectedCurve();
00242 
00243     /******* error bars options **************/
00244     void pickErrorBarsColor();
00245     void changeErrorBarsType();
00246     void changeErrorBarsPlus();
00247     void changeErrorBarsMinus();
00248     void changeErrorBarsThrough();
00249 
00250     void setAutomaticBinning();
00251     bool validInput();
00252     void showPlotAssociations(QTreeWidgetItem *item, int);
00253 
00254     void setPenStyle(Qt::PenStyle style);
00255     void setPiePenStyle(const Qt::PenStyle& style);
00256 
00257     //box plots
00258     void setBoxType(int index);
00259     void setBoxRangeType(int index);
00260     void setWhiskersRange(int index);
00261 
00262     //spectrograms
00263     void showDefaultContourLinesBox(bool show);
00264     void showColorMapEditor(bool show);
00265 
00266     //layer geometry
00267     void adjustLayerHeight(int width);
00268     void adjustLayerWidth(int height);
00269 
00270 protected slots:
00271     void setActiveLayer(LayerItem *item);
00272     void updateTreeWidgetItem(QTreeWidgetItem *item);
00273     void updateBackgroundTransparency(int alpha);
00274     void updateCanvasTransparency(int alpha);
00275     void updateAntialiasing(bool on);
00276     void updateBorder(int width);
00277     void pickBackgroundColor();
00278     void pickCanvasColor();
00279     void pickBorderColor();
00280     void changeMargin(int);
00281     void setTitlesFont();
00282     void setAxesLabelsFont();
00283     void setAxesNumbersFont();
00284     void setLegendsFont();
00285     void editCurve();
00286     void chooseLabelsFont();
00287 
00288 private:
00289     int labelsAlignment();
00290     void closeEvent(QCloseEvent* e);
00291 
00292     void clearTabWidget();
00293     void initAxesPage();
00294     void initLinePage();
00295     void initSymbolsPage();
00296     void initHistogramPage();
00297     void initErrorsPage();
00298     void initSpacingPage();
00299     void initVectPage();
00300     void initBoxPage();
00301     void initPercentilePage();
00302     void initSpectrogramPage();
00303     void initLayerPage();
00304     void initLayerGeometryPage();
00305     void initFontsPage();
00306     void initPiePage();
00307     void initPieGeometryPage();
00308     void initPieLabelsPage();
00309     void initPrintPage();
00310     void initLabelsPage();
00311     void contextMenuEvent(QContextMenuEvent *e);
00312 
00313     double aspect_ratio;
00314 
00315     QFont titleFont, legendFont, axesFont, numbersFont;
00316 
00317     MultiLayer *d_ml;
00318     QStringList columnNames;
00319 
00320     QSpinBox* boxX, *boxY, *boxLayerWidth, *boxLayerHeight;
00321     QCheckBox *keepRatioBox;
00322 
00323     QPushButton *btnTitle, *btnAxesLabels, *btnAxesNumbers, *btnLegend;
00324     ColorMapEditor *colorMapEditor;
00325     QWidget *curvePlotTypeBox, *layerPage, *layerGeometryPage, *piePage, *fontsPage, *printPage;
00326     QTreeWidget* listBox;
00327     QCheckBox *boxAntialiasing, *boxAll, *boxScaleLayers, *boxPrintCrops;
00328     ColorButton *boxBorderColor, *boxBackgroundColor, *boxCanvasColor;
00329     QSpinBox *boxBackgroundTransparency, *boxCanvasTransparency, *boxBorderWidth, *boxMargin;
00330     QSpinBox *boxRadius;
00331     DoubleSpinBox *boxPieLineWidth;
00332     ColorBox *boxFirstColor, *boxPieLineColor;
00333     PatternBox *boxPiePattern;
00334     QComboBox* boxPieLineStyle;
00335 
00336     QPushButton* buttonApply, *btnWorksheet;
00337     QPushButton* buttonOk, *btnMore;
00338     QPushButton* buttonCancel;
00339     QComboBox* boxPlotType;
00340     QWidget* linePage;
00341     QComboBox* boxConnect;
00342     QComboBox* boxLineStyle;
00343     DoubleSpinBox *boxLineWidth, *boxPenWidth;
00344     ColorBox* boxLineColor, *boxAreaColor;
00345     QWidget* symbolPage;
00346     QSpinBox* boxSymbolSize;
00347     ColorBox* boxSymbolColor,*boxFillColor;
00348     SymbolBox* boxSymbolStyle;
00349     PatternBox *boxPattern;
00350     QTabWidget* privateTabWidget;
00351     QWidget *errorsPage, *spectrogramPage;
00352     QGroupBox* fillGroupBox;
00353     QCheckBox* plusBox;
00354     QCheckBox* minusBox;
00355     QCheckBox* xBox;
00356     ColorButton *colorBox, *levelsColorBox;
00357     ColorBox* vectColorBox;
00358     DoubleSpinBox* widthBox;
00359     QComboBox* capBox;
00360     QCheckBox* throughBox;
00361     QLabel *labelPosition, *labelXEnd, *labelYEnd;
00362     QGroupBox* GroupBoxH;
00363     QWidget *histogramPage, *spacingPage;
00364     QLineEdit *binSizeBox, *histogramBeginBox, *histogramEndBox;
00365     QCheckBox *automaticBox;
00366     QPushButton* buttonStatistics, *btnEditCurve;
00367     QSpinBox* gapBox, *offsetBox, *boxWidth;
00368     QWidget *vectPage, *boxPage, *percentilePage, *axesPage;
00369     QComboBox *xEndBox, *yEndBox, *boxType, *boxWhiskersType, *boxWhiskersRange, *boxRange;
00370     QSpinBox* headAngleBox, *headLengthBox, *boxPercSize;
00371     DoubleSpinBox *vectWidthBox, *boxEdgeWidth;
00372     QCheckBox *filledHeadBox;
00373     QSpinBox *boxCoef, *boxWhiskersCoef;
00374     QCheckBox *boxFillSymbols, *boxFillSymbol;
00375     ColorBox *boxPercFillColor, *boxEdgeColor;
00376     QLabel  *whiskerCoeffLabel, *whiskerRangeLabel, *boxCoeffLabel;
00377     QLabel *boxRangeLabel, *whiskerCntLabel, *boxCntLabel;
00378     QGroupBox *GroupBoxVectEnd;
00379     QComboBox *vectPosBox, *boxXAxis, *boxYAxis, *colorScaleBox, *boxContourStyle;
00380     QSpinBox *levelsBox, *colorScaleWidthBox;
00381     DoubleSpinBox *contourWidthBox;
00382     QGroupBox *levelsGroupBox, *axisScaleBox, *imageGroupBox;
00383     QGroupBox *defaultPenBox;
00384     QRadioButton *defaultScaleBox, *grayScaleBox, *customScaleBox, *defaultContourBox, *autoContourBox;
00385 
00386     SymbolBox *boxMaxStyle, *boxMinStyle, *boxMeanStyle, *box99Style, *box1Style;
00387     QDoubleSpinBox *whiskerCnt, *boxCnt;
00389     QGroupBox *labelsGroupBox;
00390     DoubleSpinBox *boxLabelsAngle;
00391     QSpinBox *boxLabelsXOffset, *boxLabelsYOffset;
00392     QCheckBox *boxLabelsWhiteOut;
00393     QPushButton *btnLabelsFont;
00394     QComboBox *boxLabelsAlign, *boxLabelsColumn;
00395     ColorBox* boxLabelsColor;
00396     QWidget *labelsPage;
00397 
00398     QGroupBox *pieAutoLabelsBox, *boxPieWedge;
00399     DoubleSpinBox *boxPieStartAzimuth, *boxPieEdgeDist, *boxPieViewAngle, *boxPieThickness;
00400     QCheckBox *boxPieConterClockwise, *boxPieValues, *boxPiePercentages, *boxPieCategories;
00401     QWidget *pieLabelsPage;
00402     QSpinBox *boxPieOffset;
00403     QWidget *pieGeometryPage;
00404 };
00405 
00406 /*****************************************************************************
00407  *
00408  * Class LayerItem
00409  *
00410  *****************************************************************************/
00412 class LayerItem : public QTreeWidgetItem
00413 {
00414 public:
00415     enum {LayerTreeItem = 1001};
00416     LayerItem(Graph *g, QTreeWidgetItem *parent, const QString& s);
00417 
00418     Graph *graph() { return d_graph; };
00419     void setActive(bool select);
00420 
00421 protected:
00422     void insertCurvesList();
00423     Graph *d_graph;
00424 };
00425 
00426 /*****************************************************************************
00427  *
00428  * Class CurveTreeItem
00429  *
00430  *****************************************************************************/
00432 class CurveTreeItem : public QTreeWidgetItem
00433 {
00434 public:
00435     enum {PlotCurveTreeItem = 1002};
00436     CurveTreeItem(QwtPlotItem *curve, LayerItem *parent, const QString& s);
00437 
00438     Graph* graph(){return ((LayerItem *)parent())->graph();};
00439     void setActive(bool on);
00440 
00441     const QwtPlotItem *plotItem() { return d_curve; };
00442     int plotItemType();
00443     int plotItemIndex();
00444 
00445 protected:
00446     QwtPlotItem *d_curve;
00447 };
00448 
00449 #endif

Generated on Tue Jun 17 08:36:12 2008 for QtiPlot by  doxygen 1.5.5