mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-13 23:51:46 -05:00
menu action cleanup/refactoring
This commit is contained in:
parent
58d4f484e4
commit
c67330e985
633
src/AppFrame.cpp
633
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,8 +1814,8 @@ 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;
|
||||||
|
|
||||||
#ifdef USE_HAMLIB
|
#ifdef USE_HAMLIB
|
||||||
@ -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;
|
||||||
@ -1820,7 +1843,7 @@ bool AppFrame::actionOnMenuRig(wxCommandEvent& event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int rigSerialIdMax = wxID_RIG_SERIAL_BASE + rigSerialRates.size();
|
int rigSerialIdMax = wxID_RIG_SERIAL_BASE + rigSerialRates.size();
|
||||||
|
|
||||||
if (event.GetId() >= wxID_RIG_SERIAL_BASE && event.GetId() < rigSerialIdMax) {
|
if (event.GetId() >= wxID_RIG_SERIAL_BASE && event.GetId() < rigSerialIdMax) {
|
||||||
int serialIdx = event.GetId() - wxID_RIG_SERIAL_BASE;
|
int serialIdx = event.GetId() - wxID_RIG_SERIAL_BASE;
|
||||||
rigSerialRate = rigSerialRates[serialIdx];
|
rigSerialRate = rigSerialRates[serialIdx];
|
||||||
@ -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) {
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
|
|
||||||
@ -2127,13 +2160,13 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
|||||||
#if USE_HAMLIB
|
#if USE_HAMLIB
|
||||||
handleRigMenu();
|
handleRigMenu();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (scopeCanvas && scopeCanvas->HasFocus()) {
|
if (scopeCanvas && scopeCanvas->HasFocus()) {
|
||||||
waterfallCanvas->SetFocus();
|
waterfallCanvas->SetFocus();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!this->IsActive()) {
|
if (!this->IsActive()) {
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(30));
|
std::this_thread::sleep_for(std::chrono::milliseconds(30));
|
||||||
} else {
|
} else {
|
||||||
@ -2143,7 +2176,7 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
|||||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
event.RequestMore();
|
event.RequestMore();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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();
|
||||||
}
|
}
|
||||||
@ -2278,30 +2315,31 @@ void AppFrame::handleScopeProcessor() {
|
|||||||
|
|
||||||
void AppFrame::handleMuteButton() {
|
void AppFrame::handleMuteButton() {
|
||||||
if (demodMuteButton->modeChanged()) {
|
if (demodMuteButton->modeChanged()) {
|
||||||
int muteMode = demodMuteButton->getSelection();
|
int muteMode = demodMuteButton->getSelection();
|
||||||
if (muteMode == -1) {
|
if (muteMode == -1) {
|
||||||
wxGetApp().getDemodMgr().setLastMuted(false);
|
wxGetApp().getDemodMgr().setLastMuted(false);
|
||||||
} else if (muteMode == 1) {
|
} else if (muteMode == 1) {
|
||||||
wxGetApp().getDemodMgr().setLastMuted(true);
|
wxGetApp().getDemodMgr().setLastMuted(true);
|
||||||
}
|
|
||||||
demodMuteButton->clearModeChanged();
|
|
||||||
}
|
}
|
||||||
|
demodMuteButton->clearModeChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppFrame::handleSpectrumWaterfall() {
|
void AppFrame::handleSpectrumWaterfall() {
|
||||||
if (spectrumCanvas->getViewState() && abs(wxGetApp().getFrequency() - spectrumCanvas->getCenterFrequency()) > (wxGetApp().getSampleRate() / 2)) {
|
if (spectrumCanvas->getViewState() &&
|
||||||
spectrumCanvas->setCenterFrequency(wxGetApp().getFrequency());
|
abs(wxGetApp().getFrequency() - spectrumCanvas->getCenterFrequency()) > (wxGetApp().getSampleRate() / 2)) {
|
||||||
waterfallCanvas->setCenterFrequency(wxGetApp().getFrequency());
|
spectrumCanvas->setCenterFrequency(wxGetApp().getFrequency());
|
||||||
}
|
waterfallCanvas->setCenterFrequency(wxGetApp().getFrequency());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppFrame::handleDemodWaterfallSpectrum() {
|
void AppFrame::handleDemodWaterfallSpectrum() {
|
||||||
if (demodWaterfallCanvas && wxGetApp().getFrequency() != demodWaterfallCanvas->getCenterFrequency()) {
|
if (demodWaterfallCanvas && wxGetApp().getFrequency() != demodWaterfallCanvas->getCenterFrequency()) {
|
||||||
demodWaterfallCanvas->setCenterFrequency(wxGetApp().getFrequency());
|
demodWaterfallCanvas->setCenterFrequency(wxGetApp().getFrequency());
|
||||||
if (demodSpectrumCanvas) {
|
if (demodSpectrumCanvas) {
|
||||||
demodSpectrumCanvas->setCenterFrequency(wxGetApp().getFrequency());
|
demodSpectrumCanvas->setCenterFrequency(wxGetApp().getFrequency());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppFrame::handleGainMeter() {
|
void AppFrame::handleGainMeter() {
|
||||||
@ -2309,12 +2347,12 @@ void AppFrame::handleGainMeter() {
|
|||||||
|
|
||||||
demodGainMeter->setLevel(mgr->getLastGain());
|
demodGainMeter->setLevel(mgr->getLastGain());
|
||||||
if (demodSignalMeter->inputChanged()) {
|
if (demodSignalMeter->inputChanged()) {
|
||||||
mgr->setLastSquelchLevel(demodSignalMeter->getInputValue());
|
mgr->setLastSquelchLevel(demodSignalMeter->getInputValue());
|
||||||
}
|
}
|
||||||
if (demodGainMeter->inputChanged()) {
|
if (demodGainMeter->inputChanged()) {
|
||||||
mgr->setLastGain(demodGainMeter->getInputValue());
|
mgr->setLastGain(demodGainMeter->getInputValue());
|
||||||
demodGainMeter->setLevel(demodGainMeter->getInputValue());
|
demodGainMeter->setLevel(demodGainMeter->getInputValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppFrame::handleModeSelector() {
|
void AppFrame::handleModeSelector() {
|
||||||
@ -2326,18 +2364,18 @@ void AppFrame::handleModeSelector() {
|
|||||||
|
|
||||||
// basic demodulators
|
// basic demodulators
|
||||||
if (dSelection != "" && dSelection != mgr->getLastDemodulatorType()) {
|
if (dSelection != "" && dSelection != mgr->getLastDemodulatorType()) {
|
||||||
mgr->setLastDemodulatorType(dSelection);
|
mgr->setLastDemodulatorType(dSelection);
|
||||||
mgr->setLastBandwidth(Modem::getModemDefaultSampleRate(dSelection));
|
mgr->setLastBandwidth(Modem::getModemDefaultSampleRate(dSelection));
|
||||||
demodTuner->setHalfBand(dSelection == "USB" || dSelection == "LSB");
|
demodTuner->setHalfBand(dSelection == "USB" || dSelection == "LSB");
|
||||||
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);
|
||||||
demodModeSelector->setSelection(-1);
|
demodModeSelector->setSelection(-1);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// basic demodulators
|
// basic demodulators
|
||||||
if (dSelection != "" && dSelection != mgr->getLastDemodulatorType()) {
|
if (dSelection != "" && dSelection != mgr->getLastDemodulatorType()) {
|
||||||
@ -2353,173 +2391,176 @@ void AppFrame::handleCurrentModem() {
|
|||||||
DemodulatorInstancePtr demod = wxGetApp().getDemodMgr().getCurrentModem();
|
DemodulatorInstancePtr demod = wxGetApp().getDemodMgr().getCurrentModem();
|
||||||
|
|
||||||
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()) {
|
||||||
diff = abs(demod->getFrequency() - spectrumCanvas->getCenterFrequency());
|
diff = abs(demod->getFrequency() - spectrumCanvas->getCenterFrequency());
|
||||||
} else {
|
} else {
|
||||||
diff = diff - spectrumCanvas->getBandwidth() / 2;
|
diff = diff - spectrumCanvas->getBandwidth() / 2;
|
||||||
}
|
|
||||||
spectrumCanvas->moveCenterFrequency((demod->getFrequency() < spectrumCanvas->getCenterFrequency()) ? diff : -diff);
|
|
||||||
demod->setTracking(false);
|
|
||||||
}
|
}
|
||||||
} else {
|
spectrumCanvas->moveCenterFrequency(
|
||||||
|
(demod->getFrequency() < spectrumCanvas->getCenterFrequency()) ? diff : -diff);
|
||||||
demod->setTracking(false);
|
demod->setTracking(false);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
demod->setTracking(false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (demod->getBandwidth() != wxGetApp().getDemodMgr().getLastBandwidth()) {
|
if (demod->getBandwidth() != wxGetApp().getDemodMgr().getLastBandwidth()) {
|
||||||
wxGetApp().getDemodMgr().setLastBandwidth(demod->getBandwidth());
|
wxGetApp().getDemodMgr().setLastBandwidth(demod->getBandwidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (demod.get() != activeDemodulator) {
|
if (demod.get() != activeDemodulator) {
|
||||||
demodSignalMeter->setInputValue(demod->getSquelchLevel());
|
demodSignalMeter->setInputValue(demod->getSquelchLevel());
|
||||||
demodGainMeter->setInputValue(demod->getGain());
|
demodGainMeter->setInputValue(demod->getGain());
|
||||||
wxGetApp().getDemodMgr().setLastGain(demod->getGain());
|
wxGetApp().getDemodMgr().setLastGain(demod->getGain());
|
||||||
int outputDevice = demod->getOutputDevice();
|
int outputDevice = demod->getOutputDevice();
|
||||||
if (scopeCanvas) {
|
if (scopeCanvas) {
|
||||||
auto outputDevices = wxGetApp().getDemodMgr().getOutputDevices();
|
auto outputDevices = wxGetApp().getDemodMgr().getOutputDevices();
|
||||||
scopeCanvas->setDeviceName(outputDevices[outputDevice].name);
|
scopeCanvas->setDeviceName(outputDevices[outputDevice].name);
|
||||||
}
|
}
|
||||||
// outputDeviceMenuItems[outputDevice]->Check(true);
|
// outputDeviceMenuItems[outputDevice]->Check(true);
|
||||||
string dType = demod->getDemodulatorType();
|
string dType = demod->getDemodulatorType();
|
||||||
demodModeSelector->setSelection(dType);
|
demodModeSelector->setSelection(dType);
|
||||||
#ifdef ENABLE_DIGITAL_LAB
|
#ifdef ENABLE_DIGITAL_LAB
|
||||||
demodModeSelectorAdv->setSelection(dType);
|
demodModeSelectorAdv->setSelection(dType);
|
||||||
#endif
|
#endif
|
||||||
deltaLockButton->setSelection(demod->isDeltaLock() ? 1 : -1);
|
deltaLockButton->setSelection(demod->isDeltaLock() ? 1 : -1);
|
||||||
demodMuteButton->setSelection(demod->isMuted() ? 1 : -1);
|
demodMuteButton->setSelection(demod->isMuted() ? 1 : -1);
|
||||||
modemPropertiesUpdated.store(true);
|
modemPropertiesUpdated.store(true);
|
||||||
demodTuner->setHalfBand(dType == "USB" || dType == "LSB");
|
demodTuner->setHalfBand(dType == "USB" || dType == "LSB");
|
||||||
}
|
}
|
||||||
if (!demodWaterfallCanvas || demodWaterfallCanvas->getDragState() == WaterfallCanvas::WF_DRAG_NONE) {
|
if (!demodWaterfallCanvas || demodWaterfallCanvas->getDragState() == WaterfallCanvas::WF_DRAG_NONE) {
|
||||||
long long centerFreq = demod->getFrequency();
|
long long centerFreq = demod->getFrequency();
|
||||||
unsigned int demodBw = (unsigned int) ceil((float) demod->getBandwidth() * 2.25);
|
unsigned int demodBw = (unsigned int) ceil((float) demod->getBandwidth() * 2.25);
|
||||||
|
|
||||||
if (demod->getDemodulatorType() == "USB") {
|
if (demod->getDemodulatorType() == "USB") {
|
||||||
demodBw /= 2;
|
demodBw /= 2;
|
||||||
centerFreq += demod->getBandwidth() / 4;
|
centerFreq += demod->getBandwidth() / 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (demod->getDemodulatorType() == "LSB") {
|
if (demod->getDemodulatorType() == "LSB") {
|
||||||
demodBw /= 2;
|
demodBw /= 2;
|
||||||
centerFreq -= demod->getBandwidth() / 4;
|
centerFreq -= demod->getBandwidth() / 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (demodBw > wxGetApp().getSampleRate() / 2) {
|
if (demodBw > wxGetApp().getSampleRate() / 2) {
|
||||||
demodBw = wxGetApp().getSampleRate() / 2;
|
demodBw = wxGetApp().getSampleRate() / 2;
|
||||||
}
|
}
|
||||||
if (demodBw < 20000) {
|
if (demodBw < 20000) {
|
||||||
demodBw = 20000;
|
demodBw = 20000;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (demodWaterfallCanvas && centerFreq != demodWaterfallCanvas->getCenterFrequency()) {
|
if (demodWaterfallCanvas && centerFreq != demodWaterfallCanvas->getCenterFrequency()) {
|
||||||
demodWaterfallCanvas->setCenterFrequency(centerFreq);
|
demodWaterfallCanvas->setCenterFrequency(centerFreq);
|
||||||
demodSpectrumCanvas->setCenterFrequency(centerFreq);
|
demodSpectrumCanvas->setCenterFrequency(centerFreq);
|
||||||
}
|
}
|
||||||
|
|
||||||
string dSelection = demodModeSelector->getSelectionLabel();
|
string dSelection = demodModeSelector->getSelectionLabel();
|
||||||
#ifdef ENABLE_DIGITAL_LAB
|
#ifdef ENABLE_DIGITAL_LAB
|
||||||
string dSelectionadv = demodModeSelectorAdv->getSelectionLabel();
|
string dSelectionadv = demodModeSelectorAdv->getSelectionLabel();
|
||||||
|
|
||||||
// basic demodulators
|
// basic demodulators
|
||||||
if (dSelection != "" && dSelection != demod->getDemodulatorType()) {
|
if (dSelection != "" && dSelection != demod->getDemodulatorType()) {
|
||||||
demod->setDemodulatorType(dSelection);
|
demod->setDemodulatorType(dSelection);
|
||||||
demodTuner->setHalfBand(dSelection == "USB" || dSelection == "LSB");
|
demodTuner->setHalfBand(dSelection == "USB" || dSelection == "LSB");
|
||||||
demodModeSelectorAdv->setSelection(-1);
|
demodModeSelectorAdv->setSelection(-1);
|
||||||
}
|
}
|
||||||
// advanced demodulators
|
// advanced demodulators
|
||||||
else if (dSelectionadv != "" && dSelectionadv != demod->getDemodulatorType()) {
|
else if (dSelectionadv != "" && dSelectionadv != demod->getDemodulatorType()) {
|
||||||
demod->setDemodulatorType(dSelectionadv);
|
demod->setDemodulatorType(dSelectionadv);
|
||||||
demodTuner->setHalfBand(false);
|
demodTuner->setHalfBand(false);
|
||||||
demodModeSelector->setSelection(-1);
|
demodModeSelector->setSelection(-1);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// basic demodulators
|
// basic demodulators
|
||||||
if (dSelection != "" && dSelection != demod->getDemodulatorType()) {
|
if (dSelection != "" && dSelection != demod->getDemodulatorType()) {
|
||||||
demod->setDemodulatorType(dSelection);
|
demod->setDemodulatorType(dSelection);
|
||||||
demodTuner->setHalfBand(dSelection=="USB" || dSelection=="LSB");
|
demodTuner->setHalfBand(dSelection=="USB" || dSelection=="LSB");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int muteMode = demodMuteButton->getSelection();
|
int muteMode = demodMuteButton->getSelection();
|
||||||
if (demodMuteButton->modeChanged()) {
|
if (demodMuteButton->modeChanged()) {
|
||||||
if (demod->isMuted() && muteMode == -1) {
|
if (demod->isMuted() && muteMode == -1) {
|
||||||
demod->setMuted(false);
|
demod->setMuted(false);
|
||||||
} else if (!demod->isMuted() && muteMode == 1) {
|
} else if (!demod->isMuted() && muteMode == 1) {
|
||||||
demod->setMuted(true);
|
demod->setMuted(true);
|
||||||
}
|
}
|
||||||
|
wxGetApp().getDemodMgr().setLastMuted(demod->isMuted());
|
||||||
|
demodMuteButton->clearModeChanged();
|
||||||
|
} else {
|
||||||
|
if (demod->isMuted() && muteMode == -1) {
|
||||||
|
demodMuteButton->setSelection(1);
|
||||||
wxGetApp().getDemodMgr().setLastMuted(demod->isMuted());
|
wxGetApp().getDemodMgr().setLastMuted(demod->isMuted());
|
||||||
demodMuteButton->clearModeChanged();
|
demodMuteButton->Refresh();
|
||||||
} else {
|
} else if (!demod->isMuted() && muteMode == 1) {
|
||||||
if (demod->isMuted() && muteMode == -1) {
|
demodMuteButton->setSelection(-1);
|
||||||
demodMuteButton->setSelection(1);
|
wxGetApp().getDemodMgr().setLastMuted(demod->isMuted());
|
||||||
wxGetApp().getDemodMgr().setLastMuted(demod->isMuted());
|
demodMuteButton->Refresh();
|
||||||
demodMuteButton->Refresh();
|
|
||||||
} else if (!demod->isMuted() && muteMode == 1) {
|
|
||||||
demodMuteButton->setSelection(-1);
|
|
||||||
wxGetApp().getDemodMgr().setLastMuted(demod->isMuted());
|
|
||||||
demodMuteButton->Refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int deltaMode = deltaLockButton->getSelection();
|
|
||||||
if (deltaLockButton->modeChanged()) {
|
|
||||||
if (demod->isDeltaLock() && deltaMode == -1) {
|
|
||||||
demod->setDeltaLock(false);
|
|
||||||
} else if (!demod->isDeltaLock() && deltaMode == 1) {
|
|
||||||
demod->setDeltaLockOfs(demod->getFrequency()-wxGetApp().getFrequency());
|
|
||||||
demod->setDeltaLock(true);
|
|
||||||
}
|
|
||||||
wxGetApp().getDemodMgr().setLastDeltaLock(demod->isDeltaLock());
|
|
||||||
deltaLockButton->clearModeChanged();
|
|
||||||
} else {
|
|
||||||
if (demod->isDeltaLock() && deltaMode == -1) {
|
|
||||||
deltaLockButton->setSelection(1);
|
|
||||||
wxGetApp().getDemodMgr().setLastDeltaLock(true);
|
|
||||||
deltaLockButton->Refresh();
|
|
||||||
} else if (!demod->isDeltaLock() && deltaMode == 1) {
|
|
||||||
deltaLockButton->setSelection(-1);
|
|
||||||
wxGetApp().getDemodMgr().setLastDeltaLock(false);
|
|
||||||
deltaLockButton->Refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int soloMode = soloModeButton->getSelection();
|
|
||||||
if (soloModeButton->modeChanged()) {
|
|
||||||
if (soloMode == 1) {
|
|
||||||
wxGetApp().setSoloMode(true);
|
|
||||||
} else {
|
|
||||||
wxGetApp().setSoloMode(false);
|
|
||||||
}
|
|
||||||
soloModeButton->clearModeChanged();
|
|
||||||
} else {
|
|
||||||
if (wxGetApp().getSoloMode() != (soloMode==1)) {
|
|
||||||
soloModeButton->setSelection(wxGetApp().getSoloMode() ? 1 : -1);
|
|
||||||
soloModeButton->Refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (demodWaterfallCanvas) {
|
|
||||||
demodWaterfallCanvas->setBandwidth(demodBw);
|
|
||||||
demodSpectrumCanvas->setBandwidth(demodBw);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int deltaMode = deltaLockButton->getSelection();
|
||||||
|
if (deltaLockButton->modeChanged()) {
|
||||||
|
if (demod->isDeltaLock() && deltaMode == -1) {
|
||||||
|
demod->setDeltaLock(false);
|
||||||
|
} else if (!demod->isDeltaLock() && deltaMode == 1) {
|
||||||
|
demod->setDeltaLockOfs(demod->getFrequency() - wxGetApp().getFrequency());
|
||||||
|
demod->setDeltaLock(true);
|
||||||
|
}
|
||||||
|
wxGetApp().getDemodMgr().setLastDeltaLock(demod->isDeltaLock());
|
||||||
|
deltaLockButton->clearModeChanged();
|
||||||
|
} else {
|
||||||
|
if (demod->isDeltaLock() && deltaMode == -1) {
|
||||||
|
deltaLockButton->setSelection(1);
|
||||||
|
wxGetApp().getDemodMgr().setLastDeltaLock(true);
|
||||||
|
deltaLockButton->Refresh();
|
||||||
|
} else if (!demod->isDeltaLock() && deltaMode == 1) {
|
||||||
|
deltaLockButton->setSelection(-1);
|
||||||
|
wxGetApp().getDemodMgr().setLastDeltaLock(false);
|
||||||
|
deltaLockButton->Refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int soloMode = soloModeButton->getSelection();
|
||||||
|
if (soloModeButton->modeChanged()) {
|
||||||
|
if (soloMode == 1) {
|
||||||
|
wxGetApp().setSoloMode(true);
|
||||||
|
} else {
|
||||||
|
wxGetApp().setSoloMode(false);
|
||||||
|
}
|
||||||
|
soloModeButton->clearModeChanged();
|
||||||
|
} else {
|
||||||
|
if (wxGetApp().getSoloMode() != (soloMode == 1)) {
|
||||||
|
soloModeButton->setSelection(wxGetApp().getSoloMode() ? 1 : -1);
|
||||||
|
soloModeButton->Refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (demodWaterfallCanvas) {
|
||||||
|
demodWaterfallCanvas->setBandwidth(demodBw);
|
||||||
|
demodSpectrumCanvas->setBandwidth(demodBw);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
demodSignalMeter->setLevel(demod->getSignalLevel());
|
demodSignalMeter->setLevel(demod->getSignalLevel());
|
||||||
demodSignalMeter->setMin(demod->getSignalFloor());
|
demodSignalMeter->setMin(demod->getSignalFloor());
|
||||||
demodSignalMeter->setMax(demod->getSignalCeil());
|
demodSignalMeter->setMax(demod->getSignalCeil());
|
||||||
|
|
||||||
demodGainMeter->setLevel(demod->getGain());
|
demodGainMeter->setLevel(demod->getGain());
|
||||||
if (demodSignalMeter->inputChanged()) {
|
if (demodSignalMeter->inputChanged()) {
|
||||||
demod->setSquelchLevel(demodSignalMeter->getInputValue());
|
demod->setSquelchLevel(demodSignalMeter->getInputValue());
|
||||||
}
|
}
|
||||||
if (demodGainMeter->inputChanged()) {
|
if (demodGainMeter->inputChanged()) {
|
||||||
demod->setGain(demodGainMeter->getInputValue());
|
demod->setGain(demodGainMeter->getInputValue());
|
||||||
demodGainMeter->setLevel(demodGainMeter->getInputValue());
|
demodGainMeter->setLevel(demodGainMeter->getInputValue());
|
||||||
}
|
}
|
||||||
activeDemodulator = demod.get();
|
activeDemodulator = demod.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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