MCPcopy Create free account
hub / github.com/cjcliffe/CubicSDR / activateBookmark

Method activateBookmark

src/forms/Bookmark/BookmarkView.cpp:903–941  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

901
902
903void BookmarkView::activateBookmark(const BookmarkEntryPtr& bmEnt) {
904
905 wxTreeItemId selItem = m_treeView->GetSelection();
906 if (selItem) {
907 m_treeView->SelectItem(selItem, false);
908 }
909
910 //if a matching DemodulatorInstance do not exist yet, create it and activate it, else use
911 //the already existing one:
912 // we search among the list of existing demodulators the one matching
913 //bmEnt and activate it. The search is made backwards, to select the most recently created one.
914 DemodulatorInstancePtr matchingDemod = wxGetApp().getDemodMgr().getLastDemodulatorWith(
915 bmEnt->type,
916 bmEnt->label,
917 bmEnt->frequency,
918 bmEnt->bandwidth);
919 //not found, create a new demod instance:
920 if (matchingDemod == nullptr) {
921
922 matchingDemod = wxGetApp().getDemodMgr().loadInstance(bmEnt->node);
923 matchingDemod->run();
924 wxGetApp().notifyDemodulatorsChanged();
925 }
926
927 matchingDemod->setActive(true);
928
929 long long freq = matchingDemod->getFrequency();
930 long long currentFreq = wxGetApp().getFrequency();
931 long long currentRate = wxGetApp().getSampleRate();
932
933 if ((abs(freq - currentFreq) > currentRate / 2) || (abs(currentFreq - freq) > currentRate / 2)) {
934 wxGetApp().setFrequency(freq);
935 }
936
937 nextDemod = matchingDemod;
938 wxGetApp().getDemodMgr().setActiveDemodulator(nextDemod, false);
939
940 //wxGetApp().getBookmarkMgr().updateActiveList();
941}
942
943
944void BookmarkView::activateRange(const BookmarkRangeEntryPtr& rangeEnt) {

Callers

nothing calls this directly

Calls 9

loadInstanceMethod · 0.80
setActiveDemodulatorMethod · 0.80
runMethod · 0.45
setActiveMethod · 0.45
getFrequencyMethod · 0.45
getSampleRateMethod · 0.45
setFrequencyMethod · 0.45

Tested by

no test coverage detected