From d47ca1994bf3d2c39e3a2ee4b3dcc4ce5ebf45fa Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Thu, 18 Feb 2021 15:22:02 +0100 Subject: [PATCH] More beeps --- radio/src/thirdparty/libopenui/src/form.cpp | 12 +++++++++++- radio/src/thirdparty/libopenui/src/menu.cpp | 14 +++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/radio/src/thirdparty/libopenui/src/form.cpp b/radio/src/thirdparty/libopenui/src/form.cpp index 10e9ea624..eea53358c 100644 --- a/radio/src/thirdparty/libopenui/src/form.cpp +++ b/radio/src/thirdparty/libopenui/src/form.cpp @@ -39,19 +39,23 @@ void FormField::onEvent(event_t event) if (event == EVT_ROTARY_RIGHT/*EVT_KEY_BREAK(KEY_DOWN)*/) { if (next) { + onKeyPress(); next->setFocus(SET_FOCUS_FORWARD); } } else if (event == EVT_ROTARY_LEFT/*EVT_KEY_BREAK(KEY_UP)*/) { if (previous) { + onKeyPress(); previous->setFocus(SET_FOCUS_BACKWARD); } } else if (event == EVT_KEY_BREAK(KEY_ENTER)) { + onKeyPress(); setEditMode(!editMode); invalidate(); } else if (event == EVT_KEY_BREAK(KEY_EXIT) && editMode) { + onKeyPress(); setEditMode(false); invalidate(); } @@ -210,15 +214,19 @@ void FormGroup::onEvent(event_t event) TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString("FormGroup").c_str(), event); if (event == EVT_KEY_BREAK(KEY_ENTER)) { + onKeyPress(); setFocusOnFirstVisibleField(SET_FOCUS_FIRST); } else if (event == EVT_KEY_BREAK(KEY_EXIT) && !hasFocus() && !(windowFlags & FORM_FORWARD_FOCUS)) { + onKeyPress(); setFocus(SET_FOCUS_DEFAULT); // opentx - model - timers settings } else if (event == EVT_ROTARY_RIGHT && !next) { + onKeyPress(); setFocusOnFirstVisibleField(SET_FOCUS_FIRST); } else if (event == EVT_ROTARY_LEFT && !previous) { + onKeyPress(); setFocusOnLastVisibleField(SET_FOCUS_BACKWARD); } else { @@ -245,10 +253,12 @@ void FormWindow::onEvent(event_t event) TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString("FormWindow").c_str(), event); if (event == EVT_KEY_BREAK(KEY_EXIT) && (windowFlags & FORM_FORWARD_FOCUS) && first) { + onKeyPress(); Window * currentFocus = getFocus(); first->setFocus(SET_FOCUS_FIRST); - if (getFocus() != currentFocus) + if (getFocus() != currentFocus) { return; + } } FormGroup::onEvent(event); diff --git a/radio/src/thirdparty/libopenui/src/menu.cpp b/radio/src/thirdparty/libopenui/src/menu.cpp index 4ff454f63..22b5e3c0c 100644 --- a/radio/src/thirdparty/libopenui/src/menu.cpp +++ b/radio/src/thirdparty/libopenui/src/menu.cpp @@ -36,15 +36,20 @@ void MenuBody::onEvent(event_t event) TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event); if (event == EVT_ROTARY_RIGHT) { - if (!lines.empty()) + if (!lines.empty()) { select(int((selectedIndex + 1) % lines.size())); + onKeyPress(); + } } else if (event == EVT_ROTARY_LEFT) { - if (!lines.empty()) + if (!lines.empty()) { select(int(selectedIndex <= 0 ? lines.size() - 1 : selectedIndex - 1)); + onKeyPress(); + } } else if (event == EVT_KEY_BREAK(KEY_ENTER)) { if (!lines.empty()) { + onKeyPress(); if (selectedIndex < 0) { select(0); } @@ -62,8 +67,10 @@ void MenuBody::onEvent(event_t event) } } else if (event == EVT_KEY_BREAK(KEY_EXIT)) { - if (onCancel) + onKeyPress(); + if (onCancel) { onCancel(); + } Window::onEvent(event); } else { @@ -78,6 +85,7 @@ bool MenuBody::onTouchEnd(coord_t /*x*/, coord_t y) Menu * menu = getParentMenu(); int index = y / MENUS_LINE_HEIGHT; if (index < (int)lines.size()) { + onKeyPress(); if (menu->multiple) { if (selectedIndex == index) lines[index].onPress();