mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
show rich cells
This commit is contained in:
parent
69832723b3
commit
39c44d1e67
3 changed files with 35 additions and 18 deletions
|
|
@ -48,9 +48,9 @@ pub enum TekMode {
|
||||||
/// Multi-track MIDI sequencer.
|
/// Multi-track MIDI sequencer.
|
||||||
Arranger {
|
Arranger {
|
||||||
/// Number of tracks
|
/// 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
|
/// 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
|
/// Number of scenes
|
||||||
#[arg(short = 'y', long, default_value_t = 8)] scenes: usize,
|
#[arg(short = 'y', long, default_value_t = 8)] scenes: usize,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,14 @@ pub fn map_south<O: Output>(
|
||||||
Push::y(item_offset, Align::n(Fixed::y(item_height, Fill::x(item))))
|
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>(
|
pub fn map_east<O: Output>(
|
||||||
item_offset: O::Unit,
|
item_offset: O::Unit,
|
||||||
item_width: O::Unit,
|
item_width: O::Unit,
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,10 @@ render!(TuiOut: (self: Arranger) => {
|
||||||
(8, 20, self.scene_row_headers(), self.scene_row_cells()),
|
(8, 20, self.scene_row_headers(), self.scene_row_cells()),
|
||||||
(25, 2, self.input_row_header(), self.input_row_cells()),
|
(25, 2, self.input_row_header(), self.input_row_cells()),
|
||||||
].into_iter(),
|
].into_iter(),
|
||||||
move|(y, h, header, cells), index|map_south(y, h, Fill::x(Align::w(Bsp::e(
|
move|(y, h, header, cells), index|map_south_west(y, h, Align::w(Bsp::a(
|
||||||
Fixed::xy(scenes_w, h, header),
|
Align::w(Fixed::xy(scenes_w, h, header)),
|
||||||
Fixed::xy(self.tracks.len() as u16*6, h, cells)
|
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))))))
|
self.size.of(toolbar(pool(editing(Bsp::s(arrrrrr, enclosed(&self.editor))))))
|
||||||
|
|
||||||
|
|
@ -167,14 +167,18 @@ impl Arranger {
|
||||||
let color = scene.color();
|
let color = scene.color();
|
||||||
let cell = Self::phat_sel_3(
|
let cell = Self::phat_sel_3(
|
||||||
selected_scene == Some(i),
|
selected_scene == Some(i),
|
||||||
Push::x(1, name.clone()),
|
Push::x(1, Tui::bold(true, name.clone())),
|
||||||
Push::x(1, name),
|
Push::x(1, Tui::bold(true, name)),
|
||||||
if selected_scene.map(|s|s + 1) == Some(i) {
|
if selected_scene.map(|s|s + 1) == Some(i) {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
Some(last_color.read().unwrap().base.rgb)
|
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)
|
Color::Rgb(0, 0, 0)
|
||||||
);
|
);
|
||||||
*last_color.write().unwrap() = color;
|
*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(
|
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),
|
||self.scenes_with_heights(2),
|
||||||
move|(_, scene, y1, y2), i| {
|
move|(_, scene, y1, y2), j| {
|
||||||
let h = (y2 - y1) as u16;
|
let h = (y2 - y1) as u16;
|
||||||
let color = scene.color();
|
let color = scene.color();
|
||||||
let name = format!("🭬{}", &scene.name);
|
let name = "⏹ ";
|
||||||
//*last_color.write().unwrap() = color
|
let cell = Self::phat_sel_3(
|
||||||
map_south(y1 as u16, 2, Fill::x(Self::phat_cell_3(
|
selected_track == Some(i) && selected_scene == Some(j),
|
||||||
Tui::fg(TuiTheme::g(64), " ⏹ "),
|
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(),
|
TuiTheme::g(32).into(),
|
||||||
TuiTheme::g(32).into(),
|
);
|
||||||
//Tui::fg(TuiTheme::g(64), " ⏺ ")
|
map_south(y1 as u16, 3, Fill::x(cell))
|
||||||
)))
|
|
||||||
}
|
}
|
||||||
))).boxed()
|
))).boxed()
|
||||||
))
|
))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue