feat(view): one list of visual styles behind every way of choosing one

The ribbon offered four styles and dispatched each one's id as a command.
Two of those ids were not visual-style commands: "Shaded" carried SOLID,
which draws a 2D filled polygon, so choosing it started a draw command;
"Hidden" carried HIDDEN, which matched nothing at all, so it did nothing.
The intent had been for the button to fire its tool's event, but the
dropdown never reads one -- it dispatches the id.

Behind that sat two generations of the same feature. The render-mode
picker offered the seven styles a viewport can actually be drawn in;
everything else -- the ribbon, VSCURRENT, SHADEMODE, VISUALSTYLES and a
handful of bare verbs -- went through a binary wireframe-or-shaded flag
that could only approximate them, reporting "Hidden (shown shaded)" and
"X-Ray (shown as wireframe)" when asked for something it had no way to
draw. Four descriptions of one choice, each drifting on its own.

There is one list now. Each style names itself once -- mode, label, icon,
and the command that applies it -- and the ribbon, the picker, the
VISUALSTYLES verb and the interactive prompt all read from it, down to
the line that lists the choices, so what is offered cannot disagree with
what works. Keywords are the render modes' own names, since there is one
set of styles left to name.

The binary path is gone rather than kept alongside: its message, its
module event, the tool definitions that produced it, the ribbon's
special-cased highlight arms, the bare style verbs and the older keyword
spellings. X-Ray goes with it -- no render mode draws one, and it was
already coming out as a plain wireframe. Three files that had been left
holding a single icon constant each fold into the list.

Note: ModuleEvent::SetWireframe leaves the plugin API with it.

Closes #621

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 5 committed 2026-08-07 14:15:59 +03:00
1 parent 5c5c7606a1
commit b5a1146966
18 files changed
+170 -187

No files matched your search

+7 -12
View File
@@ -2,7 +2,6 @@
mod cascade;
mod file_tabs;
mod hidden;
mod layout_tabs;
pub mod limits;
mod orbit;
@@ -13,9 +12,9 @@ pub mod plot_window;
pub mod quick_print;
mod properties_palette;
mod sheetset;
mod solid;
mod tile_horiz;
mod tile_vert;
pub mod visual_style;
mod tool_palettes;
pub mod ucs_cmd;
mod ucs_icon;
@@ -28,8 +27,6 @@ mod vports_config;
mod vports_join;
mod vports_named;
mod vports_restore;
mod wireframe;
mod xray;
mod zoom_ext;
mod zoom_in;
mod zoom_out;
@@ -89,14 +86,12 @@ impl CadModule for ViewModule {
tools: vec![RibbonItem::LargeDropdown {
id: "VISUAL_STYLE",
label: "Visual\nStyle",
icon: wireframe::tool().icon,
items: vec![
("WIREFRAME", "Wireframe", wireframe::tool().icon),
("SOLID", "Shaded", solid::tool().icon),
("HIDDEN", "Hidden", hidden::tool().icon),
("XRAY", "X-Ray", xray::tool().icon),
],
default: "WIREFRAME",
icon: visual_style::VISUAL_STYLES[0].icon,
items: visual_style::VISUAL_STYLES
.iter()
.map(|style| (style.command, style.label, style.icon))
.collect(),
default: visual_style::VISUAL_STYLES[0].command,
}],
},
// ── Projection ────────────────────────────────────────────────────