#ifndef GRAPH_H
#define GRAPH_H

#include "image.h"
#include "qcustomplot/qcustomplot.h"
#include <QObject>

class Graph : public QCustomPlot {
  Q_OBJECT
public:
  explicit Graph(QObject *parent = nullptr);

private:
  QCPGraph *raw;  // monochrome
  QCPGraph *rawR; // R
  QCPGraph *rawG; // G
  QCPGraph *rawB; // B
  QCPGraph *c1;   // cursor 1
  QCPGraph *c2;   // cursor 2
  int x1;         // cursor 1 x position
  int x2;         // cursor 2 x position
  bool c1enabled; // cursor 1 enabled
  bool c2enabled; // cursor 2 enabled

  uint32_t scaleMin; // scale minimum
  uint32_t scaleMax; // scale maximum

  void rescaleRGB(); // rescale for RGB
signals:

public slots:
  void catchLine(Image &, uint32_t); // get line to plot
  void home();                       // rescale graph
  void rangeChanged(QCPRange);       // range change - checks maximum ranges
  void cursor1Enabled(int);          // set enable cursor 1
  void cursor2Enabled(int);          // set enable cursor 2
  void cursor1x(int);                // set position x cursor 1
  void cursor2x(int);                // set position x cursor 2
};

#endif // GRAPH_H
