show all editor coordinates

This commit is contained in:
🪞👃🪞 2024-12-15 00:16:12 +01:00
parent 6ee3abed8c
commit 03e3a82238
2 changed files with 36 additions and 8 deletions

View file

@ -173,23 +173,22 @@ audio!(|self:SequencerTui,client,scope|{
Control::Continue
});
render!(|self: SequencerTui|lay!([self.size, Tui::split_up(false, 1,
Tui::fill_xy(SequencerStatusBar::from(self)),
render!(|self: SequencerTui|lay!([self.size, Tui::split_up(false, 3,
Tui::fill_xy(col!([
PhraseEditStatus(&self.editor),
SequencerStatusBar::from(self)
])),
Tui::split_right(false, if self.size.w() > 60 {
20
} else if self.size.w() > 40 {
15
} else {
10
},
Tui::fixed_x(20, Tui::split_down(false, 4, col!([
}, Tui::fixed_x(20, col!([
PhraseSelector::play_phrase(&self.player),
PhraseSelector::next_phrase(&self.player),
]), Tui::split_up(false, 2,
PhraseSelector::edit_phrase(self.editor.phrase()),
PhraseListView::from(self),
))),
col!([
])), col!([
Tui::fixed_y(2, TransportView::from((
self,
self.player.play_phrase().as_ref().map(|(_,p)|p.as_ref().map(|p|p.read().unwrap().color)).flatten().clone(),

View file

@ -224,3 +224,32 @@ impl std::fmt::Debug for PhraseEditorModel {
.finish()
}
}
pub struct PhraseEditStatus<'a>(pub &'a PhraseEditorModel);
render!(|self:PhraseEditStatus<'a>|row!(|add|{
let (color, name, length) = if let Some(phrase) = self.0.phrase().as_ref().map(|p|p.read().unwrap()) {
(phrase.color, phrase.name.clone(), phrase.length)
} else {
(ItemPalette::from(TuiTheme::g(64)), String::new(), 0)
};
let bg = color.base.rgb;
let fg = color.lightest.rgb;
let mut field = |name:&str, value:String|add(&Tui::fixed_xy(8, 2,
Tui::bg(bg, Tui::fg(fg, col!([
name, Tui::bold(true, &value)
])))));
field("Edit", format!("{name}"))?;
field("Length", format!("{length}"))?;
field("TimePt", format!("{}", self.0.time_point()))?;
field("TimeZoom", format!("{}", self.0.time_zoom()))?;
field("TimeLock", format!("{}", self.0.time_lock()))?;
field("TimeStrt", format!("{}", self.0.time_start()))?;
field("NoteLen", format!("{}", self.0.note_len()))?;
field("NoteLo", format!("{}", self.0.note_lo()))?;
field("NoteAxis", format!("{}", self.0.note_axis()))?;
field("NoteHi", format!("{}", self.0.note_hi()))?;
field("NotePt", format!("{}", self.0.note_point()))?;
Ok(())
}));