mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
fix flip
This commit is contained in:
parent
43154c486d
commit
deb5348c69
1 changed files with 21 additions and 21 deletions
|
|
@ -28,6 +28,24 @@ pub struct PhraseEditorModel {
|
||||||
pub(crate) view_mode: PhraseViewMode,
|
pub(crate) view_mode: PhraseViewMode,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Copy, Clone, Debug)]
|
||||||
|
pub enum PhraseEditMode {
|
||||||
|
Note,
|
||||||
|
Scroll,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Copy, Clone, Debug)]
|
||||||
|
pub enum PhraseViewMode {
|
||||||
|
PianoHorizontal {
|
||||||
|
time_zoom: usize,
|
||||||
|
note_zoom: PhraseViewNoteZoom,
|
||||||
|
},
|
||||||
|
PianoVertical {
|
||||||
|
time_zoom: usize,
|
||||||
|
note_zoom: PhraseViewNoteZoom,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
impl std::fmt::Debug for PhraseEditorModel {
|
impl std::fmt::Debug for PhraseEditorModel {
|
||||||
fn fmt (&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
|
fn fmt (&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
|
||||||
f.debug_struct("PhraseEditorModel")
|
f.debug_struct("PhraseEditorModel")
|
||||||
|
|
@ -75,7 +93,7 @@ impl PhraseEditorModel {
|
||||||
let time = self.time_point.load(Ordering::Relaxed);
|
let time = self.time_point.load(Ordering::Relaxed);
|
||||||
let note = self.note_point.load(Ordering::Relaxed);
|
let note = self.note_point.load(Ordering::Relaxed);
|
||||||
let mut phrase = phrase.write().unwrap();
|
let mut phrase = phrase.write().unwrap();
|
||||||
let key: u7 = u7::from((127 - note) as u8);
|
let key: u7 = u7::from(note as u8);
|
||||||
let vel: u7 = 100.into();
|
let vel: u7 = 100.into();
|
||||||
let start = time;
|
let start = time;
|
||||||
let end = (start + self.note_len) % phrase.length;
|
let end = (start + self.note_len) % phrase.length;
|
||||||
|
|
@ -226,12 +244,12 @@ render!(|self: PhraseView<'a>|{
|
||||||
Ok(if to.area().h() >= 2 { view_mode.render_keys(to, *note_hi, *note_lo) })
|
Ok(if to.area().h() >= 2 { view_mode.render_keys(to, *note_hi, *note_lo) })
|
||||||
}))),
|
}))),
|
||||||
Tui::fill_x(lay!([
|
Tui::fill_x(lay!([
|
||||||
Tui::push_y(1, Tui::fill_x(render(|to: &mut TuiOutput|{
|
Tui::push_y(1, Tui::fill_x(Widget::new(|to|Ok(Some(to)), |to: &mut TuiOutput|{
|
||||||
size.set_wh(to.area.w(), to.area.h() as usize - 1);
|
size.set_wh(to.area.w(), to.area.h() as usize - 1);
|
||||||
let draw = to.area().h() >= 2;
|
let draw = to.area().h() >= 2;
|
||||||
Ok(if draw { view_mode.render_notes(to, buffer, *time_start, *note_hi) })
|
Ok(if draw { view_mode.render_notes(to, buffer, *time_start, *note_hi) })
|
||||||
}))),
|
}))),
|
||||||
Tui::push_y(1, render(move|to: &mut TuiOutput|{
|
Tui::push_y(1, Widget::new(|to|Ok(Some(to)), move|to: &mut TuiOutput|{
|
||||||
Ok(if *focused && *entered {
|
Ok(if *focused && *entered {
|
||||||
view_mode.render_cursor(
|
view_mode.render_cursor(
|
||||||
to,
|
to,
|
||||||
|
|
@ -245,18 +263,6 @@ render!(|self: PhraseView<'a>|{
|
||||||
])
|
])
|
||||||
});
|
});
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
|
||||||
pub enum PhraseViewMode {
|
|
||||||
PianoHorizontal {
|
|
||||||
time_zoom: usize,
|
|
||||||
note_zoom: PhraseViewNoteZoom,
|
|
||||||
},
|
|
||||||
PianoVertical {
|
|
||||||
time_zoom: usize,
|
|
||||||
note_zoom: PhraseViewNoteZoom,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub enum PhraseViewNoteZoom {
|
pub enum PhraseViewNoteZoom {
|
||||||
N(usize),
|
N(usize),
|
||||||
|
|
@ -704,9 +710,3 @@ impl Command<PhraseEditorModel> for PhraseCommand {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
|
||||||
pub enum PhraseEditMode {
|
|
||||||
Note,
|
|
||||||
Scroll,
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue