[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 11/23: qtgui: for sink_x, waterfall_sink_x,
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 11/23: qtgui: for sink_x, waterfall_sink_x, and freq_sink_x, when the display is double-clicked, the center frequency is adjusted to the clicked frequency and a message is posted containing the new center frequency. |
Date: |
Thu, 26 Jun 2014 19:54:44 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
trondeau pushed a commit to branch master
in repository gnuradio.
commit 8cf4334a96288f4f24b3369d44146da21b9e0375
Author: Tom Rondeau <address@hidden>
Date: Wed Jun 25 18:18:08 2014 -0400
qtgui: for sink_x, waterfall_sink_x, and freq_sink_x, when the display is
double-clicked, the center frequency is adjusted to the clicked frequency and a
message is posted containing the new center frequency.
Should be able to connect this to a radio message port input that will
adjust the frequency of the device itself.
---
gr-qtgui/grc/qtgui_freq_sink_x.xml | 7 ++++
gr-qtgui/grc/qtgui_sink_x.xml | 12 +++++--
gr-qtgui/grc/qtgui_waterfall_sink_x.xml | 7 ++++
gr-qtgui/include/gnuradio/qtgui/SpectrumGUIClass.h | 3 ++
gr-qtgui/include/gnuradio/qtgui/displayform.h | 2 +-
gr-qtgui/include/gnuradio/qtgui/freqdisplayform.h | 11 ++++++
.../include/gnuradio/qtgui/spectrumdisplayform.h | 10 ++++++
.../include/gnuradio/qtgui/waterfalldisplayform.h | 11 ++++++
gr-qtgui/lib/SpectrumGUIClass.cc | 13 +++++++
gr-qtgui/lib/freq_sink_c_impl.cc | 14 ++++++++
gr-qtgui/lib/freq_sink_c_impl.h | 1 +
gr-qtgui/lib/freq_sink_f_impl.cc | 14 ++++++++
gr-qtgui/lib/freq_sink_f_impl.h | 1 +
gr-qtgui/lib/freqdisplayform.cc | 33 ++++++++++++++++--
gr-qtgui/lib/sink_c_impl.cc | 15 +++++++-
gr-qtgui/lib/sink_c_impl.h | 1 +
gr-qtgui/lib/sink_f_impl.cc | 14 ++++++++
gr-qtgui/lib/sink_f_impl.h | 1 +
gr-qtgui/lib/spectrumdisplayform.cc | 40 +++++++++++++++++-----
gr-qtgui/lib/waterfall_sink_c_impl.cc | 14 ++++++++
gr-qtgui/lib/waterfall_sink_c_impl.h | 1 +
gr-qtgui/lib/waterfall_sink_f_impl.cc | 14 ++++++++
gr-qtgui/lib/waterfall_sink_f_impl.h | 1 +
gr-qtgui/lib/waterfalldisplayform.cc | 31 +++++++++++++++--
24 files changed, 255 insertions(+), 16 deletions(-)
diff --git a/gr-qtgui/grc/qtgui_freq_sink_x.xml
b/gr-qtgui/grc/qtgui_freq_sink_x.xml
index 761943e..b8bbbe1 100644
--- a/gr-qtgui/grc/qtgui_freq_sink_x.xml
+++ b/gr-qtgui/grc/qtgui_freq_sink_x.xml
@@ -550,6 +550,13 @@ $(gui_hint()($win))</make>
<type>$type</type>
<nports>$nconnections</nports>
</sink>
+
+ <source>
+ <name>freq</name>
+ <type>message</type>
+ <optional>1</optional>
+ </source>
+
<doc>
The GUI hint can be used to position the widget within the application. \
The hint is of the form address@hidden: [row, col, row_span, col_span]. \
diff --git a/gr-qtgui/grc/qtgui_sink_x.xml b/gr-qtgui/grc/qtgui_sink_x.xml
index ea14947..c41468d 100644
--- a/gr-qtgui/grc/qtgui_sink_x.xml
+++ b/gr-qtgui/grc/qtgui_sink_x.xml
@@ -179,9 +179,17 @@ Qt.QObject.connect(self._$(id)_win,
Qt.SIGNAL("plotPointSelected(QPointF, int)")
<type>$type</type>
<nports>$num_inputs</nports>
</sink>
- <doc>
+
+
+ <source>
+ <name>freq</name>
+ <type>message</type>
+ <optional>1</optional>
+ </source>
+
+ <doc>
The GUI hint can be used to position the widget within the application. \
The hint is of the form address@hidden: [row, col, row_span, col_span]. \
Both the tab specification and the grid position are optional.
- </doc>
+ </doc>
</block>
diff --git a/gr-qtgui/grc/qtgui_waterfall_sink_x.xml
b/gr-qtgui/grc/qtgui_waterfall_sink_x.xml
index fcd8d97..c340313 100644
--- a/gr-qtgui/grc/qtgui_waterfall_sink_x.xml
+++ b/gr-qtgui/grc/qtgui_waterfall_sink_x.xml
@@ -392,6 +392,13 @@ $(gui_hint()($win))</make>
<type>$type</type>
<nports>$nconnections</nports>
</sink>
+
+ <source>
+ <name>freq</name>
+ <type>message</type>
+ <optional>1</optional>
+ </source>
+
<doc>
The GUI hint can be used to position the widget within the application. \
The hint is of the form address@hidden: [row, col, row_span, col_span]. \
diff --git a/gr-qtgui/include/gnuradio/qtgui/SpectrumGUIClass.h
b/gr-qtgui/include/gnuradio/qtgui/SpectrumGUIClass.h
index 68a7201..2fb7044 100644
--- a/gr-qtgui/include/gnuradio/qtgui/SpectrumGUIClass.h
+++ b/gr-qtgui/include/gnuradio/qtgui/SpectrumGUIClass.h
@@ -105,6 +105,9 @@ public:
void enableRFFreq(bool en);
+ bool checkClicked();
+ float getClickedFreq();
+
protected:
private:
diff --git a/gr-qtgui/include/gnuradio/qtgui/displayform.h
b/gr-qtgui/include/gnuradio/qtgui/displayform.h
index c4a9cf7..42c8e40 100644
--- a/gr-qtgui/include/gnuradio/qtgui/displayform.h
+++ b/gr-qtgui/include/gnuradio/qtgui/displayform.h
@@ -91,7 +91,7 @@ private slots:
virtual void autoScale(bool) = 0;
void updateGuiTimer();
- void onPlotPointSelected(const QPointF p);
+ virtual void onPlotPointSelected(const QPointF p);
signals:
void plotPointSelected(const QPointF p, int type);
diff --git a/gr-qtgui/include/gnuradio/qtgui/freqdisplayform.h
b/gr-qtgui/include/gnuradio/qtgui/freqdisplayform.h
index 95e6337..1fa57c1 100644
--- a/gr-qtgui/include/gnuradio/qtgui/freqdisplayform.h
+++ b/gr-qtgui/include/gnuradio/qtgui/freqdisplayform.h
@@ -49,6 +49,12 @@ class FreqDisplayForm : public DisplayForm
float getFFTAverage() const;
gr::filter::firdes::win_type getFFTWindowType() const;
+ // returns the frequency that was last double-clicked on by the user
+ float getClickedFreq() const;
+
+ // checks if there was a double-click event; reset if there was
+ bool checkClicked();
+
public slots:
void customEvent(QEvent *e);
@@ -64,6 +70,7 @@ public slots:
private slots:
void newData(const QEvent *updateEvent);
+ void onPlotPointSelected(const QPointF p);
private:
uint64_t d_num_real_data_points;
@@ -73,6 +80,10 @@ private:
int d_fftsize;
float d_fftavg;
gr::filter::firdes::win_type d_fftwintype;
+ double d_units;
+
+ bool d_clicked;
+ double d_clicked_freq;
FFTSizeMenu *d_sizemenu;
FFTAverageMenu *d_avgmenu;
diff --git a/gr-qtgui/include/gnuradio/qtgui/spectrumdisplayform.h
b/gr-qtgui/include/gnuradio/qtgui/spectrumdisplayform.h
index 50cbc58..7c71254 100644
--- a/gr-qtgui/include/gnuradio/qtgui/spectrumdisplayform.h
+++ b/gr-qtgui/include/gnuradio/qtgui/spectrumdisplayform.h
@@ -55,6 +55,12 @@ class SpectrumDisplayForm : public QWidget, public
Ui::SpectrumDisplayForm
void resizeBuffers(const uint64_t numFFTDataPoints,
const uint64_t numTimeDomainDataPoints);
+ // returns the frequency that was last double-clicked on by the user
+ float getClickedFreq() const;
+
+ // checks if there was a double-click event; reset if there was
+ bool checkClicked();
+
public slots:
void resizeEvent(QResizeEvent * e);
void customEvent(QEvent * e);
@@ -125,6 +131,10 @@ private:
double _peakAmplitude;
double _stopFrequency;
+ double d_units;
+ bool d_clicked;
+ double d_clicked_freq;
+
//SpectrumUpdateEvent _lastSpectrumEvent;
// whether or not to use a particular display
diff --git a/gr-qtgui/include/gnuradio/qtgui/waterfalldisplayform.h
b/gr-qtgui/include/gnuradio/qtgui/waterfalldisplayform.h
index 1ac1cf4..5af2680 100644
--- a/gr-qtgui/include/gnuradio/qtgui/waterfalldisplayform.h
+++ b/gr-qtgui/include/gnuradio/qtgui/waterfalldisplayform.h
@@ -56,6 +56,12 @@ class WaterfallDisplayForm : public DisplayForm
void clearData();
+ // returns the frequency that was last double-clicked on by the user
+ float getClickedFreq() const;
+
+ // checks if there was a double-click event; reset if there was
+ bool checkClicked();
+
public slots:
void customEvent(QEvent *e);
@@ -81,6 +87,7 @@ public slots:
private slots:
void newData(const QEvent *updateEvent);
+ void onPlotPointSelected(const QPointF p);
private:
QIntValidator* d_int_validator;
@@ -89,6 +96,10 @@ private:
int d_fftsize;
float d_fftavg;
gr::filter::firdes::win_type d_fftwintype;
+ double d_units;
+
+ bool d_clicked;
+ double d_clicked_freq;
double d_min_val;
double d_max_val;
diff --git a/gr-qtgui/lib/SpectrumGUIClass.cc b/gr-qtgui/lib/SpectrumGUIClass.cc
index b7c5883..98feec5 100644
--- a/gr-qtgui/lib/SpectrumGUIClass.cc
+++ b/gr-qtgui/lib/SpectrumGUIClass.cc
@@ -477,5 +477,18 @@ SpectrumGUIClass::enableRFFreq(bool en)
_spectrumDisplayForm->toggleRFFrequencies(en);
}
+bool
+SpectrumGUIClass::checkClicked()
+{
+ gr::thread::scoped_lock lock(d_mutex);
+ return _spectrumDisplayForm->checkClicked();
+}
+
+float
+SpectrumGUIClass::getClickedFreq()
+{
+ gr::thread::scoped_lock lock(d_mutex);
+ return _spectrumDisplayForm->getClickedFreq();
+}
#endif /* SPECTRUM_GUI_CLASS_CPP */
diff --git a/gr-qtgui/lib/freq_sink_c_impl.cc b/gr-qtgui/lib/freq_sink_c_impl.cc
index ff40ff3..da8a750 100644
--- a/gr-qtgui/lib/freq_sink_c_impl.cc
+++ b/gr-qtgui/lib/freq_sink_c_impl.cc
@@ -69,6 +69,10 @@ namespace gr {
d_argv = new char;
d_argv[0] = '\0';
+ // setup output message port to post frequency when display is
+ // double-clicked
+ message_port_register_out(pmt::mp("freq"));
+
d_main_gui = NULL;
// Perform fftshift operation;
@@ -444,6 +448,15 @@ namespace gr {
}
}
+ void
+ freq_sink_c_impl::check_clicked()
+ {
+ if(d_main_gui->checkClicked()) {
+ d_center_freq = d_main_gui->getClickedFreq();
+ message_port_pub(pmt::mp("freq"), pmt::from_double(d_center_freq));
+ }
+ }
+
int
freq_sink_c_impl::work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -455,6 +468,7 @@ namespace gr {
// Update the FFT size from the application
fftresize();
windowreset();
+ check_clicked();
for(int i=0; i < noutput_items; i+=d_fftsize) {
unsigned int datasize = noutput_items - i;
diff --git a/gr-qtgui/lib/freq_sink_c_impl.h b/gr-qtgui/lib/freq_sink_c_impl.h
index 15b5137..8cc5438 100644
--- a/gr-qtgui/lib/freq_sink_c_impl.h
+++ b/gr-qtgui/lib/freq_sink_c_impl.h
@@ -70,6 +70,7 @@ namespace gr {
void windowreset();
void buildwindow();
void fftresize();
+ void check_clicked();
void fft(float *data_out, const gr_complex *data_in, int size);
public:
diff --git a/gr-qtgui/lib/freq_sink_f_impl.cc b/gr-qtgui/lib/freq_sink_f_impl.cc
index b661f7b..0b564d5 100644
--- a/gr-qtgui/lib/freq_sink_f_impl.cc
+++ b/gr-qtgui/lib/freq_sink_f_impl.cc
@@ -69,6 +69,10 @@ namespace gr {
d_argv = new char;
d_argv[0] = '\0';
+ // setup output message port to post frequency when display is
+ // double-clicked
+ message_port_register_out(pmt::mp("freq"));
+
d_main_gui = NULL;
// Perform fftshift operation;
@@ -447,6 +451,15 @@ namespace gr {
}
}
+ void
+ freq_sink_f_impl::check_clicked()
+ {
+ if(d_main_gui->checkClicked()) {
+ d_center_freq = d_main_gui->getClickedFreq();
+ message_port_pub(pmt::mp("freq"), pmt::from_double(d_center_freq));
+ }
+ }
+
int
freq_sink_f_impl::work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -458,6 +471,7 @@ namespace gr {
// Update the FFT size from the application
fftresize();
windowreset();
+ check_clicked();
for(int i=0; i < noutput_items; i+=d_fftsize) {
unsigned int datasize = noutput_items - i;
diff --git a/gr-qtgui/lib/freq_sink_f_impl.h b/gr-qtgui/lib/freq_sink_f_impl.h
index 68cb8c6..e0fdcf9 100644
--- a/gr-qtgui/lib/freq_sink_f_impl.h
+++ b/gr-qtgui/lib/freq_sink_f_impl.h
@@ -70,6 +70,7 @@ namespace gr {
void windowreset();
void buildwindow();
void fftresize();
+ void check_clicked();
void fft(float *data_out, const float *data_in, int size);
public:
diff --git a/gr-qtgui/lib/freqdisplayform.cc b/gr-qtgui/lib/freqdisplayform.cc
index 16576b3..6d2f9b9 100644
--- a/gr-qtgui/lib/freqdisplayform.cc
+++ b/gr-qtgui/lib/freqdisplayform.cc
@@ -39,6 +39,8 @@ FreqDisplayForm::FreqDisplayForm(int nplots, QWidget* parent)
d_num_real_data_points = 1024;
d_fftsize = 1024;
d_fftavg = 1.0;
+ d_clicked = false;
+ d_clicked_freq = 0;
d_sizemenu = new FFTSizeMenu(this);
d_avgmenu = new FFTAverageMenu(this);
@@ -147,14 +149,14 @@ FreqDisplayForm::setFrequencyRange(const double
centerfreq,
std::string strunits[4] = {"Hz", "kHz", "MHz", "GHz"};
double units10 = floor(log10(bandwidth));
double units3 = std::max(floor(units10 / 3.0), 0.0);
- double units = pow(10, (units10-fmod(units10, 3.0)));
+ d_units = pow(10, (units10-fmod(units10, 3.0)));
int iunit = static_cast<int>(units3);
d_center_freq = centerfreq;
d_samp_rate = bandwidth;
getPlot()->setFrequencyRange(centerfreq, bandwidth,
- units, strunits[iunit]);
+ d_units, strunits[iunit]);
}
void
@@ -177,3 +179,30 @@ FreqDisplayForm::autoScale(bool en)
getPlot()->setAutoScale(d_autoscale_state);
getPlot()->replot();
}
+
+void
+FreqDisplayForm::onPlotPointSelected(const QPointF p)
+{
+ d_clicked = true;
+ d_clicked_freq = d_units*p.x();
+
+ setFrequencyRange(d_clicked_freq, d_samp_rate);
+}
+
+bool
+FreqDisplayForm::checkClicked()
+{
+ if(d_clicked) {
+ d_clicked = false;
+ return true;
+ }
+ else {
+ return false;
+ }
+}
+
+float
+FreqDisplayForm::getClickedFreq() const
+{
+ return d_clicked_freq;
+}
diff --git a/gr-qtgui/lib/sink_c_impl.cc b/gr-qtgui/lib/sink_c_impl.cc
index 5d1c33e..b73ab47 100644
--- a/gr-qtgui/lib/sink_c_impl.cc
+++ b/gr-qtgui/lib/sink_c_impl.cc
@@ -73,6 +73,10 @@ namespace gr {
d_argv = new char;
d_argv[0] = '\0';
+ // setup output message port to post frequency when display is
+ // double-clicked
+ message_port_register_out(pmt::mp("freq"));
+
d_main_gui = NULL;
// Perform fftshift operation;
@@ -221,7 +225,6 @@ namespace gr {
void
sink_c_impl::enable_rf_freq(bool en)
{
- std::cerr << "ENABLE RF: " << en << std::endl;
d_main_gui->enableRFFreq(en);
}
@@ -319,6 +322,15 @@ namespace gr {
}
}
+ void
+ sink_c_impl::check_clicked()
+ {
+ if(d_main_gui->checkClicked()) {
+ d_center_freq = d_main_gui->getClickedFreq();
+ message_port_pub(pmt::mp("freq"), pmt::from_double(d_center_freq));
+ }
+ }
+
int
sink_c_impl::general_work(int noutput_items,
gr_vector_int &ninput_items,
@@ -331,6 +343,7 @@ namespace gr {
// Update the FFT size from the application
fftresize();
windowreset();
+ check_clicked();
for(int i=0; i < noutput_items; i+=d_fftsize) {
unsigned int datasize = noutput_items - i;
diff --git a/gr-qtgui/lib/sink_c_impl.h b/gr-qtgui/lib/sink_c_impl.h
index d303c05..22b8b21 100644
--- a/gr-qtgui/lib/sink_c_impl.h
+++ b/gr-qtgui/lib/sink_c_impl.h
@@ -67,6 +67,7 @@ namespace gr {
void windowreset();
void buildwindow();
void fftresize();
+ void check_clicked();
void fft(float *data_out, const gr_complex *data_in, int size);
public:
diff --git a/gr-qtgui/lib/sink_f_impl.cc b/gr-qtgui/lib/sink_f_impl.cc
index 0a0e119..960acb3 100644
--- a/gr-qtgui/lib/sink_f_impl.cc
+++ b/gr-qtgui/lib/sink_f_impl.cc
@@ -73,6 +73,10 @@ namespace gr {
d_argv = new char;
d_argv[0] = '\0';
+ // setup output message port to post frequency when display is
+ // double-clicked
+ message_port_register_out(pmt::mp("freq"));
+
d_main_gui = NULL;
// Perform fftshift operation;
@@ -307,6 +311,15 @@ namespace gr {
}
}
+ void
+ sink_f_impl::check_clicked()
+ {
+ if(d_main_gui->checkClicked()) {
+ d_center_freq = d_main_gui->getClickedFreq();
+ message_port_pub(pmt::mp("freq"), pmt::from_double(d_center_freq));
+ }
+ }
+
int
sink_f_impl::general_work(int noutput_items,
gr_vector_int &ninput_items,
@@ -319,6 +332,7 @@ namespace gr {
// Update the FFT size from the application
fftresize();
windowreset();
+ check_clicked();
for(int i=0; i < noutput_items; i+=d_fftsize) {
unsigned int datasize = noutput_items - i;
diff --git a/gr-qtgui/lib/sink_f_impl.h b/gr-qtgui/lib/sink_f_impl.h
index 68331cc..a547da3 100644
--- a/gr-qtgui/lib/sink_f_impl.h
+++ b/gr-qtgui/lib/sink_f_impl.h
@@ -65,6 +65,7 @@ namespace gr {
void windowreset();
void buildwindow();
void fftresize();
+ void check_clicked();
void fft(float *data_out, const float *data_in, int size);
public:
diff --git a/gr-qtgui/lib/spectrumdisplayform.cc
b/gr-qtgui/lib/spectrumdisplayform.cc
index aaaae63..6dc38a2 100644
--- a/gr-qtgui/lib/spectrumdisplayform.cc
+++ b/gr-qtgui/lib/spectrumdisplayform.cc
@@ -426,7 +426,7 @@ SpectrumDisplayForm::setFrequencyRange(const double
newCenterFrequency,
std::string strtime[4] = {"sec", "ms", "us", "ns"};
double units10 = floor(log10(fdiff));
double units3 = std::max(floor(units10 / 3.0), 0.0);
- double units = pow(10, (units10-fmod(units10, 3.0)));
+ d_units = pow(10, (units10-fmod(units10, 3.0)));
int iunit = static_cast<int>(units3);
_startFrequency = newStartFrequency;
@@ -434,11 +434,11 @@ SpectrumDisplayForm::setFrequencyRange(const double
newCenterFrequency,
_centerFrequency = newCenterFrequency;
_frequencyDisplayPlot->setFrequencyRange(fcenter, fdiff,
- units, strunits[iunit]);
+ d_units, strunits[iunit]);
_waterfallDisplayPlot->setFrequencyRange(fcenter, fdiff,
- units, strunits[iunit]);
+ d_units, strunits[iunit]);
_timeDomainDisplayPlot->setSampleRate((_stopFrequency -
_startFrequency)/2.0,
- units, strtime[iunit]);
+ d_units, strtime[iunit]);
}
}
@@ -768,23 +768,47 @@ SpectrumDisplayForm::setUpdateTime(double t)
void
SpectrumDisplayForm::onFFTPlotPointSelected(const QPointF p)
{
- emit plotPointSelected(p, 1);
+ d_clicked = true;
+ d_clicked_freq = d_units*p.x();
+
+ setFrequencyRange(d_clicked_freq, _startFrequency, _stopFrequency);
}
void
SpectrumDisplayForm::onWFallPlotPointSelected(const QPointF p)
{
- emit plotPointSelected(p, 2);
+ d_clicked = true;
+ d_clicked_freq = d_units*p.x();
+
+ setFrequencyRange(d_clicked_freq, _startFrequency, _stopFrequency);
}
void
SpectrumDisplayForm::onTimePlotPointSelected(const QPointF p)
{
- emit plotPointSelected(p, 3);
+ //emit plotPointSelected(p, 3);
}
void
SpectrumDisplayForm::onConstPlotPointSelected(const QPointF p)
{
- emit plotPointSelected(p, 4);
+ //emit plotPointSelected(p, 4);
+}
+
+bool
+SpectrumDisplayForm::checkClicked()
+{
+ if(d_clicked) {
+ d_clicked = false;
+ return true;
+ }
+ else {
+ return false;
+ }
+}
+
+float
+SpectrumDisplayForm::getClickedFreq() const
+{
+ return d_clicked_freq;
}
diff --git a/gr-qtgui/lib/waterfall_sink_c_impl.cc
b/gr-qtgui/lib/waterfall_sink_c_impl.cc
index 2c436db..6147b31 100644
--- a/gr-qtgui/lib/waterfall_sink_c_impl.cc
+++ b/gr-qtgui/lib/waterfall_sink_c_impl.cc
@@ -69,6 +69,10 @@ namespace gr {
d_argv = new char;
d_argv[0] = '\0';
+ // setup output message port to post frequency when display is
+ // double-clicked
+ message_port_register_out(pmt::mp("freq"));
+
d_main_gui = NULL;
// Perform fftshift operation;
@@ -418,6 +422,15 @@ namespace gr {
}
}
+ void
+ waterfall_sink_c_impl::check_clicked()
+ {
+ if(d_main_gui->checkClicked()) {
+ d_center_freq = d_main_gui->getClickedFreq();
+ message_port_pub(pmt::mp("freq"), pmt::from_double(d_center_freq));
+ }
+ }
+
int
waterfall_sink_c_impl::work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -429,6 +442,7 @@ namespace gr {
// Update the FFT size from the application
fftresize();
windowreset();
+ check_clicked();
for(int i=0; i < noutput_items; i+=d_fftsize) {
unsigned int datasize = noutput_items - i;
diff --git a/gr-qtgui/lib/waterfall_sink_c_impl.h
b/gr-qtgui/lib/waterfall_sink_c_impl.h
index aad4a4d..1e5ee17 100644
--- a/gr-qtgui/lib/waterfall_sink_c_impl.h
+++ b/gr-qtgui/lib/waterfall_sink_c_impl.h
@@ -68,6 +68,7 @@ namespace gr {
void windowreset();
void buildwindow();
void fftresize();
+ void check_clicked();
void fft(float *data_out, const gr_complex *data_in, int size);
public:
diff --git a/gr-qtgui/lib/waterfall_sink_f_impl.cc
b/gr-qtgui/lib/waterfall_sink_f_impl.cc
index fc6d9fa..27de72e 100644
--- a/gr-qtgui/lib/waterfall_sink_f_impl.cc
+++ b/gr-qtgui/lib/waterfall_sink_f_impl.cc
@@ -68,6 +68,10 @@ namespace gr {
d_argv = new char;
d_argv[0] = '\0';
+ // setup output message port to post frequency when display is
+ // double-clicked
+ message_port_register_out(pmt::mp("freq"));
+
d_main_gui = NULL;
// Perform fftshift operation;
@@ -419,6 +423,15 @@ namespace gr {
}
}
+ void
+ waterfall_sink_f_impl::check_clicked()
+ {
+ if(d_main_gui->checkClicked()) {
+ d_center_freq = d_main_gui->getClickedFreq();
+ message_port_pub(pmt::mp("freq"), pmt::from_double(d_center_freq));
+ }
+ }
+
int
waterfall_sink_f_impl::work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -430,6 +443,7 @@ namespace gr {
// Update the FFT size from the application
fftresize();
windowreset();
+ check_clicked();
for(int i=0; i < noutput_items; i+=d_fftsize) {
unsigned int datasize = noutput_items - i;
diff --git a/gr-qtgui/lib/waterfall_sink_f_impl.h
b/gr-qtgui/lib/waterfall_sink_f_impl.h
index 172f873..db86b6a 100644
--- a/gr-qtgui/lib/waterfall_sink_f_impl.h
+++ b/gr-qtgui/lib/waterfall_sink_f_impl.h
@@ -68,6 +68,7 @@ namespace gr {
void windowreset();
void buildwindow();
void fftresize();
+ void check_clicked();
void fft(float *data_out, const float *data_in, int size);
public:
diff --git a/gr-qtgui/lib/waterfalldisplayform.cc
b/gr-qtgui/lib/waterfalldisplayform.cc
index f4dd2fd..3f7cf79 100644
--- a/gr-qtgui/lib/waterfalldisplayform.cc
+++ b/gr-qtgui/lib/waterfalldisplayform.cc
@@ -217,14 +217,14 @@ WaterfallDisplayForm::setFrequencyRange(const double
centerfreq,
std::string strunits[4] = {"Hz", "kHz", "MHz", "GHz"};
double units10 = floor(log10(bandwidth));
double units3 = std::max(floor(units10 / 3.0), 0.0);
- double units = pow(10, (units10-fmod(units10, 3.0)));
+ d_units = pow(10, (units10-fmod(units10, 3.0)));
int iunit = static_cast<int>(units3);
d_center_freq = centerfreq;
d_samp_rate = bandwidth;
getPlot()->setFrequencyRange(centerfreq, bandwidth,
- units, strunits[iunit]);
+ d_units, strunits[iunit]);
getPlot()->replot();
}
@@ -269,3 +269,30 @@ WaterfallDisplayForm::clearData()
{
getPlot()->clearData();
}
+
+void
+WaterfallDisplayForm::onPlotPointSelected(const QPointF p)
+{
+ d_clicked = true;
+ d_clicked_freq = d_units*p.x();
+
+ setFrequencyRange(d_clicked_freq, d_samp_rate);
+}
+
+bool
+WaterfallDisplayForm::checkClicked()
+{
+ if(d_clicked) {
+ d_clicked = false;
+ return true;
+ }
+ else {
+ return false;
+ }
+}
+
+float
+WaterfallDisplayForm::getClickedFreq() const
+{
+ return d_clicked_freq;
+}
- [Commit-gnuradio] [gnuradio] 05/23: digital: adding a rotate_phase message for the constellation_receiver to adjust the phase of the constellation., (continued)
- [Commit-gnuradio] [gnuradio] 05/23: digital: adding a rotate_phase message for the constellation_receiver to adjust the phase of the constellation., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 01/23: volk: cmake: Rename GrBoost to VolkBoost to differentiate it from GR's GrBoost. Although they set the same BOOST variables internally, this change make it clear which cmake file to include., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 09/23: qtgui: minor mods, including putting min/max lines in FFT sink behind all other lines., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 04/23: blocks: adding a message port to the copy block to enable/disable copy., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 13/23: filter: adds a message input port to frequency xlating FIR filter to update the frequency., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 03/23: digital: expose set_constellation message port in GRC for constellation_receiver., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 08/23: qtgui: adds an alternative qss file., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 14/23: docs: adding docs for blocks::copy and digital::constellation_receiver to describe their message ports., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 15/23: qtgui: dynamically adjust min/max amplitude for qtgui freq and waterfall plots., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 16/23: Merge branch 'maint', git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 11/23: qtgui: for sink_x, waterfall_sink_x, and freq_sink_x, when the display is double-clicked, the center frequency is adjusted to the clicked frequency and a message is posted containing the new center frequency.,
git <=
- [Commit-gnuradio] [gnuradio] 17/23: replaced dynamic_ by static_cast; typechecking done before, git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 02/23: cmake: Include GrBoost at the top level such that the correct default BOOST variables are set throughout the build. Because of the way CMake handles non-cached variables, each GR component (e.g., Volk) can change the BOOST variables for its particular needs without overriding these default values for other components., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 06/23: blocks.head: added callback to GRC definition, git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 18/23: crc32_async: fix memory leak; coverity 1215946, git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 23/23: build: removed some gcc warnings., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 21/23: Merge remote-tracking branch 'mmueller/blocks_grc_add_head_set_length_cb', git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 20/23: Merge remote-tracking branch 'michaelld/boost_once', git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 19/23: gr-fec: cc_decoder: fix leak; coverity 1215943, git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 22/23: Merge branch 'maint', git, 2014/06/26