* claim: #5717 * ui(feat): let users choose visible toolbar tabs Keep Sheet Metal and Weldments visible by default while adding persisted tab visibility controls and restoring specialty tabs for designs that use them. Signed-off-by: Karl Von Richter<karl@embeint.com> * ui(fix): respect hidden toolbar tabs in every design Remove feature-based visibility overrides for Sheet Metal and Weldments. Keep all tabs visible by default and preserve the user choice across feature creation, opening designs, selection and undo. Signed-off-by: Karl Von Richter<karl@embeint.com> --------- Signed-off-by: Karl Von Richter<karl@embeint.com>
This commit is contained in:
@@ -224,6 +224,7 @@ settings_monitor false
|
||||
settings_mouse false
|
||||
settings_palette false
|
||||
settings_plug false
|
||||
sheet false
|
||||
sheet_rules false
|
||||
shell false
|
||||
shield false
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
{
|
||||
"en": {
|
||||
"prefs.toolbar_tabs": "Toolbar tabs",
|
||||
"ui.tab_assemble": "Assemble",
|
||||
"ui.tab_manage": "Manage",
|
||||
"ui.tab_sheet_metal": "Sheet Metal",
|
||||
"ui.tab_view": "View",
|
||||
"ui.tab_weldments": "Weldments",
|
||||
"ui.toolbar_tabs_hidden": "Every toolbar tab is hidden. Click + or right-click here to show one."
|
||||
},
|
||||
"cs": {
|
||||
"ui.tab_assemble": "Sestava",
|
||||
"ui.tab_manage": "Správa",
|
||||
"ui.tab_sheet_metal": "Plech",
|
||||
"ui.tab_view": "Pohled"
|
||||
},
|
||||
"da": {
|
||||
"ui.tab_assemble": "Samling",
|
||||
"ui.tab_manage": "Administrér",
|
||||
"ui.tab_sheet_metal": "Plade",
|
||||
"ui.tab_view": "Visning"
|
||||
},
|
||||
"de": {
|
||||
"ui.tab_assemble": "Zusammenbau",
|
||||
"ui.tab_manage": "Verwalten",
|
||||
"ui.tab_sheet_metal": "Blech",
|
||||
"ui.tab_view": "Ansicht",
|
||||
"prefs.toolbar_tabs": "Werkzeugleisten-Registerkarten",
|
||||
"ui.toolbar_tabs_hidden": "Alle Werkzeugleisten-Registerkarten sind ausgeblendet. Klicken Sie auf + oder hier mit der rechten Maustaste, um eine einzublenden.",
|
||||
"ui.tab_weldments": "Schweissteile"
|
||||
},
|
||||
"es": {
|
||||
"ui.tab_assemble": "Ensamblar",
|
||||
"ui.tab_manage": "Gestionar",
|
||||
"ui.tab_sheet_metal": "Chapa",
|
||||
"ui.tab_view": "Vista"
|
||||
},
|
||||
"fr": {
|
||||
"ui.tab_assemble": "Assembler",
|
||||
"ui.tab_manage": "Gérer",
|
||||
"ui.tab_sheet_metal": "Tôlerie",
|
||||
"ui.tab_view": "Vue"
|
||||
},
|
||||
"gl": {
|
||||
"ui.tab_assemble": "Ensamblar",
|
||||
"ui.tab_manage": "Xestionar",
|
||||
"ui.tab_sheet_metal": "Chapa",
|
||||
"ui.tab_view": "Vista"
|
||||
},
|
||||
"hu": {
|
||||
"ui.tab_assemble": "Összeszerelés",
|
||||
"ui.tab_manage": "Kezelés",
|
||||
"ui.tab_sheet_metal": "Lemez",
|
||||
"ui.tab_view": "Nézet"
|
||||
},
|
||||
"id": {
|
||||
"ui.tab_assemble": "Rakit",
|
||||
"ui.tab_manage": "Kelola",
|
||||
"ui.tab_sheet_metal": "Pelat Logam",
|
||||
"ui.tab_view": "Tampilan"
|
||||
},
|
||||
"it": {
|
||||
"ui.tab_assemble": "Assembla",
|
||||
"ui.tab_manage": "Gestisci",
|
||||
"ui.tab_sheet_metal": "Lamiera",
|
||||
"ui.tab_view": "Vista"
|
||||
},
|
||||
"ja": {
|
||||
"prefs.toolbar_tabs": "ツールバーのタブ",
|
||||
"ui.tab_assemble": "アセンブリ",
|
||||
"ui.tab_manage": "管理",
|
||||
"ui.tab_sheet_metal": "板金",
|
||||
"ui.tab_view": "表示",
|
||||
"ui.toolbar_tabs_hidden": "ツールバーのタブはすべて非表示です。+ をクリックするか、ここを右クリックして表示します。",
|
||||
"ui.tab_weldments": "溶接構造"
|
||||
},
|
||||
"ko": {
|
||||
"ui.tab_assemble": "조립",
|
||||
"ui.tab_manage": "관리",
|
||||
"ui.tab_sheet_metal": "판금",
|
||||
"ui.tab_view": "보기",
|
||||
"prefs.toolbar_tabs": "도구 모음 탭",
|
||||
"ui.toolbar_tabs_hidden": "모든 도구 모음 탭이 숨겨져 있습니다. +를 클릭하거나 여기를 마우스 오른쪽 버튼으로 클릭하여 표시하세요.",
|
||||
"ui.tab_weldments": "용접 구조물"
|
||||
},
|
||||
"ms": {
|
||||
"ui.tab_assemble": "Pasang",
|
||||
"ui.tab_manage": "Urus",
|
||||
"ui.tab_sheet_metal": "Logam Kepingan",
|
||||
"ui.tab_view": "Pandangan"
|
||||
},
|
||||
"nb": {
|
||||
"ui.tab_assemble": "Monter",
|
||||
"ui.tab_manage": "Administrer",
|
||||
"ui.tab_sheet_metal": "Plate",
|
||||
"ui.tab_view": "Visning"
|
||||
},
|
||||
"nl": {
|
||||
"ui.tab_assemble": "Samenstellen",
|
||||
"ui.tab_manage": "Beheren",
|
||||
"ui.tab_sheet_metal": "Plaatwerk",
|
||||
"ui.tab_view": "Weergave"
|
||||
},
|
||||
"pl": {
|
||||
"ui.tab_assemble": "Złożenie",
|
||||
"ui.tab_manage": "Zarządzanie",
|
||||
"ui.tab_sheet_metal": "Blacha",
|
||||
"ui.tab_view": "Widok"
|
||||
},
|
||||
"pt-BR": {
|
||||
"ui.tab_assemble": "Montar",
|
||||
"ui.tab_manage": "Gerenciar",
|
||||
"ui.tab_sheet_metal": "Chapa Metálica",
|
||||
"ui.tab_view": "Vista"
|
||||
},
|
||||
"ro": {
|
||||
"ui.tab_assemble": "Asamblare",
|
||||
"ui.tab_manage": "Gestionare",
|
||||
"ui.tab_sheet_metal": "Tablă",
|
||||
"ui.tab_view": "Vizualizare"
|
||||
},
|
||||
"ru": {
|
||||
"ui.tab_assemble": "Сборка",
|
||||
"ui.tab_manage": "Управление",
|
||||
"ui.tab_sheet_metal": "Листовой Металл",
|
||||
"ui.tab_view": "Вид"
|
||||
},
|
||||
"sv": {
|
||||
"ui.tab_assemble": "Montera",
|
||||
"ui.tab_manage": "Hantera",
|
||||
"ui.tab_sheet_metal": "Plåt",
|
||||
"ui.tab_view": "Vy"
|
||||
},
|
||||
"tr": {
|
||||
"ui.tab_assemble": "Montaj",
|
||||
"ui.tab_manage": "Yönet",
|
||||
"ui.tab_sheet_metal": "Sac Metal",
|
||||
"ui.tab_view": "Görünüm"
|
||||
},
|
||||
"uk": {
|
||||
"ui.tab_assemble": "Складання",
|
||||
"ui.tab_manage": "Керування",
|
||||
"ui.tab_sheet_metal": "Листовий Метал",
|
||||
"ui.tab_view": "Вид"
|
||||
},
|
||||
"vi": {
|
||||
"ui.tab_assemble": "Lắp Ráp",
|
||||
"ui.tab_manage": "Quản Lý",
|
||||
"ui.tab_sheet_metal": "Kim Loại Tấm",
|
||||
"ui.tab_view": "Góc Nhìn",
|
||||
"prefs.toolbar_tabs": "Thẻ thanh công cụ",
|
||||
"ui.toolbar_tabs_hidden": "Tất cả các thẻ thanh công cụ đều bị ẩn. Nhấp vào + hoặc nhấp chuột phải tại đây để hiện một thẻ.",
|
||||
"ui.tab_weldments": "Kết Cấu Hàn"
|
||||
},
|
||||
"zh": {
|
||||
"prefs.toolbar_tabs": "工具栏选项卡",
|
||||
"ui.tab_assemble": "装配",
|
||||
"ui.tab_manage": "管理",
|
||||
"ui.tab_sheet_metal": "钣金",
|
||||
"ui.tab_view": "视图",
|
||||
"ui.toolbar_tabs_hidden": "所有工具栏选项卡均已隐藏。点击 + 或在此处右键单击即可显示。",
|
||||
"ui.tab_weldments": "焊件"
|
||||
},
|
||||
"zh-TW": {
|
||||
"ui.tab_assemble": "組裝",
|
||||
"ui.tab_manage": "管理",
|
||||
"ui.tab_sheet_metal": "鈑金",
|
||||
"ui.tab_view": "檢視"
|
||||
},
|
||||
"ar": {
|
||||
"prefs.toolbar_tabs": "علامات تبويب شريط الأدوات",
|
||||
"ui.toolbar_tabs_hidden": "جميع علامات تبويب شريط الأدوات مخفية. انقر على + أو انقر هنا بزر الفأرة الأيمن لإظهار إحداها.",
|
||||
"ui.tab_weldments": "اللحامات",
|
||||
"ui.tab_assemble": "التجميع",
|
||||
"ui.tab_manage": "إدارة",
|
||||
"ui.tab_view": "العرض",
|
||||
"ui.tab_sheet_metal": "الصفائح المعدنية"
|
||||
},
|
||||
"he": {
|
||||
"prefs.toolbar_tabs": "לשוניות סרגל הכלים",
|
||||
"ui.toolbar_tabs_hidden": "כל לשוניות סרגל הכלים מוסתרות. לחצו על + או לחצו כאן לחיצה ימנית כדי להציג לשונית.",
|
||||
"ui.tab_weldments": "ריתוכים",
|
||||
"ui.tab_assemble": "הרכבה",
|
||||
"ui.tab_manage": "ניהול",
|
||||
"ui.tab_view": "תצוגה",
|
||||
"ui.tab_sheet_metal": "פח"
|
||||
}
|
||||
}
|
||||
@@ -1513,7 +1513,7 @@ pub fn run_item(app: &mut SolveApp, item: &Item, at: Pos2) {
|
||||
let _ = app.run("browser.visibility", json!({"visible": true, "paths": [p["path"]], "isolate": true}));
|
||||
}
|
||||
"ui.canvasVisible" => drop(app.run("canvas.edit", p)),
|
||||
"ui.toolbarPin" | "ui.toolbarRemove" | "ui.toolbarReset" | "ui.toolbarCustomize" | "ui.shortcutPin" => {
|
||||
"ui.toolbarPin" | "ui.toolbarRemove" | "ui.toolbarReset" | "ui.toolbarCustomize" | "ui.toolbarTab" | "ui.shortcutPin" => {
|
||||
crate::toolbar_custom::run(app, &item.id, &p)
|
||||
}
|
||||
"ui.historyPlayButton" => {
|
||||
@@ -1920,7 +1920,7 @@ pub fn open_for(app: &mut SolveApp, at: Pos2, target: Target) {
|
||||
|
||||
/// A button's menu: a click opens it, and a click on the same button while it is open closes it.
|
||||
pub fn toggle_for(app: &mut SolveApp, opener: Rect, at: Pos2, target: Target) {
|
||||
if app.viewport.context_menu.is_some() && app.menu.target == target && app.menu.opener == Some(opener) {
|
||||
if open_from(app, opener, &target) {
|
||||
close(app);
|
||||
} else {
|
||||
open_for(app, at, target);
|
||||
@@ -1928,6 +1928,11 @@ pub fn toggle_for(app: &mut SolveApp, opener: Rect, at: Pos2, target: Target) {
|
||||
}
|
||||
}
|
||||
|
||||
/// The button's menu is open, so the button can show it pressed.
|
||||
pub fn open_from(app: &SolveApp, opener: Rect, target: &Target) -> bool {
|
||||
app.viewport.context_menu.is_some() && app.menu.target == *target && app.menu.opener == Some(opener)
|
||||
}
|
||||
|
||||
pub fn close(app: &mut SolveApp) {
|
||||
app.viewport.context_menu = None;
|
||||
app.menu.flick = false;
|
||||
|
||||
@@ -976,6 +976,8 @@ preference_settings! {
|
||||
/// Where notices and offers stack: the view's bottom-right corner (the default) or the bottom
|
||||
/// centre, as before #7893.
|
||||
toast_place: crate::viewport::ToastPlace = Default::default(), PAGE_INTERFACE;
|
||||
/// Toolbar tabs hidden by the person. An empty list keeps every existing tab visible.
|
||||
hidden_toolbar_tabs: Vec<String> = Vec::new(), PAGE_INTERFACE;
|
||||
/// Interface scale (1 = 100 %).
|
||||
ui_scale: f32 = 1.0, PAGE_INTERFACE, accept(0.5..=2.5);
|
||||
/// Interface font: an installed font family (or a font file), or empty for the built-in one
|
||||
@@ -3060,12 +3062,29 @@ fn limit_disabled_plugins(mut p: Prefs) -> Prefs {
|
||||
p
|
||||
}
|
||||
|
||||
/// Keep only known hidden tabs, each once, so a hand-edited preferences
|
||||
/// file cannot carry a huge or nonsense list. `set` still refuses those instead of dropping them.
|
||||
fn limit_toolbar_tabs(mut p: Prefs) -> Prefs {
|
||||
fn known_once(list: Vec<String>, allowed: &[&str]) -> Vec<String> {
|
||||
let mut kept: Vec<String> = Vec::new();
|
||||
for tab in list {
|
||||
if allowed.contains(&tab.as_str()) && !kept.contains(&tab) {
|
||||
kept.push(tab);
|
||||
}
|
||||
}
|
||||
kept
|
||||
}
|
||||
let allowed: Vec<&str> = crate::workspace::choosable_tabs().collect();
|
||||
p.hidden_toolbar_tabs = known_once(std::mem::take(&mut p.hidden_toolbar_tabs), &allowed);
|
||||
p
|
||||
}
|
||||
|
||||
/// Saved preferences, keeping every one that still reads. A value this version doesn't
|
||||
/// understand (a setting a newer or older release saved differently, a hand edit) falls back to
|
||||
/// its default on its own instead of discarding all of them.
|
||||
pub fn lenient(saved: &serde_json::Value) -> Prefs {
|
||||
if let Ok(p) = serde_json::from_value::<Prefs>(saved.clone()) {
|
||||
return limit_disabled_plugins(migrate(p));
|
||||
return limit_toolbar_tabs(limit_disabled_plugins(migrate(p)));
|
||||
}
|
||||
let Ok(mut cur) = serde_json::to_value(Prefs::default()) else { return Prefs::default() };
|
||||
if let (Some(o), Some(src)) = (cur.as_object_mut(), saved.as_object()) {
|
||||
@@ -3079,7 +3098,7 @@ pub fn lenient(saved: &serde_json::Value) -> Prefs {
|
||||
}
|
||||
}
|
||||
}
|
||||
serde_json::from_value(cur).map(migrate).map(limit_disabled_plugins).unwrap_or_default()
|
||||
serde_json::from_value(cur).map(migrate).map(limit_disabled_plugins).map(limit_toolbar_tabs).unwrap_or_default()
|
||||
}
|
||||
|
||||
/// Set preferences from JSON (control channel); returns them all.
|
||||
@@ -3171,6 +3190,13 @@ pub fn set(app: &mut SolveApp, p: &serde_json::Value) -> Result<serde_json::Valu
|
||||
)
|
||||
})?;
|
||||
}
|
||||
let once = |list: &[String], allowed: &[&str]| {
|
||||
list.len() <= allowed.len() && list.iter().all(|tab| allowed.contains(&tab.as_str()) && list.iter().filter(|t| *t == tab).count() == 1)
|
||||
};
|
||||
let allowed: Vec<&str> = crate::workspace::choosable_tabs().collect();
|
||||
if !once(&new.hidden_toolbar_tabs, &allowed) {
|
||||
return Err(format!("`hidden_toolbar_tabs` lists toolbar tabs, each once: {}", allowed.join(", ")));
|
||||
}
|
||||
if !accepted::ui_scale(&new) || !accepted::look_at_speed(&new) {
|
||||
return Err("`ui_scale` must be 0.5…2.5 and `look_at_speed` 0.25…4".into());
|
||||
}
|
||||
@@ -3210,7 +3236,9 @@ pub fn set(app: &mut SolveApp, p: &serde_json::Value) -> Result<serde_json::Valu
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn reveal_preference(h: &mut crate::scenario::Harness, handle: &str) {
|
||||
for _ in 0..16 {
|
||||
// Interface includes the toolbar-tab choices as well as the existing font controls.
|
||||
// Keep small scroll steps so a target cannot be skipped, with a bounded longer page.
|
||||
for _ in 0..32 {
|
||||
let page = crate::scenario::rect_of("dialog:page_body").expect("preference body");
|
||||
let visible = crate::scenario::rect_of(handle)
|
||||
.map(|r| page.contains_rect(r))
|
||||
@@ -5243,6 +5271,11 @@ mod tests {
|
||||
assert_eq!(p.navigator_style, super::NavigatorStyle::Axes);
|
||||
assert_eq!(p.ui_scale, super::Prefs::default().ui_scale);
|
||||
assert_eq!(super::lenient(&json!("garbage")), super::Prefs::default());
|
||||
// Hand-edited toolbar tab lists keep only the tabs each can hold, each once (#5717).
|
||||
let mut hidden = vec![json!("VIEW"), json!("SHEET METAL"), json!("VIEW"), json!("SURFACE")];
|
||||
hidden.extend(std::iter::repeat_n(json!("NOT A TAB"), 10_000));
|
||||
let tabs = super::lenient(&json!({"hidden_toolbar_tabs": hidden}));
|
||||
assert_eq!(tabs.hidden_toolbar_tabs, ["VIEW", "SHEET METAL", "SURFACE"]);
|
||||
// Whole-app load: the other saved state is kept too, and nothing panics.
|
||||
let mut app = crate::SolveApp::new(solidcraft_engine::Session::default(), crate::Services::default());
|
||||
app.load_prefs(&json!({"grid": false, "preferences": saved}).to_string());
|
||||
|
||||
@@ -248,6 +248,17 @@ pub(super) fn interface(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {
|
||||
});
|
||||
origin_plane_names(app, ui);
|
||||
super::navbar::show(app, ui);
|
||||
// The same choice as the toolbar's own menu (the plus after the tabs, or right-click a tab).
|
||||
ui_kit::settings_section(ui, "toolbar_tabs", app.tr("prefs.toolbar_tabs"), |ui| {
|
||||
for tab in crate::workspace::choosable_tabs() {
|
||||
let mut on = crate::workspace::tab_turned_on(app, tab);
|
||||
let response = ui_kit::checkbox(ui, &crate::toolbar::ribbon_label(app, tab), &mut on);
|
||||
crate::scenario::publish_target(&format!("prefs:toolbar_tab:{tab}"), response.rect);
|
||||
if response.changed() {
|
||||
crate::workspace::set_tab_shown(app, tab, on);
|
||||
}
|
||||
}
|
||||
});
|
||||
ui_kit::settings_section(ui, "scale", app.tr("prefs.scale_text"), |ui| {
|
||||
ui_kit::settings_pair(
|
||||
ui,
|
||||
|
||||
@@ -1009,7 +1009,7 @@ fn ribbon_label_top(whole: Rect, height: f32) -> f32 {
|
||||
}
|
||||
|
||||
/// Ribbon headings use the translated labels, with normal word casing instead of registry caps.
|
||||
fn ribbon_label(app: &SolveApp, label: &str) -> String {
|
||||
pub(crate) fn ribbon_label(app: &SolveApp, label: &str) -> String {
|
||||
let label = crate::workspace::word_cased(app.tr_label(crate::workspace::tab_label(label)));
|
||||
// Partial catalogs may already translate the word-cased name (for example "Model").
|
||||
app.tr_label(&label).to_string()
|
||||
@@ -1072,9 +1072,15 @@ fn ribbon_tabs(app: &mut SolveApp, ui: &mut egui::Ui, row: Rect) {
|
||||
+ 24.0
|
||||
})
|
||||
.collect();
|
||||
// A plus after the last tab opens the toolbar's menu, so tabs can be shown or hidden without
|
||||
// knowing about the right-click; it stays when every tab is hidden. The Render workspace's
|
||||
// one tab can't be hidden.
|
||||
let add = !crate::render_workspace::active(app);
|
||||
let add_size = TAB_ROW_HEIGHT - 2.0 * RIBBON_TAB_INSET;
|
||||
let tabs_width: f32 = widths.iter().sum::<f32>()
|
||||
+ tabs.len().saturating_sub(1) as f32 * 2.0
|
||||
+ tabs.iter().filter(|tab| contextual_tab(app, tab)).count() as f32 * 6.0;
|
||||
+ tabs.iter().filter(|tab| contextual_tab(app, tab)).count() as f32 * 6.0
|
||||
+ if add { 2.0 + add_size } else { 0.0 };
|
||||
let search_width = crate::ui_kit::CommandSearch::closed_width(ui.ctx());
|
||||
// The first tab and the search field sit the same distance from the card's top, left and right
|
||||
// edges, so their outer corners are concentric with the card's corners.
|
||||
@@ -1159,8 +1165,32 @@ fn ribbon_tabs(app: &mut SolveApp, ui: &mut egui::Ui, row: Rect) {
|
||||
if response.clicked() {
|
||||
app.ui.tab = tab.to_string();
|
||||
}
|
||||
if response.secondary_clicked() {
|
||||
crate::context_menu::open_for(
|
||||
app,
|
||||
response.interact_pointer_pos().unwrap_or(tr.left_bottom()),
|
||||
crate::context_menu::Target::Toolbar,
|
||||
);
|
||||
}
|
||||
x += width + 2.0;
|
||||
}
|
||||
if add {
|
||||
let pr = Rect::from_min_size(pos2(x, all.top() + inset), vec2(add_size, add_size));
|
||||
let open = crate::context_menu::open_from(app, pr, &crate::context_menu::Target::Toolbar);
|
||||
if open && !ui.rect_contains_pointer(pr) {
|
||||
ui.painter().rect_filled(pr, t.control_radius, t.hover);
|
||||
}
|
||||
let response = crate::ui_kit::quiet_icon_button_at(ui, pr, "plus", app.tr("prefs.toolbar_tabs"));
|
||||
if ui.clip_rect().contains(pr.center()) {
|
||||
crate::scenario::publish_target("ribbon:add_tab", pr);
|
||||
}
|
||||
if response.clicked() {
|
||||
// A click leaves no keyboard focus here, as on the tabs, so single-key
|
||||
// shortcuts such as S still work afterwards.
|
||||
response.surrender_focus();
|
||||
crate::context_menu::toggle_for(app, pr, pr.left_bottom(), crate::context_menu::Target::Toolbar);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
if matches!(app.ui.tab.as_str(), "SKETCH" | "SHEET METAL") {
|
||||
@@ -1364,6 +1394,12 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
})
|
||||
.collect();
|
||||
let right = r.right();
|
||||
if crate::workspace::visible_tabs(app).is_empty() {
|
||||
// Every tab is hidden: the ribbon says how to bring them back.
|
||||
let at = pos2((ribbon_left + right) / 2.0, top + group_height / 2.0);
|
||||
ribbon_text(ui, at, app.tr("ui.toolbar_tabs_hidden"), t.font_body, t.text_dim, false);
|
||||
crate::scenario::publish_handle("ribbon:tabs_hidden", at);
|
||||
}
|
||||
// The Sketch exit group follows the last sketch panel, and is always kept room for so it
|
||||
// stays reachable at every width; when panels go into the » menu it moves to the far right.
|
||||
let finish_plan =
|
||||
|
||||
@@ -3,10 +3,11 @@
|
||||
//! pins it to the toolbar, removes it, or pins it to the S box's favourites; buttons are dragged
|
||||
//! to reorder them within and between panels; a drop-down row dragged onto the toolbar pins it
|
||||
//! there, a button dragged off the toolbar (or back into the drop-down) leaves it; the pin icon
|
||||
//! on a hovered drop-down row pins or unpins; the toolbar's own menu (right-click its empty
|
||||
//! space) has Customize Toolbar… (a window listing every command of the tab with a check box)
|
||||
//! and Reset Toolbar; Reset Toolbar restores the tab. Kept with the
|
||||
//! preferences and exported or imported with the keyboard shortcuts.
|
||||
//! on a hovered drop-down row pins or unpins; the toolbar's own menu (the plus after the tabs,
|
||||
//! or right-click its empty space or a tab) shows or hides each tab, and has Customize Toolbar…
|
||||
//! (a window listing every command of the tab with a check box) and Reset Toolbar; Reset Toolbar
|
||||
//! restores the tab. The buttons are kept with the preferences and exported or imported with the
|
||||
//! keyboard shortcuts; hidden tabs are kept in the `hidden_toolbar_tabs` preference.
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
@@ -331,12 +332,28 @@ pub fn command_items(app: &SolveApp, id: &str) -> Vec<Item> {
|
||||
v
|
||||
}
|
||||
|
||||
/// The toolbar's own menu (right-click on its empty space).
|
||||
/// The toolbar's own menu (right-click on its empty space or a tab): every tab that can be shown
|
||||
/// or hidden, ticked when on, then the button customisation of the selected tab.
|
||||
pub fn toolbar_items(app: &SolveApp) -> Vec<Item> {
|
||||
vec![
|
||||
Item::action("ui.toolbarCustomize", "Customize Toolbar…", "settings"),
|
||||
Item::action("ui.toolbarReset", "Reset Toolbar", "restore").with(json!({ "tab": app.ui.tab })),
|
||||
]
|
||||
let mut v = Vec::new();
|
||||
if !crate::render_workspace::active(app) {
|
||||
v.push(Item::heading(app.tr("prefs.toolbar_tabs")));
|
||||
for tab in crate::workspace::choosable_tabs() {
|
||||
let on = crate::workspace::tab_turned_on(app, tab);
|
||||
// The row reads as the tab does, in every language.
|
||||
let item = Item::action("ui.toolbarTab", &crate::toolbar::ribbon_label(app, tab), crate::workspace::tab_icon(tab))
|
||||
.with(json!({ "tab": tab, "shown": !on }));
|
||||
v.push(if on { item.key("current") } else { item });
|
||||
}
|
||||
// With every tab hidden there is no tab to customise.
|
||||
if !crate::workspace::visible_tabs(app).contains(&app.ui.tab.as_str()) {
|
||||
return v;
|
||||
}
|
||||
v.push(Item::sep());
|
||||
}
|
||||
v.push(Item::action("ui.toolbarCustomize", "Customize Toolbar…", "settings"));
|
||||
v.push(Item::action("ui.toolbarReset", "Reset Toolbar", "restore").with(json!({ "tab": app.ui.tab })));
|
||||
v
|
||||
}
|
||||
|
||||
/// Run a toolbar item from a menu.
|
||||
@@ -352,6 +369,7 @@ pub fn run(app: &mut SolveApp, action: &str, p: &Value) {
|
||||
"ui.toolbarRemove" => remove(app, &tab, id),
|
||||
"ui.toolbarReset" => reset(app, &tab),
|
||||
"ui.toolbarCustomize" => app.toolbar_custom.customizing = true,
|
||||
"ui.toolbarTab" => crate::workspace::set_tab_shown(app, &tab, p.get("shown").and_then(Value::as_bool).unwrap_or(true)),
|
||||
"ui.shortcutPin" => app.sbox.toggle_pin(id),
|
||||
_ => {}
|
||||
}
|
||||
|
||||
+212
-10
@@ -591,11 +591,58 @@ pub fn frame_body(app: &crate::SolveApp) -> Option<String> {
|
||||
matches!(made_by.kind, FeatureKind::FrameMember { .. }).then(|| body.name.clone())
|
||||
}
|
||||
|
||||
/// The design tabs following the general-purpose tabs in the ribbon.
|
||||
pub struct SpecialtyTab {
|
||||
pub tab: &'static str,
|
||||
pub icon: &'static str,
|
||||
}
|
||||
|
||||
pub const SPECIALTY_TABS: &[SpecialtyTab] =
|
||||
&[SpecialtyTab { tab: "SHEET METAL", icon: "sheet" }, SpecialtyTab { tab: "WELDMENTS", icon: "frame_member" }];
|
||||
|
||||
/// A tab's row in the toolbar menu: the icon of the command that leads the tab (Model › Create ›
|
||||
/// Extrude, Inspect › Measure, View › Views and so on).
|
||||
pub fn tab_icon(tab: &str) -> &'static str {
|
||||
match tab {
|
||||
"MODEL" => "extrude",
|
||||
"SURFACE" => "surface_extrude",
|
||||
"ASSEMBLE" => "joint",
|
||||
"INSERT" => "import",
|
||||
"INSPECT" => "measure",
|
||||
"MANAGE" => "params",
|
||||
"VIEW" => "camera",
|
||||
_ => SPECIALTY_TABS.iter().find(|o| o.tab == tab).map_or("", |o| o.icon),
|
||||
}
|
||||
}
|
||||
|
||||
/// Tabs shown by default, in row order. Sketch has its own visibility preference and the Render
|
||||
/// workspace owns its controls, so neither is on this list.
|
||||
pub fn choosable_tabs() -> impl Iterator<Item = &'static str> {
|
||||
TABS.iter().copied().chain(SPECIALTY_TABS.iter().map(|o| o.tab))
|
||||
}
|
||||
|
||||
/// The person's choice. Every tab is on until explicitly hidden.
|
||||
pub fn tab_turned_on(app: &crate::SolveApp, tab: &str) -> bool {
|
||||
choosable_tabs().any(|t| t == tab) && !app.preferences.hidden_toolbar_tabs.iter().any(|t| t == tab)
|
||||
}
|
||||
|
||||
/// Show or hide a tab (kept with the preferences); names not on the list are left alone.
|
||||
pub fn set_tab_shown(app: &mut crate::SolveApp, tab: &str, shown: bool) {
|
||||
if !choosable_tabs().any(|t| t == tab) {
|
||||
return;
|
||||
}
|
||||
app.preferences.hidden_toolbar_tabs.retain(|t| t != tab);
|
||||
if !shown {
|
||||
app.preferences.hidden_toolbar_tabs.push(tab.to_string());
|
||||
}
|
||||
}
|
||||
|
||||
/// Every design tab stays hidden until the person chooses to show it again.
|
||||
pub fn visible_tabs(app: &crate::SolveApp) -> Vec<&'static str> {
|
||||
if crate::render_workspace::active(app) {
|
||||
return Vec::new();
|
||||
}
|
||||
let mut tabs = TABS.to_vec();
|
||||
let mut tabs: Vec<_> = TABS.iter().copied().filter(|tab| tab_turned_on(app, tab)).collect();
|
||||
if app.preferences.sketch_tab_always {
|
||||
// Right after MODEL, whether a sketch is open or not (#7904).
|
||||
let at = tabs.iter().position(|t| *t == "MODEL").map_or(0, |i| i + 1);
|
||||
@@ -603,14 +650,17 @@ pub fn visible_tabs(app: &crate::SolveApp) -> Vec<&'static str> {
|
||||
} else if app.session.active_sketch.is_some() {
|
||||
tabs.push("SKETCH");
|
||||
}
|
||||
// Always reachable, as before the ribbon redesign: a sheet-metal part starts from an
|
||||
// ordinary sketch or solid, so the tab cannot wait for a sheet body. A frame starts
|
||||
// from a sketch of its lines, so Weldments is always there too.
|
||||
tabs.push("SHEET METAL");
|
||||
tabs.push("WELDMENTS");
|
||||
tabs.extend(SPECIALTY_TABS.iter().map(|o| o.tab).filter(|tab| tab_turned_on(app, tab)));
|
||||
tabs
|
||||
}
|
||||
|
||||
/// Where the ribbon goes when the selected tab is not in the row: Model, or the first tab shown
|
||||
/// while Model is hidden; none when every tab is hidden.
|
||||
fn home_tab(app: &crate::SolveApp) -> &'static str {
|
||||
let tabs = visible_tabs(app);
|
||||
if tabs.contains(&"MODEL") { "MODEL" } else { tabs.first().copied().unwrap_or_default() }
|
||||
}
|
||||
|
||||
/// With the SKETCH tab kept shown (#7904) and no sketch open: whether `id` is one of the tools in
|
||||
/// its CREATE or REFERENCE sections, which then start a sketch first (Create Sketch, then the
|
||||
/// tool). Tools that work on a sketch's geometry (modify, pattern, constrain) wait for one.
|
||||
@@ -652,19 +702,19 @@ pub fn sync_context(app: &mut crate::SolveApp) {
|
||||
"SKETCH"
|
||||
} else if let Some(back) = back.as_deref().filter(|t| *t != "SKETCH" && visible_tabs(app).contains(t)) {
|
||||
// Finishing a sketch goes back to the tab it came from (#3250).
|
||||
visible_tabs(app).into_iter().find(|t| t == &back).unwrap_or("MODEL")
|
||||
visible_tabs(app).into_iter().find(|t| t == &back).unwrap_or_else(|| home_tab(app))
|
||||
} else if context.as_deref().is_some_and(|c| c.starts_with("frame:")) {
|
||||
"WELDMENTS"
|
||||
} else if context.is_some() {
|
||||
"SHEET METAL"
|
||||
} else {
|
||||
"MODEL"
|
||||
home_tab(app)
|
||||
}
|
||||
.into();
|
||||
app.ui.ribbon_context = context;
|
||||
}
|
||||
if !visible_tabs(app).contains(&app.ui.tab.as_str()) {
|
||||
app.ui.tab = "MODEL".into();
|
||||
app.ui.tab = home_tab(app).into();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -870,7 +920,7 @@ mod tests {
|
||||
h.app.run("solid.box", json!({"body_name":"Solid", "operation":"new", "length":10, "width":10, "height":10})).unwrap();
|
||||
h.app.run("select.set", json!({"items":[{"type":"body","name":"Solid"}]})).unwrap();
|
||||
sync_context(&mut h.app);
|
||||
assert!(visible_tabs(&h.app).contains(&"SHEET METAL"), "the tab stays reachable off a sheet body");
|
||||
assert!(visible_tabs(&h.app).contains(&"SHEET METAL"), "the tab stays reachable off a sheet body by default");
|
||||
assert!(sheet_body(&h.app).is_none());
|
||||
h.app.run("select.set", json!({"items":[{"type":"body","name":"Sheet"}]})).unwrap();
|
||||
sync_context(&mut h.app);
|
||||
@@ -921,6 +971,157 @@ mod tests {
|
||||
assert_eq!(h.app.ui.tab, "WELDMENTS");
|
||||
}
|
||||
|
||||
/// Tabs show until the person hides them, from the same menu and Settings, down
|
||||
/// to no tab at all; the plus stays, so they can come back (#5717).
|
||||
#[test]
|
||||
fn standard_tabs_show_until_hidden_and_every_tab_can_be_hidden() {
|
||||
let mut h = crate::scenario::Harness::new();
|
||||
h.frames(2);
|
||||
assert!(h.app.preferences.hidden_toolbar_tabs.is_empty());
|
||||
assert_eq!(h.app.ui.tab, "MODEL");
|
||||
|
||||
// Hide the selected tab from its own menu: it leaves the row and the next tab is selected.
|
||||
h.step(&json!({"click":{"handle":"tab:MODEL"},"button":"right"})).unwrap();
|
||||
h.call("ui.menuPick", json!({"item":"Model"}));
|
||||
h.frames(2);
|
||||
assert_eq!(h.app.preferences.hidden_toolbar_tabs, ["MODEL"]);
|
||||
assert!(crate::scenario::handle_at("tab:MODEL").is_none());
|
||||
assert_eq!(h.app.ui.tab, "SURFACE", "the first tab still shown is selected");
|
||||
|
||||
// Settings › Interface lists the standard tabs too.
|
||||
h.call("ui.prefs", json!({"open":"Interface"}));
|
||||
crate::prefs::reveal_preference(&mut h, "prefs:toolbar_tab:MODEL");
|
||||
h.step(&json!({"click":{"handle":"prefs:toolbar_tab:MODEL"}})).unwrap();
|
||||
assert!(h.app.preferences.hidden_toolbar_tabs.is_empty());
|
||||
crate::prefs::reveal_preference(&mut h, "prefs:toolbar_tab:VIEW");
|
||||
h.step(&json!({"click":{"handle":"prefs:toolbar_tab:VIEW"}})).unwrap();
|
||||
assert_eq!(h.app.preferences.hidden_toolbar_tabs, ["VIEW"]);
|
||||
h.call("ui.prefs", json!({"button":"defaults"}));
|
||||
assert!(h.app.preferences.hidden_toolbar_tabs.is_empty(), "the Interface page's defaults show every standard tab");
|
||||
h.call("ui.prefs", json!({"button":"ok"}));
|
||||
|
||||
// The control channel checks the list, and it is kept with the preferences.
|
||||
assert!(h.call("ui.prefs", json!({"hidden_toolbar_tabs": ["SKETCH"]}))["error"].is_string(), "only choosable tabs");
|
||||
assert!(h.call("ui.prefs", json!({"hidden_toolbar_tabs": ["VIEW", "VIEW"]}))["error"].is_string(), "each once");
|
||||
assert!(h.call("ui.prefs", json!({"hidden_toolbar_tabs": choosable_tabs().collect::<Vec<_>>()}))["error"].is_null());
|
||||
let mut other = crate::SolveApp::new(solidcraft_engine::Session::default(), crate::Services::default());
|
||||
other.load_prefs(&h.app.prefs());
|
||||
assert!(visible_tabs(&other).is_empty());
|
||||
|
||||
// Every tab hidden: only the plus is left in the row, the ribbon says how to bring the
|
||||
// tabs back, and the menu has no tab to customise.
|
||||
h.frames(2);
|
||||
assert!(visible_tabs(&h.app).is_empty());
|
||||
assert_eq!(h.app.ui.tab, "");
|
||||
assert!(choosable_tabs().all(|tab| crate::scenario::handle_at(&format!("tab:{tab}")).is_none()));
|
||||
assert!(crate::scenario::handle_at("ribbon:tabs_hidden").is_some());
|
||||
let items = crate::toolbar_custom::toolbar_items(&h.app);
|
||||
assert!(!items.iter().any(|i| matches!(i.id.as_str(), "ui.toolbarCustomize" | "ui.toolbarReset")));
|
||||
// A sketch still brings its tab, and finishing it leaves the row empty again.
|
||||
h.app.run("sketch.create", json!({"plane":"XY"})).unwrap();
|
||||
h.frames(2);
|
||||
assert_eq!(visible_tabs(&h.app), ["SKETCH"]);
|
||||
assert_eq!(h.app.ui.tab, "SKETCH");
|
||||
h.app.finish_sketch();
|
||||
h.frames(2);
|
||||
assert_eq!(h.app.ui.tab, "");
|
||||
// The plus brings a tab back.
|
||||
h.step(&json!({"click":{"handle":"ribbon:add_tab"}})).unwrap();
|
||||
h.call("ui.menuPick", json!({"item":"Inspect"}));
|
||||
h.frames(2);
|
||||
assert_eq!(visible_tabs(&h.app), ["INSPECT"]);
|
||||
assert_eq!(h.app.ui.tab, "INSPECT");
|
||||
assert!(crate::scenario::handle_at("ribbon:tabs_hidden").is_none());
|
||||
// A hidden tab's commands are still found by command search, and start from there.
|
||||
let found = crate::shortcut_box::search(&h.app, "Change Parameters");
|
||||
assert_eq!(found.first().map(|row| row.0), Some("parameters.change"), "Parameters is on the hidden Model and Manage tabs");
|
||||
h.step(&json!({"start":"parameters.change"})).unwrap();
|
||||
assert!(h.app.params.is_some());
|
||||
assert_eq!(h.app.ui.tab, "INSPECT", "its tabs stay hidden");
|
||||
h.call("ui.prefs", json!({"hidden_toolbar_tabs": []}));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn specialty_tabs_show_by_default_and_stay_hidden_for_features() {
|
||||
let mut h = crate::scenario::Harness::new();
|
||||
h.frames(2);
|
||||
assert_eq!(visible_tabs(&h.app), choosable_tabs().collect::<Vec<_>>());
|
||||
h.step(&json!({"click":{"handle":"ribbon:add_tab"}})).unwrap();
|
||||
let rows: Vec<_> = crate::toolbar_custom::toolbar_items(&h.app).into_iter().filter(|i| i.id == "ui.toolbarTab").collect();
|
||||
assert_eq!(
|
||||
rows.iter().map(|i| i.label.as_str()).collect::<Vec<_>>(),
|
||||
["Model", "Surface", "Assemble", "Insert", "Inspect", "Manage", "View", "Sheet Metal", "Weldments"]
|
||||
);
|
||||
assert!(rows.iter().all(|i| i.shortcut == "current"), "all existing tabs stay on by default");
|
||||
h.step(&json!({"click":{"handle":"ribbon:add_tab"}})).unwrap();
|
||||
assert!(h.app.viewport.context_menu.is_none(), "a second click closes the menu");
|
||||
h.step(&json!({"key":"S"})).unwrap();
|
||||
assert!(h.app.ui.palette_open, "the plus leaves single-key shortcuts available");
|
||||
h.step(&json!({"key":"Escape"})).unwrap();
|
||||
h.step(&json!({"click":{"handle":"ribbon:add_tab"}})).unwrap();
|
||||
h.call("ui.menuPick", json!({"item":"Sheet Metal"}));
|
||||
h.frames(2);
|
||||
assert_eq!(h.app.preferences.hidden_toolbar_tabs, ["SHEET METAL"]);
|
||||
assert!(crate::scenario::handle_at("tab:SHEET METAL").is_none());
|
||||
assert!(visible_tabs(&h.app).contains(&"WELDMENTS"));
|
||||
let mut other = crate::SolveApp::new(solidcraft_engine::Session::default(), crate::Services::default());
|
||||
other.load_prefs(&h.app.prefs());
|
||||
assert!(!visible_tabs(&other).contains(&"SHEET METAL"));
|
||||
|
||||
h.app.run("sketch.create", json!({"plane":"XY", "name":"Tab path"})).unwrap();
|
||||
h.app.run("sketch.rectangle.two_point", json!({"p0":[0,0],"p1":[40,30]})).unwrap();
|
||||
h.app.run("sketch.finish", json!({})).unwrap();
|
||||
h.app.run("sheet.flange", json!({"name":"Sheet", "body_name":"Sheet"})).unwrap();
|
||||
sync_context(&mut h.app);
|
||||
h.frames(2);
|
||||
assert_eq!(h.app.ui.tab, "MODEL", "a sheet context cannot select its hidden tab");
|
||||
assert!(!visible_tabs(&h.app).contains(&"SHEET METAL"));
|
||||
assert!(crate::scenario::handle_at("tab:SHEET METAL").is_none());
|
||||
assert_eq!(h.app.preferences.hidden_toolbar_tabs, ["SHEET METAL"], "features do not change the saved choice");
|
||||
let path = h.dir.join("hidden-sheet.solidcraft");
|
||||
h.app.run("file.save", json!({"path":path})).unwrap();
|
||||
other.run("doc.open", json!({"path":path})).unwrap();
|
||||
assert!(!visible_tabs(&other).contains(&"SHEET METAL"), "opening a sheet design respects the saved hiding choice");
|
||||
sync_context(&mut other);
|
||||
assert_eq!(other.ui.tab, "MODEL");
|
||||
h.app.run("edit.undo", json!({})).unwrap();
|
||||
sync_context(&mut h.app);
|
||||
assert!(!visible_tabs(&h.app).contains(&"SHEET METAL"));
|
||||
|
||||
h.call("ui.prefs", json!({"hidden_toolbar_tabs": ["SHEET METAL", "WELDMENTS"]}));
|
||||
h.app.run("frame.member", json!({"sketch":"Tab path", "profile":{"kind":"rect_tube","width":10,"height":10,"wall":1}})).unwrap();
|
||||
sync_context(&mut h.app);
|
||||
h.frames(2);
|
||||
assert_eq!(h.app.ui.tab, "MODEL", "a frame context cannot select its hidden tab");
|
||||
assert!(!visible_tabs(&h.app).contains(&"WELDMENTS"));
|
||||
assert!(crate::scenario::handle_at("tab:WELDMENTS").is_none());
|
||||
h.app.run("file.save", json!({"path":path})).unwrap();
|
||||
set_tab_shown(&mut other, "WELDMENTS", false);
|
||||
other.run("doc.open", json!({"path":path})).unwrap();
|
||||
assert!(!visible_tabs(&other).contains(&"WELDMENTS"), "opening a frame design respects the saved hiding choice");
|
||||
sync_context(&mut other);
|
||||
assert_eq!(other.ui.tab, "MODEL");
|
||||
h.call("ui.prefs", json!({"hidden_toolbar_tabs":choosable_tabs().collect::<Vec<_>>()}));
|
||||
h.frames(2);
|
||||
assert!(visible_tabs(&h.app).is_empty(), "a design with a frame member can still hide every tab");
|
||||
assert_eq!(h.app.ui.tab, "");
|
||||
h.app.run("edit.undo", json!({})).unwrap();
|
||||
sync_context(&mut h.app);
|
||||
assert!(!visible_tabs(&h.app).contains(&"WELDMENTS"));
|
||||
|
||||
// The Sketch visibility setting still works when every other tab is hidden.
|
||||
h.call("ui.prefs", json!({"hidden_toolbar_tabs":choosable_tabs().collect::<Vec<_>>(), "sketch_tab_always":true}));
|
||||
h.frames(2);
|
||||
assert_eq!(visible_tabs(&h.app), ["SKETCH"]);
|
||||
assert_eq!(h.app.ui.tab, "SKETCH");
|
||||
|
||||
h.call("ui.prefs", json!({"open":"Interface"}));
|
||||
h.call("ui.prefs", json!({"button":"defaults"}));
|
||||
h.call("ui.prefs", json!({"button":"ok"}));
|
||||
assert!(h.app.preferences.hidden_toolbar_tabs.is_empty());
|
||||
assert_eq!(visible_tabs(&h.app), choosable_tabs().collect::<Vec<_>>(), "defaults restore Sheet Metal and Weldments too");
|
||||
}
|
||||
|
||||
/// Parameters and Configurations are on the design tabs they were on before the redesign, and a
|
||||
/// fresh document reaches Sheet Metal (to flange a sketch or convert a solid) by its tab.
|
||||
#[test]
|
||||
@@ -937,6 +1138,7 @@ mod tests {
|
||||
}
|
||||
let mut h = crate::scenario::Harness::new();
|
||||
assert!(sheet_body(&h.app).is_none());
|
||||
h.frames(2);
|
||||
h.step(&json!({"click":{"handle":"tab:SHEET METAL"}})).unwrap();
|
||||
h.frames(2);
|
||||
assert_eq!(h.app.ui.tab, "SHEET METAL");
|
||||
|
||||
@@ -14,6 +14,11 @@
|
||||
panel's name for all its commands. Drag a command from the dropdown onto a panel's label
|
||||
or empty space to append it; the insertion line shows its destination. Drop onto an existing
|
||||
button to insert before it. Buttons can also move between panels, and the layout is saved.
|
||||
Click the **+** after the tabs, right-click a tab or empty toolbar space, or use
|
||||
**Preferences > Interface > Toolbar tabs** to hide or restore tabs. Every existing tab,
|
||||
including Sheet Metal and Weldments, stays visible by default. Tabs you hide stay hidden in every
|
||||
design until you show them again. Hidden tabs keep
|
||||
their customised buttons, commands in search and shortcuts; with all tabs hidden, **+** remains.
|
||||
- **Browser** (left). The design as a tree: document settings and units, named views, the
|
||||
origin, bodies, sketches, construction planes, canvases, joints and components. The eye shows or
|
||||
hides an item, a component's radio button makes it the active component, and right-clicking any
|
||||
|
||||
@@ -305,7 +305,7 @@ labels; `prefs:measure_axis_distances` identifies the checkbox.
|
||||
| `ui.dialogInput` | `index` | what clicking an input's Select chip does: picks go to that input |
|
||||
| `ui.at` | `world: [x,y,z]` \| `sketch: [x,y]` \| `plane: "XY"` \| `axis: "Z"` \| `dimension: "d1"` (its value text) \| `handle: "arrow"` (a manipulator handle, see `scenario::publish_handle`) | the screen point (a scenario step's target; see `crates/ui-egui/src/scenario.rs`) |
|
||||
| `ui.pick` | `pixels?: [[x,y]…]`, `rays?: [{origin, dir}…]`, `frame?: "window"\|"model"`, `width?`, `height?`, `edges?` (default true), `edge_px?` (default 6), `all?`, `include_ghosted?` | read-only geometry under each pixel or ray (#6304): one entry per input, `null` where nothing is hit — body, face index, exact world `point` and outward `normal`, `depth`, `occurrence`/`component` for placed parts, `edge`/`vertex` within `edge_px` of a pixel, `section_cap: true` on a cut face. `window` pixels are physical pixels of a window screenshot; `model` pixels are pixels of a `ui.render` of `width`×`height` (default 960×600), so it works headless. As `view.pick` through `engine.execute`/`engine.batch`. See `crates/ui-egui/src/view_pick.rs` |
|
||||
| `ui.handles` | `prefix?` | the handles drawn last frame, `[{name, x, y}]`: toolbar buttons and drop-down items `toolbar:<command id>` (the button alone: `button:<command id>`; a drop-down row: `dropdown:<command id>`, highlighted `dropdown_hot:<command id>`, its pin `dropdown_pin:<command id>`; Customize Toolbar's check boxes `customize:<command id>`), ribbon tabs `tab:<name>` (MODEL, SURFACE, ASSEMBLE, INSERT, INSPECT, MANAGE, VIEW, SHEET METAL, WELDMENTS; contextual SKETCH; workspace RENDER), panel labels `panel:<tab>:<panel>` (also `ribbon:section:<TAB>:<SECTION>`), document overflow list `tab:overflow`, workspace column `ribbon:workspace`, command-search launcher `ribbon:search`, browser rows `row:<label>` and fold arrows `fold:<label>`, manipulator handles; signed-axis tips `axis_view:z`, `axis_view:-y`; optional cube facets `navigation_cube:top`, `navigation_cube:top_front_right`, controls `navigation_cube:control:home` (and other actions), plus signed-axis aliases for visible cube faces; Preferences navigator picker `prefs:navigator`, options `prefs:navigator:Signed axes` and `prefs:navigator:Cube`; in the Motion Study dialog, where the chart puts its first and last step `motion:chart_start` and `motion:chart_end`, the Check collisions button `motion:check` and each collision found `motion:collision:<n>` |
|
||||
| `ui.handles` | `prefix?` | the handles drawn last frame, `[{name, x, y}]`: toolbar buttons and drop-down items `toolbar:<command id>` (the button alone: `button:<command id>`; a drop-down row: `dropdown:<command id>`, highlighted `dropdown_hot:<command id>`, its pin `dropdown_pin:<command id>`; Customize Toolbar's check boxes `customize:<command id>`), ribbon tabs `tab:<name>` (MODEL, SURFACE, ASSEMBLE, INSERT, INSPECT, MANAGE, VIEW, SHEET METAL, WELDMENTS; contextual SKETCH; workspace RENDER), the toolbar menu button `ribbon:add_tab`, the hint when every tab is hidden `ribbon:tabs_hidden`, Preferences tab check boxes `prefs:toolbar_tab:<NAME>`, panel labels `panel:<tab>:<panel>` (also `ribbon:section:<TAB>:<SECTION>`), document overflow list `tab:overflow`, workspace column `ribbon:workspace`, command-search launcher `ribbon:search`, browser rows `row:<label>` and fold arrows `fold:<label>`, manipulator handles; signed-axis tips `axis_view:z`, `axis_view:-y`; optional cube facets `navigation_cube:top`, `navigation_cube:top_front_right`, controls `navigation_cube:control:home` (and other actions), plus signed-axis aliases for visible cube faces; Preferences navigator picker `prefs:navigator`, options `prefs:navigator:Signed axes` and `prefs:navigator:Cube`; in the Motion Study dialog, where the chart puts its first and last step `motion:chart_start` and `motion:chart_end`, the Check collisions button `motion:check` and each collision found `motion:collision:<n>` |
|
||||
| `ui.editFeature` | `feature` (id or name) | what double-clicking a timeline item does: rolls back to it and opens its dialog filled in (sketches open in sketch mode) |
|
||||
| `ui.scroll` | `x`, `y`, `delta?`, `ctrl?`, `unit?`: `point` \| `line` | wheel zoom at the cursor. `ctrl: true` replays a Ctrl+wheel pinch (Ctrl held and the wheel in points); `unit` selects the wheel unit and defaults to points with `ctrl` and lines without it. `delta` is in points either way. Invalid units or coordinates outside the finite screen-coordinate range are rejected before queuing input |
|
||||
| `ui.key` | `key` (egui key name, `Enter`, `Escape`…), `cmd?`, `ctrl?`, `shift?`, `alt?`, `pressed?` | By default, press and release, then release modifiers. With `pressed: true` or `false`, send only that edge; modifiers remain as given. `cmd` retains the legacy primary-modifier alias unless `ctrl` is explicit: `cmd:true, ctrl:false` sends physical Command, and both true sends Control+Command. `ui.move` can change modifiers between edges. |
|
||||
@@ -346,6 +346,7 @@ One setting per line, sorted by name. A change that adds a setting adds its own
|
||||
- `extrude_auto_to_object` (default false: in the Extrude dialog, with a profile picked, a face, vertex or parallel plane picked off its plane switches the extent to To Object; it applies to Extrude dialogs opened afterwards)
|
||||
- `frame_rate_details` (default false: with the frame rate, a frame-time graph of the frames drawn with the triangles over it, a frame-time histogram and what the GPU drew; clicking the readout switches it)
|
||||
- `graphics_adapter` (exact card name, or empty for Automatic; applies after restart; `WGPU_ADAPTER_NAME` takes precedence)
|
||||
- `hidden_toolbar_tabs` (default `[]`: all existing tabs, including Sheet Metal and Weldments, stay visible; lists tabs to hide, each once, e.g. `["SURFACE", "SHEET METAL"]`; hidden tabs stay hidden regardless of the design's features; [ribbon layout](ribbon-layout.md))
|
||||
- `history_sketches` (`in_order` (default), `under_feature`: the History at the left lists a sketch under the first feature built from it, #6489; the timeline at the bottom keeps the creation order)
|
||||
- `hole_moves` (default false: a placed Single hole has a drag handle (`hole:<n>`), and a pick on a face that has a hole moves it there)
|
||||
- `hole_snaps` (default false: a Single hole snaps to its face's middle and round edges' centres)
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
The UI layout in `crates/ui-egui/src/workspace.rs` maps the original engine registry placements into ribbon sections. `docs/features.md` continues to document registry placements; command registrations and ids are unchanged.
|
||||
|
||||
Always shown, in order: MODEL, SURFACE, ASSEMBLE, INSERT, INSPECT, MANAGE, VIEW, SHEET METAL, WELDMENTS. SKETCH appears during sketch editing; with Preferences › Interface › **Keep the Sketch tab shown** (`sketch_tab_always`, #7904) it stays right after MODEL all the time, and outside a sketch the tools in its CREATE and REFERENCE sections open Create Sketch first and then start in the new sketch. SHEET METAL is reachable in every document, so a sheet-metal part can start from a sketch or a solid; it takes the contextual style and selects itself when the selected body (or the last body of the active component) has evaluated sheet-metal data. WELDMENTS is reachable in every document too, since a frame starts from a sketch of its lines; it selects itself when that body is a frame member, keeping the ordinary tab look (sheet metal comes first). Entering a context selects its tab; the other tabs remain available. RENDER belongs to the Render workspace.
|
||||
Shown by default, in order: MODEL, SURFACE, ASSEMBLE, INSERT, INSPECT, MANAGE, VIEW, SHEET METAL, WELDMENTS. Click the **+** after the tabs, right-click a tab or empty toolbar space, or open Preferences › Interface › **Toolbar tabs** to show or hide them. All existing tabs stay on by default. The per-user `hidden_toolbar_tabs` preference lists the tabs hidden; newly added tabs show automatically. Hiding a tab preserves its customised buttons, commands in search and shortcuts. Hiding the selected tab selects MODEL, or the first tab still shown. Every tab can be hidden: the **+** remains, with a hint explaining how to restore them.
|
||||
|
||||
SKETCH appears during sketch editing; with Preferences › Interface › **Keep the Sketch tab shown** (`sketch_tab_always`, #7904) it stays right after MODEL all the time, and outside a sketch the tools in its CREATE and REFERENCE sections open Create Sketch first and then start in the new sketch. Hidden tabs stay hidden when creating features, opening designs, selecting bodies or undoing changes. When shown, SHEET METAL takes the contextual style and selects itself when the selected body (or the last body of the active component) has evaluated sheet-metal data. When shown, WELDMENTS selects itself when that body is a frame member, keeping the ordinary tab look (sheet metal comes first). Entering a context selects its tab; the other tabs remain available. RENDER belongs to the Render workspace.
|
||||
|
||||
**Bold command ids are default promoted buttons.** Every listed command remains in the section menu. Saved user pins can add buttons, as before.
|
||||
|
||||
@@ -136,7 +138,7 @@ Additional old panels used for shared layouts migrate as follows: SELECT on any
|
||||
|
||||
## Automation handles
|
||||
|
||||
The tab handle form stays `tab:<UPPERCASE NAME>`. Added: `tab:MODEL`, `tab:ASSEMBLE`, `tab:INSERT`, `tab:INSPECT`, `tab:MANAGE`, `tab:VIEW`. SURFACE and RENDER retain their names; SKETCH is available only in context; SHEET METAL is always available. Legacy aliases remain: `tab:SOLID` and `tab:PLASTIC` → MODEL; `tab:MESH` → SURFACE; `tab:UTILITIES` → MANAGE. The Home and document-tab handles are unchanged.
|
||||
The tab handle form stays `tab:<UPPERCASE NAME>`. Added: `tab:MODEL`, `tab:ASSEMBLE`, `tab:INSERT`, `tab:INSPECT`, `tab:MANAGE`, `tab:VIEW`. SURFACE and RENDER retain their names; SKETCH is available in context or with `sketch_tab_always`; SHEET METAL and WELDMENTS show unless hidden, or when the design has their features; the other design tabs show unless hidden. The **+** after the last tab is `ribbon:add_tab`; it opens the toolbar menu. In that menu (`ui.menu` with target `{"type": "toolbar"}`), pick a tab's row by its label, as the tab row shows it (`ui.menuPick {"item": "Sheet Metal"}`). With every tab hidden, the ribbon's hint is `ribbon:tabs_hidden`. The Settings check boxes are `prefs:toolbar_tab:<UPPERCASE NAME>`. Legacy aliases remain: `tab:SOLID` and `tab:PLASTIC` → MODEL; `tab:MESH` → SURFACE; `tab:UTILITIES` → MANAGE. The Home and document-tab handles are unchanged.
|
||||
|
||||
Section labels retain `panel:<tab>:<section>` and collapsed sections retain `collapsed:<tab>:<section>`, with destinations from the tables above. In particular, `panel:SOLID:CREATE` becomes `panel:MODEL:CREATE`, selection-filter panels become `panel:VIEW:SELECT`, and `panel:SKETCH:CONSTRAINTS` becomes `panel:SKETCH:CONSTRAIN`. Command button and menu handles keep their command ids.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user