positioned squelch and snr static text correctly and stays centred
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 9 Nov 2012 01:56:45 +0000 (01:56 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 9 Nov 2012 01:56:45 +0000 (01:56 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@951 01035d8c-6547-0410-b346-abe4f91aad63

fdmdv2/src/Makefile.linux
fdmdv2/src/Makefile.win32
fdmdv2/src/fdmdv2_defines.h
fdmdv2/src/fdmdv2_main.cpp
fdmdv2/src/topFrame.cpp
fdmdv2/src/topFrame.h

index 3fd0ced1ca0f24dab4976e6da322c02e55965d32..c3315f37203e6bd304e4a46eaf63e59f638ebe59 100644 (file)
@@ -30,7 +30,7 @@ dlg_audiooptions.o \
 dlg_comports.o \
 dlg_options.o
 
-HDRS = fdmdv2_main.h fdmdv2_defines.h fdmdv2_plot.h fdmdv2_plot_scalar.h fdmdv2_plot_waterfall_linux.h fdmdv2_plot_scatter.h fdmdv2_plot_spectrum.h fdmdv2_pa_wrapper.h
+HDRS = fdmdv2_main.h fdmdv2_defines.h fdmdv2_plot.h fdmdv2_plot_scalar.h fdmdv2_plot_waterfall_linux.h fdmdv2_plot_scatter.h fdmdv2_plot_spectrum.h fdmdv2_pa_wrapper.h topFrame.h
 
 all: fdmdv2
 
index abb5b475b9634593465d988d0f916da88f293b17..7cb3e66867812f7a4b21548ef190c2ccd398929d 100644 (file)
@@ -30,7 +30,7 @@ dlg_audiooptions.o \
 dlg_comports.o \
 dlg_options.o
 
-HDRS = fdmdv2_main.h fdmdv2_defines.h fdmdv2_plot.h fdmdv2_plot_scalar.h fdmdv2_plot_waterfall_linux.h fdmdv2_plot_scatter.h fdmdv2_plot_spectrum.h fdmdv2_pa_wrapper.h
+HDRS = fdmdv2_main.h fdmdv2_defines.h fdmdv2_plot.h fdmdv2_plot_scalar.h fdmdv2_plot_waterfall_linux.h fdmdv2_plot_scatter.h fdmdv2_plot_spectrum.h fdmdv2_pa_wrapper.h topFrame.h
 
 all: fdmdv2
 
index 94f9a5c5385db8fdddfea58351f0cef75c023ca2..9857982d59978709605c6bbbbdb7f5c2c53ae853 100644 (file)
@@ -71,6 +71,9 @@
 #define BITS_PER_CODEC_FRAME  (2 * FDMDV_BITS_PER_FRAME)
 #define BYTES_PER_CODEC_FRAME (BITS_PER_CODEC_FRAME / 8)
 
+// Squelch
+#define SQ_DEFAULT_SNR      4.0
+
 enum
 {
     ID_ROTATE_LEFT = wxID_HIGHEST + 1,
index ed605938059111359b72bd5d2be781fadb549a16..600270dc35827933327b5561bfc9a787872d75df 100644 (file)
@@ -271,6 +271,14 @@ MainFrame::MainFrame(wxWindow *parent) : TopFrame(parent)
 
 //    m_menuItemPlayAudioFile->Enable(false);
 
+    // default squelch position
+
+    char sqsnr[15];
+    sprintf(sqsnr, "%4.1f", SQ_DEFAULT_SNR);
+    wxString sqsnr_string(sqsnr);
+    m_sliderSQ->SetValue(SQ_DEFAULT_SNR*2);
+    m_textSQ->SetLabel(sqsnr_string);
+   
 #ifdef _USE_TIMER
     Bind(wxEVT_TIMER, &MainFrame::OnTimer, this);       // ID_MY_WINDOW);
     m_plotTimer.SetOwner(this, ID_TIMER_WATERFALL);
@@ -398,17 +406,17 @@ void MainFrame::OnTimer(wxTimerEvent &evt)
 
     // SNR text box and guage ------------------------------------------------------------
 
+    float snr_limited = g_stats.snr_est;
+
+    if (snr_limited < -9.0) snr_limited = -9.0; // stop text box overflow
     char snr[15];
-    sprintf(snr, "%2.1f", g_stats.snr_est);
+    sprintf(snr, "%4.1f", snr_limited);
     wxString snr_string(snr);
-    //m_textSNR->ChangeValue(snr_string);
     m_textSNR->SetLabel(snr_string);
 
-    m_gaugeSNR->SetRange(20); // 0 to 20dB seems sensible
-    int snr_limited = g_stats.snr_est;
-    if (snr_limited < 0) snr_limited = 0;
-    if (snr_limited > 20) snr_limited = 20;
-    m_gaugeSNR->SetValue(snr_limited);
+    if (snr_limited < 0.0) snr_limited = 0;
+    if (snr_limited > 20.0) snr_limited = 20.0;
+    m_gaugeSNR->SetValue((int)(snr_limited+0.5));
 
     // sync LED
 
@@ -495,7 +503,7 @@ void MainFrame::OnPaint(wxPaintEvent& WXUNUSED(event))
 void MainFrame::OnCmdSliderScroll(wxScrollEvent& event)
 {
     char sqsnr[15];
-    sprintf(sqsnr, "%d", m_sliderSQ->GetValue());
+    sprintf(sqsnr, "%4.1f", (float)m_sliderSQ->GetValue()/2.0); // 0.5 dB steps
     wxString sqsnr_string(sqsnr);
     m_textSQ->SetLabel(sqsnr_string);
 
index 43f5e86d0286df7eef5dd12255795cdb48f013a7..7e9c31fce428c8d412cade25bfbc563f16e79cdf 100644 (file)
@@ -157,7 +157,8 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const
     //------------------------------
     // Box for S/N ratio (Numeric)
     //------------------------------
-    m_textSNR = new wxStaticText(this, wxID_ANY, wxEmptyString, wxPoint(-1,-1), wxSize(35,25), wxTE_READONLY);
+    m_textSNR = new wxStaticText(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE);
+    //m_textSNR = new wxStaticText(this, wxID_ANY, wxEmptyString, wxPoint(-1,-1), wxSize(35,25), wxTE_READONLY);
     m_textSNR->SetToolTip(_("Show SNR ratio numerically."));
     m_textSNR->SetMinSize(wxSize(35,25));
     bSizer29->Add(m_textSNR, 0, wxALIGN_CENTER|wxALL, 1);
@@ -230,46 +231,35 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const
     rightSizer = new wxBoxSizer(wxVERTICAL);
 
     //=====================================================
-    // Squelch Control box
+    // Squelch Slider Control
     //=====================================================
     wxStaticBoxSizer* sbSizer3;
     sbSizer3 = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("SQ")), wxVERTICAL);
 
-    m_sliderSQ = new wxSlider(this, wxID_ANY, SQ_DEFAULT_SNR, 0, 20, wxDefaultPosition, wxSize(-1,80), wxSL_AUTOTICKS|wxSL_INVERSE|wxSL_VERTICAL);
+    m_sliderSQ = new wxSlider(this, wxID_ANY, 0, 0, 40, wxDefaultPosition, wxSize(-1,80), wxSL_AUTOTICKS|wxSL_INVERSE|wxSL_VERTICAL);
     m_sliderSQ->SetToolTip(_("Set Squelch level in dB."));
 
-    sbSizer3->Add(m_sliderSQ, 2, wxALIGN_CENTER|wxALL, 1);
+    sbSizer3->Add(m_sliderSQ, 1, wxALIGN_CENTER_HORIZONTAL, 0);
 
     //------------------------------
-    // Squelch Toggle Checkbox
+    // Squelch Level static text box
     //------------------------------
-    wxBoxSizer* bSizer131A;
-    bSizer131A = new wxBoxSizer(wxVERTICAL);
 
-    m_ckboxSQ = new wxCheckBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
-    m_ckboxSQ->SetToolTip(_("Activate/Deactivate Squelch"));
+    m_textSQ = new wxStaticText(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE);
 
-    bSizer131A->Add(m_ckboxSQ, 0, wxALIGN_CENTER|wxALL, 0);
-    //sbSizer3->Add(bSizer131A, 2, wxALIGN_CENTER|wxALL, 1);
+    sbSizer3->Add(m_textSQ, 0, wxALIGN_CENTER_HORIZONTAL, 0);
 
     //------------------------------
-    // Squelch Level text box
+    // Squelch Toggle Checkbox
     //------------------------------
 
-    wxBoxSizer* bSizer131B;
-    bSizer131B = new wxBoxSizer(wxVERTICAL);
+    m_ckboxSQ = new wxCheckBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
+    m_ckboxSQ->SetToolTip(_("Activate/Deactivate Squelch"));
 
-    // TODO: make this a config parameter?
-    char sqsnr[15];
-    sprintf(sqsnr, "%2.0f", SQ_DEFAULT_SNR);
-    wxString sqsnr_string(sqsnr);
-    m_textSQ = new wxStaticText(this, wxID_ANY, sqsnr_string, wxPoint(-1,-1), wxSize(35,25));
-    m_textSQ->SetMinSize(wxSize(35,25));
+    sbSizer3->Add(m_ckboxSQ, 0, wxALIGN_CENTER_HORIZONTAL, 0);
 
-    bSizer131B->Add(m_textSQ, 0, wxALL, 0);
-    sbSizer3->Add(bSizer131B, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 1);
 
-    rightSizer->Add(sbSizer3, 2, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
+    rightSizer->Add(sbSizer3, 2, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 0);
 
     //------------------------------
     // Synch Indicator box
index 3bb5885696104d6a97f90fbaf4ec96acb16bb943..16aca4e32d6d1b300772a24a4f1f12c505d2b793 100644 (file)
@@ -41,6 +41,7 @@
 #include <wx/notebook.h>
 #include <wx/listctrl.h>
 
+
 ///////////////////////////////////////////////////////////////////////////
 
 #define ID_OPEN 1000
@@ -72,6 +73,7 @@ class TopFrame : public wxFrame
         wxTextCtrl* m_txtCtrl;
         wxSlider* m_sliderSQ;
         wxCheckBox* m_ckboxSQ;
+        wxStaticText* m_textSQ;
         wxStatusBar* m_statusBar1;
         wxRadioButton *m_rbSync;