fix warnings, cleanup

This commit is contained in:
i do not exist 2026-08-12 18:59:19 +03:00
parent 406aabde6e
commit da2099c52e
10 changed files with 379 additions and 450 deletions

View file

@ -1,4 +1,3 @@
use crate::*;
use super::*;
/// A scene consists of a set of clips to play together.
@ -85,13 +84,13 @@ pub trait SceneController: HasScene
+ Namespace<ItemTheme>
{
#[command(SetSize = "scene/size")]
fn scene_set_size (&mut self, size: usize) -> Perhaps<SceneCommand>
fn scene_set_size (&mut self, _size: usize) -> Perhaps<SceneCommand>
where Self: Namespace<usize>
{
todo!()
}
#[command(SetZoom = "scene/zoom")]
fn scene_set_zoom (&mut self, size: usize) -> Perhaps<SceneCommand>
fn scene_set_zoom (&mut self, _size: usize) -> Perhaps<SceneCommand>
where Self: Namespace<usize>
{
todo!()

View file

@ -104,19 +104,19 @@ pub trait TrackController: HasTrack
Ok(None)
}
#[command(SetMute = "track/mute")]
fn track_set_mute (&mut self, mute: Option<bool>) -> Perhaps<TrackCommand> {
fn track_set_mute (&mut self, _mute: Option<bool>) -> Perhaps<TrackCommand> {
todo!()
}
#[command(SetSolo = "track/solo")]
fn track_set_solo (&mut self, solo: Option<bool>) -> Perhaps<TrackCommand> {
fn track_set_solo (&mut self, _solo: Option<bool>) -> Perhaps<TrackCommand> {
todo!()
}
#[command(SetSize = "track/size")]
fn track_set_size (&mut self, size: usize) -> Perhaps<TrackCommand> {
fn track_set_size (&mut self, _size: usize) -> Perhaps<TrackCommand> {
todo!()
}
#[command(SetZoom = "track/zoom")]
fn track_set_zoom (&mut self, zoom: usize) -> Perhaps<TrackCommand> {
fn track_set_zoom (&mut self, _zoom: usize) -> Perhaps<TrackCommand> {
todo!()
}
#[command(SetName = "track/name")]
@ -313,7 +313,7 @@ pub trait TracksController: HasTracks
fn tracks_add (&mut self) -> Perhaps<TracksCommand>
where Self: HasScenes + HasJack<'static>
{
let (index, _) = self.tracks_add_one(None, None, [].into(), [].into())?;
let (_index, _) = self.tracks_add_one(None, None, [].into(), [].into())?;
Ok(None)
}
}

View file

@ -60,13 +60,13 @@ pub trait BrowseController:
pub size: Sizer,
}
pub(crate) struct EntriesIterator<'a, S: Screen> {
pub browser: &'a Browse,
pub offset: usize,
pub length: usize,
pub index: usize,
_screen: std::marker::PhantomData<S>
}
//pub(crate) struct EntriesIterator<'a, S: Screen> {
//pub browser: &'a Browse,
//pub offset: usize,
//pub length: usize,
//pub index: usize,
//_screen: std::marker::PhantomData<S>
//}
#[derive(Clone, Debug)] pub enum BrowseTarget {
SaveProject,
@ -118,40 +118,37 @@ impl Browse {
unreachable!()
})
}
fn _todo_stub_path_buf (&self) -> PathBuf { todo!() }
fn _todo_stub_usize (&self) -> usize { todo!() }
fn _todo_stub_arc_str (&self) -> Arc<str> { todo!() }
fn tui (&self) -> impl Draw<Tui> {
iter_south_fixed(1, ||self.tui_entries(), |entry, _index|entry.origin_w().full_w())
}
fn tui_entries (&self) -> EntriesIterator<'_, Tui> {
EntriesIterator {
offset: 0,
index: 0,
length: self.dirs.len() + self.files.len(),
browser: self,
_screen: Default::default(),
}
}
//fn tui (&self) -> impl Draw<Tui> {
//iter_south_fixed(1, ||self.tui_entries(), |entry, _index|entry.origin_w().full_w())
//}
//fn tui_entries (&self) -> EntriesIterator<'_, Tui> {
//EntriesIterator {
//offset: 0,
//index: 0,
//length: self.dirs.len() + self.files.len(),
//browser: self,
//_screen: Default::default(),
//}
//}
}
impl<'a> Iterator for EntriesIterator<'a, Tui> {
type Item = impl Draw<Tui>;
fn next (&mut self) -> Option<Self::Item> {
let dirs = self.browser.dirs.len();
let files = self.browser.files.len();
let index = self.index;
if self.index < dirs {
self.index += 1;
Some(bold(true, self.browser.dirs[index].1.as_str()))
} else if self.index < dirs + files {
self.index += 1;
Some(bold(false, self.browser.files[index - dirs].1.as_str()))
} else {
None
}
}
}
//impl<'a> Iterator for EntriesIterator<'a, Tui> {
//type Item = impl Draw<Tui>;
//fn next (&mut self) -> Option<Self::Item> {
//let dirs = self.browser.dirs.len();
//let files = self.browser.files.len();
//let index = self.index;
//if self.index < dirs {
//self.index += 1;
//Some(bold(true, self.browser.dirs[index].1.as_str()))
//} else if self.index < dirs + files {
//self.index += 1;
//Some(bold(false, self.browser.files[index - dirs].1.as_str()))
//} else {
//None
//}
//}
//}
impl PartialEq for BrowseTarget {
fn eq (&self, other: &Self) -> bool {

View file

@ -416,18 +416,6 @@ impl Clock {
}
}
impl Clock {
fn _todo_provide_u32 (&self) -> u32 {
todo!()
}
fn _todo_provide_opt_u32 (&self) -> Option<u32> {
todo!()
}
fn _todo_provide_f64 (&self) -> f64 {
todo!()
}
}
impl_has!(Clock: |self: Track|self.sequencer.clock);
impl_default!(Timebase: Self::new(48000f64, 150f64, DEFAULT_PPQ));

View file

@ -236,7 +236,6 @@ impl MidiEditor {
self.mode.redraw();
}
}
fn _todo_opt_clip_stub (&self) -> Option<Arc<RwLock<MidiClip>>> { todo!() }
fn clip_length (&self) -> usize { self.clip().as_ref().map(|p|p.read().unwrap().length).unwrap_or(1) }
fn note_length (&self) -> usize { self.get_note_len() }
fn note_pos (&self) -> usize { self.get_note_pos() }

View file

@ -222,7 +222,7 @@ pub trait PoolController: HasPool
}
#[command(CropSet = "crop/set")]
fn crop_set (&mut self, length: usize) -> Perhaps<PoolCommand> {
fn crop_set (&mut self, _length: usize) -> Perhaps<PoolCommand> {
if let Some(PoolMode::Length(clip, ref mut length, ref mut _focus))
= self.pool_mut().mode_mut().clone()
{
@ -233,7 +233,7 @@ pub trait PoolController: HasPool
clip.write().unwrap().length = *length;
}
*self.pool_mut().mode_mut() = None;
return Ok(old_length.map(|length|PoolCommand::CropSet { length }))
return Ok(old_length.map(|l|PoolCommand::CropSet { _length: l }))
}
Ok(None)
}
@ -429,12 +429,6 @@ impl ClipLength {
}
impl Pool {
fn _todo_usize_ (&self) -> usize { todo!() }
fn _todo_bool_ (&self) -> bool { todo!() }
fn _todo_clip_ (&self) -> MidiClip { todo!() }
fn _todo_path_ (&self) -> PathBuf { todo!() }
fn _todo_color_ (&self) -> ItemColor { todo!() }
fn _todo_str_ (&self) -> Arc<str> { todo!() }
fn _clip_new (&self) -> MidiClip { self.new_clip() }
fn _clip_cloned (&self) -> MidiClip { self.cloned_clip() }
fn _clip_index_current (&self) -> usize { 0 }
@ -445,44 +439,44 @@ impl Pool {
}
impl<'a> PoolView<'a> {
fn tui (&self) -> impl Draw<Tui> {
let Self(pool) = self;
//let color = self.1.clip().map(|c|c.read().unwrap().color).unwrap_or_else(||g(32).into());
//let on_bg = |x|x;//below(Repeat(" "), bg(color.darkest.term, x));
//let border = |x|x;//Outer(Style::default().fg(color.dark.term).bg(color.darkest.term)).enclose(x);
//let height = pool.clips.read().unwrap().len() as u16;
iter(
||pool.clips().clone().into_iter(),
move|clip: Arc<RwLock<MidiClip>>, i: usize|{
let MidiClip { ref name, color, length, .. } = *clip.read().unwrap();
let item_height = 1;
let _item_offset = i as u16 * item_height;
let selected = i == pool.clip_index();
let b = if selected { color.light.term } else { color.base.term };
let f = color.lightest.term;
let name = if false { format!(" {i:>3}") } else { format!(" {i:>3} {name}") };
let length = if false { String::default() } else { format!("{length} ") };
bg(b, below!(
fg(f, bold(selected, name)).origin_w().full_w(),
fg(f, bold(selected, length)).origin_e().full_w(),
when(selected, bold(true, fg(g(255), ""))).origin_w().full_w(),
when(selected, bold(true, fg(g(255), ""))).origin_e().full_w(),
)).exact_h(1)
}).origin_n().full_h().exact_w(20)
}
//fn tui (&self) -> impl Draw<Tui> {
//let Self(pool) = self;
////let color = self.1.clip().map(|c|c.read().unwrap().color).unwrap_or_else(||g(32).into());
////let on_bg = |x|x;//below(Repeat(" "), bg(color.darkest.term, x));
////let border = |x|x;//Outer(Style::default().fg(color.dark.term).bg(color.darkest.term)).enclose(x);
////let height = pool.clips.read().unwrap().len() as u16;
//iter(
//||pool.clips().clone().into_iter(),
//move|clip: Arc<RwLock<MidiClip>>, i: usize|{
//let MidiClip { ref name, color, length, .. } = *clip.read().unwrap();
//let item_height = 1;
//let _item_offset = i as u16 * item_height;
//let selected = i == pool.clip_index();
//let b = if selected { color.light.term } else { color.base.term };
//let f = color.lightest.term;
//let name = if false { format!(" {i:>3}") } else { format!(" {i:>3} {name}") };
//let length = if false { String::default() } else { format!("{length} ") };
//bg(b, below!(
//fg(f, bold(selected, name)).origin_w().full_w(),
//fg(f, bold(selected, length)).origin_e().full_w(),
//when(selected, bold(true, fg(g(255), "▶"))).origin_w().full_w(),
//when(selected, bold(true, fg(g(255), "◀"))).origin_e().full_w(),
//)).exact_h(1)
//}).origin_n().full_h().exact_w(20)
//}
}
impl ClipLength {
fn tui (&self) -> impl Draw<Tui> {
use ClipLengthFocus::*;
let bars = format!("{}", self.bars());
let beats = format!("{}", self.beats());
let ticks = format!("{:>02}", self.ticks());
match self.focus {
None => east!(" ", bars, ".", beats, ".", ticks),
Some(Bar) => east!("[", bars, "]", beats, ".", ticks),
Some(Beat) => east!(" ", bars, "[", beats, "]", ticks),
Some(Tick) => east!(" ", bars, ".", beats, "[", ticks),
}
}
//fn tui (&self) -> impl Draw<Tui> {
//use ClipLengthFocus::*;
//let bars = format!("{}", self.bars());
//let beats = format!("{}", self.beats());
//let ticks = format!("{:>02}", self.ticks());
//match self.focus {
//None => east!(" ", bars, ".", beats, ".", ticks),
//Some(Bar) => east!("[", bars, "]", beats, ".", ticks),
//Some(Beat) => east!(" ", bars, "[", beats, "]", ticks),
//Some(Tick) => east!(" ", bars, ".", beats, "[", ticks),
//}
//}
}

View file

@ -263,7 +263,7 @@ pub trait MidiClipController: HasMidiClip
{
#[command(SetColor = "clip/color")]
fn clip_set_color (&mut self, color: Option<ItemTheme>) -> Perhaps<MidiClipCommand> {
fn clip_set_color (&mut self, _color: Option<ItemTheme>) -> Perhaps<MidiClipCommand> {
//(SetColor [t: usize, s: usize, c: ItemTheme]
//clip.clip_set_color(t, s, c).map(|o|Self::SetColor(t, s, o)))));
//("color" [a: usize, b: usize] Some(Self::SetColor(a.unwrap(), b.unwrap(), ItemTheme::random())))
@ -271,7 +271,7 @@ pub trait MidiClipController: HasMidiClip
}
#[command(SetLoop = "clip/loop")]
fn clip_toggle_loop (&mut self, looping: Option<bool>) -> Perhaps<MidiClipCommand> {
fn clip_toggle_loop (&mut self, _looping: Option<bool>) -> Perhaps<MidiClipCommand> {
//(SetLoop [t: usize, s: usize, l: bool] cmd_todo!("\n\rtodo: {self:?}"))
//("loop" [a: usize, b: usize, c: bool] Some(Self::SetLoop(a.unwrap(), b.unwrap(), c.unwrap())))
todo!()
@ -362,14 +362,6 @@ impl PartialEq for MidiClip {
impl Eq for MidiClip {}
impl MidiClip {
fn _todo_opt_bool_stub_ (&self) -> Option<bool> { todo!() }
fn _todo_bool_stub_ (&self) -> bool { todo!() }
fn _todo_usize_stub_ (&self) -> usize { todo!() }
fn _todo_arc_str_stub_ (&self) -> Arc<str> { todo!() }
fn _todo_item_theme_stub (&self) -> ItemTheme { todo!() }
fn _todo_opt_item_theme_stub (&self) -> Option<ItemTheme> { todo!() }
}
impl_has!(Sequencer: |self: Track| self.sequencer);
impl_has!(Clock: |self: Sequencer| self.clock);
impl_has!(Vec<MidiInput>: |self: Sequencer| self.midi_ins);