mirror of
https://github.com/storytold/designcraft.git
synced 2026-10-30 13:16:56 -06:00
Chris Nielsen's "The Adobe InDesign Toolbox" (InDesign 2020) walks the Tools panel in one and two columns. Compared with it: - Gradient Swatch and Gradient Feather are separate tools (one flyout here before). - In two columns InDesign lays out Content Collector and Content Placer, Apply Color / Apply Gradient / Apply None and Normal / Preview (with Bleed, Slug, Presentation in its flyout) side by side (SPLIT_IN_TWO_COLUMNS). One column keeps one well with a flyout, which now names what is in front (Apply Color, Apply Gradient or Apply None). - The utility button is View Options: Frame Edges, Rulers, Guides, Smart Guides, Baseline Grid and Hidden Characters, checked when shown, with their shortcuts (17:40). It was Text Frame Options (Object › Text Frame Options…, ⌘B, still opens it). - Apply Color (,) applies the colour applied last ([Black] at first) and Apply Gradient (.) the gradient applied last, else the document's first, else white to black (InDesign's default), to the fill or stroke in front. The flyout had Apply Color as [Black] and no Apply Gradient. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
93 lines
3.9 KiB
Rust
93 lines
3.9 KiB
Rust
//! The tool catalogue: ids, labels, shortcuts and Tools-panel groups (InDesign's order).
|
|
|
|
use serde::Serialize;
|
|
|
|
#[derive(Clone, Copy, Debug, Serialize)]
|
|
pub struct ToolInfo {
|
|
pub id: &'static str,
|
|
pub label: &'static str,
|
|
pub shortcut: Option<&'static str>,
|
|
pub icon: &'static str,
|
|
}
|
|
|
|
const fn t(id: &'static str, label: &'static str, shortcut: Option<&'static str>, icon: &'static str) -> ToolInfo {
|
|
ToolInfo { id, label, shortcut, icon }
|
|
}
|
|
|
|
/// Tools-panel groups in order (the first tool of each group shows by default). A `None` group
|
|
/// marks a separator.
|
|
///
|
|
/// In two columns InDesign lays some groups out tool by tool (Content Collector and Content
|
|
/// Placer side by side): see [`SPLIT_IN_TWO_COLUMNS`].
|
|
pub const TOOL_GROUPS: &[&[ToolInfo]] = &[
|
|
&[t("selection", "Selection Tool", Some("V"), "tool-selection")],
|
|
&[t("directSelection", "Direct Selection Tool", Some("A"), "tool-direct")],
|
|
&[t("page", "Page Tool", Some("Shift+P"), "tool-page")],
|
|
&[t("gap", "Gap Tool", Some("U"), "tool-gap")],
|
|
&[
|
|
t("contentCollector", "Content Collector Tool", Some("B"), "tool-collector"),
|
|
t("contentPlacer", "Content Placer Tool", Some("B"), "tool-placer"),
|
|
],
|
|
&[],
|
|
&[
|
|
t("type", "Type Tool", Some("T"), "tool-type"),
|
|
t("typeOnPath", "Type on a Path Tool", Some("Shift+T"), "tool-type-path"),
|
|
t("verticalType", "Vertical Type Tool", None, "tool-type-vertical"),
|
|
t("verticalTypeOnPath", "Vertical Type on a Path Tool", None, "tool-type-path"),
|
|
],
|
|
&[t("line", "Line Tool", Some("\\"), "tool-line")],
|
|
&[
|
|
t("pen", "Pen Tool", Some("P"), "tool-pen"),
|
|
t("addAnchor", "Add Anchor Point Tool", Some("="), "tool-pen-add"),
|
|
t("deleteAnchor", "Delete Anchor Point Tool", Some("-"), "tool-pen-delete"),
|
|
t("convertDirection", "Convert Direction Point Tool", Some("Shift+C"), "tool-anchor"),
|
|
],
|
|
&[
|
|
t("pencil", "Pencil Tool", Some("N"), "tool-pencil"),
|
|
t("smooth", "Smooth Tool", None, "tool-smooth"),
|
|
t("erase", "Erase Tool", None, "tool-erase"),
|
|
],
|
|
&[
|
|
t("rectangleFrame", "Rectangle Frame Tool", Some("F"), "tool-rect-frame"),
|
|
t("ellipseFrame", "Ellipse Frame Tool", None, "tool-ellipse-frame"),
|
|
t("polygonFrame", "Polygon Frame Tool", None, "tool-polygon-frame"),
|
|
],
|
|
&[
|
|
t("rectangle", "Rectangle Tool", Some("M"), "tool-rect"),
|
|
t("ellipse", "Ellipse Tool", Some("L"), "tool-ellipse"),
|
|
t("polygon", "Polygon Tool", None, "tool-polygon"),
|
|
],
|
|
&[],
|
|
&[t("scissors", "Scissors Tool", Some("C"), "tool-scissors")],
|
|
&[
|
|
t("freeTransform", "Free Transform Tool", Some("E"), "tool-free-transform"),
|
|
t("rotate", "Rotate Tool", Some("R"), "tool-rotate"),
|
|
t("scale", "Scale Tool", Some("S"), "tool-scale"),
|
|
t("shear", "Shear Tool", Some("O"), "tool-shear"),
|
|
],
|
|
&[t("gradientSwatch", "Gradient Swatch Tool", Some("G"), "tool-gradient")],
|
|
&[t("gradientFeather", "Gradient Feather Tool", Some("Shift+G"), "tool-gradient-feather")],
|
|
&[],
|
|
&[t("note", "Note Tool", None, "tool-note")],
|
|
&[
|
|
t("colorTheme", "Color Theme Tool", Some("Shift+I"), "tool-color-theme"),
|
|
t("eyedropper", "Eyedropper Tool", Some("I"), "tool-eyedropper"),
|
|
t("measure", "Measure Tool", Some("K"), "tool-measure"),
|
|
],
|
|
&[t("hand", "Hand Tool", Some("H"), "tool-hand")],
|
|
&[t("zoom", "Zoom Tool", Some("Z"), "tool-zoom")],
|
|
];
|
|
|
|
/// Groups (by their first tool) whose tools get a button each when the Tools panel has two
|
|
/// columns, as InDesign's does.
|
|
pub const SPLIT_IN_TWO_COLUMNS: &[&str] = &["contentCollector"];
|
|
|
|
pub fn tool_info(id: &str) -> Option<ToolInfo> {
|
|
TOOL_GROUPS.iter().flat_map(|g| g.iter()).find(|t| t.id == id).copied()
|
|
}
|
|
|
|
/// Tool for a single-key shortcut (`"T"`, `"Shift+P"`).
|
|
pub fn tool_for_shortcut(key: &str) -> Option<&'static str> {
|
|
TOOL_GROUPS.iter().flat_map(|g| g.iter()).find(|t| t.shortcut == Some(key)).map(|t| t.id)
|
|
}
|