mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 04:36:45 +01:00
wip: 21 errors!
This commit is contained in:
parent
694970bf0d
commit
ea5bc2e3b1
30 changed files with 392 additions and 362 deletions
|
|
@ -11,19 +11,11 @@ impl Sequencer {
|
|||
.add_ref(&SequenceRange)
|
||||
.add_ref(&SequenceLoopRange)
|
||||
.add_ref(&SequenceNoteRange)
|
||||
.render(&mut TuiOutput {
|
||||
buffer: to.buffer,
|
||||
area: Rect {
|
||||
x: area.x,
|
||||
y: area.y,
|
||||
height: area.height,
|
||||
width: 10,
|
||||
}
|
||||
})?;
|
||||
.render(to.with_area(area.x, area.y, area.height, 10))?;
|
||||
area.x = area.x + 10;
|
||||
area.width = area.width.saturating_sub(10);
|
||||
area.height = area.height.min(66);
|
||||
Lozenge(Style::default().fg(Nord::BG2)).draw(to.buffer, area)?;
|
||||
Lozenge(Style::default().fg(Nord::BG2)).draw(to.with_rect(area))?;
|
||||
area.x = area.x + 1;
|
||||
area.width = area.width.saturating_sub(1);
|
||||
Layered::new()
|
||||
|
|
@ -32,10 +24,7 @@ impl Sequencer {
|
|||
.add_ref(&SequenceNotes(&self))
|
||||
.add_ref(&SequenceCursor(&self))
|
||||
.add_ref(&SequenceZoom(&self))
|
||||
.render(&mut TuiOutput {
|
||||
buffer: to.buffer,
|
||||
area: area
|
||||
})?;
|
||||
.render(to.with_rect(area))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
@ -63,9 +52,9 @@ impl<'a> Render<Tui> for SequenceName<'a> {
|
|||
fn render (&self, to: &mut Tui) -> Perhaps<Rect> {
|
||||
let Rect { x, y, .. } = to.area();
|
||||
let frame = Rect { x, y, width: 10, height: 4 };
|
||||
Lozenge(Style::default().fg(Nord::BG2)).draw(to.buffer, frame)?;
|
||||
"Name:".blit(to.buffer, x + 1, y + 1, STYLE_LABEL)?;
|
||||
self.0.name.read().unwrap().blit(to.buffer, x + 1, y + 2, STYLE_VALUE)?;
|
||||
Lozenge(Style::default().fg(Nord::BG2)).draw(to.with_rect(frame))?;
|
||||
to.blit(&"Name:", x + 1, y + 1, STYLE_LABEL)?;
|
||||
to.blit(&*self.0.name.read().unwrap(), x + 1, y + 2, STYLE_VALUE)?;
|
||||
Ok(Some(frame))
|
||||
}
|
||||
}
|
||||
|
|
@ -76,11 +65,11 @@ impl<'a> Render<Tui> for SequenceRange {
|
|||
fn render (&self, to: &mut Tui) -> Perhaps<Rect> {
|
||||
let Rect { x, y, .. } = to.area();
|
||||
let frame = Rect { x, y, width: 10, height: 6 };
|
||||
Lozenge(Style::default().fg(Nord::BG2)).draw(to.buffer, frame)?;
|
||||
"Start: ".blit(to.buffer, x + 1, y + 1, STYLE_LABEL)?;
|
||||
" 1.1.1".blit(to.buffer, x + 1, y + 2, STYLE_VALUE)?;
|
||||
"End: ".blit(to.buffer, x + 1, y + 3, STYLE_LABEL)?;
|
||||
" 2.1.1".blit(to.buffer, x + 1, y + 4, STYLE_VALUE)?;
|
||||
Lozenge(Style::default().fg(Nord::BG2)).draw(to.with_rect(frame))?;
|
||||
to.blit(&"Start: ", x + 1, y + 1, STYLE_LABEL)?;
|
||||
to.blit(&" 1.1.1", x + 1, y + 2, STYLE_VALUE)?;
|
||||
to.blit(&"End: ", x + 1, y + 3, STYLE_LABEL)?;
|
||||
to.blit(&" 2.1.1", x + 1, y + 4, STYLE_VALUE)?;
|
||||
Ok(Some(frame))
|
||||
}
|
||||
}
|
||||
|
|
@ -91,12 +80,12 @@ impl<'a> Render<Tui> for SequenceLoopRange {
|
|||
fn render (&self, to: &mut Tui) -> Perhaps<Rect> {
|
||||
let Rect { x, y, .. } = to.area();
|
||||
let range = Rect { x, y, width: 10, height: 7 };
|
||||
Lozenge(Style::default().fg(Nord::BG2)).draw(to.buffer, range)?;
|
||||
"Loop [ ]".blit(to.buffer, x + 1, y + 1, STYLE_LABEL)?;
|
||||
"From: ".blit(to.buffer, x + 1, y + 2, STYLE_LABEL)?;
|
||||
" 1.1.1".blit(to.buffer, x + 1, y + 3, STYLE_VALUE)?;
|
||||
"Length: ".blit(to.buffer, x + 1, y + 4, STYLE_LABEL)?;
|
||||
" 1.0.0".blit(to.buffer, x + 1, y + 5, STYLE_VALUE)?;
|
||||
Lozenge(Style::default().fg(Nord::BG2)).draw(to.with_rect(range))?;
|
||||
to.blit(&"Loop [ ]", x + 1, y + 1, STYLE_LABEL)?;
|
||||
to.blit(&"From: ", x + 1, y + 2, STYLE_LABEL)?;
|
||||
to.blit(&" 1.1.1", x + 1, y + 3, STYLE_VALUE)?;
|
||||
to.blit(&"Length: ", x + 1, y + 4, STYLE_LABEL)?;
|
||||
to.blit(&" 1.0.0", x + 1, y + 5, STYLE_VALUE)?;
|
||||
Ok(Some(range))
|
||||
}
|
||||
}
|
||||
|
|
@ -107,15 +96,15 @@ impl<'a> Render<Tui> for SequenceNoteRange {
|
|||
fn render (&self, to: &mut Tui) -> Perhaps<Rect> {
|
||||
let Rect { x, y, .. } = to.area();
|
||||
let range = Rect { x, y, width: 10, height: 9 };
|
||||
Lozenge(Style::default().fg(Nord::BG2)).draw(to.buffer, range)?;
|
||||
"Notes: ".blit(to.buffer, x + 1, y + 1, STYLE_LABEL)?;
|
||||
"C#0-C#9 ".blit(to.buffer, x + 1, y + 2, STYLE_VALUE)?;
|
||||
"[ /2 ]".blit(to.buffer, x + 1, y + 3, STYLE_LABEL)?;
|
||||
"[ x2 ]".blit(to.buffer, x + 1, y + 4, STYLE_LABEL)?;
|
||||
"[ Rev ]".blit(to.buffer, x + 1, y + 5, STYLE_LABEL)?;
|
||||
"[ Inv ]".blit(to.buffer, x + 1, y + 6, STYLE_LABEL)?;
|
||||
"[ Dup ]".blit(to.buffer, x + 1, y + 7, STYLE_LABEL)?;
|
||||
Ok(Some(to.area))
|
||||
Lozenge(Style::default().fg(Nord::BG2)).draw(to.with_rect(range))?;
|
||||
to.blit(&"Notes: ", x + 1, y + 1, STYLE_LABEL)?;
|
||||
to.blit(&"C#0-C#9 ", x + 1, y + 2, STYLE_VALUE)?;
|
||||
to.blit(&"[ /2 ]", x + 1, y + 3, STYLE_LABEL)?;
|
||||
to.blit(&"[ x2 ]", x + 1, y + 4, STYLE_LABEL)?;
|
||||
to.blit(&"[ Rev ]", x + 1, y + 5, STYLE_LABEL)?;
|
||||
to.blit(&"[ Inv ]", x + 1, y + 6, STYLE_LABEL)?;
|
||||
to.blit(&"[ Dup ]", x + 1, y + 7, STYLE_LABEL)?;
|
||||
Ok(Some(to.area()))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -123,22 +112,23 @@ struct SequenceKeys<'a>(&'a Sequencer);
|
|||
|
||||
impl<'a> Render<Tui> for SequenceKeys<'a> {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<Rect> {
|
||||
if to.area.height < 2 {
|
||||
return Ok(Some(to.area))
|
||||
let area = to.area();
|
||||
if area.height < 2 {
|
||||
return Ok(Some(area))
|
||||
}
|
||||
let area = Rect {
|
||||
x: to.area.x,
|
||||
y: to.area.y + 1,
|
||||
x: area.x,
|
||||
y: area.y + 1,
|
||||
width: 5,
|
||||
height: to.area.height - 2
|
||||
height: area.height - 2
|
||||
};
|
||||
buffer_update(to.buffer, area, &|cell, x, y|{
|
||||
buffer_update(to.buffer(), area, &|cell, x, y|{
|
||||
let y = y + self.0.note_axis.start as u16;
|
||||
if x < self.0.keys.area.width && y < self.0.keys.area.height {
|
||||
*cell = self.0.keys.get(x, y).clone()
|
||||
}
|
||||
});
|
||||
Ok(Some(to.area))
|
||||
Ok(Some(area))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -195,7 +185,7 @@ impl<'a> Render<Tui> for SequenceZoom<'a> {
|
|||
let quant = ppq_to_name(self.0.time_axis.scale);
|
||||
let quant_x = area.x + area.width - 1 - quant.len() as u16;
|
||||
let quant_y = area.y + area.height - 2;
|
||||
buffer.blit(&quant, quant_x, quant_y, self.0.style_focus())
|
||||
to.blit(&quant, quant_x, quant_y, self.0.style_focus())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue