mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 20:26:42 +01:00
simplify
This commit is contained in:
parent
d7bbc2a412
commit
e3a3962130
15 changed files with 74 additions and 81 deletions
|
|
@ -46,6 +46,7 @@ has!(Vec<JackMidiIn>: |self: Arrangement|self.midi_ins);
|
|||
has!(Vec<JackMidiOut>: |self: Arrangement|self.midi_outs);
|
||||
has!(Vec<Scene>: |self: Arrangement|self.scenes);
|
||||
has!(Vec<Track>: |self: Arrangement|self.tracks);
|
||||
has!(Measure<TuiOut>: |self: Arrangement|self.size);
|
||||
|
||||
impl Arrangement {
|
||||
/// Width of display
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ impl<'a> ArrangerView<'a> {
|
|||
pub(crate) fn input_ports (&'a self) -> impl Content<TuiOut> + 'a {
|
||||
Tryptich::top(1)
|
||||
.left(self.width_side,
|
||||
button_3("i", "midi ins", format!("{}", self.inputs_count), self.is_editing))
|
||||
button_3("i", "midi ins", format!("{}", self.arrangement.midi_ins().len()), self.is_editing))
|
||||
.right(self.width_side,
|
||||
button_2("I", "add midi in", self.is_editing))
|
||||
.middle(self.width_mid,
|
||||
|
|
@ -96,7 +96,12 @@ impl<'a> ArrangerView<'a> {
|
|||
}
|
||||
|
||||
pub(crate) fn output_count (&'a self) -> impl Content<TuiOut> + 'a {
|
||||
button_3("o", "midi outs", format!("{}", self.outputs_count), self.is_editing)
|
||||
button_3(
|
||||
"o",
|
||||
"midi outs",
|
||||
format!("{}", self.arrangement.midi_outs().len()),
|
||||
self.is_editing
|
||||
)
|
||||
}
|
||||
|
||||
pub(crate) fn output_add (&'a self) -> impl Content<TuiOut> + 'a {
|
||||
|
|
|
|||
|
|
@ -9,20 +9,15 @@ pub struct ArrangerView<'a> {
|
|||
pub width_mid: u16,
|
||||
pub width_side: u16,
|
||||
|
||||
pub inputs_count: usize,
|
||||
pub inputs_height: u16,
|
||||
|
||||
pub outputs_count: usize,
|
||||
pub outputs_height: u16,
|
||||
|
||||
pub scene_last: usize,
|
||||
pub scene_count: usize,
|
||||
pub scene_scroll: Fill<Fixed<u16, ScrollbarV>>,
|
||||
pub scene_selected: Option<usize>,
|
||||
pub scenes_height: u16,
|
||||
|
||||
pub track_scroll: Fill<Fixed<u16, ScrollbarH>>,
|
||||
pub track_count: usize,
|
||||
pub track_selected: Option<usize>,
|
||||
pub tracks_height: u16,
|
||||
|
||||
|
|
@ -47,14 +42,10 @@ impl<'a> ArrangerView<'a> {
|
|||
width_side: arrangement.w_sidebar(is_editing),
|
||||
|
||||
inputs_height: arrangement.h_inputs(),
|
||||
inputs_count: arrangement.midi_ins.len(),
|
||||
|
||||
outputs_height: arrangement.h_outputs(),
|
||||
outputs_count: arrangement.midi_outs.len(),
|
||||
|
||||
scenes_height: h_scenes_area,
|
||||
scene_selected: arrangement.selection().scene(),
|
||||
scene_count: arrangement.scenes.len(),
|
||||
scene_last: arrangement.scenes.len().saturating_sub(1),
|
||||
scene_scroll: Fill::y(Fixed::x(1, ScrollbarV {
|
||||
offset: arrangement.scene_scroll,
|
||||
|
|
@ -63,7 +54,6 @@ impl<'a> ArrangerView<'a> {
|
|||
})),
|
||||
|
||||
tracks_height: h_tracks_area,
|
||||
track_count: arrangement.tracks.len(),
|
||||
track_selected: arrangement.selection().track(),
|
||||
track_scroll: Fill::x(Fixed::y(1, ScrollbarH {
|
||||
offset: arrangement.track_scroll,
|
||||
|
|
@ -108,9 +98,9 @@ impl<'a> ArrangerView<'a> {
|
|||
|
||||
/// Render track headers
|
||||
pub(crate) fn tracks (&'a self) -> impl Content<TuiOut> + 'a {
|
||||
let Self { width_side, width_mid, track_count, track_selected, is_editing, .. } = self;
|
||||
let Self { width_side, width_mid, track_selected, is_editing, .. } = self;
|
||||
Tryptich::center(3)
|
||||
.left(*width_side, button_3("t", "track", format!("{}", *track_count), *is_editing))
|
||||
.left(*width_side, button_3("t", "track", format!("{}", self.arrangement.tracks.len()), *is_editing))
|
||||
.right(*width_side, button_2("T", "add track", *is_editing))
|
||||
.middle(*width_mid, per_track(*width_mid, ||self.tracks_with_sizes_scrolled(),
|
||||
|index, track|wrap(
|
||||
|
|
@ -126,7 +116,7 @@ impl<'a> ArrangerView<'a> {
|
|||
|
||||
/// Render device switches.
|
||||
pub(crate) fn devices (&'a self) -> impl Content<TuiOut> + 'a {
|
||||
let Self { width_side, width_mid, track_count, track_selected, is_editing, .. } = self;
|
||||
let Self { width_side, width_mid, track_selected, is_editing, .. } = self;
|
||||
Tryptich::top(1)
|
||||
.left(*width_side, button_3("d", "devices", format!("{}", 0), *is_editing))
|
||||
.right(*width_side, button_2("D", "add device", *is_editing))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue