Clean-up some error-prone prototype cruft

This commit is contained in:
Charles J. Cliffe 2016-12-15 21:53:51 -05:00
parent 2cc05baaa1
commit 5924ebc057
3 changed files with 112 additions and 106 deletions

View File

@ -186,6 +186,10 @@ void BookmarkMgr::removeGroup(std::string group) {
} }
void BookmarkMgr::renameGroup(std::string group, std::string ngroup) { void BookmarkMgr::renameGroup(std::string group, std::string ngroup) {
if (group == ngroup) {
return;
}
std::lock_guard < std::mutex > lock(busy_lock); std::lock_guard < std::mutex > lock(busy_lock);
BookmarkMap::iterator i = bmData.find(group); BookmarkMap::iterator i = bmData.find(group);

View File

@ -29,8 +29,6 @@ BookmarkView::BookmarkView( wxWindow* parent, wxWindowID id, const wxPoint& pos,
doUpdateActive.store(true); doUpdateActive.store(true);
doUpdateBookmarks.store(true); doUpdateBookmarks.store(true);
bookmarkChoice = nullptr; bookmarkChoice = nullptr;
activeSel = nullptr;
recentSel = nullptr;
dragItem = nullptr; dragItem = nullptr;
dragItemId = nullptr; dragItemId = nullptr;
editingLabel = false; editingLabel = false;
@ -100,9 +98,10 @@ void BookmarkView::updateBookmarks(std::string group) {
doUpdateBookmarks.store(true); doUpdateBookmarks.store(true);
} }
wxTreeItemId BookmarkView::refreshBookmarks() { wxTreeItemId BookmarkView::refreshBookmarks() {
TreeViewItem *prevSel = itemToTVI(m_treeView->GetSelection());
BookmarkNames groupNames; BookmarkNames groupNames;
wxGetApp().getBookmarkMgr().getGroups(groupNames); wxGetApp().getBookmarkMgr().getGroups(groupNames);
@ -130,7 +129,7 @@ wxTreeItemId BookmarkView::refreshBookmarks() {
wxTreeItemId group_itm = m_treeView->AppendItem(bookmarkBranch, gn_i); wxTreeItemId group_itm = m_treeView->AppendItem(bookmarkBranch, gn_i);
m_treeView->SetItemData(group_itm, tvi); m_treeView->SetItemData(group_itm, tvi);
groups[gn_i] = group_itm; groups[gn_i] = group_itm;
if (gn_i == groupSel) { if (prevSel != nullptr && prevSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_GROUP && gn_i == prevSel->groupName) {
bmSelFound = group_itm; bmSelFound = group_itm;
} }
} }
@ -166,7 +165,7 @@ wxTreeItemId BookmarkView::refreshBookmarks() {
wxTreeItemId itm = m_treeView->AppendItem(groupItem, labelVal); wxTreeItemId itm = m_treeView->AppendItem(groupItem, labelVal);
m_treeView->SetItemData(itm, tvi); m_treeView->SetItemData(itm, tvi);
if (bookmarkSel == bmEnt && groupExpanded) { if (prevSel != nullptr && prevSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_BOOKMARK && prevSel->bookmarkEnt == bmEnt && groupExpanded) {
bmSelFound = itm; bmSelFound = itm;
} }
} }
@ -187,6 +186,8 @@ void BookmarkView::doUpdateActiveList() {
DemodulatorInstance *activeDemodulator = wxGetApp().getDemodMgr().getActiveDemodulator(); DemodulatorInstance *activeDemodulator = wxGetApp().getDemodMgr().getActiveDemodulator();
// DemodulatorInstance *lastActiveDemodulator = wxGetApp().getDemodMgr().getLastActiveDemodulator(); // DemodulatorInstance *lastActiveDemodulator = wxGetApp().getDemodMgr().getLastActiveDemodulator();
TreeViewItem *prevSel = itemToTVI(m_treeView->GetSelection());
// Actives // Actives
m_treeView->DeleteChildren(activeBranch); m_treeView->DeleteChildren(activeBranch);
@ -210,10 +211,9 @@ void BookmarkView::doUpdateActiveList() {
if (activeDemodulator) { if (activeDemodulator) {
if (activeDemodulator == demod_i && activeExpandState) { if (activeDemodulator == demod_i && activeExpandState) {
selItem = itm; selItem = itm;
activeSel = demod_i;
} }
} }
else if (activeSel == demod_i && activeExpandState) { else if (prevSel != nullptr && prevSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE && prevSel->demod == demod_i && activeExpandState) {
selItem = itm; selItem = itm;
} }
} }
@ -238,7 +238,7 @@ void BookmarkView::doUpdateActiveList() {
wxTreeItemId itm = m_treeView->AppendItem(recentBranch, labelVal); wxTreeItemId itm = m_treeView->AppendItem(recentBranch, labelVal);
m_treeView->SetItemData(itm, tvi); m_treeView->SetItemData(itm, tvi);
if (recentSel == bmr_i && recentExpandState) { if (prevSel && prevSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RECENT && prevSel->bookmarkEnt == bmr_i && recentExpandState) {
selItem = itm; selItem = itm;
} }
} }
@ -292,8 +292,8 @@ void BookmarkView::onTreeEndLabelEdit( wxTreeEvent& event ) {
tvi->demod->setDemodulatorUserLabel(newText); tvi->demod->setDemodulatorUserLabel(newText);
wxGetApp().getBookmarkMgr().updateActiveList(); wxGetApp().getBookmarkMgr().updateActiveList();
} else if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RECENT) { } else if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RECENT) {
recentSel->label = newText; tvi->bookmarkEnt->label = newText;
recentSel->node->child("user_label")->element()->set(newText); tvi->bookmarkEnt->node->child("user_label")->element()->set(newText);
wxGetApp().getBookmarkMgr().updateActiveList(); wxGetApp().getBookmarkMgr().updateActiveList();
} else if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_BOOKMARK) { } else if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_BOOKMARK) {
tvi->bookmarkEnt->label = newText; tvi->bookmarkEnt->label = newText;
@ -302,8 +302,6 @@ void BookmarkView::onTreeEndLabelEdit( wxTreeEvent& event ) {
} else if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_GROUP) { } else if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_GROUP) {
std::string newGroup = m_treeView->GetEditControl()->GetValue().ToStdString(); std::string newGroup = m_treeView->GetEditControl()->GetValue().ToStdString();
wxGetApp().getBookmarkMgr().renameGroup(tvi->groupName, newGroup); wxGetApp().getBookmarkMgr().renameGroup(tvi->groupName, newGroup);
groupSel = newGroup;
wxGetApp().getBookmarkMgr().renameGroup(tvi->groupName, groupSel);
wxGetApp().getBookmarkMgr().updateBookmarks(); wxGetApp().getBookmarkMgr().updateBookmarks();
} }
} }
@ -319,16 +317,14 @@ void BookmarkView::onTreeActivate( wxTreeEvent& event ) {
wxGetApp().setFrequency(tvi->demod->getFrequency()); wxGetApp().setFrequency(tvi->demod->getFrequency());
wxGetApp().getDemodMgr().setActiveDemodulator(tvi->demod,false); wxGetApp().getDemodMgr().setActiveDemodulator(tvi->demod,false);
} }
} else if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RECENT) {
wxGetApp().getBookmarkMgr().removeRecent(tvi->bookmarkEnt);
activateBookmark(tvi->bookmarkEnt);
wxGetApp().getBookmarkMgr().updateActiveList();
} else if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_BOOKMARK) {
activateBookmark(tvi->bookmarkEnt);
} }
} }
if (recentSel) {
wxGetApp().getBookmarkMgr().removeRecent(recentSel);
activateBookmark(recentSel);
wxGetApp().getBookmarkMgr().updateActiveList();
}
if (bookmarkSel) {
activateBookmark(bookmarkSel);
}
} }
@ -465,7 +461,9 @@ void BookmarkView::updateBookmarkChoices() {
if (!bookmarkChoices.empty()) { if (!bookmarkChoices.empty()) {
bookmarkChoices.erase(bookmarkChoices.begin(),bookmarkChoices.end()); bookmarkChoices.erase(bookmarkChoices.begin(),bookmarkChoices.end());
} }
bookmarkChoices.push_back((bookmarkSel!=nullptr)?BOOKMARK_VIEW_CHOICE_MOVE:BOOKMARK_VIEW_CHOICE_DEFAULT); TreeViewItem *activeSel = itemToTVI(m_treeView->GetSelection());
bookmarkChoices.push_back(((activeSel != nullptr && activeSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_BOOKMARK))?BOOKMARK_VIEW_CHOICE_MOVE:BOOKMARK_VIEW_CHOICE_DEFAULT);
wxGetApp().getBookmarkMgr().getGroups(bookmarkChoices); wxGetApp().getBookmarkMgr().getGroups(bookmarkChoices);
bookmarkChoices.push_back(BOOKMARK_VIEW_CHOICE_NEW); bookmarkChoices.push_back(BOOKMARK_VIEW_CHOICE_NEW);
} }
@ -479,6 +477,8 @@ void BookmarkView::addBookmarkChoice(wxWindow *parent) {
void BookmarkView::onBookmarkChoice( wxCommandEvent &event ) { void BookmarkView::onBookmarkChoice( wxCommandEvent &event ) {
TreeViewItem *tvi = itemToTVI(m_treeView->GetSelection());
int numSel = bookmarkChoice->GetCount(); int numSel = bookmarkChoice->GetCount();
int sel = bookmarkChoice->GetSelection(); int sel = bookmarkChoice->GetSelection();
@ -499,25 +499,21 @@ void BookmarkView::onBookmarkChoice( wxCommandEvent &event ) {
return; return;
} }
groupSel = stringVal; if (tvi != nullptr) {
if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) {
if (activeSel) { doBookmarkActive(stringVal.ToStdString(), tvi->demod);
doBookmarkActive(groupSel, activeSel); }
} if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RECENT) {
if (recentSel) { doBookmarkRecent(stringVal.ToStdString(), tvi->bookmarkEnt);
doBookmarkRecent(groupSel, recentSel); }
} if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_BOOKMARK) {
if (bookmarkSel && groupSel != "") { doMoveBookmark(tvi->bookmarkEnt, stringVal.ToStdString());
doMoveBookmark(bookmarkSel, groupSel); }
} }
} }
void BookmarkView::activeSelection(DemodulatorInstance *dsel) { void BookmarkView::activeSelection(DemodulatorInstance *dsel) {
activeSel = dsel;
bookmarkSel = nullptr;
recentSel = nullptr;
groupSel = "";
m_frequencyVal->SetLabelText(frequencyToStr(dsel->getFrequency())); m_frequencyVal->SetLabelText(frequencyToStr(dsel->getFrequency()));
m_bandwidthVal->SetLabelText(frequencyToStr(dsel->getBandwidth())); m_bandwidthVal->SetLabelText(frequencyToStr(dsel->getBandwidth()));
@ -552,6 +548,8 @@ void BookmarkView::activeSelection(DemodulatorInstance *dsel) {
void BookmarkView::activateBookmark(BookmarkEntry *bmEnt) { void BookmarkView::activateBookmark(BookmarkEntry *bmEnt) {
DemodulatorInstance *newDemod = wxGetApp().getDemodMgr().loadInstance(bmEnt->node); DemodulatorInstance *newDemod = wxGetApp().getDemodMgr().loadInstance(bmEnt->node);
TreeViewItem *sel = itemToTVI(m_treeView->GetSelection());
long long freq = newDemod->getFrequency(); long long freq = newDemod->getFrequency();
long long currentFreq = wxGetApp().getFrequency(); long long currentFreq = wxGetApp().getFrequency();
long long currentRate = wxGetApp().getSampleRate(); long long currentRate = wxGetApp().getSampleRate();
@ -563,19 +561,11 @@ void BookmarkView::activateBookmark(BookmarkEntry *bmEnt) {
newDemod->run(); newDemod->run();
newDemod->setActive(true); newDemod->setActive(true);
wxGetApp().bindDemodulator(newDemod); wxGetApp().bindDemodulator(newDemod);
if (bmEnt == recentSel) {
activeSel = newDemod;
recentSel = nullptr;
}
doUpdateActiveList(); doUpdateActiveList();
} }
void BookmarkView::bookmarkSelection(BookmarkEntry *bmSel) { void BookmarkView::bookmarkSelection(BookmarkEntry *bmSel) {
bookmarkSel = bmSel;
recentSel = nullptr;
activeSel = nullptr;
groupSel = "";
m_frequencyVal->SetLabelText(frequencyToStr(bmSel->frequency)); m_frequencyVal->SetLabelText(frequencyToStr(bmSel->frequency));
m_bandwidthVal->SetLabelText(frequencyToStr(bmSel->bandwidth)); m_bandwidthVal->SetLabelText(frequencyToStr(bmSel->bandwidth));
@ -609,10 +599,6 @@ void BookmarkView::bookmarkSelection(BookmarkEntry *bmSel) {
void BookmarkView::recentSelection(BookmarkEntry *bmSel) { void BookmarkView::recentSelection(BookmarkEntry *bmSel) {
recentSel = bmSel;
activeSel = nullptr;
bookmarkSel = nullptr;
groupSel = "";
m_frequencyVal->SetLabelText(frequencyToStr(bmSel->frequency)); m_frequencyVal->SetLabelText(frequencyToStr(bmSel->frequency));
m_bandwidthVal->SetLabelText(frequencyToStr(bmSel->bandwidth)); m_bandwidthVal->SetLabelText(frequencyToStr(bmSel->bandwidth));
@ -644,10 +630,6 @@ void BookmarkView::recentSelection(BookmarkEntry *bmSel) {
} }
void BookmarkView::groupSelection(std::string groupName) { void BookmarkView::groupSelection(std::string groupName) {
recentSel = nullptr;
activeSel = nullptr;
bookmarkSel = nullptr;
groupSel = groupName;
clearButtons(); clearButtons();
@ -669,10 +651,6 @@ void BookmarkView::groupSelection(std::string groupName) {
void BookmarkView::bookmarkBranchSelection() { void BookmarkView::bookmarkBranchSelection() {
recentSel = nullptr;
activeSel = nullptr;
bookmarkSel = nullptr;
groupSel = "";
clearButtons(); clearButtons();
hideProps(); hideProps();
@ -741,20 +719,24 @@ void BookmarkView::onTreeSelectChanging( wxTreeEvent& event ) {
void BookmarkView::onLabelText( wxCommandEvent& event ) { void BookmarkView::onLabelText( wxCommandEvent& event ) {
std::wstring newLabel = m_labelText->GetValue().ToStdWstring(); std::wstring newLabel = m_labelText->GetValue().ToStdWstring();
TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
if (activeSel) { if (curSel != nullptr) {
activeSel->setDemodulatorUserLabel(newLabel); if (curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) {
wxGetApp().getBookmarkMgr().updateActiveList(); curSel->demod->setDemodulatorUserLabel(newLabel);
} else if (bookmarkSel) { wxGetApp().getBookmarkMgr().updateActiveList();
bookmarkSel->label = m_labelText->GetValue().ToStdWstring(); } else if (curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_BOOKMARK) {
bookmarkSel->node->child("user_label")->element()->set(newLabel); curSel->bookmarkEnt->label = m_labelText->GetValue().ToStdWstring();
wxGetApp().getBookmarkMgr().updateBookmarks(); curSel->bookmarkEnt->node->child("user_label")->element()->set(newLabel);
} else if (recentSel) { wxGetApp().getBookmarkMgr().updateBookmarks();
recentSel->label = m_labelText->GetValue().ToStdWstring(); } else if (curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RECENT) {
recentSel->node->child("user_label")->element()->set(newLabel); curSel->bookmarkEnt->label = m_labelText->GetValue().ToStdWstring();
wxGetApp().getBookmarkMgr().updateActiveList(); curSel->bookmarkEnt->node->child("user_label")->element()->set(newLabel);
wxGetApp().getBookmarkMgr().updateActiveList();
}
} }
// else if (groupSel != "") {
// else if (groupSel != "") {
// std::string newGroupName = m_labelText->GetValue().ToStdString(); // std::string newGroupName = m_labelText->GetValue().ToStdString();
// wxGetApp().getBookmarkMgr().renameGroup(groupSel, newGroupName); // wxGetApp().getBookmarkMgr().renameGroup(groupSel, newGroupName);
// groupSel = newGroupName; // groupSel = newGroupName;
@ -764,30 +746,36 @@ void BookmarkView::onLabelText( wxCommandEvent& event ) {
void BookmarkView::onDoubleClickFreq( wxMouseEvent& event ) { void BookmarkView::onDoubleClickFreq( wxMouseEvent& event ) {
if (activeSel) { TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
wxGetApp().getDemodMgr().setActiveDemodulator(activeSel, false);
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) {
wxGetApp().getDemodMgr().setActiveDemodulator(curSel->demod, false);
wxGetApp().showFrequencyInput(FrequencyDialog::FrequencyDialogTarget::FDIALOG_TARGET_DEFAULT); wxGetApp().showFrequencyInput(FrequencyDialog::FrequencyDialogTarget::FDIALOG_TARGET_DEFAULT);
} }
} }
void BookmarkView::onDoubleClickBandwidth( wxMouseEvent& event ) { void BookmarkView::onDoubleClickBandwidth( wxMouseEvent& event ) {
if (activeSel) { TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
wxGetApp().getDemodMgr().setActiveDemodulator(activeSel, false);
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) {
wxGetApp().getDemodMgr().setActiveDemodulator(curSel->demod, false);
wxGetApp().showFrequencyInput(FrequencyDialog::FrequencyDialogTarget::FDIALOG_TARGET_BANDWIDTH); wxGetApp().showFrequencyInput(FrequencyDialog::FrequencyDialogTarget::FDIALOG_TARGET_BANDWIDTH);
} }
} }
void BookmarkView::onRemoveActive( wxCommandEvent& event ) { void BookmarkView::onRemoveActive( wxCommandEvent& event ) {
if (activeSel != nullptr) { TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) {
if (editingLabel) { if (editingLabel) {
return; return;
} }
wxGetApp().getDemodMgr().setActiveDemodulator(nullptr, false); wxGetApp().getDemodMgr().setActiveDemodulator(nullptr, false);
wxGetApp().removeDemodulator(activeSel); wxGetApp().removeDemodulator(curSel->demod);
wxGetApp().getDemodMgr().deleteThread(activeSel); wxGetApp().getDemodMgr().deleteThread(curSel->demod);
activeSel = nullptr; m_treeView->Delete(m_treeView->GetSelection());
} }
} }
@ -796,27 +784,34 @@ void BookmarkView::onRemoveBookmark( wxCommandEvent& event ) {
if (editingLabel) { if (editingLabel) {
return; return;
} }
if (bookmarkSel) {
wxGetApp().getBookmarkMgr().removeBookmark(bookmarkSel); TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
bookmarkSel = nullptr;
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_BOOKMARK) {
wxGetApp().getBookmarkMgr().removeBookmark(curSel->bookmarkEnt);
m_treeView->Delete(m_treeView->GetSelection());
wxGetApp().getBookmarkMgr().updateBookmarks(); wxGetApp().getBookmarkMgr().updateBookmarks();
} }
} }
void BookmarkView::onActivateBookmark( wxCommandEvent& event ) { void BookmarkView::onActivateBookmark( wxCommandEvent& event ) {
if (bookmarkSel) { TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
activateBookmark(bookmarkSel);
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_BOOKMARK) {
activateBookmark(curSel->bookmarkEnt);
} }
} }
void BookmarkView::onActivateRecent( wxCommandEvent& event ) { void BookmarkView::onActivateRecent( wxCommandEvent& event ) {
if (recentSel) { TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
wxGetApp().getBookmarkMgr().removeRecent(recentSel);
activateBookmark(recentSel); if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RECENT) {
wxGetApp().getBookmarkMgr().removeRecent(curSel->bookmarkEnt);
activateBookmark(curSel->bookmarkEnt);
m_treeView->Delete(m_treeView->GetSelection());
wxGetApp().getBookmarkMgr().updateActiveList(); wxGetApp().getBookmarkMgr().updateActiveList();
recentSel = nullptr;
} }
} }
@ -826,7 +821,6 @@ void BookmarkView::onAddGroup( wxCommandEvent& event ) {
if (stringVal.ToStdString() != "") { if (stringVal.ToStdString() != "") {
wxGetApp().getBookmarkMgr().addGroup(stringVal.ToStdString()); wxGetApp().getBookmarkMgr().addGroup(stringVal.ToStdString());
wxGetApp().getBookmarkMgr().updateBookmarks(); wxGetApp().getBookmarkMgr().updateBookmarks();
groupSel = stringVal;
} }
} }
@ -835,33 +829,33 @@ void BookmarkView::onRemoveGroup( wxCommandEvent& event ) {
if (editingLabel) { if (editingLabel) {
return; return;
} }
if (groupSel == "") {
return; TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_GROUP) {
wxGetApp().getBookmarkMgr().removeGroup(curSel->groupName);
m_treeView->Delete(m_treeView->GetSelection());
wxGetApp().getBookmarkMgr().updateBookmarks();
} }
wxGetApp().getBookmarkMgr().removeGroup(groupSel);
groupSel = "";
wxGetApp().getBookmarkMgr().updateBookmarks();
} }
void BookmarkView::onRenameGroup( wxCommandEvent& event ) { void BookmarkView::onRenameGroup( wxCommandEvent& event ) {
if (groupSel == "") { TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
if (!curSel || curSel->type != TreeViewItem::TREEVIEW_ITEM_TYPE_GROUP) {
return; return;
} }
wxString stringVal = ""; wxString stringVal = "";
stringVal = wxGetTextFromUser("Rename Group", "New Group Name", groupSel); stringVal = wxGetTextFromUser("Rename Group", "New Group Name", curSel->groupName);
std::string newGroupName = stringVal.ToStdString(); std::string newGroupName = stringVal.ToStdString();
wxGetApp().getBookmarkMgr().renameGroup(groupSel, newGroupName); wxGetApp().getBookmarkMgr().renameGroup(curSel->groupName, newGroupName);
groupSel = newGroupName; m_treeView->Delete(m_treeView->GetSelection());
wxGetApp().getBookmarkMgr().updateBookmarks(); wxGetApp().getBookmarkMgr().updateBookmarks();
} }
@ -983,3 +977,15 @@ void BookmarkView::onEnterWindow( wxMouseEvent& event ) {
void BookmarkView::onLeaveWindow( wxMouseEvent& event ) { void BookmarkView::onLeaveWindow( wxMouseEvent& event ) {
mouseInView.store(false); mouseInView.store(false);
} }
TreeViewItem *BookmarkView::itemToTVI(wxTreeItemId item) {
TreeViewItem* tvi = nullptr;
if (item != nullptr) {
tvi = dynamic_cast<TreeViewItem*>(m_treeView->GetItemData(item));
}
return tvi;
}

View File

@ -99,6 +99,8 @@ protected:
void onRemoveGroup( wxCommandEvent& event ); void onRemoveGroup( wxCommandEvent& event );
void onRenameGroup( wxCommandEvent& event ); void onRenameGroup( wxCommandEvent& event );
TreeViewItem *itemToTVI(wxTreeItemId item);
std::atomic_bool mouseInView; std::atomic_bool mouseInView;
@ -114,17 +116,11 @@ protected:
// Bookmarks // Bookmarks
std::atomic_bool doUpdateBookmarks; std::atomic_bool doUpdateBookmarks;
std::set< std::string > doUpdateBookmarkGroup; std::set< std::string > doUpdateBookmarkGroup;
std::string groupSel;
BookmarkNames groupNames; BookmarkNames groupNames;
std::map<std::string, wxTreeItemId> groups; std::map<std::string, wxTreeItemId> groups;
BookmarkEntry *bookmarkSel;
wxArrayString bookmarkChoices; wxArrayString bookmarkChoices;
wxChoice *bookmarkChoice; wxChoice *bookmarkChoice;
// Active // Active
std::atomic_bool doUpdateActive; std::atomic_bool doUpdateActive;
DemodulatorInstance *activeSel;
// Recent
BookmarkEntry *recentSel;
}; };