mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 04:36:45 +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(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue