diff --git a/USER_MANUAL.md b/USER_MANUAL.md index ba6783796..18c48fc22 100644 --- a/USER_MANUAL.md +++ b/USER_MANUAL.md @@ -893,7 +893,9 @@ LDPC | Low Density Parity Check Codes - a family of powerful FEC codes 1. Bugfixes: * Prevent unnecessary recreation of resamplers in analog mode. (PR #661) - +2. Enhancements: + * Add Frequency column to RX drop-down. (PR #663) + ## V1.9.7.2 January 2024 1. Bugfixes: diff --git a/src/main.cpp b/src/main.cpp index a00bfeddd..6b23035ab 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1438,7 +1438,21 @@ void MainFrame::OnTimer(wxTimerEvent &evt) std::string pendingCallsign = rxCallsign.ToStdString(); auto pendingSnr = (int)(g_snr + 0.5); - if (m_lastReportedCallsignListView->GetItemCount() == 0 || m_lastReportedCallsignListView->GetItemText(0, 0) != rxCallsign) + wxString freqString; + if (wxGetApp().appConfiguration.reportingConfiguration.reportingFrequencyAsKhz) + { + double freq = wxGetApp().appConfiguration.reportingConfiguration.reportingFrequency.get() / 1000.0; + freqString = wxString::Format("%.01f", freq); + } + else + { + double freq = wxGetApp().appConfiguration.reportingConfiguration.reportingFrequency.get() / 1000000.0; + freqString = wxString::Format("%.04f", freq); + } + + if (m_lastReportedCallsignListView->GetItemCount() == 0 || + m_lastReportedCallsignListView->GetItemText(0, 0) != rxCallsign || + m_lastReportedCallsignListView->GetItemText(0, 1) != freqString) { auto currentTime = wxDateTime::Now(); wxString currentTimeAsString = ""; @@ -1450,13 +1464,14 @@ void MainFrame::OnTimer(wxTimerEvent &evt) currentTimeAsString.Printf(wxT("%s %s"), currentTime.FormatISODate(), currentTime.FormatISOTime()); auto index = m_lastReportedCallsignListView->InsertItem(0, rxCallsign, 0); - m_lastReportedCallsignListView->SetItem(index, 1, currentTimeAsString); + m_lastReportedCallsignListView->SetItem(index, 1, freqString); + m_lastReportedCallsignListView->SetItem(index, 2, currentTimeAsString); } wxString snrAsString; snrAsString.Printf(wxT("%0.1f"), g_snr); auto index = m_lastReportedCallsignListView->GetTopItem(); - m_lastReportedCallsignListView->SetItem(index, 2, snrAsString); + m_lastReportedCallsignListView->SetItem(index, 3, snrAsString); m_cboLastReportedCallsigns->SetText(rxCallsign); m_cboLastReportedCallsigns->Enable(m_lastReportedCallsignListView->GetItemCount() > 0); diff --git a/src/ongui.cpp b/src/ongui.cpp index feff0df75..3b8dda9b5 100644 --- a/src/ongui.cpp +++ b/src/ongui.cpp @@ -189,6 +189,8 @@ void MainFrame::OnToolsFilter(wxCommandEvent& event) //------------------------------------------------------------------------- void MainFrame::OnToolsOptions(wxCommandEvent& event) { + bool oldFreqAsKHz = wxGetApp().appConfiguration.reportingConfiguration.reportingFrequencyAsKhz; + wxUnusedVar(event); if (optionsDlg->ShowModal() == wxOK) { @@ -226,7 +228,33 @@ void MainFrame::OnToolsOptions(wxCommandEvent& event) { m_freqBox->SetLabel(_("Report Freq. (MHz)")); } - + + // If the "Frequency as kHz" option has changed, update the frequencies + // in the main window's callsign list. + if (oldFreqAsKHz != wxGetApp().appConfiguration.reportingConfiguration.reportingFrequencyAsKhz) + { + for (int index = 0; index < m_lastReportedCallsignListView->GetItemCount(); index++) + { + wxString newFreq = ""; + wxString freq = m_lastReportedCallsignListView->GetItemText(index, 1); + double freqDouble = 0; + freq.ToDouble(&freqDouble); + + if (wxGetApp().appConfiguration.reportingConfiguration.reportingFrequencyAsKhz) + { + freqDouble *= 1000.0; + newFreq = wxString::Format("%.01f", freqDouble); + } + else + { + freqDouble /= 1000.0; + newFreq = wxString::Format("%.04f", freqDouble); + } + + m_lastReportedCallsignListView->SetItem(index, 1, newFreq); + } + } + // Initialize FreeDV Reporter if required. initializeFreeDVReporter_(); diff --git a/src/topFrame.cpp b/src/topFrame.cpp index 3d48775b2..a04d66b39 100644 --- a/src/topFrame.cpp +++ b/src/topFrame.cpp @@ -582,9 +582,10 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const m_cboLastReportedCallsigns->SetPopupControl(m_lastReportedCallsignListView); m_cboLastReportedCallsigns->SetSizeHints(wxSize(100,-1)); - m_lastReportedCallsignListView->InsertColumn(0, wxT("Callsign"), wxLIST_FORMAT_LEFT, 125); - m_lastReportedCallsignListView->InsertColumn(1, wxT("Date/Time"), wxLIST_FORMAT_CENTRE, 175); - m_lastReportedCallsignListView->InsertColumn(2, wxT("SNR (dB)"), wxLIST_FORMAT_CENTRE, 75); + m_lastReportedCallsignListView->InsertColumn(0, wxT("Callsign"), wxLIST_FORMAT_LEFT, 100); + m_lastReportedCallsignListView->InsertColumn(1, wxT("Frequency"), wxLIST_FORMAT_RIGHT, 75); + m_lastReportedCallsignListView->InsertColumn(2, wxT("Date/Time"), wxLIST_FORMAT_LEFT, 175); + m_lastReportedCallsignListView->InsertColumn(3, wxT("SNR"), wxLIST_FORMAT_RIGHT, 50); bSizer15->Add(m_txtCtrlCallSign, 1, wxALL|wxEXPAND, 5); bSizer15->Add(m_cboLastReportedCallsigns, 1, wxALL|wxEXPAND, 5);