From f9a48b9a079b6dbc1085c1b7e0ff06205a3d31b5 Mon Sep 17 00:00:00 2001 From: Jiekang Tian Date: Sat, 5 Sep 2026 00:19:19 +0800 Subject: [PATCH] feat(ui): hide status bar by default --- crates/app/src/ui/mod.rs | 34 +++++++++++++++++++ crates/app/src/ui/properties/mod.rs | 6 ++++ crates/app/src/ui/properties/tests.rs | 4 +-- crates/core/src/properties/app_preferences.rs | 12 +++++++ .../src/properties/app_preferences_tests.rs | 8 ++++- crates/core/src/settings/model.rs | 2 ++ crates/core/src/settings/tests.rs | 3 ++ .../src/content/docs/reference/ui-overview.md | 3 +- .../docs/zh-cn/reference/ui-overview.md | 4 ++- 9 files changed, 71 insertions(+), 5 deletions(-) diff --git a/crates/app/src/ui/mod.rs b/crates/app/src/ui/mod.rs index 091ccdd..e47e927 100644 --- a/crates/app/src/ui/mod.rs +++ b/crates/app/src/ui/mod.rs @@ -244,6 +244,9 @@ fn copy_table_export(ctx: &egui::Context, payload: plotx_core::data_export::Clip } fn render_status(app: &PlotxApp, ui: &mut Ui, dark: bool) { + if !app.settings.appearance.show_status_bar { + return; + } egui::Panel::bottom("status") .frame( card_frame( @@ -620,6 +623,37 @@ fn flush_frame(dark: bool, inner_margin: egui::Margin) -> egui::Frame { #[path = "sidebar_tests.rs"] mod sidebar_tests; +#[cfg(test)] +mod status_bar_tests { + use super::*; + use egui::{Pos2, RawInput, Rect, vec2}; + + fn remaining_height(app: &PlotxApp) -> f32 { + let ctx = crate::typography::test_context(); + let input = RawInput { + screen_rect: Some(Rect::from_min_size(Pos2::ZERO, vec2(800.0, 600.0))), + ..Default::default() + }; + let mut height = 0.0; + let _ = ctx.run_ui(input, |ui| { + render_status(app, ui, false); + height = ui.available_height(); + }); + height + } + + #[test] + fn status_bar_only_reserves_workspace_when_enabled() { + let mut app = PlotxApp::new_with_settings(plotx_core::settings::Settings::default()); + let hidden_height = remaining_height(&app); + + app.settings.appearance.show_status_bar = true; + let shown_height = remaining_height(&app); + + assert!(shown_height < hidden_height); + } +} + #[cfg(test)] mod feedback_tests { use super::*; diff --git a/crates/app/src/ui/properties/mod.rs b/crates/app/src/ui/properties/mod.rs index acb028f..74af151 100644 --- a/crates/app/src/ui/properties/mod.rs +++ b/crates/app/src/ui/properties/mod.rs @@ -644,6 +644,12 @@ pub const PRESENTATIONS: &[PropertyPresentation] = &[ &[LocalizedText("appearance theme")], APPEARANCE_PREFERENCES_HOME, ), + preference_entry( + app_preferences::SHOW_STATUS_BAR, + "Show status bar", + &[LocalizedText("bottom status")], + APPEARANCE_PREFERENCES_HOME, + ), preference_entry( app_preferences::GRAPHICS_POWER, "Graphics processor", diff --git a/crates/app/src/ui/properties/tests.rs b/crates/app/src/ui/properties/tests.rs index f87b0b8..0dcabe3 100644 --- a/crates/app/src/ui/properties/tests.rs +++ b/crates/app/src/ui/properties/tests.rs @@ -319,8 +319,8 @@ fn migrated_preferences_keep_their_real_section_density() { ), ( SettingsCategory::Appearance.section_id(), - 3, - "theme, GPU, and the accent override row", + 4, + "theme, status bar, GPU, and the accent override row", ), ( SettingsCategory::Processing.section_id(), diff --git a/crates/core/src/properties/app_preferences.rs b/crates/core/src/properties/app_preferences.rs index 043c962..89da461 100644 --- a/crates/core/src/properties/app_preferences.rs +++ b/crates/core/src/properties/app_preferences.rs @@ -21,6 +21,7 @@ pub const KEEP_EMPTY_SOURCE_CANVAS: PropertyId = pub const PROJECT_BACKUP_GENERATIONS: PropertyId = PropertyId("settings.general.project_backup_generations"); pub const THEME: PropertyId = PropertyId("settings.appearance.theme"); +pub const SHOW_STATUS_BAR: PropertyId = PropertyId("settings.appearance.show_status_bar"); pub const GRAPHICS_POWER: PropertyId = PropertyId("settings.appearance.graphics_power"); pub const ACCENT_COLOR: PropertyId = PropertyId("settings.appearance.accent.color"); pub const INCLUDE_VIEW_SNAPSHOTS: PropertyId = PropertyId("settings.export.include_view_snapshots"); @@ -145,6 +146,13 @@ pub(crate) const DEFINITIONS: &[PropertyDefinition] = &[ "Chrome theme", &["appearance theme", "light mode", "dark mode"], ), + app_definition( + SHOW_STATUS_BAR, + ValueSchema::Bool, + DefaultPolicy::Fixed(PropertyValue::Bool(false)), + "Show status bar", + &["status bar", "bottom status"], + ), app_definition( GRAPHICS_POWER, ValueSchema::Enum { @@ -316,6 +324,7 @@ fn value_of(app: &PlotxApp, id: PropertyId) -> Result PropertyValue::Enum(theme_key(settings.appearance.theme)), + SHOW_STATUS_BAR => PropertyValue::Bool(settings.appearance.show_status_bar), GRAPHICS_POWER => PropertyValue::Enum(graphics_key(settings.appearance.graphics_power)), ACCENT_COLOR => { let [r, g, b] = settings.appearance.canvas_accent.unwrap_or([ @@ -390,6 +399,9 @@ fn write_value( (THEME, PropertyValue::Enum(value)) => { settings.appearance.theme = theme(value).expect("validated theme") } + (SHOW_STATUS_BAR, PropertyValue::Bool(value)) => { + settings.appearance.show_status_bar = value + } (GRAPHICS_POWER, PropertyValue::Enum(value)) => { settings.appearance.graphics_power = graphics(value).expect("validated graphics power") } diff --git a/crates/core/src/properties/app_preferences_tests.rs b/crates/core/src/properties/app_preferences_tests.rs index 36fd7c9..c0b461b 100644 --- a/crates/core/src/properties/app_preferences_tests.rs +++ b/crates/core/src/properties/app_preferences_tests.rs @@ -126,13 +126,14 @@ fn backup_bound_rejects_the_value_and_names_the_actual_limit() { } #[test] -fn all_twelve_app_preferences_reset_through_their_catalog_definitions() { +fn all_thirteen_app_preferences_reset_through_their_catalog_definitions() { let mut settings = Settings::default(); settings.general.snap_enabled = false; settings.general.equal_scale_homonuclear_2d_imports = false; settings.general.keep_empty_source_canvas = true; settings.general.project_backup_generations = MAX_PROJECT_BACKUP_GENERATIONS; settings.appearance.theme = ThemeMode::Dark; + settings.appearance.show_status_bar = true; settings.appearance.graphics_power = GraphicsPowerPreference::HighPerformance; settings.appearance.canvas_accent = Some([12, 34, 56]); settings.export.include_view_snapshots = true; @@ -148,6 +149,7 @@ fn all_twelve_app_preferences_reset_through_their_catalog_definitions() { KEEP_EMPTY_SOURCE_CANVAS, PROJECT_BACKUP_GENERATIONS, THEME, + SHOW_STATUS_BAR, GRAPHICS_POWER, ACCENT_COLOR, INCLUDE_VIEW_SNAPSHOTS, @@ -170,6 +172,10 @@ fn all_twelve_app_preferences_reset_through_their_catalog_definitions() { let defaults = Settings::default(); assert_eq!(app.settings.general, defaults.general); assert_eq!(app.settings.appearance.theme, defaults.appearance.theme); + assert_eq!( + app.settings.appearance.show_status_bar, + defaults.appearance.show_status_bar + ); assert_eq!( app.settings.appearance.graphics_power, defaults.appearance.graphics_power diff --git a/crates/core/src/settings/model.rs b/crates/core/src/settings/model.rs index d4754f3..4345d3a 100644 --- a/crates/core/src/settings/model.rs +++ b/crates/core/src/settings/model.rs @@ -87,6 +87,8 @@ pub struct AppearanceSettings { #[serde(default)] pub theme: ThemeMode, #[serde(default)] + pub show_status_bar: bool, + #[serde(default)] pub ui_scale: UiScaleSettings, #[serde(default)] pub graphics_power: GraphicsPowerPreference, diff --git a/crates/core/src/settings/tests.rs b/crates/core/src/settings/tests.rs index 53a4f76..6654e44 100644 --- a/crates/core/src/settings/tests.rs +++ b/crates/core/src/settings/tests.rs @@ -20,6 +20,7 @@ fn missing_fields_take_defaults() { settings.appearance.graphics_power, GraphicsPowerPreference::LowPower ); + assert!(!settings.appearance.show_status_bar); assert_eq!(settings.window.task_cards.craft.width, 520.0); assert_eq!(settings.window.task_cards.processing.width, 340.0); } @@ -103,6 +104,7 @@ fn save_and_load_roundtrip() { settings.general.project_backup_generations = 3; settings.export.include_view_snapshots = true; settings.export.trim_to_visible_content = true; + settings.appearance.show_status_bar = true; settings.window.task_cards.craft = TaskCardSize::new(612.0, 688.0); io::save_to_path(&path, &settings).unwrap(); @@ -114,6 +116,7 @@ fn save_and_load_roundtrip() { assert_eq!(loaded.general.project_backup_generations, 3); assert!(loaded.export.include_view_snapshots); assert!(loaded.export.trim_to_visible_content); + assert!(loaded.appearance.show_status_bar); assert_eq!( loaded.window.task_cards.craft, TaskCardSize::new(612.0, 688.0) diff --git a/docs/src/content/docs/reference/ui-overview.md b/docs/src/content/docs/reference/ui-overview.md index 8f0dec1..8418b18 100644 --- a/docs/src/content/docs/reference/ui-overview.md +++ b/docs/src/content/docs/reference/ui-overview.md @@ -36,7 +36,8 @@ introduces the same regions in walkthrough form. shortcut surface: everything on it is also in the menus or command palette. See [the Ribbon](/reference/ribbon/) for every tab's groups. - **Status bar** — the bottom strip, showing hints, progress, and selection - details. + details. It is hidden by default to leave more room for the workspace; enable + **Show status bar** under **Preferences → Appearance** when you want it. Both Side Bars can be shown or hidden at any time: click the pair of layout buttons at the right end of the Ribbon's task row, press diff --git a/docs/src/content/docs/zh-cn/reference/ui-overview.md b/docs/src/content/docs/zh-cn/reference/ui-overview.md index 3536206..89ee82a 100644 --- a/docs/src/content/docs/zh-cn/reference/ui-overview.md +++ b/docs/src/content/docs/zh-cn/reference/ui-overview.md @@ -30,7 +30,9 @@ PlotX 的界面为英文;手册中加粗的英文词即界面上的原文标 **Analyze**、**Figure**、**Arrange**、**View**)。在 macOS 上,其任务行 还承载原生窗口按钮和项目名。它是快捷入口:其上的一切也都能在菜单或命令面板中找到。 各页签的分组详见 [Ribbon](/zh-cn/reference/ribbon/)。 -- **状态栏**——底部条带,显示提示、进度和选择详情。 +- **状态栏**——底部条带,显示提示、进度和选择详情。默认隐藏,以便为工作区 + 留出更多空间;需要时可在 **Preferences → Appearance** 中开启 + **Show status bar**。 两个侧栏随时可以显示或隐藏:点击 Ribbon 任务行右端的一对布局按钮,按 Ctrl+B(左)或 Ctrl+Shift+B