reenable recoloring tracks

This commit is contained in:
🪞👃🪞 2024-12-23 21:52:21 +01:00
parent 95aba6bd59
commit 47c13e1901
2 changed files with 14 additions and 4 deletions

View file

@ -308,8 +308,17 @@ command!(|self:ArrangerSceneCommand,state:ArrangerTui|match self {
},
_ => None
});
command!(|self:ArrangerTrackCommand,_state:ArrangerTui|None);
command!(|self:ArrangerClipCommand, _state:ArrangerTui|None);
command!(|self: ArrangerTrackCommand, state: ArrangerTui|match self {
Self::SetColor(index, color) => {
let old = state.tracks[index].color;
state.tracks[index].color = color;
Some(Self::SetColor(index, old))
},
_ => None
});
command!(|self:ArrangerClipCommand, _state:ArrangerTui|match self {
_ => None
});
#[derive(Clone, Debug)]
pub enum ArrangerClipCommand {
Play,

View file

@ -102,11 +102,11 @@ impl ArrangerTrack {
pub enum ArrangerTrackCommand {
Add,
Delete(usize),
RandomColor,
Stop,
Swap(usize, usize),
SetSize(usize),
SetZoom(usize),
SetColor(usize, ItemPalette),
}
/// Hosts the JACK callback for a collection of tracks
@ -140,6 +140,7 @@ pub fn to_arranger_track_command (input: &TuiInput, t: usize, len: usize) -> Opt
key_pat!(Char('s')) => Select(Selected::Clip(t, 0)),
key_pat!(Char('a')) => Select(if t > 0 { Selected::Track(t - 1) } else { Selected::Mix }),
key_pat!(Char('d')) => Select(Selected::Track((t + 1) % len)),
key_pat!(Char('c')) => Track(Tracks::SetColor(t, ItemPalette::random())),
key_pat!(Char(',')) => Track(Tracks::Swap(t, t - 1)),
key_pat!(Char('.')) => Track(Tracks::Swap(t, t + 1)),
key_pat!(Char('<')) => Track(Tracks::Swap(t, t - 1)),