basic filter dialog screen working, after usual pain with sizers
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 25 Nov 2012 00:00:28 +0000 (00:00 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 25 Nov 2012 00:00:28 +0000 (00:00 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@1060 01035d8c-6547-0410-b346-abe4f91aad63

fdmdv2/src/dlg_filter.cpp
fdmdv2/src/dlg_filter.h

index 78faa8e29faba5709474853a1001beb7473ed66d..3fcd1220c9d0f3265fc57a4c75eff5f1d0b2e10a 100644 (file)
@@ -20,7 +20,7 @@
 //==========================================================================
 #include "dlg_filter.h"
 
-#define SLIDER_MAX 20
+#define SLIDER_MAX 100
 
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
 // Class FilterDlg
@@ -34,36 +34,44 @@ FilterDlg::FilterDlg(wxWindow* parent, wxWindowID id, const wxString& title, con
     bSizer30 = new wxBoxSizer(wxVERTICAL);
 
     wxGridSizer* gSizer3;
-    gSizer3 = new wxGridSizer(6, 2, 0, 0);
+    gSizer3 = new wxGridSizer(6, 3, 0, 0);
 
-    m_staticText8 = new wxStaticText(this, wxID_ANY, _("Enable LPC Post Filter:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
-    m_staticText8->Wrap(-1);
-    gSizer3->Add(m_staticText8, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 2);
+    gSizer3->Add(new wxStaticText(this, wxID_ANY, _("")));
+    
+    m_codec2LPCPostFilterEnable = new wxCheckBox(this, wxID_ANY, _("Enable LPC Post Filter"), wxDefaultPosition,wxDefaultSize , wxCHK_2STATE);
+    gSizer3->Add(m_codec2LPCPostFilterEnable, 2);
 
-    m_codec2LPCPostFilterEnable = new wxCheckBox(this, wxID_ANY, _(""), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
-    gSizer3->Add(m_codec2LPCPostFilterEnable, 2, wxALL|wxEXPAND, 2);
+    gSizer3->Add(new wxStaticText(this, wxID_ANY, _("")));
+    gSizer3->Add(new wxStaticText(this, wxID_ANY, _("")));
 
-    m_staticText9 = new wxStaticText(this, wxID_ANY, _("0-1 kHz 3dB Boost"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
-    m_staticText9->Wrap(-1);
-    gSizer3->Add(m_staticText9, 1, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 2);
-
-    m_codec2LPCPostFilterBassBoost = new wxCheckBox(this, wxID_ANY, _(""), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
-    gSizer3->Add(m_codec2LPCPostFilterBassBoost, 1, wxALIGN_CENTER_VERTICAL|wxALL, 2);
+    m_codec2LPCPostFilterBassBoost = new wxCheckBox(this, wxID_ANY, _("0-1 kHz 3dB Boost"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
+    gSizer3->Add(m_codec2LPCPostFilterBassBoost, 2);
+    gSizer3->Add(new wxStaticText(this, wxID_ANY, _("")));
 
     m_staticText91 = new wxStaticText(this, wxID_ANY, _("Beta:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
     m_staticText91->Wrap(-1);
     gSizer3->Add(m_staticText91, 1, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 2);
 
-    m_codec2LPCPostFilterBeta = new wxSlider(this, wxID_ANY, 0, 0, SLIDER_MAX);
+    m_codec2LPCPostFilterBeta = new wxSlider(this, wxID_ANY, 0, 0, SLIDER_MAX, wxDefaultPosition, wxSize(155,wxDefaultCoord));
     gSizer3->Add(m_codec2LPCPostFilterBeta, 1, wxALIGN_CENTER_VERTICAL|wxALL, 2);
 
+    m_staticTextBeta = new wxStaticText(this, wxID_ANY, _("0.0"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
+    m_staticTextBeta->Wrap(-1);
+    //gSizer3->Add(m_staticTextBeta, 1, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL, 2);
+    gSizer3->Add(m_staticTextBeta, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL);
+
     m_staticText911 = new wxStaticText(this, wxID_ANY, _("Gamma:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
     m_staticText911->Wrap(-1);
-    gSizer3->Add(m_staticText911, 1, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 2);
+    gSizer3->Add(m_staticText911, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 2);
 
-    m_codec2LPCPostFilterGamma = new wxSlider(this, wxID_ANY, 0, 0, SLIDER_MAX);
+    m_codec2LPCPostFilterGamma = new wxSlider(this, wxID_ANY, 0, 0, SLIDER_MAX, wxDefaultPosition, wxSize(155,wxDefaultCoord));
     gSizer3->Add(m_codec2LPCPostFilterGamma, 1, wxALIGN_CENTER_VERTICAL|wxALL, 2);
 
+    m_staticTextGamma = new wxStaticText(this, wxID_ANY, _("0.0"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
+    m_staticTextGamma->Wrap(-1);
+    gSizer3->Add(m_staticTextGamma, 1, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL);
+
     bSizer30->Add(gSizer3, 1, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 5);
 
     m_sdbSizer5 = new wxStdDialogButtonSizer();
@@ -75,8 +83,7 @@ FilterDlg::FilterDlg(wxWindow* parent, wxWindowID id, const wxString& title, con
     m_sdbSizer5->AddButton(m_sdbSizer5Cancel);
     m_sdbSizer5->Realize();
 
-    bSizer30->Add(m_sdbSizer5, 0, wxEXPAND, 5);
-
+    bSizer30->Add(m_sdbSizer5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
 
     this->SetSizer(bSizer30);
     this->Layout();
@@ -86,10 +93,10 @@ FilterDlg::FilterDlg(wxWindow* parent, wxWindowID id, const wxString& title, con
 
     // Connect Events
     this->Connect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(FilterDlg::OnInitDialog));
-    //m_sdbSizer5Apply->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(FilterDlg::OnApply), NULL, this);
+    m_codec2LPCPostFilterBeta->Connect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnBetaScroll), NULL, this);
+    m_codec2LPCPostFilterGamma->Connect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnGammaScroll), NULL, this);
     m_sdbSizer5Cancel->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(FilterDlg::OnCancel), NULL, this);
     m_sdbSizer5OK->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(FilterDlg::OnOK), NULL, this);
-    //m_listCtrlPortSelect->Connect(wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler(FilterDlg::OnListItemSelected), NULL, this);
 }
 
 //-------------------------------------------------------------------------
@@ -99,20 +106,12 @@ FilterDlg::~FilterDlg()
 {
     // Disconnect Events
     this->Disconnect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(FilterDlg::OnInitDialog));
-    //m_listCtrlPortSelect->Disconnect(wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler(FilterDlg::OnListItemSelected), NULL, this);
-    //m_sdbSizer5Apply->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(FilterDlg::OnApply), NULL, this);
+    m_codec2LPCPostFilterBeta->Disconnect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnBetaScroll), NULL, this);
+    m_codec2LPCPostFilterGamma->Disconnect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(FilterDlg::OnGammaScroll), NULL, this);
     m_sdbSizer5Cancel->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(FilterDlg::OnCancel), NULL, this);
     m_sdbSizer5OK->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(FilterDlg::OnOK), NULL, this);
 }
 
-//-------------------------------------------------------------------------
-// OnListItemSelected()
-//-------------------------------------------------------------------------
-void FilterDlg::OnListItemSelected(wxListEvent& event)
-{
-    // TODO: Implement OnListItemSelected
-}
-
 //-------------------------------------------------------------------------
 // ExchangeData()
 //-------------------------------------------------------------------------
@@ -159,14 +158,6 @@ void FilterDlg::OnOK(wxCommandEvent& event)
     this->EndModal(wxID_OK);
 }
 
-//-------------------------------------------------------------------------
-// OnApply()
-//-------------------------------------------------------------------------
-void FilterDlg::OnApply(wxCommandEvent& event)
-{
-    ExchangeData(EXCHANGE_DATA_OUT);
-}
-
 //-------------------------------------------------------------------------
 // OnClose()
 //-------------------------------------------------------------------------
@@ -183,3 +174,17 @@ void FilterDlg::OnInitDialog(wxInitDialogEvent& event)
     ExchangeData(EXCHANGE_DATA_IN);
 }
 
+void FilterDlg::OnBetaScroll(wxScrollEvent& event) {
+    float beta = (float)m_codec2LPCPostFilterBeta->GetValue()/SLIDER_MAX;
+    wxString buf;
+    buf.Printf(wxT("%3.2f"), beta);
+    m_staticTextBeta->SetLabel(buf);
+}
+
+void FilterDlg::OnGammaScroll(wxScrollEvent& event) {
+    float gamma = (float)m_codec2LPCPostFilterGamma->GetValue()/SLIDER_MAX;
+    wxString buf;
+    buf.Printf(wxT("%3.2f"), gamma);
+    m_staticTextGamma->SetLabel(buf);
+}
+
index 2b56bcbf189a10cb7a19e5c91aa753b24a2efa7d..d6918cc673eeff1477a776c76e1e40ea22e86be0 100644 (file)
 class FilterDlg : public wxDialog
 {
     public:
-        FilterDlg( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Filter"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 399,354 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
+        FilterDlg( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Filter"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 400,250 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
         ~FilterDlg();
 
         void    ExchangeData(int inout);
 
     protected:
         // Handlers for events.
-        void    OnListItemSelected(wxListEvent& event);
         void    OnCancel(wxCommandEvent& event);
         void    OnOK(wxCommandEvent& event);
         void    OnClose(wxCloseEvent& event);
         void    OnInitDialog(wxInitDialogEvent& event);
-        void    OnApply(wxCommandEvent& event);
+        void    OnBetaScroll(wxScrollEvent& event);
+        void    OnGammaScroll(wxScrollEvent& event);
 
         wxStaticText* m_staticText8;
         wxCheckBox*   m_codec2LPCPostFilterEnable;
@@ -50,8 +50,10 @@ class FilterDlg : public wxDialog
         wxCheckBox*   m_codec2LPCPostFilterBassBoost;
         wxStaticText* m_staticText91;
         wxSlider*     m_codec2LPCPostFilterBeta;
+        wxStaticText* m_staticTextBeta;
         wxStaticText* m_staticText911;
         wxSlider*     m_codec2LPCPostFilterGamma;
+        wxStaticText* m_staticTextGamma;
 
         wxStdDialogButtonSizer* m_sdbSizer5;
         wxButton*     m_sdbSizer5OK;