diff options
27 files changed, 1056 insertions, 1008 deletions
diff --git a/gr-qtgui/include/gnuradio/qtgui/ConstellationDisplayPlot.h b/gr-qtgui/include/gnuradio/qtgui/ConstellationDisplayPlot.h index 52a74b6d40..bcee59f1a0 100644 --- a/gr-qtgui/include/gnuradio/qtgui/ConstellationDisplayPlot.h +++ b/gr-qtgui/include/gnuradio/qtgui/ConstellationDisplayPlot.h @@ -65,10 +65,10 @@ public slots: private: void _autoScale(double bottom, double top); - std::vector<double*> _realDataPoints; - std::vector<double*> _imagDataPoints; + std::vector<double*> d_real_data; + std::vector<double*> d_imag_data; - int64_t _penSize; + int64_t d_pen_size; }; #endif /* CONSTELLATION_DISPLAY_PLOT_H */ diff --git a/gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h b/gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h index 80cce3810c..3b311918c6 100644 --- a/gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h +++ b/gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h @@ -271,22 +271,22 @@ protected slots: virtual void legendEntryChecked(QwtPlotItem *plotItem, bool on); protected: - int _nplots; - std::vector<QwtPlotCurve*> _plot_curve; + int d_nplots; + std::vector<QwtPlotCurve*> d_plot_curve; - QwtPlotPanner* _panner; - QwtPlotZoomer* _zoomer; + QwtPlotPanner* d_panner; + QwtPlotZoomer* d_zoomer; - QwtDblClickPlotPicker *_picker; - QwtPlotMagnifier *_magnifier; + QwtDblClickPlotPicker *d_picker; + QwtPlotMagnifier *d_magnifier; - int64_t _numPoints; + int64_t d_numPoints; - bool _stop; + bool d_stop; - QList<QColor> _trace_colors; + QList<QColor> d_trace_colors; - bool _autoscale_state; + bool d_autoscale_state; }; #endif /* DOMAIN_DISPLAY_PLOT_H */ diff --git a/gr-qtgui/include/gnuradio/qtgui/FrequencyDisplayPlot.h b/gr-qtgui/include/gnuradio/qtgui/FrequencyDisplayPlot.h index 220dcd7546..f5e8f0f7ad 100644 --- a/gr-qtgui/include/gnuradio/qtgui/FrequencyDisplayPlot.h +++ b/gr-qtgui/include/gnuradio/qtgui/FrequencyDisplayPlot.h @@ -120,45 +120,45 @@ private: void _resetXAxisPoints(); void _autoScale(double bottom, double top); - std::vector<double*> _dataPoints; - - QwtPlotCurve* _min_fft_plot_curve; - QwtPlotCurve* _max_fft_plot_curve; - QColor _min_fft_color; - bool _min_fft_visible; - QColor _max_fft_color; - bool _max_fft_visible; - QColor _marker_lower_intensity_color; - bool _marker_lower_intensity_visible; - QColor _marker_upper_intensity_color; - bool _marker_upper_intensity_visible; - QColor _marker_peak_amplitude_color; - QColor _marker_noise_floor_amplitude_color; - bool _marker_noise_floor_amplitude_visible; - QColor _marker_CF_color; - - double _startFrequency; - double _stopFrequency; - double _maxYAxis; - double _minYAxis; - - QwtPlotMarker* _lower_intensity_marker; - QwtPlotMarker* _upper_intensity_marker; - - QwtPlotMarker *_markerPeakAmplitude; - QwtPlotMarker *_markerNoiseFloorAmplitude; - QwtPlotMarker *_markerCF; - - double* _xAxisPoints; - int _xAxisMultiplier; - - double* _minFFTPoints; - double* _maxFFTPoints; - - double _peakFrequency; - double _peakAmplitude; - - double _noiseFloorAmplitude; + std::vector<double*> d_ydata; + + QwtPlotCurve* d_min_fft_plot_curve; + QwtPlotCurve* d_max_fft_plot_curve; + QColor d_min_fft_color; + bool d_min_fft_visible; + QColor d_max_fft_color; + bool d_max_fft_visible; + QColor d_marker_lower_intensity_color; + bool d_marker_lower_intensity_visible; + QColor d_marker_upper_intensity_color; + bool d_marker_upper_intensity_visible; + QColor d_marker_peak_amplitude_color; + QColor d_marker_noise_floor_amplitude_color; + bool d_marker_noise_floor_amplitude_visible; + QColor d_marker_cf_color; + + double d_start_frequency; + double d_stop_frequency; + double d_ymax; + double d_ymin; + + QwtPlotMarker* d_lower_intensity_marker; + QwtPlotMarker* d_upper_intensity_marker; + + QwtPlotMarker *d_marker_peak_amplitude; + QwtPlotMarker *d_marker_noise_floor_amplitude; + QwtPlotMarker *d_marker_cf; + + double* d_xdata; + int d_xdata_multiplier; + + double* d_min_fft_data; + double* d_max_fft_data; + + double d_peak_frequency; + double d_peak_amplitude; + + double d_noise_floor_amplitude; }; #endif /* FREQUENCY_DISPLAY_PLOT_HPP */ diff --git a/gr-qtgui/include/gnuradio/qtgui/HistogramDisplayPlot.h b/gr-qtgui/include/gnuradio/qtgui/HistogramDisplayPlot.h index 04b23ee27c..27002bd4a6 100644 --- a/gr-qtgui/include/gnuradio/qtgui/HistogramDisplayPlot.h +++ b/gr-qtgui/include/gnuradio/qtgui/HistogramDisplayPlot.h @@ -63,8 +63,8 @@ private: void _resetXAxisPoints(double left, double right); void _autoScaleY(double bottom, double top); - double* _xAxisPoints; - std::vector<double*> _yDataPoints; + double* d_xdata; + std::vector<double*> d_ydata; int d_bins; bool d_accum; @@ -73,7 +73,7 @@ private: bool d_semilogx; bool d_semilogy; - bool _autoscalex_state; + bool d_autoscalex_state; }; #endif /* HISTOGRAM_DISPLAY_PLOT_H */ diff --git a/gr-qtgui/include/gnuradio/qtgui/TimeDomainDisplayPlot.h b/gr-qtgui/include/gnuradio/qtgui/TimeDomainDisplayPlot.h index 9101292779..4e0d0bdb37 100644 --- a/gr-qtgui/include/gnuradio/qtgui/TimeDomainDisplayPlot.h +++ b/gr-qtgui/include/gnuradio/qtgui/TimeDomainDisplayPlot.h @@ -66,10 +66,10 @@ private: void _resetXAxisPoints(); void _autoScale(double bottom, double top); - std::vector<double*> _dataPoints; - double* _xAxisPoints; + std::vector<double*> d_ydata; + double* d_xdata; - double _sampleRate; + double d_sample_rate; bool d_semilogx; bool d_semilogy; diff --git a/gr-qtgui/include/gnuradio/qtgui/WaterfallDisplayPlot.h b/gr-qtgui/include/gnuradio/qtgui/WaterfallDisplayPlot.h index cff06572bc..156f6bf93d 100644 --- a/gr-qtgui/include/gnuradio/qtgui/WaterfallDisplayPlot.h +++ b/gr-qtgui/include/gnuradio/qtgui/WaterfallDisplayPlot.h @@ -103,9 +103,9 @@ signals: private: void _updateIntensityRangeDisplay(); - double _startFrequency; - double _stopFrequency; - int _xAxisMultiplier; + double d_start_frequency; + double d_stop_frequency; + int d_xaxis_multiplier; std::vector<WaterfallData*> d_data; @@ -115,9 +115,9 @@ private: std::vector<QwtPlotSpectrogram*> d_spectrogram; #endif - std::vector<int> _intensityColorMapType; - QColor _userDefinedLowIntensityColor; - QColor _userDefinedHighIntensityColor; + std::vector<int> d_intensity_color_map_type; + QColor d_user_defined_low_intensity_color; + QColor d_user_defined_high_intensity_color; }; #endif /* WATERFALL_DISPLAY_PLOT_H */ diff --git a/gr-qtgui/include/gnuradio/qtgui/constellationdisplayform.h b/gr-qtgui/include/gnuradio/qtgui/constellationdisplayform.h index 605fb4196e..fb14388fce 100644 --- a/gr-qtgui/include/gnuradio/qtgui/constellationdisplayform.h +++ b/gr-qtgui/include/gnuradio/qtgui/constellationdisplayform.h @@ -60,7 +60,7 @@ private slots: void newData(const QEvent*); private: - QIntValidator* _intValidator; + QIntValidator* d_int_validator; int d_npoints; }; diff --git a/gr-qtgui/include/gnuradio/qtgui/displayform.h b/gr-qtgui/include/gnuradio/qtgui/displayform.h index 54f878dc47..d8d7e74cf8 100644 --- a/gr-qtgui/include/gnuradio/qtgui/displayform.h +++ b/gr-qtgui/include/gnuradio/qtgui/displayform.h @@ -97,39 +97,39 @@ signals: void plotPointSelected(const QPointF p, int type); protected: - bool _isclosed; + bool d_isclosed; - int _nplots; + int d_nplots; - QGridLayout *_layout; - DisplayPlot* _displayPlot; - bool _systemSpecifiedFlag; + QGridLayout *d_layout; + DisplayPlot* d_display_plot; + bool d_system_specified_flag; - QwtPlotGrid *_grid; + QwtPlotGrid *d_grid; - bool _menu_on; - QMenu *_menu; + bool d_menu_on; + QMenu *d_menu; - QAction *_stop_act; - bool _stop_state; - QAction *_grid_act; - bool _grid_state; + QAction *d_stop_act; + bool d_stop_state; + QAction *d_grid_act; + bool d_grid_state; - QAction *_autoscale_act; - bool _autoscale_state; + QAction *d_autoscale_act; + bool d_autoscale_state; - QList<QMenu*> _lines_menu; - QList<LineTitleAction*> _line_title_act; - QList<LineColorMenu*> _line_color_menu; - QList<LineWidthMenu*> _line_width_menu; - QList<LineStyleMenu*> _line_style_menu; - QList<LineMarkerMenu*> _line_marker_menu; - QList<MarkerAlphaMenu*> _marker_alpha_menu; + QList<QMenu*> d_lines_menu; + QList<LineTitleAction*> d_line_title_act; + QList<LineColorMenu*> d_line_color_menu; + QList<LineWidthMenu*> d_line_width_menu; + QList<LineStyleMenu*> d_line_style_menu; + QList<LineMarkerMenu*> d_line_marker_menu; + QList<MarkerAlphaMenu*> d_marker_alpha_menu; - PopupMenu *_samp_rate_act; - QAction *_save_act; + PopupMenu *d_samp_rate_act; + QAction *d_save_act; - QTimer *d_displayTimer; + QTimer *d_display_timer; double d_update_time; }; diff --git a/gr-qtgui/include/gnuradio/qtgui/freqdisplayform.h b/gr-qtgui/include/gnuradio/qtgui/freqdisplayform.h index 48dd1a6377..9a69810276 100644 --- a/gr-qtgui/include/gnuradio/qtgui/freqdisplayform.h +++ b/gr-qtgui/include/gnuradio/qtgui/freqdisplayform.h @@ -66,13 +66,13 @@ private slots: void newData(const QEvent *updateEvent); private: - uint64_t _numRealDataPoints; - QIntValidator* _intValidator; + uint64_t d_num_real_data_points; + QIntValidator* d_int_validator; - double _samp_rate, _center_freq; - int _fftsize; - float _fftavg; - gr::filter::firdes::win_type _fftwintype; + double d_samp_rate, d_center_freq; + int d_fftsize; + float d_fftavg; + gr::filter::firdes::win_type d_fftwintype; }; #endif /* FREQ_DISPLAY_FORM_H */ diff --git a/gr-qtgui/include/gnuradio/qtgui/histogramdisplayform.h b/gr-qtgui/include/gnuradio/qtgui/histogramdisplayform.h index 6766b66741..16a64b703a 100644 --- a/gr-qtgui/include/gnuradio/qtgui/histogramdisplayform.h +++ b/gr-qtgui/include/gnuradio/qtgui/histogramdisplayform.h @@ -64,10 +64,10 @@ private slots: void newData(const QEvent*); private: - QIntValidator* _intValidator; + QIntValidator* d_int_validator; - double _startFrequency; - double _stopFrequency; + double d_startFrequency; + double d_stopFrequency; int d_npoints; @@ -79,8 +79,8 @@ private: QAction *d_semilogxmenu; QAction *d_semilogymenu; - QAction *_autoscalex_act; - bool _autoscalex_state; + QAction *d_autoscalex_act; + bool d_autoscalex_state; }; #endif /* HISTOGRAM_DISPLAY_FORM_H */ diff --git a/gr-qtgui/include/gnuradio/qtgui/timedisplayform.h b/gr-qtgui/include/gnuradio/qtgui/timedisplayform.h index b1cf1dbd2f..2a7b188069 100644 --- a/gr-qtgui/include/gnuradio/qtgui/timedisplayform.h +++ b/gr-qtgui/include/gnuradio/qtgui/timedisplayform.h @@ -81,10 +81,10 @@ private slots: void newData(const QEvent*); private: - QIntValidator* _intValidator; + QIntValidator* d_int_validator; - double _startFrequency; - double _stopFrequency; + double d_start_frequency; + double d_stop_frequency; int d_npoints; diff --git a/gr-qtgui/include/gnuradio/qtgui/timerasterdisplayform.h b/gr-qtgui/include/gnuradio/qtgui/timerasterdisplayform.h index 24933c3c05..dff2986cc8 100644 --- a/gr-qtgui/include/gnuradio/qtgui/timerasterdisplayform.h +++ b/gr-qtgui/include/gnuradio/qtgui/timerasterdisplayform.h @@ -86,8 +86,8 @@ private slots: void newData(const QEvent *updateEvent); private: - double _min_val; - double _max_val; + double d_min_val; + double d_max_val; }; #endif /* TIMERASTER_DISPLAY_FORM_H */ diff --git a/gr-qtgui/include/gnuradio/qtgui/waterfalldisplayform.h b/gr-qtgui/include/gnuradio/qtgui/waterfalldisplayform.h index f615eda2e9..926d1cec12 100644 --- a/gr-qtgui/include/gnuradio/qtgui/waterfalldisplayform.h +++ b/gr-qtgui/include/gnuradio/qtgui/waterfalldisplayform.h @@ -83,16 +83,15 @@ private slots: void newData(const QEvent *updateEvent); private: - uint64_t _numRealDataPoints; - QIntValidator* _intValidator; + QIntValidator* d_int_validator; - double _samp_rate, _center_freq; - int _fftsize; - float _fftavg; - gr::filter::firdes::win_type _fftwintype; + double d_samp_rate, d_center_freq; + int d_fftsize; + float d_fftavg; + gr::filter::firdes::win_type d_fftwintype; - double _min_val; - double _max_val; + double d_min_val; + double d_max_val; }; #endif /* WATERFALL_DISPLAY_FORM_H */ diff --git a/gr-qtgui/lib/ConstellationDisplayPlot.cc b/gr-qtgui/lib/ConstellationDisplayPlot.cc index f14016743f..af27fc4ea4 100644 --- a/gr-qtgui/lib/ConstellationDisplayPlot.cc +++ b/gr-qtgui/lib/ConstellationDisplayPlot.cc @@ -62,26 +62,26 @@ ConstellationDisplayPlot::ConstellationDisplayPlot(int nplots, QWidget* parent) { resize(parent->width(), parent->height()); - _numPoints = 1024; - _penSize = 5; + d_numPoints = 1024; + d_pen_size = 5; - _zoomer = new ConstellationDisplayZoomer(canvas()); + d_zoomer = new ConstellationDisplayZoomer(canvas()); #if QWT_VERSION < 0x060000 - _zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection); + d_zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection); #endif - _zoomer->setMousePattern(QwtEventPattern::MouseSelect2, - Qt::RightButton, Qt::ControlModifier); - _zoomer->setMousePattern(QwtEventPattern::MouseSelect3, - Qt::RightButton); + d_zoomer->setMousePattern(QwtEventPattern::MouseSelect2, + Qt::RightButton, Qt::ControlModifier); + d_zoomer->setMousePattern(QwtEventPattern::MouseSelect3, + Qt::RightButton); const QColor c(Qt::darkRed); - _zoomer->setRubberBandPen(c); - _zoomer->setTrackerPen(c); + d_zoomer->setRubberBandPen(c); + d_zoomer->setTrackerPen(c); - _magnifier->setAxisEnabled(QwtPlot::xBottom, true); - _magnifier->setAxisEnabled(QwtPlot::yLeft, true); + d_magnifier->setAxisEnabled(QwtPlot::xBottom, true); + d_magnifier->setAxisEnabled(QwtPlot::yLeft, true); setAxisScaleEngine(QwtPlot::xBottom, new QwtLinearScaleEngine); set_xaxis(-2.0, 2.0); @@ -100,24 +100,25 @@ ConstellationDisplayPlot::ConstellationDisplayPlot(int nplots, QWidget* parent) // Setup dataPoints and plot vectors // Automatically deleted when parent is deleted - for(int i = 0; i < _nplots; i++) { - _realDataPoints.push_back(new double[_numPoints]); - _imagDataPoints.push_back(new double[_numPoints]); - memset(_realDataPoints[i], 0x0, _numPoints*sizeof(double)); - memset(_imagDataPoints[i], 0x0, _numPoints*sizeof(double)); - - _plot_curve.push_back(new QwtPlotCurve(QString("Data %1").arg(i))); - _plot_curve[i]->attach(this); - _plot_curve[i]->setPen(QPen(colors[i])); + for(int i = 0; i < d_nplots; i++) { + d_real_data.push_back(new double[d_numPoints]); + d_imag_data.push_back(new double[d_numPoints]); + memset(d_real_data[i], 0x0, d_numPoints*sizeof(double)); + memset(d_imag_data[i], 0x0, d_numPoints*sizeof(double)); + + d_plot_curve.push_back(new QwtPlotCurve(QString("Data %1").arg(i))); + d_plot_curve[i]->attach(this); + d_plot_curve[i]->setPen(QPen(colors[i])); - QwtSymbol *symbol = new QwtSymbol(QwtSymbol::NoSymbol, QBrush(colors[i]), QPen(colors[i]), QSize(7,7)); + QwtSymbol *symbol = new QwtSymbol(QwtSymbol::NoSymbol, QBrush(colors[i]), + QPen(colors[i]), QSize(7,7)); #if QWT_VERSION < 0x060000 - _plot_curve[i]->setRawData(_realDataPoints[i], _imagDataPoints[i], _numPoints); - _plot_curve[i]->setSymbol(*symbol); + d_plot_curve[i]->setRawData(d_real_data[i], d_imag_data[i], d_numPoints); + d_plot_curve[i]->setSymbol(*symbol); #else - _plot_curve[i]->setRawSamples(_realDataPoints[i], _imagDataPoints[i], _numPoints); - _plot_curve[i]->setSymbol(symbol); + d_plot_curve[i]->setRawSamples(d_real_data[i], d_imag_data[i], d_numPoints); + d_plot_curve[i]->setSymbol(symbol); #endif setLineStyle(i, Qt::NoPen); @@ -127,13 +128,13 @@ ConstellationDisplayPlot::ConstellationDisplayPlot(int nplots, QWidget* parent) ConstellationDisplayPlot::~ConstellationDisplayPlot() { - for(int i = 0; i < _nplots; i++) { - delete [] _realDataPoints[i]; - delete [] _imagDataPoints[i]; + for(int i = 0; i < d_nplots; i++) { + delete [] d_real_data[i]; + delete [] d_imag_data[i]; } - // _fft_plot_curves deleted when parent deleted - // _zoomer and _panner deleted when parent deleted + // d_plot_curves deleted when parent deleted + // d_zoomer and d_panner deleted when parent deleted } void @@ -160,9 +161,10 @@ void ConstellationDisplayPlot::set_pen_size(int size) { if(size > 0 && size < 30){ - _penSize = size; - for(int i = 0; i < _nplots; i++) { - _plot_curve[i]->setPen(QPen(Qt::blue, _penSize, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); + d_pen_size = size; + for(int i = 0; i < d_nplots; i++) { + d_plot_curve[i]->setPen(QPen(Qt::blue, d_pen_size, Qt::SolidLine, + Qt::RoundCap, Qt::RoundJoin)); } } } @@ -180,33 +182,33 @@ ConstellationDisplayPlot::plotNewData(const std::vector<double*> realDataPoints, const int64_t numDataPoints, const double timeInterval) { - if(!_stop) { + if(!d_stop) { if((numDataPoints > 0)) { - if(numDataPoints != _numPoints) { - _numPoints = numDataPoints; + if(numDataPoints != d_numPoints) { + d_numPoints = numDataPoints; - for(int i = 0; i < _nplots; i++) { - delete [] _realDataPoints[i]; - delete [] _imagDataPoints[i]; - _realDataPoints[i] = new double[_numPoints]; - _imagDataPoints[i] = new double[_numPoints]; + for(int i = 0; i < d_nplots; i++) { + delete [] d_real_data[i]; + delete [] d_imag_data[i]; + d_real_data[i] = new double[d_numPoints]; + d_imag_data[i] = new double[d_numPoints]; #if QWT_VERSION < 0x060000 - _plot_curve[i]->setRawData(_realDataPoints[i], _imagDataPoints[i], _numPoints); + d_plot_curve[i]->setRawData(d_real_data[i], d_imag_data[i], d_numPoints); #else - _plot_curve[i]->setRawSamples(_realDataPoints[i], _imagDataPoints[i], _numPoints); + d_plot_curve[i]->setRawSamples(d_real_data[i], d_imag_data[i], d_numPoints); #endif } } - for(int i = 0; i < _nplots; i++) { - memcpy(_realDataPoints[i], realDataPoints[i], numDataPoints*sizeof(double)); - memcpy(_imagDataPoints[i], imagDataPoints[i], numDataPoints*sizeof(double)); + for(int i = 0; i < d_nplots; i++) { + memcpy(d_real_data[i], realDataPoints[i], numDataPoints*sizeof(double)); + memcpy(d_imag_data[i], imagDataPoints[i], numDataPoints*sizeof(double)); } - if(_autoscale_state) { + if(d_autoscale_state) { double bottom=1e20, top=-1e20; - for(int n = 0; n < _nplots; n++) { + for(int n = 0; n < d_nplots; n++) { for(int64_t point = 0; point < numDataPoints; point++) { double b = std::min(realDataPoints[n][point], imagDataPoints[n][point]); double t = std::max(realDataPoints[n][point], imagDataPoints[n][point]); @@ -253,7 +255,7 @@ ConstellationDisplayPlot::_autoScale(double bottom, double top) void ConstellationDisplayPlot::setAutoScale(bool state) { - _autoscale_state = state; + d_autoscale_state = state; } #endif /* CONSTELLATION_DISPLAY_PLOT_C */ diff --git a/gr-qtgui/lib/DisplayPlot.cc b/gr-qtgui/lib/DisplayPlot.cc index 3fe16f68bd..5c29381906 100644 --- a/gr-qtgui/lib/DisplayPlot.cc +++ b/gr-qtgui/lib/DisplayPlot.cc @@ -30,12 +30,12 @@ #include <QDebug> DisplayPlot::DisplayPlot(int nplots, QWidget* parent) - : QwtPlot(parent), _nplots(nplots), _stop(false) + : QwtPlot(parent), d_nplots(nplots), d_stop(false) { qRegisterMetaType<QColorList>("QColorList"); resize(parent->width(), parent->height()); - _autoscale_state = false; + d_autoscale_state = false; // Disable polygon clipping #if QWT_VERSION < 0x060000 @@ -53,25 +53,25 @@ DisplayPlot::DisplayPlot(int nplots, QWidget* parent) QColor default_palette_color = QColor("white"); setPaletteColor(default_palette_color); - _panner = new QwtPlotPanner(canvas()); - _panner->setAxisEnabled(QwtPlot::yRight, false); - _panner->setMouseButton(Qt::MidButton, Qt::ControlModifier); + d_panner = new QwtPlotPanner(canvas()); + d_panner->setAxisEnabled(QwtPlot::yRight, false); + d_panner->setMouseButton(Qt::MidButton, Qt::ControlModifier); // emit the position of clicks on widget - _picker = new QwtDblClickPlotPicker(canvas()); + d_picker = new QwtDblClickPlotPicker(canvas()); #if QWT_VERSION < 0x060000 - connect(_picker, SIGNAL(selected(const QwtDoublePoint &)), + connect(d_picker, SIGNAL(selected(const QwtDoublePoint &)), this, SLOT(onPickerPointSelected(const QwtDoublePoint &))); #else - _picker->setStateMachine(new QwtPickerDblClickPointMachine()); - connect(_picker, SIGNAL(selected(const QPointF &)), + d_picker->setStateMachine(new QwtPickerDblClickPointMachine()); + connect(d_picker, SIGNAL(selected(const QPointF &)), this, SLOT(onPickerPointSelected6(const QPointF &))); #endif // Configure magnify on mouse wheel - _magnifier = new QwtPlotMagnifier(canvas()); - _magnifier->setAxisEnabled(QwtPlot::xBottom, false); + d_magnifier = new QwtPlotMagnifier(canvas()); + d_magnifier->setAxisEnabled(QwtPlot::xBottom, false); // Avoid jumping when labels with more/less digits // appear/disappear when scrolling vertically @@ -90,7 +90,7 @@ DisplayPlot::DisplayPlot(int nplots, QWidget* parent) DisplayPlot::~DisplayPlot() { - // _zoomer and _panner deleted when parent deleted + // d_zoomer and d_panner deleted when parent deleted } @@ -98,59 +98,60 @@ void DisplayPlot::setYaxis(double min, double max) { setAxisScale(QwtPlot::yLeft, min, max); - if(!_autoscale_state) - _zoomer->setZoomBase(); + if(!d_autoscale_state) + d_zoomer->setZoomBase(); } void DisplayPlot::setXaxis(double min, double max) { setAxisScale(QwtPlot::xBottom, min, max); - _zoomer->setZoomBase(); + d_zoomer->setZoomBase(); } void DisplayPlot::setLineLabel(int which, QString label) { - _plot_curve[which]->setTitle(label); + d_plot_curve[which]->setTitle(label); } QString DisplayPlot::getLineLabel(int which) { - return _plot_curve[which]->title().text(); + return d_plot_curve[which]->title().text(); } void DisplayPlot::setLineColor(int which, QColor color) { - if (which < _nplots) { + if (which < d_nplots) { // Set the color of the pen - QPen pen(_plot_curve[which]->pen()); + QPen pen(d_plot_curve[which]->pen()); pen.setColor(color); - _plot_curve[which]->setPen(pen); + d_plot_curve[which]->setPen(pen); // And set the color of the markers #if QWT_VERSION < 0x060000 - //_plot_curve[which]->setBrush(QBrush(QColor(color))); - _plot_curve[which]->setPen(pen); - QwtSymbol sym = (QwtSymbol)_plot_curve[which]->symbol(); + //d_plot_curve[which]->setBrush(QBrush(QColor(color))); + d_plot_curve[which]->setPen(pen); + QwtSymbol sym = (QwtSymbol)d_plot_curve[which]->symbol(); setLineMarker(which, sym.style()); #else - QwtSymbol *sym = (QwtSymbol*)_plot_curve[which]->symbol(); + QwtSymbol *sym = (QwtSymbol*)d_plot_curve[which]->symbol(); if(sym) { sym->setColor(color); sym->setPen(pen); - _plot_curve[which]->setSymbol(sym); + d_plot_curve[which]->setSymbol(sym); } #endif } } QColor -DisplayPlot::getLineColor(int which) const { +DisplayPlot::getLineColor(int which) const +{ // If that plot doesn't exist then return black. - if (which < _nplots) - return _plot_curve[which]->pen().color(); + if (which < d_nplots) + return d_plot_curve[which]->pen().color(); return QColor("black"); } @@ -178,13 +179,13 @@ SETUPLINE(9, 8) void DisplayPlot::setZoomerColor(QColor c) { - _zoomer->setRubberBandPen(c); - _zoomer->setTrackerPen(c); + d_zoomer->setRubberBandPen(c); + d_zoomer->setTrackerPen(c); } QColor DisplayPlot::getZoomerColor() const { - return _zoomer->rubberBandPen().color(); + return d_zoomer->rubberBandPen().color(); } void @@ -253,22 +254,22 @@ DisplayPlot::getAxesLabelFontSize() const { void DisplayPlot::setLineWidth(int which, int width) { - if (which < _nplots) { + if(which < d_nplots) { // Set the new line width - QPen pen(_plot_curve[which]->pen()); + QPen pen(d_plot_curve[which]->pen()); pen.setWidth(width); - _plot_curve[which]->setPen(pen); + d_plot_curve[which]->setPen(pen); // Scale the marker size proportionally #if QWT_VERSION < 0x060000 - QwtSymbol sym = (QwtSymbol)_plot_curve[which]->symbol(); + QwtSymbol sym = (QwtSymbol)d_plot_curve[which]->symbol(); sym.setSize(7+10*log10(1.0*width), 7+10*log10(1.0*width)); - _plot_curve[which]->setSymbol(sym); + d_plot_curve[which]->setSymbol(sym); #else - QwtSymbol *sym = (QwtSymbol*)_plot_curve[which]->symbol(); + QwtSymbol *sym = (QwtSymbol*)d_plot_curve[which]->symbol(); if(sym) { sym->setSize(7+10*log10(1.0*width), 7+10*log10(1.0*width)); - _plot_curve[which]->setSymbol(sym); + d_plot_curve[which]->setSymbol(sym); } #endif } @@ -276,9 +277,10 @@ DisplayPlot::setLineWidth(int which, int width) int DisplayPlot::getLineWidth(int which) const { - if (which < _nplots) { - return _plot_curve[which]->pen().width(); - } else { + if (which < d_nplots) { + return d_plot_curve[which]->pen().width(); + } + else { return 0; } } @@ -286,19 +288,20 @@ DisplayPlot::getLineWidth(int which) const { void DisplayPlot::setLineStyle(int which, Qt::PenStyle style) { - if (which < _nplots) { - QPen pen(_plot_curve[which]->pen()); + if(which < d_nplots) { + QPen pen(d_plot_curve[which]->pen()); pen.setStyle(style); - _plot_curve[which]->setPen(pen); + d_plot_curve[which]->setPen(pen); } } const Qt::PenStyle DisplayPlot::getLineStyle(int which) const { - if (which < _nplots) { - return _plot_curve[which]->pen().style(); - } else { + if(which < d_nplots) { + return d_plot_curve[which]->pen().style(); + } + else { return Qt::SolidLine; } } @@ -306,20 +309,20 @@ DisplayPlot::getLineStyle(int which) const void DisplayPlot::setLineMarker(int which, QwtSymbol::Style marker) { - if (which < _nplots) { + if(which < d_nplots) { #if QWT_VERSION < 0x060000 - QwtSymbol sym = (QwtSymbol)_plot_curve[which]->symbol(); - QPen pen(_plot_curve[which]->pen()); + QwtSymbol sym = (QwtSymbol)d_plot_curve[which]->symbol(); + QPen pen(d_plot_curve[which]->pen()); QBrush brush(pen.color()); sym.setStyle(marker); sym.setPen(pen); sym.setBrush(brush); - _plot_curve[which]->setSymbol(sym); + d_plot_curve[which]->setSymbol(sym); #else - QwtSymbol *sym = (QwtSymbol*)_plot_curve[which]->symbol(); + QwtSymbol *sym = (QwtSymbol*)d_plot_curve[which]->symbol(); if(sym) { sym->setStyle(marker); - _plot_curve[which]->setSymbol(sym); + d_plot_curve[which]->setSymbol(sym); } #endif } @@ -328,12 +331,12 @@ DisplayPlot::setLineMarker(int which, QwtSymbol::Style marker) const QwtSymbol::Style DisplayPlot::getLineMarker(int which) const { - if(which < _nplots) { + if(which < d_nplots) { #if QWT_VERSION < 0x060000 - QwtSymbol sym = (QwtSymbol)_plot_curve[which]->symbol(); + QwtSymbol sym = (QwtSymbol)d_plot_curve[which]->symbol(); return sym.style(); #else - QwtSymbol *sym = (QwtSymbol*)_plot_curve[which]->symbol(); + QwtSymbol *sym = (QwtSymbol*)d_plot_curve[which]->symbol(); return sym->style(); #endif } @@ -345,26 +348,26 @@ DisplayPlot::getLineMarker(int which) const void DisplayPlot::setMarkerAlpha(int which, int alpha) { - if (which < _nplots) { + if (which < d_nplots) { // Get the pen color - QPen pen(_plot_curve[which]->pen()); + QPen pen(d_plot_curve[which]->pen()); QColor color = pen.color(); // Set new alpha and update pen color.setAlpha(alpha); pen.setColor(color); - _plot_curve[which]->setPen(pen); + d_plot_curve[which]->setPen(pen); // And set the new color for the markers #if QWT_VERSION < 0x060000 - QwtSymbol sym = (QwtSymbol)_plot_curve[which]->symbol(); + QwtSymbol sym = (QwtSymbol)d_plot_curve[which]->symbol(); setLineMarker(which, sym.style()); #else - QwtSymbol *sym = (QwtSymbol*)_plot_curve[which]->symbol(); + QwtSymbol *sym = (QwtSymbol*)d_plot_curve[which]->symbol(); if(sym) { sym->setColor(color); sym->setPen(pen); - _plot_curve[which]->setSymbol(sym); + d_plot_curve[which]->setSymbol(sym); } #endif } @@ -373,9 +376,10 @@ DisplayPlot::setMarkerAlpha(int which, int alpha) int DisplayPlot::getMarkerAlpha(int which) const { - if (which < _nplots) { - return _plot_curve[which]->pen().color().alpha(); - } else { + if(which < d_nplots) { + return d_plot_curve[which]->pen().color().alpha(); + } + else { return 0; } } @@ -383,7 +387,7 @@ DisplayPlot::getMarkerAlpha(int which) const void DisplayPlot::setStop(bool on) { - _stop = on; + d_stop = on; } void diff --git a/gr-qtgui/lib/FrequencyDisplayPlot.cc b/gr-qtgui/lib/FrequencyDisplayPlot.cc index 3784ec1501..85fd14f5b9 100644 --- a/gr-qtgui/lib/FrequencyDisplayPlot.cc +++ b/gr-qtgui/lib/FrequencyDisplayPlot.cc @@ -52,7 +52,7 @@ public: void setUnitType(const std::string &type) { - _unitType = type; + d_unitType = type; } protected: @@ -62,12 +62,12 @@ protected: QwtDoublePoint dp = QwtPlotZoomer::invTransform(p); QwtText t(QString("%1 %2, %3 dB") .arg(dp.x(), 0, 'f', getFrequencyPrecision()) - .arg(_unitType.c_str()).arg(dp.y(), 0, 'f', 2)); + .arg(d_unitType.c_str()).arg(dp.y(), 0, 'f', 2)); return t; } private: - std::string _unitType; + std::string d_unitType; }; @@ -77,21 +77,21 @@ private: FrequencyDisplayPlot::FrequencyDisplayPlot(int nplots, QWidget* parent) : DisplayPlot(nplots, parent) { - _startFrequency = -1; - _stopFrequency = 1; + d_start_frequency = -1; + d_stop_frequency = 1; - _numPoints = 1024; - _minFFTPoints = new double[_numPoints]; - _maxFFTPoints = new double[_numPoints]; - _xAxisPoints = new double[_numPoints]; + d_numPoints = 1024; + d_min_fft_data = new double[d_numPoints]; + d_max_fft_data = new double[d_numPoints]; + d_xdata = new double[d_numPoints]; setAxisTitle(QwtPlot::xBottom, "Frequency (Hz)"); setAxisScaleDraw(QwtPlot::xBottom, new FreqDisplayScaleDraw(0)); - _minYAxis = -120; - _maxYAxis = 10; + d_ymin = -120; + d_ymax = 10; setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine); - setAxisScale(QwtPlot::yLeft, _minYAxis, _maxYAxis); + setAxisScale(QwtPlot::yLeft, d_ymin, d_ymax); setAxisTitle(QwtPlot::yLeft, "Power (dB)"); QList<QColor> default_colors; @@ -101,101 +101,101 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(int nplots, QWidget* parent) << QColor(Qt::darkGreen) << QColor(Qt::darkBlue) << QColor(Qt::darkGray); // Automatically deleted when parent is deleted - for(int i = 0; i < _nplots; i++) { - _dataPoints.push_back(new double[_numPoints]); - memset(_dataPoints[i], 0x0, _numPoints*sizeof(double)); + for(int i = 0; i < d_nplots; i++) { + d_ydata.push_back(new double[d_numPoints]); + memset(d_ydata[i], 0x0, d_numPoints*sizeof(double)); - _plot_curve.push_back(new QwtPlotCurve(QString("Data %1").arg(i))); - _plot_curve[i]->attach(this); + d_plot_curve.push_back(new QwtPlotCurve(QString("Data %1").arg(i))); + d_plot_curve[i]->attach(this); QwtSymbol *symbol = new QwtSymbol(QwtSymbol::NoSymbol, QBrush(default_colors[i]), QPen(default_colors[i]), QSize(7,7)); #if QWT_VERSION < 0x060000 - _plot_curve[i]->setRawData(_xAxisPoints, _dataPoints[i], _numPoints); - _plot_curve[i]->setSymbol(*symbol); + d_plot_curve[i]->setRawData(d_xdata, d_ydata[i], d_numPoints); + d_plot_curve[i]->setSymbol(*symbol); #else - _plot_curve[i]->setRawSamples(_xAxisPoints, _dataPoints[i], _numPoints); - _plot_curve[i]->setSymbol(symbol); + d_plot_curve[i]->setRawSamples(d_xdata, d_ydata[i], d_numPoints); + d_plot_curve[i]->setSymbol(symbol); #endif setLineColor(i, default_colors[i]); } - _min_fft_plot_curve = new QwtPlotCurve("Minimum Power"); - _min_fft_plot_curve->attach(this); - const QColor _default_min_fft_color = Qt::magenta; - setMinFFTColor(_default_min_fft_color); + d_min_fft_plot_curve = new QwtPlotCurve("Minimum Power"); + d_min_fft_plot_curve->attach(this); + const QColor default_min_fft_color = Qt::magenta; + setMinFFTColor(default_min_fft_color); #if QWT_VERSION < 0x060000 - _min_fft_plot_curve->setRawData(_xAxisPoints, _minFFTPoints, _numPoints); + d_min_fft_plot_curve->setRawData(d_xdata, d_min_fft_data, d_numPoints); #else - _min_fft_plot_curve->setRawSamples(_xAxisPoints, _minFFTPoints, _numPoints); + d_min_fft_plot_curve->setRawSamples(d_xdata, d_min_fft_data, d_numPoints); #endif - _min_fft_plot_curve->setVisible(false); + d_min_fft_plot_curve->setVisible(false); - _max_fft_plot_curve = new QwtPlotCurve("Maximum Power"); - _max_fft_plot_curve->attach(this); - QColor _default_max_fft_color = Qt::darkYellow; - setMaxFFTColor(_default_max_fft_color); + d_max_fft_plot_curve = new QwtPlotCurve("Maximum Power"); + d_max_fft_plot_curve->attach(this); + QColor default_max_fft_color = Qt::darkYellow; + setMaxFFTColor(default_max_fft_color); #if QWT_VERSION < 0x060000 - _max_fft_plot_curve->setRawData(_xAxisPoints, _maxFFTPoints, _numPoints); + d_max_fft_plot_curve->setRawData(d_xdata, d_max_fft_data, d_numPoints); #else - _max_fft_plot_curve->setRawSamples(_xAxisPoints, _maxFFTPoints, _numPoints); + d_max_fft_plot_curve->setRawSamples(d_xdata, d_max_fft_data, d_numPoints); #endif - _max_fft_plot_curve->setVisible(false); + d_max_fft_plot_curve->setVisible(false); - _lower_intensity_marker= new QwtPlotMarker(); - _lower_intensity_marker->setLineStyle(QwtPlotMarker::HLine); - QColor _default_marker_lower_intensity_color = Qt::cyan; - setMarkerLowerIntensityColor(_default_marker_lower_intensity_color); - _lower_intensity_marker->attach(this); + d_lower_intensity_marker= new QwtPlotMarker(); + d_lower_intensity_marker->setLineStyle(QwtPlotMarker::HLine); + QColor default_marker_lower_intensity_color = Qt::cyan; + setMarkerLowerIntensityColor(default_marker_lower_intensity_color); + d_lower_intensity_marker->attach(this); - _upper_intensity_marker = new QwtPlotMarker(); - _upper_intensity_marker->setLineStyle(QwtPlotMarker::HLine); - QColor _default_marker_upper_intensity_color = Qt::green; - setMarkerUpperIntensityColor(_default_marker_upper_intensity_color); - _upper_intensity_marker->attach(this); + d_upper_intensity_marker = new QwtPlotMarker(); + d_upper_intensity_marker->setLineStyle(QwtPlotMarker::HLine); + QColor default_marker_upper_intensity_color = Qt::green; + setMarkerUpperIntensityColor(default_marker_upper_intensity_color); + d_upper_intensity_marker->attach(this); - memset(_xAxisPoints, 0x0, _numPoints*sizeof(double)); + memset(d_xdata, 0x0, d_numPoints*sizeof(double)); - for(int64_t number = 0; number < _numPoints; number++){ - _minFFTPoints[number] = 200.0; - _maxFFTPoints[number] = -280.0; + for(int64_t number = 0; number < d_numPoints; number++){ + d_min_fft_data[number] = 200.0; + d_max_fft_data[number] = -280.0; } - _markerPeakAmplitude = new QwtPlotMarker(); - QColor _default_marker_peak_amplitude_color = Qt::yellow; - setMarkerPeakAmplitudeColor(_default_marker_peak_amplitude_color); + d_marker_peak_amplitude = new QwtPlotMarker(); + QColor default_marker_peak_amplitude_color = Qt::yellow; + setMarkerPeakAmplitudeColor(default_marker_peak_amplitude_color); /// THIS CAUSES A PROBLEM! - //_markerPeakAmplitude->attach(this); + //d_marker_peak_amplitude->attach(this); - _markerNoiseFloorAmplitude = new QwtPlotMarker(); - _markerNoiseFloorAmplitude->setLineStyle(QwtPlotMarker::HLine); - QColor _default_marker_noise_floor_amplitude_color = Qt::darkRed; - setMarkerNoiseFloorAmplitudeColor(_default_marker_noise_floor_amplitude_color); - _markerNoiseFloorAmplitude->attach(this); + d_marker_noise_floor_amplitude = new QwtPlotMarker(); + d_marker_noise_floor_amplitude->setLineStyle(QwtPlotMarker::HLine); + QColor d_default_marker_noise_floor_amplitude_color = Qt::darkRed; + setMarkerNoiseFloorAmplitudeColor(d_default_marker_noise_floor_amplitude_color); + d_marker_noise_floor_amplitude->attach(this); - _markerCF= new QwtPlotMarker(); - _markerCF->setLineStyle(QwtPlotMarker::VLine); - QColor _default_marker_CF_color = Qt::lightGray; - setMarkerCFColor(_default_marker_CF_color); - _markerCF->attach(this); - _markerCF->hide(); + d_marker_cf= new QwtPlotMarker(); + d_marker_cf->setLineStyle(QwtPlotMarker::VLine); + QColor d_default_marker_cf_color = Qt::lightGray; + setMarkerCFColor(d_default_marker_cf_color); + d_marker_cf->attach(this); + d_marker_cf->hide(); - _peakFrequency = 0; - _peakAmplitude = -HUGE_VAL; + d_peak_frequency = 0; + d_peak_amplitude = -HUGE_VAL; - _noiseFloorAmplitude = -HUGE_VAL; + d_noise_floor_amplitude = -HUGE_VAL; - _zoomer = new FreqDisplayZoomer(canvas(), 0); + d_zoomer = new FreqDisplayZoomer(canvas(), 0); #if QWT_VERSION < 0x060000 - _zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection); + d_zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection); #endif - _zoomer->setMousePattern(QwtEventPattern::MouseSelect2, - Qt::RightButton, Qt::ControlModifier); - _zoomer->setMousePattern(QwtEventPattern::MouseSelect3, - Qt::RightButton); + d_zoomer->setMousePattern(QwtEventPattern::MouseSelect2, + Qt::RightButton, Qt::ControlModifier); + d_zoomer->setMousePattern(QwtEventPattern::MouseSelect3, + Qt::RightButton); const QColor default_zoomer_color(Qt::darkRed); @@ -207,9 +207,9 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(int nplots, QWidget* parent) // Turn off min/max hold plots in legend QWidget *w; QwtLegend* legendDisplay = legend(); - w = legendDisplay->find(_min_fft_plot_curve); + w = legendDisplay->find(d_min_fft_plot_curve); ((QwtLegendItem*)w)->setChecked(true); - w = legendDisplay->find(_max_fft_plot_curve); + w = legendDisplay->find(d_max_fft_plot_curve); ((QwtLegendItem*)w)->setChecked(true); replot(); @@ -217,27 +217,27 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(int nplots, QWidget* parent) FrequencyDisplayPlot::~FrequencyDisplayPlot() { - for(int i = 0; i < _nplots; i++) - delete [] _dataPoints[i]; - delete[] _maxFFTPoints; - delete[] _minFFTPoints; - delete[] _xAxisPoints; + for(int i = 0; i < d_nplots; i++) + delete [] d_ydata[i]; + delete[] d_max_fft_data; + delete[] d_min_fft_data; + delete[] d_xdata; } void FrequencyDisplayPlot::setYaxis(double min, double max) { // Get the new max/min values for the plot - _minYAxis = min; - _maxYAxis = max; + d_ymin = min; + d_ymax = max; // Set the axis max/min to the new values - setAxisScale(QwtPlot::yLeft, _minYAxis, _maxYAxis); + setAxisScale(QwtPlot::yLeft, d_ymin, d_ymax); // Reset the base zoom level to the new axis scale set here. // But don't do it if we set the axis due to auto scaling. - if(!_autoscale_state) - _zoomer->setZoomBase(); + if(!d_autoscale_state) + d_zoomer->setZoomBase(); } void @@ -248,17 +248,17 @@ FrequencyDisplayPlot::setFrequencyRange(const double centerfreq, double startFreq = (centerfreq - bandwidth/2.0f) / units; double stopFreq = (centerfreq + bandwidth/2.0f) / units; - _xAxisMultiplier = units; + d_xdata_multiplier = units; bool reset = false; - if((startFreq != _startFrequency) || (stopFreq != _stopFrequency)) + if((startFreq != d_start_frequency) || (stopFreq != d_stop_frequency)) reset = true; if(stopFreq > startFreq) { - _startFrequency = startFreq; - _stopFrequency = stopFreq; + d_start_frequency = startFreq; + d_stop_frequency = stopFreq; - if((axisScaleDraw(QwtPlot::xBottom) != NULL) && (_zoomer != NULL)) { + if((axisScaleDraw(QwtPlot::xBottom) != NULL) && (d_zoomer != NULL)) { double display_units = ceil(log10(units)/2.0); setAxisScaleDraw(QwtPlot::xBottom, new FreqDisplayScaleDraw(display_units)); setAxisTitle(QwtPlot::xBottom, QString("Frequency (%1)").arg(strunits.c_str())); @@ -269,8 +269,8 @@ FrequencyDisplayPlot::setFrequencyRange(const double centerfreq, clearMinData(); } - ((FreqDisplayZoomer*)_zoomer)->setFrequencyPrecision(display_units); - ((FreqDisplayZoomer*)_zoomer)->setUnitType(strunits); + ((FreqDisplayZoomer*)d_zoomer)->setFrequencyPrecision(display_units); + ((FreqDisplayZoomer*)d_zoomer)->setUnitType(strunits); } } } @@ -279,29 +279,29 @@ FrequencyDisplayPlot::setFrequencyRange(const double centerfreq, double FrequencyDisplayPlot::getStartFrequency() const { - return _startFrequency; + return d_start_frequency; } double FrequencyDisplayPlot::getStopFrequency() const { - return _stopFrequency; + return d_stop_frequency; } void FrequencyDisplayPlot::replot() { - _markerNoiseFloorAmplitude->setYValue(_noiseFloorAmplitude); - _markerPeakAmplitude->setXValue(_peakFrequency + _startFrequency); + d_marker_noise_floor_amplitude->setYValue(d_noise_floor_amplitude); + d_marker_peak_amplitude->setXValue(d_peak_frequency + d_start_frequency); // Make sure to take into account the start frequency -// if(_useCenterFrequencyFlag){ -// _markerPeakAmplitude->setXValue((_peakFrequency/1000.0) + _startFrequency); +// if(d_useCenterFrequencyFlag){ +// d_marker_peak_amplitude->setXValue((d_peak_frequency/1000.0) + d_start_frequency); // } // else{ -// _markerPeakAmplitude->setXValue(_peakFrequency + _startFrequency); +// _markerPeakAmplitude->setXValue(d_peak_frequency + d_start_frequency); // } - _markerPeakAmplitude->setYValue(_peakAmplitude); + d_marker_peak_amplitude->setYValue(d_peak_amplitude); QwtPlot::replot(); } @@ -312,34 +312,34 @@ FrequencyDisplayPlot::plotNewData(const std::vector<double*> dataPoints, const double noiseFloorAmplitude, const double peakFrequency, const double peakAmplitude, const double timeInterval) { - if(!_stop) { + if(!d_stop) { if(numDataPoints > 0) { - if(numDataPoints != _numPoints) { - _numPoints = numDataPoints; - - delete[] _minFFTPoints; - delete[] _maxFFTPoints; - delete[] _xAxisPoints; - _xAxisPoints = new double[_numPoints]; - _minFFTPoints = new double[_numPoints]; - _maxFFTPoints = new double[_numPoints]; + if(numDataPoints != d_numPoints) { + d_numPoints = numDataPoints; + + delete[] d_min_fft_data; + delete[] d_max_fft_data; + delete[] d_xdata; + d_xdata = new double[d_numPoints]; + d_min_fft_data = new double[d_numPoints]; + d_max_fft_data = new double[d_numPoints]; - for(int i = 0; i < _nplots; i++) { - delete[] _dataPoints[i]; - _dataPoints[i] = new double[_numPoints]; + for(int i = 0; i < d_nplots; i++) { + delete[] d_ydata[i]; + d_ydata[i] = new double[d_numPoints]; #if QWT_VERSION < 0x060000 - _plot_curve[i]->setRawData(_xAxisPoints, _dataPoints[i], _numPoints); + d_plot_curve[i]->setRawData(d_xdata, d_ydata[i], d_numPoints); #else - _plot_curve[i]->setRawSamples(_xAxisPoints, _dataPoints[i], _numPoints); + d_plot_curve[i]->setRawSamples(d_xdata, d_ydata[i], d_numPoints); #endif } #if QWT_VERSION < 0x060000 - _min_fft_plot_curve->setRawData(_xAxisPoints, _minFFTPoints, _numPoints); - _max_fft_plot_curve->setRawData(_xAxisPoints, _maxFFTPoints, _numPoints); + d_min_fft_plot_curve->setRawData(d_xdata, d_min_fft_data, d_numPoints); + d_max_fft_plot_curve->setRawData(d_xdata, d_max_fft_data, d_numPoints); #else - _min_fft_plot_curve->setRawSamples(_xAxisPoints, _minFFTPoints, _numPoints); - _max_fft_plot_curve->setRawSamples(_xAxisPoints, _maxFFTPoints, _numPoints); + d_min_fft_plot_curve->setRawSamples(d_xdata, d_min_fft_data, d_numPoints); + d_max_fft_plot_curve->setRawSamples(d_xdata, d_max_fft_data, d_numPoints); #endif _resetXAxisPoints(); clearMaxData(); @@ -347,16 +347,16 @@ FrequencyDisplayPlot::plotNewData(const std::vector<double*> dataPoints, } double bottom=1e20, top=-1e20; - for(int n = 0; n < _nplots; n++) { + for(int n = 0; n < d_nplots; n++) { - memcpy(_dataPoints[n], dataPoints[n], numDataPoints*sizeof(double)); + memcpy(d_ydata[n], dataPoints[n], numDataPoints*sizeof(double)); for(int64_t point = 0; point < numDataPoints; point++) { - if(dataPoints[n][point] < _minFFTPoints[point]) { - _minFFTPoints[point] = dataPoints[n][point]; + if(dataPoints[n][point] < d_min_fft_data[point]) { + d_min_fft_data[point] = dataPoints[n][point]; } - if(dataPoints[n][point] > _maxFFTPoints[point]) { - _maxFFTPoints[point] = dataPoints[n][point]; + if(dataPoints[n][point] > d_max_fft_data[point]) { + d_max_fft_data[point] = dataPoints[n][point]; } // Find overall top and bottom values in plot. @@ -370,14 +370,14 @@ FrequencyDisplayPlot::plotNewData(const std::vector<double*> dataPoints, } } - if(_autoscale_state) + if(d_autoscale_state) _autoScale(bottom, top); - _noiseFloorAmplitude = noiseFloorAmplitude; - _peakFrequency = peakFrequency; - _peakAmplitude = peakAmplitude; + d_noise_floor_amplitude = noiseFloorAmplitude; + d_peak_frequency = peakFrequency; + d_peak_amplitude = peakAmplitude; - setUpperIntensityLevel(_peakAmplitude); + setUpperIntensityLevel(d_peak_amplitude); replot(); } @@ -399,16 +399,16 @@ FrequencyDisplayPlot::plotNewData(const double* dataPoints, void FrequencyDisplayPlot::clearMaxData() { - for(int64_t number = 0; number < _numPoints; number++) { - _maxFFTPoints[number] = _minYAxis; + for(int64_t number = 0; number < d_numPoints; number++) { + d_max_fft_data[number] = d_ymin; } } void FrequencyDisplayPlot::clearMinData() { - for(int64_t number = 0; number < _numPoints; number++) { - _minFFTPoints[number] = _maxYAxis; + for(int64_t number = 0; number < d_numPoints; number++) { + d_min_fft_data[number] = d_ymax; } } @@ -422,69 +422,73 @@ FrequencyDisplayPlot::_autoScale(double bottom, double top) void FrequencyDisplayPlot::setAutoScale(bool state) { - _autoscale_state = state; + d_autoscale_state = state; } void FrequencyDisplayPlot::setMaxFFTVisible(const bool visibleFlag) { - _max_fft_visible = visibleFlag; - _max_fft_plot_curve->setVisible(visibleFlag); + d_max_fft_visible = visibleFlag; + d_max_fft_plot_curve->setVisible(visibleFlag); } -const bool FrequencyDisplayPlot::getMaxFFTVisible() const + +const bool +FrequencyDisplayPlot::getMaxFFTVisible() const { - return _max_fft_visible; + return d_max_fft_visible; } void FrequencyDisplayPlot::setMinFFTVisible(const bool visibleFlag) { - _min_fft_visible = visibleFlag; - _min_fft_plot_curve->setVisible(visibleFlag); + d_min_fft_visible = visibleFlag; + d_min_fft_plot_curve->setVisible(visibleFlag); } -const bool FrequencyDisplayPlot::getMinFFTVisible() const + +const bool +FrequencyDisplayPlot::getMinFFTVisible() const { - return _min_fft_visible; + return d_min_fft_visible; } void FrequencyDisplayPlot::_resetXAxisPoints() { - double fft_bin_size = (_stopFrequency-_startFrequency) - / static_cast<double>(_numPoints-1); - double freqValue = _startFrequency; - for(int64_t loc = 0; loc < _numPoints; loc++) { - _xAxisPoints[loc] = freqValue; + double fft_bin_size = (d_stop_frequency - d_start_frequency) + / static_cast<double>(d_numPoints-1); + double freqValue = d_start_frequency; + for(int64_t loc = 0; loc < d_numPoints; loc++) { + d_xdata[loc] = freqValue; freqValue += fft_bin_size; } - setAxisScale(QwtPlot::xBottom, _startFrequency, _stopFrequency); + setAxisScale(QwtPlot::xBottom, d_start_frequency, d_stop_frequency); // Set up zoomer base for maximum unzoom x-axis // and reset to maximum unzoom level - QwtDoubleRect zbase = _zoomer->zoomBase(); - _zoomer->zoom(zbase); - _zoomer->setZoomBase(zbase); - _zoomer->setZoomBase(true); - _zoomer->zoom(0); + QwtDoubleRect zbase = d_zoomer->zoomBase(); + d_zoomer->zoom(zbase); + d_zoomer->setZoomBase(zbase); + d_zoomer->setZoomBase(true); + d_zoomer->zoom(0); } void FrequencyDisplayPlot::setLowerIntensityLevel(const double lowerIntensityLevel) { - _lower_intensity_marker->setYValue(lowerIntensityLevel); + d_lower_intensity_marker->setYValue(lowerIntensityLevel); } void FrequencyDisplayPlot::setUpperIntensityLevel(const double upperIntensityLevel) { - _upper_intensity_marker->setYValue(upperIntensityLevel); + d_upper_intensity_marker->setYValue(upperIntensityLevel); } void FrequencyDisplayPlot::setTraceColour(QColor c) { - _plot_curve[0]->setPen(QPen(c)); + d_plot_curve[0]->setPen(QPen(c)); } void @@ -498,19 +502,18 @@ FrequencyDisplayPlot::setBGColour(QColor c) void FrequencyDisplayPlot::showCFMarker(const bool show) { - if (show) - _markerCF->show(); + if(show) + d_marker_cf->show(); else - _markerCF->hide(); + d_marker_cf->hide(); } - void FrequencyDisplayPlot::onPickerPointSelected(const QwtDoublePoint & p) { QPointF point = p; - //fprintf(stderr,"onPickerPointSelected %f %f %d\n", point.x(), point.y(), _xAxisMultiplier); - point.setX(point.x() * _xAxisMultiplier); + //fprintf(stderr,"onPickerPointSelected %f %f %d\n", point.x(), point.y(), d_xdata_multiplier); + point.setX(point.x() * d_xdata_multiplier); emit plotPointSelected(point); } @@ -518,116 +521,154 @@ void FrequencyDisplayPlot::onPickerPointSelected6(const QPointF & p) { QPointF point = p; - //fprintf(stderr,"onPickerPointSelected %f %f %d\n", point.x(), point.y(), _xAxisMultiplier); - point.setX(point.x() * _xAxisMultiplier); + //fprintf(stderr,"onPickerPointSelected %f %f %d\n", point.x(), point.y(), d_xdata_multiplier); + point.setX(point.x() * d_xdata_multiplier); emit plotPointSelected(point); } void FrequencyDisplayPlot::setMinFFTColor (QColor c) { - _min_fft_color = c; - _min_fft_plot_curve->setPen(QPen(c)); + d_min_fft_color = c; + d_min_fft_plot_curve->setPen(QPen(c)); } const QColor -FrequencyDisplayPlot::getMinFFTColor() const {return _min_fft_color;} +FrequencyDisplayPlot::getMinFFTColor() const +{ + return d_min_fft_color; +} void FrequencyDisplayPlot::setMaxFFTColor (QColor c) { - _max_fft_color = c; - _max_fft_plot_curve->setPen(QPen(c)); + d_max_fft_color = c; + d_max_fft_plot_curve->setPen(QPen(c)); } + const QColor -FrequencyDisplayPlot::getMaxFFTColor() const {return _max_fft_color;} +FrequencyDisplayPlot::getMaxFFTColor() const +{ + return d_max_fft_color; +} void FrequencyDisplayPlot::setMarkerLowerIntensityColor (QColor c) { - _marker_lower_intensity_color = c; - _lower_intensity_marker->setLinePen(QPen(c)); + d_marker_lower_intensity_color = c; + d_lower_intensity_marker->setLinePen(QPen(c)); } const QColor -FrequencyDisplayPlot::getMarkerLowerIntensityColor () const {return _marker_lower_intensity_color;} +FrequencyDisplayPlot::getMarkerLowerIntensityColor () const +{ + return d_marker_lower_intensity_color; +} + void FrequencyDisplayPlot::setMarkerLowerIntensityVisible (bool visible) { - _marker_lower_intensity_visible = visible; - if (visible) - _lower_intensity_marker->setLineStyle(QwtPlotMarker::HLine); + d_marker_lower_intensity_visible = visible; + if(visible) + d_lower_intensity_marker->setLineStyle(QwtPlotMarker::HLine); else - _lower_intensity_marker->setLineStyle(QwtPlotMarker::NoLine); + d_lower_intensity_marker->setLineStyle(QwtPlotMarker::NoLine); } const bool -FrequencyDisplayPlot::getMarkerLowerIntensityVisible () const {return _marker_lower_intensity_visible;} +FrequencyDisplayPlot::getMarkerLowerIntensityVisible() const +{ + return d_marker_lower_intensity_visible; +} void -FrequencyDisplayPlot::setMarkerUpperIntensityColor (QColor c) +FrequencyDisplayPlot::setMarkerUpperIntensityColor(QColor c) { - _marker_upper_intensity_color = c; - _upper_intensity_marker->setLinePen(QPen(c, 0, Qt::DotLine)); + d_marker_upper_intensity_color = c; + d_upper_intensity_marker->setLinePen(QPen(c, 0, Qt::DotLine)); } + const QColor -FrequencyDisplayPlot::getMarkerUpperIntensityColor () const {return _marker_upper_intensity_color;} +FrequencyDisplayPlot::getMarkerUpperIntensityColor() const +{ + return d_marker_upper_intensity_color; +} + void -FrequencyDisplayPlot::setMarkerUpperIntensityVisible (bool visible) +FrequencyDisplayPlot::setMarkerUpperIntensityVisible(bool visible) { - _marker_upper_intensity_visible = visible; - if (visible) - _upper_intensity_marker->setLineStyle(QwtPlotMarker::HLine); + d_marker_upper_intensity_visible = visible; + if(visible) + d_upper_intensity_marker->setLineStyle(QwtPlotMarker::HLine); else - _upper_intensity_marker->setLineStyle(QwtPlotMarker::NoLine); + d_upper_intensity_marker->setLineStyle(QwtPlotMarker::NoLine); } + const bool -FrequencyDisplayPlot::getMarkerUpperIntensityVisible () const {return _marker_upper_intensity_visible;} +FrequencyDisplayPlot::getMarkerUpperIntensityVisible() const +{ + return d_marker_upper_intensity_visible; +} void -FrequencyDisplayPlot::setMarkerPeakAmplitudeColor (QColor c) +FrequencyDisplayPlot::setMarkerPeakAmplitudeColor(QColor c) { - _marker_peak_amplitude_color = c; - _markerPeakAmplitude->setLinePen(QPen(c)); + d_marker_peak_amplitude_color = c; + d_marker_peak_amplitude->setLinePen(QPen(c)); QwtSymbol symbol; symbol.setStyle(QwtSymbol::Diamond); symbol.setSize(8); symbol.setPen(QPen(c)); symbol.setBrush(QBrush(c)); #if QWT_VERSION < 0x060000 - _markerPeakAmplitude->setSymbol(symbol); + d_marker_peak_amplitude->setSymbol(symbol); #else - _markerPeakAmplitude->setSymbol(&symbol); + d_marker_peak_amplitude->setSymbol(&symbol); #endif } const QColor -FrequencyDisplayPlot::getMarkerPeakAmplitudeColor () const {return _marker_peak_amplitude_color;} +FrequencyDisplayPlot::getMarkerPeakAmplitudeColor() const +{ + return d_marker_peak_amplitude_color; +} void -FrequencyDisplayPlot::setMarkerNoiseFloorAmplitudeColor (QColor c) +FrequencyDisplayPlot::setMarkerNoiseFloorAmplitudeColor(QColor c) { - _marker_noise_floor_amplitude_color = c; - _markerNoiseFloorAmplitude->setLinePen(QPen(c, 0, Qt::DotLine)); + d_marker_noise_floor_amplitude_color = c; + d_marker_noise_floor_amplitude->setLinePen(QPen(c, 0, Qt::DotLine)); } + const QColor -FrequencyDisplayPlot::getMarkerNoiseFloorAmplitudeColor () const {return _marker_noise_floor_amplitude_color;} +FrequencyDisplayPlot::getMarkerNoiseFloorAmplitudeColor() const +{ + return d_marker_noise_floor_amplitude_color; +} void -FrequencyDisplayPlot::setMarkerNoiseFloorAmplitudeVisible (bool visible) +FrequencyDisplayPlot::setMarkerNoiseFloorAmplitudeVisible(bool visible) { - _marker_noise_floor_amplitude_visible = visible; - if (visible) - _markerNoiseFloorAmplitude->setLineStyle(QwtPlotMarker::HLine); + d_marker_noise_floor_amplitude_visible = visible; + if(visible) + d_marker_noise_floor_amplitude->setLineStyle(QwtPlotMarker::HLine); else - _markerNoiseFloorAmplitude->setLineStyle(QwtPlotMarker::NoLine); + d_marker_noise_floor_amplitude->setLineStyle(QwtPlotMarker::NoLine); } + const bool -FrequencyDisplayPlot::getMarkerNoiseFloorAmplitudeVisible () const {return _marker_noise_floor_amplitude_visible;} +FrequencyDisplayPlot::getMarkerNoiseFloorAmplitudeVisible() const +{ + return d_marker_noise_floor_amplitude_visible; +} void -FrequencyDisplayPlot::setMarkerCFColor (QColor c) +FrequencyDisplayPlot::setMarkerCFColor(QColor c) { - _marker_CF_color = c; - _markerCF->setLinePen(QPen(c, 0, Qt::DotLine)); + d_marker_cf_color = c; + d_marker_cf->setLinePen(QPen(c, 0, Qt::DotLine)); } + const QColor -FrequencyDisplayPlot::getMarkerCFColor () const {return _marker_CF_color;} +FrequencyDisplayPlot::getMarkerCFColor() const +{ + return d_marker_cf_color; +} #endif /* FREQUENCY_DISPLAY_PLOT_C */ diff --git a/gr-qtgui/lib/HistogramDisplayPlot.cc b/gr-qtgui/lib/HistogramDisplayPlot.cc index 68b7d8c3ab..9798f21151 100644 --- a/gr-qtgui/lib/HistogramDisplayPlot.cc +++ b/gr-qtgui/lib/HistogramDisplayPlot.cc @@ -37,9 +37,9 @@ class TimePrecisionClass { public: - TimePrecisionClass(const int timePrecision) + TimePrecisionClass(const int timeprecision) { - _timePrecision = timePrecision; + d_time_precision = timeprecision; } virtual ~TimePrecisionClass() @@ -48,23 +48,23 @@ public: virtual unsigned int getTimePrecision() const { - return _timePrecision; + return d_time_precision; } - virtual void setTimePrecision(const unsigned int newPrecision) + virtual void setTimePrecision(const unsigned int newprecision) { - _timePrecision = newPrecision; + d_time_precision = newprecision; } protected: - unsigned int _timePrecision; + unsigned int d_time_precision; }; class HistogramDisplayZoomer: public QwtPlotZoomer, public TimePrecisionClass { public: - HistogramDisplayZoomer(QwtPlotCanvas* canvas, const unsigned int timePrecision) - : QwtPlotZoomer(canvas),TimePrecisionClass(timePrecision) + HistogramDisplayZoomer(QwtPlotCanvas* canvas, const unsigned int timeprecision) + : QwtPlotZoomer(canvas),TimePrecisionClass(timeprecision) { setTrackerMode(QwtPicker::AlwaysOn); } @@ -80,7 +80,7 @@ public: void setUnitType(const std::string &type) { - _unitType = type; + d_unit_type = type; } protected: @@ -104,7 +104,7 @@ protected: } private: - std::string _unitType; + std::string d_unit_type; }; @@ -118,28 +118,28 @@ HistogramDisplayPlot::HistogramDisplayPlot(int nplots, QWidget* parent) d_accum = false; // Initialize x-axis data array - _xAxisPoints = new double[d_bins]; - memset(_xAxisPoints, 0x0, d_bins*sizeof(double)); + d_xdata = new double[d_bins]; + memset(d_xdata, 0x0, d_bins*sizeof(double)); - _zoomer = new HistogramDisplayZoomer(canvas(), 0); + d_zoomer = new HistogramDisplayZoomer(canvas(), 0); #if QWT_VERSION < 0x060000 - _zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection); + d_zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection); #endif - _zoomer->setMousePattern(QwtEventPattern::MouseSelect2, - Qt::RightButton, Qt::ControlModifier); - _zoomer->setMousePattern(QwtEventPattern::MouseSelect3, - Qt::RightButton); + d_zoomer->setMousePattern(QwtEventPattern::MouseSelect2, + Qt::RightButton, Qt::ControlModifier); + d_zoomer->setMousePattern(QwtEventPattern::MouseSelect3, + Qt::RightButton); const QColor c(Qt::darkRed); - _zoomer->setRubberBandPen(c); - _zoomer->setTrackerPen(c); + d_zoomer->setRubberBandPen(c); + d_zoomer->setTrackerPen(c); d_semilogx = false; d_semilogy = false; - _autoscale_state = true; - _autoscalex_state = false; + d_autoscale_state = true; + d_autoscalex_state = false; setAxisScaleEngine(QwtPlot::xBottom, new QwtLinearScaleEngine); setXaxis(-1, 1); @@ -157,29 +157,29 @@ HistogramDisplayPlot::HistogramDisplayPlot(int nplots, QWidget* parent) // Setup dataPoints and plot vectors // Automatically deleted when parent is deleted - for(int i = 0; i < _nplots; i++) { - _yDataPoints.push_back(new double[d_bins]); - memset(_yDataPoints[i], 0, d_bins*sizeof(double)); + for(int i = 0; i < d_nplots; i++) { + d_ydata.push_back(new double[d_bins]); + memset(d_ydata[i], 0, d_bins*sizeof(double)); - _plot_curve.push_back(new QwtPlotCurve(QString("Data %1").arg(i))); - _plot_curve[i]->attach(this); - _plot_curve[i]->setPen(QPen(colors[i])); - _plot_curve[i]->setRenderHint(QwtPlotItem::RenderAntialiased); + d_plot_curve.push_back(new QwtPlotCurve(QString("Data %1").arg(i))); + d_plot_curve[i]->attach(this); + d_plot_curve[i]->setPen(QPen(colors[i])); + d_plot_curve[i]->setRenderHint(QwtPlotItem::RenderAntialiased); // Adjust color's transparency for the brush - colors[i].setAlpha(127 / _nplots); - _plot_curve[i]->setBrush(QBrush(colors[i])); + colors[i].setAlpha(127 / d_nplots); + d_plot_curve[i]->setBrush(QBrush(colors[i])); - colors[i].setAlpha(255 / _nplots); + colors[i].setAlpha(255 / d_nplots); QwtSymbol *symbol = new QwtSymbol(QwtSymbol::NoSymbol, QBrush(colors[i]), QPen(colors[i]), QSize(7,7)); #if QWT_VERSION < 0x060000 - _plot_curve[i]->setRawData(_xAxisPoints, _yDataPoints[i], d_bins); - _plot_curve[i]->setSymbol(*symbol); + d_plot_curve[i]->setRawData(d_xdata, d_ydata[i], d_bins); + d_plot_curve[i]->setSymbol(*symbol); #else - _plot_curve[i]->setRawSamples(_xAxisPoints, _yDataPoints[i], d_bins); - _plot_curve[i]->setSymbol(symbol); + d_plot_curve[i]->setRawSamples(d_xdata, d_ydata[i], d_bins); + d_plot_curve[i]->setSymbol(symbol); #endif } @@ -188,11 +188,11 @@ HistogramDisplayPlot::HistogramDisplayPlot(int nplots, QWidget* parent) HistogramDisplayPlot::~HistogramDisplayPlot() { - for(int i = 0; i < _nplots; i++) - delete[] _yDataPoints[i]; - delete[] _xAxisPoints; + for(int i = 0; i < d_nplots; i++) + delete[] d_ydata[i]; + delete[] d_xdata; - // _zoomer and _panner deleted when parent deleted + // d_zoomer and _panner deleted when parent deleted } void @@ -206,43 +206,43 @@ HistogramDisplayPlot::plotNewData(const std::vector<double*> dataPoints, const int64_t numDataPoints, const double timeInterval) { - if(!_stop) { + if(!d_stop) { if((numDataPoints > 0)) { // keep track of the min/max values for when autoscaleX is called. d_xmin = 1e20; d_xmax = -1e20; - for(int n = 0; n < _nplots; n++) { + for(int n = 0; n < d_nplots; n++) { d_xmin = std::min(d_xmin, *std::min_element(dataPoints[n], dataPoints[n]+numDataPoints)); d_xmax = std::max(d_xmax, *std::max_element(dataPoints[n], dataPoints[n]+numDataPoints)); } // If autoscalex has been clicked, clear the data for the new // bin widths and reset the x-axis. - if(_autoscalex_state) { - for(int n = 0; n < _nplots; n++) - memset(_yDataPoints[n], 0, d_bins*sizeof(double)); + if(d_autoscalex_state) { + for(int n = 0; n < d_nplots; n++) + memset(d_ydata[n], 0, d_bins*sizeof(double)); _resetXAxisPoints(d_xmin, d_xmax); - _autoscalex_state = false; + d_autoscalex_state = false; } int index; - for(int n = 0; n < _nplots; n++) { + for(int n = 0; n < d_nplots; n++) { if(!d_accum) - memset(_yDataPoints[n], 0, d_bins*sizeof(double)); + memset(d_ydata[n], 0, d_bins*sizeof(double)); for(int64_t point = 0; point < numDataPoints; point++) { index = boost::math::iround(1e-20 + (dataPoints[n][point] - d_left)/d_width); if((index >= 0) && (index < d_bins)) - _yDataPoints[n][static_cast<int>(index)] += 1; + d_ydata[n][static_cast<int>(index)] += 1; } } - double height = *std::max_element(_yDataPoints[0], _yDataPoints[0]+d_bins); - for(int n = 1; n < _nplots; n++) { - height = std::max(height, *std::max_element(_yDataPoints[n], _yDataPoints[n]+d_bins)); + double height = *std::max_element(d_ydata[0], d_ydata[0]+d_bins); + for(int n = 1; n < d_nplots; n++) { + height = std::max(height, *std::max_element(d_ydata[n], d_ydata[n]+d_bins)); } - if(_autoscale_state) + if(d_autoscale_state) _autoScaleY(0, height); replot(); @@ -267,13 +267,13 @@ HistogramDisplayPlot::_resetXAxisPoints(double left, double right) d_right = right*(1 + copysign(0.1, right)); d_width = (d_right - d_left)/(d_bins); for(long loc = 0; loc < d_bins; loc++){ - _xAxisPoints[loc] = d_left + loc*d_width; + d_xdata[loc] = d_left + loc*d_width; } axisScaleDiv(QwtPlot::xBottom)->setInterval(d_left, d_right); // Set up zoomer base for maximum unzoom x-axis // and reset to maximum unzoom level - QwtDoubleRect zbase = _zoomer->zoomBase(); + QwtDoubleRect zbase = d_zoomer->zoomBase(); if(d_semilogx) { setAxisScale(QwtPlot::xBottom, 1e-1, d_right); @@ -285,9 +285,9 @@ HistogramDisplayPlot::_resetXAxisPoints(double left, double right) } zbase.setRight(d_right); - _zoomer->zoom(zbase); - _zoomer->setZoomBase(zbase); - _zoomer->zoom(0); + d_zoomer->zoom(zbase); + d_zoomer->setZoomBase(zbase); + d_zoomer->zoom(0); } void @@ -312,13 +312,13 @@ HistogramDisplayPlot::_autoScaleY(double bottom, double top) void HistogramDisplayPlot::setAutoScaleX() { - _autoscalex_state = true; + d_autoscalex_state = true; } void HistogramDisplayPlot::setAutoScale(bool state) { - _autoscale_state = state; + d_autoscale_state = state; } void @@ -359,10 +359,10 @@ HistogramDisplayPlot::setAccumulate(bool state) void HistogramDisplayPlot::setMarkerAlpha(int which, int alpha) { - if(which < _nplots) { + if(which < d_nplots) { // Get the pen color - QPen pen(_plot_curve[which]->pen()); - QBrush brush(_plot_curve[which]->brush()); + QPen pen(d_plot_curve[which]->pen()); + QBrush brush(d_plot_curve[which]->brush()); QColor color = brush.color(); // Set new alpha and update pen @@ -370,19 +370,19 @@ HistogramDisplayPlot::setMarkerAlpha(int which, int alpha) brush.setColor(color); color.setAlpha(std::min(255, static_cast<int>(alpha*1.5))); pen.setColor(color); - _plot_curve[which]->setBrush(brush); - _plot_curve[which]->setPen(pen); + d_plot_curve[which]->setBrush(brush); + d_plot_curve[which]->setPen(pen); // And set the new color for the markers #if QWT_VERSION < 0x060000 - QwtSymbol sym = (QwtSymbol)_plot_curve[which]->symbol(); + QwtSymbol sym = (QwtSymbol)d_plot_curve[which]->symbol(); setLineMarker(which, sym.style()); #else - QwtSymbol *sym = (QwtSymbol*)_plot_curve[which]->symbol(); + QwtSymbol *sym = (QwtSymbol*)d_plot_curve[which]->symbol(); if(sym) { sym->setColor(color); sym->setPen(pen); - _plot_curve[which]->setSymbol(sym); + d_plot_curve[which]->setSymbol(sym); } #endif } @@ -391,8 +391,8 @@ HistogramDisplayPlot::setMarkerAlpha(int which, int alpha) int HistogramDisplayPlot::getMarkerAlpha(int which) const { - if(which < _nplots) { - return _plot_curve[which]->brush().color().alpha(); + if(which < d_nplots) { + return d_plot_curve[which]->brush().color().alpha(); } else { return 0; @@ -402,31 +402,31 @@ HistogramDisplayPlot::getMarkerAlpha(int which) const void HistogramDisplayPlot::setLineColor(int which, QColor color) { - if(which < _nplots) { + if(which < d_nplots) { // Adjust color's transparency for the brush - color.setAlpha(127 / _nplots); + color.setAlpha(127 / d_nplots); - QBrush brush(_plot_curve[which]->brush()); + QBrush brush(d_plot_curve[which]->brush()); brush.setColor(color); - _plot_curve[which]->setBrush(brush); + d_plot_curve[which]->setBrush(brush); // Adjust color's transparency darker for the pen and markers - color.setAlpha(255 / _nplots); + color.setAlpha(255 / d_nplots); - QPen pen(_plot_curve[which]->pen()); + QPen pen(d_plot_curve[which]->pen()); pen.setColor(color); - _plot_curve[which]->setPen(pen); + d_plot_curve[which]->setPen(pen); #if QWT_VERSION < 0x060000 - _plot_curve[which]->setPen(pen); - QwtSymbol sym = (QwtSymbol)_plot_curve[which]->symbol(); + d_plot_curve[which]->setPen(pen); + QwtSymbol sym = (QwtSymbol)d_plot_curve[which]->symbol(); setLineMarker(which, sym.style()); #else - QwtSymbol *sym = (QwtSymbol*)_plot_curve[which]->symbol(); + QwtSymbol *sym = (QwtSymbol*)d_plot_curve[which]->symbol(); if(sym) { sym->setColor(color); sym->setPen(pen); - _plot_curve[which]->setSymbol(sym); + d_plot_curve[which]->setSymbol(sym); } #endif } @@ -437,19 +437,19 @@ HistogramDisplayPlot::setNumBins(int bins) { d_bins = bins; - delete [] _xAxisPoints; - _xAxisPoints = new double[d_bins]; + delete [] d_xdata; + d_xdata = new double[d_bins]; _resetXAxisPoints(d_left, d_right); - for(int i = 0; i < _nplots; i++) { - delete [] _yDataPoints[i]; - _yDataPoints[i] = new double[d_bins]; - memset(_yDataPoints[i], 0, d_bins*sizeof(double)); + for(int i = 0; i < d_nplots; i++) { + delete [] d_ydata[i]; + d_ydata[i] = new double[d_bins]; + memset(d_ydata[i], 0, d_bins*sizeof(double)); #if QWT_VERSION < 0x060000 - _plot_curve[i]->setRawData(_xAxisPoints, _yDataPoints[i], d_bins); + d_plot_curve[i]->setRawData(d_xdata, d_ydata[i], d_bins); #else - _plot_curve[i]->setRawSamples(_xAxisPoints, _yDataPoints[i], d_bins); + d_plot_curve[i]->setRawSamples(d_xdata, d_ydata[i], d_bins); #endif } } diff --git a/gr-qtgui/lib/TimeDomainDisplayPlot.cc b/gr-qtgui/lib/TimeDomainDisplayPlot.cc index 55e62d2b2d..052aaf8cf7 100644 --- a/gr-qtgui/lib/TimeDomainDisplayPlot.cc +++ b/gr-qtgui/lib/TimeDomainDisplayPlot.cc @@ -37,7 +37,7 @@ class TimePrecisionClass public: TimePrecisionClass(const int timePrecision) { - _timePrecision = timePrecision; + d_timePrecision = timePrecision; } virtual ~TimePrecisionClass() @@ -46,15 +46,15 @@ public: virtual unsigned int getTimePrecision() const { - return _timePrecision; + return d_timePrecision; } virtual void setTimePrecision(const unsigned int newPrecision) { - _timePrecision = newPrecision; + d_timePrecision = newPrecision; } protected: - unsigned int _timePrecision; + unsigned int d_timePrecision; }; @@ -67,17 +67,18 @@ public: setTrackerMode(QwtPicker::AlwaysOn); } - virtual ~TimeDomainDisplayZoomer(){ - + virtual ~TimeDomainDisplayZoomer() + { } - virtual void updateTrackerText(){ + virtual void updateTrackerText() + { updateDisplay(); } void setUnitType(const std::string &type) { - _unitType = type; + d_unitType = type; } protected: @@ -89,13 +90,13 @@ protected: if((dp.y() > 0.0001) && (dp.y() < 10000)) { t.setText(QString("%1 %2, %3 V"). arg(dp.x(), 0, 'f', getTimePrecision()). - arg(_unitType.c_str()). + arg(d_unitType.c_str()). arg(dp.y(), 0, 'f', 4)); } else { t.setText(QString("%1 %2, %3 V"). arg(dp.x(), 0, 'f', getTimePrecision()). - arg(_unitType.c_str()). + arg(d_unitType.c_str()). arg(dp.y(), 0, 'e', 4)); } @@ -103,7 +104,7 @@ protected: } private: - std::string _unitType; + std::string d_unitType; }; @@ -113,30 +114,30 @@ private: TimeDomainDisplayPlot::TimeDomainDisplayPlot(int nplots, QWidget* parent) : DisplayPlot(nplots, parent) { - _numPoints = 1024; - _xAxisPoints = new double[_numPoints]; - memset(_xAxisPoints, 0x0, _numPoints*sizeof(double)); + d_numPoints = 1024; + d_xdata = new double[d_numPoints]; + memset(d_xdata, 0x0, d_numPoints*sizeof(double)); - _zoomer = new TimeDomainDisplayZoomer(canvas(), 0); + d_zoomer = new TimeDomainDisplayZoomer(canvas(), 0); #if QWT_VERSION < 0x060000 - _zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection); + d_zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection); #endif - _zoomer->setMousePattern(QwtEventPattern::MouseSelect2, + d_zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier); - _zoomer->setMousePattern(QwtEventPattern::MouseSelect3, + d_zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::RightButton); const QColor c(Qt::darkRed); - _zoomer->setRubberBandPen(c); - _zoomer->setTrackerPen(c); + d_zoomer->setRubberBandPen(c); + d_zoomer->setTrackerPen(c); d_semilogx = false; d_semilogy = false; setAxisScaleEngine(QwtPlot::xBottom, new QwtLinearScaleEngine); - setXaxis(0, _numPoints); + setXaxis(0, d_numPoints); setAxisTitle(QwtPlot::xBottom, "Time (sec)"); setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine); @@ -151,41 +152,41 @@ TimeDomainDisplayPlot::TimeDomainDisplayPlot(int nplots, QWidget* parent) // Setup dataPoints and plot vectors // Automatically deleted when parent is deleted - for(int i = 0; i < _nplots; i++) { - _dataPoints.push_back(new double[_numPoints]); - memset(_dataPoints[i], 0x0, _numPoints*sizeof(double)); + for(int i = 0; i < d_nplots; i++) { + d_ydata.push_back(new double[d_numPoints]); + memset(d_ydata[i], 0x0, d_numPoints*sizeof(double)); - _plot_curve.push_back(new QwtPlotCurve(QString("Data %1").arg(i))); - _plot_curve[i]->attach(this); - _plot_curve[i]->setPen(QPen(colors[i])); - _plot_curve[i]->setRenderHint(QwtPlotItem::RenderAntialiased); + d_plot_curve.push_back(new QwtPlotCurve(QString("Data %1").arg(i))); + d_plot_curve[i]->attach(this); + d_plot_curve[i]->setPen(QPen(colors[i])); + d_plot_curve[i]->setRenderHint(QwtPlotItem::RenderAntialiased); QwtSymbol *symbol = new QwtSymbol(QwtSymbol::NoSymbol, QBrush(colors[i]), QPen(colors[i]), QSize(7,7)); #if QWT_VERSION < 0x060000 - _plot_curve[i]->setRawData(_xAxisPoints, _dataPoints[i], _numPoints); - _plot_curve[i]->setSymbol(*symbol); + d_plot_curve[i]->setRawData(d_xdata, d_ydata[i], d_numPoints); + d_plot_curve[i]->setSymbol(*symbol); #else - _plot_curve[i]->setRawSamples(_xAxisPoints, _dataPoints[i], _numPoints); - _plot_curve[i]->setSymbol(symbol); + d_plot_curve[i]->setRawSamples(d_xdata, d_ydata[i], d_numPoints); + d_plot_curve[i]->setSymbol(symbol); #endif } - _sampleRate = 1; + d_sample_rate = 1; _resetXAxisPoints(); - d_tag_markers.resize(_nplots); - d_tag_markers_en = std::vector<bool>(_nplots, true); + d_tag_markers.resize(d_nplots); + d_tag_markers_en = std::vector<bool>(d_nplots, true); } TimeDomainDisplayPlot::~TimeDomainDisplayPlot() { - for(int i = 0; i < _nplots; i++) - delete [] _dataPoints[i]; - delete[] _xAxisPoints; + for(int i = 0; i < d_nplots; i++) + delete [] d_ydata[i]; + delete[] d_xdata; - // _zoomer and _panner deleted when parent deleted + // d_zoomer and _panner deleted when parent deleted } void @@ -200,40 +201,40 @@ TimeDomainDisplayPlot::plotNewData(const std::vector<double*> dataPoints, const double timeInterval, const std::vector< std::vector<gr::tag_t> > &tags) { - if(!_stop) { + if(!d_stop) { if((numDataPoints > 0)) { - if(numDataPoints != _numPoints){ - _numPoints = numDataPoints; + if(numDataPoints != d_numPoints){ + d_numPoints = numDataPoints; - delete[] _xAxisPoints; - _xAxisPoints = new double[_numPoints]; + delete[] d_xdata; + d_xdata = new double[d_numPoints]; - for(int i = 0; i < _nplots; i++) { - delete[] _dataPoints[i]; - _dataPoints[i] = new double[_numPoints]; + for(int i = 0; i < d_nplots; i++) { + delete[] d_ydata[i]; + d_ydata[i] = new double[d_numPoints]; #if QWT_VERSION < 0x060000 - _plot_curve[i]->setRawData(_xAxisPoints, _dataPoints[i], _numPoints); + d_plot_curve[i]->setRawData(d_xdata, d_ydata[i], d_numPoints); #else - _plot_curve[i]->setRawSamples(_xAxisPoints, _dataPoints[i], _numPoints); + d_plot_curve[i]->setRawSamples(d_xdata, d_ydata[i], d_numPoints); #endif } _resetXAxisPoints(); } - for(int i = 0; i < _nplots; i++) { + for(int i = 0; i < d_nplots; i++) { if(d_semilogy) { for(int n = 0; n < numDataPoints; n++) - _dataPoints[i][n] = fabs(dataPoints[i][n]); + d_ydata[i][n] = fabs(dataPoints[i][n]); } else { - memcpy(_dataPoints[i], dataPoints[i], numDataPoints*sizeof(double)); + memcpy(d_ydata[i], dataPoints[i], numDataPoints*sizeof(double)); } } // Detach and delete any tags that were plotted last time - for(int n = 0; n < _nplots; n++) { + for(int n = 0; n < d_nplots; n++) { for(size_t i = 0; i < d_tag_markers[n].size(); i++) { d_tag_markers[n][i]->detach(); delete d_tag_markers[n][i]; @@ -245,16 +246,16 @@ TimeDomainDisplayPlot::plotNewData(const std::vector<double*> dataPoints, // First test if this was a complex input where real/imag get // split here into two stream. bool cmplx = false; - int mult = (int)_nplots / (int)tags.size(); + int mult = (int)d_nplots / (int)tags.size(); if(mult == 2) cmplx = true; std::vector< std::vector<gr::tag_t> >::const_iterator tag = tags.begin(); - for(int i = 0; i < _nplots; i+=mult) { + for(int i = 0; i < d_nplots; i+=mult) { std::vector<gr::tag_t>::const_iterator t; for(t = tag->begin(); t != tag->end(); t++) { uint64_t offset = (*t).offset; - double sample_offset = double(offset)/_sampleRate; + double sample_offset = double(offset)/d_sample_rate; std::stringstream s; s << (*t).key << ": " << (*t).value; @@ -264,11 +265,11 @@ TimeDomainDisplayPlot::plotNewData(const std::vector<double*> dataPoints, // real and imaginary parts and put the tag on that one. int which = i; if(cmplx) { - if(fabs(_dataPoints[i][offset]) < fabs(_dataPoints[i+1][offset])) + if(fabs(d_ydata[i][offset]) < fabs(d_ydata[i+1][offset])) which = i+1; } - double yval = _dataPoints[which][offset]; + double yval = d_ydata[which][offset]; // Find if we already have a marker at this location std::vector<QwtPlotMarker*>::iterator mitr; @@ -280,7 +281,7 @@ TimeDomainDisplayPlot::plotNewData(const std::vector<double*> dataPoints, // If no matching marker, create a new one if(mitr == d_tag_markers[which].end()) { - bool show = _plot_curve[which]->isVisible(); + bool show = d_plot_curve[which]->isVisible(); QwtPlotMarker *m = new QwtPlotMarker(); m->setXValue(sample_offset); @@ -335,15 +336,15 @@ TimeDomainDisplayPlot::plotNewData(const std::vector<double*> dataPoints, tag++; } - if(_autoscale_state) { + if(d_autoscale_state) { double bottom=1e20, top=-1e20; - for(int n = 0; n < _nplots; n++) { + for(int n = 0; n < d_nplots; n++) { for(int64_t point = 0; point < numDataPoints; point++) { - if(_dataPoints[n][point] < bottom) { - bottom = _dataPoints[n][point]; + if(d_ydata[n][point] < bottom) { + bottom = d_ydata[n][point]; } - if(_dataPoints[n][point] > top) { - top = _dataPoints[n][point]; + if(d_ydata[n][point] > top) { + top = d_ydata[n][point]; } } } @@ -359,8 +360,8 @@ void TimeDomainDisplayPlot::legendEntryChecked(QwtPlotItem* plotItem, bool on) { // When line is turned on/off, immediately show/hide tag markers - for(int n = 0; n < _nplots; n++) { - if(plotItem == _plot_curve[n]) { + for(int n = 0; n < d_nplots; n++) { + if(plotItem == d_plot_curve[n]) { for(size_t i = 0; i < d_tag_markers[n].size(); i++) { if(!(!on && d_tag_markers_en[n])) d_tag_markers[n][i]->hide(); @@ -375,28 +376,28 @@ TimeDomainDisplayPlot::legendEntryChecked(QwtPlotItem* plotItem, bool on) void TimeDomainDisplayPlot::_resetXAxisPoints() { - double delt = 1.0/_sampleRate; - for(long loc = 0; loc < _numPoints; loc++){ - _xAxisPoints[loc] = loc*delt; + double delt = 1.0/d_sample_rate; + for(long loc = 0; loc < d_numPoints; loc++){ + d_xdata[loc] = loc*delt; } // Set up zoomer base for maximum unzoom x-axis // and reset to maximum unzoom level - QwtDoubleRect zbase = _zoomer->zoomBase(); + QwtDoubleRect zbase = d_zoomer->zoomBase(); if(d_semilogx) { - setAxisScale(QwtPlot::xBottom, 1e-1, _numPoints*delt); + setAxisScale(QwtPlot::xBottom, 1e-1, d_numPoints*delt); zbase.setLeft(1e-1); } else { - setAxisScale(QwtPlot::xBottom, 0, _numPoints*delt); + setAxisScale(QwtPlot::xBottom, 0, d_numPoints*delt); zbase.setLeft(0); } - zbase.setRight(_numPoints*delt); - _zoomer->zoom(zbase); - _zoomer->setZoomBase(zbase); - _zoomer->zoom(0); + zbase.setRight(d_numPoints*delt); + d_zoomer->zoom(zbase); + d_zoomer->setZoomBase(zbase); + d_zoomer->zoom(0); } @@ -422,7 +423,7 @@ TimeDomainDisplayPlot::_autoScale(double bottom, double top) void TimeDomainDisplayPlot::setAutoScale(bool state) { - _autoscale_state = state; + d_autoscale_state = state; } void @@ -430,8 +431,8 @@ TimeDomainDisplayPlot::setSampleRate(double sr, double units, const std::string &strunits) { double newsr = sr/units; - if(newsr != _sampleRate) { - _sampleRate = sr/units; + if(newsr != d_sample_rate) { + d_sample_rate = sr/units; _resetXAxisPoints(); // While we could change the displayed sigfigs based on the unit being @@ -439,8 +440,8 @@ TimeDomainDisplayPlot::setSampleRate(double sr, double units, //double display_units = ceil(log10(units)/2.0); double display_units = 4; setAxisTitle(QwtPlot::xBottom, QString("Time (%1)").arg(strunits.c_str())); - ((TimeDomainDisplayZoomer*)_zoomer)->setTimePrecision(display_units); - ((TimeDomainDisplayZoomer*)_zoomer)->setUnitType(strunits); + ((TimeDomainDisplayZoomer*)d_zoomer)->setTimePrecision(display_units); + ((TimeDomainDisplayZoomer*)d_zoomer)->setUnitType(strunits); } } @@ -448,14 +449,14 @@ void TimeDomainDisplayPlot::stemPlot(bool en) { if(en) { - for(int i = 0; i < _nplots; i++) { - _plot_curve[i]->setStyle(QwtPlotCurve::Sticks); + for(int i = 0; i < d_nplots; i++) { + d_plot_curve[i]->setStyle(QwtPlotCurve::Sticks); setLineMarker(i, QwtSymbol::Ellipse); } } else { - for(int i = 0; i < _nplots; i++) { - _plot_curve[i]->setStyle(QwtPlotCurve::Lines); + for(int i = 0; i < d_nplots; i++) { + d_plot_curve[i]->setStyle(QwtPlotCurve::Lines); setLineMarker(i, QwtSymbol::NoSymbol); } } diff --git a/gr-qtgui/lib/TimeRasterDisplayPlot.cc b/gr-qtgui/lib/TimeRasterDisplayPlot.cc index 89e32cab9c..b26f7f071b 100644 --- a/gr-qtgui/lib/TimeRasterDisplayPlot.cc +++ b/gr-qtgui/lib/TimeRasterDisplayPlot.cc @@ -69,14 +69,14 @@ public: class QwtYScaleDraw: public QwtScaleDraw { public: - QwtYScaleDraw(): QwtScaleDraw(), _rows(0) { } + QwtYScaleDraw(): QwtScaleDraw(), d_rows(0) { } virtual ~QwtYScaleDraw() { } virtual QwtText label(double value) const { - if(_rows > 0) - value = _rows - value; + if(d_rows > 0) + value = d_rows - value; return QwtText(QString("").sprintf("%.0f", value)); } @@ -87,10 +87,10 @@ public: invalidateCache(); } - void setRows(double rows) { rows>0 ? _rows = rows : _rows = 0; } + void setRows(double rows) { rows>0 ? d_rows = rows : d_rows = 0; } private: - double _rows; + double d_rows; }; class TimePrecisionClass @@ -98,7 +98,7 @@ class TimePrecisionClass public: TimePrecisionClass(const int timePrecision) { - _timePrecision = timePrecision; + d_timePrecision = timePrecision; } virtual ~TimePrecisionClass() @@ -107,15 +107,15 @@ public: virtual unsigned int getTimePrecision() const { - return _timePrecision; + return d_timePrecision; } virtual void setTimePrecision(const unsigned int newPrecision) { - _timePrecision = newPrecision; + d_timePrecision = newPrecision; } protected: - unsigned int _timePrecision; + unsigned int d_timePrecision; }; /*********************************************************************** @@ -144,7 +144,7 @@ public: void setUnitType(const std::string &type) { - _unitType = type; + d_unitType = type; } void setColumns(const double cols) @@ -167,13 +167,13 @@ protected: double y = floor(d_rows - dp.y()); QwtText t(QString("%1 %2, %3") .arg(x, 0, 'f', getTimePrecision()) - .arg(_unitType.c_str()) + .arg(d_unitType.c_str()) .arg(y, 0, 'f', 0)); return t; } private: - std::string _unitType; + std::string d_unitType; double d_rows, d_cols; }; @@ -186,31 +186,31 @@ TimeRasterDisplayPlot::TimeRasterDisplayPlot(int nplots, QWidget* parent) : DisplayPlot(nplots, parent) { - _zoomer = NULL; // need this for proper init + d_zoomer = NULL; // need this for proper init resize(parent->width(), parent->height()); d_samp_rate = samp_rate; d_cols = cols; d_rows = rows; - _numPoints = d_cols; + d_numPoints = d_cols; setAxisScaleDraw(QwtPlot::xBottom, new QwtXScaleDraw()); setAxisScaleDraw(QwtPlot::yLeft, new QwtYScaleDraw()); - for(int i = 0; i < _nplots; i++) { + for(int i = 0; i < d_nplots; i++) { d_data.push_back(new TimeRasterData(d_rows, d_cols)); d_raster.push_back(new PlotTimeRaster("Raster")); d_raster[i]->setData(d_data[i]); // a hack around the fact that we aren't using plot curves for the // raster plots. - _plot_curve.push_back(new QwtPlotCurve(QString("Data"))); + d_plot_curve.push_back(new QwtPlotCurve(QString("Data"))); d_raster[i]->attach(this); d_color_map_type.push_back(INTENSITY_COLOR_MAP_TYPE_BLACK_HOT); - setAlpha(i, 255/_nplots); + setAlpha(i, 255/d_nplots); } // Set bottom plot with no transparency as a base @@ -220,23 +220,23 @@ TimeRasterDisplayPlot::TimeRasterDisplayPlot(int nplots, // MidButton for the panning // RightButton: zoom out by 1 // Ctrl+RighButton: zoom out to full size - _zoomer = new TimeRasterZoomer(canvas(), d_rows, d_cols, 0); + d_zoomer = new TimeRasterZoomer(canvas(), d_rows, d_cols, 0); #if QWT_VERSION < 0x060000 - _zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection); + d_zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection); #endif - _zoomer->setMousePattern(QwtEventPattern::MouseSelect2, - Qt::RightButton, Qt::ControlModifier); - _zoomer->setMousePattern(QwtEventPattern::MouseSelect3, - Qt::RightButton); + d_zoomer->setMousePattern(QwtEventPattern::MouseSelect2, + Qt::RightButton, Qt::ControlModifier); + d_zoomer->setMousePattern(QwtEventPattern::MouseSelect3, + Qt::RightButton); const QColor c(Qt::red); - _zoomer->setRubberBandPen(c); - _zoomer->setTrackerPen(c); + d_zoomer->setRubberBandPen(c); + d_zoomer->setTrackerPen(c); - // Set intensity color now (needed _zoomer before we could do this). + // Set intensity color now (needed d_zoomer before we could do this). // We've made sure the old type is different than here so we'll // force and update. - for(int i = 0; i < _nplots; i++) { + for(int i = 0; i < d_nplots; i++) { setIntensityColorMapType(i, INTENSITY_COLOR_MAP_TYPE_WHITE_HOT, QColor("white"), QColor("white")); } @@ -253,7 +253,7 @@ TimeRasterDisplayPlot::~TimeRasterDisplayPlot() void TimeRasterDisplayPlot::reset() { - for(int i = 0; i < _nplots; i++) { + for(int i = 0; i < d_nplots; i++) { d_data[i]->resizeData(d_rows, d_cols); d_data[i]->reset(); } @@ -277,23 +277,23 @@ TimeRasterDisplayPlot::reset() xScale->initiateUpdate(); // Load up the new base zoom settings - if(_zoomer) { + if(d_zoomer) { double display_units = 4; - ((TimeRasterZoomer*)_zoomer)->setColumns(d_cols); - ((TimeRasterZoomer*)_zoomer)->setRows(d_rows); - ((TimeRasterZoomer*)_zoomer)->setSecondsPerLine(sec_per_samp); - ((TimeRasterZoomer*)_zoomer)->setTimePrecision(display_units); - ((TimeRasterZoomer*)_zoomer)->setUnitType(strunits[iunit]); + ((TimeRasterZoomer*)d_zoomer)->setColumns(d_cols); + ((TimeRasterZoomer*)d_zoomer)->setRows(d_rows); + ((TimeRasterZoomer*)d_zoomer)->setSecondsPerLine(sec_per_samp); + ((TimeRasterZoomer*)d_zoomer)->setTimePrecision(display_units); + ((TimeRasterZoomer*)d_zoomer)->setUnitType(strunits[iunit]); - QwtDoubleRect newSize = _zoomer->zoomBase(); + QwtDoubleRect newSize = d_zoomer->zoomBase(); newSize.setLeft(0); newSize.setWidth(d_cols); newSize.setBottom(0); newSize.setHeight(d_rows); - _zoomer->zoom(newSize); - _zoomer->setZoomBase(newSize); - _zoomer->zoom(0); + d_zoomer->zoom(newSize); + d_zoomer->setZoomBase(newSize); + d_zoomer->zoom(0); } } @@ -353,7 +353,7 @@ TimeRasterDisplayPlot::setPlotDimensions(const double rows, const double cols, d_rows = rows; d_cols = cols; - if((axisScaleDraw(QwtPlot::xBottom) != NULL) && (_zoomer != NULL)) { + if((axisScaleDraw(QwtPlot::xBottom) != NULL) && (d_zoomer != NULL)) { if(rst) { reset(); } @@ -364,9 +364,9 @@ void TimeRasterDisplayPlot::plotNewData(const std::vector<double*> dataPoints, const int64_t numDataPoints) { - if(!_stop) { + if(!d_stop) { if(numDataPoints > 0) { - for(int i = 0; i < _nplots; i++) { + for(int i = 0; i < d_nplots; i++) { d_data[i]->addData(dataPoints[i], numDataPoints); d_raster[i]->invalidateCache(); d_raster[i]->itemChanged(); @@ -390,7 +390,7 @@ void TimeRasterDisplayPlot::setIntensityRange(const double minIntensity, const double maxIntensity) { - for(int i = 0; i < _nplots; i++) { + for(int i = 0; i < d_nplots; i++) { #if QWT_VERSION < 0x060000 d_data[i]->setRange(QwtDoubleInterval(minIntensity, maxIntensity)); #else @@ -441,8 +441,8 @@ TimeRasterDisplayPlot::replot() axisWidget(QwtPlot::xBottom)->update(); } - if(_zoomer != NULL) { - ((TimeRasterZoomer*)_zoomer)->updateTrackerText(); + if(d_zoomer != NULL) { + ((TimeRasterZoomer*)d_zoomer)->updateTrackerText(); } QwtPlot::replot(); @@ -474,8 +474,8 @@ TimeRasterDisplayPlot::setIntensityColorMapType(const int which, d_color_map_type[which] = newType; d_raster[which]->setColorMap(new ColorMap_MultiColor()); - if(_zoomer) - _zoomer->setTrackerPen(QColor(Qt::black)); + if(d_zoomer) + d_zoomer->setTrackerPen(QColor(Qt::black)); break; } case INTENSITY_COLOR_MAP_TYPE_WHITE_HOT: { @@ -526,7 +526,7 @@ TimeRasterDisplayPlot::_updateIntensityRangeDisplay() rightAxis->setTitle("Intensity"); rightAxis->setColorBarEnabled(true); - for(int i = 0; i < _nplots; i++) { + for(int i = 0; i < d_nplots; i++) { #if QWT_VERSION < 0x060000 rightAxis->setColorMap(d_raster[i]->data()->range(), d_raster[i]->colorMap()); diff --git a/gr-qtgui/lib/WaterfallDisplayPlot.cc b/gr-qtgui/lib/WaterfallDisplayPlot.cc index d86d0e5885..47d6624798 100644 --- a/gr-qtgui/lib/WaterfallDisplayPlot.cc +++ b/gr-qtgui/lib/WaterfallDisplayPlot.cc @@ -97,7 +97,7 @@ public: void setUnitType(const std::string &type) { - _unitType = type; + d_unitType = type; } protected: @@ -107,14 +107,14 @@ protected: QwtDoublePoint dp = QwtPlotZoomer::invTransform(p); double secs = double(dp.y() * getSecondsPerLine()); QwtText t(QString("%1 %2, %3 s") - .arg(dp.x(), 0, 'f', getFrequencyPrecision()) - .arg(_unitType.c_str()) + .arg(dp.x(), 0, 'f', getFrequencyPrecision()) + .arg(d_unitType.c_str()) .arg(secs, 0, 'f', 2)); return t; } private: - std::string _unitType; + std::string d_unitType; }; /********************************************************************* @@ -123,12 +123,12 @@ private: WaterfallDisplayPlot::WaterfallDisplayPlot(int nplots, QWidget* parent) : DisplayPlot(nplots, parent) { - _zoomer = NULL; // need this for proper init - _startFrequency = -1; - _stopFrequency = 1; + d_zoomer = NULL; // need this for proper init + d_start_frequency = -1; + d_stop_frequency = 1; resize(parent->width(), parent->height()); - _numPoints = 1024; + d_numPoints = 1024; setAxisTitle(QwtPlot::xBottom, "Frequency (Hz)"); setAxisScaleDraw(QwtPlot::xBottom, new FreqDisplayScaleDraw(0)); @@ -136,9 +136,9 @@ WaterfallDisplayPlot::WaterfallDisplayPlot(int nplots, QWidget* parent) setAxisTitle(QwtPlot::yLeft, "Time (s)"); setAxisScaleDraw(QwtPlot::yLeft, new QwtTimeScaleDraw()); - for(int i = 0; i < _nplots; i++) { - d_data.push_back(new WaterfallData(_startFrequency, _stopFrequency, - _numPoints, 200)); + for(int i = 0; i < d_nplots; i++) { + d_data.push_back(new WaterfallData(d_start_frequency, d_stop_frequency, + d_numPoints, 200)); #if QWT_VERSION < 0x060000 d_spectrogram.push_back(new PlotWaterfall(d_data[i], "Spectrogram")); @@ -152,15 +152,15 @@ WaterfallDisplayPlot::WaterfallDisplayPlot(int nplots, QWidget* parent) // a hack around the fact that we aren't using plot curves for the // spectrogram plots. - _plot_curve.push_back(new QwtPlotCurve(QString("Data %1").arg(i))); + d_plot_curve.push_back(new QwtPlotCurve(QString("Data %1").arg(i))); d_spectrogram[i]->attach(this); - _intensityColorMapType.push_back(INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR); - setIntensityColorMapType(i, _intensityColorMapType[i], + d_intensity_color_map_type.push_back(INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR); + setIntensityColorMapType(i, d_intensity_color_map_type[i], QColor("white"), QColor("white")); - setAlpha(i, 255/_nplots); + setAlpha(i, 255/d_nplots); } // Set bottom plot with no transparency as a base @@ -170,22 +170,22 @@ WaterfallDisplayPlot::WaterfallDisplayPlot(int nplots, QWidget* parent) // MidButton for the panning // RightButton: zoom out by 1 // Ctrl+RighButton: zoom out to full size - _zoomer = new WaterfallZoomer(canvas(), 0); + d_zoomer = new WaterfallZoomer(canvas(), 0); #if QWT_VERSION < 0x060000 - _zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection); + d_zoomer->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelection); #endif - _zoomer->setMousePattern(QwtEventPattern::MouseSelect2, - Qt::RightButton, Qt::ControlModifier); - _zoomer->setMousePattern(QwtEventPattern::MouseSelect3, - Qt::RightButton); + d_zoomer->setMousePattern(QwtEventPattern::MouseSelect2, + Qt::RightButton, Qt::ControlModifier); + d_zoomer->setMousePattern(QwtEventPattern::MouseSelect3, + Qt::RightButton); const QColor c(Qt::black); - _zoomer->setRubberBandPen(c); - _zoomer->setTrackerPen(c); + d_zoomer->setRubberBandPen(c); + d_zoomer->setTrackerPen(c); _updateIntensityRangeDisplay(); - _xAxisMultiplier = 1; + d_xaxis_multiplier = 1; } WaterfallDisplayPlot::~WaterfallDisplayPlot() @@ -195,19 +195,19 @@ WaterfallDisplayPlot::~WaterfallDisplayPlot() void WaterfallDisplayPlot::resetAxis() { - for(int i = 0; i < _nplots; i++) { - d_data[i]->resizeData(_startFrequency, _stopFrequency, _numPoints); + for(int i = 0; i < d_nplots; i++) { + d_data[i]->resizeData(d_start_frequency, d_stop_frequency, d_numPoints); d_data[i]->reset(); } - setAxisScale(QwtPlot::xBottom, _startFrequency, _stopFrequency); + setAxisScale(QwtPlot::xBottom, d_start_frequency, d_stop_frequency); // Load up the new base zoom settings - QwtDoubleRect zbase = _zoomer->zoomBase(); - _zoomer->zoom(zbase); - _zoomer->setZoomBase(zbase); - _zoomer->setZoomBase(true); - _zoomer->zoom(0); + QwtDoubleRect zbase = d_zoomer->zoomBase(); + d_zoomer->zoom(zbase); + d_zoomer->setZoomBase(zbase); + d_zoomer->setZoomBase(true); + d_zoomer->zoom(0); } void @@ -218,17 +218,17 @@ WaterfallDisplayPlot::setFrequencyRange(const double centerfreq, double startFreq = (centerfreq - bandwidth/2.0f) / units; double stopFreq = (centerfreq + bandwidth/2.0f) / units; - _xAxisMultiplier = units; + d_xaxis_multiplier = units; bool reset = false; - if((startFreq != _startFrequency) || (stopFreq != _stopFrequency)) + if((startFreq != d_start_frequency) || (stopFreq != d_stop_frequency)) reset = true; if(stopFreq > startFreq) { - _startFrequency = startFreq; - _stopFrequency = stopFreq; + d_start_frequency = startFreq; + d_stop_frequency = stopFreq; - if((axisScaleDraw(QwtPlot::xBottom) != NULL) && (_zoomer != NULL)) { + if((axisScaleDraw(QwtPlot::xBottom) != NULL) && (d_zoomer != NULL)) { double display_units = ceil(log10(units)/2.0); setAxisScaleDraw(QwtPlot::xBottom, new FreqDisplayScaleDraw(display_units)); setAxisTitle(QwtPlot::xBottom, QString("Frequency (%1)").arg(strunits.c_str())); @@ -237,8 +237,8 @@ WaterfallDisplayPlot::setFrequencyRange(const double centerfreq, resetAxis(); } - ((WaterfallZoomer*)_zoomer)->setFrequencyPrecision(display_units); - ((WaterfallZoomer*)_zoomer)->setUnitType(strunits); + ((WaterfallZoomer*)d_zoomer)->setFrequencyPrecision(display_units); + ((WaterfallZoomer*)d_zoomer)->setUnitType(strunits); } } } @@ -247,13 +247,13 @@ WaterfallDisplayPlot::setFrequencyRange(const double centerfreq, double WaterfallDisplayPlot::getStartFrequency() const { - return _startFrequency; + return d_start_frequency; } double WaterfallDisplayPlot::getStopFrequency() const { - return _stopFrequency; + return d_stop_frequency; } void @@ -263,14 +263,14 @@ WaterfallDisplayPlot::plotNewData(const std::vector<double*> dataPoints, const gr::high_res_timer_type timestamp, const int droppedFrames) { - if(!_stop) { + if(!d_stop) { if(numDataPoints > 0){ - if(numDataPoints != _numPoints){ - _numPoints = numDataPoints; + if(numDataPoints != d_numPoints){ + d_numPoints = numDataPoints; resetAxis(); - for(int i = 0; i < _nplots; i++) { + for(int i = 0; i < d_nplots; i++) { d_spectrogram[i]->invalidateCache(); d_spectrogram[i]->itemChanged(); } @@ -284,10 +284,10 @@ WaterfallDisplayPlot::plotNewData(const std::vector<double*> dataPoints, timeScale->setSecondsPerLine(timePerFFT); timeScale->setZeroTime(timestamp); - ((WaterfallZoomer*)_zoomer)->setSecondsPerLine(timePerFFT); - ((WaterfallZoomer*)_zoomer)->setZeroTime(timestamp); + ((WaterfallZoomer*)d_zoomer)->setSecondsPerLine(timePerFFT); + ((WaterfallZoomer*)d_zoomer)->setZeroTime(timestamp); - for(int i = 0; i < _nplots; i++) { + for(int i = 0; i < d_nplots; i++) { d_data[i]->addFFTData(dataPoints[i], numDataPoints, droppedFrames); d_data[i]->incrementNumLinesToUpdate(); d_spectrogram[i]->invalidateCache(); @@ -316,7 +316,7 @@ void WaterfallDisplayPlot::setIntensityRange(const double minIntensity, const double maxIntensity) { - for(int i = 0; i < _nplots; i++) { + for(int i = 0; i < d_nplots; i++) { #if QWT_VERSION < 0x060000 d_data[i]->setRange(QwtDoubleInterval(minIntensity, maxIntensity)); #else @@ -374,8 +374,8 @@ WaterfallDisplayPlot::replot() axisWidget(QwtPlot::xBottom)->update(); } - if(_zoomer != NULL){ - ((WaterfallZoomer*)_zoomer)->updateTrackerText(); + if(d_zoomer != NULL){ + ((WaterfallZoomer*)d_zoomer)->updateTrackerText(); } QwtPlot::replot(); @@ -384,7 +384,7 @@ WaterfallDisplayPlot::replot() void WaterfallDisplayPlot::clearData() { - for(int i = 0; i < _nplots; i++) { + for(int i = 0; i < d_nplots; i++) { d_data[i]->reset(); } } @@ -393,7 +393,7 @@ WaterfallDisplayPlot::clearData() int WaterfallDisplayPlot::getIntensityColorMapType(int which) const { - return _intensityColorMapType[which]; + return d_intensity_color_map_type[which]; } void @@ -402,12 +402,12 @@ WaterfallDisplayPlot::setIntensityColorMapType(const int which, const QColor lowColor, const QColor highColor) { - if((_intensityColorMapType[which] != newType) || + if((d_intensity_color_map_type[which] != newType) || ((newType == INTENSITY_COLOR_MAP_TYPE_USER_DEFINED) && (lowColor.isValid() && highColor.isValid()))){ switch(newType){ case INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR:{ - _intensityColorMapType[which] = newType; + d_intensity_color_map_type[which] = newType; #if QWT_VERSION < 0x060000 ColorMap_MultiColor colorMap; d_spectrogram[which]->setColorMap(colorMap); @@ -417,7 +417,7 @@ WaterfallDisplayPlot::setIntensityColorMapType(const int which, break; } case INTENSITY_COLOR_MAP_TYPE_WHITE_HOT:{ - _intensityColorMapType[which] = newType; + d_intensity_color_map_type[which] = newType; #if QWT_VERSION < 0x060000 ColorMap_WhiteHot colorMap; d_spectrogram[which]->setColorMap(colorMap); @@ -427,7 +427,7 @@ WaterfallDisplayPlot::setIntensityColorMapType(const int which, break; } case INTENSITY_COLOR_MAP_TYPE_BLACK_HOT:{ - _intensityColorMapType[which] = newType; + d_intensity_color_map_type[which] = newType; #if QWT_VERSION < 0x060000 ColorMap_BlackHot colorMap; d_spectrogram[which]->setColorMap(colorMap); @@ -437,7 +437,7 @@ WaterfallDisplayPlot::setIntensityColorMapType(const int which, break; } case INTENSITY_COLOR_MAP_TYPE_INCANDESCENT:{ - _intensityColorMapType[which] = newType; + d_intensity_color_map_type[which] = newType; #if QWT_VERSION < 0x060000 ColorMap_Incandescent colorMap; d_spectrogram[which]->setColorMap(colorMap); @@ -447,9 +447,9 @@ WaterfallDisplayPlot::setIntensityColorMapType(const int which, break; } case INTENSITY_COLOR_MAP_TYPE_USER_DEFINED:{ - _userDefinedLowIntensityColor = lowColor; - _userDefinedHighIntensityColor = highColor; - _intensityColorMapType[which] = newType; + d_user_defined_low_intensity_color = lowColor; + d_user_defined_high_intensity_color = highColor; + d_intensity_color_map_type[which] = newType; #if QWT_VERSION < 0x060000 ColorMap_UserDefined colorMap(lowColor, highColor); d_spectrogram[which]->setColorMap(colorMap); @@ -468,7 +468,8 @@ WaterfallDisplayPlot::setIntensityColorMapType(const int which, void WaterfallDisplayPlot::setIntensityColorMapType1(int newType) { - setIntensityColorMapType(0, newType, _userDefinedLowIntensityColor, _userDefinedHighIntensityColor); + setIntensityColorMapType(0, newType, d_user_defined_low_intensity_color, + d_user_defined_high_intensity_color); } int @@ -480,25 +481,25 @@ WaterfallDisplayPlot::getIntensityColorMapType1() const void WaterfallDisplayPlot::setUserDefinedLowIntensityColor(QColor c) { - _userDefinedLowIntensityColor = c; + d_user_defined_low_intensity_color = c; } const QColor WaterfallDisplayPlot::getUserDefinedLowIntensityColor() const { - return _userDefinedLowIntensityColor; + return d_user_defined_low_intensity_color; } void WaterfallDisplayPlot::setUserDefinedHighIntensityColor(QColor c) { - _userDefinedHighIntensityColor = c; + d_user_defined_high_intensity_color = c; } const QColor WaterfallDisplayPlot::getUserDefinedHighIntensityColor() const { - return _userDefinedHighIntensityColor; + return d_user_defined_high_intensity_color; } int @@ -520,7 +521,7 @@ WaterfallDisplayPlot::_updateIntensityRangeDisplay() rightAxis->setTitle("Intensity (dB)"); rightAxis->setColorBarEnabled(true); - for(int i = 0; i < _nplots; i++) { + for(int i = 0; i < d_nplots; i++) { #if QWT_VERSION < 0x060000 rightAxis->setColorMap(d_spectrogram[i]->data()->range(), d_spectrogram[i]->colorMap()); @@ -529,7 +530,7 @@ WaterfallDisplayPlot::_updateIntensityRangeDisplay() d_spectrogram[i]->data()->range().maxValue()); #else QwtInterval intv = d_spectrogram[i]->interval(Qt::ZAxis); - switch(_intensityColorMapType[i]) { + switch(d_intensity_color_map_type[i]) { case INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR: rightAxis->setColorMap(intv, new ColorMap_MultiColor()); break; case INTENSITY_COLOR_MAP_TYPE_WHITE_HOT: @@ -539,8 +540,9 @@ WaterfallDisplayPlot::_updateIntensityRangeDisplay() case INTENSITY_COLOR_MAP_TYPE_INCANDESCENT: rightAxis->setColorMap(intv, new ColorMap_Incandescent()); break; case INTENSITY_COLOR_MAP_TYPE_USER_DEFINED: - rightAxis->setColorMap(intv, new ColorMap_UserDefined(_userDefinedLowIntensityColor, - _userDefinedHighIntensityColor)); break; + rightAxis->setColorMap(intv, new ColorMap_UserDefined(d_user_defined_low_intensity_color, + d_user_defined_high_intensity_color)); + break; default: rightAxis->setColorMap(intv, new ColorMap_MultiColor()); break; } diff --git a/gr-qtgui/lib/constellationdisplayform.cc b/gr-qtgui/lib/constellationdisplayform.cc index 52691ee67a..d0424b0511 100644 --- a/gr-qtgui/lib/constellationdisplayform.cc +++ b/gr-qtgui/lib/constellationdisplayform.cc @@ -28,22 +28,22 @@ ConstellationDisplayForm::ConstellationDisplayForm(int nplots, QWidget* parent) : DisplayForm(nplots, parent) { - _intValidator = new QIntValidator(this); - _intValidator->setBottom(0); + d_int_validator = new QIntValidator(this); + d_int_validator->setBottom(0); - _layout = new QGridLayout(this); - _displayPlot = new ConstellationDisplayPlot(nplots, this); - _layout->addWidget(_displayPlot, 0, 0); - setLayout(_layout); + d_layout = new QGridLayout(this); + d_display_plot = new ConstellationDisplayPlot(nplots, this); + d_layout->addWidget(d_display_plot, 0, 0); + setLayout(d_layout); NPointsMenu *nptsmenu = new NPointsMenu(this); - _menu->addAction(nptsmenu); + d_menu->addAction(nptsmenu); connect(nptsmenu, SIGNAL(whichTrigger(int)), this, SLOT(setNPoints(const int))); Reset(); - connect(_displayPlot, SIGNAL(plotPointSelected(const QPointF)), + connect(d_display_plot, SIGNAL(plotPointSelected(const QPointF)), this, SLOT(onPlotPointSelected(const QPointF))); } @@ -52,13 +52,13 @@ ConstellationDisplayForm::~ConstellationDisplayForm() // Qt deletes children when parent is deleted // Don't worry about deleting Display Plots - they are deleted when parents are deleted - delete _intValidator; + delete d_int_validator; } ConstellationDisplayPlot* ConstellationDisplayForm::getPlot() { - return ((ConstellationDisplayPlot*)_displayPlot); + return ((ConstellationDisplayPlot*)d_display_plot); } void @@ -110,9 +110,9 @@ ConstellationDisplayForm::setXaxis(double min, double max) void ConstellationDisplayForm::autoScale(bool en) { - _autoscale_state = en; - _autoscale_act->setChecked(en); - getPlot()->setAutoScale(_autoscale_state); + d_autoscale_state = en; + d_autoscale_act->setChecked(en); + getPlot()->setAutoScale(d_autoscale_state); getPlot()->replot(); } diff --git a/gr-qtgui/lib/displayform.cc b/gr-qtgui/lib/displayform.cc index ce83c96389..036370f9dc 100644 --- a/gr-qtgui/lib/displayform.cc +++ b/gr-qtgui/lib/displayform.cc @@ -26,149 +26,149 @@ #include <QFileDialog> DisplayForm::DisplayForm(int nplots, QWidget* parent) - : QWidget(parent), _nplots(nplots), _systemSpecifiedFlag(false) + : QWidget(parent), d_nplots(nplots), d_system_specified_flag(false) { - _isclosed = false; + d_isclosed = false; // Set the initial plot size resize(QSize(800, 600)); // Set up a grid that can be turned on/off - _grid = new QwtPlotGrid(); - _grid->setPen(QPen(QColor(Qt::gray))); + d_grid = new QwtPlotGrid(); + d_grid->setPen(QPen(QColor(Qt::gray))); // Create a set of actions for the menu - _stop_act = new QAction("Stop", this); - _stop_act->setStatusTip(tr("Start/Stop")); - connect(_stop_act, SIGNAL(triggered()), this, SLOT(setStop())); - _stop_state = false; - - _grid_act = new QAction("Grid", this); - _grid_act->setCheckable(true); - _grid_act->setStatusTip(tr("Toggle Grid on/off")); - connect(_grid_act, SIGNAL(triggered(bool)), + d_stop_act = new QAction("Stop", this); + d_stop_act->setStatusTip(tr("Start/Stop")); + connect(d_stop_act, SIGNAL(triggered()), this, SLOT(setStop())); + d_stop_state = false; + + d_grid_act = new QAction("Grid", this); + d_grid_act->setCheckable(true); + d_grid_act->setStatusTip(tr("Toggle Grid on/off")); + connect(d_grid_act, SIGNAL(triggered(bool)), this, SLOT(setGrid(bool))); - _grid_state = false; + d_grid_state = false; // Create a pop-up menu for manipulating the figure - _menu_on = true; - _menu = new QMenu(this); - _menu->addAction(_stop_act); - _menu->addAction(_grid_act); - - for(int i = 0; i < _nplots; i++) { - _line_title_act.push_back(new LineTitleAction(i, this)); - _line_color_menu.push_back(new LineColorMenu(i, this)); - _line_width_menu.push_back(new LineWidthMenu(i, this)); - _line_style_menu.push_back(new LineStyleMenu(i, this)); - _line_marker_menu.push_back(new LineMarkerMenu(i, this)); - _marker_alpha_menu.push_back(new MarkerAlphaMenu(i, this)); - - connect(_line_title_act[i], SIGNAL(whichTrigger(int, const QString&)), + d_menu_on = true; + d_menu = new QMenu(this); + d_menu->addAction(d_stop_act); + d_menu->addAction(d_grid_act); + + for(int i = 0; i < d_nplots; i++) { + d_line_title_act.push_back(new LineTitleAction(i, this)); + d_line_color_menu.push_back(new LineColorMenu(i, this)); + d_line_width_menu.push_back(new LineWidthMenu(i, this)); + d_line_style_menu.push_back(new LineStyleMenu(i, this)); + d_line_marker_menu.push_back(new LineMarkerMenu(i, this)); + d_marker_alpha_menu.push_back(new MarkerAlphaMenu(i, this)); + + connect(d_line_title_act[i], SIGNAL(whichTrigger(int, const QString&)), this, SLOT(setLineLabel(int, const QString&))); - for(int j = 0; j < _line_color_menu[i]->getNumActions(); j++) { - connect(_line_color_menu[i], SIGNAL(whichTrigger(int, const QString&)), + for(int j = 0; j < d_line_color_menu[i]->getNumActions(); j++) { + connect(d_line_color_menu[i], SIGNAL(whichTrigger(int, const QString&)), this, SLOT(setLineColor(int, const QString&))); } - for(int j = 0; j < _line_width_menu[i]->getNumActions(); j++) { - connect(_line_width_menu[i], SIGNAL(whichTrigger(int, int)), + for(int j = 0; j < d_line_width_menu[i]->getNumActions(); j++) { + connect(d_line_width_menu[i], SIGNAL(whichTrigger(int, int)), this, SLOT(setLineWidth(int, int))); } - for(int j = 0; j < _line_style_menu[i]->getNumActions(); j++) { - connect(_line_style_menu[i], SIGNAL(whichTrigger(int, Qt::PenStyle)), + for(int j = 0; j < d_line_style_menu[i]->getNumActions(); j++) { + connect(d_line_style_menu[i], SIGNAL(whichTrigger(int, Qt::PenStyle)), this, SLOT(setLineStyle(int, Qt::PenStyle))); } - for(int j = 0; j < _line_marker_menu[i]->getNumActions(); j++) { - connect(_line_marker_menu[i], SIGNAL(whichTrigger(int, QwtSymbol::Style)), + for(int j = 0; j < d_line_marker_menu[i]->getNumActions(); j++) { + connect(d_line_marker_menu[i], SIGNAL(whichTrigger(int, QwtSymbol::Style)), this, SLOT(setLineMarker(int, QwtSymbol::Style))); } - for(int j = 0; j < _marker_alpha_menu[i]->getNumActions(); j++) { - connect(_marker_alpha_menu[i], SIGNAL(whichTrigger(int, int)), + for(int j = 0; j < d_marker_alpha_menu[i]->getNumActions(); j++) { + connect(d_marker_alpha_menu[i], SIGNAL(whichTrigger(int, int)), this, SLOT(setMarkerAlpha(int, int))); } - _lines_menu.push_back(new QMenu(tr(""), this)); - _lines_menu[i]->addAction(_line_title_act[i]); - _lines_menu[i]->addMenu(_line_color_menu[i]); - _lines_menu[i]->addMenu(_line_width_menu[i]); - _lines_menu[i]->addMenu(_line_style_menu[i]); - _lines_menu[i]->addMenu(_line_marker_menu[i]); - _lines_menu[i]->addMenu(_marker_alpha_menu[i]); - _menu->addMenu(_lines_menu[i]); + d_lines_menu.push_back(new QMenu(tr(""), this)); + d_lines_menu[i]->addAction(d_line_title_act[i]); + d_lines_menu[i]->addMenu(d_line_color_menu[i]); + d_lines_menu[i]->addMenu(d_line_width_menu[i]); + d_lines_menu[i]->addMenu(d_line_style_menu[i]); + d_lines_menu[i]->addMenu(d_line_marker_menu[i]); + d_lines_menu[i]->addMenu(d_marker_alpha_menu[i]); + d_menu->addMenu(d_lines_menu[i]); } - _samp_rate_act = new PopupMenu("Sample Rate", this); - _samp_rate_act->setStatusTip(tr("Set Sample Rate")); - connect(_samp_rate_act, SIGNAL(whichTrigger(QString)), + d_samp_rate_act = new PopupMenu("Sample Rate", this); + d_samp_rate_act->setStatusTip(tr("Set Sample Rate")); + connect(d_samp_rate_act, SIGNAL(whichTrigger(QString)), this, SLOT(setSampleRate(QString))); - _menu->addAction(_samp_rate_act); + d_menu->addAction(d_samp_rate_act); - _autoscale_act = new QAction("Auto Scale", this); - _autoscale_act->setStatusTip(tr("Autoscale Plot")); - _autoscale_act->setCheckable(true); - connect(_autoscale_act, SIGNAL(triggered(bool)), + d_autoscale_act = new QAction("Auto Scale", this); + d_autoscale_act->setStatusTip(tr("Autoscale Plot")); + d_autoscale_act->setCheckable(true); + connect(d_autoscale_act, SIGNAL(triggered(bool)), this, SLOT(autoScale(bool))); - _autoscale_state = false; - _menu->addAction(_autoscale_act); + d_autoscale_state = false; + d_menu->addAction(d_autoscale_act); - _save_act = new QAction("Save", this); - _save_act->setStatusTip(tr("Save Figure")); - connect(_save_act, SIGNAL(triggered()), this, SLOT(saveFigure())); - _menu->addAction(_save_act); + d_save_act = new QAction("Save", this); + d_save_act->setStatusTip(tr("Save Figure")); + connect(d_save_act, SIGNAL(triggered()), this, SLOT(saveFigure())); + d_menu->addAction(d_save_act); Reset(); // Create a timer to update plots at the specified rate - d_displayTimer = new QTimer(this); - connect(d_displayTimer, SIGNAL(timeout()), this, SLOT(updateGuiTimer())); + d_display_timer = new QTimer(this); + connect(d_display_timer, SIGNAL(timeout()), this, SLOT(updateGuiTimer())); } DisplayForm::~DisplayForm() { - _isclosed = true; + d_isclosed = true; // Qt deletes children when parent is deleted // Don't worry about deleting Display Plots - they are deleted when parents are deleted - d_displayTimer->stop(); - delete d_displayTimer; + d_display_timer->stop(); + delete d_display_timer; } void DisplayForm::resizeEvent( QResizeEvent *e ) { QSize s = size(); - emit _displayPlot->resizeSlot(&s); + emit d_display_plot->resizeSlot(&s); } void DisplayForm::mousePressEvent( QMouseEvent * e) { bool ctrloff = Qt::ControlModifier != QApplication::keyboardModifiers(); - if((e->button() == Qt::MidButton) && ctrloff && (_menu_on)) { - if(_stop_state == false) - _stop_act->setText(tr("Stop")); + if((e->button() == Qt::MidButton) && ctrloff && (d_menu_on)) { + if(d_stop_state == false) + d_stop_act->setText(tr("Stop")); else - _stop_act->setText(tr("Start")); + d_stop_act->setText(tr("Start")); // Update the line titles if changed externally - for(int i = 0; i < _nplots; i++) { - _lines_menu[i]->setTitle(_displayPlot->getLineLabel(i)); + for(int i = 0; i < d_nplots; i++) { + d_lines_menu[i]->setTitle(d_display_plot->getLineLabel(i)); } - _menu->exec(e->globalPos()); + d_menu->exec(e->globalPos()); } } void DisplayForm::updateGuiTimer() { - _displayPlot->canvas()->update(); + d_display_plot->canvas()->update(); } void @@ -185,19 +185,19 @@ DisplayForm::Reset() bool DisplayForm::isClosed() const { - return _isclosed; + return d_isclosed; } void DisplayForm::enableMenu(bool en) { - _menu_on = en; + d_menu_on = en; } void DisplayForm::closeEvent(QCloseEvent *e) { - _isclosed = true; + d_isclosed = true; qApp->processEvents(); QWidget::closeEvent(e); } @@ -206,97 +206,97 @@ void DisplayForm::setUpdateTime(double t) { d_update_time = t; - d_displayTimer->start(d_update_time); + d_display_timer->start(d_update_time); } void DisplayForm::setTitle(const QString &title) { - _displayPlot->setTitle(title); + d_display_plot->setTitle(title); } void DisplayForm::setLineLabel(int which, const QString &label) { - _displayPlot->setLineLabel(which, label); + d_display_plot->setLineLabel(which, label); } void DisplayForm::setLineColor(int which, const QString &color) { QColor c = QColor(color); - _displayPlot->setLineColor(which, c); - _displayPlot->replot(); + d_display_plot->setLineColor(which, c); + d_display_plot->replot(); } void DisplayForm::setLineWidth(int which, int width) { - _displayPlot->setLineWidth(which, width); - _displayPlot->replot(); + d_display_plot->setLineWidth(which, width); + d_display_plot->replot(); } void DisplayForm::setLineStyle(int which, Qt::PenStyle style) { - _displayPlot->setLineStyle(which, style); - _displayPlot->replot(); + d_display_plot->setLineStyle(which, style); + d_display_plot->replot(); } void DisplayForm::setLineMarker(int which, QwtSymbol::Style marker) { - _displayPlot->setLineMarker(which, marker); - _displayPlot->replot(); + d_display_plot->setLineMarker(which, marker); + d_display_plot->replot(); } void DisplayForm::setMarkerAlpha(int which, int alpha) { - _displayPlot->setMarkerAlpha(which, alpha); - _displayPlot->replot(); + d_display_plot->setMarkerAlpha(which, alpha); + d_display_plot->replot(); } QString DisplayForm::title() { - return _displayPlot->title().text(); + return d_display_plot->title().text(); } QString DisplayForm::lineLabel(int which) { - return _displayPlot->getLineLabel(which); + return d_display_plot->getLineLabel(which); } QString DisplayForm::lineColor(int which) { - return _displayPlot->getLineColor(which).name(); + return d_display_plot->getLineColor(which).name(); } int DisplayForm::lineWidth(int which) { - return _displayPlot->getLineWidth(which); + return d_display_plot->getLineWidth(which); } Qt::PenStyle DisplayForm::lineStyle(int which) { - return _displayPlot->getLineStyle(which); + return d_display_plot->getLineStyle(which); } QwtSymbol::Style DisplayForm::lineMarker(int which) { - return _displayPlot->getLineMarker(which); + return d_display_plot->getLineMarker(which); } int DisplayForm::markerAlpha(int which) { - return _displayPlot->getMarkerAlpha(which); + return d_display_plot->getMarkerAlpha(which); } void @@ -309,20 +309,20 @@ DisplayForm::setStop(bool on) { if(!on) { // will auto-detach if already attached. - _displayPlot->setStop(false); - _stop_state = false; + d_display_plot->setStop(false); + d_stop_state = false; } else { - _displayPlot->setStop(true); - _stop_state = true; + d_display_plot->setStop(true); + d_stop_state = true; } - _displayPlot->replot(); + d_display_plot->replot(); } void DisplayForm::setStop() { - if(_stop_state == false) + if(d_stop_state == false) setStop(true); else setStop(false); @@ -333,14 +333,14 @@ DisplayForm::setGrid(bool on) { if(on) { // will auto-detach if already attached. - _grid->attach(_displayPlot); - _grid_state = true; + d_grid->attach(d_display_plot); + d_grid_state = true; } else { - _grid->detach(); - _grid_state = false; + d_grid->detach(); + d_grid_state = false; } - _displayPlot->replot(); + d_display_plot->replot(); } void diff --git a/gr-qtgui/lib/freqdisplayform.cc b/gr-qtgui/lib/freqdisplayform.cc index 948d845895..46050d8149 100644 --- a/gr-qtgui/lib/freqdisplayform.cc +++ b/gr-qtgui/lib/freqdisplayform.cc @@ -28,24 +28,24 @@ FreqDisplayForm::FreqDisplayForm(int nplots, QWidget* parent) : DisplayForm(nplots, parent) { - _intValidator = new QIntValidator(this); - _intValidator->setBottom(0); + d_int_validator = new QIntValidator(this); + d_int_validator->setBottom(0); - _layout = new QGridLayout(this); - _displayPlot = new FrequencyDisplayPlot(nplots, this); - _layout->addWidget(_displayPlot, 0, 0); - setLayout(_layout); + d_layout = new QGridLayout(this); + d_display_plot = new FrequencyDisplayPlot(nplots, this); + d_layout->addWidget(d_display_plot, 0, 0); + setLayout(d_layout); - _numRealDataPoints = 1024; - _fftsize = 1024; - _fftavg = 1.0; + d_num_real_data_points = 1024; + d_fftsize = 1024; + d_fftavg = 1.0; FFTSizeMenu *sizemenu = new FFTSizeMenu(this); FFTAverageMenu *avgmenu = new FFTAverageMenu(this); FFTWindowMenu *winmenu = new FFTWindowMenu(this); - _menu->addMenu(sizemenu); - _menu->addMenu(avgmenu); - _menu->addMenu(winmenu); + d_menu->addMenu(sizemenu); + d_menu->addMenu(avgmenu); + d_menu->addMenu(winmenu); connect(sizemenu, SIGNAL(whichTrigger(int)), this, SLOT(setFFTSize(const int))); connect(avgmenu, SIGNAL(whichTrigger(float)), @@ -55,7 +55,7 @@ FreqDisplayForm::FreqDisplayForm(int nplots, QWidget* parent) Reset(); - connect(_displayPlot, SIGNAL(plotPointSelected(const QPointF)), + connect(d_display_plot, SIGNAL(plotPointSelected(const QPointF)), this, SLOT(onPlotPointSelected(const QPointF))); } @@ -64,13 +64,13 @@ FreqDisplayForm::~FreqDisplayForm() // Qt deletes children when parent is deleted // Don't worry about deleting Display Plots - they are deleted when parents are deleted - delete _intValidator; + delete d_int_validator; } FrequencyDisplayPlot* FreqDisplayForm::getPlot() { - return ((FrequencyDisplayPlot*)_displayPlot); + return ((FrequencyDisplayPlot*)d_display_plot); } void @@ -95,45 +95,45 @@ FreqDisplayForm::customEvent( QEvent * e) int FreqDisplayForm::getFFTSize() const { - return _fftsize; + return d_fftsize; } float FreqDisplayForm::getFFTAverage() const { - return _fftavg; + return d_fftavg; } gr::filter::firdes::win_type FreqDisplayForm::getFFTWindowType() const { - return _fftwintype; + return d_fftwintype; } void FreqDisplayForm::setSampleRate(const QString &samprate) { - setFrequencyRange(_center_freq, samprate.toDouble()); + setFrequencyRange(d_center_freq, samprate.toDouble()); } void FreqDisplayForm::setFFTSize(const int newsize) { - _fftsize = newsize; + d_fftsize = newsize; getPlot()->replot(); } void FreqDisplayForm::setFFTAverage(const float newavg) { - _fftavg = newavg; + d_fftavg = newavg; getPlot()->replot(); } void FreqDisplayForm::setFFTWindowType(const gr::filter::firdes::win_type newwin) { - _fftwintype = newwin; + d_fftwintype = newwin; getPlot()->replot(); } @@ -147,8 +147,8 @@ FreqDisplayForm::setFrequencyRange(const double centerfreq, double units = pow(10, (units10-fmod(units10, 3.0))); int iunit = static_cast<int>(units3); - _center_freq = centerfreq; - _samp_rate = bandwidth; + d_center_freq = centerfreq; + d_samp_rate = bandwidth; getPlot()->setFrequencyRange(centerfreq, bandwidth, units, strunits[iunit]); @@ -164,12 +164,12 @@ void FreqDisplayForm::autoScale(bool en) { if(en) { - _autoscale_state = true; + d_autoscale_state = true; } else { - _autoscale_state = false; + d_autoscale_state = false; } - getPlot()->setAutoScale(_autoscale_state); + getPlot()->setAutoScale(d_autoscale_state); getPlot()->replot(); } diff --git a/gr-qtgui/lib/histogramdisplayform.cc b/gr-qtgui/lib/histogramdisplayform.cc index 22d0d67070..755992a873 100644 --- a/gr-qtgui/lib/histogramdisplayform.cc +++ b/gr-qtgui/lib/histogramdisplayform.cc @@ -31,63 +31,63 @@ HistogramDisplayForm::HistogramDisplayForm(int nplots, QWidget* parent) d_semilogx = false; d_semilogy = false; - _intValidator = new QIntValidator(this); - _intValidator->setBottom(0); + d_int_validator = new QIntValidator(this); + d_int_validator->setBottom(0); - _layout = new QGridLayout(this); - _displayPlot = new HistogramDisplayPlot(nplots, this); - _layout->addWidget(_displayPlot, 0, 0); - setLayout(_layout); + d_layout = new QGridLayout(this); + d_display_plot = new HistogramDisplayPlot(nplots, this); + d_layout->addWidget(d_display_plot, 0, 0); + setLayout(d_layout); d_nptsmenu = new NPointsMenu(this); - _menu->addAction(d_nptsmenu); + d_menu->addAction(d_nptsmenu); connect(d_nptsmenu, SIGNAL(whichTrigger(int)), this, SLOT(setNPoints(const int))); d_nbinsmenu = new NPointsMenu(this); d_nbinsmenu->setText("Number of Bins"); - _menu->addAction(d_nbinsmenu); + d_menu->addAction(d_nbinsmenu); connect(d_nbinsmenu, SIGNAL(whichTrigger(int)), this, SLOT(setNumBins(const int))); QAction *accummenu = new QAction("Accumulate", this); accummenu->setCheckable(true); - _menu->addAction(accummenu); + d_menu->addAction(accummenu); connect(accummenu, SIGNAL(triggered(bool)), this, SLOT(setAccumulate(bool))); - _menu->removeAction(_autoscale_act); - _autoscale_act->setText(tr("Auto Scale Y")); - _autoscale_act->setStatusTip(tr("Autoscale Y-axis")); - _autoscale_act->setCheckable(true); - _autoscale_act->setChecked(true); - _autoscale_state = true; - _menu->addAction(_autoscale_act); - - _autoscalex_act = new QAction("Auto Scale X", this); - _autoscalex_act->setStatusTip(tr("Update X-axis scale")); - _autoscalex_act->setCheckable(false); - connect(_autoscalex_act, SIGNAL(changed()), + d_menu->removeAction(d_autoscale_act); + d_autoscale_act->setText(tr("Auto Scale Y")); + d_autoscale_act->setStatusTip(tr("Autoscale Y-axis")); + d_autoscale_act->setCheckable(true); + d_autoscale_act->setChecked(true); + d_autoscale_state = true; + d_menu->addAction(d_autoscale_act); + + d_autoscalex_act = new QAction("Auto Scale X", this); + d_autoscalex_act->setStatusTip(tr("Update X-axis scale")); + d_autoscalex_act->setCheckable(false); + connect(d_autoscalex_act, SIGNAL(changed()), this, SLOT(autoScaleX())); - _autoscalex_state = false; - _menu->addAction(_autoscalex_act); + d_autoscalex_state = false; + d_menu->addAction(d_autoscalex_act); // d_semilogxmenu = new QAction("Semilog X", this); // d_semilogxmenu->setCheckable(true); -// _menu->addAction(d_semilogxmenu); +// d_menu->addAction(d_semilogxmenu); // connect(d_semilogxmenu, SIGNAL(triggered(bool)), // this, SLOT(setSemilogx(bool))); // // d_semilogymenu = new QAction("Semilog Y", this); // d_semilogymenu->setCheckable(true); -// _menu->addAction(d_semilogymenu); +// d_menu->addAction(d_semilogymenu); // connect(d_semilogymenu, SIGNAL(triggered(bool)), // this, SLOT(setSemilogy(bool))); Reset(); - connect(_displayPlot, SIGNAL(plotPointSelected(const QPointF)), + connect(d_display_plot, SIGNAL(plotPointSelected(const QPointF)), this, SLOT(onPlotPointSelected(const QPointF))); } @@ -96,13 +96,13 @@ HistogramDisplayForm::~HistogramDisplayForm() // Qt deletes children when parent is deleted // Don't worry about deleting Display Plots - they are deleted when parents are deleted - delete _intValidator; + delete d_int_validator; } HistogramDisplayPlot* HistogramDisplayForm::getPlot() { - return ((HistogramDisplayPlot*)_displayPlot); + return ((HistogramDisplayPlot*)d_display_plot); } void @@ -153,9 +153,9 @@ HistogramDisplayForm::setNPoints(const int npoints) void HistogramDisplayForm::autoScale(bool en) { - _autoscale_state = en; - _autoscale_act->setChecked(en); - getPlot()->setAutoScale(_autoscale_state); + d_autoscale_state = en; + d_autoscale_act->setChecked(en); + getPlot()->setAutoScale(d_autoscale_state); getPlot()->replot(); } diff --git a/gr-qtgui/lib/timedisplayform.cc b/gr-qtgui/lib/timedisplayform.cc index 8bd916d4f4..f6669465e3 100644 --- a/gr-qtgui/lib/timedisplayform.cc +++ b/gr-qtgui/lib/timedisplayform.cc @@ -32,44 +32,44 @@ TimeDisplayForm::TimeDisplayForm(int nplots, QWidget* parent) d_semilogx = false; d_semilogy = false; - _intValidator = new QIntValidator(this); - _intValidator->setBottom(0); + d_int_validator = new QIntValidator(this); + d_int_validator->setBottom(0); - _layout = new QGridLayout(this); - _displayPlot = new TimeDomainDisplayPlot(nplots, this); - _layout->addWidget(_displayPlot, 0, 0); - setLayout(_layout); + d_layout = new QGridLayout(this); + d_display_plot = new TimeDomainDisplayPlot(nplots, this); + d_layout->addWidget(d_display_plot, 0, 0); + setLayout(d_layout); d_nptsmenu = new NPointsMenu(this); - _menu->addAction(d_nptsmenu); + d_menu->addAction(d_nptsmenu); connect(d_nptsmenu, SIGNAL(whichTrigger(int)), this, SLOT(setNPoints(const int))); d_stemmenu = new QAction("Stem Plot", this); d_stemmenu->setCheckable(true); - _menu->addAction(d_stemmenu); + d_menu->addAction(d_stemmenu); connect(d_stemmenu, SIGNAL(triggered(bool)), this, SLOT(setStem(bool))); d_semilogxmenu = new QAction("Semilog X", this); d_semilogxmenu->setCheckable(true); - _menu->addAction(d_semilogxmenu); + d_menu->addAction(d_semilogxmenu); connect(d_semilogxmenu, SIGNAL(triggered(bool)), this, SLOT(setSemilogx(bool))); d_semilogymenu = new QAction("Semilog Y", this); d_semilogymenu->setCheckable(true); - _menu->addAction(d_semilogymenu); + d_menu->addAction(d_semilogymenu); connect(d_semilogymenu, SIGNAL(triggered(bool)), this, SLOT(setSemilogy(bool))); - for(int i = 0; i < _nplots; i++) { + for(int i = 0; i < d_nplots; i++) { d_tagsmenu.push_back(new QAction("Show Tag Makers", this)); d_tagsmenu[i]->setCheckable(true); d_tagsmenu[i]->setChecked(true); connect(d_tagsmenu[i], SIGNAL(triggered(bool)), this, SLOT(tagMenuSlot(bool))); - _lines_menu[i]->addAction(d_tagsmenu[i]); + d_lines_menu[i]->addAction(d_tagsmenu[i]); } // Set up the trigger menu @@ -86,7 +86,7 @@ TimeDisplayForm::TimeDisplayForm(int nplots, QWidget* parent) d_triggermenu->addAction(d_tr_delay_act); d_triggermenu->addMenu(d_tr_channel_menu); d_triggermenu->addAction(d_tr_tag_key_act); - _menu->addMenu(d_triggermenu); + d_menu->addMenu(d_triggermenu); setTriggerMode(gr::qtgui::TRIG_MODE_FREE); connect(d_tr_mode_menu, SIGNAL(whichTrigger(gr::qtgui::trigger_mode)), @@ -117,7 +117,7 @@ TimeDisplayForm::TimeDisplayForm(int nplots, QWidget* parent) Reset(); - connect(_displayPlot, SIGNAL(plotPointSelected(const QPointF)), + connect(d_display_plot, SIGNAL(plotPointSelected(const QPointF)), this, SLOT(onPlotPointSelected(const QPointF))); } @@ -126,13 +126,13 @@ TimeDisplayForm::~TimeDisplayForm() // Qt deletes children when parent is deleted // Don't worry about deleting Display Plots - they are deleted when parents are deleted - delete _intValidator; + delete d_int_validator; } TimeDomainDisplayPlot* TimeDisplayForm::getPlot() { - return ((TimeDomainDisplayPlot*)_displayPlot); + return ((TimeDomainDisplayPlot*)d_display_plot); } void @@ -211,9 +211,9 @@ TimeDisplayForm::setStem(bool en) void TimeDisplayForm::autoScale(bool en) { - _autoscale_state = en; - _autoscale_act->setChecked(en); - getPlot()->setAutoScale(_autoscale_state); + d_autoscale_state = en; + d_autoscale_act->setChecked(en); + getPlot()->setAutoScale(d_autoscale_state); getPlot()->replot(); } diff --git a/gr-qtgui/lib/timerasterdisplayform.cc b/gr-qtgui/lib/timerasterdisplayform.cc index e6f341875d..0121e2f544 100644 --- a/gr-qtgui/lib/timerasterdisplayform.cc +++ b/gr-qtgui/lib/timerasterdisplayform.cc @@ -39,50 +39,50 @@ TimeRasterDisplayForm::TimeRasterDisplayForm(int nplots, << std::endl << std::endl; #endif - _layout = new QGridLayout(this); - _displayPlot = new TimeRasterDisplayPlot(nplots, samp_rate, rows, cols, this); - _layout->addWidget(_displayPlot, 0, 0); - setLayout(_layout); + d_layout = new QGridLayout(this); + d_display_plot = new TimeRasterDisplayPlot(nplots, samp_rate, rows, cols, this); + d_layout->addWidget(d_display_plot, 0, 0); + setLayout(d_layout); - _min_val = 10; - _max_val = -10; + d_min_val = 10; + d_max_val = -10; // We don't use the normal menus that are part of the displayform. // Clear them out to get rid of their resources. for(int i = 0; i < nplots; i++) { - _lines_menu[i]->clear(); + d_lines_menu[i]->clear(); } - _line_title_act.clear(); - _line_color_menu.clear(); - _line_width_menu.clear(); - _line_style_menu.clear(); - _line_marker_menu.clear(); - _marker_alpha_menu.clear(); + d_line_title_act.clear(); + d_line_color_menu.clear(); + d_line_width_menu.clear(); + d_line_style_menu.clear(); + d_line_marker_menu.clear(); + d_marker_alpha_menu.clear(); // Now create our own menus for(int i = 0; i < nplots; i++) { ColorMapMenu *colormap = new ColorMapMenu(i, this); connect(colormap, SIGNAL(whichTrigger(int, const int, const QColor&, const QColor&)), this, SLOT(setColorMap(int, const int, const QColor&, const QColor&))); - _lines_menu[i]->addMenu(colormap); + d_lines_menu[i]->addMenu(colormap); - _marker_alpha_menu.push_back(new MarkerAlphaMenu(i, this)); - connect(_marker_alpha_menu[i], SIGNAL(whichTrigger(int, int)), + d_marker_alpha_menu.push_back(new MarkerAlphaMenu(i, this)); + connect(d_marker_alpha_menu[i], SIGNAL(whichTrigger(int, int)), this, SLOT(setAlpha(int, int))); - _lines_menu[i]->addMenu(_marker_alpha_menu[i]); + d_lines_menu[i]->addMenu(d_marker_alpha_menu[i]); } // One scales once when clicked, so no on/off toggling - _autoscale_act->setText(tr("Auto Scale")); - _autoscale_act->setCheckable(false); + d_autoscale_act->setText(tr("Auto Scale")); + d_autoscale_act->setCheckable(false); PopupMenu *colsmenu = new PopupMenu("Num. Columns", this); - _menu->addAction(colsmenu); + d_menu->addAction(colsmenu); connect(colsmenu, SIGNAL(whichTrigger(QString)), this, SLOT(setNumCols(QString))); PopupMenu *rowsmenu = new PopupMenu("Num. Rows", this); - _menu->addAction(rowsmenu); + d_menu->addAction(rowsmenu); connect(rowsmenu, SIGNAL(whichTrigger(QString)), this, SLOT(setNumRows(QString))); @@ -90,7 +90,7 @@ TimeRasterDisplayForm::TimeRasterDisplayForm(int nplots, Reset(); - connect(_displayPlot, SIGNAL(plotPointSelected(const QPointF)), + connect(d_display_plot, SIGNAL(plotPointSelected(const QPointF)), this, SLOT(onPlotPointSelected(const QPointF))); } @@ -103,7 +103,7 @@ TimeRasterDisplayForm::~TimeRasterDisplayForm() TimeRasterDisplayPlot* TimeRasterDisplayForm::getPlot() { - return ((TimeRasterDisplayPlot*)_displayPlot); + return ((TimeRasterDisplayPlot*)d_display_plot); } double @@ -150,15 +150,15 @@ TimeRasterDisplayForm::newData(const QEvent *updateEvent) const std::vector<double*> dataPoints = event->getPoints(); const uint64_t numDataPoints = event->getNumDataPoints(); - _min_val = 10; - _max_val = -10; + d_min_val = 10; + d_max_val = -10; for(size_t i=0; i < dataPoints.size(); i++) { double *min_val = std::min_element(&dataPoints[i][0], &dataPoints[i][numDataPoints-1]); double *max_val = std::max_element(&dataPoints[i][0], &dataPoints[i][numDataPoints-1]); - if(*min_val < _min_val) - _min_val = *min_val; - if(*max_val > _max_val) - _max_val = *max_val; + if(*min_val < d_min_val) + d_min_val = *min_val; + if(*max_val > d_max_val) + d_max_val = *max_val; } getPlot()->plotNewData(dataPoints, numDataPoints); @@ -243,8 +243,8 @@ TimeRasterDisplayForm::setIntensityRange(const double minIntensity, void TimeRasterDisplayForm::autoScale(bool en) { - double min_int = _min_val; - double max_int = _max_val; + double min_int = d_min_val; + double max_int = d_max_val; getPlot()->setIntensityRange(min_int, max_int); getPlot()->replot(); diff --git a/gr-qtgui/lib/waterfalldisplayform.cc b/gr-qtgui/lib/waterfalldisplayform.cc index c80168e671..4b8e042658 100644 --- a/gr-qtgui/lib/waterfalldisplayform.cc +++ b/gr-qtgui/lib/waterfalldisplayform.cc @@ -29,59 +29,58 @@ WaterfallDisplayForm::WaterfallDisplayForm(int nplots, QWidget* parent) : DisplayForm(nplots, parent) { - _intValidator = new QIntValidator(this); - _intValidator->setBottom(0); + d_int_validator = new QIntValidator(this); + d_int_validator->setBottom(0); - _layout = new QGridLayout(this); - _displayPlot = new WaterfallDisplayPlot(nplots, this); - _layout->addWidget(_displayPlot, 0, 0); - setLayout(_layout); + d_layout = new QGridLayout(this); + d_display_plot = new WaterfallDisplayPlot(nplots, this); + d_layout->addWidget(d_display_plot, 0, 0); + setLayout(d_layout); - _center_freq = 0; - _samp_rate = 0; + d_center_freq = 0; + d_samp_rate = 0; - _numRealDataPoints = 1024; - _fftsize = 1024; - _fftavg = 1.0; + d_fftsize = 1024; + d_fftavg = 1.0; - _min_val = 1000; - _max_val = -1000; + d_min_val = 1000; + d_max_val = -1000; // We don't use the normal menus that are part of the displayform. // Clear them out to get rid of their resources. for(int i = 0; i < nplots; i++) { - _lines_menu[i]->clear(); + d_lines_menu[i]->clear(); } - _line_title_act.clear(); - _line_color_menu.clear(); - _line_width_menu.clear(); - _line_style_menu.clear(); - _line_marker_menu.clear(); - _marker_alpha_menu.clear(); + d_line_title_act.clear(); + d_line_color_menu.clear(); + d_line_width_menu.clear(); + d_line_style_menu.clear(); + d_line_marker_menu.clear(); + d_marker_alpha_menu.clear(); // Now create our own menus for(int i = 0; i < nplots; i++) { ColorMapMenu *colormap = new ColorMapMenu(i, this); connect(colormap, SIGNAL(whichTrigger(int, const int, const QColor&, const QColor&)), this, SLOT(setColorMap(int, const int, const QColor&, const QColor&))); - _lines_menu[i]->addMenu(colormap); + d_lines_menu[i]->addMenu(colormap); - _marker_alpha_menu.push_back(new MarkerAlphaMenu(i, this)); - connect(_marker_alpha_menu[i], SIGNAL(whichTrigger(int, int)), + d_marker_alpha_menu.push_back(new MarkerAlphaMenu(i, this)); + connect(d_marker_alpha_menu[i], SIGNAL(whichTrigger(int, int)), this, SLOT(setAlpha(int, int))); - _lines_menu[i]->addMenu(_marker_alpha_menu[i]); + d_lines_menu[i]->addMenu(d_marker_alpha_menu[i]); } // One scales once when clicked, so no on/off toggling - _autoscale_act->setText(tr("Auto Scale")); - _autoscale_act->setCheckable(false); + d_autoscale_act->setText(tr("Auto Scale")); + d_autoscale_act->setCheckable(false); FFTSizeMenu *sizemenu = new FFTSizeMenu(this); FFTAverageMenu *avgmenu = new FFTAverageMenu(this); FFTWindowMenu *winmenu = new FFTWindowMenu(this); - _menu->addMenu(sizemenu); - _menu->addMenu(avgmenu); - _menu->addMenu(winmenu); + d_menu->addMenu(sizemenu); + d_menu->addMenu(avgmenu); + d_menu->addMenu(winmenu); connect(sizemenu, SIGNAL(whichTrigger(int)), this, SLOT(setFFTSize(const int))); connect(avgmenu, SIGNAL(whichTrigger(float)), @@ -91,7 +90,7 @@ WaterfallDisplayForm::WaterfallDisplayForm(int nplots, QWidget* parent) Reset(); - connect(_displayPlot, SIGNAL(plotPointSelected(const QPointF)), + connect(d_display_plot, SIGNAL(plotPointSelected(const QPointF)), this, SLOT(onPlotPointSelected(const QPointF))); } @@ -100,13 +99,13 @@ WaterfallDisplayForm::~WaterfallDisplayForm() // Qt deletes children when parent is deleted // Don't worry about deleting Display Plots - they are deleted when parents are deleted - delete _intValidator; + delete d_int_validator; } WaterfallDisplayPlot* WaterfallDisplayForm::getPlot() { - return ((WaterfallDisplayPlot*)_displayPlot); + return ((WaterfallDisplayPlot*)d_display_plot); } void @@ -117,15 +116,15 @@ WaterfallDisplayForm::newData(const QEvent *updateEvent) const uint64_t numDataPoints = event->getNumDataPoints(); const gr::high_res_timer_type dataTimestamp = event->getDataTimestamp(); - _min_val = 1000; - _max_val = -1000; + d_min_val = 1000; + d_max_val = -1000; for(size_t i=0; i < dataPoints.size(); i++) { double *min_val = std::min_element(&dataPoints[i][0], &dataPoints[i][numDataPoints-1]); double *max_val = std::max_element(&dataPoints[i][0], &dataPoints[i][numDataPoints-1]); - if(*min_val < _min_val) - _min_val = *min_val; - if(*max_val > _max_val) - _max_val = *max_val; + if(*min_val < d_min_val) + d_min_val = *min_val; + if(*max_val > d_max_val) + d_max_val = *max_val; } getPlot()->plotNewData(dataPoints, numDataPoints, d_update_time, dataTimestamp, 0); @@ -142,19 +141,19 @@ WaterfallDisplayForm::customEvent( QEvent * e) int WaterfallDisplayForm::getFFTSize() const { - return _fftsize; + return d_fftsize; } float WaterfallDisplayForm::getFFTAverage() const { - return _fftavg; + return d_fftavg; } gr::filter::firdes::win_type WaterfallDisplayForm::getFFTWindowType() const { - return _fftwintype; + return d_fftwintype; } int @@ -184,25 +183,25 @@ WaterfallDisplayForm::getMaxIntensity(int which) void WaterfallDisplayForm::setSampleRate(const QString &samprate) { - setFrequencyRange(_center_freq, samprate.toDouble()); + setFrequencyRange(d_center_freq, samprate.toDouble()); } void WaterfallDisplayForm::setFFTSize(const int newsize) { - _fftsize = newsize; + d_fftsize = newsize; } void WaterfallDisplayForm::setFFTAverage(const float newavg) { - _fftavg = newavg; + d_fftavg = newavg; } void WaterfallDisplayForm::setFFTWindowType(const gr::filter::firdes::win_type newwin) { - _fftwintype = newwin; + d_fftwintype = newwin; } void @@ -215,8 +214,8 @@ WaterfallDisplayForm::setFrequencyRange(const double centerfreq, double units = pow(10, (units10-fmod(units10, 3.0))); int iunit = static_cast<int>(units3); - _center_freq = centerfreq; - _samp_rate = bandwidth; + d_center_freq = centerfreq; + d_samp_rate = bandwidth; getPlot()->setFrequencyRange(centerfreq, bandwidth, units, strunits[iunit]); @@ -252,8 +251,8 @@ WaterfallDisplayForm::setIntensityRange(const double minIntensity, void WaterfallDisplayForm::autoScale(bool en) { - double min_int = _min_val - 5; - double max_int = _max_val + 10; + double min_int = d_min_val - 5; + double max_int = d_max_val + 10; getPlot()->setIntensityRange(min_int, max_int); getPlot()->replot(); |