mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
replug is_editing()
This commit is contained in:
parent
c7e7c9f68c
commit
5ff6868a17
2 changed files with 28 additions and 31 deletions
|
|
@ -77,14 +77,6 @@ impl Arrangement {
|
|||
pub fn h (&self) -> u16 {
|
||||
self.size.h() as u16
|
||||
}
|
||||
/// Height taken by all inputs.
|
||||
pub fn h_inputs (&self) -> u16 {
|
||||
self.midi_ins_with_sizes().last().map(|(_, _, _, _, y)|y as u16).unwrap_or(0)
|
||||
}
|
||||
/// Height taken by all outputs.
|
||||
pub fn h_outputs (&self) -> u16 {
|
||||
self.midi_outs_with_sizes().last().map(|(_, _, _, _, y)|y as u16).unwrap_or(0)
|
||||
}
|
||||
/// Height taken by visible device slots.
|
||||
pub fn h_devices (&self) -> u16 {
|
||||
2
|
||||
|
|
|
|||
|
|
@ -13,7 +13,20 @@ impl Content<TuiOut> for Arrangement {
|
|||
}
|
||||
}
|
||||
|
||||
impl Arrangement {
|
||||
impl<T> TracksView for T
|
||||
where T: ScenesView + HasMidiIns + HasMidiOuts + HasSize<TuiOut> + HasTrackScroll + HasSelection + HasMidiIns + HasEditor {}
|
||||
|
||||
pub trait TracksView:
|
||||
ScenesView + HasMidiIns + HasMidiOuts + HasSize<TuiOut> + HasTrackScroll + HasSelection + HasMidiIns + HasEditor
|
||||
{
|
||||
/// Height taken by all inputs.
|
||||
fn h_inputs (&self) -> u16 {
|
||||
self.midi_ins_with_sizes().last().map(|(_, _, _, _, y)|y as u16).unwrap_or(0)
|
||||
}
|
||||
/// Height taken by all outputs.
|
||||
fn h_outputs (&self) -> u16 {
|
||||
self.midi_outs_with_sizes().last().map(|(_, _, _, _, y)|y as u16).unwrap_or(0)
|
||||
}
|
||||
/// Render input matrix.
|
||||
fn view_inputs_0 (&self) -> impl Content<TuiOut> + '_ {
|
||||
Tui::bg(Reset, Bsp::s(
|
||||
|
|
@ -22,7 +35,7 @@ impl Arrangement {
|
|||
))
|
||||
}
|
||||
fn view_input_ports (&self) -> impl Content<TuiOut> + '_ {
|
||||
let is_editing = false; //FIXME
|
||||
let is_editing = self.is_editing();
|
||||
Tryptich::top(1)
|
||||
.left(20, button_3("i", "midi ins", format!("{}",
|
||||
self.midi_ins().len()), is_editing))
|
||||
|
|
@ -77,15 +90,12 @@ impl Arrangement {
|
|||
.middle(self.w_mid(), self.view_output_map())
|
||||
}
|
||||
fn view_output_count (&self) -> impl Content<TuiOut> {
|
||||
button_3(
|
||||
"o",
|
||||
"midi outs",
|
||||
format!("{}", self.midi_outs().len()),
|
||||
false // self.is_editing()
|
||||
button_3("o", "midi outs", format!("{}", self.midi_outs().len()),
|
||||
self.is_editing()
|
||||
)
|
||||
}
|
||||
fn view_output_add (&self) -> impl Content<TuiOut> {
|
||||
button_2("O", "add midi out", false /* is_editing */)
|
||||
button_2("O", "add midi out", self.is_editing())
|
||||
}
|
||||
fn view_output_map (&self) -> impl Content<TuiOut> + '_ {
|
||||
per_track_top(||self.tracks_with_sizes_scrolled(), move|i, t|{
|
||||
|
|
@ -145,7 +155,7 @@ impl Arrangement {
|
|||
fn view_tracks_0 (&self) -> impl Content<TuiOut> + '_ {
|
||||
let w_side = self.w_side();
|
||||
let w_mid = self.w_mid();
|
||||
let is_editing = false; // FIXME
|
||||
let is_editing = self.is_editing();
|
||||
let track_selected = self.arrangement().selection().track();
|
||||
Tryptich::center(3)
|
||||
.left(w_side,
|
||||
|
|
@ -166,7 +176,7 @@ impl Arrangement {
|
|||
fn view_devices_0 (&self) -> impl Content<TuiOut> + '_ {
|
||||
let w_side = self.w_side();
|
||||
let w_mid = self.w_mid();
|
||||
let is_editing = false; // FIXME
|
||||
let is_editing = self.is_editing();
|
||||
let track_selected = self.arrangement().selection().track();
|
||||
Tryptich::top(1)
|
||||
.left(w_side, button_3("d", "devices", format!("{}", 0), is_editing))
|
||||
|
|
@ -182,16 +192,6 @@ impl Arrangement {
|
|||
track.devices.get(0).map(|device|wrap(bg.rgb, fg, device.name()))
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> TracksView for T
|
||||
where T: HasSize<TuiOut> + HasTrackScroll + HasSelection + HasMidiIns + HasEditor {}
|
||||
|
||||
impl ClipsView for Arrangement {}
|
||||
|
||||
pub trait TracksView:
|
||||
HasSize<TuiOut> + HasTrackScroll + HasSelection + HasMidiIns + HasEditor
|
||||
{
|
||||
fn tracks_width_available (&self) -> u16 {
|
||||
(self.width() as u16).saturating_sub(40)
|
||||
}
|
||||
|
|
@ -316,7 +316,7 @@ pub trait TracksView:
|
|||
}
|
||||
}
|
||||
|
||||
pub trait ScenesView: HasSelection + HasSceneScroll + Send + Sync {
|
||||
pub trait ScenesView: HasEditor + HasSelection + HasSceneScroll + Send + Sync {
|
||||
/// Default scene height.
|
||||
const H_SCENE: usize = 2;
|
||||
/// Default editor height.
|
||||
|
|
@ -394,9 +394,9 @@ pub trait ScenesView: HasSelection + HasSceneScroll + Send + Sync {
|
|||
.then_some((s, scene, y1, y2)))
|
||||
}
|
||||
/// Height required to display all scenes.
|
||||
fn h_scenes_total (&self, is_editing: bool) -> u16 {
|
||||
fn h_scenes_total (&self) -> u16 {
|
||||
self.scenes_with_sizes(
|
||||
is_editing,
|
||||
self.is_editing(),
|
||||
Self::H_SCENE,
|
||||
Self::H_EDITOR,
|
||||
self.selection().track(),
|
||||
|
|
@ -407,7 +407,10 @@ pub trait ScenesView: HasSelection + HasSceneScroll + Send + Sync {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: TracksView + ScenesView + Send + Sync> ClipsView for T {}
|
||||
|
||||
pub trait ClipsView: TracksView + ScenesView + Send + Sync {
|
||||
|
||||
fn view_scenes_clips <'a> (&'a self)
|
||||
-> impl Content<TuiOut> + 'a
|
||||
{
|
||||
|
|
@ -498,6 +501,7 @@ pub trait ClipsView: TracksView + ScenesView + Send + Sync {
|
|||
Align::w(Fill::x(Map::new(||self.scenes().iter().skip(self.scene_scroll()),
|
||||
move|scene: &'a Scene, index|self.track_scenes(index, scene))))))
|
||||
}
|
||||
|
||||
fn track_scenes <'a> (
|
||||
&'a self,
|
||||
scene_index: usize,
|
||||
|
|
@ -508,6 +512,7 @@ pub trait ClipsView: TracksView + ScenesView + Send + Sync {
|
|||
move|clip: &'a Option<Arc<RwLock<MidiClip>>>, track_index|
|
||||
self.track_scene_clip(scene_index, scene, track_index, clip))))
|
||||
}
|
||||
|
||||
fn track_scene_clip (
|
||||
&self,
|
||||
scene_index: usize,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue