Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/ui-egui/src/dialogs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub struct Dialogs {
/// Map-local layer IDs require the dialog to retain its original project and map as well.
pub projection_map: Option<MapOwner>,
pub geometry: Option<crate::geometrycalc::Form>,
/// Publication Layout Wizard: what it has asked so far (#2850).
/// Layout Wizard: what it has asked so far (#2850).
pub publication: Option<crate::publicationwizard::Draft>,
pub repair: Option<crate::repairsource::Form>,
pub conflicts: Option<crate::conflictsui::Form>,
Expand Down
6 changes: 3 additions & 3 deletions crates/ui-egui/src/publicationwizard/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Publication Layout Wizard: `layout.publication` asked step by step (size, map, style, elements,
//! Layout Wizard: `layout.publication` asked step by step (size, map, style, elements,
//! placement, texts, sources and reference, accent), then made at once, as the New Layout ›
//! Publication Layout menu makes it (#2850).
mod accent;
Expand Down Expand Up @@ -546,7 +546,7 @@ pub fn show(app: &mut RustGisApp, ctx: &egui::Context) {
let screen = ctx.content_rect();
let width = crate::widgets::dialog_width(ctx, SIZE.x, frame);
let list = screen.width() >= LIST_FROM;
egui::Window::new(tl!("Publication Layout Wizard"))
egui::Window::new(tl!("Layout Wizard"))
.id(egui::Id::unique("publication_wizard"))
.frame(frame)
.open(&mut open)
Expand Down Expand Up @@ -860,7 +860,7 @@ mod tests {
}

fn window(h: &egui_kittest::Harness<'static, RustGisApp>) -> egui::Rect {
h.get_by_role_and_label(Role::Window, "Publication Layout Wizard").rect()
h.get_by_role_and_label(Role::Window, "Layout Wizard").rect()
}

/// Drags the window's bottom right corner `by` points.
Expand Down
2 changes: 1 addition & 1 deletion crates/ui-egui/src/publicationwizard/texts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ mod tests {
let long = "a long headline figure of sixty characters, or about as many".to_string();
d.figures = [(long.clone(), long.clone()), (long.clone(), long.clone()), (long.clone(), long)];
let mut h = harness_sized(app, egui::vec2(420.0, 360.0));
let window = |h: &Wizard| h.get_by_role_and_label(Role::Window, "Publication Layout Wizard").rect();
let window = |h: &Wizard| h.get_by_role_and_label(Role::Window, "Layout Wizard").rect();
let next = |h: &Wizard| h.get_by_role_and_label(Role::Button, "Next").rect();
let (size, at_next) = (window(&h).size(), next(&h));
h.state_mut().dialogs.publication.as_mut().unwrap().step = Step::Texts;
Expand Down
67 changes: 54 additions & 13 deletions crates/ui-egui/src/ribbon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1319,6 +1319,12 @@ fn project_group(app: &mut RustGisApp, ui: &mut Ui) {
group(ui, "Project", |ui| {
big(ui, app, "new_map", "New\nMap", "Add a new map to the project.", "map.new", Value::Null, false, false);
big_menu(ui, app, "new_layout", "New\nLayout", "Add a page layout for printing and exporting the map.", |ui, app| {
// A publication layout asked step by step: its size, style and texts too (#2850).
if ui.button(tl!("Layout Wizard…")).clicked() {
let _ = app.run("ui.dialog", json!({"name": "publicationWizard"}));
ui.close();
}
ui.separator();
for (id, label, w, h) in rustgis_engine::map::layout::PAGES {
if ui.button(page_label(label, *w, *h)).clicked() {
let _ = app.run("layout.new", json!({"page": id}));
Expand Down Expand Up @@ -1350,12 +1356,6 @@ fn project_group(app: &mut RustGisApp, ui: &mut Ui) {
ui.close();
}
}
// The same layout asked step by step: its texts and accent too (#2850).
ui.separator();
if ui.button(tl!("Publication Layout Wizard…")).clicked() {
let _ = app.run("ui.dialog", json!({"name": "publicationWizard"}));
ui.close();
}
});
ui.separator();
if ui.button(tl!("Blank Letter page")).clicked() {
Expand Down Expand Up @@ -2800,16 +2800,34 @@ fn extension_groups(app: &mut RustGisApp, ui: &mut Ui, id: &str) {
}
}

/// The Publish tab: the open layout's groups first, then reports, presentations, export and
/// sharing.
/// The Publish tab: the open layout's groups first, then the Layout Wizard, reports,
/// presentations, export and sharing.
fn publish_tab(app: &mut RustGisApp, ui: &mut Ui) {
layout_groups(app, ui);
new_publication_group(app, ui);
report_group(app, ui);
presentation_group(app, ui);
share_groups(app, ui);
thumbnail_group(app, ui);
}

/// The Layout Wizard, ahead of the reports so it is in reach without scrolling (#3115).
fn new_publication_group(app: &mut RustGisApp, ui: &mut Ui) {
group(ui, "New", |ui| {
big(
ui,
app,
"new_layout",
"Layout\nWizard…",
"Make a publication sheet or figure of the map view, asked step by step.",
"ui.dialog",
json!({"name": "publicationWizard"}),
false,
false,
);
});
}

/// The layer selected in Layers.
fn active_layer(app: &RustGisApp) -> Option<&rustgis_engine::map::Layer> {
app.session.active_layer.and_then(|id| app.session.map().layer(id))
Expand Down Expand Up @@ -7080,10 +7098,11 @@ mod tests {
assert!(l.elements.iter().all(|e| e.name != "Panel Box" && e.name != "Title"), "a figure, its title left to the caption");
}

/// New Layout › Publication Layout › Publication Layout Wizard… opens the wizard and closes
/// the menu, with nothing made yet (#2850).
/// New Layout › Layout Wizard…, the menu's first row (#3115) and no longer in the
/// Publication Layout submenu, opens the wizard and closes the menu, with nothing made yet
/// (#2850).
#[test]
fn the_publication_menu_opens_the_wizard() {
fn the_new_layout_menu_opens_the_wizard() {
let mut fonts = false;
let mut h = egui_kittest::Harness::builder().with_size(vec2(1600.0, 1000.0)).build_ui_state(
move |ui, app: &mut RustGisApp| {
Expand All @@ -7102,12 +7121,34 @@ mod tests {
h.run();
h.get_by_label("Publication Layout").hover();
h.run();
h.get_by_label("Publication Layout Wizard…").click();
// One row, the submenu open or not, above the first page size.
let wizard = h.get_by_label("Layout Wizard…").rect();
let (_, first, w, height) = rustgis_engine::map::layout::PAGES[0];
let page = h.query_all_by_label(&page_label(first, w, height)).next().expect("the page sizes").rect();
assert!(wizard.max.y <= page.min.y, "the wizard at {wizard:?}, the first page size at {page:?}");
h.get_by_label("Layout Wizard…").click();
h.run();
assert_eq!(h.state().dialogs.open, Some("publicationWizard"));
assert!(h.state().dialogs.publication.is_some());
assert_eq!(h.state().session.project.layouts.len(), before, "nothing made yet");
assert!(h.query_by_label("Layout Wizard…").is_none(), "the menu closed");
}

/// Publish › New › Layout Wizard… comes before the reports, so it needs no scrolling with no
/// layout open, and opens the wizard, with nothing made yet (#3115).
#[test]
fn the_publish_tab_opens_the_wizard() {
let mut h = tab_harness(cities(), publish_tab);
let before = h.state().session.project.layouts.len();
let wizard = h.get_by_label("Layout Wizard…").rect();
let report = h.get_by_label("New Report").rect();
assert!(wizard.max.x <= report.min.x, "the wizard at {wizard:?}, New Report at {report:?}");
assert!(wizard.max.x <= 1366.0, "the wizard at {wizard:?}, past a 1366 px window");
h.get_by_label("Layout Wizard…").click();
h.run();
assert_eq!(h.state().dialogs.open, Some("publicationWizard"));
assert!(h.state().dialogs.publication.is_some());
assert_eq!(h.state().session.project.layouts.len(), before, "nothing made yet");
assert!(h.query_by_label("Publication Layout Wizard…").is_none(), "the menu closed");
}

/// A submenu of short rows (a sheet's styles) opens at least SUBMENU_MIN_W wide, not as a
Expand Down
3 changes: 2 additions & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ sample again. **Settings › Start-up › Start With** chooses what opens next t
adds a web tile layer, and its **Celestial Bodies** take the map to the Moon or Mars.
Right-drag (or ++ctrl++-drag) turns and tilts the map; click the north arrow to reset it.
6. **Share.** **Publish › Export Map** saves a PNG with labels and a scale bar. **Home › New
Layout** offers page sizes and **Publication Layout** presets for sheets (in one of seven styles) and figures.
Layout** offers page sizes and **Publication Layout** presets for sheets (in one of seven styles) and figures;
its **Layout Wizard…**, also on **Publish › New**, builds one step by step.
Choose a page size for a page with a map frame, legend, north arrow and scale bar.
**Project › Save As** writes a `.rgis` project.

Expand Down
3 changes: 2 additions & 1 deletion docs/user-guide/layouts.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ Layouts open as tabs next to the maps; while one is open, its groups lead the Pu
thesis (160 × 225 or 160 × 110 mm): the map edge to edge with a line of its projection and
datum under it, at 7 pt. A figure's title and sources belong in its caption, so they are
left out, and the result says so.
- **Step by step**: **Publication Layout Wizard…**, at the end of the same menu, asks for the size
- **Step by step**: **Layout Wizard…**, first in Home › New Layout and on Publish › New,
asks for the size
(a sheet turned Auto, Portrait or Landscape, or a figure), the map extent and the layout's name,
the style (each beside an outline of where its title, map and footer go, and its column or panel
if it has one, with the accent colour picked, or else its own, where the sheet takes it, which
Expand Down
Loading