forked from 1b-agent/opencadstudio-upstream
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 <[email protected]>
This commit is contained in:
1 parent
5c5c7606a1
commit
b5a1146966
18 files changed
+170
-187
No files matched your search
@@ -321,7 +321,6 @@ impl Ribbon {
|
||||
fn toggle_state(&self) -> widgets::ToggleState {
|
||||
use widgets::ToggleState;
|
||||
ToggleState {
|
||||
wireframe: self.wireframe,
|
||||
ortho_mode: self.ortho_mode,
|
||||
show_viewcube: self.show_viewcube,
|
||||
show_ucs_icon: self.show_ucs_icon,
|
||||
|
||||
@@ -33,7 +33,6 @@ use super::LayerInfo;
|
||||
/// and call site.
|
||||
#[derive(Clone, Copy)]
|
||||
pub(super) struct ToggleState {
|
||||
pub wireframe: bool,
|
||||
pub ortho_mode: bool,
|
||||
pub show_viewcube: bool,
|
||||
pub show_ucs_icon: bool,
|
||||
@@ -355,8 +354,6 @@ pub(super) fn is_active_tool(
|
||||
state: &ToggleState,
|
||||
) -> bool {
|
||||
match id {
|
||||
"WIREFRAME" => state.wireframe,
|
||||
"SOLID" => !state.wireframe,
|
||||
"ORTHO" => state.ortho_mode,
|
||||
"PERSP" => !state.ortho_mode,
|
||||
"NAVVCUBE" => state.show_viewcube,
|
||||
@@ -1125,7 +1122,6 @@ pub fn module_event_to_message(event: ModuleEvent) -> Message {
|
||||
ModuleEvent::Command(cmd) => Message::Command(cmd),
|
||||
ModuleEvent::OpenFileDialog => Message::OpenFile,
|
||||
ModuleEvent::ClearModels => Message::ClearScene,
|
||||
ModuleEvent::SetWireframe(w) => Message::SetWireframe(w),
|
||||
ModuleEvent::ToggleLayers => Message::ToggleLayers,
|
||||
// Needs the tool context + async picker — route through the normal
|
||||
// ribbon-click handler rather than a direct 1:1 message.
|
||||
|
||||
Reference in new issue
Block a user