show rich cells

This commit is contained in:
🪞👃🪞 2025-01-10 00:05:36 +01:00
parent 69832723b3
commit 39c44d1e67
3 changed files with 35 additions and 18 deletions

View file

@ -48,9 +48,9 @@ pub enum TekMode {
/// Multi-track MIDI sequencer.
Arranger {
/// Number of tracks
#[arg(short = 'x', long, default_value_t = 16)] tracks: usize,
#[arg(short = 'x', long, default_value_t = 12)] tracks: usize,
/// Width of tracks
#[arg(short = 'w', long, default_value_t = 6)] track_width: usize,
#[arg(short = 'w', long, default_value_t = 10)] track_width: usize,
/// Number of scenes
#[arg(short = 'y', long, default_value_t = 8)] scenes: usize,
},

View file

@ -8,6 +8,14 @@ pub fn map_south<O: Output>(
Push::y(item_offset, Align::n(Fixed::y(item_height, Fill::x(item))))
}
pub fn map_south_west<O: Output>(
item_offset: O::Unit,
item_height: O::Unit,
item: impl Content<O>
) -> impl Content<O> {
Push::y(item_offset, Align::nw(Fixed::y(item_height, Fill::x(item))))
}
pub fn map_east<O: Output>(
item_offset: O::Unit,
item_width: O::Unit,

View file

@ -16,10 +16,10 @@ render!(TuiOut: (self: Arranger) => {
(8, 20, self.scene_row_headers(), self.scene_row_cells()),
(25, 2, self.input_row_header(), self.input_row_cells()),
].into_iter(),
move|(y, h, header, cells), index|map_south(y, h, Fill::x(Align::w(Bsp::e(
Fixed::xy(scenes_w, h, header),
Fixed::xy(self.tracks.len() as u16*6, h, cells)
)))));
move|(y, h, header, cells), index|map_south_west(y, h, Align::w(Bsp::a(
Align::w(Fixed::xy(scenes_w, h, header)),
Align::w(Push::x(scenes_w, Fixed::xy(self.tracks.len() as u16*12, h, cells)))
))));
self.size.of(toolbar(pool(editing(Bsp::s(arrrrrr, enclosed(&self.editor))))))
@ -167,14 +167,18 @@ impl Arranger {
let color = scene.color();
let cell = Self::phat_sel_3(
selected_scene == Some(i),
Push::x(1, name.clone()),
Push::x(1, name),
Push::x(1, Tui::bold(true, name.clone())),
Push::x(1, Tui::bold(true, name)),
if selected_scene.map(|s|s + 1) == Some(i) {
None
} else {
Some(last_color.read().unwrap().base.rgb)
},
color.base.rgb,
if selected_scene == Some(i) {
color.light.rgb
} else {
color.base.rgb
},
Color::Rgb(0, 0, 0)
);
*last_color.write().unwrap() = color;
@ -195,18 +199,23 @@ impl Arranger {
};
map_east(x1 as u16, w, Fixed::x(w, Tui::bg(Color::Rgb(0,0,0), Fill::y(Map::new(
||self.scenes_with_heights(2),
move|(_, scene, y1, y2), i| {
let h = (y2 - y1) as u16;
move|(_, scene, y1, y2), j| {
let h = (y2 - y1) as u16;
let color = scene.color();
let name = format!("🭬{}", &scene.name);
//*last_color.write().unwrap() = color
map_south(y1 as u16, 2, Fill::x(Self::phat_cell_3(
Tui::fg(TuiTheme::g(64), ""),
let name = "";
let cell = Self::phat_sel_3(
selected_track == Some(i) && selected_scene == Some(j),
Tui::fg(TuiTheme::g(64), Push::x(1, name)),
Tui::fg(TuiTheme::g(64), Push::x(1, name)),
if selected_track == Some(i) && selected_scene.map(|s|s+1) == Some(j) {
None
} else {
Some(TuiTheme::g(32).into())
},
TuiTheme::g(32).into(),
TuiTheme::g(32).into(),
TuiTheme::g(32).into(),
//Tui::fg(TuiTheme::g(64), " ⏺ ")
)))
);
map_south(y1 as u16, 3, Fill::x(cell))
}
))).boxed()
))