use Arc<str> where applicable; use konst split_at

This commit is contained in:
🪞👃🪞 2025-01-08 00:24:40 +01:00
parent 411fc0c4bc
commit 305481adee
35 changed files with 286 additions and 273 deletions

View file

@ -122,6 +122,39 @@ impl MidiEditor {
self.mode.redraw();
}
}
pub fn clip_status (&self) -> impl Content<TuiOut> + '_ {
let (color, name, length, looped) = if let Some(phrase) = self.phrase().as_ref().map(|p|p.read().unwrap()) {
(phrase.color, phrase.name.clone(), phrase.length, phrase.looped)
} else {
(ItemPalette::from(TuiTheme::g(64)), String::new().into(), 0, false)
};
row!(
FieldV(color, "Edit", format!("{name} ({length})")),
FieldV(color, "Loop", looped.to_string())
)
}
pub fn edit_status (&self) -> impl Content<TuiOut> + '_ {
let (color, name, length, looped) = if let Some(phrase) = self.phrase().as_ref().map(|p|p.read().unwrap()) {
(phrase.color, phrase.name.clone(), phrase.length, phrase.looped)
} else {
(ItemPalette::from(TuiTheme::g(64)), String::new().into(), 0, false)
};
let time_point = self.time_point();
let time_start = self.time_start();
let time_end = self.time_end();
let time_axis = self.time_axis().get();
let time_zoom = self.time_zoom().get();
let time_lock = if self.time_lock().get() { "[lock]" } else { " " };
let time_field = FieldV(color, "Time", format!("{length}/{time_zoom}+{time_point} {time_lock}"));
let note_point = format!("{:>3}", self.note_point());
let note_name = format!("{:4}", Note::pitch_to_name(self.note_point()));
let note_len = format!("{:>4}", self.note_len());;;;
let note_field = FieldV(color, "Note", format!("{note_name} {note_point} {note_len}"));
Bsp::e(time_field, note_field,)
}
}
impl std::fmt::Debug for MidiEditor {