b49106dc1d
feat: Refactor Iced panel adapter and introduce build metadata management - Updated Cargo.toml files across multiple crates to use workspace versioning. - Enhanced the `iced-panel-adapter` to include a new `plain_slider` module and updated widget rendering to support theme colors. - Added new theme color utilities for recessed and elevated surfaces in `iced-panel-adapter`. - Introduced a new `hcie-build-info` crate to manage build metadata, including a build ID system. - Created a build script to synchronize build IDs across the workspace. - Added a Makefile for simplified build commands for the Iced application. - Implemented regression tests for vector shape creation history in the engine API. - Added a new script for managing Cargo commands with synchronized build ID increments. - Updated line count report to reflect recent changes in codebase. - Created a visual plan document for future improvements in the Iced history and panel systems.
62 lines
1.5 KiB
Rust
62 lines
1.5 KiB
Rust
//! Status bar — bottom bar with tool info, coordinates, zoom, canvas size.
|
||
//! Uses ThemeColors for consistent styling.
|
||
|
||
use crate::app::Message;
|
||
use crate::panels::styles;
|
||
use crate::theme::ThemeColors;
|
||
use crate::widgets::plain_slider::plain_slider;
|
||
use hcie_engine_api::Tool;
|
||
use iced::widget::{container, row, text};
|
||
use iced::{Element, Length};
|
||
|
||
/// Build the status bar element.
|
||
pub fn view<'a>(
|
||
active_tool: &Tool,
|
||
cursor_pos: Option<(u32, u32)>,
|
||
zoom: f32,
|
||
canvas_w: u32,
|
||
canvas_h: u32,
|
||
colors: ThemeColors,
|
||
) -> Element<'a, Message> {
|
||
let tool_name = text(active_tool.label()).size(11);
|
||
|
||
let coords = match cursor_pos {
|
||
Some((x, y)) => text(format!("({}, {})", x, y)).size(11),
|
||
None => text(" ").size(11),
|
||
};
|
||
|
||
let zoom_pct = text(format!("{:.0}%", zoom * 100.0)).size(11);
|
||
let canvas_size = text(format!("{}×{}", canvas_w, canvas_h)).size(11);
|
||
|
||
let zoom_slider = container(plain_slider(
|
||
"Zoom",
|
||
zoom,
|
||
0.01..=16.0,
|
||
0.01,
|
||
"×",
|
||
2,
|
||
colors,
|
||
Message::CanvasZoomSet,
|
||
))
|
||
.width(120);
|
||
|
||
let bar = row![
|
||
tool_name,
|
||
text(" | ").size(11),
|
||
coords,
|
||
text(" ").size(11).width(Length::Fill),
|
||
zoom_slider,
|
||
zoom_pct,
|
||
text(" | ").size(11),
|
||
canvas_size,
|
||
]
|
||
.spacing(4)
|
||
.align_y(iced::Alignment::Center)
|
||
.padding([2, 8]);
|
||
|
||
container(bar)
|
||
.width(Length::Fill)
|
||
.style(move |_theme| styles::statusbar_background(colors))
|
||
.into()
|
||
}
|