mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-14 08:01:46 -05:00
menu action cleanup/refactoring
This commit is contained in:
parent
58d4f484e4
commit
c67330e985
309
src/AppFrame.cpp
309
src/AppFrame.cpp
@ -1269,6 +1269,31 @@ void AppFrame::dismissRigControlPortDialog() {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
void AppFrame::OnMenu(wxCommandEvent &event) {
|
||||||
|
actionOnMenuAbout(event)
|
||||||
|
|| actionOnMenuSDRStartStop(event)
|
||||||
|
|| actionOnMenuPerformance(event)
|
||||||
|
|| actionOnMenuTips(event)
|
||||||
|
|| actionOnMenuIQSwap(event)
|
||||||
|
|| actionOnMenuFreqOffset(event)
|
||||||
|
|| actionOnMenuDBOffset(event)
|
||||||
|
|| actionOnMenuAGC(event)
|
||||||
|
|| actionOnMenuSDRDevices(event)
|
||||||
|
|| actionOnMenuSetPPM(event)
|
||||||
|
|| actionOnMenuLoadSave(event)
|
||||||
|
|| actionOnMenuReset(event)
|
||||||
|
|| actionOnMenuClose(event)
|
||||||
|
|| actionOnMenuSettings(event)
|
||||||
|
|| actionOnMenuSampleRate(event)
|
||||||
|
|| actionOnMenuAudioSampleRate(event)
|
||||||
|
|| actionOnMenuRecording(event)
|
||||||
|
|| actionOnMenuDisplay(event)
|
||||||
|
//Optional : Rig
|
||||||
|
|| actionOnMenuRig(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool AppFrame::actionOnMenuDisplay(wxCommandEvent& event) {
|
bool AppFrame::actionOnMenuDisplay(wxCommandEvent& event) {
|
||||||
|
|
||||||
//by default, is managed.
|
//by default, is managed.
|
||||||
@ -1789,7 +1814,7 @@ bool AppFrame::actionOnMenuRecording(wxCommandEvent& event) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AppFrame::actionOnMenuRig(wxCommandEvent& event) {
|
bool AppFrame::actionOnMenuRig(wxCommandEvent &event) {
|
||||||
|
|
||||||
bool bManaged = false;
|
bool bManaged = false;
|
||||||
|
|
||||||
@ -1806,12 +1831,10 @@ bool AppFrame::actionOnMenuRig(wxCommandEvent& event) {
|
|||||||
rigSDRIF = devConfig->getRigIF(rigModel);
|
rigSDRIF = devConfig->getRigIF(rigModel);
|
||||||
if (rigSDRIF) {
|
if (rigSDRIF) {
|
||||||
wxGetApp().lockFrequency(rigSDRIF);
|
wxGetApp().lockFrequency(rigSDRIF);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
wxGetApp().unlockFrequency();
|
wxGetApp().unlockFrequency();
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
wxGetApp().unlockFrequency();
|
wxGetApp().unlockFrequency();
|
||||||
}
|
}
|
||||||
resetRig = true;
|
resetRig = true;
|
||||||
@ -1839,8 +1862,7 @@ bool AppFrame::actionOnMenuRig(wxCommandEvent& event) {
|
|||||||
resetRig = false;
|
resetRig = false;
|
||||||
if (!wxGetApp().rigIsActive()) {
|
if (!wxGetApp().rigIsActive()) {
|
||||||
enableRig();
|
enableRig();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
disableRig();
|
disableRig();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1851,15 +1873,15 @@ bool AppFrame::actionOnMenuRig(wxCommandEvent& event) {
|
|||||||
if (devInfo != nullptr) {
|
if (devInfo != nullptr) {
|
||||||
std::string deviceId = devInfo->getDeviceId();
|
std::string deviceId = devInfo->getDeviceId();
|
||||||
DeviceConfig *devConfig = wxGetApp().getConfig()->getDevice(deviceId);
|
DeviceConfig *devConfig = wxGetApp().getConfig()->getDevice(deviceId);
|
||||||
long long freqRigIF = wxGetNumberFromUser("Rig SDR-IF Frequency", "Frequency (Hz)", "Frequency", devConfig->getRigIF(rigModel), 0, 2000000000);
|
long long freqRigIF = wxGetNumberFromUser("Rig SDR-IF Frequency", "Frequency (Hz)", "Frequency",
|
||||||
|
devConfig->getRigIF(rigModel), 0, 2000000000);
|
||||||
if (freqRigIF != -1) {
|
if (freqRigIF != -1) {
|
||||||
rigSDRIF = freqRigIF;
|
rigSDRIF = freqRigIF;
|
||||||
devConfig->setRigIF(rigModel, rigSDRIF);
|
devConfig->setRigIF(rigModel, rigSDRIF);
|
||||||
}
|
}
|
||||||
if (rigSDRIF && wxGetApp().rigIsActive()) {
|
if (rigSDRIF && wxGetApp().rigIsActive()) {
|
||||||
wxGetApp().lockFrequency(rigSDRIF);
|
wxGetApp().lockFrequency(rigSDRIF);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
wxGetApp().unlockFrequency();
|
wxGetApp().unlockFrequency();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1872,8 +1894,7 @@ bool AppFrame::actionOnMenuRig(wxCommandEvent& event) {
|
|||||||
rt->setControlMode(!rt->getControlMode());
|
rt->setControlMode(!rt->getControlMode());
|
||||||
rigControlMenuItem->Check(rt->getControlMode());
|
rigControlMenuItem->Check(rt->getControlMode());
|
||||||
wxGetApp().getConfig()->setRigControlMode(rt->getControlMode());
|
wxGetApp().getConfig()->setRigControlMode(rt->getControlMode());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
wxGetApp().getConfig()->setRigControlMode(rigControlMenuItem->IsChecked());
|
wxGetApp().getConfig()->setRigControlMode(rigControlMenuItem->IsChecked());
|
||||||
}
|
}
|
||||||
bManaged = true;
|
bManaged = true;
|
||||||
@ -1885,8 +1906,7 @@ bool AppFrame::actionOnMenuRig(wxCommandEvent& event) {
|
|||||||
rt->setFollowMode(!rt->getFollowMode());
|
rt->setFollowMode(!rt->getFollowMode());
|
||||||
rigFollowMenuItem->Check(rt->getFollowMode());
|
rigFollowMenuItem->Check(rt->getFollowMode());
|
||||||
wxGetApp().getConfig()->setRigFollowMode(rt->getFollowMode());
|
wxGetApp().getConfig()->setRigFollowMode(rt->getFollowMode());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
wxGetApp().getConfig()->setRigFollowMode(rigFollowMenuItem->IsChecked());
|
wxGetApp().getConfig()->setRigFollowMode(rigFollowMenuItem->IsChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1899,8 +1919,7 @@ bool AppFrame::actionOnMenuRig(wxCommandEvent& event) {
|
|||||||
rt->setCenterLock(!rt->getCenterLock());
|
rt->setCenterLock(!rt->getCenterLock());
|
||||||
rigCenterLockMenuItem->Check(rt->getCenterLock());
|
rigCenterLockMenuItem->Check(rt->getCenterLock());
|
||||||
wxGetApp().getConfig()->setRigCenterLock(rt->getCenterLock());
|
wxGetApp().getConfig()->setRigCenterLock(rt->getCenterLock());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
wxGetApp().getConfig()->setRigCenterLock(rigCenterLockMenuItem->IsChecked());
|
wxGetApp().getConfig()->setRigCenterLock(rigCenterLockMenuItem->IsChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1913,8 +1932,7 @@ bool AppFrame::actionOnMenuRig(wxCommandEvent& event) {
|
|||||||
rt->setFollowModem(!rt->getFollowModem());
|
rt->setFollowModem(!rt->getFollowModem());
|
||||||
rigFollowModemMenuItem->Check(rt->getFollowModem());
|
rigFollowModemMenuItem->Check(rt->getFollowModem());
|
||||||
wxGetApp().getConfig()->setRigFollowModem(rt->getFollowModem());
|
wxGetApp().getConfig()->setRigFollowModem(rt->getFollowModem());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
wxGetApp().getConfig()->setRigFollowModem(rigFollowModemMenuItem->IsChecked());
|
wxGetApp().getConfig()->setRigFollowModem(rigFollowModemMenuItem->IsChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1930,13 +1948,120 @@ bool AppFrame::actionOnMenuRig(wxCommandEvent& event) {
|
|||||||
return bManaged;
|
return bManaged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AppFrame::actionOnMenuClose(wxCommandEvent &event) {
|
||||||
void AppFrame::OnMenu(wxCommandEvent& event) {
|
if (event.GetId() == wxID_CLOSE || event.GetId() == wxID_EXIT) {
|
||||||
|
Close(false);
|
||||||
if (actionOnMenuAbout(event)) {
|
return true;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
else if (event.GetId() == wxID_SDR_START_STOP) {
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AppFrame::actionOnMenuSetPPM(wxCommandEvent &event) {
|
||||||
|
if (event.GetId() == wxID_SET_PPM) {
|
||||||
|
long ofs = wxGetNumberFromUser(
|
||||||
|
"Frequency correction for device in PPM.\ni.e. -51 for -51 PPM\n\nNote: you can adjust PPM interactively\nby holding ALT over the frequency tuning bar.\n",
|
||||||
|
"Parts per million (PPM)",
|
||||||
|
"Frequency Correction", wxGetApp().getPPM(), -1000, 1000, this);
|
||||||
|
wxGetApp().setPPM(ofs);
|
||||||
|
|
||||||
|
settingsMenuItems[wxID_SET_PPM]->SetItemLabel(
|
||||||
|
getSettingsLabel("Device PPM", to_string(wxGetApp().getPPM()), "ppm"));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AppFrame::actionOnMenuSDRDevices(wxCommandEvent &event) {
|
||||||
|
if (event.GetId() == wxID_SDR_DEVICES) {
|
||||||
|
wxGetApp().deviceSelector();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AppFrame::actionOnMenuDBOffset(wxCommandEvent &event) {
|
||||||
|
if (event.GetId() == wxID_SET_DB_OFFSET) {
|
||||||
|
long ofs = wxGetNumberFromUser("Shift the displayed RF power level by this amount.\ni.e. -30 for -30 dB",
|
||||||
|
"Decibels (dB)",
|
||||||
|
"Power Level Offset", wxGetApp().getConfig()->getDBOffset(), -1000, 1000, this);
|
||||||
|
if (ofs != -1) {
|
||||||
|
wxGetApp().getConfig()->setDBOffset(ofs);
|
||||||
|
settingsMenuItems[wxID_SET_DB_OFFSET]->SetItemLabel(
|
||||||
|
getSettingsLabel("Power Level Offset", to_string(wxGetApp().getConfig()->getDBOffset()), "dB"));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AppFrame::actionOnMenuFreqOffset(wxCommandEvent &event) {
|
||||||
|
if (event.GetId() == wxID_SET_FREQ_OFFSET) {
|
||||||
|
//enter in KHz to accomodate > 2GHz shifts for down/upconverters on 32 bit platforms.
|
||||||
|
long ofs = wxGetNumberFromUser(
|
||||||
|
"Shift the displayed frequency by this amount of KHz.\ni.e. -125000 for -125 MHz", "Frequency (KHz)",
|
||||||
|
"Frequency Offset", (long long) (wxGetApp().getOffset() / 1000.0), -2000000000, 2000000000, this);
|
||||||
|
if (ofs != -1) {
|
||||||
|
wxGetApp().setOffset((long long) ofs * 1000);
|
||||||
|
|
||||||
|
settingsMenuItems[wxID_SET_FREQ_OFFSET]->SetItemLabel(
|
||||||
|
getSettingsLabel("Frequency Offset", to_string(wxGetApp().getOffset() / 1000), "KHz"));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AppFrame::actionOnMenuIQSwap(wxCommandEvent &event) {
|
||||||
|
if (event.GetId() == wxID_SET_IQSWAP) {
|
||||||
|
wxGetApp().getSDRThread()->setIQSwap(!wxGetApp().getSDRThread()->getIQSwap());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AppFrame::actionOnMenuTips(wxCommandEvent &event) {
|
||||||
|
if (event.GetId() == wxID_SET_TIPS) {
|
||||||
|
wxGetApp().getConfig()->setShowTips(!wxGetApp().getConfig()->getShowTips());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AppFrame::actionOnMenuPerformance(wxCommandEvent &event) {
|
||||||
|
if (event.GetId() >= wxID_PERF_BASE && event.GetId() <= wxID_PERF_BASE + (int) AppConfig::PERF_HIGH) {
|
||||||
|
|
||||||
|
int perfEnumAsInt = event.GetId() - wxID_PERF_BASE;
|
||||||
|
AppConfig::PerfModeEnum perfEnumSet = AppConfig::PERF_NORMAL;
|
||||||
|
|
||||||
|
if (perfEnumAsInt == (int) AppConfig::PERF_HIGH) {
|
||||||
|
perfEnumSet = AppConfig::PERF_HIGH;
|
||||||
|
|
||||||
|
} else if (perfEnumAsInt == (int) AppConfig::PERF_LOW) {
|
||||||
|
perfEnumSet = AppConfig::PERF_LOW;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxGetApp().getConfig()->setPerfMode(perfEnumSet);
|
||||||
|
|
||||||
|
//update Channelizer mode:
|
||||||
|
if (perfEnumSet == AppConfig::PERF_HIGH) {
|
||||||
|
wxGetApp().setChannelizerType(SDRPostPFBCH2);
|
||||||
|
} else {
|
||||||
|
wxGetApp().setChannelizerType(SDRPostPFBCH);
|
||||||
|
}
|
||||||
|
|
||||||
|
//update UI
|
||||||
|
wxMenuItem *selectedPerfModeItem = performanceMenuItems[event.GetId()];
|
||||||
|
performanceMenuItems[wxID_PERF_CURRENT]->SetItemLabel(
|
||||||
|
getSettingsLabel("CPU usage", selectedPerfModeItem->GetItemLabel().ToStdString()));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AppFrame::actionOnMenuSDRStartStop(wxCommandEvent &event) {
|
||||||
|
if (event.GetId() == wxID_SDR_START_STOP) {
|
||||||
if (!wxGetApp().getSDRThread()->isTerminated()) {
|
if (!wxGetApp().getSDRThread()->isTerminated()) {
|
||||||
wxGetApp().stopDevice(true, 2000);
|
wxGetApp().stopDevice(true, 2000);
|
||||||
} else {
|
} else {
|
||||||
@ -1945,101 +2070,9 @@ void AppFrame::OnMenu(wxCommandEvent& event) {
|
|||||||
wxGetApp().setDevice(dev, 0);
|
wxGetApp().setDevice(dev, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else if (event.GetId() >= wxID_PERF_BASE && event.GetId() <= wxID_PERF_BASE + (int)AppConfig::PERF_HIGH) {
|
return false;
|
||||||
|
|
||||||
int perfEnumAsInt = event.GetId() - wxID_PERF_BASE;
|
|
||||||
AppConfig::PerfModeEnum perfEnumSet = AppConfig::PERF_NORMAL;
|
|
||||||
|
|
||||||
if (perfEnumAsInt == (int)AppConfig::PERF_HIGH) {
|
|
||||||
perfEnumSet = AppConfig::PERF_HIGH;
|
|
||||||
|
|
||||||
} else if (perfEnumAsInt == (int)AppConfig::PERF_LOW) {
|
|
||||||
perfEnumSet = AppConfig::PERF_LOW;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxGetApp().getConfig()->setPerfMode(perfEnumSet);
|
|
||||||
|
|
||||||
//update Channelizer mode:
|
|
||||||
if (perfEnumSet == AppConfig::PERF_HIGH) {
|
|
||||||
wxGetApp().setChannelizerType(SDRPostThreadChannelizerType::SDRPostPFBCH2);
|
|
||||||
} else {
|
|
||||||
wxGetApp().setChannelizerType(SDRPostThreadChannelizerType::SDRPostPFBCH);
|
|
||||||
}
|
|
||||||
|
|
||||||
//update UI
|
|
||||||
wxMenuItem* selectedPerfModeItem = performanceMenuItems[event.GetId()];
|
|
||||||
performanceMenuItems[wxID_PERF_CURRENT]->SetItemLabel(getSettingsLabel("CPU usage", selectedPerfModeItem->GetItemLabel().ToStdString()));
|
|
||||||
}
|
|
||||||
else if (event.GetId() == wxID_SET_TIPS ) {
|
|
||||||
if (wxGetApp().getConfig()->getShowTips()) {
|
|
||||||
wxGetApp().getConfig()->setShowTips(false);
|
|
||||||
} else {
|
|
||||||
wxGetApp().getConfig()->setShowTips(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (event.GetId() == wxID_SET_IQSWAP) {
|
|
||||||
wxGetApp().getSDRThread()->setIQSwap(!wxGetApp().getSDRThread()->getIQSwap());
|
|
||||||
}
|
|
||||||
else if (event.GetId() == wxID_SET_FREQ_OFFSET) {
|
|
||||||
//enter in KHz to accomodate > 2GHz shifts for down/upconverters on 32 bit platforms.
|
|
||||||
long ofs = wxGetNumberFromUser("Shift the displayed frequency by this amount of KHz.\ni.e. -125000 for -125 MHz", "Frequency (KHz)",
|
|
||||||
"Frequency Offset", (long long)(wxGetApp().getOffset() / 1000.0) , -2000000000, 2000000000, this);
|
|
||||||
if (ofs != -1) {
|
|
||||||
wxGetApp().setOffset((long long) ofs * 1000);
|
|
||||||
|
|
||||||
settingsMenuItems[wxID_SET_FREQ_OFFSET]->SetItemLabel(getSettingsLabel("Frequency Offset", std::to_string(wxGetApp().getOffset() / 1000), "KHz"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (event.GetId() == wxID_SET_DB_OFFSET) {
|
|
||||||
long ofs = wxGetNumberFromUser("Shift the displayed RF power level by this amount.\ni.e. -30 for -30 dB", "Decibels (dB)",
|
|
||||||
"Power Level Offset", wxGetApp().getConfig()->getDBOffset(), -1000, 1000, this);
|
|
||||||
if (ofs != -1) {
|
|
||||||
wxGetApp().getConfig()->setDBOffset(ofs);
|
|
||||||
settingsMenuItems[wxID_SET_DB_OFFSET]->SetItemLabel(getSettingsLabel("Power Level Offset", std::to_string(wxGetApp().getConfig()->getDBOffset()), "dB"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (actionOnMenuAGC(event)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (event.GetId() == wxID_SDR_DEVICES) {
|
|
||||||
wxGetApp().deviceSelector();
|
|
||||||
}
|
|
||||||
else if (event.GetId() == wxID_SET_PPM) {
|
|
||||||
long ofs = wxGetNumberFromUser("Frequency correction for device in PPM.\ni.e. -51 for -51 PPM\n\nNote: you can adjust PPM interactively\nby holding ALT over the frequency tuning bar.\n", "Parts per million (PPM)",
|
|
||||||
"Frequency Correction", wxGetApp().getPPM(), -1000, 1000, this);
|
|
||||||
wxGetApp().setPPM(ofs);
|
|
||||||
|
|
||||||
settingsMenuItems[wxID_SET_PPM]->SetItemLabel(getSettingsLabel("Device PPM", std::to_string(wxGetApp().getPPM()), "ppm"));
|
|
||||||
}
|
|
||||||
else if (actionOnMenuLoadSave(event)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (actionOnMenuReset(event)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (event.GetId() == wxID_CLOSE || event.GetId() == wxID_EXIT) {
|
|
||||||
Close(false);
|
|
||||||
}
|
|
||||||
else if (actionOnMenuSettings(event)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (actionOnMenuSampleRate(event)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (actionOnMenuAudioSampleRate(event)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (actionOnMenuRecording(event)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (actionOnMenuDisplay(event)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//Optional : Rig
|
|
||||||
else if (actionOnMenuRig(event)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppFrame::OnClose(wxCloseEvent& event) {
|
void AppFrame::OnClose(wxCloseEvent& event) {
|
||||||
@ -2099,7 +2132,7 @@ void AppFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event)) {
|
|||||||
new AppFrame();
|
new AppFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppFrame::OnIdle(wxIdleEvent& event) {
|
void AppFrame::OnIdle(wxIdleEvent &event) {
|
||||||
|
|
||||||
handleUpdateDeviceParams();
|
handleUpdateDeviceParams();
|
||||||
|
|
||||||
@ -2153,7 +2186,8 @@ void AppFrame::handleTXAntennaChange() {//Refresh the current TX antenna on, if
|
|||||||
|
|
||||||
if (currentTXantennaName != actualTxAntenna) {
|
if (currentTXantennaName != actualTxAntenna) {
|
||||||
currentTXantennaName = actualTxAntenna;
|
currentTXantennaName = actualTxAntenna;
|
||||||
antennaMenuItems[wxID_ANTENNA_CURRENT_TX]->SetItemLabel(getSettingsLabel("TX Antenna", currentTXantennaName));
|
antennaMenuItems[wxID_ANTENNA_CURRENT_TX]->SetItemLabel(
|
||||||
|
getSettingsLabel("TX Antenna", currentTXantennaName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2196,10 +2230,10 @@ void AppFrame::handleModemProperties() {
|
|||||||
modemProps->fitColumns();
|
modemProps->fitColumns();
|
||||||
#if ENABLE_DIGITAL_LAB
|
#if ENABLE_DIGITAL_LAB
|
||||||
if (demod->getModemType() == "digital") {
|
if (demod->getModemType() == "digital") {
|
||||||
ModemDigitalOutputConsole *outp = (ModemDigitalOutputConsole *)demod->getOutput();
|
ModemDigitalOutputConsole *outp = (ModemDigitalOutputConsole *) demod->getOutput();
|
||||||
if (!outp->getDialog()) {
|
if (!outp->getDialog()) {
|
||||||
outp->setTitle(demod->getDemodulatorType() + ": " + frequencyToStr(demod->getFrequency()));
|
outp->setTitle(demod->getDemodulatorType() + ": " + frequencyToStr(demod->getFrequency()));
|
||||||
outp->setDialog(new DigitalConsole(this, outp)) ;
|
outp->setDialog(new DigitalConsole(this, outp));
|
||||||
}
|
}
|
||||||
demod->showOutput();
|
demod->showOutput();
|
||||||
}
|
}
|
||||||
@ -2238,7 +2272,8 @@ void AppFrame::handleScopeSpectrumProcessors() {
|
|||||||
spectrumAvgMeter->setLevel(val);
|
spectrumAvgMeter->setLevel(val);
|
||||||
proc->setFFTAverageRate(val);
|
proc->setFFTAverageRate(val);
|
||||||
|
|
||||||
GetStatusBar()->SetStatusText(wxString::Format(wxT("Spectrum averaging speed changed to %0.2f%%."), val * 100.0));
|
GetStatusBar()->SetStatusText(
|
||||||
|
wxString::Format(wxT("Spectrum averaging speed changed to %0.2f%%."), val * 100.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
SpectrumVisualProcessor *dproc = wxGetApp().getDemodSpectrumProcessor();
|
SpectrumVisualProcessor *dproc = wxGetApp().getDemodSpectrumProcessor();
|
||||||
@ -2253,13 +2288,14 @@ void AppFrame::handleScopeSpectrumProcessors() {
|
|||||||
if (waterfallSpeedMeter->inputChanged()) {
|
if (waterfallSpeedMeter->inputChanged()) {
|
||||||
float val = waterfallSpeedMeter->getInputValue();
|
float val = waterfallSpeedMeter->getInputValue();
|
||||||
waterfallSpeedMeter->setLevel(val);
|
waterfallSpeedMeter->setLevel(val);
|
||||||
waterfallDataThread->setLinesPerSecond((int)ceil(val * val));
|
waterfallDataThread->setLinesPerSecond((int) ceil(val * val));
|
||||||
waterfallCanvas->setLinesPerSecond((int)ceil(val * val));
|
waterfallCanvas->setLinesPerSecond((int) ceil(val * val));
|
||||||
GetStatusBar()->SetStatusText(
|
GetStatusBar()->SetStatusText(
|
||||||
wxString::Format(wxT("Waterfall max speed changed to %d lines per second."), (int)ceil(val * val)));
|
wxString::Format(wxT("Waterfall max speed changed to %d lines per second."), (int) ceil(val * val)));
|
||||||
}
|
}
|
||||||
|
|
||||||
wproc->setView(waterfallCanvas->getViewState(), waterfallCanvas->getCenterFrequency(), waterfallCanvas->getBandwidth());
|
wproc->setView(waterfallCanvas->getViewState(), waterfallCanvas->getCenterFrequency(),
|
||||||
|
waterfallCanvas->getBandwidth());
|
||||||
|
|
||||||
proc->setView(wproc->isView(), wproc->getCenterFrequency(), wproc->getBandwidth());
|
proc->setView(wproc->isView(), wproc->getCenterFrequency(), wproc->getBandwidth());
|
||||||
}
|
}
|
||||||
@ -2270,7 +2306,8 @@ void AppFrame::handleScopeProcessor() {
|
|||||||
|
|
||||||
wxGetApp().getScopeProcessor()->setScopeEnabled(scopeCanvas->scopeVisible());
|
wxGetApp().getScopeProcessor()->setScopeEnabled(scopeCanvas->scopeVisible());
|
||||||
wxGetApp().getScopeProcessor()->setSpectrumEnabled(scopeCanvas->spectrumVisible());
|
wxGetApp().getScopeProcessor()->setSpectrumEnabled(scopeCanvas->spectrumVisible());
|
||||||
wxGetApp().getAudioVisualQueue()->set_max_num_items((scopeCanvas->scopeVisible() ? 1 : 0) + (scopeCanvas->spectrumVisible() ? 1 : 0));
|
wxGetApp().getAudioVisualQueue()->set_max_num_items(
|
||||||
|
(scopeCanvas->scopeVisible() ? 1 : 0) + (scopeCanvas->spectrumVisible() ? 1 : 0));
|
||||||
|
|
||||||
wxGetApp().getScopeProcessor()->run();
|
wxGetApp().getScopeProcessor()->run();
|
||||||
}
|
}
|
||||||
@ -2289,7 +2326,8 @@ void AppFrame::handleMuteButton() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AppFrame::handleSpectrumWaterfall() {
|
void AppFrame::handleSpectrumWaterfall() {
|
||||||
if (spectrumCanvas->getViewState() && abs(wxGetApp().getFrequency() - spectrumCanvas->getCenterFrequency()) > (wxGetApp().getSampleRate() / 2)) {
|
if (spectrumCanvas->getViewState() &&
|
||||||
|
abs(wxGetApp().getFrequency() - spectrumCanvas->getCenterFrequency()) > (wxGetApp().getSampleRate() / 2)) {
|
||||||
spectrumCanvas->setCenterFrequency(wxGetApp().getFrequency());
|
spectrumCanvas->setCenterFrequency(wxGetApp().getFrequency());
|
||||||
waterfallCanvas->setCenterFrequency(wxGetApp().getFrequency());
|
waterfallCanvas->setCenterFrequency(wxGetApp().getFrequency());
|
||||||
}
|
}
|
||||||
@ -2332,7 +2370,7 @@ void AppFrame::handleModeSelector() {
|
|||||||
demodModeSelectorAdv->setSelection(-1);
|
demodModeSelectorAdv->setSelection(-1);
|
||||||
}
|
}
|
||||||
// advanced demodulators
|
// advanced demodulators
|
||||||
else if(dSelectionadv != "" && dSelectionadv != mgr->getLastDemodulatorType()) {
|
else if (dSelectionadv != "" && dSelectionadv != mgr->getLastDemodulatorType()) {
|
||||||
mgr->setLastDemodulatorType(dSelectionadv);
|
mgr->setLastDemodulatorType(dSelectionadv);
|
||||||
mgr->setLastBandwidth(Modem::getModemDefaultSampleRate(dSelectionadv));
|
mgr->setLastBandwidth(Modem::getModemDefaultSampleRate(dSelectionadv));
|
||||||
demodTuner->setHalfBand(false);
|
demodTuner->setHalfBand(false);
|
||||||
@ -2354,7 +2392,9 @@ void AppFrame::handleCurrentModem() {
|
|||||||
|
|
||||||
if (demod->isTracking()) {
|
if (demod->isTracking()) {
|
||||||
if (spectrumCanvas->getViewState()) {
|
if (spectrumCanvas->getViewState()) {
|
||||||
long long diff = abs(demod->getFrequency() - spectrumCanvas->getCenterFrequency()) + (demod->getBandwidth() / 2) + (demod->getBandwidth() / 4);
|
long long diff =
|
||||||
|
abs(demod->getFrequency() - spectrumCanvas->getCenterFrequency()) + (demod->getBandwidth() / 2) +
|
||||||
|
(demod->getBandwidth() / 4);
|
||||||
|
|
||||||
if (diff > spectrumCanvas->getBandwidth() / 2) {
|
if (diff > spectrumCanvas->getBandwidth() / 2) {
|
||||||
if (demod->getBandwidth() > (int) spectrumCanvas->getBandwidth()) {
|
if (demod->getBandwidth() > (int) spectrumCanvas->getBandwidth()) {
|
||||||
@ -2362,7 +2402,8 @@ void AppFrame::handleCurrentModem() {
|
|||||||
} else {
|
} else {
|
||||||
diff = diff - spectrumCanvas->getBandwidth() / 2;
|
diff = diff - spectrumCanvas->getBandwidth() / 2;
|
||||||
}
|
}
|
||||||
spectrumCanvas->moveCenterFrequency((demod->getFrequency() < spectrumCanvas->getCenterFrequency()) ? diff : -diff);
|
spectrumCanvas->moveCenterFrequency(
|
||||||
|
(demod->getFrequency() < spectrumCanvas->getCenterFrequency()) ? diff : -diff);
|
||||||
demod->setTracking(false);
|
demod->setTracking(false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -2470,7 +2511,7 @@ void AppFrame::handleCurrentModem() {
|
|||||||
if (demod->isDeltaLock() && deltaMode == -1) {
|
if (demod->isDeltaLock() && deltaMode == -1) {
|
||||||
demod->setDeltaLock(false);
|
demod->setDeltaLock(false);
|
||||||
} else if (!demod->isDeltaLock() && deltaMode == 1) {
|
} else if (!demod->isDeltaLock() && deltaMode == 1) {
|
||||||
demod->setDeltaLockOfs(demod->getFrequency()-wxGetApp().getFrequency());
|
demod->setDeltaLockOfs(demod->getFrequency() - wxGetApp().getFrequency());
|
||||||
demod->setDeltaLock(true);
|
demod->setDeltaLock(true);
|
||||||
}
|
}
|
||||||
wxGetApp().getDemodMgr().setLastDeltaLock(demod->isDeltaLock());
|
wxGetApp().getDemodMgr().setLastDeltaLock(demod->isDeltaLock());
|
||||||
@ -2496,7 +2537,7 @@ void AppFrame::handleCurrentModem() {
|
|||||||
}
|
}
|
||||||
soloModeButton->clearModeChanged();
|
soloModeButton->clearModeChanged();
|
||||||
} else {
|
} else {
|
||||||
if (wxGetApp().getSoloMode() != (soloMode==1)) {
|
if (wxGetApp().getSoloMode() != (soloMode == 1)) {
|
||||||
soloModeButton->setSelection(wxGetApp().getSoloMode() ? 1 : -1);
|
soloModeButton->setSelection(wxGetApp().getSoloMode() ? 1 : -1);
|
||||||
soloModeButton->Refresh();
|
soloModeButton->Refresh();
|
||||||
}
|
}
|
||||||
|
@ -254,9 +254,19 @@ private:
|
|||||||
bool actionOnMenuLoadSave(wxCommandEvent& event);
|
bool actionOnMenuLoadSave(wxCommandEvent& event);
|
||||||
bool actionOnMenuRecording(wxCommandEvent& event);
|
bool actionOnMenuRecording(wxCommandEvent& event);
|
||||||
bool actionOnMenuRig(wxCommandEvent& event);
|
bool actionOnMenuRig(wxCommandEvent& event);
|
||||||
|
bool actionOnMenuSDRStartStop(wxCommandEvent &event);
|
||||||
|
bool actionOnMenuPerformance(wxCommandEvent &event);
|
||||||
|
bool actionOnMenuTips(wxCommandEvent &event);
|
||||||
|
bool actionOnMenuIQSwap(wxCommandEvent &event);
|
||||||
|
bool actionOnMenuFreqOffset(wxCommandEvent &event);
|
||||||
|
bool actionOnMenuDBOffset(wxCommandEvent &event);
|
||||||
|
bool actionOnMenuSDRDevices(wxCommandEvent &event);
|
||||||
|
bool actionOnMenuSetPPM(wxCommandEvent &event);
|
||||||
|
bool actionOnMenuClose(wxCommandEvent &event);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UI Action Handlers
|
* UI Activity Handlers
|
||||||
*/
|
*/
|
||||||
void handleUpdateDeviceParams();
|
void handleUpdateDeviceParams();
|
||||||
void handleTXAntennaChange();
|
void handleTXAntennaChange();
|
||||||
@ -302,7 +312,6 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxDECLARE_EVENT_TABLE();
|
wxDECLARE_EVENT_TABLE();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user