Preferences redesign 7/11: Graphics (#9879) (#10662)

* Preferences: keep Graphics redesign independent on current main

* Preferences: repair Graphics search targets and CI regressions
This commit is contained in:
Nathan Dane
2026-11-03 13:27:19 +00:00
committed by GitHub
parent 2aa45ef3ee
commit 372136fa6a
26 changed files with 2012 additions and 936 deletions
@@ -0,0 +1,154 @@
{
"ar": {
"prefs.graphics_page.current_view": "العرض الحالي",
"prefs.graphics_page.fastest": "الأسرع",
"prefs.graphics_page.fold_items": "طي العناصر",
"prefs.graphics_page.in_view": "داخل العرض",
"prefs.graphics_page.live_details": "تفاصيل مباشرة",
"prefs.graphics_page.own_mix": "مزيجك الخاص",
"prefs.graphics_page.quick_measure": "قياس سريع",
"prefs.graphics_page.reference_geometry_through_bodies": "الهندسة المرجعية عبر الأجسام",
"prefs.graphics_page.restart": "تلزم إعادة التشغيل",
"prefs.graphics_page.sharpest": "الأكثر وضوحًا",
"prefs.graphics_page.single_surface_analysis": "تحليل سطح واحد",
"prefs.graphics_page.status_chips": "شرائح الحالة",
"prefs.graphics_page.subtitle": "وازن بين السرعة والنعومة.",
"prefs.graphics_page.supersampling": "التنعيم الفائق",
"prefs.graphics_page.supersampling_adaptive": "فقط أثناء سكون العرض",
"prefs.graphics_page.surfaces_edges": "الأسطح والحواف",
"prefs.graphics_page.view_bar": "أيضًا في شريط العرض"
},
"de": {
"prefs.graphics_page.current_view": "Aktuelle Ansicht",
"prefs.graphics_page.fastest": "Am schnellsten",
"prefs.graphics_page.fold_items": "Elemente einklappen",
"prefs.graphics_page.in_view": "In der Ansicht",
"prefs.graphics_page.live_details": "Live-Details",
"prefs.graphics_page.own_mix": "Eigene Mischung",
"prefs.graphics_page.quick_measure": "Schnellmessung",
"prefs.graphics_page.reference_geometry_through_bodies": "Referenzgeometrie durch Körper hindurch",
"prefs.graphics_page.restart": "Neustart erforderlich",
"prefs.graphics_page.sharpest": "Am schärfsten",
"prefs.graphics_page.single_surface_analysis": "Einzelne Flächenanalyse",
"prefs.graphics_page.status_chips": "Status-Chips",
"prefs.graphics_page.subtitle": "Geschwindigkeit gegen Glätte abwägen.",
"prefs.graphics_page.supersampling": "Supersampling",
"prefs.graphics_page.supersampling_adaptive": "Nur solange die Ansicht stillsteht",
"prefs.graphics_page.surfaces_edges": "Flächen und Kanten",
"prefs.graphics_page.view_bar": "Auch in der Ansichtsleiste"
},
"en": {
"prefs.graphics_page.current_view": "Current view",
"prefs.graphics_page.fastest": "Fastest",
"prefs.graphics_page.fold_items": "Fold items",
"prefs.graphics_page.in_view": "In the view",
"prefs.graphics_page.live_details": "Live details",
"prefs.graphics_page.own_mix": "Your own mix",
"prefs.graphics_page.quick_measure": "Quick measurement",
"prefs.graphics_page.reference_geometry_through_bodies": "Reference geometry through bodies",
"prefs.graphics_page.restart": "Restart needed",
"prefs.graphics_page.sharpest": "Sharpest",
"prefs.graphics_page.single_surface_analysis": "Single surface analysis",
"prefs.graphics_page.status_chips": "Status chips",
"prefs.graphics_page.subtitle": "Trade speed for smoothness.",
"prefs.graphics_page.supersampling": "Supersampling",
"prefs.graphics_page.supersampling_adaptive": "Only while the view is still",
"prefs.graphics_page.surfaces_edges": "Surfaces and edges",
"prefs.graphics_page.view_bar": "Also in the view bar"
},
"he": {
"prefs.graphics_page.current_view": "התצוגה הנוכחית",
"prefs.graphics_page.fastest": "המהיר ביותר",
"prefs.graphics_page.fold_items": "קיפול פריטים",
"prefs.graphics_page.in_view": "בתצוגה",
"prefs.graphics_page.live_details": "פרטים בזמן אמת",
"prefs.graphics_page.own_mix": "התמהיל שלך",
"prefs.graphics_page.quick_measure": "מדידה מהירה",
"prefs.graphics_page.reference_geometry_through_bodies": "גאומטריית ייחוס דרך גופים",
"prefs.graphics_page.restart": "נדרשת הפעלה מחדש",
"prefs.graphics_page.sharpest": "החד ביותר",
"prefs.graphics_page.single_surface_analysis": "ניתוח משטח יחיד",
"prefs.graphics_page.status_chips": "תגיות מצב",
"prefs.graphics_page.subtitle": "איזון בין מהירות לחלקות.",
"prefs.graphics_page.supersampling": "דגימת־על",
"prefs.graphics_page.supersampling_adaptive": "רק כל עוד התצוגה נייחת",
"prefs.graphics_page.surfaces_edges": "משטחים וקצוות",
"prefs.graphics_page.view_bar": "גם בסרגל התצוגה"
},
"ja": {
"prefs.graphics_page.current_view": "現在のビュー",
"prefs.graphics_page.fastest": "最速",
"prefs.graphics_page.fold_items": "項目を折りたたむ",
"prefs.graphics_page.in_view": "ビュー内",
"prefs.graphics_page.live_details": "リアルタイムの詳細",
"prefs.graphics_page.own_mix": "独自の組み合わせ",
"prefs.graphics_page.quick_measure": "クイック測定",
"prefs.graphics_page.reference_geometry_through_bodies": "ボディ越しの参照ジオメトリ",
"prefs.graphics_page.restart": "再起動が必要",
"prefs.graphics_page.sharpest": "最も鮮明",
"prefs.graphics_page.single_surface_analysis": "単一のサーフェス解析",
"prefs.graphics_page.status_chips": "ステータスチップ",
"prefs.graphics_page.subtitle": "速度と滑らかさのバランスを調整します。",
"prefs.graphics_page.supersampling": "スーパーサンプリング",
"prefs.graphics_page.supersampling_adaptive": "ビューが静止している間のみ",
"prefs.graphics_page.surfaces_edges": "サーフェスとエッジ",
"prefs.graphics_page.view_bar": "ビューバーにも表示"
},
"ko": {
"prefs.graphics_page.current_view": "현재 뷰",
"prefs.graphics_page.fastest": "가장 빠르게",
"prefs.graphics_page.fold_items": "항목 접기",
"prefs.graphics_page.in_view": "뷰 내부",
"prefs.graphics_page.live_details": "실시간 세부 정보",
"prefs.graphics_page.own_mix": "사용자 조합",
"prefs.graphics_page.quick_measure": "빠른 측정",
"prefs.graphics_page.reference_geometry_through_bodies": "바디를 통한 참조 형상",
"prefs.graphics_page.restart": "다시 시작 필요",
"prefs.graphics_page.sharpest": "가장 선명하게",
"prefs.graphics_page.single_surface_analysis": "단일 표면 분석",
"prefs.graphics_page.status_chips": "상태 칩",
"prefs.graphics_page.subtitle": "속도와 부드러움의 균형을 조절합니다.",
"prefs.graphics_page.supersampling": "슈퍼샘플링",
"prefs.graphics_page.supersampling_adaptive": "뷰가 멈춰 있는 동안만",
"prefs.graphics_page.surfaces_edges": "곡면과 모서리",
"prefs.graphics_page.view_bar": "뷰 표시줄에서도 사용"
},
"vi": {
"prefs.graphics_page.current_view": "Khung nhìn hiện tại",
"prefs.graphics_page.fastest": "Nhanh nhất",
"prefs.graphics_page.fold_items": "Thu gọn mục",
"prefs.graphics_page.in_view": "Trong khung nhìn",
"prefs.graphics_page.live_details": "Chi tiết trực tiếp",
"prefs.graphics_page.own_mix": "Tùy chỉnh riêng",
"prefs.graphics_page.quick_measure": "Đo nhanh",
"prefs.graphics_page.reference_geometry_through_bodies": "Hình học tham chiếu xuyên qua các khối",
"prefs.graphics_page.restart": "Cần khởi động lại",
"prefs.graphics_page.sharpest": "Sắc nét nhất",
"prefs.graphics_page.single_surface_analysis": "Phân tích bề mặt duy nhất",
"prefs.graphics_page.status_chips": "Nút trạng thái",
"prefs.graphics_page.subtitle": "Cân bằng tốc độ và độ mượt.",
"prefs.graphics_page.supersampling": "Siêu lấy mẫu",
"prefs.graphics_page.supersampling_adaptive": "Chỉ trong khi góc nhìn đứng yên",
"prefs.graphics_page.surfaces_edges": "Bề mặt và cạnh",
"prefs.graphics_page.view_bar": "Cũng có trên thanh khung nhìn"
},
"zh": {
"prefs.graphics_page.current_view": "当前视图",
"prefs.graphics_page.fastest": "最快",
"prefs.graphics_page.fold_items": "折叠项目",
"prefs.graphics_page.in_view": "视图内",
"prefs.graphics_page.live_details": "实时详情",
"prefs.graphics_page.own_mix": "自定义组合",
"prefs.graphics_page.quick_measure": "快速测量",
"prefs.graphics_page.reference_geometry_through_bodies": "透过实体的参考几何体",
"prefs.graphics_page.restart": "需要重启",
"prefs.graphics_page.sharpest": "最清晰",
"prefs.graphics_page.single_surface_analysis": "单一曲面分析",
"prefs.graphics_page.status_chips": "状态标签",
"prefs.graphics_page.subtitle": "在速度与平滑度之间权衡。",
"prefs.graphics_page.supersampling": "超级采样",
"prefs.graphics_page.supersampling_adaptive": "仅在视图保持静止时",
"prefs.graphics_page.surfaces_edges": "曲面与边",
"prefs.graphics_page.view_bar": "也可在视图栏中设置"
}
}
+326 -39
View File
@@ -1092,7 +1092,7 @@ preference_settings! {
/// Anti-aliasing samples (applies on restart).
msaa: u32 = 4, PAGE_GRAPHICS;
/// Share shading and Continuity; false preserves their independent legacy behavior.
single_surface_analysis: bool = true, PAGE_GRAPHICS => check_id("prefs.single_surface_analysis");
single_surface_analysis: bool = true, PAGE_GRAPHICS => check_id("prefs.graphics_page.single_surface_analysis");
/// Linux: the window system the app opens with at its next start (#3083): `auto` (XWayland
/// whenever there is an X display, native Wayland on niri), `wayland` or `x11`.
window_system: String = "auto".into(), PAGE_GRAPHICS;
@@ -1110,13 +1110,13 @@ preference_settings! {
section_hatch: SectionHatch = SectionHatch::ByPart, PAGE_GRAPHICS;
/// The grid turns to the upright origin plane facing a side view (#1470). Off by default: the
/// grid stays on the ground plane (XY) whatever the view.
grid_follows_view: bool = false => check("Grid follows the view", "Side views show the grid on the upright plane facing them instead of the ground");
grid_follows_view: bool = false => check_id("ui.grid_follows_view");
/// Draw reference geometry such as inactive sketches and datum planes through shaded bodies.
/// Off by default to preserve the depth-tested viewport behaviour.
reference_geometry_through_bodies: bool = false, PAGE_GRAPHICS => check_id("settings.reference_geometry_through_bodies");
reference_geometry_through_bodies: bool = false, PAGE_GRAPHICS => check_id("prefs.graphics_page.reference_geometry_through_bodies");
/// A small dot at every vertex wherever edges are drawn (#7834). Off by default: the viewport
/// draws edges only, as it always has.
vertex_markers: bool = false => check("Vertex markers", "Show a small dot at every vertex wherever edges are drawn");
vertex_markers: bool = false;
/// A preview of a feature that changes a body draws the surface it adds in the preview
/// colour, working out face by face which surface that is. Off: the body is drawn as itself
/// and nothing is worked out (`preview::Colors::tint_new`).
@@ -1133,9 +1133,9 @@ preference_settings! {
/// down (1, 1.5 or 2; 1 is off).
supersampling: f32 = 1.0, PAGE_GRAPHICS;
/// Supersample only while the view holds still (full speed while orbiting).
supersampling_adaptive: bool = true, PAGE_GRAPHICS => check_tr("ui.supersampling_adaptive");
supersampling_adaptive: bool = true, PAGE_GRAPHICS => check_tr("prefs.graphics_page.supersampling_adaptive");
/// Show the frame rate in the view's corner (the view then redraws every frame).
show_frame_rate: bool = false, PAGE_GRAPHICS => check_id("ui.frame_rate");
show_frame_rate: bool = false, PAGE_GRAPHICS;
/// Record where the time goes (SMLib's calls, kernel operations, features, commands, imports)
/// for `diagnostics.profile` (docs/perf.md). Off by default: nothing is recorded.
profile_operations: bool = false, PAGE_GRAPHICS => check_tr("prefs.profile_operations");
@@ -1229,10 +1229,10 @@ preference_settings! {
ribbon_labels: bool = true, PAGE_LAYOUT;
/// Show engine-derived persistent selection in the ribbon; off retains neutral buttons.
persistent_ribbon_pressed: bool = true, PAGE_LAYOUT => check_id("prefs.persistent_ribbon_pressed");
viewport_analysis_status: bool = true, PAGE_GRAPHICS => check_id("prefs.viewport_analysis_status");
viewport_section_status: bool = true, PAGE_GRAPHICS => check_id("prefs.viewport_section_status");
viewport_status_details: bool = true, PAGE_GRAPHICS => check_id("prefs.viewport_status_details");
viewport_status_summary: bool = true, PAGE_GRAPHICS => check_id("prefs.viewport_status_summary");
viewport_analysis_status: bool = true, PAGE_GRAPHICS;
viewport_section_status: bool = true, PAGE_GRAPHICS;
viewport_status_details: bool = true, PAGE_GRAPHICS;
viewport_status_summary: bool = true, PAGE_GRAPHICS;
/// Keep the SKETCH tab in the ribbon, right after MODEL, while no sketch is open; its drawing
/// tools then start a sketch first (#7904).
sketch_tab_always: bool = false, PAGE_LAYOUT => check_id("prefs.sketch_tab_always");
@@ -1271,7 +1271,7 @@ preference_settings! {
status_bar: bool = false, PAGE_LAYOUT => check_id("prefs.status_bar");
/// The selection's length, area or distance in the view's bottom right corner (#7000). Off by
/// default.
quick_measure: bool = false, PAGE_GRAPHICS => check_id("prefs.quick_measure");
quick_measure: bool = false, PAGE_GRAPHICS;
/// Put the feature history to the left of the browser instead of below the viewport.
timeline_left: bool = false, PAGE_LAYOUT;
/// Measured outer width; the contents react to this width without a names mode.
@@ -2533,27 +2533,41 @@ pub const WAYLAND_DROP_ISSUE: &str = "https://github.com/rust-windowing/winit/is
/// which one is running now, and when native Wayland is in use or chosen, that some features are
/// limited there, linking to [`WAYLAND_DROP_ISSUE`].
#[cfg(target_os = "linux")]
fn window_system_row(app: &mut SolveApp, ui: &mut egui::Ui) {
fn window_system_row(app: &mut SolveApp, ui: &mut egui::Ui, label_width: f32) {
let t = Tokens::get();
let label = |id: &str| crate::i18n::tr(&format!("ui.window_system_{id}")).to_string();
let labels: Vec<_> = WINDOW_SYSTEMS.iter().copied().map(label).collect();
let labels: Vec<_> = labels.iter().map(String::as_str).collect();
// The note below says that it applies after a restart, and which one runs now.
let response = ui.allocate_ui_with_layout(egui::vec2(t.form_card_width, 0.0), egui::Layout::top_down(egui::Align::Min), |ui| {
let mut selected = WINDOW_SYSTEMS.iter().position(|id| *id == app.preferences.window_system).unwrap_or(0);
if ui_kit::segmented(ui, &mut selected, &labels, ui_kit::Segments::default())
&& let Some(id) = WINDOW_SYSTEMS.get(selected)
{
app.preferences.window_system = (*id).into();
}
});
crate::scenario::publish_handle("prefs:window_system", response.response.rect.center());
let now = app.services.window_system.map(label);
let text = match &now {
Some(now) => crate::i18n::format("settings.window_system_note_now", &[("now", now)]),
None => app.tr("settings.msaa_applies_on_restart").to_string(),
};
ui_kit::text(ui, &text, ui_kit::Text::Hint("window_system"));
let row_width = (label_width + t.space_14 + t.space_24 * 10.0).min(ui.available_width());
ui.horizontal_wrapped(|ui| {
ui.allocate_ui_with_layout(egui::vec2(row_width, t.control_height), egui::Layout::top_down(egui::Align::Min), |ui| {
ui_kit::settings_form(ui, label_width, |ui| {
ui_kit::settings_row_help(ui, app.tr("ui.window_system"), &text, |ui| {
ui.allocate_ui_with_layout(
egui::vec2((t.space_24 * 10.0).min(ui.available_width()), t.control_height),
egui::Layout::top_down(egui::Align::Min),
|ui| {
let mut selected = WINDOW_SYSTEMS.iter().position(|id| *id == app.preferences.window_system).unwrap_or(0);
let before = selected;
let response = ui_kit::dropdown(ui, "window_system", &mut selected, &labels);
crate::scenario::publish_target("prefs:window_system", response.rect);
if selected != before
&& let Some(id) = WINDOW_SYSTEMS.get(selected)
{
app.preferences.window_system = (*id).into();
}
},
);
});
});
});
ui_kit::settings_badge(ui, "Linux", false);
});
let choice = app.preferences.window_system.as_str();
if choice == "wayland" || (choice == "auto" && app.services.window_system == Some("wayland")) {
ui.horizontal_wrapped(|ui| {
@@ -5863,7 +5877,7 @@ mod tests {
out.textures_delta.clear();
}
let mut previous = 0;
for label in ["Coarse", "Normal", "Fine", "Ultra"] {
for (label, segments) in [("Coarse", 8), ("Normal", 16), ("Fine", 32), ("Ultra", 64)] {
let card = crate::scenario::rect_of(&format!("prefs:option:{label}")).expect("quality card");
let facets = shapes
.iter()
@@ -5877,6 +5891,7 @@ mod tests {
.max()
.unwrap_or(0);
assert!(facets > previous, "{label} must visibly add detail to the preceding quality: {facets} <= {previous}");
assert_eq!(facets, segments + 1, "{label} uses the canonical faceting caption, with the closing vertex");
previous = facets;
}
}
@@ -6068,11 +6083,11 @@ mod tests {
("Origin plane names", PAGE_DESIGN),
("Status bar", PAGE_LAYOUT),
("Color vision", PAGE_APPEARANCE),
("Quick measurement in the view's corner", PAGE_GRAPHICS),
("Show viewport analysis status", PAGE_GRAPHICS),
("Show viewport section status", PAGE_GRAPHICS),
("Live viewport details", PAGE_GRAPHICS),
("Fold viewport status items", PAGE_GRAPHICS),
("Quick measurement", PAGE_GRAPHICS),
("Analysis", PAGE_GRAPHICS),
("Section", PAGE_GRAPHICS),
("Live details", PAGE_GRAPHICS),
("Fold items", PAGE_GRAPHICS),
("Allow network locations in designs", PAGE_GENERAL),
("Print face highlight", PAGE_GENERAL),
];
@@ -9778,16 +9793,6 @@ mod ui_scale_regression_tests {
}
}
/// View ▸ View angles and Preferences ▸ Graphics run the same command (#6032).
pub(crate) fn view_angles_checkbox(app: &mut SolveApp, ui: &mut egui::Ui) {
let mut enabled = app.preferences.show_view_angles;
let response = ui_kit::checkbox(ui, crate::i18n::tr("ui.view_angles"), &mut enabled).on_hover_text(crate::i18n::tr("ui.view_angles_help"));
crate::scenario::publish_handle("view:view_angles", response.rect.center());
if response.changed() {
let _ = app.run("view.angle_readout", json!({"enabled": enabled}));
}
}
#[cfg(test)]
mod ambient_occlusion_tests {
use super::*;
@@ -9865,6 +9870,288 @@ pub(crate) fn graphics_preset(prefs: &Prefs) -> &'static str {
mod graphics_preset_tests {
use super::*;
fn click_graphics(h: &mut crate::scenario::Harness, query: &str, handle: &str) {
h.app.prefs_window.filter = query.into();
h.frames(5);
reveal_preference(h, handle);
h.step(&json!({"click":{"handle":handle}})).unwrap();
h.frames(2);
}
#[test]
fn graphics_cards_follow_manual_changes_and_preserve_non_preset_settings_in_both_themes() {
for theme in ["light", "dark"] {
let mut h = crate::scenario::Harness::new();
h.call("ui.prefs", json!({"theme":theme,"language":"en","msaa":2,"dark_parts_shading":true,"frame_rate_details":true}));
h.call("ui.prefs", json!({"open":"Graphics"}));
let camera = h.app.cam;
let design = h.app.session.doc.to_json();
click_graphics(&mut h, "Quality", "view:graphics_preset:quality");
assert_eq!(graphics_preset(&h.app.preferences), "quality");
assert_eq!(
(h.app.preferences.display_quality.as_str(), h.app.preferences.supersampling, h.app.preferences.supersampling_adaptive),
("fine", 2.0, true)
);
assert!(h.app.preferences.ambient_occlusion);
assert_eq!(h.app.preferences.msaa, 2);
assert!(h.app.preferences.dark_parts_shading && h.app.preferences.frame_rate_details);
let quality = h.app.preferences.clone();
click_graphics(&mut h, "Custom", "view:graphics_preset:custom");
assert_eq!(h.app.preferences, quality, "Custom represents the mixture and sets nothing");
click_graphics(&mut h, "Ultra", "prefs:display_quality:ultra");
assert_eq!(h.app.preferences.display_quality, "ultra");
assert_eq!(graphics_preset(&h.app.preferences), "custom");
click_graphics(&mut h, "Performance", "view:graphics_preset:performance");
assert_eq!(graphics_preset(&h.app.preferences), "performance");
assert_eq!(
(h.app.preferences.ambient_occlusion, h.app.preferences.supersampling, h.app.preferences.display_quality.as_str()),
(false, 1.0, "normal")
);
h.call("ui.prefs", json!({"supersampling_adaptive":false}));
assert_eq!(graphics_preset(&h.app.preferences), "performance", "Performance ignores the stored adaptive flag");
assert_eq!(h.app.preferences.msaa, 2);
assert!(h.app.preferences.dark_parts_shading && h.app.preferences.frame_rate_details);
assert_eq!(h.app.cam, camera);
assert_eq!(h.app.session.doc.to_json(), design);
assert!(h.app.session.undo.is_empty());
}
}
#[test]
fn graphics_tiles_and_status_chips_edit_real_values_and_cancel_in_both_themes() {
for theme in ["light", "dark"] {
let mut h = crate::scenario::Harness::new();
h.call("ui.prefs", json!({"theme":theme,"language":"en"}));
h.call("ui.prefs", json!({"open":"Graphics"}));
let original = h.app.preferences.clone();
let session = (h.app.ui.show_grid, h.app.ui.ground_shadow, h.app.ui.perspective);
for (query, handle) in [("Grid", "prefs:grid"), ("Ground shadow", "prefs:ground_shadow"), ("Perspective", "prefs:perspective")] {
click_graphics(&mut h, query, handle);
}
assert_eq!((h.app.ui.show_grid, h.app.ui.ground_shadow, h.app.ui.perspective), (!session.0, !session.1, !session.2));
for (query, field) in [
("Ambient occlusion", "ambient_occlusion"),
("View angles", "show_view_angles"),
("Vertex markers", "vertex_markers"),
("Quick measurement", "quick_measure"),
("Frame rate", "show_frame_rate"),
("Analysis", "viewport_analysis_status"),
("Section", "viewport_section_status"),
("Live details", "viewport_status_details"),
("Fold items", "viewport_status_summary"),
] {
let before = serde_json::to_value(&h.app.preferences).unwrap();
click_graphics(&mut h, query, &format!("prefs:{field}"));
let after = serde_json::to_value(&h.app.preferences).unwrap();
let mut expected = before.clone();
expected[field] = json!(!before[field].as_bool().unwrap());
assert_eq!(after, expected, "{theme}: {field} changes precisely its own setting");
}
h.call("ui.prefs", json!({"button":"cancel"}));
assert_eq!(h.app.preferences, original);
assert_eq!((h.app.ui.show_grid, h.app.ui.ground_shadow, h.app.ui.perspective), session);
}
}
#[test]
fn graphics_overlay_cards_apply_persist_and_reset_without_adding_unpaged_fields() {
let mut h = crate::scenario::Harness::new();
h.call("ui.prefs", json!({"language":"en"}));
h.call("ui.prefs", json!({"open":"Graphics"}));
for (query, handle) in [
("View angles", "prefs:show_view_angles"),
("Vertex markers", "prefs:vertex_markers"),
("Quick measurement", "prefs:quick_measure"),
("Frame rate", "prefs:show_frame_rate"),
("Frame rate details", "prefs:frame_rate_details"),
("Analysis", "prefs:viewport_analysis_status"),
("Section", "prefs:viewport_section_status"),
("Live details", "prefs:viewport_status_details"),
("Fold items", "prefs:viewport_status_summary"),
] {
click_graphics(&mut h, query, handle);
}
h.call("ui.prefs", json!({"button":"apply"}));
let applied = h.app.preferences.clone();
let mut restored = SolveApp::new(Default::default(), Default::default());
restored.load_prefs(&h.app.prefs());
assert!(restored.preferences.show_view_angles && restored.preferences.vertex_markers && restored.preferences.quick_measure);
assert!(restored.preferences.show_frame_rate && restored.preferences.frame_rate_details);
assert!(!restored.preferences.viewport_analysis_status && !restored.preferences.viewport_section_status);
assert!(!restored.preferences.viewport_status_details && !restored.preferences.viewport_status_summary);
h.call("ui.prefs", json!({"button":"defaults"}));
assert!(!h.app.preferences.show_view_angles && !h.app.preferences.quick_measure);
assert!(!h.app.preferences.show_frame_rate && !h.app.preferences.frame_rate_details);
assert!(h.app.preferences.viewport_analysis_status && h.app.preferences.viewport_section_status);
assert!(h.app.preferences.viewport_status_details && h.app.preferences.viewport_status_summary);
assert!(h.app.preferences.vertex_markers, "the visible unpaged control remains excluded from page defaults");
h.call("ui.prefs", json!({"button":"cancel"}));
assert_eq!(h.app.preferences, applied, "Cancel after Apply restores the applied overlay state");
}
#[test]
fn graphics_redesign_keeps_newer_main_controls_and_their_transactions() {
for theme in ["light", "dark"] {
let mut h = crate::scenario::Harness::new();
h.app.home.open = false;
h.call("ui.prefs", json!({"theme":theme,"language":"en","open":"Graphics"}));
let original = h.app.preferences.clone();
for (query, handle) in [
("Tint new surface in a preview", "prefs:preview_tint_new_faces"),
("Show removed material in red", "prefs:cut_preview_tint"),
("Profile operations", "prefs:profile_operations"),
] {
click_graphics(&mut h, query, handle);
}
h.app.prefs_window.filter = "Section hatch".into();
h.frames(5);
reveal_preference(&mut h, "dialog:Section hatch:One style");
h.step(&json!({"click":{"handle":"dialog:Section hatch:One style"}})).unwrap();
h.frames(2);
assert!(!h.app.preferences.preview_tint_new_faces && !h.app.preferences.cut_preview_tint);
assert!(h.app.preferences.profile_operations);
assert_eq!(h.app.preferences.section_hatch, SectionHatch::One);
h.call("ui.prefs", json!({"button":"apply"}));
let applied = h.app.preferences.clone();
h.call("ui.prefs", json!({"button":"defaults"}));
assert!(h.app.preferences.preview_tint_new_faces && h.app.preferences.cut_preview_tint);
assert!(!h.app.preferences.profile_operations);
assert_eq!(h.app.preferences.section_hatch, SectionHatch::ByPart);
h.call("ui.prefs", json!({"button":"cancel"}));
assert_eq!(h.app.preferences, applied);
h.call("ui.prefs", json!({"profile_operations":false}));
assert_eq!(h.app.preferences.persistent_ribbon_pressed, original.persistent_ribbon_pressed);
}
}
#[test]
fn graphics_style_dropdown_uses_the_real_indices_and_icon_masters() {
for theme in ["light", "dark"] {
let mut h = crate::scenario::Harness::new();
h.call("ui.prefs", json!({"theme":theme,"language":"en"}));
h.call("ui.prefs", json!({"open":"Graphics"}));
for (index, (_, label)) in crate::navigation_bar::VISUAL_STYLES.into_iter().enumerate() {
click_graphics(&mut h, "Visual style", "prefs:visual_style");
h.step(&json!({"click":{"handle":format!("dialog:Visual style:{label}")}})).unwrap();
h.frames(3);
assert_eq!(h.app.ui.visual_style, index as u8);
let icon = crate::navigation_bar::visual_style_icon(index as u8);
let painted = crate::scenario::rect_of(&format!("dialog:dropdown_icon:{icon}")).unwrap();
assert!(crate::scenario::rect_of("prefs:visual_style").unwrap().contains_rect(painted));
}
h.call("ui.prefs", json!({"button":"cancel"}));
assert_eq!(h.app.ui.visual_style, 0);
}
}
#[test]
fn graphics_style_popup_owns_escape_and_leaves_snapshot_cancel_to_the_next_escape() {
for theme in ["light", "dark"] {
let mut h = crate::scenario::Harness::new();
h.app.home.open = false;
h.call("ui.resize", json!({"width":1600,"height":1100}));
h.call("ui.prefs", json!({"language":"en","theme":theme}));
let before = h.app.preferences.clone();
h.call("ui.prefs", json!({"open":"Graphics","dark_parts_shading":true}));
let edited = h.app.preferences.clone();
assert_ne!(before, edited);
reveal_preference(&mut h, "prefs:visual_style");
h.step(&json!({"click":{"handle":"prefs:visual_style"}})).unwrap();
h.frames(2);
let popup = "dialog:Visual style:Wireframe";
assert!(crate::scenario::handle_at(popup).is_some());
h.step(&json!({"key":"Escape"})).unwrap();
h.frames(2);
assert!(h.app.prefs_window.open && h.app.prefs_window.section == PAGE_GRAPHICS);
assert!(h.app.prefs_window.snapshot.is_some());
assert_eq!(h.app.preferences, edited, "first Escape retains unapplied Graphics edits");
assert!(crate::scenario::handle_at(popup).is_none());
h.step(&json!({"key":"Enter"})).unwrap();
h.frames(2);
assert!(h.app.prefs_window.open && crate::scenario::handle_at(popup).is_some(), "Enter reopens the focused style trigger");
h.step(&json!({"key":"Escape"})).unwrap();
h.frames(2);
assert!(h.app.prefs_window.open && h.app.prefs_window.snapshot.is_some());
assert!(crate::scenario::handle_at(popup).is_none());
assert_eq!(h.app.preferences, edited);
h.step(&json!({"key":"Escape"})).unwrap();
h.frames(2);
assert!(!h.app.prefs_window.open && h.app.prefs_window.snapshot.is_none());
assert_eq!(h.app.preferences, before, "Escape without a popup performs normal Preferences Cancel");
}
}
#[test]
fn graphics_disabled_controls_keep_stored_values_and_msaa_waits_for_restart() {
use egui::accesskit::Role;
for theme in ["light", "dark"] {
let mut h = crate::scenario::Harness::new();
let dir = std::env::temp_dir().join(format!("solidcraft-graphics-cards-{}-{theme}", std::process::id()));
std::fs::create_dir_all(&dir).unwrap();
let path = dir.join("graphics.json");
std::fs::write(&path, r#"{"backend":"vulkan","msaa":4}"#).unwrap();
h.app.services.graphics_path = Some(path.to_string_lossy().into_owned());
h.app.msaa_supported = vec![1, 2, 4];
let active_samples = h.app.viewport.gpu.as_ref().map(|gpu| gpu.samples);
h.call("ui.prefs", json!({"theme":theme,"language":"en","frame_rate_details":true}));
h.call("ui.prefs", json!({"open":"Graphics"}));
click_graphics(&mut h, "Anti-aliasing", "prefs:msaa:8");
assert_eq!(h.app.preferences.msaa, 4, "an unavailable card cannot coerce MSAA");
assert!(h.widget("Restart needed").is_some());
let tree = h.output.accesskit_update.as_ref().unwrap();
assert!(tree.nodes.iter().any(|(_, node)| node.role() == Role::RadioButton && node.label() == Some("8×") && node.is_disabled()));
click_graphics(&mut h, "Anti-aliasing", "prefs:msaa:2");
assert_eq!(h.app.preferences.msaa, 2);
let saved: serde_json::Value = serde_json::from_slice(&std::fs::read(&path).unwrap()).unwrap();
assert_eq!(saved["msaa"], 2);
assert_eq!(saved["backend"], "vulkan");
assert_eq!(
h.app.viewport.gpu.as_ref().map(|gpu| gpu.samples),
active_samples,
"changing the saved level leaves the running renderer alone"
);
click_graphics(&mut h, "Only when the view is still", "prefs:supersampling_adaptive");
assert!(h.app.preferences.supersampling_adaptive, "disabled adaptive control retains its saved value");
click_graphics(&mut h, "Frame rate details", "prefs:frame_rate_details");
assert!(h.app.preferences.frame_rate_details, "visible disabled details control retains its saved value");
let tree = h.output.accesskit_update.as_ref().unwrap();
assert!(
tree.nodes.iter().any(|(_, node)| node.role() == Role::CheckBox && node.label() == Some("Frame rate details") && node.is_disabled())
);
click_graphics(&mut h, "Frame rate", "prefs:show_frame_rate");
click_graphics(&mut h, "Frame rate details", "prefs:frame_rate_details");
assert!(!h.app.preferences.frame_rate_details, "enabling Frame rate enables its details checkbox");
h.call("ui.prefs", json!({"button":"cancel"}));
assert_eq!(h.app.preferences.msaa, 4);
assert!(h.app.preferences.frame_rate_details);
let saved: serde_json::Value = serde_json::from_slice(&std::fs::read(&path).unwrap()).unwrap();
assert_eq!(saved["msaa"], 4, "Cancel restores startup persistence too");
assert_eq!(saved["backend"], "vulkan");
std::fs::remove_dir_all(dir).unwrap();
}
}
#[test]
fn graphics_page_keeps_the_untouched_radian_default_and_unpaged_reset_exclusions() {
for theme in ["light", "dark"] {
let mut h = crate::scenario::Harness::new();
h.call("ui.prefs", json!({"theme":theme,"language":"en","vertex_markers":true,"grid_follows_view":true}));
h.call("ui.prefs", json!({"open":"Graphics"}));
for (perspective, auto_ortho) in [(false, false), (true, false), (false, true)] {
h.app.ui.perspective = perspective;
h.app.ui.auto_ortho_faces = auto_ortho;
h.app.prefs_window.filter = "Field of view".into();
h.frames(5);
assert_eq!(h.app.preferences.perspective_fov, 0.6, "drawing a whole-degree readout never rounds the default");
}
for page in 0..PAGES.len() {
defaults(&mut h.app, page);
assert!(h.app.preferences.vertex_markers && h.app.preferences.grid_follows_view, "{page}: neither unpaged field joins resets");
}
assert_eq!(h.app.preferences.perspective_fov, 0.6);
}
}
#[test]
fn viewport_preset_popup_accepts_quality_and_performance() {
let mut h = crate::scenario::Harness::new();
+509 -227
View File
@@ -1,255 +1,537 @@
//! Graphics preferences use the shared settings form and illustrative option cards.
//! Graphics preferences compose shared controls and canonical figures, preserving transactions.
use super::*;
use ui_kit::PreferenceFigure;
pub(super) fn show(app: &mut SolveApp, ui: &mut egui::Ui) {
let t = crate::theme::Tokens::get();
ui_kit::settings_heading(ui, app.tr("prefs.graphics"), app.tr("prefs.graphics_note"));
if let Some(note) = &app.graphics_fallback {
ui_kit::text(ui, note, ui_kit::Text::Hint("graphics_fallback"));
}
if app.services.graphics_path.is_some() {
ui_kit::settings_section(ui, "graphics_card", app.tr("prefs.graphics_card"), |ui| {
let adapters = &app.services.graphics_adapters;
let selected = adapters.iter().position(|(name, _)| *name == app.preferences.graphics_adapter);
let missing = !app.preferences.graphics_adapter.is_empty() && selected.is_none();
let current = selected.and_then(|i| adapters.get(i)).map_or(app.tr("prefs.graphics_card_auto"), |(_, label)| label.as_str());
let mut requested = None;
let response = ui_kit::dropdown_menu(ui, "graphics_card", current, |ui| {
if ui_kit::list_picker(ui, "graphics_card:auto", app.tr("prefs.graphics_card_auto"), selected.is_none()).clicked() {
requested = Some(String::new());
}
for (index, (name, label)) in adapters.iter().enumerate() {
if ui_kit::list_picker(ui, &format!("graphics_card:{index}"), label, selected == Some(index)).clicked() {
requested = Some(name.clone());
let t = Tokens::get();
let help_label_width = ["prefs.graphics_page.supersampling", "prefs.graphics_card", "ui.window_system"]
.into_iter()
.map(|id| ui_kit::ContentWidth::label(ui, app.tr(id)))
.fold(0.0, f32::max)
+ t.space_16
+ t.space_4;
ui_kit::settings_page(ui, |ui| {
ui_kit::settings_heading(ui, app.tr("prefs.graphics"), app.tr("prefs.graphics_page.subtitle"));
ui_kit::settings_section(ui, "preset", app.tr("navbar.preset"), |ui| {
let width = ((ui.available_width() - t.space_10 * 2.0) / 3.0).max(t.space_24 * 8.0 + t.space_12).min(ui.available_width());
ui.horizontal_wrapped(|ui| {
ui.spacing_mut().item_spacing = egui::vec2(t.space_10, t.space_10);
for (id, label, word) in [
("performance", "ui.graphics_performance", "prefs.graphics_page.fastest"),
("quality", "ui.graphics_quality", "prefs.graphics_page.sharpest"),
("custom", "ui.graphics_custom", "prefs.graphics_page.own_mix"),
] {
let response = ui_kit::preset_card(
ui,
app.tr(label),
app.tr(word),
graphics_preset(&app.preferences) == id,
true,
&|p, rect, ink| paint_preset_glyph(p, rect, id, ink),
width,
)
.on_hover_text(app.tr("ui.graphics_preset_help"));
crate::scenario::publish_target(&format!("view:graphics_preset:{id}"), response.rect);
if id == "performance" {
crate::scenario::publish_target("view:graphics_preset", response.rect);
}
if response.clicked() && id != "custom" {
let _ = app.run("view.graphics_preset", json!({"preset":id}));
}
}
});
crate::scenario::publish_target("prefs:graphics_card", response.rect);
if let Some(name) = requested {
let _ = super::set(app, &json!({"graphics_adapter": name}));
}
ui_kit::text(ui, app.tr("prefs.graphics_card_restart"), ui_kit::Text::Hint("graphics_card_restart"));
if missing {
ui_kit::text(ui, app.tr("prefs.graphics_card_missing"), ui_kit::Text::Hint("graphics_card_missing"));
} else if !app.preferences.graphics_adapter.is_empty() {
// Status / Help show the adapter actually in use; the dropdown shows the saved
// preference. When they differ the saved card was not applied (#8341).
let active = app.viewport.adapter.rsplit(" · ").next().unwrap_or("");
if !active.is_empty() && !active.eq_ignore_ascii_case(&app.preferences.graphics_adapter) {
ui_kit::text(ui, app.tr("prefs.graphics_card_unused"), ui_kit::Text::Hint("graphics_card_unused"));
}
}
});
}
ui.horizontal_wrapped(|ui| {
let response =
ui.allocate_ui_with_layout(egui::vec2(t.form_card_width + t.space_24 * 2.0, 0.0), egui::Layout::top_down(egui::Align::Min), |ui| {
let presets = ["performance", "quality", "custom"];
let mut selected = presets.iter().position(|preset| *preset == graphics_preset(&app.preferences)).unwrap_or(2);
let labels = [app.tr("ui.graphics_performance"), app.tr("ui.graphics_quality"), app.tr("ui.graphics_custom")];
let changed = ui_kit::segmented(ui, &mut selected, &labels, ui_kit::Segments::default());
if changed && let Some(preset) = presets.get(selected).filter(|preset| **preset != "custom") {
let _ = app.run("view.graphics_preset", json!({"preset":preset}));
ui_kit::settings_section(ui, "quality", app.tr("prefs.curved_surfaces"), |ui| {
use solidcraft_engine::doc::display_quality::DisplayQuality;
let current = DisplayQuality::parse(&app.preferences.display_quality).unwrap_or_default();
let figures: [fn(&egui::Painter, egui::Rect); 4] = [
|p, r| paint_graphics_figure(p, r, PreferenceFigure::Quality(8)),
|p, r| paint_graphics_figure(p, r, PreferenceFigure::Quality(16)),
|p, r| paint_graphics_figure(p, r, PreferenceFigure::Quality(32)),
|p, r| paint_graphics_figure(p, r, PreferenceFigure::Quality(64)),
];
let notes = ["prefs.quality_fastest", "prefs.quality_default", "prefs.quality_smoother", "prefs.quality_slowest"];
ui.horizontal_wrapped(|ui| {
ui.spacing_mut().item_spacing = egui::vec2(t.space_10, t.space_10);
for ((q, figure), note) in DisplayQuality::ALL.into_iter().zip(figures).zip(notes) {
let label_id = format!("ui.display_quality_{}", q.id());
let label = crate::i18n::tr(&label_id);
let width = (t.space_24 * 5.0 + t.space_10).max(ui_kit::ContentWidth::name(ui, label) + t.space_12).min(ui.max_rect().width());
let response = ui_kit::picture_card(
ui,
&ui_kit::Card {
label,
sub: Some(app.tr(note)),
selected: current == q,
enabled: true,
options: None,
check: current == q,
aspect: 120.0 / 64.0,
figure: &figure,
},
width,
)
.on_hover_text(app.tr("settings.display_quality_note"));
crate::scenario::publish_target(&format!("prefs:display_quality:{}", q.id()), response.rect);
crate::scenario::publish_target(&format!("prefs:option:{label}"), response.rect);
if response.clicked() {
app.preferences.display_quality = q.id().into();
}
}
});
let rect = response.response.rect;
crate::scenario::publish_handle("view:graphics_preset", rect.center());
for (index, preset) in ["performance", "quality", "custom"].into_iter().enumerate() {
crate::scenario::publish_handle(
&format!("view:graphics_preset:{preset}"),
egui::pos2(rect.left() + rect.width() * (index as f32 + 0.5) / 3.0, rect.center().y),
);
}
response.response.on_hover_text(app.tr("ui.graphics_preset_help"));
});
ui_kit::text(ui, app.tr("prefs.graphics_presets_note"), ui_kit::Text::Hint("preset"));
ui_kit::settings_section(ui, "quality", app.tr("prefs.curved_surfaces"), |ui| {
use solidcraft_engine::doc::display_quality::DisplayQuality;
ui_kit::text(ui, app.tr("ui.display_quality"), ui_kit::Text::Heading("display_quality"));
let current = DisplayQuality::parse(&app.preferences.display_quality).unwrap_or_default();
ui.horizontal_wrapped(|ui| {
for ((q, facets), note) in DisplayQuality::ALL.into_iter().zip([5, 8, 14, 64]).zip([
"prefs.quality_fastest",
"prefs.quality_default",
"prefs.quality_smoother",
"prefs.quality_slowest",
]) {
if ui_kit::option_card(
ui,
crate::i18n::tr(&format!("ui.display_quality_{}", q.id())),
Some(app.tr(note)),
current == q,
true,
ui_kit::PreferenceFigure::Quality(facets),
)
.clicked()
{
app.preferences.display_quality = q.id().into();
});
ui_kit::settings_section(ui, "edges", app.tr("prefs.edges"), |ui| {
ui.horizontal_wrapped(|ui| {
ui_kit::text(ui, app.tr("ui.anti_aliasing"), ui_kit::Text::Heading("antialiasing"));
ui_kit::settings_badge(ui, app.tr("prefs.graphics_page.restart"), true);
ui_kit::help_icon(ui, app.tr("settings.msaa_applies_on_restart"));
});
let figures: [fn(&egui::Painter, egui::Rect); 4] = [
|p, r| paint_graphics_figure(p, r, PreferenceFigure::Antialiasing(1)),
|p, r| paint_graphics_figure(p, r, PreferenceFigure::Antialiasing(2)),
|p, r| paint_graphics_figure(p, r, PreferenceFigure::Antialiasing(4)),
|p, r| paint_graphics_figure(p, r, PreferenceFigure::Antialiasing(8)),
];
ui.horizontal_wrapped(|ui| {
ui.spacing_mut().item_spacing = egui::vec2(t.space_10, t.space_10);
for (m, figure) in MSAA.into_iter().zip(figures) {
let enabled = app.msaa_supported.is_empty() || app.msaa_supported.contains(&m);
let label = if m == 1 { app.tr("ui.colour_vision_off").to_owned() } else { format!("{m}×") };
let response = ui_kit::picture_card(
ui,
&ui_kit::Card {
label: &label,
sub: Some(if enabled { "" } else { app.tr("prefs.not_on_gpu") }),
selected: app.preferences.msaa == m,
enabled,
options: None,
check: app.preferences.msaa == m,
aspect: 120.0 / 64.0,
figure: &figure,
},
(t.space_24 * 5.0 + t.space_10).min(ui.max_rect().width()),
)
.on_hover_text(app.tr("settings.msaa_applies_on_restart"))
.on_disabled_hover_text(app.tr("settings.msaa_applies_on_restart"));
crate::scenario::publish_target(&format!("prefs:msaa:{m}"), response.rect);
crate::scenario::publish_target(&format!("prefs:option:{label}"), response.rect);
if enabled && response.clicked() {
app.preferences.msaa = m;
}
}
});
if app.msaa_compatibility {
ui_kit::text(ui, app.tr("prefs.anti_aliasing_amd_dx12"), ui_kit::Text::Hint("msaa_compatibility"));
}
});
ui_kit::text(ui, app.tr("settings.display_quality_note"), ui_kit::Text::Hint("quality"));
});
ui_kit::settings_section(ui, "edges", app.tr("prefs.edges"), |ui| {
ui.horizontal(|ui| {
ui_kit::text(ui, app.tr("ui.anti_aliasing"), ui_kit::Text::Heading("antialiasing"));
ui_kit::settings_badge(ui, app.tr("prefs.applies_on_restart"), true);
});
ui.horizontal_wrapped(|ui| {
for m in MSAA {
let enabled = app.msaa_supported.is_empty() || app.msaa_supported.contains(&m);
let label = if m == 1 { app.tr("ui.colour_vision_off").to_owned() } else { format!("{m}×") };
let response = ui_kit::option_card(
ui,
&label,
if enabled { None } else { Some(app.tr("prefs.not_on_gpu")) },
app.preferences.msaa == m,
enabled,
ui_kit::PreferenceFigure::Antialiasing(m),
)
.on_hover_text(app.tr("settings.msaa_applies_on_restart"));
crate::scenario::publish_target(&format!("prefs:msaa:{m}"), response.rect);
if enabled && response.clicked() {
app.preferences.msaa = m;
ui_kit::settings_form(ui, help_label_width, |ui| {
ui_kit::settings_row_help(ui, app.tr("prefs.graphics_page.supersampling"), app.tr("settings.supersampling_note"), |ui| {
let mut selected = SUPERSAMPLING.iter().position(|f| *f == app.preferences.supersampling).unwrap_or(0);
if ui_kit::segmented(
ui,
&mut selected,
&[app.tr("ui.colour_vision_off"), "1.5×", "2×"],
ui_kit::Segments {
targets: &["prefs:supersampling:1", "prefs:supersampling:1.5", "prefs:supersampling:2"],
..Default::default()
},
) && let Some(factor) = SUPERSAMPLING.get(selected)
{
app.preferences.supersampling = *factor;
}
});
let label = app.tr("prefs.graphics_page.supersampling");
if let Some(rect) = crate::scenario::rect_of(&format!("dialog:{label}")) {
crate::scenario::publish_target("dialog:Supersampling (SSAA)", rect);
}
}
});
ui_kit::text(ui, app.tr("prefs.anti_aliasing_note"), ui_kit::Text::Hint("msaa"));
if app.msaa_compatibility {
ui_kit::text(ui, app.tr("prefs.anti_aliasing_amd_dx12"), ui_kit::Text::Hint("msaa_compatibility"));
}
ui.add_space(t.space_6);
ui_kit::text(ui, app.tr("ui.supersampling"), ui_kit::Text::Heading("supersampling"));
ui.horizontal_wrapped(|ui| {
ui.allocate_ui_with_layout(egui::vec2(t.form_card_width - t.space_24, 0.0), egui::Layout::top_down(egui::Align::Min), |ui| {
let mut selected = SUPERSAMPLING.iter().position(|f| *f == app.preferences.supersampling).unwrap_or(0);
if ui_kit::segmented(ui, &mut selected, &[app.tr("ui.colour_vision_off"), "1.5×", "2×"], ui_kit::Segments::default())
&& let Some(factor) = SUPERSAMPLING.get(selected)
{
app.preferences.supersampling = *factor;
for (option, legacy) in [(app.tr("ui.colour_vision_off"), "Off"), ("1.5×", "1.5×"), ("2×", "2×")] {
if let Some(rect) = crate::scenario::rect_of(&format!("dialog:{label}:{option}")) {
crate::scenario::publish_target(&format!("dialog:Supersampling (SSAA):{legacy}"), rect);
}
}
});
ui.add_enabled_ui(app.preferences.supersampling > 1.0, |ui| {
setting::supersampling_adaptive(app, ui);
let response = setting::supersampling_adaptive(app, ui);
crate::scenario::publish_target("prefs:supersampling_adaptive", response.rect);
crate::scenario::publish_target("dialog:Only when the view is still", response.rect);
});
let response = setting::dark_parts_shading(app, ui).on_hover_text(app.tr("prefs.dark_parts_shading_help"));
crate::scenario::publish_target("prefs:dark_parts_shading", response.rect);
});
ui_kit::settings_section(ui, "current_view", app.tr("prefs.graphics_page.current_view"), |ui| {
ui_kit::settings_badge(ui, app.tr("prefs.graphics_page.view_bar"), false);
let width = ((ui.available_width() - t.space_10 * 3.0) / 4.0).max(t.space_24 * 5.0 + t.space_10).min(ui.available_width());
let tiles: [(_, _, _, fn(&egui::Painter, egui::Rect)); 4] = [
("grid", "navbar.grid", app.ui.show_grid, ui_kit::paint_view_grid),
("ground_shadow", "ui.ground_shadow", app.ui.ground_shadow, ui_kit::paint_view_shadow),
("perspective", "navbar.perspective", app.ui.perspective, ui_kit::paint_view_perspective),
("ambient_occlusion", "ui.ambient_occlusion", app.preferences.ambient_occlusion, |p, r| {
paint_graphics_figure(p, r, PreferenceFigure::ContactShading(true));
}),
];
ui.horizontal_wrapped(|ui| {
ui.spacing_mut().item_spacing = egui::vec2(t.space_10, t.space_10);
for (id, label, selected, figure) in tiles {
let response = ui_kit::toggle_tile(
ui,
&ui_kit::Card {
label: app.tr(label),
sub: None,
selected,
enabled: true,
options: None,
check: false,
aspect: 120.0 / 64.0,
figure: &figure,
},
width,
);
crate::scenario::publish_target(&format!("prefs:{id}"), response.rect);
crate::scenario::publish_target(&format!("view:{id}"), response.rect);
if response.clicked() {
match id {
"grid" => app.ui.show_grid = !selected,
"ground_shadow" => app.ui.ground_shadow = !selected,
"perspective" => app.ui.perspective = !selected,
_ => {
let _ = app.run("view.ambient_occlusion", json!({"enabled":!selected}));
}
}
}
}
});
ui_kit::settings_form(ui, t.form_label_width + t.space_24, |ui| {
ui_kit::row(ui, app.tr_label("Visual style"), |ui| {
let options = crate::navigation_bar::VISUAL_STYLES.map(|(_, label)| crate::i18n::tr_label(label));
let choices: Vec<_> =
options.into_iter().zip(["style_shaded_edges", "style_shaded", "style_wireframe", "style_hidden_edges"]).collect();
let mut selected = usize::from(app.ui.visual_style.min(3));
let before = selected;
let response = ui
.allocate_ui_with_layout(
egui::vec2((t.space_24 * 10.0).min(ui.available_width()), t.control_height),
egui::Layout::top_down(egui::Align::Min),
|ui| ui_kit::dropdown_icons(ui, "pref_style", &mut selected, &choices),
)
.inner;
crate::scenario::publish_target("prefs:visual_style", response.rect);
if selected != before
&& let Some((style, _)) = crate::navigation_bar::VISUAL_STYLES.get(selected)
{
let _ = app.run("view.visual_style", json!({"style":style}));
}
});
ui.add_enabled_ui(app.ui.perspective || app.ui.auto_ortho_faces, |ui| field_of_view_row(app, ui));
});
});
ui_kit::text(ui, app.tr("prefs.supersampling_brief"), ui_kit::Text::Hint("supersampling"))
.on_hover_text(app.tr("settings.supersampling_note"));
ui.add_space(t.space_6);
ui_kit::text(ui, app.tr_label("Ambient occlusion"), ui_kit::Text::Heading("contact_shading"));
ui.horizontal_wrapped(|ui| {
for (on, label) in [(false, "ui.colour_vision_off"), (true, "prefs.contact_shading")] {
let response = ui_kit::option_card(
ui_kit::settings_section(ui, "in_view", app.tr("prefs.graphics_page.in_view"), |ui| {
let width = ((ui.available_width() - t.space_10 * 3.0) / 4.0).max(t.space_24 * 5.0 + t.space_10).min(ui.available_width());
let tiles: [(_, _, _, _, fn(&egui::Painter, egui::Rect)); 4] = [
("show_view_angles", "ui.view_angles", "ui.view_angles_help", app.preferences.show_view_angles, ui_kit::paint_view_angles),
(
"vertex_markers",
"Vertex markers",
"Show a small dot at every vertex wherever edges are drawn",
app.preferences.vertex_markers,
ui_kit::paint_vertex_markers,
),
(
"quick_measure",
"prefs.graphics_page.quick_measure",
"prefs.quick_measure_note",
app.preferences.quick_measure,
ui_kit::paint_quick_measure,
),
("show_frame_rate", "ui.frame_rate", "settings.frame_rate_note", app.preferences.show_frame_rate, ui_kit::paint_frame_rate),
];
ui.horizontal_wrapped(|ui| {
ui.spacing_mut().item_spacing = egui::vec2(t.space_10, t.space_10);
for (id, label, help, selected, figure) in tiles {
let label = if id == "vertex_markers" { app.tr_label(label) } else { app.tr(label) };
let help = if id == "vertex_markers" { app.tr_label(help) } else { app.tr(help) };
let response = ui_kit::toggle_tile(
ui,
&ui_kit::Card {
label,
sub: None,
selected,
enabled: true,
options: None,
check: false,
aspect: 120.0 / 64.0,
figure: &figure,
},
width,
)
.on_hover_text(help);
crate::scenario::publish_target(&format!("prefs:{id}"), response.rect);
crate::scenario::publish_target(&format!("dialog:{label}"), response.rect);
if id == "quick_measure" {
crate::scenario::publish_target(&format!("dialog:{}", app.tr("prefs.quick_measure")), response.rect);
}
if id == "show_view_angles" {
crate::scenario::publish_target("view:view_angles", response.rect);
}
if response.clicked() {
match id {
"show_view_angles" => {
let _ = app.run("view.angle_readout", json!({"enabled":!selected}));
}
"vertex_markers" => app.preferences.vertex_markers = !selected,
"quick_measure" => app.preferences.quick_measure = !selected,
_ => app.preferences.show_frame_rate = !selected,
}
}
}
});
ui.add_enabled_ui(app.preferences.show_frame_rate, |ui| {
let response = ui_kit::checkbox(ui, app.tr("ui.frame_rate_details"), &mut app.preferences.frame_rate_details)
.on_hover_text(app.tr("settings.frame_rate_details_note"));
crate::scenario::publish_target("prefs:frame_rate_details", response.rect);
});
let profile = setting::profile_operations(app, ui).on_hover_text(app.tr("prefs.profile_operations_note"));
crate::scenario::publish_target("prefs:profile_operations", profile.rect);
ui.horizontal_wrapped(|ui| {
ui_kit::settings_inline_note(ui, app.tr("prefs.graphics_page.status_chips"));
for (id, label, help) in [
("viewport_analysis_status", "ui.analysis", "prefs.viewport_analysis_status_help"),
("viewport_section_status", "Section", "prefs.viewport_section_status_help"),
("viewport_status_details", "prefs.graphics_page.live_details", "prefs.viewport_status_details_help"),
("viewport_status_summary", "prefs.graphics_page.fold_items", "prefs.viewport_status_summary_help"),
] {
let value = match id {
"viewport_analysis_status" => &mut app.preferences.viewport_analysis_status,
"viewport_section_status" => &mut app.preferences.viewport_section_status,
"viewport_status_details" => &mut app.preferences.viewport_status_details,
_ => &mut app.preferences.viewport_status_summary,
};
let response = ui_kit::choice_chip(
ui,
id,
if id == "viewport_section_status" { crate::i18n::tr_label(label) } else { crate::i18n::tr(label) },
*value,
)
.on_hover_text(crate::i18n::tr(help));
crate::scenario::publish_target(&format!("prefs:{id}"), response.rect);
if response.clicked() {
*value = !*value;
}
}
});
});
ui_kit::settings_section(ui, "surfaces_edges", app.tr("prefs.graphics_page.surfaces_edges"), |ui| {
let response = ui_kit::checkbox(ui, app.tr("ui.cosmetic_thread_markings"), &mut app.preferences.cosmetic_threads)
.on_hover_text(app.tr("ui.cosmetic_thread_markings_help"));
crate::scenario::publish_target("prefs:cosmetic_threads", response.rect);
setting::sketch_halo(app, ui);
ui_kit::row(ui, app.tr("prefs.section_hatch"), |ui| {
let styles = [crate::prefs::SectionHatch::One, crate::prefs::SectionHatch::ByPart];
let mut selected = styles.iter().position(|s| *s == app.preferences.section_hatch).unwrap_or(1);
if ui_kit::segmented(
ui,
app.tr(label),
None,
app.preferences.ambient_occlusion == on,
true,
ui_kit::PreferenceFigure::ContactShading(on),
);
if on != app.preferences.ambient_occlusion {
crate::scenario::publish_handle("view:ambient_occlusion", response.rect.center());
&mut selected,
&[app.tr("prefs.section_hatch_one"), app.tr("prefs.section_hatch_by_part")],
Default::default(),
) && let Some(style) = styles.get(selected)
{
app.preferences.section_hatch = *style;
}
if response.clicked() {
let _ = app.run("view.ambient_occlusion", json!({"enabled":on}));
});
let tint_new = setting::preview_tint_new_faces(app, ui).on_hover_text(app.tr("prefs.preview_tint_new_faces_help"));
crate::scenario::publish_target("prefs:preview_tint_new_faces", tint_new.rect);
let cut_tint = setting::cut_preview_tint(app, ui).on_hover_text(app.tr("prefs.cut_preview_tint_help"));
crate::scenario::publish_target("prefs:cut_preview_tint", cut_tint.rect);
let reference =
setting::reference_geometry_through_bodies(app, ui).on_hover_text(app.tr("settings.reference_geometry_through_bodies_help"));
crate::scenario::publish_target("dialog:Show reference geometry through bodies", reference.rect);
ui.add_enabled_ui(app.ui.show_grid, |ui| {
setting::grid_follows_view(app, ui).on_hover_text(app.tr("ui.grid_follows_view_hint"));
});
let response = setting::single_surface_analysis(app, ui).on_hover_text(app.tr("prefs.single_surface_analysis_help"));
crate::scenario::publish_target("prefs:single_surface_analysis", response.rect);
crate::scenario::publish_target("dialog:Use a single surface analysis", response.rect);
if response.changed() {
sync_surface_analysis(app);
}
});
ui_kit::settings_section(ui, "computer", app.tr("prefs.general.this_computer"), |ui| {
computer_card(ui, |ui| {
computer_header(app, ui);
if let Some(note) = &app.graphics_fallback {
ui_kit::text(ui, note, ui_kit::Text::Hint("graphics_fallback"));
}
}
});
ui_kit::text(ui, app.tr("prefs.contact_shading_note"), ui_kit::Text::Hint("ao"));
let response = setting::dark_parts_shading(app, ui).on_hover_text(app.tr("prefs.dark_parts_shading_help"));
crate::scenario::publish_handle("prefs:dark_parts_shading", response.rect.center());
});
ui_kit::settings_section(ui, "viewport", app.tr("prefs.viewport"), |ui| {
let analysis_policy = setting::single_surface_analysis(app, ui).on_hover_text(app.tr("prefs.single_surface_analysis_help"));
crate::scenario::publish_target("prefs:single_surface_analysis", analysis_policy.rect);
if analysis_policy.changed() {
sync_surface_analysis(app);
}
let response = ui_kit::checkbox(ui, app.tr("ui.cosmetic_thread_markings"), &mut app.preferences.cosmetic_threads)
.on_hover_text(app.tr("ui.cosmetic_thread_markings_help"));
crate::scenario::publish_handle("prefs:cosmetic_threads", response.rect.center());
ui_kit::row(ui, app.tr("prefs.section_hatch"), |ui| {
let styles = [crate::prefs::SectionHatch::One, crate::prefs::SectionHatch::ByPart];
let mut selected = styles.iter().position(|s| *s == app.preferences.section_hatch).unwrap_or(1);
if ui_kit::segmented(ui, &mut selected, &[app.tr("prefs.section_hatch_one"), app.tr("prefs.section_hatch_by_part")], Default::default())
&& let Some(style) = styles.get(selected)
{
app.preferences.section_hatch = *style;
}
});
ui.columns(2, |columns| {
if let Some(left) = columns.get_mut(0) {
ui_kit::checkbox(left, crate::i18n::tr_label("Grid"), &mut app.ui.show_grid);
ui_kit::checkbox(left, crate::i18n::tr_label("Perspective view"), &mut app.ui.perspective);
left.add_enabled_ui(app.ui.perspective || app.ui.auto_ortho_faces, |ui| field_of_view_row(app, ui));
setting::show_frame_rate(app, left).on_hover_text(app.tr("settings.frame_rate_note"));
left.add_enabled_ui(app.preferences.show_frame_rate, |ui| {
ui_kit::checkbox(ui, app.tr("ui.frame_rate_details"), &mut app.preferences.frame_rate_details)
.on_hover_text(app.tr("settings.frame_rate_details_note"));
});
setting::profile_operations(app, left).on_hover_text(app.tr("prefs.profile_operations_note"));
crate::prefs::view_angles_checkbox(app, left);
setting::reference_geometry_through_bodies(app, left).on_hover_text(app.tr("settings.reference_geometry_through_bodies_help"));
let tint_new = setting::preview_tint_new_faces(app, left).on_hover_text(app.tr("prefs.preview_tint_new_faces_help"));
crate::scenario::publish_target("prefs:preview_tint_new_faces", tint_new.rect);
let cut_tint = setting::cut_preview_tint(app, left).on_hover_text(app.tr("prefs.cut_preview_tint_help"));
crate::scenario::publish_target("prefs:cut_preview_tint", cut_tint.rect);
setting::sketch_halo(app, left);
setting::vertex_markers(app, left);
}
if let Some(right) = columns.get_mut(1) {
ui_kit::checkbox(right, crate::i18n::tr_label("Ground shadow"), &mut app.ui.ground_shadow);
right.add_enabled_ui(app.ui.show_grid, |ui| {
setting::grid_follows_view(app, ui);
});
}
});
ui_kit::settings_form(ui, t.space_24 * 6.0 + t.space_6, |ui| {
ui_kit::row(ui, "", |ui| {
let check = setting::quick_measure(app, ui).on_hover_text(app.tr("prefs.quick_measure_note"));
crate::scenario::publish_target("prefs:quick_measure", check.rect);
});
ui_kit::row(ui, "", |ui| {
let check = setting::viewport_analysis_status(app, ui).on_hover_text(app.tr("prefs.viewport_analysis_status_help"));
crate::scenario::publish_target("prefs:viewport_analysis_status", check.rect);
});
ui_kit::row(ui, "", |ui| {
let check = setting::viewport_section_status(app, ui).on_hover_text(app.tr("prefs.viewport_section_status_help"));
crate::scenario::publish_target("prefs:viewport_section_status", check.rect);
});
ui_kit::row(ui, "", |ui| {
let check = setting::viewport_status_details(app, ui).on_hover_text(app.tr("prefs.viewport_status_details_help"));
crate::scenario::publish_target("prefs:viewport_status_details", check.rect);
});
ui_kit::row(ui, "", |ui| {
let check = setting::viewport_status_summary(app, ui).on_hover_text(app.tr("prefs.viewport_status_summary_help"));
crate::scenario::publish_target("prefs:viewport_status_summary", check.rect);
});
ui_kit::row(ui, app.tr_label("Visual style"), |ui| {
let mut selected = usize::from(app.ui.visual_style.min(3));
ui_kit::dropdown(ui, "pref_style", &mut selected, &["Shaded with edges", "Shaded", "Wireframe", "Shaded with hidden edges"]);
app.ui.visual_style = selected as u8;
if app.services.graphics_path.is_some() {
graphics_card_row(app, ui, help_label_width);
}
#[cfg(target_os = "linux")]
window_system_row(app, ui, help_label_width);
setting::render_previous_geometry_budget(app, ui).on_hover_text(app.tr("prefs.render_previous_geometry_budget_help"));
});
});
});
#[cfg(target_os = "linux")]
ui_kit::settings_section(ui, "window_system", app.tr("ui.window_system"), |ui| window_system_row(app, ui));
setting::render_previous_geometry_budget(app, ui).on_hover_text(app.tr("prefs.render_previous_geometry_budget_help"));
ui.horizontal(|ui| {
ui_kit::text(ui, app.tr_label("Renderer"), ui_kit::Text::Inline);
let renderer = match (&app.viewport.gpu, &app.help.gpu) {
(Some(_), Some(g)) => {
ui_kit::settings_badge(ui, "GPU", false);
g.to_owned()
}
(Some(_), None) => "GPU".into(),
_ => crate::i18n::tr("prefs.cpu").into(),
};
ui_kit::text(ui, &renderer, ui_kit::Text::Inline);
});
}
/// Graphics uses the refined canonical pictures while retaining the shared legacy figure API.
fn paint_graphics_figure(p: &egui::Painter, rect: egui::Rect, figure: PreferenceFigure) {
let paint: fn(&egui::Painter, egui::Rect) = match figure {
PreferenceFigure::Quality(8) => ui_kit::paint_tess_coarse,
PreferenceFigure::Quality(16) => ui_kit::paint_tess_normal,
PreferenceFigure::Quality(32) => ui_kit::paint_tess_fine,
PreferenceFigure::Quality(64) => ui_kit::paint_tess_ultra,
PreferenceFigure::Antialiasing(1) => ui_kit::paint_aa_off,
PreferenceFigure::Antialiasing(2) => ui_kit::paint_aa_2x,
PreferenceFigure::Antialiasing(4) => ui_kit::paint_aa_4x,
PreferenceFigure::Antialiasing(8) => ui_kit::paint_aa_8x,
PreferenceFigure::ContactShading(true) => ui_kit::paint_ao_on,
_ => {
ui_kit::paint_preference_figure(p, rect, figure, true);
return;
}
};
paint(p, rect);
}
/// One stroked glyph of a preset card on the design's 24 x 24 grid: a bolt, a gem or three sliders.
fn paint_preset_glyph(p: &egui::Painter, rect: egui::Rect, preset: &str, ink: egui::Color32) {
let s = rect.width().min(rect.height()) / 24.0;
let at = |x: f32, y: f32| rect.center() + egui::vec2(x - 12.0, y - 12.0) * s;
let stroke = egui::Stroke::new(1.9 * s, ink);
let line = |points: &[(f32, f32)], closed: bool| {
let points: Vec<egui::Pos2> = points.iter().map(|&(x, y)| at(x, y)).collect();
p.add(if closed { egui::epaint::PathShape::closed_line(points, stroke) } else { egui::epaint::PathShape::line(points, stroke) });
};
match preset {
"performance" => line(&[(13.0, 3.0), (5.0, 13.0), (11.0, 13.0), (10.0, 21.0), (18.0, 11.0), (12.0, 11.0)], true),
"quality" => {
line(&[(6.0, 4.0), (18.0, 4.0), (21.0, 9.0), (12.0, 20.0), (3.0, 9.0)], true);
line(&[(3.0, 9.0), (21.0, 9.0)], false);
line(&[(9.0, 4.0), (12.0, 20.0), (15.0, 4.0)], false);
}
_ => {
for (y, knob) in [(6.0, 9.0), (12.0, 15.0), (18.0, 8.0)] {
line(&[(5.0, y), (19.0, y)], false);
p.circle_filled(at(knob, y), 2.0 * s, ink);
}
}
}
}
/// The monitor on the device tile, on the same grid.
fn paint_monitor(p: &egui::Painter, rect: egui::Rect, ink: egui::Color32) {
let s = rect.width().min(rect.height()) / 24.0;
let at = |x: f32, y: f32| rect.center() + egui::vec2(x - 12.0, y - 12.0) * s;
let stroke = egui::Stroke::new(1.8 * s, ink);
p.rect_stroke(egui::Rect::from_two_pos(at(3.0, 4.0), at(21.0, 16.0)), 2.0 * s, stroke, egui::StrokeKind::Middle);
p.line_segment([at(8.0, 20.0), at(16.0, 20.0)], stroke);
p.line_segment([at(12.0, 16.0), at(12.0, 20.0)], stroke);
}
/// The section's card: one grey surface holding the device, its pickers and its checkbox. A search
/// shows the rows without it, like every other card.
fn computer_card(ui: &mut egui::Ui, add: impl FnOnce(&mut egui::Ui)) {
let t = Tokens::get();
if crate::prefs_search::suppress_chrome(ui) {
add(ui);
return;
}
egui::Frame::NONE
.fill(t.pref_well)
.stroke(egui::Stroke::new(1.0, t.dialog_border))
.corner_radius(f32::from(t.radius_lg) + t.space_2)
.inner_margin(egui::Margin::same(t.space_14 as i8))
.show(ui, |ui| {
ui.set_width(ui.available_width());
ui.spacing_mut().item_spacing.y = t.space_12;
add(ui);
});
}
/// The device line: a tile with a monitor, the adapter's name, its backend and renderer, and a badge.
fn computer_header(app: &SolveApp, ui: &mut egui::Ui) {
let t = Tokens::get();
let adapter = app.viewport.adapter.as_str();
let (backend, name) = adapter.split_once(" · ").unwrap_or(("", adapter));
let renderer_kind = if app.viewport.gpu.is_some() { "GPU" } else { app.tr("prefs.cpu") };
let renderer_details = match (&app.viewport.gpu, &app.help.gpu) {
(Some(_), Some(g)) => g.as_str(),
_ => renderer_kind,
};
let renderer = format!("{renderer_kind} {}", app.tr_label("Renderer").to_lowercase());
// Without an adapter name (a software renderer reports none) the title is the renderer itself.
let (name, line) = if name.is_empty() {
(app.tr_label("Renderer"), renderer_kind.to_owned())
} else if backend.is_empty() {
(name, renderer)
} else {
(name, format!("{backend} · {renderer}"))
};
let tile = t.space_24 + t.space_12;
ui.allocate_ui_with_layout(egui::vec2(ui.available_width(), tile), egui::Layout::right_to_left(egui::Align::Center), |ui| {
ui.spacing_mut().item_spacing.x = t.space_12;
ui_kit::settings_badge(ui, renderer_kind, app.viewport.gpu.is_none());
ui.with_layout(egui::Layout::left_to_right(egui::Align::Center), |ui| {
let (rect, _) = ui.allocate_exact_size(egui::vec2(tile, tile), egui::Sense::hover());
ui.painter().rect_filled(rect, f32::from(t.radius_lg) + t.space_2 * 0.5, t.selected_bg);
paint_monitor(ui.painter(), egui::Rect::from_center_size(rect.center(), rect.size() * 0.56), t.form_primary);
ui.vertical(|ui| {
ui.spacing_mut().item_spacing.y = 1.0;
ui_kit::text(ui, name, ui_kit::Text::NameCell(true)).on_hover_text(adapter);
ui.label(egui::RichText::new(line).monospace().size(t.font_small).color(t.form_dim)).on_hover_text(renderer_details);
});
});
});
}
/// The saved adapter picker retains validation, persistence and all fallback notices.
fn graphics_card_row(app: &mut SolveApp, ui: &mut egui::Ui, label_width: f32) {
let t = Tokens::get();
let selected = app.services.graphics_adapters.iter().position(|(name, _)| *name == app.preferences.graphics_adapter);
let missing = !app.preferences.graphics_adapter.is_empty() && selected.is_none();
let row_width = (label_width + t.space_14 + t.space_24 * 10.0).min(ui.available_width());
ui.horizontal_wrapped(|ui| {
ui.allocate_ui_with_layout(egui::vec2(row_width, t.control_height), egui::Layout::top_down(egui::Align::Min), |ui| {
ui_kit::settings_form(ui, label_width, |ui| {
ui_kit::settings_row_help(ui, app.tr("prefs.graphics_card"), app.tr("prefs.graphics_card_restart"), |ui| {
ui.allocate_ui_with_layout(
egui::vec2((t.space_24 * 10.0).min(ui.available_width()), t.control_height),
egui::Layout::top_down(egui::Align::Min),
|ui| {
let adapters = &app.services.graphics_adapters;
let selected = adapters.iter().position(|(name, _)| *name == app.preferences.graphics_adapter);
let current =
selected.and_then(|i| adapters.get(i)).map_or(app.tr("prefs.graphics_card_auto"), |(_, label)| label.as_str());
let mut requested = None;
let response = ui_kit::dropdown_menu(ui, "graphics_card", current, |ui| {
if ui_kit::list_picker(ui, "graphics_card:auto", app.tr("prefs.graphics_card_auto"), selected.is_none()).clicked() {
requested = Some(String::new());
}
for (index, (name, label)) in adapters.iter().enumerate() {
if ui_kit::list_picker(ui, &format!("graphics_card:{index}"), label, selected == Some(index)).clicked() {
requested = Some(name.clone());
}
}
});
crate::scenario::publish_target("prefs:graphics_card", response.rect);
if let Some(name) = requested {
let _ = super::set(app, &json!({"graphics_adapter": name}));
}
},
);
});
});
});
ui_kit::settings_badge(ui, app.tr("prefs.graphics_page.restart"), true);
});
if missing {
ui_kit::text(ui, app.tr("prefs.graphics_card_missing"), ui_kit::Text::Hint("graphics_card_missing"));
} else if !app.preferences.graphics_adapter.is_empty() {
// Status / Help show the adapter actually in use; the dropdown shows the saved
// preference. When they differ the saved card was not applied (#8341).
let active = app.viewport.adapter.rsplit(" · ").next().unwrap_or("");
if !active.is_empty() && !active.eq_ignore_ascii_case(&app.preferences.graphics_adapter) {
ui_kit::text(ui, app.tr("prefs.graphics_card_unused"), ui_kit::Text::Hint("graphics_card_unused"));
}
}
}
/// Perspective view's Field of view (#5364): the kit slider in degrees, typed or dragged, kept to
/// whole degrees and written back in radians. No step on the slider itself: it would round the
/// default 0.6 (34.4°) just by being drawn, so an untouched angle stays exactly as saved.
+50
View File
@@ -565,6 +565,17 @@ fn keywords(text: &str) -> &'static [&'static str] {
match fold(text).as_str() {
"theme" => &["dark", "light", "appearance"],
"anti-aliasing" | "antialiasing" => &["antialiasing", "msaa"],
"curved surfaces" => &["display quality"],
"perspective" => &["perspective view"],
"quick measurement" => &["quick measurement in the view's corner"],
"analysis" => &["show viewport analysis status"],
"section" => &["show viewport section status"],
"live details" => &["live viewport details"],
"fold items" => &["fold viewport status items"],
"reference geometry through bodies" => &["show reference geometry through bodies"],
"single surface analysis" => &["use a single surface analysis"],
"only while the view is still" => &["only when the view is still"],
"supersampling" => &["supersampling (ssaa)"],
_ => &[],
}
}
@@ -740,6 +751,45 @@ pub(crate) fn follow(ui: &Ui, label: &str, rect: Rect) {
mod tests {
use super::*;
#[test]
fn graphics_cards_tiles_and_short_status_labels_keep_search_paths_and_reveal() {
for theme in ["light", "dark"] {
let mut h = crate::scenario::Harness::new();
h.app.home.open = false;
h.call("ui.prefs", serde_json::json!({"theme":theme,"language":"en"}));
h.call("ui.prefs", serde_json::json!({"open":"Graphics"}));
for (query, label, handle) in [
("Display quality", "Curved surfaces", "prefs:display_quality:normal"),
("MSAA", "Anti-aliasing", "prefs:msaa:4"),
("Ambient occlusion", "Ambient occlusion", "prefs:ambient_occlusion"),
("Profile operations", "Profile operations", "prefs:profile_operations"),
("Quick measurement in the view's corner", "Quick measurement", "prefs:quick_measure"),
("Show viewport analysis status", "Analysis", "prefs:viewport_analysis_status"),
("Show viewport section status", "Section", "prefs:viewport_section_status"),
("Live viewport details", "Live details", "prefs:viewport_status_details"),
("Fold viewport status items", "Fold items", "prefs:viewport_status_summary"),
] {
h.app.prefs_window.filter = query.into();
h.frames(5);
let (_, _, hits) = nav(&h.ctx);
let matching: Vec<_> =
hits.iter().enumerate().filter(|(_, hit)| hit.page == crate::prefs::PAGE_GRAPHICS && hit.label == label).collect();
assert_eq!(matching.len(), 1, "{theme}: {query} keeps one real Graphics search target");
let index = matching[0].0;
set_cursor(&h.ctx, index);
h.frames(2);
h.step(&serde_json::json!({"key":"Enter"})).unwrap();
// Enter restores the full page; let its normal scroll animation settle.
h.frames(20);
assert_eq!(h.app.prefs_window.section, crate::prefs::PAGE_GRAPHICS);
assert!(h.app.prefs_window.filter.is_empty());
let page = crate::scenario::rect_of("dialog:page_body").unwrap();
let target = crate::scenario::rect_of(handle).unwrap();
assert!(page.contains_rect(target), "{query} reveals the real control: page={page:?}, target={target:?}");
}
}
}
#[test]
fn appearance_controls_keep_one_search_result_and_their_page() {
use egui::accesskit::Role;
+3 -1
View File
@@ -248,7 +248,9 @@ fn actual_config_appearance_preferences_and_menu_boxes_and_ticks_match_at_1x_2x(
appearance.local.overwrite = true;
app.ui.pick_bodies = true;
if name == "preferences" {
crate::prefs::open_at(&mut app, crate::prefs::PAGE_GRAPHICS);
// Layout still contains the real shared checkboxes, including a checked default.
crate::prefs::open_at(&mut app, crate::prefs::PAGE_LAYOUT);
app.prefs_window.filter = app.tr("prefs.persistent_ribbon_pressed").to_string();
}
let mut textures = HashMap::new();
let mut final_output = None;
+19
View File
@@ -434,7 +434,26 @@ pub(crate) fn list_picker(ui: &mut Ui, key: &str, text: &str, selected: bool) ->
/// Intrinsic-width selection chip for horizontal lists, sharing list-picker styling.
pub(crate) fn choice_chip(ui: &mut Ui, key: &str, text: &str, selected: bool) -> egui::Response {
crate::prefs_search::note_unlabelled(ui, &[text]);
if crate::prefs_search::querying(ui) && !crate::prefs_search::visible(ui, &[text]) {
return crate::prefs_search::hidden_response(ui);
}
let t = Tokens::get();
if super::settings_page_active(ui) {
let font = if selected { crate::fonts::semibold(t.font_small) } else { egui::FontId::proportional(t.font_small) };
let width = ui.painter().layout_no_wrap(text.to_owned(), font.clone(), t.form_ink).size().x + t.space_16;
let response = ui.add_sized(
vec2(width.min(dimension(ui.max_rect().width())), t.space_24 - t.space_2),
egui::Button::selectable(selected, egui::RichText::new(text).font(font).color(if selected { t.selected_ink } else { t.form_ink }))
.fill(if selected { t.selected_bg } else { t.control_fill })
.stroke(egui::Stroke::new(1.0, if selected { t.form_primary } else { t.control_border }))
.corner_radius(t.radius_xl),
);
crate::prefs_search::remember(ui, text, response.rect);
crate::prefs_search::follow(ui, text, response.rect);
crate::scenario::publish_target(&format!("dialog:list:{key}"), response.rect);
return response;
}
if super::layout::in_catalog(ui) {
let accent = crate::theme::TabAccent::current(ui.ctx());
let width = ui.painter().layout_no_wrap(text.to_string(), crate::fonts::semibold(t.font_small), t.form_ink).size().x + t.space_16;
+54 -6
View File
@@ -730,6 +730,44 @@ pub(crate) fn dropdown(ui: &mut Ui, id: &str, selected: &mut usize, options: &[&
})
}
/// The standard dropdown with a leading application icon on the current value and each option.
/// The text job reserves the icon's space; the native combo and selectable items own interaction.
pub(crate) fn dropdown_icons(ui: &mut Ui, id: &str, selected: &mut usize, options: &[(&str, &str)]) -> Response {
let (text, icon) = options.get(*selected).copied().unwrap_or(("", ""));
let row = label(ui).to_owned();
dropdown_menu_width(ui, id, text, Some(icon), false, egui::PopupCloseBehavior::CloseOnClick, |ui| {
for (index, (text, icon)) in options.iter().enumerate() {
let response = ui.selectable_label(*selected == index, dropdown_icon_text(text));
paint_dropdown_icon(ui, response.rect, icon);
scenario::publish_target(&format!("dialog:{row}:{text}"), response.rect);
if response.clicked() {
*selected = index;
}
}
})
}
fn dropdown_icon_text(text: &str) -> egui::text::LayoutJob {
let t = Tokens::get();
let mut job = egui::text::LayoutJob::default();
job.append(
text,
t.space_16 + t.space_6,
egui::TextFormat { font_id: egui::FontId::proportional(t.font_label), color: t.form_ink, ..Default::default() },
);
job
}
fn paint_dropdown_icon(ui: &Ui, rect: egui::Rect, icon: &str) {
let t = Tokens::get();
let rect = egui::Rect::from_center_size(
egui::pos2(rect.left() + ui.spacing().button_padding.x + t.space_8, rect.center().y),
vec2(t.space_16, t.space_16),
);
crate::icons::paint_ink(ui.painter(), rect, icon, t.form_ink);
scenario::publish_rect(&format!("dialog:dropdown_icon:{icon}"), rect);
}
/// [`dropdown`] whose options each show a picture beside them while hovered, painted by `preview`
/// for that option's index, so a choice can be seen before it is picked. Tokens: dropdown tokens,
/// the tooltip frame.
@@ -779,18 +817,19 @@ pub(crate) fn dropdown_menu_with_close_behavior(
close_behavior: egui::PopupCloseBehavior,
add: impl FnOnce(&mut Ui),
) -> Response {
dropdown_menu_width(ui, id, current, false, close_behavior, add)
dropdown_menu_width(ui, id, current, None, false, close_behavior, add)
}
/// Intrinsic-width variant for horizontal toolbars and bottom strips.
pub(crate) fn compact_dropdown_menu(ui: &mut Ui, id: impl egui::AsIdSalt, current: &str, add: impl FnOnce(&mut Ui)) -> Response {
dropdown_menu_width(ui, id, current, true, egui::PopupCloseBehavior::CloseOnClick, add)
dropdown_menu_width(ui, id, current, None, true, egui::PopupCloseBehavior::CloseOnClick, add)
}
fn dropdown_menu_width(
ui: &mut Ui,
id: impl egui::AsIdSalt,
current: &str,
leading_icon: Option<&str>,
compact: bool,
close_behavior: egui::PopupCloseBehavior,
add: impl FnOnce(&mut Ui),
@@ -809,14 +848,23 @@ fn dropdown_menu_width(
} else {
dimension(ui.available_width())
};
let response = egui::ComboBox::from_id_salt(id)
let selected_text = if leading_icon.is_some() { egui::WidgetText::from(dropdown_icon_text(current)) } else { current.into() };
let popup = egui::ComboBox::from_id_salt(id)
.width(width)
.height(Tokens::get().space_24 * 14.0)
.selected_text(current)
.selected_text(selected_text)
.icon(dropdown_arrow)
.close_behavior(close_behavior)
.show_ui(ui, add)
.response;
.show_ui(ui, add);
let response = popup.response;
// The native popup closes on Escape; keep the same key from reaching the enclosing window.
// Only this dropdown's shown popup owns the key, and its trigger regains keyboard focus.
if popup.inner.is_some() && ui.input_mut(|input| input.consume_key(egui::Modifiers::NONE, egui::Key::Escape)) {
response.request_focus();
}
if let Some(icon) = leading_icon {
paint_dropdown_icon(ui, response.rect, icon);
}
publish(ui, &response, egui::WidgetType::ComboBox);
response
}
+90
View File
@@ -520,6 +520,96 @@ fn preference_dropdown_keeps_disabled_choices_inert_and_closes_after_selection()
assert_eq!(picked.get(), 8);
}
#[test]
fn dropdown_popups_own_escape_and_return_focus_without_canceling_the_window() {
use std::cell::Cell;
let previous = crate::theme::is_dark();
for dark in [false, true] {
crate::theme::set_dark(dark);
for kind in ["plain", "icons", "compact", "editable"] {
let ctx = crate::fonts::test_context();
let action = Cell::new(Action::None);
let trigger = Cell::new(None);
let selected = Cell::new(0);
let mut draw = |ui: &mut Ui| {
let ctx = ui.ctx().clone();
action.set(
Window::new(egui::Id::new(("dropdown_escape", kind)), "settings", "Preferences")
.cards(1.0)
.fields()
.actions("OK", "Cancel", None)
.show(&ctx, true, |ui| {
// An earlier, closed dropdown must not steal this popup's Escape or focus.
row(ui, "Units", |ui| {
dropdown(ui, "units", &mut 0, &["mm", "in"]);
});
row(ui, "Visual style", |ui| {
let options = crate::navigation_bar::VISUAL_STYLES.map(|(_, label)| label);
let icons = crate::navigation_bar::VISUAL_STYLES
.iter()
.enumerate()
.map(|(index, (_, label))| (*label, crate::navigation_bar::visual_style_icon(index as u8)))
.collect::<Vec<_>>();
let mut choice = selected.get();
let choices = |ui: &mut Ui| {
for (index, option) in options.iter().enumerate() {
let response = ui.selectable_label(selected.get() == index, *option);
scenario::publish_target(&format!("dialog:Visual style:{option}"), response.rect);
if response.clicked() {
selected.set(index);
}
}
};
let response = match kind {
"plain" => dropdown(ui, "styles", &mut choice, &options),
"icons" => dropdown_icons(ui, "styles", &mut choice, &icons),
"compact" => compact_dropdown_menu(ui, "styles", options[selected.get()], choices),
_ => dropdown_menu_with_close_behavior(
ui,
"styles",
options[selected.get()],
egui::PopupCloseBehavior::CloseOnClickOutside,
choices,
),
};
trigger.set(Some(response.id));
if matches!(kind, "plain" | "icons") {
selected.set(choice);
}
});
})
.1,
);
};
for _ in 0..3 {
frame(&ctx, vec![], &mut draw);
}
let at = scenario::handle_at("dialog:Visual style").unwrap();
frame(&ctx, pointer(at, true), &mut draw);
frame(&ctx, pointer(at, false), &mut draw);
frame(&ctx, vec![], &mut draw);
assert!(scenario::handle_at("dialog:Visual style:Wireframe").is_some(), "{kind}: popup opens");
frame(&ctx, key(egui::Key::Escape), &mut draw);
assert_eq!(action.get(), Action::None, "{kind}: first Escape belongs to the popup");
assert!(ctx.memory(|m| m.has_focus(trigger.get().unwrap())), "{kind}: Escape refocuses its own trigger");
frame(&ctx, vec![], &mut draw);
assert!(scenario::handle_at("dialog:Visual style:Wireframe").is_none());
frame(&ctx, key(egui::Key::Enter), &mut draw);
assert_eq!(action.get(), Action::None, "{kind}: Enter reopens rather than submitting");
frame(&ctx, vec![], &mut draw);
assert!(scenario::handle_at("dialog:Visual style:Wireframe").is_some(), "{kind}: focused trigger reopens on Enter");
frame(&ctx, key(egui::Key::Escape), &mut draw);
assert_eq!(action.get(), Action::None);
frame(&ctx, vec![], &mut draw);
assert!(scenario::handle_at("dialog:Visual style:Wireframe").is_none());
frame(&ctx, key(egui::Key::Escape), &mut draw);
assert_eq!(action.get(), Action::Cancel, "{kind}: Escape without a popup cancels normally");
assert_eq!(selected.get(), 0, "dismissal does not select an option");
}
}
crate::theme::set_dark(previous);
}
#[test]
fn secret_field_retains_focus_and_masks_paint_and_accessibility_events() {
let ctx = crate::fonts::test_context();
+74 -7
View File
@@ -741,15 +741,32 @@ const ELEMENTS: &[Element] = &[
}),
element!("preference_option_cards", |ui, _| {
ui.horizontal_wrapped(|ui| {
for figure in [
PreferenceFigure::Pivot(2),
PreferenceFigure::Quality(24),
PreferenceFigure::Antialiasing(8),
PreferenceFigure::ContactShading(true),
PreferenceFigure::UpAxis(true),
] {
for figure in [PreferenceFigure::Pivot(2), PreferenceFigure::UpAxis(true)] {
option_card(ui, "Choice", Some("Example"), true, true, figure);
}
let t = Tokens::get();
let width = t.space_24 * 5.0 + t.space_10;
for (label, figure) in [("Fine", paint_tess_fine as fn(&egui::Painter, egui::Rect)), ("8×", paint_aa_8x)] {
picture_card(
ui,
&Card { label, sub: None, selected: true, enabled: true, options: None, check: true, aspect: 120.0 / 64.0, figure: &figure },
width,
);
}
toggle_tile(
ui,
&Card {
label: "Ambient occlusion",
sub: None,
selected: true,
enabled: true,
options: None,
check: false,
aspect: 120.0 / 64.0,
figure: &paint_ao_on,
},
width,
);
});
}),
element!("settings_font_row", |ui, sample| {
@@ -1616,6 +1633,16 @@ const ELEMENTS: &[Element] = &[
dropdown(ui, "gallery", &mut s.selected, &["One", "Two"]);
});
}),
element!("dropdown_icons", "dialog:row:Visual style", Some("dialog:Visual style"), |ui, s| {
row(ui, "Visual style", |ui| {
let options: Vec<_> = crate::navigation_bar::VISUAL_STYLES
.iter()
.enumerate()
.map(|(index, (_, label))| (*label, crate::navigation_bar::visual_style_icon(index as u8)))
.collect();
dropdown_icons(ui, "gallery_visual_style", &mut s.selected, &options);
});
}),
element!("dropdown_previews", "dialog:row:Gallery", Some("dialog:Gallery"), |ui, s| {
row(ui, "Gallery", |ui| {
dropdown_previews(ui, "gallery_previews", &mut s.selected, &["One", "Two"], |ui, index| {
@@ -1947,6 +1974,46 @@ fn every_element_has_geometry_and_stays_in_its_allocation_in_both_themes() {
crate::theme::set_dark(previous);
}
#[test]
fn visual_style_dropdown_specimen_selects_real_options_and_paints_their_icons() {
let previous = crate::theme::is_dark();
let element = ELEMENTS.iter().find(|element| element.name == "dropdown_icons").unwrap();
for dark in [false, true] {
crate::theme::set_dark(dark);
let ctx = crate::fonts::test_context();
let sample = std::cell::RefCell::new(Sample { value: String::new(), second: String::new(), selected: 0, checked: false });
let mut draw = |ui: &mut Ui| {
(element.draw)(ui, &mut sample.borrow_mut());
};
for _ in 0..3 {
super::test_support::frame(&ctx, vec![], &mut draw);
}
for (index, (_, label)) in crate::navigation_bar::VISUAL_STYLES.into_iter().enumerate() {
let trigger = scenario::handle_at("dialog:Visual style").unwrap();
super::test_support::frame(&ctx, super::test_support::pointer(trigger, true), &mut draw);
super::test_support::frame(&ctx, super::test_support::pointer(trigger, false), &mut draw);
super::test_support::frame(&ctx, vec![], &mut draw);
for (option, (_, name)) in crate::navigation_bar::VISUAL_STYLES.into_iter().enumerate() {
let rect = scenario::rect_of(&format!("dialog:Visual style:{name}")).unwrap();
let icon = crate::navigation_bar::visual_style_icon(option as u8);
let painted = scenario::rect_of(&format!("dialog:dropdown_icon:{icon}")).unwrap();
let owner = if option == sample.borrow().selected { scenario::rect_of("dialog:widget:Visual style").unwrap() } else { rect };
assert!(owner.contains_rect(painted), "{name}: its real icon is in its option or selected trigger");
}
let option = scenario::handle_at(&format!("dialog:Visual style:{label}")).unwrap();
super::test_support::frame(&ctx, super::test_support::pointer(option, true), &mut draw);
super::test_support::frame(&ctx, super::test_support::pointer(option, false), &mut draw);
super::test_support::frame(&ctx, vec![], &mut draw);
assert_eq!(sample.borrow().selected, index, "the specimen edits the real selection index");
let icon = crate::navigation_bar::visual_style_icon(index as u8);
let trigger = scenario::rect_of("dialog:widget:Visual style").unwrap();
assert!(trigger.contains_rect(scenario::rect_of(&format!("dialog:dropdown_icon:{icon}")).unwrap()));
assert!(scenario::handle_at("dialog:Visual style:Wireframe").is_none(), "the native popup closes after selection");
}
}
crate::theme::set_dark(previous);
}
#[test]
fn apply_does_not_submit_and_obeys_validation() {
for enabled in [false, true] {
+4
View File
@@ -93,6 +93,10 @@ pub(crate) use preferences::*;
pub(crate) use preferences_assistant::*;
#[allow(unused_imports, reason = "composed by the Preferences pages of #9875 to #9883")]
pub(crate) use preferences_cards::*;
pub(crate) use preferences_figure_data::{
paint_aa_2x, paint_aa_4x, paint_aa_8x, paint_aa_off, paint_ao_on, paint_frame_rate, paint_quick_measure, paint_tess_coarse, paint_tess_fine,
paint_tess_normal, paint_tess_ultra, paint_vertex_markers, paint_view_angles, paint_view_grid, paint_view_perspective, paint_view_shadow,
};
pub(crate) use preferences_figures::{ThemeSample, paint_theme_system, paint_theme_thumbnail};
pub(crate) use preferences_navigation::*;
pub(crate) use preferences_small::*;
+1 -1
View File
@@ -651,7 +651,7 @@ fn point(r: Rect, x: f32, y: f32) -> Pos2 {
pos2(r.left() + r.width() * x, r.top() + r.height() * y)
}
fn paint_preference_figure(p: &egui::Painter, rect: Rect, figure: PreferenceFigure, enabled: bool) {
pub(crate) fn paint_preference_figure(p: &egui::Painter, rect: Rect, figure: PreferenceFigure, enabled: bool) {
if !p.clip_rect().intersects(rect) {
return;
}
@@ -110,10 +110,20 @@ pub(crate) fn settings_row_card<R>(ui: &mut Ui, selected: bool, height: f32, add
}
fn paint_card(ui: &mut Ui, card: &Card, width: f32, tile: bool) -> Response {
crate::prefs_search::note_unlabelled(ui, &[card.label]);
if crate::prefs_search::querying(ui) && !crate::prefs_search::visible(ui, &[card.label, card.sub.unwrap_or("")]) {
return crate::prefs_search::hidden_response(ui);
}
let t = Tokens::get();
let width = dimension(width);
let enabled = card.enabled && ui.is_enabled();
let (rect, response) = ui.allocate_exact_size(vec2(width, card_height(&t, width, card)), if enabled { Sense::click() } else { Sense::hover() });
// Labelled compound rows own their search index (settings_picture_choices, for example).
// Standalone cards and tiles are independently searchable settings.
if super::layout::label(ui).is_empty() {
crate::prefs_search::remember(ui, card.label, rect);
crate::prefs_search::follow(ui, card.label, rect);
}
let look = card_look(card.selected, enabled, response.hovered(), response.has_focus());
let p = ui.painter();
let dim = |c: Color32| c.gamma_multiply(look.alpha);
@@ -177,6 +187,7 @@ fn paint_card(ui: &mut Ui, card: &Card, width: f32, tile: bool) -> Response {
let kind = if tile { egui::WidgetType::Checkbox } else { egui::WidgetType::RadioButton };
response.widget_info(|| egui::WidgetInfo::selected(kind, enabled, card.selected, card.label));
scenario::publish_target(&format!("prefs:card:{}", card.label), rect);
let response = response.on_hover_text(card.label);
let response = if let Some(options) = card.options { response.on_hover_text(options) } else { response };
if enabled { response.on_hover_cursor(egui::CursorIcon::PointingHand) } else { response }
}
@@ -211,11 +222,17 @@ pub(crate) fn preset_card(
icon: &dyn Fn(&Painter, Rect, Color32),
width: f32,
) -> Response {
crate::prefs_search::note_unlabelled(ui, &[name, word]);
if crate::prefs_search::querying(ui) && !crate::prefs_search::visible(ui, &[name, word]) {
return crate::prefs_search::hidden_response(ui);
}
let t = Tokens::get();
let enabled = enabled && ui.is_enabled();
let width = dimension(width);
let height = t.space_24 * 3.0 - t.space_2;
let (rect, response) = ui.allocate_exact_size(vec2(width, height), if enabled { Sense::click() } else { Sense::hover() });
crate::prefs_search::remember(ui, name, rect);
crate::prefs_search::follow(ui, name, rect);
let look = card_look(selected, enabled, response.hovered(), response.has_focus());
let dim = |c: Color32| c.gamma_multiply(look.alpha);
let p = ui.painter();
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,37 @@
[
{"note":"#9879: Graphics uses real preset/detail cards, stable page navigation, and view tiles in both themes. Native screenshots remain a separate review."},
{"call":"ui.prefs","params":{"theme":"light","language":"en","msaa":2,"open":"General"}},
{"click":{"handle":"prefs:page:Graphics"}},
{"click":{"handle":"view:graphics_preset:quality"}},
{"expect":{"prefs":{"dialog":"Graphics","ambient_occlusion":true,"display_quality":"fine","supersampling":2.0,"supersampling_adaptive":true,"msaa":2}}},
{"click":{"handle":"view:graphics_preset:custom"}},
{"expect":{"prefs":{"ambient_occlusion":true,"display_quality":"fine","supersampling":2.0,"msaa":2}}},
{"click":{"handle":"prefs:display_quality:ultra"}},
{"expect":{"prefs":{"display_quality":"ultra","ambient_occlusion":true}}},
{"click":{"handle":"view:graphics_preset:performance"}},
{"expect":{"prefs":{"ambient_occlusion":false,"display_quality":"normal","supersampling":1.0,"msaa":2}}},
{"click":{"handle":"prefs:search"}},
{"text":"Ambient occlusion"},
{"frames":5},
{"click":{"handle":"prefs:ambient_occlusion"}},
{"expect":{"prefs":{"ambient_occlusion":true}}},
{"click":{"handle":"prefs:cancel"}},
{"expect":{"prefs":{"dialog":null,"ambient_occlusion":false,"display_quality":"normal","supersampling":1.0}}},
{"call":"ui.prefs","params":{"theme":"dark","language":"en","msaa":2,"open":"General"}},
{"click":{"handle":"prefs:page:Graphics"}},
{"click":{"handle":"view:graphics_preset:quality"}},
{"expect":{"prefs":{"dialog":"Graphics","ambient_occlusion":true,"display_quality":"fine","supersampling":2.0,"supersampling_adaptive":true,"msaa":2}}},
{"click":{"handle":"view:graphics_preset:custom"}},
{"expect":{"prefs":{"ambient_occlusion":true,"display_quality":"fine","supersampling":2.0,"msaa":2}}},
{"click":{"handle":"prefs:display_quality:ultra"}},
{"expect":{"prefs":{"display_quality":"ultra","ambient_occlusion":true}}},
{"click":{"handle":"view:graphics_preset:performance"}},
{"expect":{"prefs":{"ambient_occlusion":false,"display_quality":"normal","supersampling":1.0,"msaa":2}}},
{"click":{"handle":"prefs:search"}},
{"text":"Ambient occlusion"},
{"frames":5},
{"click":{"handle":"prefs:ambient_occlusion"}},
{"expect":{"prefs":{"ambient_occlusion":true}}},
{"click":{"handle":"prefs:cancel"}},
{"expect":{"prefs":{"dialog":null,"ambient_occlusion":false,"display_quality":"normal","supersampling":1.0}}}
]
@@ -19,7 +19,7 @@
{"expect": {"prefs": {"dialog": "Shortcuts"}, "same_width": "prefs:window", "right_edge": {"inner": "prefs:ok", "outer": "prefs:actions", "tol": 1}}},
{"widget": "Design"},
{"expect": {"prefs": {"dialog": "Design"}, "same_width": "prefs:window", "right_edge": {"inner": "prefs:ok", "outer": "prefs:actions", "tol": 1}}},
{"widget": "Graphics"},
{"click": {"handle": "prefs:page:Graphics"}},
{"expect": {"prefs": {"dialog": "Graphics"}, "same_width": "prefs:window", "right_edge": {"inner": "prefs:ok", "outer": "prefs:actions", "tol": 1}}},
{"widget": "Sketch"},
{"expect": {"prefs": {"dialog": "Sketch"}, "same_width": "prefs:window", "right_edge": {"inner": "prefs:ok", "outer": "prefs:actions", "tol": 1}}},
File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 64" width="120" height="64"><rect width="120" height="64" fill="#1C1F26"/><path d="M32.742000000000004 27.5l11.258 6.5v13l-11.258 -6.5z" fill="#515B72" stroke="#A3AEC2" stroke-width="0.9" stroke-linejoin="round"/><path d="M55.257999999999996 27.5l-11.258 6.5v13l11.258 -6.5z" fill="#394256" stroke="#A3AEC2" stroke-width="0.9" stroke-linejoin="round"/><path d="M44 21l11.258 6.5l-11.258 6.5l-11.258 -6.5z" fill="#6B7790" stroke="#A3AEC2" stroke-width="0.9" stroke-linejoin="round"/><path d="M64.742 27.5l11.258 6.5v13l-11.258 -6.5z" fill="#515B72" stroke="#A3AEC2" stroke-width="0.9" stroke-linejoin="round"/><path d="M87.258 27.5l-11.258 6.5v13l11.258 -6.5z" fill="#394256" stroke="#A3AEC2" stroke-width="0.9" stroke-linejoin="round"/><path d="M76 21l11.258 6.5l-11.258 6.5l-11.258 -6.5z" fill="#6B7790" stroke="#A3AEC2" stroke-width="0.9" stroke-linejoin="round"/><defs><radialGradient id="ao18"><stop offset="0" stop-color="#000" stop-opacity=".55"/><stop offset="1" stop-color="#000" stop-opacity="0"/></radialGradient></defs><ellipse cx="60" cy="42" rx="22" ry="7" fill="url(#ao18)"/><ellipse cx="60" cy="31" rx="5" ry="10" fill="url(#ao18)" opacity=".8"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 64" width="120" height="64"><rect width="120" height="64" fill="#1C1F26"/><polygon points="44.000,26.500 68.248,40.500 44.000,54.500 19.752,40.500" fill="#000000" fill-opacity="0.07"/><polygon points="76.000,26.500 100.248,40.500 76.000,54.500 51.752,40.500" fill="#000000" fill-opacity="0.07"/><polygon points="44.000,28.000 65.650,40.500 44.000,53.000 22.350,40.500" fill="#000000" fill-opacity="0.07"/><polygon points="76.000,28.000 97.650,40.500 76.000,53.000 54.350,40.500" fill="#000000" fill-opacity="0.07"/><polygon points="44.000,29.500 63.052,40.500 44.000,51.500 24.948,40.500" fill="#000000" fill-opacity="0.07"/><polygon points="76.000,29.500 95.052,40.500 76.000,51.500 56.948,40.500" fill="#000000" fill-opacity="0.07"/><polygon points="44.000,31.000 60.454,40.500 44.000,50.000 27.546,40.500" fill="#000000" fill-opacity="0.07"/><polygon points="76.000,31.000 92.454,40.500 76.000,50.000 59.546,40.500" fill="#000000" fill-opacity="0.07"/><polygon points="44.000,32.500 57.856,40.500 44.000,48.500 30.144,40.500" fill="#000000" fill-opacity="0.07"/><polygon points="76.000,32.500 89.856,40.500 76.000,48.500 62.144,40.500" fill="#000000" fill-opacity="0.07"/><polygon points="32.742,27.500 44.000,34.000 44.000,47.000 32.742,40.500" fill="#515B72"/><polygon points="32.742,40.500 44.000,47.000 44.000,44.790 32.742,38.290" fill="#000000" fill-opacity="0.260"/><polygon points="32.742,38.290 44.000,44.790 44.000,42.580 32.742,36.080" fill="#000000" fill-opacity="0.180"/><polygon points="32.742,36.080 44.000,42.580 44.000,40.240 32.742,33.740" fill="#000000" fill-opacity="0.110"/><polygon points="32.742,33.740 44.000,40.240 44.000,37.900 32.742,31.400" fill="#000000" fill-opacity="0.060"/><polygon points="32.742,31.400 44.000,37.900 44.000,35.950 32.742,29.450" fill="#000000" fill-opacity="0.030"/><polygon points="32.742,27.500 44.000,34.000 44.000,47.000 32.742,40.500" fill="none" stroke="#A3AEC2" stroke-width="0.9" stroke-linejoin="round"/><polygon points="55.258,27.500 44.000,34.000 44.000,47.000 55.258,40.500" fill="#394256"/><polygon points="55.258,40.500 44.000,47.000 44.000,44.790 55.258,38.290" fill="#000000" fill-opacity="0.390"/><polygon points="55.258,38.290 44.000,44.790 44.000,42.580 55.258,36.080" fill="#000000" fill-opacity="0.270"/><polygon points="55.258,36.080 44.000,42.580 44.000,40.240 55.258,33.740" fill="#000000" fill-opacity="0.165"/><polygon points="55.258,33.740 44.000,40.240 44.000,37.900 55.258,31.400" fill="#000000" fill-opacity="0.090"/><polygon points="55.258,31.400 44.000,37.900 44.000,35.950 55.258,29.450" fill="#000000" fill-opacity="0.045"/><polygon points="55.258,27.500 44.000,34.000 44.000,47.000 55.258,40.500" fill="none" stroke="#A3AEC2" stroke-width="0.9" stroke-linejoin="round"/><polygon points="44.000,21.000 55.258,27.500 44.000,34.000 32.742,27.500" fill="#6B7790" stroke="#A3AEC2" stroke-width="0.9" stroke-linejoin="round"/><polygon points="64.742,27.500 76.000,34.000 76.000,47.000 64.742,40.500" fill="#515B72"/><polygon points="64.742,40.500 76.000,47.000 76.000,44.790 64.742,38.290" fill="#000000" fill-opacity="0.390"/><polygon points="64.742,38.290 76.000,44.790 76.000,42.580 64.742,36.080" fill="#000000" fill-opacity="0.270"/><polygon points="64.742,36.080 76.000,42.580 76.000,40.240 64.742,33.740" fill="#000000" fill-opacity="0.165"/><polygon points="64.742,33.740 76.000,40.240 76.000,37.900 64.742,31.400" fill="#000000" fill-opacity="0.090"/><polygon points="64.742,31.400 76.000,37.900 76.000,35.950 64.742,29.450" fill="#000000" fill-opacity="0.045"/><polygon points="64.742,27.500 76.000,34.000 76.000,47.000 64.742,40.500" fill="none" stroke="#A3AEC2" stroke-width="0.9" stroke-linejoin="round"/><polygon points="87.258,27.500 76.000,34.000 76.000,47.000 87.258,40.500" fill="#394256"/><polygon points="87.258,40.500 76.000,47.000 76.000,44.790 87.258,38.290" fill="#000000" fill-opacity="0.260"/><polygon points="87.258,38.290 76.000,44.790 76.000,42.580 87.258,36.080" fill="#000000" fill-opacity="0.180"/><polygon points="87.258,36.080 76.000,42.580 76.000,40.240 87.258,33.740" fill="#000000" fill-opacity="0.110"/><polygon points="87.258,33.740 76.000,40.240 76.000,37.900 87.258,31.400" fill="#000000" fill-opacity="0.060"/><polygon points="87.258,31.400 76.000,37.900 76.000,35.950 87.258,29.450" fill="#000000" fill-opacity="0.030"/><polygon points="87.258,27.500 76.000,34.000 76.000,47.000 87.258,40.500" fill="none" stroke="#A3AEC2" stroke-width="0.9" stroke-linejoin="round"/><polygon points="76.000,21.000 87.258,27.500 76.000,34.000 64.742,27.500" fill="#6B7790" stroke="#A3AEC2" stroke-width="0.9" stroke-linejoin="round"/></svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 64" width="120" height="64"><rect width="120" height="64" fill="#F7F8FA"/><path d="M32.742000000000004 27.5l11.258 6.5v13l-11.258 -6.5z" fill="#E4E9F0" stroke="#6F7C8F" stroke-width="0.9" stroke-linejoin="round"/><path d="M55.257999999999996 27.5l-11.258 6.5v13l11.258 -6.5z" fill="#C9D2DE" stroke="#6F7C8F" stroke-width="0.9" stroke-linejoin="round"/><path d="M44 21l11.258 6.5l-11.258 6.5l-11.258 -6.5z" fill="#FFFFFF" stroke="#6F7C8F" stroke-width="0.9" stroke-linejoin="round"/><path d="M64.742 27.5l11.258 6.5v13l-11.258 -6.5z" fill="#E4E9F0" stroke="#6F7C8F" stroke-width="0.9" stroke-linejoin="round"/><path d="M87.258 27.5l-11.258 6.5v13l11.258 -6.5z" fill="#C9D2DE" stroke="#6F7C8F" stroke-width="0.9" stroke-linejoin="round"/><path d="M76 21l11.258 6.5l-11.258 6.5l-11.258 -6.5z" fill="#FFFFFF" stroke="#6F7C8F" stroke-width="0.9" stroke-linejoin="round"/><defs><radialGradient id="ao14"><stop offset="0" stop-color="#000" stop-opacity=".55"/><stop offset="1" stop-color="#000" stop-opacity="0"/></radialGradient></defs><ellipse cx="60" cy="42" rx="22" ry="7" fill="url(#ao14)"/><ellipse cx="60" cy="31" rx="5" ry="10" fill="url(#ao14)" opacity=".8"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 64" width="120" height="64"><rect width="120" height="64" fill="#F7F8FA"/><polygon points="44.000,26.500 68.248,40.500 44.000,54.500 19.752,40.500" fill="#000000" fill-opacity="0.07"/><polygon points="76.000,26.500 100.248,40.500 76.000,54.500 51.752,40.500" fill="#000000" fill-opacity="0.07"/><polygon points="44.000,28.000 65.650,40.500 44.000,53.000 22.350,40.500" fill="#000000" fill-opacity="0.07"/><polygon points="76.000,28.000 97.650,40.500 76.000,53.000 54.350,40.500" fill="#000000" fill-opacity="0.07"/><polygon points="44.000,29.500 63.052,40.500 44.000,51.500 24.948,40.500" fill="#000000" fill-opacity="0.07"/><polygon points="76.000,29.500 95.052,40.500 76.000,51.500 56.948,40.500" fill="#000000" fill-opacity="0.07"/><polygon points="44.000,31.000 60.454,40.500 44.000,50.000 27.546,40.500" fill="#000000" fill-opacity="0.07"/><polygon points="76.000,31.000 92.454,40.500 76.000,50.000 59.546,40.500" fill="#000000" fill-opacity="0.07"/><polygon points="44.000,32.500 57.856,40.500 44.000,48.500 30.144,40.500" fill="#000000" fill-opacity="0.07"/><polygon points="76.000,32.500 89.856,40.500 76.000,48.500 62.144,40.500" fill="#000000" fill-opacity="0.07"/><polygon points="32.742,27.500 44.000,34.000 44.000,47.000 32.742,40.500" fill="#E4E9F0"/><polygon points="32.742,40.500 44.000,47.000 44.000,44.790 32.742,38.290" fill="#000000" fill-opacity="0.260"/><polygon points="32.742,38.290 44.000,44.790 44.000,42.580 32.742,36.080" fill="#000000" fill-opacity="0.180"/><polygon points="32.742,36.080 44.000,42.580 44.000,40.240 32.742,33.740" fill="#000000" fill-opacity="0.110"/><polygon points="32.742,33.740 44.000,40.240 44.000,37.900 32.742,31.400" fill="#000000" fill-opacity="0.060"/><polygon points="32.742,31.400 44.000,37.900 44.000,35.950 32.742,29.450" fill="#000000" fill-opacity="0.030"/><polygon points="32.742,27.500 44.000,34.000 44.000,47.000 32.742,40.500" fill="none" stroke="#6F7C8F" stroke-width="0.9" stroke-linejoin="round"/><polygon points="55.258,27.500 44.000,34.000 44.000,47.000 55.258,40.500" fill="#C9D2DE"/><polygon points="55.258,40.500 44.000,47.000 44.000,44.790 55.258,38.290" fill="#000000" fill-opacity="0.390"/><polygon points="55.258,38.290 44.000,44.790 44.000,42.580 55.258,36.080" fill="#000000" fill-opacity="0.270"/><polygon points="55.258,36.080 44.000,42.580 44.000,40.240 55.258,33.740" fill="#000000" fill-opacity="0.165"/><polygon points="55.258,33.740 44.000,40.240 44.000,37.900 55.258,31.400" fill="#000000" fill-opacity="0.090"/><polygon points="55.258,31.400 44.000,37.900 44.000,35.950 55.258,29.450" fill="#000000" fill-opacity="0.045"/><polygon points="55.258,27.500 44.000,34.000 44.000,47.000 55.258,40.500" fill="none" stroke="#6F7C8F" stroke-width="0.9" stroke-linejoin="round"/><polygon points="44.000,21.000 55.258,27.500 44.000,34.000 32.742,27.500" fill="#FFFFFF" stroke="#6F7C8F" stroke-width="0.9" stroke-linejoin="round"/><polygon points="64.742,27.500 76.000,34.000 76.000,47.000 64.742,40.500" fill="#E4E9F0"/><polygon points="64.742,40.500 76.000,47.000 76.000,44.790 64.742,38.290" fill="#000000" fill-opacity="0.390"/><polygon points="64.742,38.290 76.000,44.790 76.000,42.580 64.742,36.080" fill="#000000" fill-opacity="0.270"/><polygon points="64.742,36.080 76.000,42.580 76.000,40.240 64.742,33.740" fill="#000000" fill-opacity="0.165"/><polygon points="64.742,33.740 76.000,40.240 76.000,37.900 64.742,31.400" fill="#000000" fill-opacity="0.090"/><polygon points="64.742,31.400 76.000,37.900 76.000,35.950 64.742,29.450" fill="#000000" fill-opacity="0.045"/><polygon points="64.742,27.500 76.000,34.000 76.000,47.000 64.742,40.500" fill="none" stroke="#6F7C8F" stroke-width="0.9" stroke-linejoin="round"/><polygon points="87.258,27.500 76.000,34.000 76.000,47.000 87.258,40.500" fill="#C9D2DE"/><polygon points="87.258,40.500 76.000,47.000 76.000,44.790 87.258,38.290" fill="#000000" fill-opacity="0.260"/><polygon points="87.258,38.290 76.000,44.790 76.000,42.580 87.258,36.080" fill="#000000" fill-opacity="0.180"/><polygon points="87.258,36.080 76.000,42.580 76.000,40.240 87.258,33.740" fill="#000000" fill-opacity="0.110"/><polygon points="87.258,33.740 76.000,40.240 76.000,37.900 87.258,31.400" fill="#000000" fill-opacity="0.060"/><polygon points="87.258,31.400 76.000,37.900 76.000,35.950 87.258,29.450" fill="#000000" fill-opacity="0.030"/><polygon points="87.258,27.500 76.000,34.000 76.000,47.000 87.258,40.500" fill="none" stroke="#6F7C8F" stroke-width="0.9" stroke-linejoin="round"/><polygon points="76.000,21.000 87.258,27.500 76.000,34.000 64.742,27.500" fill="#FFFFFF" stroke="#6F7C8F" stroke-width="0.9" stroke-linejoin="round"/></svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

+14 -6
View File
@@ -8,7 +8,7 @@ Board: `Prefs2_Graphics` (1920x1821). Heading: Look. Subtitle "Trade speed for s
| Label | Control | Edits | Default | Hover | Figure | Notes |
|---|---|---|---|---|---|---|
| Performance "Fastest", Quality "Sharpest", Custom "Your own mix" | Three preset cards (204 x 69.5) | command `view.graphics_preset` with `{"preset":"performance"}` or `"quality"`; the selection is derived from the settings by `graphics_preset(&prefs)`, Custom when neither matches | derived | Today's tooltip `ui.graphics_preset_help`: "Quality: ambient occlusion, Fine display quality and adaptive 2x supersampling. Performance: no ambient occlusion, Normal display quality and supersampling off. Manual changes show Custom. MSAA stays unchanged." The board shows no hover; keep the existing text on the card group. | preset icons (not figures; the app's icons) | The board shows no meters. Custom cannot be chosen to set values: choosing it changes nothing. Only these three exist ("Balanced" in an earlier board does not). |
| Performance "Fastest", Quality "Sharpest", Custom "Your own mix" | Three preset cards (204 x 69.5) | command `view.graphics_preset` with `{"preset":"performance"}` or `"quality"`; the selection is derived from the settings by `graphics_preset(&prefs)`, Custom when neither matches | derived | Today's tooltip `ui.graphics_preset_help`: "Quality: ambient occlusion, Fine display quality and adaptive 2x supersampling. Performance: no ambient occlusion, Normal display quality and supersampling off. Manual changes show Custom. MSAA stays unchanged." The board shows no hover; keep the existing text on the card group. | preset glyphs drawn as strokes: a bolt (Performance), a gem (Quality), three sliders (Custom) | The board shows no meters. Custom cannot be chosen to set values: choosing it changes nothing. Only these three exist ("Balanced" in an earlier board does not). |
## Curved surfaces
@@ -20,9 +20,10 @@ Board: `Prefs2_Graphics` (1920x1821). Heading: Look. Subtitle "Trade speed for s
| Label | Control | Edits | Default | Hover | Figure | Notes |
|---|---|---|---|---|---|---|
| Anti-aliasing + badge "Restart needed" | Four picture cards: Off, 2x, 4x, 8x ("not on this GPU") | `Prefs.msaa` (1, 2, 4, 8) | `4` | tooltip on the cards: `settings.msaa_applies_on_restart` (the restart note) | `aa-off`, `aa-2x`, `aa-4x`, `aa-8x` | A level the adapter lacks (`app.msaa_supported`) is disabled with the badge "not on this GPU". Changing it applies on restart. |
| Anti-aliasing + badge "Restart needed" | Four picture cards: Off, 2x, 4x, 8x ("not on this GPU") | `Prefs.msaa` (1, 2, 4, 8) | `4` | tooltip on the cards: `settings.msaa_applies_on_restart` (the restart note) | `aa-off`, `aa-2x`, `aa-4x`, `aa-8x` | Each figure is an edge on a pixel grid, shaded by that level's sample count (2, 3, 5 and 9 tones) with the sample dots of one pixel in the corner; all four have the same strength. A level the adapter lacks (`app.msaa_supported`) is disabled with the badge "not on this GPU". Changing it applies on restart. |
| Supersampling | Segmented: Off / 1.5x / 2x | `Prefs.supersampling` (1.0, 1.5, 2.0) | `1.0` (Off) | `settings.supersampling_note` | none | |
| Only while the view is still | Checkbox | `Prefs.supersampling_adaptive` | `true` | none | none | Disabled while Supersampling is Off (`supersampling > 1.0`). |
| Keep the shape of dark parts | Checkbox | `Prefs.dark_parts_shading` | `false` | Existing `prefs.dark_parts_shading_help` | none | Retain the current control once, as the final Edges and shading row after Supersampling and its adaptive checkbox. Accepted reference-gap resolution on #9879. |
## Current view (with the badge "Also in the view bar")
@@ -47,7 +48,8 @@ Four toggle tiles, then a chip row.
| Vertex markers | Toggle tile | `Prefs.vertex_markers` | `false` | none | `vertex-markers` | |
| Quick measurement | Toggle tile | `Prefs.quick_measure` (today on the Interface page) | `false` | none | `quick-measure` | Moves here. |
| Frame rate | Toggle tile | `Prefs.show_frame_rate` | `false` | none | `frame-rate` | |
| Status chips: Analysis, Section, Live details, Fold items | Four small chips (the row is labelled "Status chips") | `Prefs.viewport_analysis_status`, `Prefs.viewport_section_status`, `Prefs.viewport_status_details`, `Prefs.viewport_status_summary` | all `true` | none | none | Mapping by catalog label: "Live details" is `viewport_status_details` ("Live viewport details") and "Fold items" is `viewport_status_summary` ("Fold viewport status items"). These four move here from Interface. `Prefs.frame_rate_details` (frame rate details) has no control on the board. |
| Frame rate details | Checkbox | `Prefs.frame_rate_details` | `false` | Existing `settings.frame_rate_details_note` | none | Retain the current control directly below the four-tile row containing Frame rate and before the status chips. Always visible; disabled while `show_frame_rate` is false, retaining its stored value. Accepted reference-gap resolution on #9879. |
| Status chips: Analysis, Section, Live details, Fold items | Four small chips (the row is labelled "Status chips") | `Prefs.viewport_analysis_status`, `Prefs.viewport_section_status`, `Prefs.viewport_status_details`, `Prefs.viewport_status_summary` | all `true` | none | none | Mapping by catalog label: "Live details" is `viewport_status_details` ("Live viewport details") and "Fold items" is `viewport_status_summary` ("Fold viewport status items"). These four move here from Interface. |
## Surfaces and edges
@@ -63,7 +65,7 @@ Four toggle tiles, then a chip row.
| Label | Control | Edits | Default | Hover | Figure | Notes |
|---|---|---|---|---|---|---|
| Apple M2 / Metal . GPU renderer | Read-only device card (the first line is the adapter name, the second the backend) | none (from the renderer) | n/a | none | none | Sample values. |
| Apple M2 / Metal . GPU renderer | One grey card: a device header (monitor tile, adapter name, "backend · GPU renderer" in mono, a GPU badge) with the rows below it inside the card, checkbox included | none (from the renderer) | n/a | none | none | Sample values. |
| Graphics card + badge "Restart needed" | Dropdown (240 wide, "Automatic") | `Prefs.graphics_adapter` (empty = automatic) | empty | none | none | aria-label "Graphics card". |
| Window system | Dropdown (240 wide, "Automatic") with "Linux" badge | `Prefs.window_system` (`"auto"`) | `"auto"` | none | none | The "Linux" badge says the choice is for Linux only; hide the row elsewhere. aria-label "Window system". |
| Use previous Render preview geometry budget | Checkbox | `Prefs.render_previous_geometry_budget` | `false` | "Restores the earlier fixed budget." | none | |
@@ -71,7 +73,13 @@ Four toggle tiles, then a chip row.
## Mismatches
* "Axis distances in Measure" (`Prefs.measure_axis_distances`) leaves this page for Tools.
* The board has no control for `frame_rate_details`.
* Renderer and window system rows come from the old page's "Renderer" block.
* The board omits `dark_parts_shading` and `frame_rate_details`. Retain their current controls,
labels, help, defaults and behavior in the adjacent locations recorded above; absence from the
board does not remove a current setting.
* Keep main's newer controls: Profile operations follows Frame rate details; Section hatch and
both preview-tint checkboxes follow Halo under sketch curves. Their defaults, help text,
persistence and page reset behaviour stay unchanged.
* Renderer and window system rows come from the old page's "Renderer" block. When the adapter
has no name, the device header uses "Renderer" as its title.
* The tracker's "Edges and shading" note says Ambient occlusion moves to Current view; the code still
lists it under Graphics with `PAGE_GRAPHICS`.