feat(alias): centralize command aliases in user-editable ocad.pgp (#286/#288)

Command aliases (L→LINE, CC→COPYCLIP) were scattered across dispatch match
arms and CommandRegistration name arrays. Move them all into a single
user-editable file:

- assets/ocad.pgp: shipped default alias table (ALIAS,*COMMAND format),
  embedded and copied to config/ocad.pgp on first launch; only that user
  copy is read after. AA→AREA default closes #286.
- resolve_alias() rewrites the leading command token at the top of
  dispatch_command_inner, so aliases resolve for every path (families,
  plugins, Repeat menu). Args after the first space are untouched.
- Autocomplete hides alias keys and, when the whole input is an alias,
  surfaces its target command as the top (highlighted) suggestion so the
  highlight matches what Enter runs (AA→AREA, L→LINE).
- ALIASEDIT opens a new editor modal (add/edit/delete rows) with an Apply
  button; Apply persists to ocad.pgp, closing discards unapplied edits.
- Strip alias tokens from all 8 dispatch match-arm files and 71 module
  CommandRegistration arrays, keeping canonical/synonym/distinct-command
  names. ocad.pgp is now the sole source: deleting or remapping an alias
  there takes effect. CUI stays on the keyboard-shortcut panel.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-07-10 12:39:22 +03:00
commit 91ba9f7699
69 changed files with 767 additions and 164 deletions

View file

@ -5,7 +5,7 @@ impl OpenCADStudio {
match cmd {
// Interactive pan: left-drag pans the view until Esc. The only pan
// path when there is no middle mouse button (trackpad / web).
"PAN" | "P" => {
"PAN" => {
self.tabs[i].pan_mode = true;
self.command_line
.push_output("PAN: drag with the left mouse button. Press Esc to exit.");
@ -126,7 +126,7 @@ impl OpenCADStudio {
}
// ── PROPERTIES — toggle Properties panel visibility ──────────────────
"PROPERTIES" | "PR" | "PROPS" => {
"PROPERTIES" | "PROPS" => {
return Some(Task::done(Message::ToggleProperties));
}
@ -160,7 +160,7 @@ impl OpenCADStudio {
return Some(Task::done(Message::ToggleSnapPopup));
}
// UNITS — open the drawing-units picker (linear / angular format).
"UNITS" | "UN" | "DDUNITS" => {
"UNITS" | "DDUNITS" => {
return Some(Task::done(Message::ToggleUnitsPopup));
}
@ -174,13 +174,13 @@ impl OpenCADStudio {
}
// ── TOOLPALETTES — not yet implemented ───────────────────────────────
"TOOLPALETTES" | "TP" => {
"TOOLPALETTES" => {
self.command_line
.push_info("TOOLPALETTES: Tool Palettes not yet implemented.");
}
// ── SHEETSET — not yet implemented ───────────────────────────────────
"SHEETSET" | "SSM" => {
"SHEETSET" => {
self.command_line
.push_info("SHEETSET: Sheet Set Manager not yet implemented.");
}
@ -292,7 +292,7 @@ impl OpenCADStudio {
// PRESSPULL on a closed boundary creates a solid by extruding it to a
// height — the same operation as EXTRUDE. THICKEN turns a closed planar
// profile into a solid of the given thickness, which is also an extrude.
"EXTRUDE" | "EXT" | "PRESSPULL" | "THICKEN" => {
"EXTRUDE" | "PRESSPULL" | "THICKEN" => {
use crate::modules::insert::solid3d_cmds::ExtrudeCommand;
// If a single entity is already selected, skip the pick step.
let selected: Vec<_> = self.tabs[i].scene.selected_entities().into_iter().collect();
@ -311,7 +311,7 @@ impl OpenCADStudio {
}
// ── REVOLVE ────────────────────────────────────────────────────
"REVOLVE" | "REV" => {
"REVOLVE" => {
use crate::modules::insert::solid3d_cmds::RevolveCommand;
let color = self.tabs[i].scene.layer_color(&self.tabs[i].active_layer);
let cmd = RevolveCommand::new(color);