mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-09 05:06:43 +01:00
refactor: view constructors from App
This commit is contained in:
parent
1e3d96e64e
commit
b01863dfdc
5 changed files with 88 additions and 102 deletions
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::*;
|
||||
use crate::{core::*, model::App};
|
||||
|
||||
pub struct TransportView<'a> {
|
||||
pub timebase: &'a Arc<Timebase>,
|
||||
|
|
@ -10,6 +10,20 @@ pub struct TransportView<'a> {
|
|||
pub quant: usize,
|
||||
}
|
||||
|
||||
impl<'a> TransportView<'a> {
|
||||
pub fn new (app: &'a App) -> Self {
|
||||
Self {
|
||||
timebase: &app.timebase,
|
||||
playing: *app.playing.as_ref().unwrap_or(&TransportState::Stopped),
|
||||
monitor: app.track().map(|t|t.1.monitoring).unwrap_or(false),
|
||||
record: app.track().map(|t|t.1.recording).unwrap_or(false),
|
||||
overdub: app.track().map(|t|t.1.overdub).unwrap_or(false),
|
||||
frame: app.playhead,
|
||||
quant: app.quant,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Render for TransportView<'a> {
|
||||
fn render (&self, buf: &mut Buffer, area: Rect) -> Usually<Rect> {
|
||||
fill_bg(buf, area, Color::Rgb(20, 45, 5));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue