From c5652be14168efb802a16f79100d7c6c27011f4d Mon Sep 17 00:00:00 2001 From: "Charles J. Cliffe" Date: Wed, 17 Jun 2020 22:05:57 -0400 Subject: [PATCH 1/3] Possible workaround for label entry to keep it from breaking global key handler (Linux tested) --- src/forms/Bookmark/BookmarkPanel.cpp | 2 ++ src/forms/Bookmark/BookmarkPanel.fbp | 13 ++++---- src/forms/Bookmark/BookmarkPanel.h | 1 + src/forms/Bookmark/BookmarkView.cpp | 45 +++++++--------------------- src/forms/Bookmark/BookmarkView.h | 3 +- 5 files changed, 22 insertions(+), 42 deletions(-) diff --git a/src/forms/Bookmark/BookmarkPanel.cpp b/src/forms/Bookmark/BookmarkPanel.cpp index 4f45fc7e..aa9baeef 100644 --- a/src/forms/Bookmark/BookmarkPanel.cpp +++ b/src/forms/Bookmark/BookmarkPanel.cpp @@ -105,6 +105,7 @@ BookmarkPanel::BookmarkPanel( wxWindow* parent, wxWindowID id, const wxPoint& po m_treeView->Connect( wxEVT_COMMAND_TREE_ITEM_MENU, wxTreeEventHandler( BookmarkPanel::onTreeItemMenu ), NULL, this ); m_treeView->Connect( wxEVT_COMMAND_TREE_SEL_CHANGED, wxTreeEventHandler( BookmarkPanel::onTreeSelect ), NULL, this ); m_treeView->Connect( wxEVT_COMMAND_TREE_SEL_CHANGING, wxTreeEventHandler( BookmarkPanel::onTreeSelectChanging ), NULL, this ); + m_labelText->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( BookmarkPanel::onLabelKillFocus ), NULL, this ); m_labelText->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( BookmarkPanel::onLabelText ), NULL, this ); m_frequencyVal->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( BookmarkPanel::onDoubleClickFreq ), NULL, this ); m_bandwidthVal->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( BookmarkPanel::onDoubleClickBandwidth ), NULL, this ); @@ -133,6 +134,7 @@ BookmarkPanel::~BookmarkPanel() m_treeView->Disconnect( wxEVT_COMMAND_TREE_ITEM_MENU, wxTreeEventHandler( BookmarkPanel::onTreeItemMenu ), NULL, this ); m_treeView->Disconnect( wxEVT_COMMAND_TREE_SEL_CHANGED, wxTreeEventHandler( BookmarkPanel::onTreeSelect ), NULL, this ); m_treeView->Disconnect( wxEVT_COMMAND_TREE_SEL_CHANGING, wxTreeEventHandler( BookmarkPanel::onTreeSelectChanging ), NULL, this ); + m_labelText->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( BookmarkPanel::onLabelKillFocus ), NULL, this ); m_labelText->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( BookmarkPanel::onLabelText ), NULL, this ); m_frequencyVal->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( BookmarkPanel::onDoubleClickFreq ), NULL, this ); m_bandwidthVal->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( BookmarkPanel::onDoubleClickBandwidth ), NULL, this ); diff --git a/src/forms/Bookmark/BookmarkPanel.fbp b/src/forms/Bookmark/BookmarkPanel.fbp index 4cbe6094..533d3a9d 100644 --- a/src/forms/Bookmark/BookmarkPanel.fbp +++ b/src/forms/Bookmark/BookmarkPanel.fbp @@ -27,7 +27,7 @@ UI 0 0 - + 0 wxAUI_MGR_DEFAULT @@ -52,7 +52,7 @@ onEnterWindow onLeaveWindow onMotion - + bSizer1 wxVERTICAL @@ -325,11 +325,11 @@ - + 5 wxALL|wxEXPAND 0 - + 1 1 1 @@ -515,6 +515,7 @@ + onLabelKillFocus onLabelText @@ -889,11 +890,11 @@ - + 5 wxALL|wxEXPAND 0 - + 1 1 1 diff --git a/src/forms/Bookmark/BookmarkPanel.h b/src/forms/Bookmark/BookmarkPanel.h index b02e9c17..4f305204 100644 --- a/src/forms/Bookmark/BookmarkPanel.h +++ b/src/forms/Bookmark/BookmarkPanel.h @@ -70,6 +70,7 @@ class BookmarkPanel : public wxPanel virtual void onTreeItemMenu( wxTreeEvent& event ) { event.Skip(); } virtual void onTreeSelect( wxTreeEvent& event ) { event.Skip(); } virtual void onTreeSelectChanging( wxTreeEvent& event ) { event.Skip(); } + virtual void onLabelKillFocus( wxFocusEvent& event ) { event.Skip(); } virtual void onLabelText( wxCommandEvent& event ) { event.Skip(); } virtual void onDoubleClickFreq( wxMouseEvent& event ) { event.Skip(); } virtual void onDoubleClickBandwidth( wxMouseEvent& event ) { event.Skip(); } diff --git a/src/forms/Bookmark/BookmarkView.cpp b/src/forms/Bookmark/BookmarkView.cpp index a4d59ba2..94f2230f 100644 --- a/src/forms/Bookmark/BookmarkView.cpp +++ b/src/forms/Bookmark/BookmarkView.cpp @@ -146,8 +146,7 @@ BookmarkView::BookmarkView( wxWindow* parent, wxWindowID id, const wxPoint& pos, bookmarkChoice = nullptr; dragItem = nullptr; dragItemId = nullptr; - editingLabel = false; - + m_clearSearchButton->Hide(); hideProps(); @@ -165,7 +164,6 @@ BookmarkView::~BookmarkView() { dragItem = nullptr; dragItemId = nullptr; - editingLabel = false; visualDragItem = nullptr; nextEnt = nullptr; @@ -668,9 +666,6 @@ void BookmarkView::onMenuItem(wxCommandEvent& event) { bool BookmarkView::isMouseInView() { - if (editingLabel) { - return true; - } if (m_labelText->HasFocus()) { return true; } @@ -1171,11 +1166,20 @@ void BookmarkView::onTreeSelectChanging( wxTreeEvent& event ) { } +void BookmarkView::onLabelKillFocus(wxFocusEvent &event) { + event.Skip(); + + wxCommandEvent dummyEvt; + onLabelText(dummyEvt); + + if (!m_treeView->HasFocus()) { m_treeView->SetFocus(); } +} + void BookmarkView::onLabelText( wxCommandEvent& /* event */ ) { std::wstring newLabel = m_labelText->GetValue().ToStdWstring(); TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection()); - + if (curSel != nullptr) { if (curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) { curSel->demod->setDemodulatorUserLabel(newLabel); @@ -1233,9 +1237,6 @@ void BookmarkView::onRemoveActive( wxCommandEvent& /* event */ ) { TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection()); if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) { - if (editingLabel) { - return; - } doRemoveActive(curSel->demod); } } @@ -1270,11 +1271,6 @@ void BookmarkView::onStopRecording( wxCommandEvent& /* event */ ) { void BookmarkView::onRemoveBookmark( wxCommandEvent& /* event */ ) { - - if (editingLabel) { - return; - } - TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection()); if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_BOOKMARK) { @@ -1310,11 +1306,6 @@ void BookmarkView::onActivateRecent( wxCommandEvent& /* event */ ) { void BookmarkView::onRemoveRecent ( wxCommandEvent& /* event */ ) { - - if (editingLabel) { - return; - } - TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection()); if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RECENT) { @@ -1328,10 +1319,6 @@ void BookmarkView::onRemoveRecent ( wxCommandEvent& /* event */ ) { } void BookmarkView::onClearRecents ( wxCommandEvent& /* event */ ) { - - if (editingLabel) { - return; - } doClearRecents(); } @@ -1347,11 +1334,6 @@ void BookmarkView::onAddGroup( wxCommandEvent& /* event */ ) { void BookmarkView::onRemoveGroup( wxCommandEvent& /* event */ ) { - - if (editingLabel) { - return; - } - TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection()); if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_GROUP) { @@ -1372,11 +1354,6 @@ void BookmarkView::onAddRange( wxCommandEvent& /* event */ ) { void BookmarkView::onRemoveRange( wxCommandEvent& /* event */ ) { - - if (editingLabel) { - return; - } - TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection()); if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RANGE) { diff --git a/src/forms/Bookmark/BookmarkView.h b/src/forms/Bookmark/BookmarkView.h index fd87e331..1afbc24e 100644 --- a/src/forms/Bookmark/BookmarkView.h +++ b/src/forms/Bookmark/BookmarkView.h @@ -113,6 +113,7 @@ class BookmarkView : public BookmarkPanel { void onTreeItemMenu( wxTreeEvent& event ); void onTreeSelect( wxTreeEvent& event ); void onTreeSelectChanging( wxTreeEvent& event ); + void onLabelKillFocus(wxFocusEvent& event ); void onLabelText( wxCommandEvent& event ); void onDoubleClickFreq( wxMouseEvent& event ); void onDoubleClickBandwidth( wxMouseEvent& event ); @@ -180,8 +181,6 @@ class BookmarkView : public BookmarkPanel { wxTreeItemId dragItemId; BookmarkViewVisualDragItem *visualDragItem; - bool editingLabel; - // Bookmarks std::atomic_bool doUpdateBookmarks; std::set< std::string > doUpdateBookmarkGroup; From 50f2bb18ebedd7824491be77b78192933aa82cbf Mon Sep 17 00:00:00 2001 From: "Charles J. Cliffe" Date: Mon, 22 Jun 2020 23:26:04 -0400 Subject: [PATCH 2/3] Fix enter handling on mac --- src/forms/Bookmark/BookmarkView.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/forms/Bookmark/BookmarkView.cpp b/src/forms/Bookmark/BookmarkView.cpp index 94f2230f..ae6892e5 100644 --- a/src/forms/Bookmark/BookmarkView.cpp +++ b/src/forms/Bookmark/BookmarkView.cpp @@ -1171,8 +1171,6 @@ void BookmarkView::onLabelKillFocus(wxFocusEvent &event) { wxCommandEvent dummyEvt; onLabelText(dummyEvt); - - if (!m_treeView->HasFocus()) { m_treeView->SetFocus(); } } void BookmarkView::onLabelText( wxCommandEvent& /* event */ ) { @@ -1205,6 +1203,8 @@ void BookmarkView::onLabelText( wxCommandEvent& /* event */ ) { } } } + + if (!m_treeView->HasFocus()) { m_treeView->SetFocus(); } } From b4f2b611eb6913e7ce5f4d5981e8950689862b8b Mon Sep 17 00:00:00 2001 From: "Charles J. Cliffe" Date: Mon, 22 Jun 2020 23:36:39 -0400 Subject: [PATCH 3/3] Update recording notification message --- src/AppConfig.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AppConfig.cpp b/src/AppConfig.cpp index 25676451..1a84b7de 100644 --- a/src/AppConfig.cpp +++ b/src/AppConfig.cpp @@ -519,7 +519,7 @@ bool AppConfig::verifyRecordingPath() { string recPathStr = wxGetApp().getConfig()->getRecordingPath(); if (recPathStr.empty()) { - wxMessageBox( wxT("Recording path is not set. Please use 'Set Recording Path' from the 'File' Menu."), wxT("Recording Path Error"), wxICON_INFORMATION); + wxMessageBox( wxT("Recording path is not set. Please use 'Set Recording Path' from the 'Recording' Menu."), wxT("Recording Path Error"), wxICON_INFORMATION); return false; } @@ -527,7 +527,7 @@ bool AppConfig::verifyRecordingPath() { wxFileName recPath(recPathStr); if (!recPath.Exists() || !recPath.IsDirWritable()) { - wxMessageBox( wxT("Recording path does not exist or is not writable. Please use 'Set Recording Path' from the 'File' Menu."), wxT("Recording Path Error"), wxICON_INFORMATION); + wxMessageBox( wxT("Recording path does not exist or is not writable. Please use 'Set Recording Path' from the 'Recording' Menu."), wxT("Recording Path Error"), wxICON_INFORMATION); return false; }