mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-05-30 06:02:25 -04:00
Fix #593 : Make the middle of the range always the central frequency
This commit is contained in:
parent
505ed18066
commit
0f72a0f683
@ -870,7 +870,11 @@ void BookmarkView::activateBookmark(BookmarkEntryPtr bmEnt) {
|
|||||||
|
|
||||||
|
|
||||||
void BookmarkView::activateRange(BookmarkRangeEntryPtr rangeEnt) {
|
void BookmarkView::activateRange(BookmarkRangeEntryPtr rangeEnt) {
|
||||||
wxGetApp().setFrequency(rangeEnt->freq);
|
|
||||||
|
//the following oly works if rangeEnt->freq is the middle of [rangeEnt->startFreq ; rangeEnt->startFreq]
|
||||||
|
wxGetApp().setFrequency(rangeEnt->freq);
|
||||||
|
|
||||||
|
// Change View limits to fit the range exactly.
|
||||||
wxGetApp().getAppFrame()->setViewState(rangeEnt->startFreq + (rangeEnt->endFreq - rangeEnt->startFreq) / 2, rangeEnt->endFreq - rangeEnt->startFreq);
|
wxGetApp().getAppFrame()->setViewState(rangeEnt->startFreq + (rangeEnt->endFreq - rangeEnt->startFreq) / 2, rangeEnt->endFreq - rangeEnt->startFreq);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1536,10 +1540,13 @@ void BookmarkView::loadDefaultRanges() {
|
|||||||
|
|
||||||
BookmarkRangeEntryPtr BookmarkView::makeActiveRangeEntry() {
|
BookmarkRangeEntryPtr BookmarkView::makeActiveRangeEntry() {
|
||||||
BookmarkRangeEntryPtr re(new BookmarkRangeEntry);
|
BookmarkRangeEntryPtr re(new BookmarkRangeEntry);
|
||||||
re->freq = wxGetApp().getFrequency();
|
|
||||||
re->startFreq = wxGetApp().getAppFrame()->getViewCenterFreq() - (wxGetApp().getAppFrame()->getViewBandwidth()/2);
|
re->startFreq = wxGetApp().getAppFrame()->getViewCenterFreq() - (wxGetApp().getAppFrame()->getViewBandwidth()/2);
|
||||||
re->endFreq = wxGetApp().getAppFrame()->getViewCenterFreq() + (wxGetApp().getAppFrame()->getViewBandwidth()/2);
|
re->endFreq = wxGetApp().getAppFrame()->getViewCenterFreq() + (wxGetApp().getAppFrame()->getViewBandwidth()/2);
|
||||||
|
|
||||||
|
//to prevent problems, always make the re->freq the middle of the interval.
|
||||||
|
re->freq = (re->startFreq + re->endFreq) / 2;
|
||||||
|
|
||||||
return re;
|
return re;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user