From c6a36ed677dc84c40c89474d2358e1a89c44754c Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 4 Mar 2017 19:49:48 +0100 Subject: [PATCH] unbreak msgbox the "if (msg)" was basically always true, killing all keys that were not handled in this clause (e.g. it was not possible to switch the box from standby if a plugin with output was running during standby) Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/f9b7fca210978a90cadd9cbdfd5cd8b85e2b38cf Author: Stefan Seyfried Date: 2017-03-04 (Sat, 04 Mar 2017) --- src/gui/widget/msgbox.cpp | 82 +++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 42 deletions(-) diff --git a/src/gui/widget/msgbox.cpp b/src/gui/widget/msgbox.cpp index 28657be05..12caa52ef 100644 --- a/src/gui/widget/msgbox.cpp +++ b/src/gui/widget/msgbox.cpp @@ -276,53 +276,51 @@ int CMsgBox::exec() { scroll_down(); } - else if (msg){ - //***navi buttons for button selection*** - if(msg==CRCInput::RC_right || msg==CRCInput::RC_left) - { - if(msg==CRCInput::RC_right){ - ccw_footer->setSelectedButton(selected+1); - mb_show_button = ccw_footer->getSelectedButtonObject()->getButtonAlias(); - } - if(msg==CRCInput::RC_left){ - ccw_footer->setSelectedButton(selected-1); - mb_show_button = ccw_footer->getSelectedButtonObject()->getButtonAlias(); - } - selected = ccw_footer->getSelectedButton(); + //***navi buttons for button selection*** + else if(msg == CRCInput::RC_right || msg == CRCInput::RC_left) + { + if (msg == CRCInput::RC_right) { + ccw_footer->setSelectedButton(selected+1); + mb_show_button = ccw_footer->getSelectedButtonObject()->getButtonAlias(); + } + if (msg == CRCInput::RC_left) { + ccw_footer->setSelectedButton(selected-1); + mb_show_button = ccw_footer->getSelectedButtonObject()->getButtonAlias(); + } + selected = ccw_footer->getSelectedButton(); - //***refresh buttons only if we have more than one button, this avoids unnecessary repaints with possible flicker effects*** - if (ccw_footer->getButtonChainObject()->size()>1) - refreshFoot(); + //***refresh buttons only if we have more than one button, this avoids unnecessary repaints with possible flicker effects*** + if (ccw_footer->getButtonChainObject()->size()>1) + refreshFoot(); - //***refresh timeout on any pressed navi key! This resets current timeout end to initial value*** - if (timeout > 0){ - timeout_pb->setValues(0, timeout); - timeoutEnd = CRCInput::calcTimeoutEnd(timeout); - } + //***refresh timeout on any pressed navi key! This resets current timeout end to initial value*** + if (timeout > 0) { + timeout_pb->setValues(0, timeout); + timeoutEnd = CRCInput::calcTimeoutEnd(timeout); + } + dprintf(DEBUG_INFO, "\033[32m[CMsgBox] [%s - %d] result = %d, mb_show_button = %d\033[0m\n", __func__, __LINE__, result, mb_show_button); + } + + //***action buttons without preselection*** + for (size_t i = 0; i< ccw_footer->getButtonChainObject()->size(); i++){ + CComponentsButton* btn_action = static_cast(ccw_footer->getButtonChainObject()->getCCItem(i)); + if (msg == btn_action->getButtonDirectKey() || msg == btn_action->getButtonDirectKeyA()){ + result = (msg_result_t)btn_action->getButtonResult(); dprintf(DEBUG_INFO, "\033[32m[CMsgBox] [%s - %d] result = %d, mb_show_button = %d\033[0m\n", __func__, __LINE__, result, mb_show_button); - } - - //***action buttons without preselection*** - for (size_t i = 0; i< ccw_footer->getButtonChainObject()->size(); i++){ - CComponentsButton* btn_action = static_cast(ccw_footer->getButtonChainObject()->getCCItem(i)); - if (msg == btn_action->getButtonDirectKey() || msg == btn_action->getButtonDirectKeyA()){ - result = (msg_result_t)btn_action->getButtonResult(); - dprintf(DEBUG_INFO, "\033[32m[CMsgBox] [%s - %d] result = %d, mb_show_button = %d\033[0m\n", __func__, __LINE__, result, mb_show_button); - loop = false; - } - } - //***action button ok with preselected button*** - if ((msg == CRCInput::RC_ok) && (ccw_footer->getSelectedButtonObject()->getButtonAlias() == mb_show_button)){ - result = (msg_result_t)ccw_footer->getSelectedButtonObject()->getButtonResult(); loop = false; } - else if (msg == NeutrinoMessages::RECORD_START || msg == NeutrinoMessages::RECORD_STOP) { - CNeutrinoApp::getInstance()->handleMsg(msg, data); - } - //***ignore*** - else if (CNeutrinoApp::getInstance()->listModeKey(msg)){ - // do nothing //TODO: if passed rc messages are ignored rc messaages: has no effect here too!! - } + } + //***action button ok with preselected button*** + if ((msg == CRCInput::RC_ok) && (ccw_footer->getSelectedButtonObject()->getButtonAlias() == mb_show_button)){ + result = (msg_result_t)ccw_footer->getSelectedButtonObject()->getButtonResult(); + loop = false; + } + else if (msg == NeutrinoMessages::RECORD_START || msg == NeutrinoMessages::RECORD_STOP) { + CNeutrinoApp::getInstance()->handleMsg(msg, data); + } + //***ignore*** + else if (CNeutrinoApp::getInstance()->listModeKey(msg)){ + // do nothing //TODO: if passed rc messages are ignored rc messaages: has no effect here too!! } else if (CNeutrinoApp::getInstance()->handleMsg(msg, data) & messages_return::cancel_all) {