mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
wip: clip launcher
This commit is contained in:
parent
2f52e97c58
commit
90998b1c6e
3 changed files with 78 additions and 52 deletions
|
|
@ -95,9 +95,9 @@ pub fn process (_: &mut Launcher, _: &Client, _: &ProcessScope) -> Control {
|
|||
}
|
||||
pub fn render (state: &Launcher, buf: &mut Buffer, area: Rect) -> Usually<Rect> {
|
||||
let Rect { x, y, width, height } = area;
|
||||
let track_area = Rect { x: 0, y: 0, width, height: 22 };
|
||||
let seq_area = Rect { x: 0, y: 23, width, height: 18 };
|
||||
let chain_area = Rect { x: 0, y: 40, width, height: 22 };
|
||||
let track_area = Rect { x: x, y: y, width, height: 22 };
|
||||
let seq_area = Rect { x: x, y: y+21, width, height: 20 };
|
||||
let chain_area = Rect { x: x, y: y+40, width, height: 22 };
|
||||
let separator = format!("├{}┤", "-".repeat((width - 2).into()));
|
||||
let scenes = draw_scenes(state, buf, x, y);
|
||||
separator.blit(buf, x, y + 2, Some(Style::default().dim()));
|
||||
|
|
@ -108,18 +108,18 @@ pub fn render (state: &Launcher, buf: &mut Buffer, area: Rect) -> Usually<Rect>
|
|||
highlight = Some(scenes);
|
||||
}
|
||||
draw_crossings(state, buf, x + w - 2, y);
|
||||
draw_sequencer(state, buf, x, y + 21, width, height - 22)?;
|
||||
draw_box(buf, area);
|
||||
draw_highlight(state, buf, &highlight);
|
||||
let style = Some(Style::default().green().not_dim());
|
||||
let style = Some(Style::default().green().dim());
|
||||
crate::device::chain::draw_as_row(
|
||||
&*state.chains[0].state(), buf, chain_area, Some(Style::default().green().dim())
|
||||
&*state.chains[0].state(), buf, chain_area, style
|
||||
)?;
|
||||
draw_highlight(state, buf, &highlight);
|
||||
match state.view {
|
||||
LauncherView::Tracks => draw_box_styled(buf, track_area, style),
|
||||
LauncherView::Sequencer => draw_box_styled(buf, seq_area, style),
|
||||
LauncherView::Chains => draw_box_styled(buf, chain_area, style),
|
||||
};
|
||||
draw_sequencer(state, buf, seq_area.x, seq_area.y + 1, seq_area.width, seq_area.height - 2)?;
|
||||
if state.show_help {
|
||||
let style = Some(Style::default().bold().white().not_dim().on_black().italic());
|
||||
//" [Tab] ".blit(buf, 1, match state.view {
|
||||
|
|
@ -234,12 +234,18 @@ fn draw_sequencer (
|
|||
state: &Launcher, buf: &mut Buffer, x: u16, y: u16, width: u16, height: u16
|
||||
) -> Usually<()> {
|
||||
if let Some(sequencer) = state.tracks.get(state.col().saturating_sub(1)) {
|
||||
crate::device::sequencer::horizontal::footer(
|
||||
&sequencer.state(), buf, 0, y, width, 0
|
||||
);
|
||||
//crate::device::sequencer::horizontal::footer(
|
||||
//&sequencer.state(), buf, 0, y, width, 0
|
||||
//);
|
||||
crate::device::sequencer::horizontal::keys(
|
||||
&sequencer.state(), buf, Rect { x, y: y + 3, width, height }
|
||||
&sequencer.state(), buf, Rect { x, y: y + 1, width, height }
|
||||
)?;
|
||||
crate::device::sequencer::horizontal::lanes(
|
||||
&sequencer.state(), buf, x, y + 1, width,
|
||||
);
|
||||
crate::device::sequencer::horizontal::cursor(
|
||||
&sequencer.state(), buf, x, y + 1,
|
||||
);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -252,18 +258,35 @@ fn draw_highlight (
|
|||
}
|
||||
|
||||
pub fn handle (state: &mut Launcher, event: &AppEvent) -> Usually<bool> {
|
||||
handle_keymap(state, event, KEYMAP)
|
||||
Ok(handle_keymap(state, event, KEYMAP)? || match state.view {
|
||||
LauncherView::Tracks => {
|
||||
handle_keymap(state, event, KEYMAP_TRACKS)?
|
||||
},
|
||||
LauncherView::Sequencer => {
|
||||
let i = state.col().saturating_sub(1);
|
||||
if let Some(sequencer) = state.tracks.get_mut(i) {
|
||||
crate::device::sequencer::handle(&mut *sequencer.state(), event)?
|
||||
} else {
|
||||
true
|
||||
}
|
||||
},
|
||||
LauncherView::Chains => {
|
||||
true
|
||||
}
|
||||
})
|
||||
}
|
||||
pub const KEYMAP: &'static [KeyBinding<Launcher>] = keymap!(Launcher {
|
||||
[Up, NONE, "cursor_up", "move cursor up", cursor_up],
|
||||
[Down, NONE, "cursor_down", "move cursor down", cursor_down],
|
||||
[Left, NONE, "cursor_left", "move cursor left", cursor_left],
|
||||
[Right, NONE, "cursor_right", "move cursor right", cursor_right],
|
||||
[Char('r'), NONE, "rename", "rename current element", rename],
|
||||
[F(1), NONE, "toggle_help", "toggle help", toggle_help],
|
||||
[Tab, SHIFT, "focus_prev", "focus previous area", focus_prev],
|
||||
[Tab, NONE, "focus_next", "focus next area", focus_next],
|
||||
});
|
||||
pub const KEYMAP_TRACKS: &'static [KeyBinding<Launcher>] = keymap!(Launcher {
|
||||
[Up, NONE, "cursor_up", "move cursor up", cursor_up],
|
||||
[Down, NONE, "cursor_down", "move cursor down", cursor_down],
|
||||
[Left, NONE, "cursor_left", "move cursor left", cursor_left],
|
||||
[Right, NONE, "cursor_right", "move cursor right", cursor_right],
|
||||
});
|
||||
fn rename (_: &mut Launcher) -> Usually<bool> {
|
||||
Ok(true)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue