wip: big mixer view on scene list focus

This commit is contained in:
🪞👃🪞 2024-07-04 16:08:12 +03:00
parent 8d11ae87c0
commit 9a6e7ab3b4
4 changed files with 142 additions and 102 deletions

View file

@ -10,7 +10,7 @@ pub mod plugin;
pub use self::layout::*;
pub use self::transport::TransportView;
pub use self::grid::SceneGridView;
pub use self::chain::{ChainView, ChainViewMode};
pub use self::chain::ChainView;
pub use self::sequencer::SequencerView;
use crate::{render, App, core::*};
@ -40,22 +40,56 @@ render!(App |self, buf, area| {
if self.track_cursor > 0 {
let track = self.tracks.get(self.track_cursor - 1).unwrap();
let track = self.tracks
.get(self.track_cursor - 1)
.unwrap();
ChainView { focused: self.section == 1, track: Some(track) }
ChainView {
focused: self.section == 1,
track: Some(track),
vertical: false,
}
.render(buf, Rect { x, y: y + height - height / 3 - 1, width, height: height / 3 })?.height;
SequencerView {
let phrase = self.phrase_id()
.map(|id|track.phrases.get(id))
.flatten();
let seq_area = SequencerView {
focused: self.section == 2,
ppq: self.timebase.ppq() as usize,
now: self.timebase.frames_pulses(self.playhead as f64) as usize,
phrase: track.phrases.get(0),
phrase: phrase,
time_cursor: self.time_cursor,
time_start: self.time_start,
time_zoom: self.time_zoom,
note_cursor: self.note_cursor,
note_start: self.note_start,
}.render(buf, Rect { x, y, width, height: height - height / 3 })?;
if phrase.is_none() && self.section == 2 {
let label = format!("[ENTER] Create new clip: {}", track.name);
let x = x + seq_area.width / 2 - (label.len() / 2) as u16;
let y = y + seq_area.height / 2;
label.blit(buf, x, y, Some(Style::default().white()));
}
} else {
let mut x = x;
for track in self.tracks.iter() {
track.name.blit(buf, x + 1, y, Some(Style::default().white().bold()));
x = x + ChainView {
focused: self.section == 1,
track: Some(track),
vertical: true,
}
.render(buf, Rect { x, y: y + 1, width, height: height / 3 })?
.width
.max(track.name.len() as u16);
}
}
if let Some(ref modal) = self.modal {