mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
5 compile errors left
This commit is contained in:
parent
7bcd40b425
commit
b3f0f60400
13 changed files with 462 additions and 180 deletions
|
|
@ -4,187 +4,235 @@ pub fn draw (state: &Arranger<Tui>, to: &mut Tui) -> Perhaps<[u16;4]> {
|
|||
let area = to.area();
|
||||
let area = [area.x(), area.y(), area.w(), area.h().min((2 + state.tracks.len() * 2) as u16)];
|
||||
let tracks = state.tracks.as_slice();
|
||||
Layered::new()
|
||||
//.add(FillBg(Nord::bg_lo(state.focused, state.entered)))
|
||||
.add(Split::right()
|
||||
Layers(&[
|
||||
&state.focused.then_some(FillBg(COLOR_BG0)),
|
||||
&Split::right()
|
||||
.add(TrackNameColumn(tracks, state.selected))
|
||||
.add(TrackMonitorColumn(tracks))
|
||||
.add(TrackRecordColumn(tracks))
|
||||
.add(TrackOverdubColumn(tracks))
|
||||
.add(TrackEraseColumn(tracks))
|
||||
.add(TrackGainColumn(tracks))
|
||||
.add(TrackScenesColumn(tracks, state.scenes.as_slice(), state.selected)))
|
||||
.render(to)
|
||||
.add(TrackScenesColumn(tracks, state.scenes.as_slice(), state.selected))
|
||||
]).render(to.with_rect(area))
|
||||
}
|
||||
|
||||
struct TrackNameColumn<'a>(&'a [Sequencer], ArrangerFocus);
|
||||
|
||||
impl<'a> Layout<Tui> for TrackNameColumn<'a> {
|
||||
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Render<Tui> for TrackNameColumn<'a> {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
let Self(tracks, selected) = self;
|
||||
let yellow = Some(Style::default().yellow().bold().not_dim());
|
||||
let white = Some(Style::default().white().bold().not_dim());
|
||||
let area = to.area();
|
||||
let area = [area.x(), area.y(), 3 + 5.max(track_name_max_len(tracks)) as u16, area.h()];
|
||||
let offset = 0; // track scroll offset
|
||||
for y in 0..area.h() {
|
||||
if y == 0 {
|
||||
to.blit(&"Mixer", area.x() + 1, area.y() + y, Some(DIM))?;
|
||||
} else if y % 2 == 0 {
|
||||
let index = (y as usize - 2) / 2 + offset;
|
||||
if let Some(track) = tracks.get(index) {
|
||||
let selected = selected.track() == Some(index);
|
||||
let style = if selected { yellow } else { white };
|
||||
to.blit(&format!(" {index:>02} "), area.x(), area.y() + y, style)?;
|
||||
to.blit(&*track.name.read().unwrap(), area.x() + 4, area.y() + y, style)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(Some(area))
|
||||
todo!();
|
||||
//let Self(tracks, selected) = self;
|
||||
//let yellow = Some(Style::default().yellow().bold().not_dim());
|
||||
//let white = Some(Style::default().white().bold().not_dim());
|
||||
//let area = to.area();
|
||||
//let area = [area.x(), area.y(), 3 + 5.max(track_name_max_len(tracks)) as u16, area.h()];
|
||||
//let offset = 0; // track scroll offset
|
||||
//for y in 0..area.h() {
|
||||
//if y == 0 {
|
||||
//to.blit(&"Mixer", area.x() + 1, area.y() + y, Some(DIM))?;
|
||||
//} else if y % 2 == 0 {
|
||||
//let index = (y as usize - 2) / 2 + offset;
|
||||
//if let Some(track) = tracks.get(index) {
|
||||
//let selected = selected.track() == Some(index);
|
||||
//let style = if selected { yellow } else { white };
|
||||
//to.blit(&format!(" {index:>02} "), area.x(), area.y() + y, style)?;
|
||||
//to.blit(&*track.name.read().unwrap(), area.x() + 4, area.y() + y, style)?;
|
||||
//}
|
||||
//}
|
||||
//}
|
||||
//Ok(Some(area))
|
||||
}
|
||||
}
|
||||
|
||||
struct TrackMonitorColumn<'a>(&'a [Sequencer]);
|
||||
|
||||
impl<'a> Layout<Tui> for TrackMonitorColumn<'a> {
|
||||
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Render<Tui> for TrackMonitorColumn<'a> {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
let Self(tracks) = self;
|
||||
let mut area = to.area();
|
||||
let on = Some(Style::default().not_dim().green().bold());
|
||||
let off = Some(DIM);
|
||||
area.x += 1;
|
||||
for y in 0..area.h() {
|
||||
if y == 0 {
|
||||
//" MON ".blit(to.buffer, area.x, area.y + y, style2)?;
|
||||
} else if y % 2 == 0 {
|
||||
let index = (y as usize - 2) / 2;
|
||||
if let Some(track) = tracks.get(index) {
|
||||
let style = if track.monitoring { on } else { off };
|
||||
to.blit(&" MON ", area.x(), area.y() + y, style)?;
|
||||
} else {
|
||||
area.height = y;
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
area.width = 4;
|
||||
Ok(Some(area))
|
||||
todo!();
|
||||
//let Self(tracks) = self;
|
||||
//let mut area = to.area();
|
||||
//let on = Some(Style::default().not_dim().green().bold());
|
||||
//let off = Some(DIM);
|
||||
//area.x += 1;
|
||||
//for y in 0..area.h() {
|
||||
//if y == 0 {
|
||||
////" MON ".blit(to.buffer, area.x, area.y + y, style2)?;
|
||||
//} else if y % 2 == 0 {
|
||||
//let index = (y as usize - 2) / 2;
|
||||
//if let Some(track) = tracks.get(index) {
|
||||
//let style = if track.monitoring { on } else { off };
|
||||
//to.blit(&" MON ", area.x(), area.y() + y, style)?;
|
||||
//} else {
|
||||
//area.height = y;
|
||||
//break
|
||||
//}
|
||||
//}
|
||||
//}
|
||||
//area.width = 4;
|
||||
//Ok(Some(area))
|
||||
}
|
||||
}
|
||||
|
||||
struct TrackRecordColumn<'a>(&'a [Sequencer]);
|
||||
|
||||
impl<'a> Layout<Tui> for TrackRecordColumn<'a> {
|
||||
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Render<Tui> for TrackRecordColumn<'a> {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
let Self(tracks) = self;
|
||||
let mut area = to.area();
|
||||
let on = Some(Style::default().not_dim().red().bold());
|
||||
let off = Some(Style::default().dim());
|
||||
area.x += 1;
|
||||
for y in 0..area.h() {
|
||||
if y == 0 {
|
||||
//" REC ".blit(to.buffer, area.x, area.y + y, style2)?;
|
||||
} else if y % 2 == 0 {
|
||||
let index = (y as usize - 2) / 2;
|
||||
if let Some(track) = tracks.get(index) {
|
||||
let style = if track.recording { on } else { off };
|
||||
to.blit(&" REC ", area.x(), area.y() + y, style)?;
|
||||
} else {
|
||||
area.height = y;
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
area.width = 4;
|
||||
Ok(Some(area))
|
||||
todo!();
|
||||
//let Self(tracks) = self;
|
||||
//let mut area = to.area();
|
||||
//let on = Some(Style::default().not_dim().red().bold());
|
||||
//let off = Some(Style::default().dim());
|
||||
//area.x += 1;
|
||||
//for y in 0..area.h() {
|
||||
//if y == 0 {
|
||||
////" REC ".blit(to.buffer, area.x, area.y + y, style2)?;
|
||||
//} else if y % 2 == 0 {
|
||||
//let index = (y as usize - 2) / 2;
|
||||
//if let Some(track) = tracks.get(index) {
|
||||
//let style = if track.recording { on } else { off };
|
||||
//to.blit(&" REC ", area.x(), area.y() + y, style)?;
|
||||
//} else {
|
||||
//area.height = y;
|
||||
//break
|
||||
//}
|
||||
//}
|
||||
//}
|
||||
//area.width = 4;
|
||||
//Ok(Some(area))
|
||||
}
|
||||
}
|
||||
|
||||
struct TrackOverdubColumn<'a>(&'a [Sequencer]);
|
||||
|
||||
impl<'a> Layout<Tui> for TrackOverdubColumn<'a> {
|
||||
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Render<Tui> for TrackOverdubColumn<'a> {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
let Self(tracks) = self;
|
||||
let mut area = to.area();
|
||||
let on = Some(Style::default().not_dim().yellow().bold());
|
||||
let off = Some(Style::default().dim());
|
||||
area.x = area.x + 1;
|
||||
for y in 0..area.h() {
|
||||
if y == 0 {
|
||||
//" OVR ".blit(to.buffer, area.x, area.y + y, style2)?;
|
||||
} else if y % 2 == 0 {
|
||||
let index = (y as usize - 2) / 2;
|
||||
if let Some(track) = tracks.get(index) {
|
||||
to.blit(&" OVR ", area.x(), area.y() + y, if track.overdub {
|
||||
on
|
||||
} else {
|
||||
off
|
||||
})?;
|
||||
} else {
|
||||
area.height = y;
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
area.width = 4;
|
||||
Ok(Some(area))
|
||||
todo!();
|
||||
//let Self(tracks) = self;
|
||||
//let mut area = to.area();
|
||||
//let on = Some(Style::default().not_dim().yellow().bold());
|
||||
//let off = Some(Style::default().dim());
|
||||
//area.x = area.x + 1;
|
||||
//for y in 0..area.h() {
|
||||
//if y == 0 {
|
||||
////" OVR ".blit(to.buffer, area.x, area.y + y, style2)?;
|
||||
//} else if y % 2 == 0 {
|
||||
//let index = (y as usize - 2) / 2;
|
||||
//if let Some(track) = tracks.get(index) {
|
||||
//to.blit(&" OVR ", area.x(), area.y() + y, if track.overdub {
|
||||
//on
|
||||
//} else {
|
||||
//off
|
||||
//})?;
|
||||
//} else {
|
||||
//area.height = y;
|
||||
//break
|
||||
//}
|
||||
//}
|
||||
//}
|
||||
//area.width = 4;
|
||||
//Ok(Some(area))
|
||||
}
|
||||
}
|
||||
|
||||
struct TrackEraseColumn<'a>(&'a [Sequencer]);
|
||||
|
||||
impl<'a> Layout<Tui> for TrackEraseColumn<'a> {
|
||||
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Render<Tui> for TrackEraseColumn<'a> {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
let Self(tracks) = self;
|
||||
let mut area = to.area();
|
||||
let off = Some(Style::default().dim());
|
||||
area.x = area.x + 1;
|
||||
for y in 0..area.h() {
|
||||
if y == 0 {
|
||||
//" DEL ".blit(to.buffer, area.x, area.y + y, style2)?;
|
||||
} else if y % 2 == 0 {
|
||||
let index = (y as usize - 2) / 2;
|
||||
if let Some(_) = tracks.get(index) {
|
||||
to.blit(&" DEL ", area.x(), area.y() + y, off)?;
|
||||
} else {
|
||||
area.height = y;
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
area.width = 4;
|
||||
Ok(Some(area))
|
||||
todo!();
|
||||
//let Self(tracks) = self;
|
||||
//let mut area = to.area();
|
||||
//let off = Some(Style::default().dim());
|
||||
//area.x = area.x + 1;
|
||||
//for y in 0..area.h() {
|
||||
//if y == 0 {
|
||||
////" DEL ".blit(to.buffer, area.x, area.y + y, style2)?;
|
||||
//} else if y % 2 == 0 {
|
||||
//let index = (y as usize - 2) / 2;
|
||||
//if let Some(_) = tracks.get(index) {
|
||||
//to.blit(&" DEL ", area.x(), area.y() + y, off)?;
|
||||
//} else {
|
||||
//area.height = y;
|
||||
//break
|
||||
//}
|
||||
//}
|
||||
//}
|
||||
//area.width = 4;
|
||||
//Ok(Some(area))
|
||||
}
|
||||
}
|
||||
|
||||
struct TrackGainColumn<'a>(&'a [Sequencer]);
|
||||
|
||||
impl<'a> Layout<Tui> for TrackGainColumn<'a> {
|
||||
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Render<Tui> for TrackGainColumn<'a> {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
let Self(tracks) = self;
|
||||
let mut area = to.area();
|
||||
let off = Some(Style::default().dim());
|
||||
area.x = area.x() + 1;
|
||||
for y in 0..area.h() {
|
||||
if y == 0 {
|
||||
//" GAIN ".blit(to.buffer, area.x, area.y + y, style2)?;
|
||||
} else if y % 2 == 0 {
|
||||
let index = (y as usize - 2) / 2;
|
||||
if let Some(_) = tracks.get(index) {
|
||||
to.blit(&" +0.0 ", area.x(), area.y() + y, off)?;
|
||||
} else {
|
||||
area.height = y;
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
area.width = 7;
|
||||
Ok(Some(area))
|
||||
todo!();
|
||||
//let Self(tracks) = self;
|
||||
//let mut area = to.area();
|
||||
//let off = Some(Style::default().dim());
|
||||
//area.x = area.x() + 1;
|
||||
//for y in 0..area.h() {
|
||||
//if y == 0 {
|
||||
////" GAIN ".blit(to.buffer, area.x, area.y + y, style2)?;
|
||||
//} else if y % 2 == 0 {
|
||||
//let index = (y as usize - 2) / 2;
|
||||
//if let Some(_) = tracks.get(index) {
|
||||
//to.blit(&" +0.0 ", area.x(), area.y() + y, off)?;
|
||||
//} else {
|
||||
//area.height = y;
|
||||
//break
|
||||
//}
|
||||
//}
|
||||
//}
|
||||
//area.width = 7;
|
||||
//Ok(Some(area))
|
||||
}
|
||||
}
|
||||
|
||||
struct TrackScenesColumn<'a>(&'a [Sequencer], &'a [Scene], ArrangerFocus);
|
||||
|
||||
impl<'a> Layout<Tui> for TrackScenesColumn<'a> {
|
||||
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Render<Tui> for TrackScenesColumn<'a> {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
let Self(tracks, scenes, selected) = self;
|
||||
|
|
|
|||
|
|
@ -51,6 +51,12 @@ pub fn draw <'a, 'b> (
|
|||
|
||||
struct ColumnSeparators<'a>(u16, &'a [(usize, usize)]);
|
||||
|
||||
impl<'a> Layout<Tui> for ColumnSeparators<'a> {
|
||||
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Render<Tui> for ColumnSeparators<'a> {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
let area = to.area();
|
||||
|
|
@ -68,6 +74,12 @@ impl<'a> Render<Tui> for ColumnSeparators<'a> {
|
|||
|
||||
struct RowSeparators<'a>(&'a [(usize, usize)]);
|
||||
|
||||
impl<'a> Layout<Tui> for RowSeparators<'a> {
|
||||
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Render<Tui> for RowSeparators<'a> {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
let area = to.area();
|
||||
|
|
@ -91,6 +103,12 @@ struct CursorFocus<'a>(
|
|||
ArrangerFocus, u16, &'a [(usize, usize)], &'a [(usize, usize)]
|
||||
);
|
||||
|
||||
impl<'a> Layout<Tui> for CursorFocus<'a> {
|
||||
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Render<Tui> for CursorFocus<'a> {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
let area = to.area();
|
||||
|
|
@ -157,6 +175,12 @@ impl<'a> Render<Tui> for CursorFocus<'a> {
|
|||
|
||||
struct TracksHeader<'a>(u16, &'a[(usize, usize)], &'a [Sequencer]);
|
||||
|
||||
impl<'a> Layout<Tui> for TracksHeader<'a> {
|
||||
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Render<Tui> for TracksHeader<'a> {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
let area = to.area();
|
||||
|
|
@ -177,6 +201,12 @@ impl<'a> Render<Tui> for TracksHeader<'a> {
|
|||
|
||||
struct SceneRows<'a>(u16, &'a[(usize, usize)], &'a[(usize, usize)], &'a[Sequencer], &'a[Scene]);
|
||||
|
||||
impl<'a> Layout<Tui> for SceneRows<'a> {
|
||||
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Render<Tui> for SceneRows<'a> {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
let area = to.area();
|
||||
|
|
@ -206,6 +236,12 @@ impl<'a> Render<Tui> for SceneRows<'a> {
|
|||
|
||||
struct SceneRow<'a>(&'a[Sequencer], &'a Scene, &'a[(usize, usize)], u16);
|
||||
|
||||
impl<'a> Layout<Tui> for SceneRow<'a> {
|
||||
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Render<Tui> for SceneRow<'a> {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
let area = to.area();
|
||||
|
|
@ -232,6 +268,12 @@ impl<'a> Render<Tui> for SceneRow<'a> {
|
|||
|
||||
struct SceneClip<'a>(&'a Sequencer, usize);
|
||||
|
||||
impl<'a> Layout<Tui> for SceneClip<'a> {
|
||||
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Render<Tui> for SceneClip<'a> {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
let area = to.area();
|
||||
|
|
|
|||
|
|
@ -48,6 +48,12 @@ const STYLE_VALUE: Option<Style> = Some(Style {
|
|||
|
||||
struct SequenceName<'a>(&'a Sequencer);
|
||||
|
||||
impl<'a> Layout<Tui> for SequenceName<'a> {
|
||||
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Render<Tui> for SequenceName<'a> {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
let [x, y, ..] = to.area();
|
||||
|
|
@ -61,6 +67,12 @@ impl<'a> Render<Tui> for SequenceName<'a> {
|
|||
|
||||
struct SequenceRange;
|
||||
|
||||
impl Layout<Tui> for SequenceRange {
|
||||
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Render<Tui> for SequenceRange {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
let [x, y, ..] = to.area();
|
||||
|
|
@ -76,6 +88,12 @@ impl<'a> Render<Tui> for SequenceRange {
|
|||
|
||||
struct SequenceLoopRange;
|
||||
|
||||
impl Layout<Tui> for SequenceLoopRange {
|
||||
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Render<Tui> for SequenceLoopRange {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
let [x, y, ..] = to.area();
|
||||
|
|
@ -92,6 +110,12 @@ impl<'a> Render<Tui> for SequenceLoopRange {
|
|||
|
||||
struct SequenceNoteRange;
|
||||
|
||||
impl Layout<Tui> for SequenceNoteRange {
|
||||
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Render<Tui> for SequenceNoteRange {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
let [x, y, ..] = to.area();
|
||||
|
|
@ -110,6 +134,12 @@ impl<'a> Render<Tui> for SequenceNoteRange {
|
|||
|
||||
struct SequenceKeys<'a>(&'a Sequencer);
|
||||
|
||||
impl<'a> Layout<Tui> for SequenceKeys<'a> {
|
||||
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Render<Tui> for SequenceKeys<'a> {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
let area = to.area();
|
||||
|
|
@ -129,6 +159,12 @@ impl<'a> Render<Tui> for SequenceKeys<'a> {
|
|||
|
||||
struct SequenceNotes<'a>(&'a Sequencer);
|
||||
|
||||
impl<'a> Layout<Tui> for SequenceNotes<'a> {
|
||||
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Render<Tui> for SequenceNotes<'a> {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
let area = to.area();
|
||||
|
|
@ -158,6 +194,12 @@ impl<'a> Render<Tui> for SequenceNotes<'a> {
|
|||
|
||||
struct SequenceCursor<'a>(&'a Sequencer);
|
||||
|
||||
impl<'a> Layout<Tui> for SequenceCursor<'a> {
|
||||
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Render<Tui> for SequenceCursor<'a> {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
let area = to.area();
|
||||
|
|
@ -174,6 +216,12 @@ impl<'a> Render<Tui> for SequenceCursor<'a> {
|
|||
|
||||
struct SequenceZoom<'a>(&'a Sequencer);
|
||||
|
||||
impl<'a> Layout<Tui> for SequenceZoom<'a> {
|
||||
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Render<Tui> for SequenceZoom<'a> {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
let area = to.area();
|
||||
|
|
@ -186,6 +234,12 @@ impl<'a> Render<Tui> for SequenceZoom<'a> {
|
|||
|
||||
struct SequenceTimer<'a>(&'a Sequencer, Arc<RwLock<Phrase>>);
|
||||
|
||||
impl<'a> Layout<Tui> for SequenceTimer<'a> {
|
||||
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Render<Tui> for SequenceTimer<'a> {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
let area = to.area();
|
||||
|
|
|
|||
|
|
@ -21,31 +21,60 @@ impl Render<Tui> for TransportToolbar {
|
|||
}
|
||||
}
|
||||
|
||||
impl Layout<Tui> for TransportPlayPauseButton {
|
||||
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
||||
area.expect_min(10, 1)?;
|
||||
Ok(Some([area.x(), area.y(), 10, 1]))
|
||||
}
|
||||
}
|
||||
|
||||
impl Render<Tui> for TransportPlayPauseButton {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
let area = to.area();
|
||||
let [x, y, ..] = area;
|
||||
let Self { value, focused } = &self;
|
||||
let style = Some(match value {
|
||||
Some(TransportState::Stopped) => GRAY_DIM.bold(),
|
||||
Some(TransportState::Starting) => GRAY_NOT_DIM_BOLD,
|
||||
Some(TransportState::Rolling) => WHITE_NOT_DIM_BOLD,
|
||||
_ => unreachable!(),
|
||||
});
|
||||
let label = match value {
|
||||
Some(TransportState::Rolling) => "▶ PLAYING",
|
||||
Some(TransportState::Starting) => "READY ...",
|
||||
Some(TransportState::Stopped) => "⏹ STOPPED",
|
||||
_ => unreachable!(),
|
||||
};
|
||||
let area = to.blit(&label, x + 1, y, style)?.unwrap();
|
||||
let area = [area.x(), area.y(), area.w() + 1, area.h() + 1];
|
||||
if *focused {
|
||||
let area = [area.x() - 1, area.y(), area.w() - 1, area.h() ];
|
||||
CORNERS.draw(to)?;
|
||||
to.fill_bg(area, COLOR_BG1);
|
||||
}
|
||||
Ok(Some(area))
|
||||
Layers(&[
|
||||
&focused.then_some(CORNERS),
|
||||
&Inset::W(1, Styled(match value {
|
||||
Some(TransportState::Stopped) => Some(GRAY_DIM.bold()),
|
||||
Some(TransportState::Starting) => Some(GRAY_NOT_DIM_BOLD),
|
||||
Some(TransportState::Rolling) => Some(WHITE_NOT_DIM_BOLD),
|
||||
_ => unreachable!(),
|
||||
}, match value {
|
||||
Some(TransportState::Rolling) => "▶ PLAYING",
|
||||
Some(TransportState::Starting) => "READY ...",
|
||||
Some(TransportState::Stopped) => "⏹ STOPPED",
|
||||
_ => unreachable!(),
|
||||
}))
|
||||
]).render(to)
|
||||
//let area = to.area();
|
||||
//let [x, y, ..] = area;
|
||||
//let Self { value, focused } = &self;
|
||||
//let style = Some(match value {
|
||||
//Some(TransportState::Stopped) => GRAY_DIM.bold(),
|
||||
//Some(TransportState::Starting) => GRAY_NOT_DIM_BOLD,
|
||||
//Some(TransportState::Rolling) => WHITE_NOT_DIM_BOLD,
|
||||
//_ => unreachable!(),
|
||||
//});
|
||||
//let label = match value {
|
||||
//Some(TransportState::Rolling) => "▶ PLAYING",
|
||||
//Some(TransportState::Starting) => "READY ...",
|
||||
//Some(TransportState::Stopped) => "⏹ STOPPED",
|
||||
//_ => unreachable!(),
|
||||
//};
|
||||
//let area = to.blit(&label, x + 1, y, style)?.unwrap();
|
||||
//let area = [area.x(), area.y(), area.w() + 1, area.h() + 1];
|
||||
//if *focused {
|
||||
//let area = [area.x() - 1, area.y(), area.w() - 1, area.h() ];
|
||||
//CORNERS.draw(to)?;
|
||||
//to.fill_bg(area, COLOR_BG1);
|
||||
//}
|
||||
//Ok(Some(area))
|
||||
}
|
||||
}
|
||||
|
||||
impl Layout<Tui> for TransportBPM {
|
||||
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
||||
area.expect_min(10, 1)?;
|
||||
Ok(Some([area.x(), area.y(), 10, 1]))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -68,6 +97,13 @@ impl Render<Tui> for TransportBPM {
|
|||
}
|
||||
}
|
||||
|
||||
impl Layout<Tui> for TransportQuantize {
|
||||
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
||||
area.expect_min(10, 1)?;
|
||||
Ok(Some([area.x(), area.y(), 10, 1]))
|
||||
}
|
||||
}
|
||||
|
||||
impl Render<Tui> for TransportQuantize {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
let [x, y, ..] = to.area();
|
||||
|
|
@ -86,6 +122,13 @@ impl Render<Tui> for TransportQuantize {
|
|||
}
|
||||
}
|
||||
|
||||
impl Layout<Tui> for TransportSync {
|
||||
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
||||
area.expect_min(10, 1)?;
|
||||
Ok(Some([area.x(), area.y(), 10, 1]))
|
||||
}
|
||||
}
|
||||
|
||||
impl Render<Tui> for TransportSync {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
let [x, y, ..] = to.area();
|
||||
|
|
@ -104,6 +147,13 @@ impl Render<Tui> for TransportSync {
|
|||
}
|
||||
}
|
||||
|
||||
impl Layout<Tui> for TransportClock {
|
||||
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
||||
area.expect_min(10, 1)?;
|
||||
Ok(Some([area.x(), area.y(), 20, 1]))
|
||||
}
|
||||
}
|
||||
|
||||
impl Render<Tui> for TransportClock {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
let [x, y, width, _] = to.area();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue