mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
ArrangerViewH/V -> H/VArranger
This commit is contained in:
parent
77a0336a80
commit
0bf9002e6b
1 changed files with 14 additions and 14 deletions
|
|
@ -315,18 +315,18 @@ impl Content for Arranger<Tui> {
|
||||||
//h + 2,
|
//h + 2,
|
||||||
//]))
|
//]))
|
||||||
match self.mode {
|
match self.mode {
|
||||||
ArrangerViewMode::Horizontal => add(&ArrangerViewHorizontal(&self)),
|
ArrangerViewMode::Horizontal => add(&HorizontalArranger(&self)),
|
||||||
ArrangerViewMode::VerticalCompact1 => add(&ArrangerViewVertical(
|
ArrangerViewMode::VerticalCompact1 => add(&VerticalArranger(
|
||||||
&self,
|
&self,
|
||||||
track_clip_name_lengths(self.tracks.as_slice()).as_slice(),
|
track_clip_name_lengths(self.tracks.as_slice()).as_slice(),
|
||||||
(0..=self.scenes.len()).map(|i|(96, 96*i)).collect::<Vec<_>>().as_slice(),
|
(0..=self.scenes.len()).map(|i|(96, 96*i)).collect::<Vec<_>>().as_slice(),
|
||||||
)),
|
)),
|
||||||
ArrangerViewMode::VerticalCompact2 => add(&ArrangerViewVertical(
|
ArrangerViewMode::VerticalCompact2 => add(&VerticalArranger(
|
||||||
&self,
|
&self,
|
||||||
track_clip_name_lengths(self.tracks.as_slice()).as_slice(),
|
track_clip_name_lengths(self.tracks.as_slice()).as_slice(),
|
||||||
(0..=self.scenes.len()).map(|i|(192, 192*i)).collect::<Vec<_>>().as_slice()
|
(0..=self.scenes.len()).map(|i|(192, 192*i)).collect::<Vec<_>>().as_slice()
|
||||||
)),
|
)),
|
||||||
ArrangerViewMode::VerticalExpanded => add(&ArrangerViewVertical(
|
ArrangerViewMode::VerticalExpanded => add(&VerticalArranger(
|
||||||
&self,
|
&self,
|
||||||
track_clip_name_lengths(self.tracks.as_slice()).as_slice(),
|
track_clip_name_lengths(self.tracks.as_slice()).as_slice(),
|
||||||
scene_ppqs(self.tracks.as_slice(), self.scenes.as_slice()).as_slice(),
|
scene_ppqs(self.tracks.as_slice(), self.scenes.as_slice()).as_slice(),
|
||||||
|
|
@ -488,11 +488,11 @@ impl ArrangerViewMode {
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
struct ArrangerViewVertical<'a, 'b, E: Engine>(
|
struct VerticalArranger<'a, 'b, E: Engine>(
|
||||||
&'a Arranger<E>, &'b [(usize, usize)], &'b [(usize, usize)]
|
&'a Arranger<E>, &'b [(usize, usize)], &'b [(usize, usize)]
|
||||||
);
|
);
|
||||||
|
|
||||||
impl<'a, 'b> Content for ArrangerViewVertical<'a, 'b, Tui> {
|
impl<'a, 'b> Content for VerticalArranger<'a, 'b, Tui> {
|
||||||
type Engine = Tui;
|
type Engine = Tui;
|
||||||
fn content (&self) -> impl Widget<Engine = Tui> {
|
fn content (&self) -> impl Widget<Engine = Tui> {
|
||||||
let Self(state, cols, rows) = self;
|
let Self(state, cols, rows) = self;
|
||||||
|
|
@ -500,8 +500,8 @@ impl<'a, 'b> Content for ArrangerViewVertical<'a, 'b, Tui> {
|
||||||
let scenes = state.scenes.as_ref();
|
let scenes = state.scenes.as_ref();
|
||||||
let offset = 4 + scene_name_max_len(scenes) as u16;
|
let offset = 4 + scene_name_max_len(scenes) as u16;
|
||||||
Layers::new(move |add|{
|
Layers::new(move |add|{
|
||||||
add(&ArrangerVerticalGrid(offset, rows, cols))?;
|
add(&VerticalArrangerGrid(offset, rows, cols))?;
|
||||||
add(&ArrangerVerticalCursor(state.focused, state.selected, offset, cols, rows))?;
|
add(&VerticalArrangerCursor(state.focused, state.selected, offset, cols, rows))?;
|
||||||
add(&Split::down(|add|{
|
add(&Split::down(|add|{
|
||||||
add(&Push::X(offset, Split::right(move |add|{
|
add(&Push::X(offset, Split::right(move |add|{
|
||||||
for (track, (w, _)) in tracks.iter().zip(*cols) {
|
for (track, (w, _)) in tracks.iter().zip(*cols) {
|
||||||
|
|
@ -561,9 +561,9 @@ pub fn scene_name_max_len (scenes: &[Scene]) -> usize {
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
struct ArrangerVerticalGrid<'a>(u16, &'a [(usize, usize)], &'a [(usize, usize)]);
|
struct VerticalArrangerGrid<'a>(u16, &'a [(usize, usize)], &'a [(usize, usize)]);
|
||||||
|
|
||||||
impl<'a> Widget for ArrangerVerticalGrid<'a> {
|
impl<'a> Widget for VerticalArrangerGrid<'a> {
|
||||||
type Engine = Tui;
|
type Engine = Tui;
|
||||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||||
let area = to.area();
|
let area = to.area();
|
||||||
|
|
@ -594,11 +594,11 @@ impl<'a> Widget for ArrangerVerticalGrid<'a> {
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
struct ArrangerVerticalCursor<'a>(
|
struct VerticalArrangerCursor<'a>(
|
||||||
bool, ArrangerFocus, u16, &'a [(usize, usize)], &'a [(usize, usize)]
|
bool, ArrangerFocus, u16, &'a [(usize, usize)], &'a [(usize, usize)]
|
||||||
);
|
);
|
||||||
|
|
||||||
impl<'a> Widget for ArrangerVerticalCursor<'a> {
|
impl<'a> Widget for VerticalArrangerCursor<'a> {
|
||||||
type Engine = Tui;
|
type Engine = Tui;
|
||||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||||
let area = to.area();
|
let area = to.area();
|
||||||
|
|
@ -671,11 +671,11 @@ impl<'a> Widget for ArrangerVerticalCursor<'a> {
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
struct ArrangerViewHorizontal<'a, E: Engine>(
|
struct HorizontalArranger<'a, E: Engine>(
|
||||||
&'a Arranger<E>
|
&'a Arranger<E>
|
||||||
);
|
);
|
||||||
|
|
||||||
impl<'a> Content for ArrangerViewHorizontal<'a, Tui> {
|
impl<'a> Content for HorizontalArranger<'a, Tui> {
|
||||||
type Engine = Tui;
|
type Engine = Tui;
|
||||||
fn content (&self) -> impl Widget<Engine = Tui> {
|
fn content (&self) -> impl Widget<Engine = Tui> {
|
||||||
let Arranger { tracks, focused, selected, scenes, .. } = self.0;
|
let Arranger { tracks, focused, selected, scenes, .. } = self.0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue