fix renaming of duplicates; remove Arranger::modal

This commit is contained in:
🪞👃🪞 2024-10-11 16:19:06 +03:00
parent de4797ab52
commit f500c717a2
5 changed files with 44 additions and 140 deletions

View file

@ -14,8 +14,6 @@ pub struct Arranger<E: Engine> {
pub editor: PhraseEditor<E>,
/// This allows the sequencer view to be moved or hidden.
pub show_sequencer: Option<tek_core::Direction>,
/// Slot for modal dialog displayed on top of app.
pub modal: Option<Box<dyn ContentComponent<E>>>,
}
/// Sections in the arranger app that may be focused
#[derive(Copy, Clone, PartialEq, Eq)]
@ -86,14 +84,6 @@ pub struct VerticalArrangerCursor<'a>(
pub struct HorizontalArranger<'a, E: Engine>(
pub &'a Arrangement<E>
);
pub struct ArrangerRenameModal<E: Engine> {
_engine: std::marker::PhantomData<E>,
pub done: bool,
pub target: ArrangementFocus,
pub value: String,
pub result: Arc<RwLock<String>>,
pub cursor: usize
}
/// Focus layout of arranger app
impl<E: Engine> FocusGrid<ArrangerFocus> for Arranger<E> {
fn cursor (&self) -> (usize, usize) { self.focus_cursor }
@ -401,7 +391,7 @@ impl ArrangementFocus {
scenes.get(*s),
) {
if let Some(clip) = scene.clip(*t) {
format!("T{t} S{s} C{}", &clip.read().unwrap().name.read().unwrap())
format!("T{t} S{s} C{}", &clip.read().unwrap().name)
} else {
format!("T{t} S{s}: Empty")
}
@ -498,22 +488,6 @@ impl ArrangementViewMode {
}
}
}
impl<E: Engine> ArrangerRenameModal<E> {
pub fn new (target: ArrangementFocus, value: &Arc<RwLock<String>>) -> Self {
Self {
_engine: Default::default(),
done: false,
value: value.read().unwrap().clone(),
cursor: value.read().unwrap().len(),
result: value.clone(),
target,
}
}
}
impl<E: Engine + Send> Exit for ArrangerRenameModal<E> {
fn exited (&self) -> bool { self.done }
fn exit (&mut self) { self.done = true }
}
impl Scene {
pub fn new (
name: impl AsRef<str>,