Skip to content

Commit

Permalink
Merge pull request #835 from cjcliffe/bugfix/bookmark-issues-jun2020
Browse files Browse the repository at this point in the history
Bugfix/bookmark issues jun2020
  • Loading branch information
cjcliffe authored Jun 23, 2020
2 parents b564a0d + b4f2b61 commit 4cc0958
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 44 deletions.
4 changes: 2 additions & 2 deletions src/AppConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,15 +519,15 @@ 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;
}

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;
}
Expand Down
2 changes: 2 additions & 0 deletions src/forms/Bookmark/BookmarkPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );
Expand Down
13 changes: 7 additions & 6 deletions src/forms/Bookmark/BookmarkPanel.fbp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<property name="ui_table">UI</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Panel" expanded="0">
<object class="Panel" expanded="1">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
Expand All @@ -52,7 +52,7 @@
<event name="OnEnterWindow">onEnterWindow</event>
<event name="OnLeaveWindow">onLeaveWindow</event>
<event name="OnMotion">onMotion</event>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer1</property>
<property name="orient">wxVERTICAL</property>
Expand Down Expand Up @@ -325,11 +325,11 @@
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxPanel" expanded="0">
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
Expand Down Expand Up @@ -515,6 +515,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnKillFocus">onLabelKillFocus</event>
<event name="OnTextEnter">onLabelText</event>
</object>
</object>
Expand Down Expand Up @@ -889,11 +890,11 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxPanel" expanded="0">
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
Expand Down
1 change: 1 addition & 0 deletions src/forms/Bookmark/BookmarkPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }
Expand Down
45 changes: 11 additions & 34 deletions src/forms/Bookmark/BookmarkView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -165,7 +164,6 @@ BookmarkView::~BookmarkView() {

dragItem = nullptr;
dragItemId = nullptr;
editingLabel = false;

visualDragItem = nullptr;
nextEnt = nullptr;
Expand Down Expand Up @@ -668,9 +666,6 @@ void BookmarkView::onMenuItem(wxCommandEvent& event) {


bool BookmarkView::isMouseInView() {
if (editingLabel) {
return true;
}
if (m_labelText->HasFocus()) {
return true;
}
Expand Down Expand Up @@ -1171,11 +1166,18 @@ void BookmarkView::onTreeSelectChanging( wxTreeEvent& event ) {
}


void BookmarkView::onLabelKillFocus(wxFocusEvent &event) {
event.Skip();

wxCommandEvent dummyEvt;
onLabelText(dummyEvt);
}

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);
Expand All @@ -1201,6 +1203,8 @@ void BookmarkView::onLabelText( wxCommandEvent& /* event */ ) {
}
}
}

if (!m_treeView->HasFocus()) { m_treeView->SetFocus(); }
}


Expand Down Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -1328,10 +1319,6 @@ void BookmarkView::onRemoveRecent ( wxCommandEvent& /* event */ ) {
}

void BookmarkView::onClearRecents ( wxCommandEvent& /* event */ ) {

if (editingLabel) {
return;
}
doClearRecents();
}

Expand All @@ -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) {
Expand All @@ -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) {
Expand Down
3 changes: 1 addition & 2 deletions src/forms/Bookmark/BookmarkView.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -180,8 +181,6 @@ class BookmarkView : public BookmarkPanel {
wxTreeItemId dragItemId;
BookmarkViewVisualDragItem *visualDragItem;

bool editingLabel;

// Bookmarks
std::atomic_bool doUpdateBookmarks;
std::set< std::string > doUpdateBookmarkGroup;
Expand Down

0 comments on commit 4cc0958

Please # to comment.