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

@ -179,7 +179,7 @@ handle!(<Tui>|self: ArrangerTui, input|ArrangerCommand::execute_with_state(self,
Editor(PhraseCommand), Editor(PhraseCommand),
ShowPool(bool) ShowPool(bool)
} }
input_to_command!(ArrangerCommand: <Tui>|state:ArrangerTui,input|{ input_to_command!(ArrangerCommand: <Tui>|state: ArrangerTui, input|{
use ArrangerSelection as Selected; use ArrangerSelection as Selected;
use ArrangerCommand::*; use ArrangerCommand::*;
// WSAD navigation, Q launches, E edits, PgUp/Down pool, Arrows editor // WSAD navigation, Q launches, E edits, PgUp/Down pool, Arrows editor
@ -308,8 +308,17 @@ command!(|self:ArrangerSceneCommand,state:ArrangerTui|match self {
}, },
_ => None _ => None
}); });
command!(|self:ArrangerTrackCommand,_state:ArrangerTui|None); command!(|self: ArrangerTrackCommand, state: ArrangerTui|match self {
command!(|self:ArrangerClipCommand, _state:ArrangerTui|None); 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)] #[derive(Clone, Debug)]
pub enum ArrangerClipCommand { pub enum ArrangerClipCommand {
Play, Play,

View file

@ -102,11 +102,11 @@ impl ArrangerTrack {
pub enum ArrangerTrackCommand { pub enum ArrangerTrackCommand {
Add, Add,
Delete(usize), Delete(usize),
RandomColor,
Stop, Stop,
Swap(usize, usize), Swap(usize, usize),
SetSize(usize), SetSize(usize),
SetZoom(usize), SetZoom(usize),
SetColor(usize, ItemPalette),
} }
/// Hosts the JACK callback for a collection of tracks /// 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('s')) => Select(Selected::Clip(t, 0)),
key_pat!(Char('a')) => Select(if t > 0 { Selected::Track(t - 1) } else { Selected::Mix }), 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('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)), 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)),