Active modem tracking; update only when necessary

This commit is contained in:
Charles J. Cliffe 2016-09-22 20:40:07 -04:00
parent f4ab6fbaad
commit 367a723947
4 changed files with 22 additions and 2 deletions

View File

@ -58,3 +58,11 @@ BookmarkList BookmarkMgr::getBookmarks(std::string group, std::string folder) {
return results; return results;
} }
void BookmarkMgr::updateActiveList() {
BookmarkView *bmv = wxGetApp().getAppFrame()->getBookmarkView();
if (bmv) {
bmv->updateActiveList();
}
}

View File

@ -42,6 +42,8 @@ public:
void removeBookmark(std::string group, BookmarkEntry *be); void removeBookmark(std::string group, BookmarkEntry *be);
BookmarkList getBookmarks(std::string group, std::string folder = ""); BookmarkList getBookmarks(std::string group, std::string folder = "");
void updateActiveList();
protected: protected:
BookmarkMap bmData; BookmarkMap bmData;

View File

@ -80,6 +80,8 @@ DemodulatorInstance::~DemodulatorInstance() {
delete pipeIQDemodData; delete pipeIQDemodData;
delete threadQueueControl; delete threadQueueControl;
delete pipeAudioData; delete pipeAudioData;
wxGetApp().getBookmarkMgr().updateActiveList();
} }
void DemodulatorInstance::setVisualOutputQueue(DemodulatorThreadOutputQueue *tQueue) { void DemodulatorInstance::setVisualOutputQueue(DemodulatorThreadOutputQueue *tQueue) {
@ -118,6 +120,7 @@ void DemodulatorInstance::run() {
active = true; active = true;
wxGetApp().getBookmarkMgr().updateActiveList();
} }
void DemodulatorInstance::updateLabel(long long freq) { void DemodulatorInstance::updateLabel(long long freq) {
@ -125,6 +128,7 @@ void DemodulatorInstance::updateLabel(long long freq) {
newLabel.precision(3); newLabel.precision(3);
newLabel << std::fixed << ((long double) freq / 1000000.0); newLabel << std::fixed << ((long double) freq / 1000000.0);
setLabel(newLabel.str()); setLabel(newLabel.str());
wxGetApp().getBookmarkMgr().updateActiveList();
} }
void DemodulatorInstance::terminate() { void DemodulatorInstance::terminate() {
@ -227,6 +231,8 @@ void DemodulatorInstance::setActive(bool state) {
tracking = false; tracking = false;
} }
active = state; active = state;
wxGetApp().getBookmarkMgr().updateActiveList();
} }
void DemodulatorInstance::squelchAuto() { void DemodulatorInstance::squelchAuto() {
@ -391,6 +397,10 @@ void DemodulatorInstance::setFrequency(long long freq) {
wxGetApp().getRigThread()->setFrequency(freq,true); wxGetApp().getRigThread()->setFrequency(freq,true);
} }
#endif #endif
if (this->isActive()) {
wxGetApp().getBookmarkMgr().updateActiveList();
}
} }
long long DemodulatorInstance::getFrequency() { long long DemodulatorInstance::getFrequency() {

View File

@ -4,7 +4,7 @@
BookmarkView::BookmarkView( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style) : BookmarkPanel(parent, id, pos, size, style) { BookmarkView::BookmarkView( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style) : BookmarkPanel(parent, id, pos, size, style) {
activeBranch = m_treeView->AddRoot("Active"); activeBranch = m_treeView->AddRoot("Active");
doUpdateActive = true; // doUpdateActive = true;
m_updateTimer.Start(500); m_updateTimer.Start(500);
} }
@ -12,7 +12,7 @@ void BookmarkView::onUpdateTimer( wxTimerEvent& event ) {
if (doUpdateActive) { if (doUpdateActive) {
doUpdateActiveList(); doUpdateActiveList();
// doUpdateActive = false; doUpdateActive = false;
} }
} }