mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
big border around selected scene
This commit is contained in:
parent
2e81549747
commit
69832723b3
4 changed files with 117 additions and 80 deletions
|
|
@ -43,26 +43,40 @@ impl Arranger {
|
|||
}
|
||||
|
||||
/// A cell that is 3-row on its own, but stacks, giving (N+1)*2 rows per N cells.
|
||||
fn phat_cell <T: Content<TuiOut>> (color: ItemPalette, last: ItemPalette, field: T) -> impl Content<TuiOut> {
|
||||
Bsp::s(
|
||||
Self::phat_lo(color.base.rgb, last.base.rgb),
|
||||
Bsp::n(
|
||||
Self::phat_hi(color.base.rgb, last.base.rgb),
|
||||
fn phat_cell <T: Content<TuiOut>> (
|
||||
color: ItemPalette, last: ItemPalette, field: T
|
||||
) -> impl Content<TuiOut> {
|
||||
Bsp::s(Self::phat_lo(color.base.rgb, last.base.rgb),
|
||||
Bsp::n(Self::phat_hi(color.base.rgb, last.base.rgb),
|
||||
Fixed::y(1, Fill::x(Tui::fg_bg(color.lightest.rgb, color.base.rgb, field))),
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
fn phat_cell_3 <T: Content<TuiOut>> (top: Color, middle: Color, bottom: Color, field: T) -> impl Content<TuiOut> {
|
||||
Bsp::s(
|
||||
Self::phat_lo(middle, top),
|
||||
Bsp::n(
|
||||
Self::phat_hi(bottom, middle),
|
||||
fn phat_cell_3 <T: Content<TuiOut>> (
|
||||
field: T, top: Color, middle: Color, bottom: Color
|
||||
) -> impl Content<TuiOut> {
|
||||
Bsp::s(Self::phat_lo(middle, top),
|
||||
Bsp::n(Self::phat_hi(middle, bottom),
|
||||
Fixed::y(1, Fill::x(Tui::bg(middle, field))),
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
fn phat_sel_3 <T: Content<TuiOut>> (
|
||||
selected: bool, field_1: T, field_2: T, top: Option<Color>, middle: Color, bottom: Color
|
||||
) -> impl Content<TuiOut> {
|
||||
let border = Style::default().fg(Color::Rgb(255,255,255)).bg(middle);
|
||||
Either(selected,
|
||||
Tui::bg(middle, Outer(border).enclose( Align::w(Bsp::s("", Bsp::s(field_1, ""))))),
|
||||
Bsp::s(
|
||||
Fixed::y(1, top.map(|top|Self::phat_lo(middle, top))),
|
||||
Bsp::n(Self::phat_hi(middle, bottom),
|
||||
Fixed::y(1, Fill::x(Tui::bg(middle, field_2))),
|
||||
)
|
||||
))
|
||||
}
|
||||
|
||||
fn output_row_header <'a> (&'a self) -> BoxThunk<'a, TuiOut> {
|
||||
(||Tui::bold(true, Tui::fg_bg(TuiTheme::g(0), TuiTheme::g(200), "[ ] Out 1: NI")).boxed()).into()
|
||||
}
|
||||
|
|
@ -118,7 +132,7 @@ impl Arranger {
|
|||
let iter = ||self.tracks_with_widths();
|
||||
(move||Fixed::y(2, Map::new(iter, move|(_, track, x1, x2), i| {
|
||||
let color = track.color();
|
||||
let name = format!(" {}", &track.name);
|
||||
let name = Push::x(1, &track.name);
|
||||
Tui::bg(color.base.rgb, map_east(x1 as u16, (x2 - x1) as u16,
|
||||
Tui::fg_bg(color.lightest.rgb, color.base.rgb,
|
||||
Self::phat_cell(color, color.darkest.rgb.into(),
|
||||
|
|
@ -141,15 +155,30 @@ impl Arranger {
|
|||
(||{
|
||||
let scenes_w = 16;//.max(SCENES_W_OFFSET + ArrangerScene::longest_name(&self.scenes) as u16);
|
||||
let last_color = Arc::new(RwLock::new(ItemPalette::from(Color::Rgb(0, 0, 0))));
|
||||
let selected_scene = match self.selected {
|
||||
ArrangerSelection::Scene(s) => Some(s),
|
||||
_ => None
|
||||
};
|
||||
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;
|
||||
let name = format!("🭬{}", &scene.name);
|
||||
let color = scene.color();
|
||||
let name = format!("🭬{}", &scene.name);
|
||||
let cell = Self::phat_cell(color, *last_color.read().unwrap(), name);
|
||||
let cell = Self::phat_sel_3(
|
||||
selected_scene == Some(i),
|
||||
Push::x(1, name.clone()),
|
||||
Push::x(1, name),
|
||||
if selected_scene.map(|s|s + 1) == Some(i) {
|
||||
None
|
||||
} else {
|
||||
Some(last_color.read().unwrap().base.rgb)
|
||||
},
|
||||
color.base.rgb,
|
||||
Color::Rgb(0, 0, 0)
|
||||
);
|
||||
*last_color.write().unwrap() = color;
|
||||
map_south(y1 as u16, 2, Fill::x(cell))
|
||||
map_south(y1 as u16, 3, Fill::x(cell))
|
||||
}
|
||||
))).boxed()
|
||||
}).into()
|
||||
|
|
@ -160,6 +189,10 @@ impl Arranger {
|
|||
let cell = Bsp::s("[Rec]", "[Mon]");
|
||||
let color: ItemPalette = track.color().dark.into();
|
||||
let last_color = Arc::new(RwLock::new(ItemPalette::from(Color::Rgb(0, 0, 0))));
|
||||
let (selected_track, selected_scene) = match self.selected {
|
||||
ArrangerSelection::Clip(t, s) => (Some(t), Some(s)),
|
||||
_ => (None, None)
|
||||
};
|
||||
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| {
|
||||
|
|
@ -168,11 +201,11 @@ impl Arranger {
|
|||
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), " ⏹ "),
|
||||
TuiTheme::g(32).into(),
|
||||
TuiTheme::g(32).into(),
|
||||
TuiTheme::g(32).into(),
|
||||
//Tui::fg(TuiTheme::g(64), " ⏺ ")
|
||||
Tui::fg(TuiTheme::g(64), " ⏹ ")
|
||||
)))
|
||||
}
|
||||
))).boxed()
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ pub struct Sequencer {
|
|||
pub selectors: bool,
|
||||
pub compact: bool,
|
||||
|
||||
pub clock: Clock,
|
||||
pub size: Measure<TuiOut>,
|
||||
pub status: bool,
|
||||
pub note_buf: Vec<u8>,
|
||||
|
|
@ -95,7 +94,7 @@ audio!(|self:Sequencer, client, scope|{
|
|||
Control::Continue
|
||||
});
|
||||
has_size!(<TuiOut>|self:Sequencer|&self.size);
|
||||
has_clock!(|self:Sequencer|&self.clock);
|
||||
has_clock!(|self:Sequencer|&self.player.clock);
|
||||
has_phrases!(|self:Sequencer|self.pool.phrases);
|
||||
has_editor!(|self:Sequencer|self.editor);
|
||||
handle!(TuiIn: |self:Sequencer,input|SequencerCommand::execute_with_state(self, input.event()));
|
||||
|
|
@ -185,13 +184,13 @@ pub struct SequencerStatus {
|
|||
pub(crate) playing: bool,
|
||||
}
|
||||
from!(|state:&Sequencer|SequencerStatus = {
|
||||
let samples = state.clock.chunk.load(Relaxed);
|
||||
let rate = state.clock.timebase.sr.get();
|
||||
let samples = state.clock().chunk.load(Relaxed);
|
||||
let rate = state.clock().timebase.sr.get();
|
||||
let buffer = samples as f64 / rate;
|
||||
let width = state.size.w();
|
||||
Self {
|
||||
width,
|
||||
playing: state.clock.is_rolling(),
|
||||
playing: state.clock().is_rolling(),
|
||||
cpu: state.perf.percentage().map(|cpu|format!("│{cpu:.01}%").into()),
|
||||
size: format!("{}x{}│", width, state.size.h()).into(),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue