1 ///////////////////////////////////////////////////////////////////////////
2 // Some code in this file and accompanying files is based on work by
3 // Moe Wheatley, AE4Y, released under the "Simplified BSD License".
4 // For more details see the accompanying file LICENSE_WHEATLEY.TXT
5 ///////////////////////////////////////////////////////////////////////////
6 
7 #ifndef EPLOTTER_H_
8 #define EPLOTTER_H_
9 
10 #include <QFrame>
11 #include <QSize>
12 #include <QImage>
13 #include <QString>
14 
15 #define VERT_DIVS 7	//specify grid screen divisions
16 #define HORZ_DIVS 20
17 
18 class QPaintEvent;
19 class QResizeEvent;
20 
21 class EPlotter : public QFrame
22 {
23   Q_OBJECT
24 public:
25   explicit EPlotter(QWidget *parent = 0);
26   ~EPlotter();
27 
28   QSize minimumSizeHint() const;
29   QSize sizeHint() const;
30   float   m_fSpan;
31   qint32  m_TxFreq;
32   qint32  m_w;
33   qint32  m_plotZero;
34   qint32  m_plotGain;
35   qint32  m_smooth;
36   qint32  m_binsPerPixel;
37   qint32  m_nColor;
38   bool    m_blue;
39 
40   void draw();		                                    //Update the Echo plot
41   void SetRunningState(bool running);
42   void setPlotZero(int plotZero);
43   int  getPlotZero();
44   void setPlotGain(int plotGain);
45   int  getPlotGain();
46   int  plotWidth();
47   void UpdateOverlay();
48   void DrawOverlay();
49   void setSmooth(int n);
50   int  getSmooth();
51   void setColors(qint32 n);
52 
53 //  void SetPercent2DScreen(int percent){m_Percent2DScreen=percent;}
54 
55 protected:
56   //re-implemented widget event handlers
57   void paintEvent(QPaintEvent *event);
58   void resizeEvent(QResizeEvent* event);
59 
60 private:
61 
62   void MakeFrequencyStrs();
63   int XfromFreq(float f);
64   float FreqfromX(int x);
65   qint64 RoundFreq(qint64 freq, int resolution);
66 
67   QPixmap m_2DPixmap;
68   QPixmap m_ScalePixmap;
69   QPixmap m_OverlayPixmap;
70   QSize   m_Size;
71   QString m_Str;
72   QString m_HDivText[483];
73 
74   double  m_fftBinWidth;
75 
76   qint64  m_StartFreq;
77 
78   qint32  m_dBStepSize;
79   qint32  m_hdivs;
80   qint32  m_line;
81   qint32  m_freqPerDiv;
82   qint32  m_h;
83   qint32  m_h1;
84   qint32  m_h2;
85 
86   bool    m_Running;
87   bool    m_paintEventBusy;
88 
89 };
90 
91 extern "C" {
92 //--------------------------------------------------- C and Fortran routines
93 
94 void smo121_(float x[], int* npts);
95 }
96 #endif // EPLOTTER_H
97