use TuiInput in handlers

This commit is contained in:
🪞👃🪞 2024-09-15 16:11:26 +03:00
parent d9535b707f
commit 5d00e9f284
11 changed files with 37 additions and 61 deletions

View file

@ -1,7 +1,7 @@
use crate::*;
impl Handle<Tui> for Mixer<Tui> {
fn handle (&mut self, engine: &Tui) -> Perhaps<bool> {
fn handle (&mut self, engine: &TuiInput) -> Perhaps<bool> {
if let TuiEvent::Input(crossterm::event::Event::Key(event)) = engine.event() {
match event.code {

View file

@ -1,7 +1,7 @@
use crate::*;
impl Handle<Tui> for Plugin<Tui> {
fn handle (&mut self, from: &Tui) -> Perhaps<bool> {
fn handle (&mut self, from: &TuiInput) -> Perhaps<bool> {
match from.event() {
key!(KeyCode::Up) => {
self.selected = self.selected.saturating_sub(1);

View file

@ -72,7 +72,7 @@ impl Widget for AddSampleModal {
}
impl Handle<Tui> for AddSampleModal {
fn handle (&mut self, from: &Tui) -> Perhaps<bool> {
fn handle (&mut self, from: &TuiInput) -> Perhaps<bool> {
if handle_keymap(self, &from.event(), KEYMAP_ADD_SAMPLE)? {
return Ok(Some(true))
}

View file

@ -1,6 +1,6 @@
use crate::*;
impl Handle<Tui> for Sampler {
fn handle (&mut self, from: &Tui) -> Perhaps<bool> {
fn handle (&mut self, from: &TuiInput) -> Perhaps<bool> {
match from.event() {
key!(KeyCode::Up) => {
self.cursor.0 = if self.cursor.0 == 0 {

View file

@ -1,7 +1,7 @@
use crate::*;
impl Handle<Tui> for Track<Tui> {
fn handle (&mut self, from: &Tui) -> Perhaps<bool> {
fn handle (&mut self, from: &TuiInput) -> Perhaps<bool> {
match from.event() {
//, NONE, "chain_cursor_up", "move cursor up", || {
key!(KeyCode::Up) => {