Files
OneCAD-Draft/src/modules/manage/mod.rs
T
PanosandClaude Opus 5 b1d2ac2744 Give the Options dialog a tab rail that can hold more pages
The dialog laid its pages out as a row of buttons across the top, which is
what AutoCAD does and what fits while there are four of them. The pages this
series adds take it to nine, and the names are translated into 21 languages —
a row of nine German or Russian page names does not fit at any dialog width
worth having.

The rail is now a vertical list down the left, the dialog is 880×620 rather
than 540×560, and the content pane scrolls on its own.

Which page was open is now remembered. With four pages, reopening on General
was a shrug; with nine it means hunting for the one you were last in.

The ribbon's Options tool has existed all along — `ToolDef`, icon and all —
but was marked `#[allow(dead_code)]` and never added to a group, so the
dialog could only be reached by typing OPTIONS or from the start page. It
now sits in Manage ▸ Application, beside About.

No settings change in this commit; it is only the shell the rest needs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 08:18:23 +03:00

94 lines
4.0 KiB
Rust

// Manage module — customization and drawing cleanup tools.
mod about;
mod audit;
mod cui_export;
mod cui_import;
mod find_nonpurgeable;
mod options;
mod overkill;
mod purge;
mod user_interface;
use crate::modules::{CadModule, IconKind, RibbonGroup, RibbonItem};
pub struct ManageModule;
impl CadModule for ManageModule {
fn id(&self) -> &'static str {
"manage"
}
fn title(&self) -> &'static str {
"Manage"
}
fn ribbon_groups(&self) -> &[RibbonGroup] {
static GROUPS: std::sync::OnceLock<Vec<RibbonGroup>> = std::sync::OnceLock::new();
GROUPS.get_or_init(|| {
vec![
// ── Customization ─────────────────────────────────────────────────
RibbonGroup {
title: "Customization",
tools: vec![
RibbonItem::LargeTool(user_interface::tool()),
RibbonItem::LargeTool(crate::modules::ToolDef {
id: "TOOLPALETTES",
label: "Tool\nPalettes",
icon: IconKind::Svg(include_bytes!(
"../../../assets/icons/tool_palettes.svg"
)),
event: crate::modules::ModuleEvent::Command("TOOLPALETTES".to_string()),
}),
RibbonItem::Tool(cui_import::tool()),
RibbonItem::Tool(cui_export::tool()),
RibbonItem::Dropdown {
id: "ALIASEDIT_DROPDOWN",
icon: IconKind::Svg(include_bytes!(
"../../../assets/icons/edit_aliases.svg"
)),
items: vec![
(
"ALIASEDIT",
"Edit Aliases",
IconKind::Svg(include_bytes!(
"../../../assets/icons/edit_aliases.svg"
)),
),
(
"CUILOAD",
"Load Partial CUI",
IconKind::Svg(include_bytes!(
"../../../assets/icons/cui_import.svg"
)),
),
],
default: "ALIASEDIT",
},
],
},
// ── Cleanup ───────────────────────────────────────────────────────
RibbonGroup {
title: "Cleanup",
tools: vec![
RibbonItem::LargeTool(find_nonpurgeable::tool()),
RibbonItem::Tool(purge::tool()),
RibbonItem::Tool(overkill::tool()),
RibbonItem::Tool(audit::tool()),
],
},
// ── Application ───────────────────────────────────────────────────
RibbonGroup {
title: "Application",
tools: vec![
// The tool and its icon already existed but were never
// added to a group, so the dialog could only be reached
// by typing OPTIONS or from the start page.
RibbonItem::LargeTool(options::tool()),
RibbonItem::LargeTool(about::tool()),
],
},
]
})
}
}