partially colorize arrangement cursor

This commit is contained in:
🪞👃🪞 2024-12-23 20:16:13 +01:00
parent b956fabe70
commit a05671a7f5
2 changed files with 10 additions and 10 deletions

View file

@ -190,7 +190,6 @@ input_to_command!(ArrangerCommand: <Tui>|state:ArrangerTui,input|{
key_pat!(Char('U')) => { todo!("redo") },
// TODO: k: toggle on-screen keyboard
key_pat!(Ctrl-Char('k')) => { todo!("keyboard") },
// Transport: Play/pause
key_pat!(Char(' ')) =>
Clock(if state.clock().is_stopped() { Play(None) } else { Pause(None) }),
@ -258,12 +257,12 @@ fn to_arranger_mix_command (input: &TuiInput) -> Option<ArrangerCommand> {
command!(|self:ArrangerCommand,state:ArrangerTui|{
use ArrangerCommand::*;
match self {
Scene(cmd) => cmd.execute(state)?.map(Scene),
Track(cmd) => cmd.execute(state)?.map(Track),
Clip(cmd) => cmd.execute(state)?.map(Clip),
Editor(cmd) => cmd.execute(&mut state.editor)?.map(Editor),
Clock(cmd) => cmd.execute(state)?.map(Clock),
Zoom(_) => { todo!(); },
Scene(cmd) => cmd.execute(state)?.map(Scene),
Track(cmd) => cmd.execute(state)?.map(Track),
Clip(cmd) => cmd.execute(state)?.map(Clip),
Editor(cmd) => cmd.execute(&mut state.editor)?.map(Editor),
Clock(cmd) => cmd.execute(state)?.map(Clock),
Zoom(_) => { todo!(); },
Select(selected) => {
*state.selected_mut() = selected;
None

View file

@ -123,12 +123,14 @@ impl<'a> ArrangerVHead<'a> {
pub struct ArrangerVCursor {
cols: Vec<(usize, usize)>,
rows: Vec<(usize, usize)>,
color: ItemPalette,
selected: ArrangerSelection,
scenes_w: u16,
}
from!(|args:(&ArrangerTui, usize)|ArrangerVCursor = Self {
cols: ArrangerTrack::widths(args.0.tracks()),
rows: ArrangerScene::ppqs(args.0.scenes(), args.1),
color: args.0.color,
selected: args.0.selected(),
scenes_w: SCENES_W_OFFSET + ArrangerScene::longest_name(args.0.scenes()) as u16,
});
@ -170,7 +172,7 @@ render!(<Tui>|self: ArrangerVCursor|render(move|to: &mut TuiOutput|{
area
},
};
let bg = Color::Rgb(0, 255, 0);
let bg = self.color.lighter.rgb;//Color::Rgb(0, 255, 0);
if let Some([x, y, width, height]) = track_area {
to.fill_fg([x, y, 1, height], bg);
to.fill_fg([x + width, y, 1, height], bg);
@ -198,8 +200,7 @@ from!(<'a>|args:(&'a ArrangerTui, usize)|ArrangerVClips<'a> = Self {
tracks: &args.0.tracks,
rows: ArrangerScene::ppqs(args.0.scenes(), args.1),
});
render!(<Tui>|self: ArrangerVClips<'a>|Fixed::h(
(self.size.h() as u16).saturating_sub(HEADER_H),
render!(<Tui>|self: ArrangerVClips<'a>|Fill::wh(
col!((scene, pulses) in self.scenes.iter().zip(self.rows.iter().map(|row|row.0)) => {
Self::format_scene(&self.tracks, scene, pulses)
})