| 
									
										
										
										
											2014-04-03 19:29:13 +00:00
										 |  |  | // -*- Mode: C++ -*-
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | ///////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | // Some code in this file and accompanying files is based on work by
 | 
					
						
							|  |  |  | // Moe Wheatley, AE4Y, released under the "Simplified BSD License".
 | 
					
						
							|  |  |  | // For more details see the accompanying file LICENSE_WHEATLEY.TXT
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef PLOTTER_H
 | 
					
						
							|  |  |  | #define PLOTTER_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-23 20:21:47 +00:00
										 |  |  | #ifdef QT5
 | 
					
						
							|  |  |  | #include <QtWidgets>
 | 
					
						
							|  |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | #include <QtGui>
 | 
					
						
							| 
									
										
										
										
											2013-05-23 20:21:47 +00:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | #include <QFrame>
 | 
					
						
							|  |  |  | #include <QImage>
 | 
					
						
							| 
									
										
										
										
											2014-03-31 00:03:44 +00:00
										 |  |  | #include <QVector>
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | #include <cstring>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define VERT_DIVS 7	//specify grid screen divisions
 | 
					
						
							|  |  |  | #define HORZ_DIVS 20
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-24 16:46:52 +00:00
										 |  |  | extern bool g_single_decode; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | class CPlotter : public QFrame | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2014-03-31 00:03:44 +00:00
										 |  |  |   Q_OBJECT; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | public: | 
					
						
							|  |  |  |   explicit CPlotter(QWidget *parent = 0); | 
					
						
							|  |  |  |   ~CPlotter(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   QSize minimumSizeHint() const; | 
					
						
							|  |  |  |   QSize sizeHint() const; | 
					
						
							| 
									
										
										
										
											2015-05-27 13:08:28 +00:00
										 |  |  |   bool    m_bScaleOK; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-06 14:18:23 +00:00
										 |  |  |   void draw(float swide[], bool bScroll, bool bRed);		//Update the waterfall
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   void SetRunningState(bool running); | 
					
						
							|  |  |  |   void setPlotZero(int plotZero); | 
					
						
							| 
									
										
										
										
											2015-04-22 17:48:03 +00:00
										 |  |  |   int  plotZero(); | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   void setPlotGain(int plotGain); | 
					
						
							| 
									
										
										
										
											2015-04-22 17:48:03 +00:00
										 |  |  |   int  plotGain(); | 
					
						
							|  |  |  |   int  plot2dGain(); | 
					
						
							|  |  |  |   void setPlot2dGain(int n); | 
					
						
							|  |  |  |   int  plot2dZero(); | 
					
						
							|  |  |  |   void setPlot2dZero(int plot2dZero); | 
					
						
							| 
									
										
										
										
											2013-07-25 16:48:10 +00:00
										 |  |  |   void setStartFreq(int f); | 
					
						
							|  |  |  |   int startFreq(); | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   int  plotWidth(); | 
					
						
							|  |  |  |   void UpdateOverlay(); | 
					
						
							|  |  |  |   void setDataFromDisk(bool b); | 
					
						
							| 
									
										
										
										
											2013-07-08 13:17:22 +00:00
										 |  |  |   void setRxRange(int fMin); | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  |   void setBinsPerPixel(int n); | 
					
						
							|  |  |  |   int  binsPerPixel(); | 
					
						
							| 
									
										
										
										
											2015-05-27 13:08:28 +00:00
										 |  |  |   void setWaterfallAvg(int n); | 
					
						
							| 
									
										
										
										
											2014-09-24 17:25:19 +00:00
										 |  |  |   void setRxFreq(int n); | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   void DrawOverlay(); | 
					
						
							| 
									
										
										
										
											2013-07-08 13:17:22 +00:00
										 |  |  |   int  rxFreq(); | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  |   void setFsample(int n); | 
					
						
							| 
									
										
										
										
											2012-11-14 15:30:21 +00:00
										 |  |  |   void setNsps(int ntrperiod, int nsps); | 
					
						
							| 
									
										
										
										
											2012-11-23 16:05:50 +00:00
										 |  |  |   void setTxFreq(int n); | 
					
						
							| 
									
										
										
										
											2013-07-08 13:17:22 +00:00
										 |  |  |   void setMode(QString mode); | 
					
						
							| 
									
										
										
										
											2015-04-22 17:48:03 +00:00
										 |  |  |   void setSubMode(int n); | 
					
						
							| 
									
										
										
										
											2013-07-08 13:17:22 +00:00
										 |  |  |   void setModeTx(QString modeTx); | 
					
						
							| 
									
										
										
										
											2015-11-22 23:38:42 +00:00
										 |  |  |   void SetPercent2DScreen(int percent); | 
					
						
							| 
									
										
										
										
											2015-04-22 17:48:03 +00:00
										 |  |  |   int  Fmax(); | 
					
						
							| 
									
										
										
										
											2013-07-12 13:45:28 +00:00
										 |  |  |   void setDialFreq(double d); | 
					
						
							| 
									
										
										
										
											2014-03-31 00:03:44 +00:00
										 |  |  |   void setCurrent(bool b) {m_bCurrent = b;} | 
					
						
							|  |  |  |   bool current() const {return m_bCurrent;} | 
					
						
							|  |  |  |   void setCumulative(bool b) {m_bCumulative = b;} | 
					
						
							|  |  |  |   bool cumulative() const {return m_bCumulative;} | 
					
						
							|  |  |  |   void setLinearAvg(bool b) {m_bLinearAvg = b;} | 
					
						
							|  |  |  |   bool linearAvg() const {return m_bLinearAvg;} | 
					
						
							|  |  |  |   void setBreadth(qint32 w) {m_w = w;} | 
					
						
							|  |  |  |   qint32 breadth() const {return m_w;} | 
					
						
							|  |  |  |   float fSpan() const {return m_fSpan;} | 
					
						
							|  |  |  |   void setLockTxFreq(bool b) {m_lockTxFreq = b;} | 
					
						
							| 
									
										
										
										
											2015-11-18 01:28:12 +00:00
										 |  |  |   void setColours(QVector<QColor> const& cl); | 
					
						
							| 
									
										
										
										
											2016-04-12 19:54:15 +00:00
										 |  |  |   void setFlatten(bool b1, bool b2); | 
					
						
							| 
									
										
										
										
											2015-04-22 17:48:03 +00:00
										 |  |  |   void setTol(int n); | 
					
						
							| 
									
										
										
										
											2015-05-27 13:08:28 +00:00
										 |  |  |   void setRxBand(QString band); | 
					
						
							| 
									
										
										
										
											2015-11-18 01:28:12 +00:00
										 |  |  |   void setReference(bool b) {m_bReference = b;} | 
					
						
							|  |  |  |   bool Reference() const {return m_bReference;} | 
					
						
							| 
									
										
										
										
											2016-07-06 14:18:23 +00:00
										 |  |  |   void drawRed(int ia, int ib, float swide[]); | 
					
						
							| 
									
										
										
										
											2016-10-24 14:56:14 +00:00
										 |  |  |   void setVHF(bool bVHF); | 
					
						
							| 
									
										
										
										
											2014-03-31 00:03:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | signals: | 
					
						
							|  |  |  |   void freezeDecode1(int n); | 
					
						
							| 
									
										
										
										
											2013-07-08 13:17:22 +00:00
										 |  |  |   void setFreq1(int rxFreq, int txFreq); | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							|  |  |  |   //re-implemented widget event handlers
 | 
					
						
							|  |  |  |   void paintEvent(QPaintEvent *event); | 
					
						
							|  |  |  |   void resizeEvent(QResizeEvent* event); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  |   void MakeFrequencyStrs(); | 
					
						
							|  |  |  |   int XfromFreq(float f); | 
					
						
							|  |  |  |   float FreqfromX(int x); | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-03-31 00:03:44 +00:00
										 |  |  |   bool    m_bCurrent; | 
					
						
							|  |  |  |   bool    m_bCumulative; | 
					
						
							|  |  |  |   bool    m_bLinearAvg; | 
					
						
							| 
									
										
										
										
											2015-11-18 01:28:12 +00:00
										 |  |  |   bool    m_bReference; | 
					
						
							|  |  |  |   bool    m_bReference0; | 
					
						
							| 
									
										
										
										
											2014-03-31 00:03:44 +00:00
										 |  |  |   bool    m_lockTxFreq; | 
					
						
							| 
									
										
										
										
											2016-10-24 14:56:14 +00:00
										 |  |  |   bool    m_bVHF; | 
					
						
							| 
									
										
										
										
											2014-03-31 00:03:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   float   m_fSpan; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   qint32  m_plotZero; | 
					
						
							|  |  |  |   qint32  m_plotGain; | 
					
						
							| 
									
										
										
										
											2015-04-22 17:48:03 +00:00
										 |  |  |   qint32  m_plot2dGain; | 
					
						
							|  |  |  |   qint32  m_plot2dZero; | 
					
						
							| 
									
										
										
										
											2014-03-31 00:03:44 +00:00
										 |  |  |   qint32  m_binsPerPixel; | 
					
						
							| 
									
										
										
										
											2015-05-27 13:08:28 +00:00
										 |  |  |   qint32  m_waterfallAvg; | 
					
						
							| 
									
										
										
										
											2014-03-31 00:03:44 +00:00
										 |  |  |   qint32  m_w; | 
					
						
							| 
									
										
										
										
											2015-02-11 00:50:35 +00:00
										 |  |  |   qint32  m_Flatten; | 
					
						
							| 
									
										
										
										
											2015-04-22 17:48:03 +00:00
										 |  |  |   qint32  m_nSubMode; | 
					
						
							| 
									
										
										
										
											2016-07-06 14:18:23 +00:00
										 |  |  |   qint32  m_ia; | 
					
						
							|  |  |  |   qint32  m_ib; | 
					
						
							| 
									
										
										
										
											2014-03-31 00:03:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   QPixmap m_WaterfallPixmap; | 
					
						
							|  |  |  |   QPixmap m_2DPixmap; | 
					
						
							|  |  |  |   QPixmap m_ScalePixmap; | 
					
						
							| 
									
										
										
										
											2012-09-30 01:03:18 +00:00
										 |  |  |   QPixmap m_OverlayPixmap; | 
					
						
							| 
									
										
										
										
											2015-11-18 01:28:12 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   QSize   m_Size; | 
					
						
							|  |  |  |   QString m_Str; | 
					
						
							|  |  |  |   QString m_HDivText[483]; | 
					
						
							| 
									
										
										
										
											2013-07-08 13:17:22 +00:00
										 |  |  |   QString m_mode; | 
					
						
							|  |  |  |   QString m_modeTx; | 
					
						
							| 
									
										
										
										
											2015-05-27 13:08:28 +00:00
										 |  |  |   QString m_rxBand; | 
					
						
							| 
									
										
										
										
											2013-07-08 13:17:22 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   bool    m_Running; | 
					
						
							|  |  |  |   bool    m_paintEventBusy; | 
					
						
							| 
									
										
										
										
											2013-07-08 13:17:22 +00:00
										 |  |  |   bool    m_dataFromDisk; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-29 17:52:35 +00:00
										 |  |  |   double  m_fftBinWidth; | 
					
						
							| 
									
										
										
										
											2013-07-12 13:45:28 +00:00
										 |  |  |   double  m_dialFreq; | 
					
						
							| 
									
										
										
										
											2014-10-03 15:08:40 +00:00
										 |  |  |   double  m_xOffset; | 
					
						
							| 
									
										
										
										
											2013-07-08 13:17:22 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-18 01:28:12 +00:00
										 |  |  |   float   m_sum[2048]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   qint32  m_dBStepSize; | 
					
						
							|  |  |  |   qint32  m_FreqUnits; | 
					
						
							|  |  |  |   qint32  m_hdivs; | 
					
						
							|  |  |  |   qint32  m_line; | 
					
						
							|  |  |  |   qint32  m_fSample; | 
					
						
							|  |  |  |   qint32  m_xClick; | 
					
						
							| 
									
										
										
										
											2012-09-29 17:09:05 +00:00
										 |  |  |   qint32  m_freqPerDiv; | 
					
						
							|  |  |  |   qint32  m_nsps; | 
					
						
							| 
									
										
										
										
											2012-09-30 01:03:18 +00:00
										 |  |  |   qint32  m_Percent2DScreen; | 
					
						
							| 
									
										
										
										
											2015-11-22 23:38:42 +00:00
										 |  |  |   qint32  m_Percent2DScreen0; | 
					
						
							| 
									
										
										
										
											2012-09-30 01:03:18 +00:00
										 |  |  |   qint32  m_h; | 
					
						
							|  |  |  |   qint32  m_h1; | 
					
						
							|  |  |  |   qint32  m_h2; | 
					
						
							| 
									
										
										
										
											2012-11-14 15:30:21 +00:00
										 |  |  |   qint32  m_TRperiod; | 
					
						
							| 
									
										
										
										
											2013-07-08 13:17:22 +00:00
										 |  |  |   qint32  m_rxFreq; | 
					
						
							| 
									
										
										
										
											2012-11-23 16:05:50 +00:00
										 |  |  |   qint32  m_txFreq; | 
					
						
							| 
									
										
										
										
											2013-04-03 16:44:31 +00:00
										 |  |  |   qint32  m_fMin; | 
					
						
							|  |  |  |   qint32  m_fMax; | 
					
						
							| 
									
										
										
										
											2013-07-25 16:48:10 +00:00
										 |  |  |   qint32  m_startFreq; | 
					
						
							| 
									
										
										
										
											2015-04-22 17:48:03 +00:00
										 |  |  |   qint32  m_tol; | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-07-08 13:17:22 +00:00
										 |  |  |   char    m_sutc[6]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | private slots: | 
					
						
							|  |  |  |   void mousePressEvent(QMouseEvent *event); | 
					
						
							|  |  |  |   void mouseDoubleClickEvent(QMouseEvent *event); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-18 01:28:12 +00:00
										 |  |  | extern QVector<QColor> g_ColorTbl; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-11 00:50:35 +00:00
										 |  |  | extern "C" { | 
					
						
							|  |  |  |   void flat4_(float swide[], int* iz, int* nflatten); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | #endif // PLOTTER_H
 |