Feat: ability to rename steps
This commit is contained in:
@@ -577,6 +577,12 @@ fn render_modal(frame: &mut Frame, app: &App, snapshot: &SequencerSnapshot, term
|
||||
.border_color(Color::Magenta)
|
||||
.render_centered(frame, term);
|
||||
}
|
||||
Modal::RenameStep { step, name, .. } => {
|
||||
TextInputModal::new(&format!("Name Step {:02}", step + 1), name)
|
||||
.width(40)
|
||||
.border_color(Color::Cyan)
|
||||
.render_centered(frame, term);
|
||||
}
|
||||
Modal::SetPattern { field, input } => {
|
||||
let (title, hint) = match field {
|
||||
PatternField::Length => ("Set Length (1-128)", "Enter number"),
|
||||
@@ -618,11 +624,13 @@ fn render_modal(frame: &mut Frame, app: &App, snapshot: &SequencerSnapshot, term
|
||||
let step_idx = app.editor_ctx.step;
|
||||
let step = pattern.step(step_idx);
|
||||
let source_idx = step.and_then(|s| s.source);
|
||||
let step_name = step.and_then(|s| s.name.as_ref());
|
||||
|
||||
let title = if let Some(src) = source_idx {
|
||||
format!("Step {:02} → {:02}", step_idx + 1, src + 1)
|
||||
} else {
|
||||
format!("Step {:02}", step_idx + 1)
|
||||
let title = match (source_idx, step_name) {
|
||||
(Some(src), Some(name)) => format!("Step {:02}: {} → {:02}", step_idx + 1, name, src + 1),
|
||||
(None, Some(name)) => format!("Step {:02}: {}", step_idx + 1, name),
|
||||
(Some(src), None) => format!("Step {:02} → {:02}", step_idx + 1, src + 1),
|
||||
(None, None) => format!("Step {:02}", step_idx + 1),
|
||||
};
|
||||
|
||||
let inner = ModalFrame::new(&title)
|
||||
@@ -686,6 +694,7 @@ fn render_modal(frame: &mut Frame, app: &App, snapshot: &SequencerSnapshot, term
|
||||
let width = (term.width * 80 / 100).max(40);
|
||||
let height = (term.height * 60 / 100).max(10);
|
||||
let step_num = app.editor_ctx.step + 1;
|
||||
let step = app.current_edit_pattern().step(app.editor_ctx.step);
|
||||
|
||||
let flash_kind = app.ui.flash_kind();
|
||||
let border_color = match flash_kind {
|
||||
@@ -695,7 +704,13 @@ fn render_modal(frame: &mut Frame, app: &App, snapshot: &SequencerSnapshot, term
|
||||
None => Color::Rgb(100, 160, 180),
|
||||
};
|
||||
|
||||
let inner = ModalFrame::new(&format!("Step {step_num:02} Script"))
|
||||
let title = if let Some(ref name) = step.and_then(|s| s.name.as_ref()) {
|
||||
format!("Step {step_num:02}: {name}")
|
||||
} else {
|
||||
format!("Step {step_num:02} Script")
|
||||
};
|
||||
|
||||
let inner = ModalFrame::new(&title)
|
||||
.width(width)
|
||||
.height(height)
|
||||
.border_color(border_color)
|
||||
|
||||
Reference in New Issue
Block a user