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

Generated on Fri Nov 7 03:36:52 2008 for QtiPlot by  doxygen 1.5.6