Prevent solo-squelch focus from interrupting user actions; acts as temporary hold as well

This commit is contained in:
Charles J. Cliffe 2016-08-16 17:55:40 -04:00
parent ad7779de53
commit 6ede20c3e8
6 changed files with 26 additions and 3 deletions

View File

@ -1928,6 +1928,16 @@ void AppFrame::refreshGainUI() {
gainCanvas->Refresh();
}
bool AppFrame::isUserDemodBusy() {
return (modemProps && modemProps->isMouseInView())
|| (waterfallCanvas->isMouseInView() && waterfallCanvas->isMouseDown())
|| (demodWaterfallCanvas->isMouseInView() && demodWaterfallCanvas->isMouseDown())
|| (wxGetApp().getDemodMgr().getLastActiveDemodulator() &&
wxGetApp().getDemodMgr().getActiveDemodulator() &&
wxGetApp().getDemodMgr().getLastActiveDemodulator() != wxGetApp().getDemodMgr().getActiveDemodulator());
}
#ifdef _WIN32
bool AppFrame::canFocus() {
return (!wxGetApp().isDeviceSelectorOpen() && (!modemProps || !modemProps->isMouseInView()));

View File

@ -101,6 +101,8 @@ public:
void setViewState(long long center_freq, int bandwidth);
void setViewState(long long center_freq);
bool isUserDemodBusy();
#ifdef _WIN32
bool canFocus();
#endif

View File

@ -192,7 +192,7 @@ void DemodulatorThread::run() {
if (squelchEnabled) {
if (!squelched && !squelchBreak) {
if (wxGetApp().getSoloMode()) {
if (wxGetApp().getSoloMode() && !wxGetApp().getAppFrame()->isUserDemodBusy()) {
std::lock_guard < std::mutex > lock(squelchLockMutex);
if (squelchLock.load() == nullptr) {
squelchLock.store(demodInstance);
@ -406,7 +406,7 @@ bool DemodulatorThread::getSquelchBreak() {
void DemodulatorThread::releaseSquelchLock(DemodulatorInstance *inst) {
std::lock_guard < std::mutex > lock(squelchLockMutex);
if (squelchLock.load() == inst) {
if (inst == nullptr || squelchLock.load() == inst) {
squelchLock.store(nullptr);
}
}

View File

@ -183,3 +183,11 @@ void InteractiveCanvas::OnMouseRightDown(wxMouseEvent& event) {
void InteractiveCanvas::OnMouseRightReleased(wxMouseEvent& event) {
mouseTracker.OnMouseRightReleased(event);
}
bool InteractiveCanvas::isMouseInView() {
return mouseTracker.mouseInView();
}
bool InteractiveCanvas::isMouseDown() {
return mouseTracker.mouseInView() && mouseTracker.mouseDown();
}

View File

@ -25,7 +25,9 @@ public:
unsigned int getBandwidth();
MouseTracker *getMouseTracker();
bool isMouseInView();
bool isMouseDown();
bool isAltDown();
bool isCtrlDown();
bool isShiftDown();

View File

@ -730,6 +730,7 @@ void WaterfallCanvas::OnMouseReleased(wxMouseEvent& event) {
demod->run();
wxGetApp().bindDemodulator(demod);
DemodulatorThread::releaseSquelchLock(nullptr);
}
if (!demod) {