mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 12:46:42 +01:00
update all to use TuiOutput; still slow?
This commit is contained in:
parent
bb7d215ba1
commit
f5fbc11b24
21 changed files with 873 additions and 888 deletions
|
|
@ -380,17 +380,17 @@ struct ColumnSeparators<'a>(u16, &'a [(usize, usize)]);
|
|||
|
||||
impl<'a> Widget for ColumnSeparators<'a> {
|
||||
type Engine = Tui;
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
let area = to.area();
|
||||
let Self(offset, cols) = self;
|
||||
let style = Some(Style::default().fg(Nord::SEPARATOR));
|
||||
for (_, x) in cols.iter() {
|
||||
let x = offset + area.x() + *x as u16 - 1;
|
||||
for y in area.y()..area.y2() {
|
||||
to.blit(&"▎", x, y, style)?;
|
||||
to.blit(&"▎", x, y, style);
|
||||
}
|
||||
}
|
||||
Ok(Some(area))
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -398,23 +398,23 @@ struct RowSeparators<'a>(&'a [(usize, usize)]);
|
|||
|
||||
impl<'a> Widget for RowSeparators<'a> {
|
||||
type Engine = Tui;
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
let area = to.area();
|
||||
let Self(rows) = self;
|
||||
for (_, y) in rows.iter() {
|
||||
let y = area.y() + (*y / 96) as u16 + 1;
|
||||
if y >= to.buffer().area.height {
|
||||
if y >= to.buffer.area.height {
|
||||
break
|
||||
}
|
||||
for x in area.x()..area.x2().saturating_sub(2) {
|
||||
if x < to.buffer().area.x && y < to.buffer().area.y {
|
||||
let cell = to.buffer().get_mut(x, y);
|
||||
if x < to.buffer.area.x && y < to.buffer.area.y {
|
||||
let cell = to.buffer.get_mut(x, y);
|
||||
cell.modifier = Modifier::UNDERLINED;
|
||||
cell.underline_color = Nord::SEPARATOR;
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(Some(area))
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -424,7 +424,7 @@ struct CursorFocus<'a>(
|
|||
|
||||
impl<'a> Widget for CursorFocus<'a> {
|
||||
type Engine = Tui;
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
let area = to.area();
|
||||
let Self(selected, offset, cols, rows) = *self;
|
||||
let get_track_area = |t: usize| [
|
||||
|
|
@ -483,7 +483,8 @@ impl<'a> Widget for CursorFocus<'a> {
|
|||
} else if let Some(scene_area) = scene_area {
|
||||
to.fill_bg(scene_area, COLOR_BG0);
|
||||
}
|
||||
Ok(Some(area))
|
||||
//Ok(Some(area))
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -606,7 +607,7 @@ impl<'a> Widget for TrackNameColumn<'a> {
|
|||
fn layout (&self, area: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
todo!()
|
||||
}
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
todo!();
|
||||
//let Self(tracks, selected) = self;
|
||||
//let yellow = Some(Style::default().yellow().bold().not_dim());
|
||||
|
|
@ -638,7 +639,7 @@ impl<'a> Widget for TrackMonitorColumn<'a> {
|
|||
fn layout (&self, area: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
todo!()
|
||||
}
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
todo!();
|
||||
//let Self(tracks) = self;
|
||||
//let mut area = to.area();
|
||||
|
|
@ -671,7 +672,7 @@ impl<'a> Widget for TrackRecordColumn<'a> {
|
|||
fn layout (&self, area: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
todo!()
|
||||
}
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
todo!();
|
||||
//let Self(tracks) = self;
|
||||
//let mut area = to.area();
|
||||
|
|
@ -704,7 +705,7 @@ impl<'a> Widget for TrackOverdubColumn<'a> {
|
|||
fn layout (&self, area: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
todo!()
|
||||
}
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
todo!();
|
||||
//let Self(tracks) = self;
|
||||
//let mut area = to.area();
|
||||
|
|
@ -740,7 +741,7 @@ impl<'a> Widget for TrackEraseColumn<'a> {
|
|||
fn layout (&self, area: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
todo!()
|
||||
}
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
todo!();
|
||||
//let Self(tracks) = self;
|
||||
//let mut area = to.area();
|
||||
|
|
@ -771,7 +772,7 @@ impl<'a> Widget for TrackGainColumn<'a> {
|
|||
fn layout (&self, area: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
todo!()
|
||||
}
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
todo!();
|
||||
//let Self(tracks) = self;
|
||||
//let mut area = to.area();
|
||||
|
|
@ -802,7 +803,7 @@ impl<'a> Widget for TrackScenesColumn<'a> {
|
|||
fn layout (&self, area: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
todo!()
|
||||
}
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
let Self(tracks, scenes, selected) = self;
|
||||
let area = to.area();
|
||||
let mut x2 = 0;
|
||||
|
|
@ -815,11 +816,11 @@ impl<'a> Widget for TrackScenesColumn<'a> {
|
|||
Style::default().dim()
|
||||
});
|
||||
for y in y+1..y+height {
|
||||
to.blit(&"│", x + x2, y, sep)?;
|
||||
to.blit(&"│", x + x2, y, sep);
|
||||
}
|
||||
let name = scene.name.read().unwrap();
|
||||
let mut x3 = name.len() as u16;
|
||||
to.blit(&*name, x + x2, y, sep)?;
|
||||
to.blit(&*name, x + x2, y, sep);
|
||||
for (i, clip) in scene.clips.iter().enumerate() {
|
||||
let active_track = selected.track() == Some(i);
|
||||
if let Some(clip) = clip {
|
||||
|
|
@ -832,13 +833,14 @@ impl<'a> Widget for TrackScenesColumn<'a> {
|
|||
Style::default().not_dim().yellow().bold()
|
||||
} else {
|
||||
Style::default().not_dim()
|
||||
}))?;
|
||||
}));
|
||||
x3 = x3.max(label.len() as u16)
|
||||
}
|
||||
}
|
||||
x2 = x2 + x3 + 1;
|
||||
}
|
||||
Ok(Some([x, y, x2, height]))
|
||||
//Ok(Some([x, y, x2, height]))
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -870,7 +872,7 @@ impl Widget for ArrangerRenameModal<Tui> {
|
|||
fn layout (&self, area: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
todo!()
|
||||
}
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
let area = to.area();
|
||||
let y = area.y() + area.h() / 2;
|
||||
let bg_area = [1, y - 1, area.w() - 2, 3];
|
||||
|
|
@ -883,12 +885,13 @@ impl Widget for ArrangerRenameModal<Tui> {
|
|||
ArrangerFocus::Clip(_, _) => "Rename clip:",
|
||||
};
|
||||
let style = Some(Style::default().not_bold().white().not_dim());
|
||||
to.blit(&label, area.x() + 3, y, style)?;
|
||||
to.blit(&label, area.x() + 3, y, style);
|
||||
let style = Some(Style::default().bold().white().not_dim());
|
||||
to.blit(&self.value, area.x() + 3 + label.len() as u16 + 1, y, style)?;
|
||||
to.blit(&self.value, area.x() + 3 + label.len() as u16 + 1, y, style);
|
||||
let style = Some(Style::default().bold().white().not_dim().reversed());
|
||||
to.blit(&"▂", area.x() + 3 + label.len() as u16 + 1 + self.cursor as u16, y, style)?;
|
||||
Ok(Some(area))
|
||||
to.blit(&"▂", area.x() + 3 + label.len() as u16 + 1 + self.cursor as u16, y, style);
|
||||
//Ok(Some(area))
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -203,12 +203,13 @@ impl Widget for Sequencer<Tui> {
|
|||
fn layout (&self, area: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
todo!()
|
||||
}
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
self.horizontal_draw(to)?;
|
||||
if self.focused && self.entered {
|
||||
Corners(Style::default().green().not_dim()).draw(to)?;
|
||||
}
|
||||
Ok(Some(to.area()))
|
||||
//Ok(Some(to.area()))
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -404,7 +405,7 @@ impl Sequencer<Tui> {
|
|||
|
||||
const H_KEYS_OFFSET: usize = 5;
|
||||
|
||||
pub(crate) fn horizontal_draw <'a> (&self, to: &mut Tui) -> Usually<()> {
|
||||
pub(crate) fn horizontal_draw <'a> (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
let area = to.area();
|
||||
Split::down(|add|{
|
||||
add(&SequenceName(&self))?;
|
||||
|
|
@ -451,13 +452,13 @@ impl<'a> Widget for SequenceName<'a> {
|
|||
fn layout (&self, area: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
todo!()
|
||||
}
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
let [x, y, ..] = to.area();
|
||||
let frame = [x, y, 10, 4];
|
||||
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))
|
||||
to.blit(&"Name:", x + 1, y + 1, STYLE_LABEL);
|
||||
to.blit(&*self.0.name.read().unwrap(), x + 1, y + 2, STYLE_VALUE);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -468,15 +469,15 @@ impl Widget for SequenceRange {
|
|||
fn layout (&self, area: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
todo!()
|
||||
}
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
let [x, y, ..] = to.area();
|
||||
let frame = [x, y, 10, 6];
|
||||
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))
|
||||
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(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -487,16 +488,16 @@ impl Widget for SequenceLoopRange {
|
|||
fn layout (&self, area: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
todo!()
|
||||
}
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
let [x, y, ..] = to.area();
|
||||
let range = [x, y, 10, 7];
|
||||
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))
|
||||
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(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -507,18 +508,18 @@ impl Widget for SequenceNoteRange {
|
|||
fn layout (&self, area: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
todo!()
|
||||
}
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
let [x, y, ..] = to.area();
|
||||
let range = [x, y, 10, 9];
|
||||
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()))
|
||||
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(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -529,19 +530,19 @@ impl<'a> Widget for SequenceKeys<'a> {
|
|||
fn layout (&self, area: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
todo!()
|
||||
}
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
let area = to.area();
|
||||
if area.h() < 2 {
|
||||
return Ok(Some(area))
|
||||
return Ok(())
|
||||
}
|
||||
let area = [area.x(), area.y() + 1, 5, area.h() - 2];
|
||||
buffer_update(to.buffer(), area, &|cell, x, y|{
|
||||
to.buffer_update(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(area))
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -552,10 +553,10 @@ impl<'a> Widget for SequenceNotes<'a> {
|
|||
fn layout (&self, area: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
todo!()
|
||||
}
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
let area = to.area();
|
||||
if area.h() < 2 {
|
||||
return Ok(Some(area))
|
||||
return Ok(())//Some(area))
|
||||
}
|
||||
let area = [
|
||||
area.x() + Sequencer::H_KEYS_OFFSET as u16,
|
||||
|
|
@ -574,7 +575,7 @@ impl<'a> Widget for SequenceNotes<'a> {
|
|||
});
|
||||
}
|
||||
});
|
||||
Ok(Some(area))
|
||||
Ok(())//Some(area))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -585,15 +586,17 @@ impl<'a> Widget for SequenceCursor<'a> {
|
|||
fn layout (&self, area: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
todo!()
|
||||
}
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
let area = to.area();
|
||||
if let (Some(time), Some(note)) = (self.0.time_axis.point, self.0.note_axis.point) {
|
||||
let x = area.x() + Sequencer::H_KEYS_OFFSET as u16 + time as u16;
|
||||
let y = area.y() + 1 + note as u16 / 2;
|
||||
let c = if note % 2 == 0 { "▀" } else { "▄" };
|
||||
to.blit(&c, x, y, self.0.style_focus())
|
||||
to.blit(&c, x, y, self.0.style_focus());
|
||||
Ok(())
|
||||
} else {
|
||||
Ok(Some([0,0,0,0]))
|
||||
//Ok(Some([0,0,0,0]))
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -605,12 +608,13 @@ impl<'a> Widget for SequenceZoom<'a> {
|
|||
fn layout (&self, area: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
todo!()
|
||||
}
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
let area = to.area();
|
||||
let quant = ppq_to_name(self.0.time_axis.scale);
|
||||
let quant_x = area.x() + area.w() - 1 - quant.len() as u16;
|
||||
let quant_y = area.y() + area.h() - 2;
|
||||
to.blit(&quant, quant_x, quant_y, self.0.style_focus())
|
||||
to.blit(&quant, quant_x, quant_y, self.0.style_focus());
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -621,7 +625,7 @@ impl<'a> Widget for SequenceTimer<'a> {
|
|||
fn layout (&self, area: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
todo!()
|
||||
}
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
let area = to.area();
|
||||
let phrase = self.1.read().unwrap();
|
||||
let (time0, time_z, now) = (
|
||||
|
|
@ -634,9 +638,10 @@ impl<'a> Widget for SequenceTimer<'a> {
|
|||
let step = (time0 + x2) * time_z;
|
||||
let next_step = (time0 + x2 + 1) * time_z;
|
||||
let style = Sequencer::<Tui>::style_timer_step(now, step as usize, next_step as usize);
|
||||
to.blit(&"-", x as u16, area.y(), Some(style))?;
|
||||
to.blit(&"-", x as u16, area.y(), Some(style));
|
||||
}
|
||||
return Ok(Some([area.x(), area.y(), area.w(), 1]))
|
||||
//return Ok(Some([area.x(), area.y(), area.w(), 1]))
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -321,13 +321,13 @@ impl Widget for TransportBPM<Tui> {
|
|||
area.expect_min(10, 1)?;
|
||||
Ok(Some([10, 1]))
|
||||
}
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
let area = to.area();
|
||||
let [x, y, ..] = area;
|
||||
let Self { value, focused, .. } = self;
|
||||
to.blit(&"BPM", x, y, Some(NOT_DIM))?;
|
||||
to.blit(&"BPM", x, y, Some(NOT_DIM));
|
||||
let bpm = format!("{}.{:03}", value, (value * 1000.0) % 1000.0);
|
||||
to.blit(&bpm, x, y + 1, Some(NOT_DIM_BOLD))?;
|
||||
to.blit(&bpm, x, y + 1, Some(NOT_DIM_BOLD));
|
||||
let width = bpm.len() as u16;
|
||||
let area = [x, y, (width + 2).max(10), 2];
|
||||
if *focused {
|
||||
|
|
@ -335,7 +335,8 @@ impl Widget for TransportBPM<Tui> {
|
|||
CORNERS.draw(to)?;
|
||||
to.fill_bg(area, COLOR_BG1);
|
||||
}
|
||||
Ok(Some(area))
|
||||
//Ok(Some(area))
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -375,20 +376,21 @@ impl Widget for TransportQuantize<Tui> {
|
|||
area.expect_min(10, 1)?;
|
||||
Ok(Some([10, 1]))
|
||||
}
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
let [x, y, ..] = to.area();
|
||||
let Self { value, focused, .. } = self;
|
||||
to.blit(&"QUANT", x, y, Some(NOT_DIM))?;
|
||||
to.blit(&"QUANT", x, y, Some(NOT_DIM));
|
||||
let name = ppq_to_name(*value as usize);
|
||||
let width = name.len() as u16;
|
||||
to.blit(&name, x, y + 1, Some(NOT_DIM_BOLD))?;
|
||||
to.blit(&name, x, y + 1, Some(NOT_DIM_BOLD));
|
||||
let area = [x, y, (width + 2).max(10), 2];
|
||||
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))
|
||||
//Ok(Some(area))
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -428,20 +430,21 @@ impl Widget for TransportSync<Tui> {
|
|||
area.expect_min(10, 1)?;
|
||||
Ok(Some([10, 1]))
|
||||
}
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
let [x, y, ..] = to.area();
|
||||
let Self { value, focused, .. } = self;
|
||||
to.blit(&"SYNC", x, y, Some(NOT_DIM))?;
|
||||
to.blit(&"SYNC", x, y, Some(NOT_DIM));
|
||||
let name = ppq_to_name(*value as usize);
|
||||
let width = name.len() as u16;
|
||||
to.blit(&name, x, y + 1, Some(NOT_DIM_BOLD))?;
|
||||
to.blit(&name, x, y + 1, Some(NOT_DIM_BOLD));
|
||||
let area = [x, y, (width + 2).max(10), 2];
|
||||
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))
|
||||
//Ok(Some(area))
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -474,7 +477,7 @@ impl Widget for TransportClock<Tui> {
|
|||
area.expect_min(20, 1)?;
|
||||
Ok(Some([20, 1]))
|
||||
}
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
let [x, y, width, _] = to.area();
|
||||
let Self { frame: _frame, pulse, ppq, usecs, focused, .. } = self;
|
||||
let (beats, pulses) = if *ppq > 0 { (pulse / ppq, pulse % ppq) } else { (0, 0) };
|
||||
|
|
@ -482,9 +485,9 @@ impl Widget for TransportClock<Tui> {
|
|||
let (seconds, msecs) = (usecs / 1000000, usecs / 1000 % 1000);
|
||||
let (minutes, seconds) = (seconds / 60, seconds % 60);
|
||||
let timer = format!("{bars}.{beats}.{pulses:02}");
|
||||
to.blit(&timer, x + width - timer.len() as u16 - 1, y + 0, Some(NOT_DIM))?;
|
||||
to.blit(&timer, x + width - timer.len() as u16 - 1, y + 0, Some(NOT_DIM));
|
||||
let timer = format!("{minutes}:{seconds:02}:{msecs:03}");
|
||||
to.blit(&timer, x + width - timer.len() as u16 - 1, y + 1, Some(NOT_DIM))?;
|
||||
to.blit(&timer, x + width - timer.len() as u16 - 1, y + 1, Some(NOT_DIM));
|
||||
let area = to.area();
|
||||
let area = [area.x(), area.y(), area.w() + 1, area.h()];
|
||||
if *focused {
|
||||
|
|
@ -492,7 +495,8 @@ impl Widget for TransportClock<Tui> {
|
|||
CORNERS.draw(to)?;
|
||||
to.fill_bg(area, COLOR_BG1);
|
||||
}
|
||||
Ok(Some(area))
|
||||
//Ok(Some(area))
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue