mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
editor: move status bars to editor_view
This commit is contained in:
parent
d1be569b48
commit
decbb177f0
2 changed files with 31 additions and 27 deletions
|
|
@ -69,33 +69,6 @@ impl MidiEditor {
|
||||||
self.mode.redraw();
|
self.mode.redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clip_status (&self) -> impl Content<TuiOut> + '_ {
|
|
||||||
let (color, name, length, looped) = if let Some(clip) = self.clip().as_ref().map(|p|p.read().unwrap()) {
|
|
||||||
(clip.color, clip.name.clone(), clip.length, clip.looped)
|
|
||||||
} else { (ItemTheme::G[64], String::new().into(), 0, false) };
|
|
||||||
Bsp::e(
|
|
||||||
FieldH(color, "Edit", format!("{name} ({length})")),
|
|
||||||
FieldH(color, "Loop", looped.to_string())
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn edit_status (&self) -> impl Content<TuiOut> + '_ {
|
|
||||||
let (color, length) = if let Some(clip) = self.clip().as_ref().map(|p|p.read().unwrap()) {
|
|
||||||
(clip.color, clip.length)
|
|
||||||
} else { (ItemTheme::G[64], 0) };
|
|
||||||
let time_pos = self.get_time_pos();
|
|
||||||
let time_zoom = self.get_time_zoom();
|
|
||||||
let time_lock = if self.get_time_lock() { "[lock]" } else { " " };
|
|
||||||
let note_pos = self.get_note_pos();
|
|
||||||
let note_name = format!("{:4}", Note::pitch_to_name(note_pos));
|
|
||||||
let note_pos = format!("{:>3}", note_pos);
|
|
||||||
let note_len = format!("{:>4}", self.get_note_len());
|
|
||||||
Bsp::e(
|
|
||||||
FieldH(color, "Time", format!("{length}/{time_zoom}+{time_pos} {time_lock}")),
|
|
||||||
FieldH(color, "Note", format!("{note_name} {note_pos} {note_len}")),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TimeRange for MidiEditor {
|
impl TimeRange for MidiEditor {
|
||||||
|
|
|
||||||
|
|
@ -7,3 +7,34 @@ content!(TuiOut: |self: MidiEditor| {
|
||||||
//self.autozoom();
|
//self.autozoom();
|
||||||
self.size.of(&self.mode)
|
self.size.of(&self.mode)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
impl MidiEditor {
|
||||||
|
|
||||||
|
pub fn clip_status (&self) -> impl Content<TuiOut> + '_ {
|
||||||
|
let (color, name, length, looped) = if let Some(clip) = self.clip().as_ref().map(|p|p.read().unwrap()) {
|
||||||
|
(clip.color, clip.name.clone(), clip.length, clip.looped)
|
||||||
|
} else { (ItemTheme::G[64], String::new().into(), 0, false) };
|
||||||
|
Bsp::e(
|
||||||
|
FieldH(color, "Edit", format!("{name} ({length})")),
|
||||||
|
FieldH(color, "Loop", looped.to_string())
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn edit_status (&self) -> impl Content<TuiOut> + '_ {
|
||||||
|
let (color, length) = if let Some(clip) = self.clip().as_ref().map(|p|p.read().unwrap()) {
|
||||||
|
(clip.color, clip.length)
|
||||||
|
} else { (ItemTheme::G[64], 0) };
|
||||||
|
let time_pos = self.get_time_pos();
|
||||||
|
let time_zoom = self.get_time_zoom();
|
||||||
|
let time_lock = if self.get_time_lock() { "[lock]" } else { " " };
|
||||||
|
let note_pos = self.get_note_pos();
|
||||||
|
let note_name = format!("{:4}", Note::pitch_to_name(note_pos));
|
||||||
|
let note_pos = format!("{:>3}", note_pos);
|
||||||
|
let note_len = format!("{:>4}", self.get_note_len());
|
||||||
|
Bsp::e(
|
||||||
|
FieldH(color, "Time", format!("{length}/{time_zoom}+{time_pos} {time_lock}")),
|
||||||
|
FieldH(color, "Note", format!("{note_name} {note_pos} {note_len}")),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue