#ifndef G12BUFFERDIALOG_H
#define G12BUFFERDIALOG_H

#include <QtGui/QDialog>
#include "ui_g12bufferdialog.h"
#include "g12buffer.h"
#include "histogramdialog.h"

typedef struct GainParameters_TAG
{
    double gain;
    int offset;
} GainParameters;

class g12BufferDialog : public QDialog
{
    Q_OBJECT

public slots:
    void notifyBufferChangeSlot(G12Buffer *buf);

    void notifyRecalculate(void);

    void pointSelected(QPoint p);
    void histogramShow();

    /* Slots for gain-offset*/
    void updateOffsetSlider (QString string);
    void updateOffsetText (int val);
    void updateGainSlider (QString string);
    void updateGainText (int val);

	void parametersChangedSlot(GainParameters gParam);

    /* Process the child repainting */
    void repaintChild(QPaintEvent *event, QWidget *who);
    void mouseChild(QMouseEvent *event);



signals:
	void notifyBufferChange(G12Buffer *buf);
	void notifyOutputBufferChange(G12Buffer *buf);

	void parametersChanged(GainParameters gParam);

public:
    g12BufferDialog(QWidget *parent = 0);
    ~g12BufferDialog();
    G12Buffer *getBuffer() const;

private:
    Ui::g12BufferDialogClass ui;
    G12Buffer *inputBuffer;
    G12Buffer *showBuffer;

    GainParameters gParams;
    bool suppressRecalculate;

    HistogramDialog histogram;
};

#endif // G12BUFFERDIALOG_H
