From 31d9a3e1c3d1f896c9870e6401a95b6be39b38f2 Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Fri, 30 Jun 2023 17:05:06 -0400 Subject: [PATCH] implement support for "Tab" to cycle the selected and active host; --- src/monitor/MonitorMainWnd.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/monitor/MonitorMainWnd.h b/src/monitor/MonitorMainWnd.h index c43be3f4..1bdf031b 100644 --- a/src/monitor/MonitorMainWnd.h +++ b/src/monitor/MonitorMainWnd.h @@ -127,6 +127,7 @@ private: LogDisplayWnd m_logWnd{this}; SelectedNodeWnd m_selectWnd{this}; std::vector m_nodes; + uint32_t m_activeNodeId = 0U; lookups::VoiceChData m_selectedCh; @@ -202,6 +203,12 @@ private: m_selectWnd.setSelectedText(ss.str()); m_selectedCh = wnd->getChData(); + + auto it = std::find(m_nodes.begin(), m_nodes.end(), wnd); + if (it != m_nodes.end()) { + uint32_t i = it - m_nodes.begin(); + m_activeNodeId = i; + } }, wnd); offsX += NODE_STATUS_WIDTH + 2; @@ -229,6 +236,29 @@ private: ** Event Handlers */ + /// + /// + /// + /// + void onKeyPress(finalcut::FKeyEvent* e) override + { + const FKey key = e->key(); + if (key == FKey::Tab) { + // lower and deactivate current window + m_nodes.at(m_activeNodeId)->lowerWindow(); + m_nodes.at(m_activeNodeId)->deactivateWindow(); + + m_activeNodeId++; + if (m_activeNodeId >= m_nodes.size()) { + m_activeNodeId = 0U; + } + + // raise and activate window + m_nodes.at(m_activeNodeId)->raiseWindow(); + m_nodes.at(m_activeNodeId)->activateWindow(); + } + } + /// /// ///