Skip to content

Commit

Permalink
Enable use of space bar for PTT when in the FreeDV Reporter window.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmiw committed Jan 21, 2024
1 parent 943dad8 commit 13d1f23
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/gui/dialogs/freedv_reporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,11 @@ FreeDVReporterDialog::~FreeDVReporterDialog()
m_bandFilter->Disconnect(wxEVT_TEXT, wxCommandEventHandler(FreeDVReporterDialog::OnBandFilterChange), NULL, this);
}

bool FreeDVReporterDialog::isTextMessageFieldInFocus()
{
return m_statusMessage->HasFocus();
}

void FreeDVReporterDialog::refreshLayout()
{
int colOffset = 0;
Expand Down
2 changes: 2 additions & 0 deletions src/gui/dialogs/freedv_reporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ class FreeDVReporterDialog : public wxDialog

void setBandFilter(FilterFrequency freq);

bool isTextMessageFieldInFocus();

protected:

// Handlers for events.
Expand Down
7 changes: 6 additions & 1 deletion src/ongui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,12 @@ int MainApp::FilterEvent(wxEvent& event)
(((wxKeyEvent&)event).GetKeyCode() == WXK_SPACE))
{
// only use space to toggle PTT if we are running and no modal dialogs (like options) up
if (frame->m_RxRunning && frame->IsActive() && wxGetApp().appConfiguration.enableSpaceBarForPTT && !frame->isReceiveOnly()) {
bool mainWindowActive = frame->IsActive();
bool reporterActiveButNotUpdatingTextMessage =
frame->m_reporterDialog != nullptr && frame->m_reporterDialog->IsActive() &&
!frame->m_reporterDialog->isTextMessageFieldInFocus();
if (frame->m_RxRunning && (mainWindowActive || reporterActiveButNotUpdatingTextMessage) &&
wxGetApp().appConfiguration.enableSpaceBarForPTT && !frame->isReceiveOnly()) {

// space bar controls rx/rx if keyer not running
if (frame->vk_state == VK_IDLE) {
Expand Down

0 comments on commit 13d1f23

Please sign in to comment.