mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-05 00:41:17 -05:00
UI Tweaks and fixes, +2.16M input rate
This commit is contained in:
parent
ec030bafff
commit
7923235253
@ -133,6 +133,7 @@ AppFrame::AppFrame() :
|
||||
// menu->Append(wxID_NEW);
|
||||
menu->Append(wxID_SET_FREQ_OFFSET, "Set Frequency Offset");
|
||||
menu->Append(wxID_SET_PPM, "Set Device PPM");
|
||||
menu->AppendSeparator();
|
||||
menu->Append(wxID_OPEN, "&Open Session");
|
||||
menu->Append(wxID_SAVE, "&Save Session");
|
||||
menu->Append(wxID_SAVEAS, "Save Session &As..");
|
||||
@ -188,6 +189,7 @@ AppFrame::AppFrame() :
|
||||
sampleRateMenuItems[wxID_BANDWIDTH_1000M] = menu->AppendRadioItem(wxID_BANDWIDTH_1000M, "1.0M");
|
||||
sampleRateMenuItems[wxID_BANDWIDTH_1500M] = menu->AppendRadioItem(wxID_BANDWIDTH_1500M, "1.5M");
|
||||
sampleRateMenuItems[wxID_BANDWIDTH_2000M] = menu->AppendRadioItem(wxID_BANDWIDTH_2000M, "2.0M");
|
||||
sampleRateMenuItems[wxID_BANDWIDTH_2160M] = menu->AppendRadioItem(wxID_BANDWIDTH_2160M, "2.16M");
|
||||
sampleRateMenuItems[wxID_BANDWIDTH_2500M] = menu->AppendRadioItem(wxID_BANDWIDTH_2500M, "2.5M");
|
||||
sampleRateMenuItems[wxID_BANDWIDTH_2880M] = menu->AppendRadioItem(wxID_BANDWIDTH_2880M, "2.88M");
|
||||
sampleRateMenuItems[wxID_BANDWIDTH_3200M] = menu->AppendRadioItem(wxID_BANDWIDTH_3200M, "3.2M");
|
||||
@ -380,6 +382,9 @@ void AppFrame::OnMenu(wxCommandEvent& event) {
|
||||
case wxID_BANDWIDTH_2000M:
|
||||
wxGetApp().setSampleRate(2000000);
|
||||
break;
|
||||
case wxID_BANDWIDTH_2160M:
|
||||
wxGetApp().setSampleRate(2160000);
|
||||
break;
|
||||
case wxID_BANDWIDTH_2500M:
|
||||
wxGetApp().setSampleRate(2500000);
|
||||
break;
|
||||
|
@ -28,8 +28,9 @@
|
||||
#define wxID_BANDWIDTH_1000M 2152
|
||||
#define wxID_BANDWIDTH_1500M 2153
|
||||
#define wxID_BANDWIDTH_2000M 2154
|
||||
#define wxID_BANDWIDTH_2500M 2155
|
||||
#define wxID_BANDWIDTH_2880M 2156
|
||||
#define wxID_BANDWIDTH_2160M 2155
|
||||
#define wxID_BANDWIDTH_2500M 2156
|
||||
#define wxID_BANDWIDTH_2880M 2157
|
||||
#define wxID_BANDWIDTH_3200M 2158
|
||||
|
||||
#define wxID_DEVICE_ID 3500
|
||||
|
@ -19,7 +19,8 @@
|
||||
|
||||
#define MIN_BANDWIDTH 1500
|
||||
|
||||
wxBEGIN_EVENT_TABLE(WaterfallCanvas, wxGLCanvas) EVT_PAINT(WaterfallCanvas::OnPaint)
|
||||
wxBEGIN_EVENT_TABLE(WaterfallCanvas, wxGLCanvas)
|
||||
EVT_PAINT(WaterfallCanvas::OnPaint)
|
||||
EVT_KEY_DOWN(WaterfallCanvas::OnKeyDown)
|
||||
EVT_KEY_UP(WaterfallCanvas::OnKeyUp)
|
||||
EVT_IDLE(WaterfallCanvas::OnIdle)
|
||||
@ -633,7 +634,7 @@ void WaterfallCanvas::OnMouseMoved(wxMouseEvent& event) {
|
||||
}
|
||||
|
||||
if (dragState == WF_DRAG_FREQUENCY) {
|
||||
long long bwTarget = (long long) (mouseTracker.getMouseX() * (float) getBandwidth()) + getCenterFrequency() - (getBandwidth() / 2) - dragOfs;
|
||||
long long bwTarget = getFrequencyAt(mouseTracker.getMouseX()) - dragOfs;
|
||||
long long currentFreq = demod->getFrequency();
|
||||
long long bwDiff = bwTarget - currentFreq;
|
||||
int snap = wxGetApp().getFrequencySnap();
|
||||
@ -678,18 +679,20 @@ void WaterfallCanvas::OnMouseMoved(wxMouseEvent& event) {
|
||||
DemodulatorInstance *demod = (*demodsHover)[i];
|
||||
long long freqDiff = demod->getFrequency() - freqPos;
|
||||
long halfBw = (demod->getBandwidth() / 2);
|
||||
|
||||
long long currentBw = getBandwidth();
|
||||
long long globalBw = wxGetApp().getSampleRate();
|
||||
long dist = abs(freqDiff);
|
||||
|
||||
if (dist < near_dist) {
|
||||
activeDemodulator = demod;
|
||||
near_dist = dist;
|
||||
}
|
||||
double maxDist = ((double)halfBw + (double)halfBw * 0.05 * ((double)currentBw / (double)globalBw));
|
||||
|
||||
if ((double)dist <= maxDist) {
|
||||
if (dist < near_dist) {
|
||||
activeDemodulator = demod;
|
||||
near_dist = dist;
|
||||
}
|
||||
|
||||
if (dist <= halfBw && dist >= (int)((float) halfBw / 1.5)) {
|
||||
if ((freqDiff > 0 && activeDemodulator->getDemodulatorType() == DEMOD_TYPE_USB) ||
|
||||
(freqDiff < 0 && activeDemodulator->getDemodulatorType() == DEMOD_TYPE_LSB)) {
|
||||
if ((freqDiff > 0 && demod->getDemodulatorType() == DEMOD_TYPE_USB) ||
|
||||
(freqDiff < 0 && demod->getDemodulatorType() == DEMOD_TYPE_LSB)) {
|
||||
continue;
|
||||
}
|
||||
long edge_dist = abs(halfBw - dist);
|
||||
@ -701,6 +704,7 @@ void WaterfallCanvas::OnMouseMoved(wxMouseEvent& event) {
|
||||
}
|
||||
|
||||
if (activeDemodulator == NULL) {
|
||||
nextDragState = WF_DRAG_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -778,6 +782,8 @@ void WaterfallCanvas::OnMouseReleased(wxMouseEvent& event) {
|
||||
mouseTracker.setHorizDragLock(false);
|
||||
|
||||
DemodulatorInstance *demod = isNew?NULL:wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||
DemodulatorInstance *activeDemod = isNew?NULL:wxGetApp().getDemodMgr().getActiveDemodulator();
|
||||
|
||||
DemodulatorMgr *mgr = &wxGetApp().getDemodMgr();
|
||||
|
||||
if (mouseTracker.getOriginDeltaMouseX() == 0 && mouseTracker.getOriginDeltaMouseY() == 0) {
|
||||
@ -820,10 +826,9 @@ void WaterfallCanvas::OnMouseReleased(wxMouseEvent& event) {
|
||||
demod->run();
|
||||
|
||||
wxGetApp().bindDemodulator(demod);
|
||||
wxGetApp().getDemodMgr().setActiveDemodulator(demod, false);
|
||||
}
|
||||
|
||||
if (demod == NULL) {
|
||||
if (!demod) {
|
||||
dragState = WF_DRAG_NONE;
|
||||
return;
|
||||
}
|
||||
@ -837,15 +842,19 @@ void WaterfallCanvas::OnMouseReleased(wxMouseEvent& event) {
|
||||
setStatusText("Moved demodulator to frequency: %s", freq);
|
||||
}
|
||||
|
||||
wxGetApp().getDemodMgr().setActiveDemodulator(wxGetApp().getDemodMgr().getLastActiveDemodulator(), false);
|
||||
wxGetApp().getDemodMgr().setActiveDemodulator(demod, false);
|
||||
SetCursor(wxCURSOR_SIZING);
|
||||
nextDragState = WF_DRAG_FREQUENCY;
|
||||
mouseTracker.setVertDragLock(true);
|
||||
mouseTracker.setHorizDragLock(false);
|
||||
} else {
|
||||
wxGetApp().getDemodMgr().setActiveDemodulator(wxGetApp().getDemodMgr().getActiveDemodulator(), false);
|
||||
wxGetApp().getDemodMgr().getActiveDemodulator()->setTracking(true);
|
||||
nextDragState = WF_DRAG_FREQUENCY;
|
||||
if (activeDemod) {
|
||||
wxGetApp().getDemodMgr().setActiveDemodulator(activeDemod, false);
|
||||
activeDemod->setTracking(true);
|
||||
nextDragState = WF_DRAG_FREQUENCY;
|
||||
} else {
|
||||
nextDragState = WF_DRAG_NONE;
|
||||
}
|
||||
}
|
||||
} else if (dragState == WF_DRAG_RANGE) {
|
||||
float width = mouseTracker.getOriginDeltaMouseX();
|
||||
@ -898,7 +907,6 @@ void WaterfallCanvas::OnMouseReleased(wxMouseEvent& event) {
|
||||
demod->run();
|
||||
|
||||
wxGetApp().bindDemodulator(demod);
|
||||
wxGetApp().getDemodMgr().setActiveDemodulator(demod, false);
|
||||
}
|
||||
|
||||
if (demod == NULL) {
|
||||
@ -908,10 +916,10 @@ void WaterfallCanvas::OnMouseReleased(wxMouseEvent& event) {
|
||||
|
||||
setStatusText("New demodulator at frequency: %s", freq);
|
||||
|
||||
wxGetApp().getDemodMgr().setActiveDemodulator(wxGetApp().getDemodMgr().getLastActiveDemodulator(), false);
|
||||
demod->updateLabel(freq);
|
||||
demod->setFrequency(freq);
|
||||
demod->setBandwidth(bw);
|
||||
wxGetApp().getDemodMgr().setActiveDemodulator(demod, false);
|
||||
}
|
||||
|
||||
dragState = WF_DRAG_NONE;
|
||||
|
Loading…
Reference in New Issue
Block a user