use crate::*; impl Content for ArrangerStatusBar { type Engine = Tui; fn content (&self) -> impl Widget { let label = match self { Self::Transport => "TRANSPORT", Self::ArrangementMix => "PROJECT", Self::ArrangementTrack => "TRACK", Self::ArrangementScene => "SCENE", Self::ArrangementClip => "CLIP", Self::PhrasePool => "SEQ LIST", Self::PhraseView => "VIEW SEQ", Self::PhraseEdit => "EDIT SEQ", }; let status_bar_bg = Arranger::::status_bar_bg(); let mode_bg = Arranger::::mode_bg(); let mode_fg = Arranger::::mode_fg(); let mode = TuiStyle::bold(format!(" {label} "), true).bg(mode_bg).fg(mode_fg); let commands = match self { Self::ArrangementMix => command(&[ ["", "c", "olor"], ["", "<>", "resize"], ["", "+-", "zoom"], ["", "n", "ame/number"], ["", "Enter", " stop all"], ]), Self::ArrangementClip => command(&[ ["", "g", "et"], ["", "s", "et"], ["", "a", "dd"], ["", "i", "ns"], ["", "d", "up"], ["", "e", "dit"], ["", "c", "olor"], ["re", "n", "ame"], ["", ",.", "select"], ["", "Enter", " launch"], ]), Self::ArrangementTrack => command(&[ ["re", "n", "ame"], ["", ",.", "resize"], ["", "<>", "move"], ["", "i", "nput"], ["", "o", "utput"], ["", "m", "ute"], ["", "s", "olo"], ["", "Del", "ete"], ["", "Enter", " stop"], ]), Self::ArrangementScene => command(&[ ["re", "n", "ame"], ["", "Del", "ete"], ["", "Enter", " launch"], ]), Self::PhrasePool => command(&[ ["", "a", "ppend"], ["", "i", "nsert"], ["", "d", "uplicate"], ["", "Del", "ete"], ["", "c", "olor"], ["re", "n", "ame"], ["leng", "t", "h"], ["", ",.", "move"], ["", "+-", "resize view"], ]), Self::PhraseView => command(&[ ["", "enter", " edit"], ["", "arrows/pgup/pgdn", " scroll"], ["", "+=", "zoom"], ]), Self::PhraseEdit => command(&[ ["", "esc", " exit"], ["", "a", "ppend"], ["", "s", "et"], ["", "][", "length"], ["", "+-", "zoom"], ]), _ => command(&[]) }; //let commands = commands.iter().reduce(String::new(), |s, (a, b, c)| format!("{s} {a}{b}{c}")); row!(mode, commands).fill_x().bg(status_bar_bg) } } fn command (commands: &[[impl Widget;3]]) -> impl Widget + '_ { Stack::right(|add|{ Ok(for [a, b, c] in commands.iter() { add(&row!( " ", widget(a), widget(b).bold(true).fg(Arranger::::hotkey_fg()), widget(c), ))?; }) }) }