From: drowe67 Date: Mon, 10 Jul 2017 06:06:57 +0000 (+0000) Subject: moved some items from PTT to Options dialog X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=6438c087e232437251256fe23325ad2726af0fbc;p=freetel-svn-tracking.git moved some items from PTT to Options dialog git-svn-id: https://svn.code.sf.net/p/freetel/code@3288 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/freedv-dev/src/dlg_options.cpp b/freedv-dev/src/dlg_options.cpp index b015c7fb..fb25de41 100644 --- a/freedv-dev/src/dlg_options.cpp +++ b/freedv-dev/src/dlg_options.cpp @@ -49,6 +49,35 @@ OptionsDlg::OptionsDlg(wxWindow* parent, wxWindowID id, const wxString& title, c bSizer30->Add(sbSizer_callSign,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3); + //---------------------------------------------------------------------- + // Voice Keyer + //---------------------------------------------------------------------- + + wxStaticBoxSizer* staticBoxSizer28a = new wxStaticBoxSizer( new wxStaticBox(this, wxID_ANY, _("Voice Keyer")), wxHORIZONTAL); + + wxStaticText *m_staticText28b = new wxStaticText(this, wxID_ANY, _("Wave File: "), wxDefaultPosition, wxDefaultSize, 0); + staticBoxSizer28a->Add(m_staticText28b, 0, wxALIGN_CENTER_VERTICAL, 5); + m_txtCtrlVoiceKeyerWaveFile = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(300,-1), 0); + m_txtCtrlVoiceKeyerWaveFile->SetToolTip(_("Wave file to play for Voice Keyer")); + staticBoxSizer28a->Add(m_txtCtrlVoiceKeyerWaveFile, 0, 0, 5); + + m_buttonChooseVoiceKeyerWaveFile = new wxButton(this, wxID_APPLY, _("Choose"), wxDefaultPosition, wxSize(-1,-1), 0); + staticBoxSizer28a->Add(m_buttonChooseVoiceKeyerWaveFile, 0, wxALIGN_CENTER_VERTICAL, 5); + + wxStaticText *m_staticText28c = new wxStaticText(this, wxID_ANY, _(" Rx Pause: "), wxDefaultPosition, wxDefaultSize, 0); + staticBoxSizer28a->Add(m_staticText28c, 0, wxALIGN_CENTER_VERTICAL , 5); + m_txtCtrlVoiceKeyerRxPause = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(40,-1), 0); + m_txtCtrlVoiceKeyerRxPause->SetToolTip(_("How long to wait in Rx mode before repeat")); + staticBoxSizer28a->Add(m_txtCtrlVoiceKeyerRxPause, 0, 0, 5); + + wxStaticText *m_staticText28d = new wxStaticText(this, wxID_ANY, _(" Repeats: "), wxDefaultPosition, wxDefaultSize, 0); + staticBoxSizer28a->Add(m_staticText28d, 0, wxALIGN_CENTER_VERTICAL, 5); + m_txtCtrlVoiceKeyerRepeats = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(40,-1), 0); + m_txtCtrlVoiceKeyerRepeats->SetToolTip(_("How long to wait in Rx mode before repeat")); + staticBoxSizer28a->Add(m_txtCtrlVoiceKeyerRepeats, 0, 0, 5); + + bSizer30->Add(staticBoxSizer28a,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3); + #ifdef __WXMSW__ //------------------------------ // debug console, for WIndows build make console pop up for debug messages @@ -77,7 +106,17 @@ OptionsDlg::OptionsDlg(wxWindow* parent, wxWindowID id, const wxString& title, c m_ckboxFreeDV700Combine = new wxCheckBox(this, wxID_ANY, _("Diversity Combine for plots"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE); sbSizer_freedv700->Add(m_ckboxFreeDV700Combine, 0, wxALIGN_LEFT, 0); - bSizer30->Add(sbSizer_freedv700,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3); + bSizer30->Add(sbSizer_freedv700, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3); + + //------------------------------ + // Half/Full duplex selection + //------------------------------ + + wxStaticBox *sb_duplex = new wxStaticBox(this, wxID_ANY, _("Half/Full Duplex Operation")); + wxStaticBoxSizer* sbSizer_duplex = new wxStaticBoxSizer(sb_duplex, wxHORIZONTAL); + m_ckHalfDuplex = new wxCheckBox(this, wxID_ANY, _("Half Duplex"), wxDefaultPosition, wxSize(-1,-1), 0); + sbSizer_duplex->Add(m_ckHalfDuplex, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); + bSizer30->Add(sbSizer_duplex,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3); //------------------------------ // Test Frames/Channel simulation check box @@ -247,6 +286,8 @@ OptionsDlg::OptionsDlg(wxWindow* parent, wxWindowID id, const wxString& title, c m_ckboxDebugConsole->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxScrollEventHandler(OptionsDlg::OnDebugConsole), NULL, this); #endif + m_buttonChooseVoiceKeyerWaveFile->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(OptionsDlg::OnChooseVoiceKeyerWaveFile), NULL, this); + event_in_serial = 0; event_out_serial = 0; } @@ -271,6 +312,7 @@ OptionsDlg::~OptionsDlg() m_ckboxFreeDV700txClip->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxScrollEventHandler(OptionsDlg::OnFreeDV700txClip), NULL, this); m_ckboxFreeDV700Combine->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxScrollEventHandler(OptionsDlg::OnFreeDV700Combine), NULL, this); + m_buttonChooseVoiceKeyerWaveFile->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(OptionsDlg::OnChooseVoiceKeyerWaveFile), NULL, this); #ifdef __WXMSW__ m_ckboxDebugConsole->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxScrollEventHandler(OptionsDlg::OnDebugConsole), NULL, this); @@ -288,6 +330,15 @@ void OptionsDlg::ExchangeData(int inout, bool storePersistent) if(inout == EXCHANGE_DATA_IN) { m_txtCtrlCallSign->SetValue(wxGetApp().m_callSign); + + /* Voice Keyer */ + + m_txtCtrlVoiceKeyerWaveFile->SetValue(wxGetApp().m_txtVoiceKeyerWaveFile); + m_txtCtrlVoiceKeyerRxPause->SetValue(wxString::Format(wxT("%i"), wxGetApp().m_intVoiceKeyerRxPause)); + m_txtCtrlVoiceKeyerRepeats->SetValue(wxString::Format(wxT("%i"), wxGetApp().m_intVoiceKeyerRepeats)); + + m_ckHalfDuplex->SetValue(wxGetApp().m_boolHalfDuplex); + m_ckboxTestFrame->SetValue(wxGetApp().m_testFrames); m_ckboxChannelNoise->SetValue(wxGetApp().m_channel_noise); @@ -329,7 +380,22 @@ void OptionsDlg::ExchangeData(int inout, bool storePersistent) if(inout == EXCHANGE_DATA_OUT) { - wxGetApp().m_callSign = m_txtCtrlCallSign->GetValue(); + wxGetApp().m_callSign = m_txtCtrlCallSign->GetValue(); + + wxGetApp().m_boolHalfDuplex = m_ckHalfDuplex->GetValue(); + pConfig->Write(wxT("/Rig/HalfDuplex"), wxGetApp().m_boolHalfDuplex); + + /* Voice Keyer */ + + wxGetApp().m_txtVoiceKeyerWaveFile = m_txtCtrlVoiceKeyerWaveFile->GetValue(); + pConfig->Write(wxT("/VoiceKeyer/WaveFile"), wxGetApp().m_txtVoiceKeyerWaveFile); + long tmp; + m_txtCtrlVoiceKeyerRxPause->GetValue().ToLong(&tmp); if (tmp < 0) tmp = 0; wxGetApp().m_intVoiceKeyerRxPause = (int)tmp; + pConfig->Write(wxT("/VoiceKeyer/RxPause"), wxGetApp().m_intVoiceKeyerRxPause); + m_txtCtrlVoiceKeyerRepeats->GetValue().ToLong(&tmp); + if (tmp < 0) tmp = 0; if (tmp > 100) tmp = 100; + wxGetApp().m_intVoiceKeyerRepeats = (int)tmp; + pConfig->Write(wxT("/VoiceKeyer/Repeats"), wxGetApp().m_intVoiceKeyerRepeats); wxGetApp().m_testFrames = m_ckboxTestFrame->GetValue(); @@ -345,7 +411,6 @@ void OptionsDlg::ExchangeData(int inout, bool storePersistent) m_txtToneAmplitude->GetValue().ToLong(&tone_amplitude); wxGetApp().m_tone_amplitude = (int)tone_amplitude; - wxGetApp().m_attn_carrier_en = m_ckboxAttnCarrierEn->GetValue(); long attn_carrier; m_txtAttnCarrier->GetValue().ToLong(&attn_carrier); @@ -467,6 +532,26 @@ void OptionsDlg::OnChannelNoise(wxScrollEvent& event) { wxGetApp().m_channel_noise = m_ckboxChannelNoise->GetValue(); } + +void OptionsDlg::OnChooseVoiceKeyerWaveFile(wxCommandEvent& event) { + wxFileDialog openFileDialog( + this, + wxT("Voice Keyer wave file"), + wxGetApp().m_txtVoiceKeyerWaveFilePath, + wxEmptyString, + wxT("WAV files (*.wav)|*.wav"), + wxFD_SAVE + ); + if(openFileDialog.ShowModal() == wxID_CANCEL) { + return; // the user changed their mind... + } + + wxString fileName, extension; + wxGetApp().m_txtVoiceKeyerWaveFile = openFileDialog.GetPath(); + wxFileName::SplitPath(wxGetApp().m_txtVoiceKeyerWaveFile, &wxGetApp().m_txtVoiceKeyerWaveFilePath, &fileName, &extension); + m_txtCtrlVoiceKeyerWaveFile->SetValue(wxGetApp().m_txtVoiceKeyerWaveFile); +} + // Run time update of carrier amplitude attenuation void OptionsDlg::OnAttnCarrierEn(wxScrollEvent& event) { diff --git a/freedv-dev/src/dlg_options.h b/freedv-dev/src/dlg_options.h index e378dab8..7ac5b1f1 100644 --- a/freedv-dev/src/dlg_options.h +++ b/freedv-dev/src/dlg_options.h @@ -36,9 +36,9 @@ class OptionsDlg : public wxDialog const wxPoint& pos = wxDefaultPosition, #ifdef __WXMSW__ /* we add debug console check box for windows */ - const wxSize& size = wxSize(600,330), + const wxSize& size = wxSize(600,360), #else - const wxSize& size = wxSize(600,300), + const wxSize& size = wxSize(600,360), #endif long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~OptionsDlg(); @@ -64,7 +64,9 @@ class OptionsDlg : public wxDialog protected: + // Handlers for events. + void OnOK(wxCommandEvent& event); void OnCancel(wxCommandEvent& event); void OnApply(wxCommandEvent& event); @@ -79,6 +81,18 @@ class OptionsDlg : public wxDialog void OnDebugConsole(wxScrollEvent& event); wxTextCtrl *m_txtCtrlCallSign; // TODO: this should be renamed to tx_txtmsg, and rename all related incl persis strge + + wxCheckBox* m_ckHalfDuplex; + + /* Voice Keyer */ + + wxButton *m_buttonChooseVoiceKeyerWaveFile; + wxTextCtrl *m_txtCtrlVoiceKeyerWaveFile; + wxTextCtrl *m_txtCtrlVoiceKeyerRxPause; + wxTextCtrl *m_txtCtrlVoiceKeyerRepeats; + + /* test frames, other simulated channel impairments */ + wxCheckBox *m_ckboxTestFrame; wxCheckBox *m_ckboxChannelNoise; wxTextCtrl *m_txtNoiseSNR; @@ -115,6 +129,8 @@ class OptionsDlg : public wxDialog unsigned int event_in_serial, event_out_serial; + void OnChooseVoiceKeyerWaveFile(wxCommandEvent& event); + private: }; diff --git a/freedv-dev/src/dlg_ptt.cpp b/freedv-dev/src/dlg_ptt.cpp index d50a1e8b..e051d5c8 100644 --- a/freedv-dev/src/dlg_ptt.cpp +++ b/freedv-dev/src/dlg_ptt.cpp @@ -41,48 +41,15 @@ ComPortsDlg::ComPortsDlg(wxWindow* parent, wxWindowID id, const wxString& title, this->SetSizer(mainSizer); //---------------------------------------------------------------------- - // Half Duplex Flag for VOX PTT + // Vox tone option //---------------------------------------------------------------------- - // DR: should this be on options dialog? - wxStaticBoxSizer* staticBoxSizer28 = new wxStaticBoxSizer( new wxStaticBox(this, wxID_ANY, _("VOX PTT Settings")), wxHORIZONTAL); - m_ckHalfDuplex = new wxCheckBox(this, wxID_ANY, _("Half Duplex"), wxDefaultPosition, wxSize(-1,-1), 0); - staticBoxSizer28->Add(m_ckHalfDuplex, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); m_ckLeftChannelVoxTone = new wxCheckBox(this, wxID_ANY, _("Left Channel Vox Tone"), wxDefaultPosition, wxSize(-1,-1), 0); staticBoxSizer28->Add(m_ckLeftChannelVoxTone, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); mainSizer->Add(staticBoxSizer28, 0, wxEXPAND, 5); - //---------------------------------------------------------------------- - // Voice Keyer - //---------------------------------------------------------------------- - - wxStaticBoxSizer* staticBoxSizer28a = new wxStaticBoxSizer( new wxStaticBox(this, wxID_ANY, _("Voice Keyer")), wxHORIZONTAL); - - wxStaticText *m_staticText28b = new wxStaticText(this, wxID_ANY, _("Wave File: "), wxDefaultPosition, wxDefaultSize, 0); - staticBoxSizer28a->Add(m_staticText28b, 0, wxALIGN_CENTER_VERTICAL, 5); - m_txtCtrlVoiceKeyerWaveFile = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(300,-1), 0); - m_txtCtrlVoiceKeyerWaveFile->SetToolTip(_("Wave file to play for Voice Keyer")); - staticBoxSizer28a->Add(m_txtCtrlVoiceKeyerWaveFile, 0, 0, 5); - - m_buttonChooseVoiceKeyerWaveFile = new wxButton(this, wxID_APPLY, _("Choose"), wxDefaultPosition, wxSize(-1,-1), 0); - staticBoxSizer28a->Add(m_buttonChooseVoiceKeyerWaveFile, 0, wxALIGN_CENTER_VERTICAL, 5); - - wxStaticText *m_staticText28c = new wxStaticText(this, wxID_ANY, _(" Rx Pause: "), wxDefaultPosition, wxDefaultSize, 0); - staticBoxSizer28a->Add(m_staticText28c, 0, wxALIGN_CENTER_VERTICAL , 5); - m_txtCtrlVoiceKeyerRxPause = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(40,-1), 0); - m_txtCtrlVoiceKeyerRxPause->SetToolTip(_("How long to wait in Rx mode before repeat")); - staticBoxSizer28a->Add(m_txtCtrlVoiceKeyerRxPause, 0, 0, 5); - - wxStaticText *m_staticText28d = new wxStaticText(this, wxID_ANY, _(" Repeats: "), wxDefaultPosition, wxDefaultSize, 0); - staticBoxSizer28a->Add(m_staticText28d, 0, wxALIGN_CENTER_VERTICAL, 5); - m_txtCtrlVoiceKeyerRepeats = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(40,-1), 0); - m_txtCtrlVoiceKeyerRepeats->SetToolTip(_("How long to wait in Rx mode before repeat")); - staticBoxSizer28a->Add(m_txtCtrlVoiceKeyerRepeats, 0, 0, 5); - - mainSizer->Add(staticBoxSizer28a, 0, wxEXPAND, 5); - //---------------------------------------------------------------------- // Hamlib for CAT PTT //---------------------------------------------------------------------- @@ -252,7 +219,6 @@ ComPortsDlg::ComPortsDlg(wxWindow* parent, wxWindowID id, const wxString& title, m_buttonOK->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnOK), NULL, this); m_buttonCancel->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnCancel), NULL, this); m_buttonApply->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnApply), NULL, this); - m_buttonChooseVoiceKeyerWaveFile->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnChooseVoiceKeyerWaveFile), NULL, this); } //------------------------------------------------------------------------- @@ -267,7 +233,6 @@ ComPortsDlg::~ComPortsDlg() m_buttonOK->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnOK), NULL, this); m_buttonCancel->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnCancel), NULL, this); m_buttonApply->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnApply), NULL, this); - m_buttonChooseVoiceKeyerWaveFile->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnChooseVoiceKeyerWaveFile), NULL, this); } //------------------------------------------------------------------------- @@ -397,15 +362,8 @@ void ComPortsDlg::ExchangeData(int inout) if(inout == EXCHANGE_DATA_IN) { - m_ckHalfDuplex->SetValue(wxGetApp().m_boolHalfDuplex); m_ckLeftChannelVoxTone->SetValue(wxGetApp().m_leftChannelVoxTone); - /* Voice Keyer */ - - m_txtCtrlVoiceKeyerWaveFile->SetValue(wxGetApp().m_txtVoiceKeyerWaveFile); - m_txtCtrlVoiceKeyerRxPause->SetValue(wxString::Format(wxT("%i"), wxGetApp().m_intVoiceKeyerRxPause)); - m_txtCtrlVoiceKeyerRepeats->SetValue(wxString::Format(wxT("%i"), wxGetApp().m_intVoiceKeyerRepeats)); - /* Hamlib */ m_ckUseHamlibPTT->SetValue(wxGetApp().m_boolHamlibUseForPTT); @@ -435,22 +393,9 @@ void ComPortsDlg::ExchangeData(int inout) } if(inout == EXCHANGE_DATA_OUT) { - wxGetApp().m_boolHalfDuplex = m_ckHalfDuplex->GetValue(); - pConfig->Write(wxT("/Rig/HalfDuplex"), wxGetApp().m_boolHalfDuplex); wxGetApp().m_leftChannelVoxTone = m_ckLeftChannelVoxTone->GetValue(); pConfig->Write(wxT("/Rig/leftChannelVoxTone"), wxGetApp().m_leftChannelVoxTone); - /* Voice Keyer */ - - wxGetApp().m_txtVoiceKeyerWaveFile = m_txtCtrlVoiceKeyerWaveFile->GetValue(); - pConfig->Write(wxT("/VoiceKeyer/WaveFile"), wxGetApp().m_txtVoiceKeyerWaveFile); - long tmp; - m_txtCtrlVoiceKeyerRxPause->GetValue().ToLong(&tmp); if (tmp < 0) tmp = 0; wxGetApp().m_intVoiceKeyerRxPause = (int)tmp; - pConfig->Write(wxT("/VoiceKeyer/RxPause"), wxGetApp().m_intVoiceKeyerRxPause); - m_txtCtrlVoiceKeyerRepeats->GetValue().ToLong(&tmp); - if (tmp < 0) tmp = 0; if (tmp > 100) tmp = 100; - wxGetApp().m_intVoiceKeyerRepeats = (int)tmp; - pConfig->Write(wxT("/VoiceKeyer/Repeats"), wxGetApp().m_intVoiceKeyerRepeats); /* Hamlib settings. */ @@ -462,6 +407,7 @@ void ComPortsDlg::ExchangeData(int inout) if (s == "default") { wxGetApp().m_intHamlibSerialRate = 0; } else { + long tmp; m_cbSerialRate->GetValue().ToLong(&tmp); wxGetApp().m_intHamlibSerialRate = tmp; } @@ -522,25 +468,6 @@ void ComPortsDlg::OnApply(wxCommandEvent& event) ExchangeData(EXCHANGE_DATA_OUT); } - void ComPortsDlg::OnChooseVoiceKeyerWaveFile(wxCommandEvent& event) { - wxFileDialog openFileDialog( - this, - wxT("Voice Keyer wave file"), - wxGetApp().m_txtVoiceKeyerWaveFilePath, - wxEmptyString, - wxT("WAV files (*.wav)|*.wav"), - wxFD_SAVE - ); - if(openFileDialog.ShowModal() == wxID_CANCEL) { - return; // the user changed their mind... - } - - wxString fileName, extension; - wxGetApp().m_txtVoiceKeyerWaveFile = openFileDialog.GetPath(); - wxFileName::SplitPath(wxGetApp().m_txtVoiceKeyerWaveFile, &wxGetApp().m_txtVoiceKeyerWaveFilePath, &fileName, &extension); - m_txtCtrlVoiceKeyerWaveFile->SetValue(wxGetApp().m_txtVoiceKeyerWaveFile); -} - //------------------------------------------------------------------------- // OnCancel() //------------------------------------------------------------------------- diff --git a/freedv-dev/src/dlg_ptt.h b/freedv-dev/src/dlg_ptt.h index 623ec391..e4e5cda1 100644 --- a/freedv-dev/src/dlg_ptt.h +++ b/freedv-dev/src/dlg_ptt.h @@ -47,16 +47,8 @@ class ComPortsDlg : public wxDialog void ExchangeData(int inout); protected: - wxCheckBox* m_ckHalfDuplex; wxCheckBox* m_ckLeftChannelVoxTone; - /* Voice Keyer */ - - wxButton *m_buttonChooseVoiceKeyerWaveFile; - wxTextCtrl *m_txtCtrlVoiceKeyerWaveFile; - wxTextCtrl *m_txtCtrlVoiceKeyerRxPause; - wxTextCtrl *m_txtCtrlVoiceKeyerRepeats; - /* Hamlib settings.*/ wxCheckBox *m_ckUseHamlibPTT; @@ -90,8 +82,6 @@ protected: void PTTUseHamLibClicked(wxCommandEvent& event); void PTTUseSerialClicked(wxCommandEvent& event); - void OnChooseVoiceKeyerWaveFile(wxCommandEvent& event); - void OnOK(wxCommandEvent& event); void OnCancel(wxCommandEvent& event); void OnApply(wxCommandEvent& event);