From 6167159bde89b25781e3e21b9d3c3840b4a3d5c4 Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Sat, 14 Nov 2026 16:45:53 +0100 Subject: [PATCH] Move Menu beside Project in the viewport toolbar --- crates/midra-layout/src/gui.rs | 33 +++++++++++++++------------------ docs/midralayout/changelog.md | 2 ++ 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/crates/midra-layout/src/gui.rs b/crates/midra-layout/src/gui.rs index 5f584d1..3cde6de 100644 --- a/crates/midra-layout/src/gui.rs +++ b/crates/midra-layout/src/gui.rs @@ -2381,6 +2381,15 @@ impl Editor { )); }, ); + ui.scope_builder( + egui::UiBuilder::new() + .max_rect(button(15)) + .layout(egui::Layout::left_to_right(egui::Align::Center)), + |ui| { + ui.spacing_mut().interact_size.y = 32.0; + toolbar_menu(ui, "Menu", |ui| self.application_menu(ui)); + }, + ); ui.scope_builder( egui::UiBuilder::new() .max_rect(button(0)) @@ -3240,18 +3249,6 @@ impl Editor { ink.text(24.0, 11.0, "MIDRA / LAYOUT", 18.0, palette.text); ink.line([206.0, 13.0], [206.0, 31.0], palette.line); ink.text(222.0, 15.0, "Layer positioning helper", 13.0, palette.muted); - ui.scope_builder( - egui::UiBuilder::new() - .max_rect(Rect::from_min_size( - ink.point(420.0, 7.0), - Vec2::new(80.0, 30.0), - )) - .layout(egui::Layout::left_to_right(egui::Align::Center)), - |ui| { - ui.spacing_mut().interact_size.y = 30.0; - ui.menu_button("Menu", |ui| self.application_menu(ui)); - }, - ); ink.text(r.width() - 347.0, 15.0, "EIKOS 4K", 12.0, palette.cyan); ink.button(r.width() - 212.0, 5.0, 188.0, "Copy coordinates", false); if click( @@ -3486,14 +3483,14 @@ enum ToolbarIcon { } // Keep related tools together when wrapping; reserve caption space per group. -fn toolbar_groups(width: f32, captions: bool) -> ([Rect; 15], Vec, f32) { - let mut buttons = [Rect::NOTHING; 15]; +fn toolbar_groups(width: f32, captions: bool) -> ([Rect; 16], Vec, f32) { + let mut buttons = [Rect::NOTHING; 16]; let mut groups = Vec::new(); let mut x = 24.0; let mut y = 20.0; let height = if captions { 58.0 } else { 36.0 }; for slots in [ - &[0, 1][..], + &[15, 0, 1][..], &[2, 3], &[4, 5], &[6, 7, 8, 9], @@ -3501,7 +3498,7 @@ fn toolbar_groups(width: f32, captions: bool) -> ([Rect; 15], Vec, f32) { &[13, 14], ] { let cell_width = |slot| match slot { - 0 => 68.0, + 0 | 15 => 68.0, 11 => 56.0, 8 | 9 if captions => 80.0, _ if captions => 56.0, @@ -3521,7 +3518,7 @@ fn toolbar_groups(width: f32, captions: bool) -> ([Rect; 15], Vec, f32) { for &slot in slots { let cell = cell_width(slot); let button_width = match slot { - 0 => 64.0, + 0 | 15 => 64.0, 11 => 52.0, 1 | 10 | 14 => 40.0, _ => 32.0, @@ -4488,7 +4485,7 @@ mod tests { assert!(buttons[..i].iter().all(|other| !other.intersects(*button))); } for slots in [ - &[0, 1][..], + &[15, 0, 1][..], &[2, 3], &[4, 5], &[6, 7, 8, 9], diff --git a/docs/midralayout/changelog.md b/docs/midralayout/changelog.md index e7fea35..8075403 100644 --- a/docs/midralayout/changelog.md +++ b/docs/midralayout/changelog.md @@ -4,6 +4,8 @@ ## Unreleased +- Move Menu from the title header to the toolbar immediately before Project, within the same wrapping group. + - Place Load before Send in the status bar. - Align status-bar connection, mapping, send/load and scope controls in one vertically centered row with consistent spacing and button heights; let labels determine positions instead of fixed offsets.