exit dos mode

This commit is contained in:
🪞👃🪞 2024-06-30 02:03:37 +03:00
parent 3ba5e253b0
commit 625956766e
4 changed files with 9 additions and 13 deletions

View file

@ -2,12 +2,8 @@ use crate::prelude::*;
use super::*; use super::*;
pub fn handle (state: &mut Launcher, event: &AppEvent) -> Usually<bool> { pub fn handle (state: &mut Launcher, event: &AppEvent) -> Usually<bool> {
Ok(handle_keymap(state, event, KEYMAP)? || match state.view { Ok(handle_keymap(state, event, KEYMAP)? || match state.view {
LauncherView::Modal(ref mut device) => { LauncherView::Modal(ref mut device) => device.handle(event)?,
device.handle(event)? LauncherView::Tracks => handle_keymap(state, event, KEYMAP_TRACKS)?,
},
LauncherView::Tracks => {
handle_keymap(state, event, KEYMAP_TRACKS)?
},
LauncherView::Sequencer => { LauncherView::Sequencer => {
let i = state.col().saturating_sub(1); let i = state.col().saturating_sub(1);
if let Some(track) = state.tracks.get_mut(i) { if let Some(track) = state.tracks.get_mut(i) {

View file

@ -172,8 +172,8 @@ pub fn process (state: &mut Launcher, _: &Client, _: &ProcessScope) -> Control {
Control::Continue Control::Continue
} }
pub fn render (state: &Launcher, buf: &mut Buffer, mut area: Rect) -> Usually<Rect> { pub fn render (state: &Launcher, buf: &mut Buffer, mut area: Rect) -> Usually<Rect> {
area.width = 80; //area.width = 80; // DOS mode
area.height = 25; //area.height = 25;
let Rect { x, y, width, height } = area; let Rect { x, y, width, height } = area;
crate::device::sequencer::draw_play_stop(buf, x + 1, y, &state.playing); crate::device::sequencer::draw_play_stop(buf, x + 1, y, &state.playing);
crate::device::sequencer::draw_rec(buf, x + 12, y, state.recording); crate::device::sequencer::draw_rec(buf, x + 12, y, state.recording);
@ -183,10 +183,10 @@ pub fn render (state: &Launcher, buf: &mut Buffer, mut area: Rect) -> Usually<Re
draw_timer(buf, x + width - 1, y, &state.timebase, state.position); draw_timer(buf, x + width - 1, y, &state.timebase, state.position);
let mut y = y + 1; let mut y = y + 1;
y = y + LauncherGridView::new( y = y + LauncherGridView::new(
state, buf, Rect { x, y, width, height: 8 }, state.view.is_tracks() state, buf, Rect { x, y, width, height: height / 3 }, state.view.is_tracks()
).draw()?.height; ).draw()?.height;
y = y + draw_section_sequencer(state, buf, Rect { x, y, width, height: 8 })?.height; y = y + draw_section_sequencer(state, buf, Rect { x, y, width, height: height / 3 })?.height;
y = y + draw_section_chains(state, buf, Rect { x, y, width, height: 8 })?.height; y = y + draw_section_chains(state, buf, Rect { x, y, width, height: height /3 })?.height;
area.height = y; area.height = y;
if state.show_help { if state.show_help {
let style = Some(Style::default().bold().white().not_dim().on_black().italic()); let style = Some(Style::default().bold().white().not_dim().on_black().italic());

View file

@ -88,7 +88,7 @@ pub fn lanes (
format!("{}", step / time_zoom / 4 + 1) format!("{}", step / time_zoom / 4 + 1)
.blit(buf, x as u16, y - 1, Some(Style::default().bold().not_dim())); .blit(buf, x as u16, y - 1, Some(Style::default().bold().not_dim()));
} }
let h = (note1-note0)/2 - y as u32; let h = ((note1-note0)/2).saturating_sub(y as u32);
for k in 0..h { for k in 0..h {
let (character, style) = match ( let (character, style) = match (
contains_note_on(phrase, u7::from_int_lossy((note0 + k * 2 + 0) as u8), a, b), contains_note_on(phrase, u7::from_int_lossy((note0 + k * 2 + 0) as u8), a, b),

View file

@ -125,7 +125,7 @@ fn main () -> Result<(), Box<dyn Error>> {
]))), ]))),
]))?, ]))?,
Track::new("Helm", &timebase, Some(vec![ Track::new("Odin2", &timebase, Some(vec![
//Plugin::lv2("Helm", "file:///home/user/.lv2/Helm.lv2", &[1, 0, 0, 2])?.boxed(), //Plugin::lv2("Helm", "file:///home/user/.lv2/Helm.lv2", &[1, 0, 0, 2])?.boxed(),
Plugin::lv2("Odin2", "file:///home/user/.lv2/Odin2.lv2", &[1, 0, 0, 2])?.boxed(), Plugin::lv2("Odin2", "file:///home/user/.lv2/Odin2.lv2", &[1, 0, 0, 2])?.boxed(),
]), Some(vec![ ]), Some(vec![