FilmCraft: An open-source, nonlinear video editor written by scratch in pure Rust
Merge pull request #749 from vangel76/fix-456-new-bin-name
Brandon Thomasa270f5cf348a
diff --cc crates/ui-egui/src/panels/project.rsindex 551f5cce3,2a18137a1..9aef769ed--- a/crates/ui-egui/src/panels/project.rs+++ b/crates/ui-egui/src/panels/project.rs@@@ -622,12 -607,9 +622,12 @@@ fn footer(app: &mut FilmcraftApp, ui: &"find" => actions.push(("edit.find".into(), json!({}))),"file.newBin" => {let parent = (v.bin != app.session.project.root.id).then_some(v.bin.0);- actions.push(("file.newBin".into(), json!({"name": "New Bin", "parent": parent})));+ actions.push(("file.newBin".into(), json!({"parent": parent, "panel": pre})));}- "project.delete" if app.session.state.project_selection.is_empty() => app.ui.status = tl!("Select items to clear").into(),+ "project.delete" => match crate::panels::project_views::clear_params(&app.session.state.project_selection, app.ui.project_panel.selected_bin) {+ Some(p) => actions.push((id.into(), p)),+ None => app.ui.status = tl!("Select items to clear").into(),+ },_ => actions.push((id.into(), json!({}))),}}diff --cc crates/ui-egui/src/panels/project_views.rsindex 46d800234,af7911fae..0d05e3a3e--- a/crates/ui-egui/src/panels/project_views.rs+++ b/crates/ui-egui/src/panels/project_views.rs@@@ -311,23 -311,9 +311,23 @@@ fn bin_menu(app: &mut FilmcraftApp, uiui.close();}if ui.button(tl!("New Bin")).clicked() {- actions.push(("file.newBin".into(), json!({"name": "New Bin", "parent": bin})));+ actions.push(("file.newBin".into(), json!({"parent": bin, "panel": v.prefix})));ui.close();}+ ui.separator();+ if ui.button(tl!("Clear")).clicked() {+ actions.push(("project.delete".into(), json!({"items": [bin]})));+ ui.close();+ }+}++/// Parameters for `project.delete`: the selected items, else the selected bin by id (the engine+/// deletes a named bin with everything in it). `None` when nothing is selected.+pub fn clear_params(selection: &[filmcraft_project::ItemId], selected_bin: Option<u64>) -> Option<serde_json::Value> {+ if !selection.is_empty() {+ return Some(json!({}));+ }+ selected_bin.map(|b| json!({"items": [b]}))}/// Drop project items dragged onto a bin: move them (the selection when the dragged item is in it).