forked from 1b-agent/opencadstudio-upstream
feat(ui): classic pull-down menu bar and ribbon toggle
MENUBAR 1 shows File, Edit, View, Insert, Format, Tools, Draw, Dimension, Modify, Parametric and Help menus above the ribbon; every entry runs an existing command, and a test keeps each entry pointing at a registered command. RIBBONCLOSE hides the ribbon and RIBBON brings it back, so the menus can replace it. Both choices persist. Also translates the "File" label, which every locale had left in English. Refs #1450 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
9724447dd0
commit
ee18f7ad3c
32 files changed
+1113
-19
No files matched your search
@@ -618,6 +618,11 @@ impl OpenCADStudio {
|
||||
"CLEANSCREEN" => {
|
||||
return Some(Task::done(Message::ToggleCleanScreen));
|
||||
}
|
||||
// ── RIBBON / RIBBONCLOSE — show or hide the ribbon ───────────────────
|
||||
"RIBBON" | "RIBBONCLOSE" => {
|
||||
self.ribbon_closed = cmd == "RIBBONCLOSE";
|
||||
self.persist_settings_if_changed();
|
||||
}
|
||||
// ── QUICKPROPERTIES — toggle the floating quick-properties readout ───
|
||||
"QUICKPROPERTIES" => {
|
||||
return Some(Task::done(Message::ToggleQuickProperties));
|
||||
|
||||
@@ -755,6 +755,9 @@ inventory::submit!(crate::command::CommandRegistration {
|
||||
"CLIPROMPTLINES",
|
||||
"COMMANDLINEFADETIME",
|
||||
"COMMANDLINEOPACITY",
|
||||
"MENUBAR",
|
||||
"RIBBON",
|
||||
"RIBBONCLOSE",
|
||||
"COLORTHEME",
|
||||
"SELECTIONAREA",
|
||||
"SELECTIONAREAOPACITY",
|
||||
|
||||
@@ -1150,6 +1150,7 @@ impl OpenCADStudio {
|
||||
| "PICKBOX"
|
||||
| "HPASSOC"
|
||||
| "COMMANDLINEOPACITY"
|
||||
| "MENUBAR"
|
||||
| "CURSORTYPE"
|
||||
| "SNAPANG"
|
||||
| "TEXTFILL"
|
||||
@@ -2190,6 +2191,17 @@ impl OpenCADStudio {
|
||||
},
|
||||
None => Ok((format!("PICKBOX = {}", self.pick_box), false)),
|
||||
},
|
||||
"MENUBAR" => match value.as_deref() {
|
||||
Some(v @ ("0" | "1")) => {
|
||||
self.show_menu_bar = v == "1";
|
||||
Ok((format!("MENUBAR = {v}"), true))
|
||||
}
|
||||
Some(_) => Err("SETVAR: 0 or 1 required.".into()),
|
||||
None => Ok((
|
||||
format!("MENUBAR = {}", u8::from(self.show_menu_bar)),
|
||||
false,
|
||||
)),
|
||||
},
|
||||
"HPASSOC" => match value.as_deref() {
|
||||
Some(v @ ("0" | "1")) => {
|
||||
self.hatch_associative = v == "1";
|
||||
@@ -3165,6 +3177,7 @@ impl OpenCADStudio {
|
||||
| "PICKBOX"
|
||||
| "HPASSOC"
|
||||
| "COMMANDLINEOPACITY"
|
||||
| "MENUBAR"
|
||||
| "CURSORTYPE"
|
||||
| "SNAPANG"
|
||||
| "CLIPROMPTLINES"
|
||||
|
||||
@@ -642,6 +642,10 @@ pub(super) struct OpenCADStudio {
|
||||
pick_box: i32,
|
||||
/// HPASSOC: new hatches follow their boundary objects.
|
||||
hatch_associative: bool,
|
||||
/// MENUBAR: the classic pull-down menus show above the ribbon.
|
||||
show_menu_bar: bool,
|
||||
/// RIBBONCLOSE hid the ribbon; RIBBON brings it back.
|
||||
ribbon_closed: bool,
|
||||
/// Use REFEDIT rather than BEDIT when double-clicking an attribute-free block.
|
||||
double_click_block_refedit: bool,
|
||||
/// Open ATTEDIT when double-clicking a block with attributes.
|
||||
@@ -4543,6 +4547,8 @@ impl OpenCADStudio {
|
||||
cursor_size: 5,
|
||||
pick_box: 3,
|
||||
hatch_associative: true,
|
||||
show_menu_bar: false,
|
||||
ribbon_closed: false,
|
||||
double_click_block_refedit: false,
|
||||
double_click_block_attedit: true,
|
||||
right_click_mode: settings::RightClickMode::ShortcutMenu,
|
||||
|
||||
@@ -400,6 +400,10 @@ pub struct UserSettings {
|
||||
pub pick_box: i32,
|
||||
/// HPASSOC: new hatches follow their boundary objects.
|
||||
pub hatch_associative: bool,
|
||||
/// MENUBAR: the classic pull-down menus show above the ribbon.
|
||||
pub show_menu_bar: bool,
|
||||
/// RIBBONCLOSE hid the ribbon; RIBBON brings it back.
|
||||
pub ribbon_closed: bool,
|
||||
/// When true, double-clicking a block reference starts REFEDIT instead of BEDIT.
|
||||
pub double_click_block_refedit: bool,
|
||||
/// When true, double-clicking a block with attributes opens ATTEDIT.
|
||||
@@ -834,6 +838,8 @@ impl Default for UserSettings {
|
||||
cursor_size: 5,
|
||||
pick_box: 3,
|
||||
hatch_associative: true,
|
||||
show_menu_bar: false,
|
||||
ribbon_closed: false,
|
||||
options_tab: crate::ui::window::options::OptionsTab::General,
|
||||
show_viewcube: true,
|
||||
show_ucs_icon: true,
|
||||
|
||||
@@ -781,6 +781,8 @@ impl OpenCADStudio {
|
||||
cursor_size: self.cursor_size,
|
||||
pick_box: self.pick_box,
|
||||
hatch_associative: self.hatch_associative,
|
||||
show_menu_bar: self.show_menu_bar,
|
||||
ribbon_closed: self.ribbon_closed,
|
||||
options_tab: self.options_tab,
|
||||
show_viewcube: self.show_viewcube,
|
||||
show_ucs_icon: self.show_ucs_icon,
|
||||
@@ -894,6 +896,8 @@ impl OpenCADStudio {
|
||||
self.cursor_size = s.cursor_size.clamp(1, 100);
|
||||
self.pick_box = s.pick_box.clamp(0, 50);
|
||||
self.hatch_associative = s.hatch_associative;
|
||||
self.show_menu_bar = s.show_menu_bar;
|
||||
self.ribbon_closed = s.ribbon_closed;
|
||||
self.options_tab = s.options_tab;
|
||||
self.spacemouse_preferences = s.spacemouse;
|
||||
// These four drive real features with commands and status-bar pills,
|
||||
|
||||
+4
-1
@@ -2020,7 +2020,10 @@ bg={bg_ms:.1}ms n={view_count}"
|
||||
// Clean-screen mode drops the ribbon for a full-canvas view; the
|
||||
// status bar stays so the mode can be toggled back off.
|
||||
let mut col = column![];
|
||||
if !self.clean_screen {
|
||||
if !self.clean_screen && self.show_menu_bar {
|
||||
col = col.push(crate::ui::menu_bar::view());
|
||||
}
|
||||
if !self.clean_screen && !self.ribbon_closed {
|
||||
col = col.push(self.ribbon.view(
|
||||
is_paper,
|
||||
self.tabs[self.active_tab].is_start,
|
||||
|
||||
Reference in new issue
Block a user