wip: big flat pt.9: down to 141, looking good!

This commit is contained in:
🪞👃🪞 2024-12-30 20:43:22 +01:00
parent e958b4a2d2
commit d01aa7481b
7 changed files with 39 additions and 12 deletions

View file

@ -152,7 +152,7 @@ border! {
"" ""
"" "" "" fn style (&self) -> Option<Style> { Some(self.0) }
},
Tab {
TabLike {
"" "" ""
"" ""
"" " " "" fn style (&self) -> Option<Style> { Some(self.0) }

View file

@ -15,7 +15,7 @@ pub(crate) use ::tek_layout::{
crossterm::{
self,
event::{
KeyEvent, KeyEventKind, KeyEventState, KeyModifiers,
Event, KeyEvent, KeyEventKind, KeyEventState, KeyModifiers,
KeyCode::{self, *},
}
},

View file

@ -30,8 +30,11 @@ pub enum PhraseCommand {
}
event_map_input_to_command!(Tui: MidiEditor: PhraseCommand: MidiEditor::KEYS);
pub(crate) type KeyMapping<const N: usize, E, T, U> = [(E, &'static dyn Fn(&T)->U);N];
impl MidiEditor {
const KEYS: KeyMapping<31, Self> = [
const KEYS: KeyMapping<31, Event, Self, PhraseCommand> = [
(kexp!(Ctrl-Alt-Up), &|s: &Self|SetNoteScroll(s.note_point() + 3)),
(kexp!(Ctrl-Alt-Down), &|s: &Self|SetNoteScroll(s.note_point().saturating_sub(3))),
(kexp!(Ctrl-Alt-Left), &|s: &Self|SetTimeScroll(s.time_point().saturating_sub(s.time_zoom().get()))),

View file

@ -165,8 +165,8 @@ impl<'a> Render<Tui> for TrackView<'a> {
//}
//}
handle!(<Tui>|self:Mixer,engine|{
if let TuiEvent::Input(crossterm::event::Event::Key(event)) = engine.event() {
handle!(<Tui>|self: Mixer, engine|{
if let crossterm::event::Event::Key(event) = engine.event() {
match event.code {
//KeyCode::Char('c') => {

View file

@ -1,23 +1,25 @@
use crate::*;
impl Tui {
pub(crate) fn fg <W: Render<Tui>> (color: Color, w: W) -> Foreground<W> {
pub trait TuiStyle {
fn fg <W: Render<Tui>> (color: Color, w: W) -> Foreground<W> {
Foreground(color, w)
}
pub(crate) fn bg <W: Render<Tui>> (color: Color, w: W) -> Background<W> {
fn bg <W: Render<Tui>> (color: Color, w: W) -> Background<W> {
Background(color, w)
}
pub(crate) fn fg_bg <W: Render<Tui>> (fg: Color, bg: Color, w: W) -> Background<Foreground<W>> {
fn fg_bg <W: Render<Tui>> (fg: Color, bg: Color, w: W) -> Background<Foreground<W>> {
Background(bg, Foreground(fg, w))
}
pub(crate) fn bold <W: Render<Tui>> (on: bool, w: W) -> Bold<W> {
fn bold <W: Render<Tui>> (on: bool, w: W) -> Bold<W> {
Bold(on, w)
}
pub(crate) fn border <W: Render<Tui>, S: BorderStyle> (style: S, w: W) -> Bordered<S, W> {
fn border <W: Render<Tui>, S: BorderStyle> (style: S, w: W) -> Bordered<S, W> {
Bordered(style, w)
}
}
impl TuiStyle for Tui {}
pub struct Bold<W: Render<Tui>>(pub bool, W);
impl<W: Render<Tui>> Render<Tui> for Bold<W> {