FillBg -> Background

This commit is contained in:
🪞👃🪞 2024-09-13 02:39:40 +03:00
parent 9816d2ee9d
commit 6624fb476c
4 changed files with 21 additions and 21 deletions

View file

@ -38,24 +38,24 @@ impl Content for Demo<Tui> {
fn content (&self) -> impl Widget<Engine = Tui> {
Align::Center(Layers::new(|add|{
add(&FillBg(Color::Rgb(0,128,128)))?;
add(&Background(Color::Rgb(0,128,128)))?;
add(&Outset::XY(1, 1, Split::down(|add|{
add(&Layers::new(|add|{
add(&FillBg(Color::Rgb(255,255,0)))?;
add(&Background(Color::Rgb(255,255,0)))?;
add(&Outset::XY(2, 1, "..."))?;
Ok(())
}))?;
add(&Layers::new(|add|{
add(&FillBg(Color::Rgb(255,128,0)))?;
add(&Background(Color::Rgb(255,128,0)))?;
add(&Outset::XY(4, 2, "---"))?;
Ok(())
}))?;
add(&Layers::new(|add|{
add(&FillBg(Color::Rgb(128,128,0)))?;
add(&Background(Color::Rgb(128,128,0)))?;
add(&Outset::XY(6, 3, "~~~"))?;
Ok(())
}))?;
@ -67,33 +67,33 @@ impl Content for Demo<Tui> {
}))
//Align::Center(Outset::X(1, Layers::new(|add|{
//add(&FillBg(Color::Rgb(128,0,0)))?;
//add(&Background(Color::Rgb(128,0,0)))?;
//add(&Split::down(|add|{
//add(&Outset::Y(1, Layers::new(|add|{
//add(&FillBg(Color::Rgb(0,128,0)))?;
//add(&Background(Color::Rgb(0,128,0)))?;
//add(&Align::Center("12345"))?;
//add(&Align::Center("FOO"))
//})))?;
//add(&Outset::XY(1, 1, Layers::new(|add|{
//add(&Align::Center("1234567"))?;
//add(&Align::Center("BAR"))?;
//add(&FillBg(Color::Rgb(0,0,128)))
//add(&Background(Color::Rgb(0,0,128)))
//})))
//}))
//})))
//Align::Y(Layers::new(|add|{
//add(&FillBg(Color::Rgb(128,0,0)))?;
//add(&Background(Color::Rgb(128,0,0)))?;
//add(&Outset::X(1, Align::Center(Split::down(|add|{
//add(&Align::X(Outset::Y(1, Layers::new(|add|{
//add(&FillBg(Color::Rgb(0,128,0)))?;
//add(&Background(Color::Rgb(0,128,0)))?;
//add(&Align::Center("12345"))?;
//add(&Align::Center("FOO"))
//})))?;
//add(&Outset::XY(1, 1, Layers::new(|add|{
//add(&Align::Center("1234567"))?;
//add(&Align::Center("BAR"))?;
//add(&FillBg(Color::Rgb(0,0,128)))
//add(&Background(Color::Rgb(0,0,128)))
//})))?;
//Ok(())
//})))))

View file

@ -137,17 +137,17 @@ fn test_0 () -> Usually<()> {
//Some([46, 48, 5, 6]));
//assert_eq!(Align::Center(Split::down(|add|{
//add(&Layers::new(|add|{
////add(&Outset::XY(1, 1, FillBg(Color::Rgb(0,128,0))))?;
////add(&Outset::XY(1, 1, Background(Color::Rgb(0,128,0))))?;
//add(&Outset::XY(1, 1, "1"))?;
//add(&Outset::XY(1, 1, "333"))?;
////add(&FillBg(Color::Rgb(0,128,0)))?;
////add(&Background(Color::Rgb(0,128,0)))?;
//Ok(())
//}))?;
//add(&Layers::new(|add|{
////add(&Outset::XY(1, 1, FillBg(Color::Rgb(0,0,128))))?;
////add(&Outset::XY(1, 1, Background(Color::Rgb(0,0,128))))?;
//add(&Outset::XY(1, 1, "555"))?;
//add(&Outset::XY(1, 1, "777777"))?;
////add(&FillBg(Color::Rgb(0,0,128)))?;
////add(&Background(Color::Rgb(0,0,128)))?;
//Ok(())
//}))
//})).layout(area)?,

View file

@ -290,9 +290,9 @@ impl Widget for Styled<&str> {
}
}
pub struct FillBg(pub Color);
pub struct Background(pub Color);
impl Widget for FillBg {
impl Widget for Background {
type Engine = Tui;
fn layout (&self, [x,y,_,_]: [u16;4]) -> Perhaps<[u16;4]> {
Ok(Some([x,y,0,0]))

View file

@ -375,7 +375,7 @@ impl<'a, 'b> Content for ArrangerViewVertical<'a, 'b, Tui> {
let scenes = state.scenes.as_ref();
let offset = 3 + scene_name_max_len(scenes) as u16;
Layers::new(move |add|{
//.add_ref(&FillBg(Color::Rgb(30, 33, 36)))//COLOR_BG1))//bg_lo(state.focused, state.entered)))
//.add_ref(&Background(Color::Rgb(30, 33, 36)))//COLOR_BG1))//bg_lo(state.focused, state.entered)))
add(&ColumnSeparators(offset, cols))?;
add(&RowSeparators(rows))?;
add(&CursorFocus(state.selected, offset, cols, rows))?;
@ -507,7 +507,7 @@ impl<'a> Content for TracksHeader<'a> {
Split::right(move |add|{
for (track, (w, _)) in tracks.iter().zip(columns) {
add(&Min::X(*w as u16, Layers::new(|add|{
add(&FillBg(COLOR_BG1))?;
add(&Background(COLOR_BG1))?;
add(&track.name.read().unwrap().as_str())
})))?;
}
@ -550,7 +550,7 @@ impl<'a> Content for SceneRow<'a> {
add(&if playing { "" } else { " " })?;
add(&scene.name.read().unwrap().as_str())
}))?;
add(&FillBg(COLOR_BG1))
add(&Background(COLOR_BG1))
}))?;
for (track, (_w, _x)) in columns.iter().enumerate() {
add(&SceneClip(tracks.get(track), scene.clips.get(track)))?;
@ -577,7 +577,7 @@ impl<'a> Content for SceneClip<'a> {
color = if track.sequence == Some(*clip) { Nord::PLAYING } else { COLOR_BG1 };
}
}
add(&FillBg(color))
add(&Background(color))
})
}
}
@ -594,7 +594,7 @@ impl<'a> Content for ArrangerViewHorizontal<'a, Tui> {
let Arranger { tracks, focused, selected, scenes, .. } = self.0;
let tracks = tracks.as_slice();
Layers::new(|add|{
add(&focused.then_some(FillBg(COLOR_BG0)))?;
add(&focused.then_some(Background(COLOR_BG0)))?;
add(&Split::right(|add|{
add(&TrackNameColumn(tracks, *selected))?;
add(&TrackMonitorColumn(tracks))?;