mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
weird formatting
This commit is contained in:
parent
75c9a4ce49
commit
45f57214f1
2 changed files with 20 additions and 41 deletions
|
|
@ -102,14 +102,11 @@ impl Content for ArrangerStatusBar {
|
||||||
row!(mode, commands)
|
row!(mode, commands)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn command (
|
fn command (commands: &[[impl Widget<Engine = Tui>;3]]) -> impl Widget<Engine = Tui> + '_ {
|
||||||
commands: &[[impl Widget<Engine = Tui>;3]]
|
|
||||||
) -> impl Widget<Engine = Tui> + '_ {
|
|
||||||
Stack::right(|add|{
|
Stack::right(|add|{
|
||||||
for [a, b, c] in commands.iter() {
|
Ok(for [a, b, c] in commands.iter() {
|
||||||
add(&row!(" ", widget(a), widget(b).bold(true).fg(Color::Rgb(255,255,0)), widget(c)))?;
|
add(&row!(" ", widget(a), widget(b).bold(true).fg(Color::Rgb(255,255,0)), widget(c)))?;
|
||||||
}
|
})
|
||||||
Ok(())
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
impl Content for Arrangement<Tui> {
|
impl Content for Arrangement<Tui> {
|
||||||
|
|
@ -263,10 +260,7 @@ impl<'a> Content for VerticalArranger<'a, Tui> {
|
||||||
let mut scene_area: Option<[u16;4]> = None;
|
let mut scene_area: Option<[u16;4]> = None;
|
||||||
let mut clip_area: Option<[u16;4]> = None;
|
let mut clip_area: Option<[u16;4]> = None;
|
||||||
let area = match selected {
|
let area = match selected {
|
||||||
ArrangementFocus::Mix => {
|
ArrangementFocus::Mix => area,
|
||||||
//if focused { to.fill_bg(area, Color::Rgb(40, 50, 30)); }
|
|
||||||
area
|
|
||||||
},
|
|
||||||
ArrangementFocus::Track(t) => { track_area = Some(get_track_area(t)); area },
|
ArrangementFocus::Track(t) => { track_area = Some(get_track_area(t)); area },
|
||||||
ArrangementFocus::Scene(s) => { scene_area = Some(get_scene_area(s)); area },
|
ArrangementFocus::Scene(s) => { scene_area = Some(get_scene_area(s)); area },
|
||||||
ArrangementFocus::Clip(t, s) => {
|
ArrangementFocus::Clip(t, s) => {
|
||||||
|
|
@ -284,21 +278,12 @@ impl<'a> Content for VerticalArranger<'a, Tui> {
|
||||||
to.fill_ul([area.x(), y - 1, area.w(), 1], Color::Rgb(70, 80, 50));
|
to.fill_ul([area.x(), y - 1, area.w(), 1], Color::Rgb(70, 80, 50));
|
||||||
to.fill_ul([area.x(), y + height - 1, area.w(), 1], Color::Rgb(70, 80, 50));
|
to.fill_ul([area.x(), y + height - 1, area.w(), 1], Color::Rgb(70, 80, 50));
|
||||||
}
|
}
|
||||||
if focused {
|
Ok(if focused {
|
||||||
if let Some(clip_area) = clip_area {
|
to.render_in(if let Some(clip_area) = clip_area { clip_area }
|
||||||
to.render_in(clip_area, &CORNERS)?;
|
else if let Some(track_area) = track_area { track_area.clip_h(track_title_h) }
|
||||||
//to.fill_bg(clip_area, Color::Rgb(40, 50, 30));
|
else if let Some(scene_area) = scene_area { scene_area.clip_w(scene_title_w) }
|
||||||
} else if let Some(track_area) = track_area {
|
else { area.clip_w(scene_title_w).clip_h(track_title_h) }, &CORNERS)?
|
||||||
to.render_in(track_area.clip_h(track_title_h), &CORNERS)?;
|
})
|
||||||
//to.fill_bg(track_area, Color::Rgb(40, 50, 30));
|
|
||||||
} else if let Some(scene_area) = scene_area {
|
|
||||||
to.render_in(scene_area.clip_w(scene_title_w), &CORNERS)?;
|
|
||||||
//to.fill_bg(scene_area, Color::Rgb(40, 50, 30));
|
|
||||||
} else {
|
|
||||||
to.render_in(area.clip_w(scene_title_w).clip_h(track_title_h), &CORNERS)?;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}))
|
}))
|
||||||
}).bg(bg).grow_y(1).border(border);
|
}).bg(bg).grow_y(1).border(border);
|
||||||
let title_color = if self.0.focused {
|
let title_color = if self.0.focused {
|
||||||
|
|
@ -488,7 +473,7 @@ impl<'a> Content for HorizontalArranger<'a, Tui> {
|
||||||
let area = to.area();
|
let area = to.area();
|
||||||
let mut x2 = 0;
|
let mut x2 = 0;
|
||||||
let [x, y, _, height] = area;
|
let [x, y, _, height] = area;
|
||||||
for (scene_index, scene) in scenes.iter().enumerate() {
|
Ok(for (scene_index, scene) in scenes.iter().enumerate() {
|
||||||
let active_scene = selected.scene() == Some(scene_index);
|
let active_scene = selected.scene() == Some(scene_index);
|
||||||
let sep = Some(if active_scene {
|
let sep = Some(if active_scene {
|
||||||
Style::default().yellow().not_dim()
|
Style::default().yellow().not_dim()
|
||||||
|
|
@ -515,9 +500,7 @@ impl<'a> Content for HorizontalArranger<'a, Tui> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
x2 = x2 + x3 + 1;
|
x2 = x2 + x3 + 1;
|
||||||
}
|
})
|
||||||
//Ok(Some([x, y, x2, height]))
|
|
||||||
Ok(())
|
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,7 @@ impl Content for PhrasePool<Tui> {
|
||||||
let row2 = TuiStyle::bold(row2, true);
|
let row2 = TuiStyle::bold(row2, true);
|
||||||
let bg = if i == self.phrase { color } else { color };
|
let bg = if i == self.phrase { color } else { color };
|
||||||
add(&col!(row1, row2).fill_x().bg(bg))?;
|
add(&col!(row1, row2).fill_x().bg(bg))?;
|
||||||
if *focused && i == self.phrase { add(&CORNERS)?; }
|
Ok(if *focused && i == self.phrase { add(&CORNERS)?; })
|
||||||
Ok(())
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
let border_color = if *focused {Color::Rgb(100, 110, 40)} else {Color::Rgb(70, 80, 50)};
|
let border_color = if *focused {Color::Rgb(100, 110, 40)} else {Color::Rgb(70, 80, 50)};
|
||||||
|
|
@ -44,7 +43,7 @@ impl Content for PhrasePool<Tui> {
|
||||||
let title_color = if *focused {Color::Rgb(150, 160, 90)} else {Color::Rgb(120, 130, 100)};
|
let title_color = if *focused {Color::Rgb(150, 160, 90)} else {Color::Rgb(120, 130, 100)};
|
||||||
let title = format!("Phrases ({})", phrases.len());
|
let title = format!("Phrases ({})", phrases.len());
|
||||||
let title = TuiStyle::fg(title, title_color).push_x(1);
|
let title = TuiStyle::fg(title, title_color).push_x(1);
|
||||||
Layers::new(move|add|{ add(&content)?; add(&title)?; Ok(()) })
|
Layers::new(move|add|{ add(&content)?; Ok(add(&title)?) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl Content for PhraseEditor<Tui> {
|
impl Content for PhraseEditor<Tui> {
|
||||||
|
|
@ -60,15 +59,14 @@ impl Content for PhraseEditor<Tui> {
|
||||||
let color = Color::Rgb(0,255,0);
|
let color = Color::Rgb(0,255,0);
|
||||||
let color = phrase.as_ref().map(|p|p.read().unwrap().color).unwrap_or(color);
|
let color = phrase.as_ref().map(|p|p.read().unwrap().color).unwrap_or(color);
|
||||||
let keys = CustomWidget::new(|to:[u16;2]|Ok(Some(to.clip_w(5))), move|to: &mut TuiOutput|{
|
let keys = CustomWidget::new(|to:[u16;2]|Ok(Some(to.clip_w(5))), move|to: &mut TuiOutput|{
|
||||||
if to.area().h() >= 2 {
|
Ok(if to.area().h() >= 2 {
|
||||||
to.buffer_update(to.area().set_w(5), &|cell, x, y|{
|
to.buffer_update(to.area().set_w(5), &|cell, x, y|{
|
||||||
let y = y + (note_start / 2) as u16;
|
let y = y + (note_start / 2) as u16;
|
||||||
if x < keys.area.width && y < keys.area.height {
|
if x < keys.area.width && y < keys.area.height {
|
||||||
*cell = keys.get(x, y).clone()
|
*cell = keys.get(x, y).clone()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
})
|
||||||
Ok(())
|
|
||||||
}).fill_y();
|
}).fill_y();
|
||||||
let notes_bg_null = Color::Rgb(28, 35, 25);
|
let notes_bg_null = Color::Rgb(28, 35, 25);
|
||||||
let notes = CustomWidget::new(|to|Ok(Some(to)), move|to: &mut TuiOutput|{
|
let notes = CustomWidget::new(|to|Ok(Some(to)), move|to: &mut TuiOutput|{
|
||||||
|
|
@ -82,7 +80,7 @@ impl Content for PhraseEditor<Tui> {
|
||||||
axis.start += 2;
|
axis.start += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if to.area().h() >= 2 {
|
Ok(if to.area().h() >= 2 {
|
||||||
let area = to.area();
|
let area = to.area();
|
||||||
to.buffer_update(area, &move |cell, x, y|{
|
to.buffer_update(area, &move |cell, x, y|{
|
||||||
cell.set_bg(notes_bg_null);
|
cell.set_bg(notes_bg_null);
|
||||||
|
|
@ -96,11 +94,10 @@ impl Content for PhraseEditor<Tui> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
})
|
||||||
Ok(())
|
|
||||||
}).fill_x();
|
}).fill_x();
|
||||||
let cursor = CustomWidget::new(|to|Ok(Some(to)), move|to: &mut TuiOutput|{
|
let cursor = CustomWidget::new(|to|Ok(Some(to)), move|to: &mut TuiOutput|{
|
||||||
if *entered {
|
Ok(if *entered {
|
||||||
let area = to.area();
|
let area = to.area();
|
||||||
if let (Some(time), Some(note)) = (time_point, note_point) {
|
if let (Some(time), Some(note)) = (time_point, note_point) {
|
||||||
let x1 = area.x() + (time / time_scale) as u16;
|
let x1 = area.x() + (time / time_scale) as u16;
|
||||||
|
|
@ -111,8 +108,7 @@ impl Content for PhraseEditor<Tui> {
|
||||||
to.blit(&c, x, y, Some(Style::default().fg(color)));
|
to.blit(&c, x, y, Some(Style::default().fg(color)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
Ok(())
|
|
||||||
});
|
});
|
||||||
let playhead_inactive = Style::default().fg(Color::Rgb(255,255,255)).bg(Color::Rgb(0,0,0));
|
let playhead_inactive = Style::default().fg(Color::Rgb(255,255,255)).bg(Color::Rgb(0,0,0));
|
||||||
let playhead_active = playhead_inactive.clone().yellow().bold().not_dim();
|
let playhead_active = playhead_inactive.clone().yellow().bold().not_dim();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue