| 
									
										
										
										
											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
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <QtGui>
 | 
					
						
							|  |  |  | #include <QFrame>
 | 
					
						
							|  |  |  | #include <QImage>
 | 
					
						
							| 
									
										
										
										
											2021-05-14 14:14:39 -04:00
										 |  |  | #include <QToolTip>
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | #include <cstring>
 | 
					
						
							|  |  |  | #include "commons.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define VERT_DIVS 7	//specify grid screen divisions
 | 
					
						
							|  |  |  | #define HORZ_DIVS 20
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class CPlotter : public QFrame | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   Q_OBJECT | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |   explicit CPlotter(QWidget *parent = 0); | 
					
						
							|  |  |  |   ~CPlotter(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-02 13:44:44 +01:00
										 |  |  |   QSize minimumSizeHint() const override; | 
					
						
							|  |  |  |   QSize sizeHint() const override; | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   QColor  m_ColorTbl[256]; | 
					
						
							| 
									
										
										
										
											2017-01-14 02:35:43 +00:00
										 |  |  |   bool    m_bDecodeFinished; | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   int     m_plotZero; | 
					
						
							|  |  |  |   int     m_plotGain; | 
					
						
							|  |  |  |   float   m_fSpan; | 
					
						
							|  |  |  |   qint32  m_nSpan; | 
					
						
							|  |  |  |   qint32  m_binsPerPixel; | 
					
						
							|  |  |  |   qint32  m_fQSO; | 
					
						
							|  |  |  |   qint32  m_DF; | 
					
						
							|  |  |  |   qint32  m_tol; | 
					
						
							|  |  |  |   qint32  m_fCal; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   void draw(float sw[], int i0, float splot[]);		//Update the waterfalls
 | 
					
						
							|  |  |  |   void SetRunningState(bool running); | 
					
						
							|  |  |  |   void setPlotZero(int plotZero); | 
					
						
							|  |  |  |   int  getPlotZero(); | 
					
						
							|  |  |  |   void setPlotGain(int plotGain); | 
					
						
							|  |  |  |   int  getPlotGain(); | 
					
						
							|  |  |  |   void SetCenterFreq(int f); | 
					
						
							|  |  |  |   qint64 centerFreq(); | 
					
						
							|  |  |  |   void SetStartFreq(quint64 f); | 
					
						
							|  |  |  |   qint64 startFreq(); | 
					
						
							|  |  |  |   void SetFreqOffset(quint64 f); | 
					
						
							|  |  |  |   qint64 freqOffset(); | 
					
						
							|  |  |  |   int  plotWidth(); | 
					
						
							|  |  |  |   void setNSpan(int n); | 
					
						
							|  |  |  |   void UpdateOverlay(); | 
					
						
							|  |  |  |   void setDataFromDisk(bool b); | 
					
						
							|  |  |  |   void setTol(int n); | 
					
						
							|  |  |  |   void setBinsPerPixel(int n); | 
					
						
							|  |  |  |   int  binsPerPixel(); | 
					
						
							|  |  |  |   void setFQSO(int n, bool bf); | 
					
						
							|  |  |  |   void setFcal(int n); | 
					
						
							|  |  |  |   void setNkhz(int n); | 
					
						
							| 
									
										
										
										
											2017-01-14 02:35:43 +00:00
										 |  |  |   void DecodeFinished(); | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   void DrawOverlay(); | 
					
						
							|  |  |  |   int  fQSO(); | 
					
						
							|  |  |  |   int  DF(); | 
					
						
							|  |  |  |   int  autoZero(); | 
					
						
							|  |  |  |   void setPalette(QString palette); | 
					
						
							|  |  |  |   void setFsample(int n); | 
					
						
							|  |  |  |   void setMode65(int n); | 
					
						
							|  |  |  |   void set2Dspec(bool b); | 
					
						
							|  |  |  |   double fGreen(); | 
					
						
							| 
									
										
										
										
											2013-11-03 19:30:00 +00:00
										 |  |  |   void setLockTxRx(bool b); | 
					
						
							| 
									
										
										
										
											2013-11-10 16:11:04 +00:00
										 |  |  |   double rxFreq(); | 
					
						
							| 
									
										
										
										
											2013-11-03 20:28:14 +00:00
										 |  |  |   double txFreq(); | 
					
						
							| 
									
										
										
										
											2013-11-10 16:11:04 +00:00
										 |  |  | //  void updateFreqLabel();
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | signals: | 
					
						
							|  |  |  |   void freezeDecode0(int n); | 
					
						
							|  |  |  |   void freezeDecode1(int n); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							|  |  |  |   //re-implemented widget event handlers
 | 
					
						
							| 
									
										
										
										
											2021-06-02 13:44:44 +01:00
										 |  |  |   void paintEvent(QPaintEvent *event) override; | 
					
						
							|  |  |  |   void resizeEvent(QResizeEvent* event) override; | 
					
						
							| 
									
										
										
										
											2021-05-14 14:14:39 -04:00
										 |  |  |   void mouseMoveEvent(QMouseEvent * event) override; | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   void MakeFrequencyStrs(); | 
					
						
							|  |  |  |   void UTCstr(); | 
					
						
							|  |  |  |   int XfromFreq(float f); | 
					
						
							|  |  |  |   float FreqfromX(int x); | 
					
						
							|  |  |  |   qint64 RoundFreq(qint64 freq, int resolution); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   QPixmap m_WaterfallPixmap; | 
					
						
							|  |  |  |   QPixmap m_ZoomWaterfallPixmap; | 
					
						
							|  |  |  |   QPixmap m_2DPixmap; | 
					
						
							|  |  |  |   unsigned char m_zwf[32768*400]; | 
					
						
							|  |  |  |   QPixmap m_ScalePixmap; | 
					
						
							|  |  |  |   QPixmap m_ZoomScalePixmap; | 
					
						
							|  |  |  |   QSize   m_Size; | 
					
						
							|  |  |  |   QString m_Str; | 
					
						
							|  |  |  |   QString m_HDivText[483]; | 
					
						
							|  |  |  |   bool    m_Running; | 
					
						
							|  |  |  |   bool    m_paintEventBusy; | 
					
						
							|  |  |  |   bool    m_2Dspec; | 
					
						
							|  |  |  |   bool    m_paintAllZoom; | 
					
						
							| 
									
										
										
										
											2013-11-03 19:30:00 +00:00
										 |  |  |   bool    m_bLockTxRx; | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   double  m_CenterFreq; | 
					
						
							|  |  |  |   double  m_fGreen; | 
					
						
							| 
									
										
										
										
											2013-11-03 19:30:00 +00:00
										 |  |  |   double  m_TXfreq; | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   qint64  m_StartFreq; | 
					
						
							|  |  |  |   qint64  m_ZoomStartFreq; | 
					
						
							|  |  |  |   qint64  m_FreqOffset; | 
					
						
							|  |  |  |   qint32  m_dBStepSize; | 
					
						
							|  |  |  |   qint32  m_FreqUnits; | 
					
						
							|  |  |  |   qint32  m_hdivs; | 
					
						
							|  |  |  |   bool    m_dataFromDisk; | 
					
						
							| 
									
										
										
										
											2021-04-14 23:41:52 +01:00
										 |  |  |   QString m_sutc; | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   qint32  m_line; | 
					
						
							|  |  |  |   qint32  m_hist1[256]; | 
					
						
							|  |  |  |   qint32  m_hist2[256]; | 
					
						
							|  |  |  |   qint32  m_z1; | 
					
						
							|  |  |  |   qint32  m_z2; | 
					
						
							|  |  |  |   qint32  m_nkhz; | 
					
						
							|  |  |  |   qint32  m_fSample; | 
					
						
							|  |  |  |   qint32  m_mode65; | 
					
						
							|  |  |  |   qint32  m_i0; | 
					
						
							|  |  |  |   qint32  m_xClick; | 
					
						
							| 
									
										
										
										
											2013-11-03 19:30:00 +00:00
										 |  |  |   qint32  m_TXkHz; | 
					
						
							|  |  |  |   qint32  m_TxDF; | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | private slots: | 
					
						
							| 
									
										
										
										
											2021-06-02 13:44:44 +01:00
										 |  |  |   void mousePressEvent(QMouseEvent *event) override; | 
					
						
							|  |  |  |   void mouseDoubleClickEvent(QMouseEvent *event) override; | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif // PLOTTER_H
 |