mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-09-04 06:07:49 -04:00
Prevent solo-squelch focus from interrupting user actions; acts as temporary hold as well
This commit is contained in:
parent
ad7779de53
commit
6ede20c3e8
@ -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()));
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
|
@ -25,7 +25,9 @@ public:
|
||||
unsigned int getBandwidth();
|
||||
|
||||
MouseTracker *getMouseTracker();
|
||||
|
||||
bool isMouseInView();
|
||||
bool isMouseDown();
|
||||
|
||||
bool isAltDown();
|
||||
bool isCtrlDown();
|
||||
bool isShiftDown();
|
||||
|
@ -730,6 +730,7 @@ void WaterfallCanvas::OnMouseReleased(wxMouseEvent& event) {
|
||||
demod->run();
|
||||
|
||||
wxGetApp().bindDemodulator(demod);
|
||||
DemodulatorThread::releaseSquelchLock(nullptr);
|
||||
}
|
||||
|
||||
if (!demod) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user