commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 25/37: qtgui: adding menu item to frequency


From: git
Subject: [Commit-gnuradio] [gnuradio] 25/37: qtgui: adding menu item to frequency sink to set y min/max.
Date: Thu, 17 Jul 2014 20:23:42 +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 127710c4604a1cbd0592d4ffa7d3c520ce03b693
Author: Tom Rondeau <address@hidden>
Date:   Sat Jul 12 11:07:24 2014 -0400

    qtgui: adding menu item to frequency sink to set y min/max.
---
 .../include/gnuradio/qtgui/FrequencyDisplayPlot.h  |  2 ++
 gr-qtgui/include/gnuradio/qtgui/freqdisplayform.h  |  2 ++
 gr-qtgui/lib/FrequencyDisplayPlot.cc               | 16 ++++++++++++-
 gr-qtgui/lib/freqdisplayform.cc                    | 28 ++++++++++++++++++++++
 4 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/gr-qtgui/include/gnuradio/qtgui/FrequencyDisplayPlot.h 
b/gr-qtgui/include/gnuradio/qtgui/FrequencyDisplayPlot.h
index f5e8f0f..ac7dfe8 100644
--- a/gr-qtgui/include/gnuradio/qtgui/FrequencyDisplayPlot.h
+++ b/gr-qtgui/include/gnuradio/qtgui/FrequencyDisplayPlot.h
@@ -76,6 +76,8 @@ public:
   void replot();
 
   void setYaxis(double min, double max);
+  double getYMin() const;
+  double getYMax() const;
 
   void setTraceColour (QColor);
   void setBGColour (QColor c);
diff --git a/gr-qtgui/include/gnuradio/qtgui/freqdisplayform.h 
b/gr-qtgui/include/gnuradio/qtgui/freqdisplayform.h
index c0cd36e..7cd077e 100644
--- a/gr-qtgui/include/gnuradio/qtgui/freqdisplayform.h
+++ b/gr-qtgui/include/gnuradio/qtgui/freqdisplayform.h
@@ -66,6 +66,8 @@ public slots:
   void setFrequencyRange(const double centerfreq,
                         const double bandwidth);
   void setYaxis(double min, double max);
+  void setYMax(const QString &m);
+  void setYMin(const QString &m);
   void autoScale(bool en);
   void clearMaxHold();
   void clearMinHold();
diff --git a/gr-qtgui/lib/FrequencyDisplayPlot.cc 
b/gr-qtgui/lib/FrequencyDisplayPlot.cc
index 19ebac1..12835bc 100644
--- a/gr-qtgui/lib/FrequencyDisplayPlot.cc
+++ b/gr-qtgui/lib/FrequencyDisplayPlot.cc
@@ -262,6 +262,18 @@ FrequencyDisplayPlot::setYaxis(double min, double max)
     d_zoomer->setZoomBase();
 }
 
+double
+FrequencyDisplayPlot::getYMin() const
+{
+  return d_ymin;
+}
+
+double
+FrequencyDisplayPlot::getYMax() const
+{
+  return d_ymax;
+}
+
 void
 FrequencyDisplayPlot::setFrequencyRange(const double centerfreq,
                                        const double bandwidth,
@@ -438,7 +450,9 @@ void
 FrequencyDisplayPlot::_autoScale(double bottom, double top)
 {
   // Auto scale the y-axis with a margin of 10 dB on either side.
-  setYaxis(bottom - 10, top + 10);
+  d_ymin = bottom-10;
+  d_ymax = top+10;
+  setYaxis(d_ymin, d_ymax);
 }
 
 void
diff --git a/gr-qtgui/lib/freqdisplayform.cc b/gr-qtgui/lib/freqdisplayform.cc
index e9968df..ccc7fe9 100644
--- a/gr-qtgui/lib/freqdisplayform.cc
+++ b/gr-qtgui/lib/freqdisplayform.cc
@@ -55,6 +55,16 @@ FreqDisplayForm::FreqDisplayForm(int nplots, QWidget* parent)
   connect(d_winmenu, SIGNAL(whichTrigger(gr::filter::firdes::win_type)),
          this, SLOT(setFFTWindowType(const gr::filter::firdes::win_type)));
 
+  PopupMenu *maxymenu = new PopupMenu("Y Max", this);
+  d_menu->addAction(maxymenu);
+  connect(maxymenu, SIGNAL(whichTrigger(QString)),
+         this, SLOT(setYMax(QString)));
+
+  PopupMenu *minymenu = new PopupMenu("Y Min", this);
+  d_menu->addAction(minymenu);
+  connect(minymenu, SIGNAL(whichTrigger(QString)),
+         this, SLOT(setYMin(QString)));
+
   d_clearmax_act = new QAction("Clear Max", this);
   d_menu->addAction(d_clearmax_act);
   connect(d_clearmax_act, SIGNAL(triggered()),
@@ -179,6 +189,24 @@ FreqDisplayForm::setYaxis(double min, double max)
 }
 
 void
+FreqDisplayForm::setYMax(const QString &m)
+{
+  double new_max = m.toDouble();
+  double cur_ymin = getPlot()->getYMin();
+  if(new_max > cur_ymin)
+    setYaxis(cur_ymin, new_max);
+}
+
+void
+FreqDisplayForm::setYMin(const QString &m)
+{
+  double new_min = m.toDouble();
+  double cur_ymax = getPlot()->getYMax();
+  if(new_min < cur_ymax)
+    setYaxis(new_min, cur_ymax);
+}
+
+void
 FreqDisplayForm::autoScale(bool en)
 {
   if(en) {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]