mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-27 19:27:21 -06:00
No behaviour change: every command keeps its id, label, menu, shortcut and params doc. - Engine: swatch.* -> cmd/swatch.rs, graphicStyle.* -> cmd/style.rs, appearance.* (incl. copyFrom) -> cmd/appearance.rs, stroke.set/setAdvanced -> cmd/stroke.rs, paint.editGradient/setGradientGeom -> cmd/gradient.rs. Shared helpers in cmd/mod.rs: leaf_targets/paint_targets (replacing three copies) and unique_name (swatch and graphic style naming). - UI: dialogs.rs -> dialogs/ with one file per dialog and a DialogSpec registry (one DialogKind row per dialog); shared field widgets in dialogs/form.rs. Headless frame tests draw and confirm every dialog. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
23 lines
743 B
Rust
23 lines
743 B
Rust
//! The All Tools drawer: every tool as a button; picking one selects it and closes the drawer.
|
|
|
|
use super::DialogSpec;
|
|
use crate::VectorcraftApp;
|
|
use crate::state::Dialog;
|
|
|
|
pub(super) const SPEC: DialogSpec = DialogSpec { heading: |_| "All Tools".into(), body, ok: None, ..DialogSpec::FORM };
|
|
|
|
fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, _: &mut Dialog) -> bool {
|
|
let mut picked = false;
|
|
for g in vectorcraft_tools::TOOL_GROUPS {
|
|
ui.horizontal_wrapped(|ui| {
|
|
for tool in g.iter() {
|
|
if ui.button(tool.label.trim_end_matches(" Tool")).clicked() {
|
|
app.select_tool(tool.id);
|
|
picked = true;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
picked
|
|
}
|