mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
pre generate grayscale palettes
This commit is contained in:
parent
cfa3cad5cb
commit
ee28d431bd
7 changed files with 16 additions and 12 deletions
|
|
@ -132,9 +132,7 @@ 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 {
|
||||
(ItemPalette::from(Tui::g(64)), String::new().into(), 0, false)
|
||||
};
|
||||
} else { (ItemPalette::G[64], String::new().into(), 0, false) };
|
||||
row!(
|
||||
FieldV(color, "Edit", format!("{name} ({length})")),
|
||||
FieldV(color, "Loop", looped.to_string())
|
||||
|
|
@ -143,9 +141,7 @@ impl MidiEditor {
|
|||
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 {
|
||||
(ItemPalette::from(Tui::g(64)), 0)
|
||||
};
|
||||
} else { (ItemPalette::G[64], 0) };
|
||||
let time_pos = self.time_pos();
|
||||
let time_zoom = self.time_zoom().get();
|
||||
let time_lock = if self.time_lock().get() { "[lock]" } else { " " };
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ pub trait HasPlayClip: HasClock {
|
|||
fn next_status (&self) -> impl Content<TuiOut> {
|
||||
let mut time: Arc<str> = String::from("--.-.--").into();
|
||||
let mut name: Arc<str> = String::from("").into();
|
||||
let mut color = ItemPalette::from(Tui::g(64));
|
||||
let mut color = ItemPalette::G[64];
|
||||
let clock = self.clock();
|
||||
if let Some((t, Some(clip))) = self.next_clip() {
|
||||
let clip = clip.read().unwrap();
|
||||
|
|
|
|||
|
|
@ -28,9 +28,7 @@ impl PianoHorizontal {
|
|||
buffer: RwLock::new(Default::default()).into(),
|
||||
point: MidiPointModel::default(),
|
||||
clip: clip.cloned(),
|
||||
color: clip.as_ref()
|
||||
.map(|p|p.read().unwrap().color)
|
||||
.unwrap_or(ItemPalette::from(ItemColor::from(Tui::g(64)))),
|
||||
color: clip.as_ref().map(|p|p.read().unwrap().color).unwrap_or(ItemPalette::G[64]),
|
||||
};
|
||||
piano.redraw();
|
||||
piano
|
||||
|
|
@ -270,7 +268,7 @@ impl MidiViewer for PianoHorizontal {
|
|||
fn set_clip (&mut self, clip: Option<&Arc<RwLock<MidiClip>>>) {
|
||||
*self.clip_mut() = clip.cloned();
|
||||
self.color = clip.map(|p|p.read().unwrap().color)
|
||||
.unwrap_or(ItemPalette::from(ItemColor::from(Tui::g(64))));
|
||||
.unwrap_or(ItemPalette::G[64]);
|
||||
self.redraw();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue