feat(layout): copy a layout from its tab menu (#1822)

The layout tab's right-click menu gains New Layout, Copy, Page Setup
and Plot beside Rename and Delete. Copy makes "<name> (2)" with the
source's page setup, sheet view and every paper-space object,
viewports included, and opens it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-10-16 01:08:07 +03:00
1 parent 38d81bf838
commit 0126ea212f
28 files changed
+172 -16

No files matched your search

+18 -16
View File
@@ -937,23 +937,25 @@ fn osnap_btn<'a>(
// ── Helpers ───────────────────────────────────────────────────────────────
fn layout_tab_context_menu(name: String) -> Element<'static, Message> {
let rename = mouse_area(
container(text(t!("Rename")).size(12))
.padding([4, 12])
.width(Length::Fill),
)
.on_press(Message::LayoutRenameStart(name.clone()))
.interaction(iced::mouse::Interaction::Pointer);
let item = |label: std::borrow::Cow<'static, str>, message: Message| {
mouse_area(
container(text(label).size(12))
.padding([4, 12])
.width(Length::Fill),
)
.on_press(message)
.interaction(iced::mouse::Interaction::Pointer)
};
let items = column![
item(t!("New Layout"), Message::LayoutCreate),
item(t!("Copy"), Message::LayoutCopy(name.clone())),
item(t!("Rename"), Message::LayoutRenameStart(name.clone())),
item(t!("Delete"), Message::LayoutDelete(name.clone())),
item(t!("Page Setup"), Message::LayoutPageSetup(name.clone())),
item(t!("Plot"), Message::LayoutPlot(name)),
];
let delete = mouse_area(
container(text(t!("Delete")).size(12))
.padding([4, 12])
.width(Length::Fill),
)
.on_press(Message::LayoutDelete(name))
.interaction(iced::mouse::Interaction::Pointer);
container(column![rename, delete].spacing(0).width(160))
container(items.spacing(0).width(160))
.style(container::bordered_box)
.padding([4, 0])
.into()