00001
00002
00003 #ifndef PLOTSETTINGSDIALOG_H
00004 #define PLOTSETTINGSDIALOG_H
00005
00006 #include <qtoolbutton.h>
00007 #include <qcolor.h>
00008 #include <qcheckbox.h>
00009 #include <qhbuttongroup.h>
00010 #include "Worksheet.h"
00011 #include "Dialog.h"
00012
00013 class PlotSettingsDialog: public Dialog
00014 {
00015 Q_OBJECT
00016 public:
00017 PlotSettingsDialog(MainWin *mw, const char *name);
00018 void updateDialog();
00019 public slots:
00020 void autoScaleX();
00021 void autoScaleY();
00022 void autoScaleZ();
00023 void enableAspectRatio(bool a=true) { aspect->setChecked(a); }
00024 bool AspectRatioEnabled() { return aspect->isChecked(); }
00025 void setPlotPosition(double x, double y) {
00026 posx->setText(QString::number(x)); posy->setText(QString::number(y));
00027 }
00028 void setPlotPosition(Point p) {
00029 posx->setText(QString::number(p.X())); posy->setText(QString::number(p.Y()));
00030 }
00031 Point PlotPosition() { return Point(posx->text().toDouble(),posy->text().toDouble()); }
00032 void setPlotSize(double x, double y) {
00033 sizex->setText(QString::number(x)); sizey->setText(QString::number(y));
00034 }
00035 void setPlotSize(Point p) {
00036 sizex->setText(QString::number(p.X())); sizey->setText(QString::number(p.Y()));
00037 }
00038 Point PlotSize() { return Point(sizex->text().toDouble(), sizey->text().toDouble()); }
00039 void enableLeftPanel(bool e=true) { leftpanel->setChecked(e); }
00040 void enableRightPanel(bool e=true) { rightpanel->setChecked(e); }
00041 void enableTopPanel(bool e=true) { toppanel->setChecked(e); }
00042 void enableBottomPanel(bool e=true) { bottompanel->setChecked(e); }
00043
00044 void setXRange(LRange *r) {
00045 xmin->setText(QString::number(r->rMin())); xmax->setText(QString::number(r->rMax()));
00046 }
00047 LRange *XRange() { return new LRange(xmin->text().toDouble(),xmax->text().toDouble()); }
00048 void setYRange(LRange *r) {
00049 ymin->setText(QString::number(r->rMin())); ymax->setText(QString::number(r->rMax()));
00050 }
00051 LRange *YRange() { return new LRange(ymin->text().toDouble(),ymax->text().toDouble()); }
00052 void setClippingOffset(int c) { clipni->setValue(c); }
00053 int ClippingOffset() { return clipni->value(); }
00054
00055 void setTransparent(bool e=true) { transparentcb->setChecked(e); }
00056 bool Transparent() { return transparentcb->isChecked(); }
00057 void setBackground(QColor c) { bgcolor->setColor(c); }
00058 void setBackground(QString c) { bgcolor->setColor(QColor(c)); }
00059 QColor Background() { return bgcolor->color(); }
00060 void setGraphBackground(QColor c) { gbgcolor->setColor(c); }
00061 void setGraphBackground(QString c) { gbgcolor->setColor(QColor(c)); }
00062 QColor GraphBackground() { return gbgcolor->color(); }
00063
00064 void setBaseline(double v) { baselinele->setText(QString::number(v)); }
00065 double Baseline() { return baselinele->text().toDouble(); }
00066 void setXBaseline(double v) { xbaselinele->setText(QString::number(v)); }
00067 double XBaseline() { return xbaselinele->text().toDouble(); }
00068 void enableBaseline(bool e=true) { baselinecb->setChecked(e); }
00069 bool BaselineEnabled() { return baselinecb->isChecked(); }
00070 void enableXBaseline(bool e=true) { xbaselinecb->setChecked(e); }
00071 bool XBaselineEnabled() { return xbaselinecb->isChecked(); }
00072 void enableRegion(bool e=true) { regioncb->setChecked(e); }
00073 bool RegionEnabled() { return regioncb->isChecked(); }
00074 void setRegion(double min, double max) {
00075 regionminle->setText(QString::number(min));
00076 regionmaxle->setText(QString::number(max));
00077 }
00078
00079 void EnableMarker(bool e=true) { markercb->setChecked(e); }
00080 bool MarkerEnabled() { return markercb->isChecked(); }
00081 void setXMarker(double min, double max) {
00082 markxminle->setText(QString::number(min));
00083 markxmaxle->setText(QString::number(max));
00084 }
00085 LRange *XMarker() { return new LRange(markxminle->text().toDouble(),markxmaxle->text().toDouble()); }
00086 void setYMarker(double min, double max) {
00087 markyminle->setText(QString::number(min));
00088 markymaxle->setText(QString::number(max));
00089 }
00090 LRange *YMarker() { return new LRange(markyminle->text().toDouble(),markymaxle->text().toDouble()); }
00091
00092
00093
00094
00095 void disableMouse(bool e=false) { disablemousecb->setChecked(e); }
00096 bool MouseDisabled() { return disablemousecb->isChecked(); }
00097 void setResolution(int r) { resolutionle->setText(QString::number(r)); }
00098 int Resolution() { return resolutionle->text().toInt(); }
00099 void setAspectRatio(int v) { aspectcb->setCurrentItem(v); }
00100 int AspectRatio() { return aspectcb->currentItem(); }
00101 void setPlotStyle(int v) { plotstyle->setCurrentItem(v); }
00102 int PlotStyle() { return plotstyle->currentItem(); }
00103 void setCoordinateStyle(int v) { coordinatestyle->setCurrentItem(v); }
00104 int CoordinateStyle() { return coordinatestyle->currentItem(); }
00105 void setFloorStyle(int v) { floorstyle->setCurrentItem(v); }
00106 int FloorStyle() { return floorstyle->currentItem(); }
00107 void setIsoline(int i) { isolines->setText(QString::number(i)); }
00108 int Isolines() { return isolines->text().toInt(); }
00109
00110
00111 void fillBrushBox();
00112 void enableFill(bool e=true) { fillcb->setChecked(e); }
00113 bool fillEnabled() { return fillcb->isChecked(); }
00114 int fillG1() { return fillg1le->text().toInt(); }
00115 void setFillG1(int g) { fillg1le->setText(QString::number(g)); }
00116 int fillG2() { return fillg2le->text().toInt(); }
00117 void setFillG2(int g) { fillg2le->setText(QString::number(g)); }
00118 QBrush fillBrush() { return QBrush(fillcolorcb->color(),(Qt::BrushStyle)fillbrushcb->currentItem()); }
00119 void setFillBrush(QBrush b) { fillcolorcb->setColor(b.color()); fillbrushcb->setCurrentItem(b.style()); }
00120 QColor fillColor() { return fillcolorcb->color(); }
00121 void setFillColor(QColor c) { fillcolorcb->setColor(c); }
00122 int fillBrushStyle() { return fillbrushcb->currentItem(); }
00123 void setFillBrushStyle(int s) { fillbrushcb->setCurrentItem(s); }
00124 int Apply() { return apply_clicked(); }
00125 private:
00126 Plot *plot;
00127 int type;
00128 KLineEdit *posx, *posy, *sizex, *sizey;
00129 QCheckBox *aspect, *leftpanel, *rightpanel, *toppanel, *bottompanel;
00130 KLineEdit *borderwidth, *baselinele, *xbaselinele;
00131 KColorButton *bgcolor, *gbgcolor;
00132 KLineEdit *xmin, *xmax, *ymin, *ymax, *zmin, *zmax;
00133 KIntNumInput *clipni;
00134 QCheckBox *baselinecb, *xbaselinecb, *regioncb, *transparentcb;
00135 KLineEdit *regionminle, *regionmaxle;
00136 QCheckBox *markercb;
00137 KLineEdit *markxminle, *markxmaxle, *markyminle, *markymaxle;
00138 KComboBox *aspectcb;
00139 KComboBox *plotstyle, *coordinatestyle, *floorstyle;
00140 KLineEdit *isolines, *resolutionle;
00141 QCheckBox *disablemousecb;
00142 QCheckBox *fillcb;
00143 QHButtonGroup *hbg;
00144 KLineEdit *fillg1le, *fillg2le;
00145 KColorButton *fillcolorcb;
00146 KComboBox *fillbrushcb;
00147 private slots:
00148 void ok_clicked() {apply_clicked(); accept(); }
00149 void saveSettings();
00150 int apply_clicked();
00151 };
00152
00153 #endif //PLOTSETTINGSDIALOG_H