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