| 901 | |
| 902 | |
| 903 | void 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 | |
| 944 | void BookmarkView::activateRange(const BookmarkRangeEntryPtr& rangeEnt) { |
nothing calls this directly
no test coverage detected