Skip to content

FilmCraft: An open-source, nonlinear video editor written by scratch in pure Rust

#3233: Transparency Grid is in the monitors' wrench menus only, not the View menu

aiongg81e0fcc8171e
diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs
index 26b972e1c..67913eb61 100644
--- a/crates/ui-egui/src/menus.rs
+++ b/crates/ui-egui/src/menus.rs
@@ -91,7 +91,8 @@ pub const UI_COMMANDS: &[UiCommand] = &[
uic!("view.addGuide", "Add Guide…", ["View"], None),
uic!("view.clearGuides", "Clear Guides", ["View"], None),
uic!("view.snapInProgramMonitor", "Snap in Program Monitor", ["View"], None),
- uic!("view.transparencyGrid", "Transparency Grid", ["View"], None),
+ // the monitors' wrench menus only, as in the reference app
+ uic!("view.transparencyGrid", "Transparency Grid", [], None),
uic!("view.safeMargins", "Safe Margins", ["View", "Guide Templates"], None),
uic!("view.guideTemplates.save", "Save Guides as Template…", ["View", "Guide Templates"], None),
uic!("view.guideTemplates.manage", "Manage Guides…", ["View", "Guide Templates"], None),
diff --git a/crates/ui-egui/tests/it/view_ui.rs b/crates/ui-egui/tests/it/view_ui.rs
index 1f3583ea0..d9bc75664 100644
--- a/crates/ui-egui/tests/it/view_ui.rs
+++ b/crates/ui-egui/tests/it/view_ui.rs
@@ -207,19 +207,19 @@ fn fills_in(d: &Driver, area: egui::Rect) -> (Vec<(egui::Rect, egui::Color32)>,
(rects, verts)
}
-/// View ▸ Transparency Grid and the wrench menu item paint a gray and white checkerboard behind
+/// The wrench menu's Transparency Grid paints a gray and white checkerboard behind
/// the picture instead of the monitor background; each monitor keeps its own setting.
#[test]
fn transparency_grid_paints_a_checkerboard_behind_the_picture() {
use filmcraft_ui_egui::frames::Target;
use filmcraft_ui_egui::panels::monitor_view::{GRID_DARK, GRID_LIGHT};
let mut d = Driver::demo();
- let checked = |d: &mut Driver| {
- let menu = d.ok("ui.menu.list", json!({}));
- menu.as_array().unwrap().iter().find(|m| m["id"] == "view.transparencyGrid").expect("View ▸ Transparency Grid")["checked"].clone()
- };
+ // the check mark of the wrench menu item
+ let checked = |d: &mut Driver| filmcraft_ui_egui::panels::monitor_view::checked(d.harness.state(), "view.transparencyGrid");
+ let menu = d.ok("ui.menu.list", json!({}));
+ assert!(menu.as_array().unwrap().iter().all(|m| m["id"] != "view.transparencyGrid"), "not in the View menu");
assert_eq!(d.program()["transparency_grid"], false, "off by default");
- assert_eq!(checked(&mut d), false);
+ assert_eq!(checked(&mut d), Some(false));
let r = d.rect("program.picture");
let pic = egui::Rect::from_min_size(egui::pos2(r[0] as f32, r[1] as f32), egui::vec2(r[2] as f32, r[3] as f32));
let covers = |rects: &[(egui::Rect, egui::Color32)]| {
@@ -233,7 +233,7 @@ fn transparency_grid_paints_a_checkerboard_behind_the_picture() {
d.click("program.settings.transparencyGrid");
d.frames(2);
assert_eq!(d.program()["transparency_grid"], true);
- assert_eq!(checked(&mut d), true);
+ assert_eq!(checked(&mut d), Some(true));
let (rects, verts) = fills_in(&d, pic);
assert!(covers(&rects), "the light squares fill the picture");
let dark = verts.iter().filter(|c| **c == GRID_DARK).count();
diff --git a/docs/monitors.md b/docs/monitors.md
index a9db82af1..bb6e520ae 100644
--- a/docs/monitors.md
+++ b/docs/monitors.md
@@ -19,7 +19,7 @@ focused monitor (Program by default). Code: `crates/ui-egui/src/panels/monitor_v
| `view.showRulers`, `view.showGuides`, `view.lockGuides`, `view.clearGuides` | View | toggles take `{"enabled": bool}` |
| `view.addGuide` | View ▸ Add Guide… | dialog, or `{"orientation": "vertical\|horizontal", "position": px}` |
| `view.snapInProgramMonitor` | View ▸ Snap in Program Monitor | graphic moves snap to the frame edges / centre and the guides (6 pt) |
-| `view.transparencyGrid` | View ▸ Transparency Grid | a gray and white checkerboard (8 pt squares) behind the picture shows its transparent areas; off by default, each monitor keeps its own; takes `{"enabled": bool}`. The Program monitor renders on the CPU while the grid is on |
+| `view.transparencyGrid` | wrench menu ▸ Transparency Grid | a gray and white checkerboard (8 pt squares) behind the picture shows its transparent areas; off by default, each monitor keeps its own; takes `{"enabled": bool}`. The Program monitor renders on the CPU while the grid is on |
| `view.safeMargins` | Guide Templates ▸ Safe Margins | action- and title-safe boxes |
| `view.guideTemplates.save`, `.manage`, `.apply`, `.delete` | Guide Templates ▸ Save Guides as Template… / Manage Guides… | templates are stored in the user preferences (`guides.templates`) |