wip: back to 89 errors

This commit is contained in:
🪞👃🪞 2025-05-14 15:16:43 +03:00
parent f3c67f95b5
commit 57eff50973
5 changed files with 27 additions and 40 deletions

View file

@ -79,20 +79,8 @@ handle!(TuiIn: |self: App, input|Ok(if let Some(command) = self.config.keys.comm
.transpose()?
.flatten())
}
fn scene (app: &mut App, command: SceneCommand) -> Perhaps<Self> {
Ok(command.delegate(app, |command|Self::Scene{command})?)
}
fn track (app: &mut App, command: TrackCommand) -> Perhaps<Self> {
Ok(command.delegate(app, |command|Self::Track{command})?)
}
fn input (app: &mut App, command: InputCommand) -> Perhaps<Self> {
Ok(command.delegate(app, |command|Self::Input{command})?)
}
fn output (app: &mut App, command: OutputCommand) -> Perhaps<Self> {
Ok(command.delegate(app, |command|Self::Output{command})?)
}
fn clip (app: &mut App, command: ClipCommand) -> Perhaps<Self> {
Ok(command.delegate(app, |command|Self::Clip{command})?)
fn arrange (app: &mut App, command: ArrangementCommand) -> Perhaps<Self> {
Ok(command.delegate(app, |command|Self::Arrange{command})?)
}
fn clock (app: &mut App, command: ClockCommand) -> Perhaps<Self> {
Ok(command.execute(&mut app.clock)?.map(|command|Self::Clock{command}))

View file

@ -141,7 +141,7 @@ pub trait AutoRemove:
}
}
}
}
/// Various possible dialog overlays
#[derive(PartialEq, Clone, Copy, Debug)]
@ -180,6 +180,9 @@ has_editor!(|self: App|{
#[tengri_proc::expose]
impl App {
fn _todo_u16_stub (&self) -> u16 {
todo!()
}
fn _todo_isize_stub (&self) -> isize {
todo!()
}

View file

@ -17,7 +17,7 @@ impl App {
pub fn view_status (&self) -> impl Content<TuiOut> + use<'_> {
self.update_clock();
let cache = self.view_cache.read().unwrap();
view_status(self.selected.describe(&self.tracks, &self.scenes),
view_status(self.selected.describe(self.tracks(), self.scenes()),
cache.sr.view.clone(), cache.buf.view.clone(), cache.lat.view.clone())
}
pub fn view_transport (&self) -> impl Content<TuiOut> + use<'_> {
@ -54,24 +54,24 @@ impl App {
self.sampler().map(|s|s.view_meters_output())
}
pub fn view_dialog (&self) -> impl Content<TuiOut> + use<'_> {
When(app.dialog.is_some(), Bsp::b( "",
When(self.dialog.is_some(), Bsp::b( "",
Fixed::xy(70, 23, Tui::fg_bg(Rgb(255,255,255), Rgb(16,16,16), Bsp::b(
Repeat(" "), Outer(true, Style::default().fg(Tui::g(96)))
.enclose(app.dialog.as_ref().map(|dialog|match dialog {
.enclose(self.dialog.as_ref().map(|dialog|match dialog {
Dialog::Menu =>
app.view_dialog_menu().boxed(),
self.view_dialog_menu().boxed(),
Dialog::Help =>
app.view_dialog_help().boxed(),
Dialog::Save =>
app.view_dialog_save().boxed(),
Dialog::Load =>
app.view_dialog_load().boxed(),
self.view_dialog_help().boxed(),
Dialog::Save(browser) =>
self.view_dialog_save().boxed(),
Dialog::Load(browser) =>
self.view_dialog_load().boxed(),
Dialog::Options =>
app.view_dialog_options().boxed(),
self.view_dialog_options().boxed(),
Dialog::Device(index) =>
app.view_dialog_device(*index).boxed(),
self.view_dialog_device(*index).boxed(),
Dialog::Message(message) =>
app.view_dialog_message(message).boxed(),
self.view_dialog_message(message).boxed(),
}))
)))
))

View file

@ -36,37 +36,37 @@ impl ArrangementCommand {
Ok(None)
}
/// Set the color of the selected entity
fn set_color (arranger: &mut Arrangement, palette: Option<ItemTheme>) -> Option<ItemTheme> {
fn set_color (arranger: &mut Arrangement, palette: Option<ItemTheme>) -> Perhaps<Self> {
use Selection::*;
let palette = palette.unwrap_or_else(||ItemTheme::random());
Some(match arranger.selected {
Ok(Some(Self::SetColor { palette: match arranger.selected {
Some(Mix) => {
let old = arranger.color;
arranger.color = palette;
old
Some(old)
},
Some(Scene(s)) => {
let old = arranger.scenes[s].color;
arranger.scenes[s].color = palette;
old
Some(old)
}
Some(Track(t)) => {
let old = arranger.tracks[t].color;
arranger.tracks[t].color = palette;
old
Some(old)
}
Some(TrackClip { track, scene }) => {
if let Some(ref clip) = arranger.scenes[scene].clips[track] {
let mut clip = clip.write().unwrap();
let old = clip.color;
clip.color = palette;
old
Some(old)
} else {
return None
None
}
},
_ => todo!()
})
} }))
}
fn track (arranger: &mut Arrangement, track: TrackCommand) -> Perhaps<Self> {

View file

@ -167,11 +167,7 @@ impl<'a> ArrangerView<'a> {
.left(*width_side, Map::new(
move||arrangement.scenes_with_sizes(
*is_editing,
Self::H_SCENE,
Self::H_EDITOR,
selected_track,
selected_scene,
*is_editing, Self::H_SCENE, Self::H_EDITOR, selected_track, selected_scene,
).map_while(|(s, scene, y1, y2)|if y2 as u16 > *scenes_height {
None
} else {