#ifndef _PLOTTERFIELD_H_
#define _PLOTTERFIELD_H_

#include <QTime>
#include <QWidget>
#include <QPainter>
#include <QList>

class PlotterField : public QWidget
{
    Q_OBJECT

public:
    PlotterField(QWidget *parent = 0);
    ~PlotterField();
    int getPaneW() { return paneW; }
    int getPaneH() { return paneH; }
    bool getCbxVLines(){ return cbxVLines; }
    bool getCbxHLines(){ return cbxHLines; }
    QSize minimumSizeHint() const { return QSize(30, 10); }
    
public slots:
    void setNextValue(const double rxVal, const double txVal);
    void onCbxHLines(const int b);
    void onCbxHTxt(const int b);
    void onCbxVLines(const int b);
    void onCbxVTxt(const int b);
    void setLinesAlpha( int a);
    void setLinesColor( QRgb rgb );
    void setPlotColor1( QRgb rgb );
    void setPlotColor2( QRgb rgb );
    void setPaneColor ( QRgb rgb );
    void setNewScaleFactor();
    void setIntervalTime(const int ms);
    void setUnitsHorizontalLeft(const QString & s);
    void setUnitsHorizontalRight(const QString & s);
    void setUnitsVerticalBelow(const QString & s);
    void setUnitsVerticalAbove(const QString & s);

protected:
    void paintEvent(QPaintEvent *event);

private:
    bool    needNewScaleFactor,
            cbxHLines,  cbxHtxt,
            cbxVLines,  cbxVtxt;
    int     paneW,      paneH,
            scaleRange, lineRGB_r,  lineRGB_g, lineRGB_b, cc_v,
            s_color,    s_alpha,    p_color1,
            p_color2,   bk_color,   max_s_col,
            ixMaxVal,   ixMinVal,   intervalTime;
    double  curVal,     minVal,     aspectRatio,    maxValueInField;
    QColor  *lineCol,   *plotCol1,  *plotCol2,      *bkCol;
    QString unitsHorizontalLeft,    unitsHorizontalRight,
            unitsVerticalBelow,     unitsVerticalAbove;
    QPainter *stift;
    QList<double> valueListRx,      valueListTx;

    double scaleFactor(const double maxV);
    void drawHline(QPainter *stift);
    void drawVline(QPainter *stift);
    void drawValue(QPainter *stift);
};


#endif // _PLOTTERFIELD_H_