From d88d2fd535cdb8e9e07f6cfe61385e7f58f87f98 Mon Sep 17 00:00:00 2001 From: Roman S Samarev Date: Thu, 26 Nov 2026 20:34:06 +0300 Subject: [PATCH 1/3] GUI: canvas: fix cursor dragging, lossless traces, per-capture scales Cursor dragging on the graph: - The canvas now sends which lines it picked. A press within 12 px of the crossing of the nearest X and Y lines drags both; elsewhere only the single nearest line moves (distance in pixels, not fractions). - A drag keeps following the pointer outside the canvas and ends on release anywhere, so it can no longer get stuck. - Resize/move pointer over lines and crossings. Traces: - New plot.rs shared by the canvas and the PNG export: per-column min/max, so Line and Dot modes never drop samples (single-sample spikes stay visible). Smooth mode still averages. - Canvas traces are clipped to the grid on the geometry itself. Frame::with_clip is not used: in iced 0.14 the clipped sub-frame is drawn before the parent's shapes, so the background hid the traces. - PNG Dot mode draws every sample instead of every N-th one. - The canvas draws in layers; the trace layer is cached and rebuilt only when samples, trace options or size change, so cursor drags no longer re-tessellate 60 000 samples. Dots use iced's rectangle fast path (one path of thousands of overlapping circles was very slow). Per-capture scales (scale.rs): - A capture with metadata uses its own V/div, V/off and t/div (shown read-only); a capture without metadata (debug dump) uses the manual scale from settings. Receiving, loading or selecting a capture no longer overwrites the manual scale, and PNG export uses the scale of the exported capture. Also fixes three clippy lints new in Rust 1.100 so the lint check passes. --- README.md | 2 + docs/GUI_DESIGN.md | 57 ++++- docs/USER_MANUAL.md | 38 +-- gui/locales/en.json | 2 + gui/locales/es.json | 2 + gui/locales/hi.json | 2 + gui/locales/ru.json | 2 + gui/locales/zh.json | 2 + gui/src/app.rs | 299 +++++++++++++--------- gui/src/canvas.rs | 538 +++++++++++++++++++++++++++++----------- gui/src/export_image.rs | 136 ++++++---- gui/src/main.rs | 2 + gui/src/plot.rs | 270 ++++++++++++++++++++ gui/src/scale.rs | 171 +++++++++++++ 14 files changed, 1193 insertions(+), 330 deletions(-) create mode 100644 gui/src/plot.rs create mode 100644 gui/src/scale.rs diff --git a/README.md b/README.md index fa16598..4f2d3c1 100644 --- a/README.md +++ b/README.md @@ -157,6 +157,8 @@ Cargo workspace (`resolver = "2"`). Shared dependencies are in `[workspace.depen | `main.rs` | Boots `iced::application(App::new, App::update, App::view)` with `.subscription()`. | | `app.rs` | `App` state, messages, view composition, subscriptions; headless unit tests. | | `canvas.rs` | `Scope` canvas program: grid, traces, measurement and device cursors. | +| `plot.rs` | Renderer-neutral waveform helpers shared by the canvas and the PNG export (per-column min/max, so no samples are dropped; trace clipping). | +| `scale.rs` | Per-capture display scale: from the capture's metadata, or the manual scale for captures without metadata. | | `range_slider.rs` | Custom two-knob range slider widget (`canvas::Program`). | | `serial.rs` | Background serial listener: port list, auto-reconnect, capture detection. | | `flash.rs` | Background firmware update over XMODEM-1K. | diff --git a/docs/GUI_DESIGN.md b/docs/GUI_DESIGN.md index 9e1648c..20c0b72 100644 --- a/docs/GUI_DESIGN.md +++ b/docs/GUI_DESIGN.md @@ -53,9 +53,28 @@ This document describes the GUI layout, interaction model and state of the Custom `iced::widget::canvas` (`canvas.rs`, `Scope`). 10×8 grid, centred axes, yellow CH1, cyan CH2. Renders: * Traces in **Line / Dot / Smooth** mode (smooth = moving average). + Traces are clipped to the grid area, so off-screen samples never run + over the scale labels. The clipping is done on the trace geometry + (`plot::clip_polyline_y`), not with `Frame::with_clip`: in iced 0.14 a + clipped sub-frame is drawn before the parent frame's own shapes, so the + opaque background covered the traces. + The canvas draws three layers: background and grid, traces, then cursors + and labels. The trace layer is cached (`canvas::Cache` in `ScopeState`) + and rebuilt only when the samples, the trace options or the plot size + change, so dragging a cursor does not re-tessellate 60 000 samples. + Dot mode draws each dot as a small square through iced's rectangle fast + path; one path of thousands of overlapping circles was very slow to fill. Line and Dot modes never drop samples: with more + samples than pixel columns, each column draws the min/max of its samples + (Line) or each distinct value once (Dot), so single-sample spikes stay + visible (`plot.rs`, shared with the PNG export). Only Smooth averages. * Pink interactive cursors (range-shaded) for **measurement cursors**. - Cursors can also be moved by clicking/dragging directly on the graph - (nearest cursor line snaps to click position). + Cursors can also be moved by clicking/dragging directly on the graph. + A press moves the single nearest cursor line (distance measured in + pixels). A press within 12 px of the crossing of the nearest X and Y + lines drags both lines together. The pointer changes to a resize/move + shape over a line or crossing. A drag keeps following the pointer when it + leaves the canvas (the line stops at the plot edge) and ends on release + anywhere. * Green thin lines for **device cursors** (data-supplied, read-only) with numeric labels (sample numbers for X, voltage for Y). * Optional **axis scales** toggled via "Show scales" setting. Scale values @@ -79,14 +98,22 @@ When capture metadata includes probe-mode information (×1, ×10, ×100), a **Probe:** row is shown beneath V/div, and probe + coupling info appear in the Trigger section. -When a capture arrives via the **screenshot protocol** (live), V/div, V/offset -and t/div are **automatically filled** from the packet's embedded settings -metadata. The same auto-population applies when **switching between captures** -in the thumbnail strip — clicking a screenshot capture applies its `scope_state` -settings. For single-capture `.zwcap` or `.bin` files, settings are applied -automatically on load. For multi-capture files, select the desired capture -from the thumbnails to apply its settings. ASCII dumps (without metadata) -retain the last-used settings. +**Each capture keeps its own scale** (`scale.rs`, `CaptureScale`): + +* A capture **with metadata** (`record.scope_state`: screenshot packets and + `.zwcap` records saved from them) is drawn, measured and exported with the + V/div, V/off and t/div from its metadata. The inputs show these values + read-only (`text_input` without `on_input`), with the note "Scales from + capture metadata". A value missing from the metadata (a channel that was + off) falls back to the manual value. +* A capture **without metadata** (ASCII debug dump) uses the **manual scale** + stored in `settings.json`. The inputs are editable, with the note "Manual + scales". + +Receiving, loading or selecting a capture never writes to the manual scale, +so one capture's scale cannot leak into another. The canvas, the measurement +panel and PNG export (including export of a capture that is not shown, from +the thumbnail context menu) all take the scale of their own capture. **Signal information** (shown when a capture is loaded): * Voltage range for CH1/CH2 (computed from V/div × 8 divs, centered at 0). @@ -197,6 +224,11 @@ traces, written as a valid PNG file using a minimal built-in encoder (no external image crate needed). Filename is auto-generated as `capture_YYYYMMDD_HHMMSS.png` saved to the Downloads directory (no file picker). +The export keeps as much of the input data as possible: Line mode draws the +per-column min/max envelope when there are more samples than columns (and +interpolates linearly when there are fewer), and Dot mode draws every sample +(dots on the same spot are drawn once). Only Smooth mode filters the data. + ## Persisted state (`settings.json`) ```jsonc @@ -241,5 +273,6 @@ Default level: info; override with `RUST_LOG`. where `v` = screen-coordinate ADC value (0 = top, 255 = bottom) and 25 = pixels per division. This matches the DSO3D12's own `pixel_to_volts`. * Time axis = 12 divisions × t/div (ms). -* When receiving screenshot packets or loading `.zwcap` files with metadata, - V/div, V/offset, t/div and probe mode are auto-filled from device metadata. +* Captures with metadata (screenshot packets, `.zwcap` records with + `scope_state`) are shown with their own V/div, V/offset, t/div and probe + mode; captures without metadata use the manual scale (see above). diff --git a/docs/USER_MANUAL.md b/docs/USER_MANUAL.md index 01ed801..56e0467 100644 --- a/docs/USER_MANUAL.md +++ b/docs/USER_MANUAL.md @@ -37,7 +37,8 @@ There are two independent capture methods: 4. **Long-press Save** to initiate the debug data transmission. Transfers ~150–500 kB at 115200 baud. Delivers 60 000 raw ADC samples per -channel. Use `V/div` and `t/div` in the Measurement panel to set the scale. +channel. A debug dump carries no scale metadata: set `V/div`, `V/off` and +`t/div` in the Measurement panel (see [Scale configuration](#scale-configuration)). #### Method 2 — Screenshot binary packet (display pixels) @@ -47,8 +48,8 @@ channel. Use `V/div` and `t/div` in the Measurement panel to set the scale. binary packet** containing the 300 display pixels plus all instrument settings. The app detects this packet by its size and decodes the embedded calibration -data to set `V/div`, `V/off`, `t/div` and **probe mode** (×1, ×10, ×100) -automatically. Probe and coupling info are shown in the Measurement panel's +data: the capture is shown with its own `V/div`, `V/off`, `t/div` and **probe +mode** (×1, ×10, ×100). Probe and coupling info are shown in the Measurement panel's Trigger section, and the probe multiplier is reflected in the displayed V/div and V/off values. @@ -65,13 +66,11 @@ Re-plug and the connection resumes without manual intervention. Click **Load Capture** and select a `.zwcap`, `.bin`, `.dat` or `.raw` file. Files can contain one or many consecutive captures. -When loading files that contain embedded instrument metadata (`.zwcap` files -or screenshot `.bin` files), the **V/div**, **V/off** and **t/div** settings -are **automatically populated** from the capture data. You can still adjust -them manually if needed. - -When switching between captures in the thumbnail strip, the scale settings -update automatically for each capture that has embedded metadata. +Each capture is shown with its own scale. Captures with embedded instrument +metadata (screenshot packets, and `.zwcap` records saved from them) use the +**V/div**, **V/off** and **t/div** the oscilloscope reported. Captures without +metadata (debug dumps) use the manual scale from the Measurement panel. See +[Scale configuration](#scale-configuration). ## Viewing the graph @@ -96,9 +95,18 @@ the real scope). The DSO3D12 screen has **8 vertical** and **12 horizontal** divisions (AC mode). All voltage and time calculations, axis labels, and PNG scales use the per-channel values. -When a capture arrives via the **screenshot protocol**, V/div and V/offset -are automatically filled for each channel from the packet's embedded settings -metadata (CH1 and CH2 separately). +The scale fields depend on the capture being shown: + +* **Capture with metadata** (screenshot protocol, or a `.zwcap` record saved + from one): the fields show that capture's own V/div, V/off and t/div, + read-only. The note under the fields reads "Scales from capture metadata". +* **Capture without metadata** (debug dump): the fields are editable and set + the **manual scale**, used for every capture without metadata. It is saved + between sessions. The note reads "Manual scales". + +Receiving or selecting a capture never changes the manual scale, so switching +between a screenshot and a dump always shows each with the right scale. PNG +export uses the scale of the capture being exported. ## Measurement cursors @@ -110,7 +118,9 @@ In the right-hand **Measurement** panel: | ☐ Cursor Y (voltage) | Two knobs on vertical range | ΔV (volts) + absolute voltages per channel (CH1 and CH2) | **Drag the knob closest to your click** in the slider — or **click/drag -directly on the graph** to move the nearest cursor line. The shaded band +directly on the graph** to move the nearest cursor line. To move an X and a +Y line together, press close to the point where they cross (within about +12 pixels); the pointer changes to a move shape there. The shaded band between cursors is drawn on the canvas in pink and updates in real time. Y cursor voltages are computed independently for CH1 and CH2 using each channel's V/div and V/offset settings. diff --git a/gui/locales/en.json b/gui/locales/en.json index 11829a6..e8872cc 100644 --- a/gui/locales/en.json +++ b/gui/locales/en.json @@ -41,6 +41,8 @@ "label.voff": "V/off, V:", "label.tdiv": "t/div, ms:", "label.ac_mode": "AC mode: 8×V, 12×t div", + "label.scale_from_metadata": "Scales from capture metadata (read-only)", + "label.scale_manual": "Manual scales (capture has no metadata)", "label.time_range": "Time range: %{ms} ms (%{n} samp)", "label.ch1_stats": "CH1: n=%{n} min=%{min} max=%{max} avg=%{avg}", "label.ch2_stats": "CH2: n=%{n} min=%{min} max=%{max} avg=%{avg}", diff --git a/gui/locales/es.json b/gui/locales/es.json index 13a8006..5cab5dd 100644 --- a/gui/locales/es.json +++ b/gui/locales/es.json @@ -41,6 +41,8 @@ "label.voff": "Despl V, V:", "label.tdiv": "t/div, ms:", "label.ac_mode": "Modo CA: 8×V, 12×t div", + "label.scale_from_metadata": "Escalas de los metadatos de la captura (solo lectura)", + "label.scale_manual": "Escalas manuales (la captura no tiene metadatos)", "label.time_range": "Tiempo: %{ms} ms (%{n} muestras)", "label.ch1_stats": "CH1: n=%{n} mín=%{min} máx=%{max} prom=%{avg}", "label.ch2_stats": "CH2: n=%{n} mín=%{min} máx=%{max} prom=%{avg}", diff --git a/gui/locales/hi.json b/gui/locales/hi.json index 86d3a6c..500a3f9 100644 --- a/gui/locales/hi.json +++ b/gui/locales/hi.json @@ -41,6 +41,8 @@ "label.voff": "V ऑफ़सेट, V:", "label.tdiv": "t/डिव, मि.से.:", "label.ac_mode": "AC मोड: 8×V, 12×t डिव", + "label.scale_from_metadata": "स्केल कैप्चर मेटाडेटा से (केवल पढ़ने के लिए)", + "label.scale_manual": "मैनुअल स्केल (कैप्चर में मेटाडेटा नहीं है)", "label.time_range": "समय: %{ms} मि.से. (%{n} नमूने)", "label.ch1_stats": "CH1: n=%{n} न्यून=%{min} अधि=%{max} औसत=%{avg}", "label.ch2_stats": "CH2: n=%{n} न्यून=%{min} अधि=%{max} औसत=%{avg}", diff --git a/gui/locales/ru.json b/gui/locales/ru.json index e8e1207..c110fe5 100644 --- a/gui/locales/ru.json +++ b/gui/locales/ru.json @@ -41,6 +41,8 @@ "label.voff": "Смещ, В:", "label.tdiv": "время/дел, мс:", "label.ac_mode": "Режим АС: 8×В, 12×t дел", + "label.scale_from_metadata": "Масштабы из метаданных захвата (только чтение)", + "label.scale_manual": "Ручные масштабы (у захвата нет метаданных)", "label.time_range": "Время: %{ms} мс (%{n} отсчётов)", "label.ch1_stats": "CH1: n=%{n} мин=%{min} макс=%{max} ср=%{avg}", "label.ch2_stats": "CH2: n=%{n} мин=%{min} макс=%{max} ср=%{avg}", diff --git a/gui/locales/zh.json b/gui/locales/zh.json index a78445e..4635562 100644 --- a/gui/locales/zh.json +++ b/gui/locales/zh.json @@ -41,6 +41,8 @@ "label.voff": "偏置, V:", "label.tdiv": "时基, 毫秒:", "label.ac_mode": "交流模式: 8×V, 12×t 格", + "label.scale_from_metadata": "刻度来自捕获元数据(只读)", + "label.scale_manual": "手动刻度(捕获没有元数据)", "label.time_range": "时间: %{ms} 毫秒 (%{n} 采样)", "label.ch1_stats": "CH1: n=%{n} 最小值=%{min} 最大值=%{max} 平均值=%{avg}", "label.ch2_stats": "CH2: n=%{n} 最小值=%{min} 最大值=%{max} 平均值=%{avg}", diff --git a/gui/src/app.rs b/gui/src/app.rs index 80e1883..1d94d0a 100644 --- a/gui/src/app.rs +++ b/gui/src/app.rs @@ -18,7 +18,8 @@ use iced::{ Element, Length, Subscription, Task, Theme, }; -use crate::canvas::{Scope, Thumbnail}; +use crate::canvas::{CursorDrag, Knob, Scope, Thumbnail}; +use crate::scale::{CaptureScale, ScaleSource}; use crate::export_image::export_png; use crate::i18n::t; use crate::range_slider; @@ -67,8 +68,8 @@ pub enum Message { TPerCellChanged(String), VOffsetChangedCh1(String), VOffsetChangedCh2(String), - // Graph click — move nearest cursor - GraphClicked(f32, f32), + // Measurement-cursor drag on the graph (one line, or X+Y near their crossing) + MeasCursorDragged(CursorDrag), // Misc OpenInstructions, CloseInstructions, @@ -381,22 +382,13 @@ impl App { self.status = t!("label.loaded_ok", n = n, path = path_s).to_string(); log::info!("{}", self.status); self.current = 0; + // Each capture is drawn with its own scale (see scale.rs), so + // loading does not touch the manual scale in settings. self.dump = Some(d); - // Auto-populate from the first record's scope_state only if it - // is the record being shown (single-capture files). For multi- - // capture files the user must select a record to apply its - // scope_state via the thumbnail strip. - if self.dump.as_ref().map(|d| d.captures.len() <= 1).unwrap_or(false) { - if let Some(state) = self.current_entry() - .and_then(|e| e.record.scope_state.clone()) - { - self.apply_scope_state(&state); - } - } Task::none() } Message::Loaded(Err(e)) => { - self.status = t!("label.load_error", e = format!("{e}")).to_string(); + self.status = t!("label.load_error", e = e.to_string()).to_string(); log::error!("load error: {e}"); Task::none() } @@ -423,7 +415,7 @@ impl App { Message::PngPathPicked(None) => Task::none(), Message::PngPathPicked(Some(path)) => { if let Some(cap) = self.current_capture().cloned() { - match export_png(&path, &cap, &self.settings) { + match export_png(&path, &cap, &self.current_scale(), &self.settings) { Ok(()) => self.status = t!("label.png_saved", path = path.display().to_string()).to_string(), Err(e) => { self.status = t!("label.png_error", e = format!("{e}")).to_string(); @@ -455,13 +447,9 @@ impl App { Message::SelectCapture(i) => { if let Some(d) = &self.dump { if i < d.captures.len() { + // The selected capture brings its own scale; the + // manual scale in settings is left unchanged. self.current = i; - // Clone scope_state before calling apply_scope_state - // to avoid borrow conflict with self.dump. - let scope_state = d.captures[i].record.scope_state.clone(); - if let Some(ref state) = scope_state { - self.apply_scope_state(state); - } } } Task::none() @@ -577,23 +565,14 @@ impl App { Ok(pkt) => { let record = dso_parser::screenshot_to_record(&pkt, now, &raw_bytes); let capture = pkt.to_capture(); - // Auto-fill scale from screenshot metadata - let s = &pkt.settings; - let probe1 = 10f64.powi(s.ch1.probe_mode as i32); - let probe2 = 10f64.powi(s.ch2.probe_mode as i32); - self.settings.v_per_div_ch1 = s.ch1.volt_scale_uv as f64 / 1_000_000.0 * probe1; - self.settings.v_per_div_ch2 = s.ch2.volt_scale_uv as f64 / 1_000_000.0 * probe2; - self.settings.t_per_div_ms = s.timebase_ns_per_div as f64 / 1_000_000.0; - // pixel_to_volts at screen centre gives −zero_volt_pixels × vpp × mult, - // but zero_volt_uv stores the value with opposite sign → negate. - self.settings.v_offset_ch1 = -(s.ch1.zero_volt_uv as f64) / 1_000_000.0 * probe1; - self.settings.v_offset_ch2 = -(s.ch2.zero_volt_uv as f64) / 1_000_000.0 * probe2; - self.v_per_div_ch1_input = format_float(self.settings.v_per_div_ch1); - self.v_per_div_ch2_input = format_float(self.settings.v_per_div_ch2); - self.t_per_div_input = format_float(self.settings.t_per_div_ms); - self.v_offset_ch1_input = format_float(self.settings.v_offset_ch1); - self.v_offset_ch2_input = format_float(self.settings.v_offset_ch2); - self.settings.save(); + // The scale travels with the record's + // metadata; the manual scale in + // settings is left unchanged. + let scale = CaptureScale::for_capture( + record.scope_state.as_ref(), + &self.settings, + ); + let timebase = pkt.settings.timebase_label(); let entry = CaptureEntry { capture, timestamp: now, record }; if let Some(ref mut dump) = self.dump { @@ -612,9 +591,9 @@ impl App { self.deleted_at = None; let total = self.dump.as_ref().map(|d| d.captures.len()).unwrap_or(0); self.status = t!("label.screenshot_received", - ch1 = dso_parser::format_uv((self.settings.v_per_div_ch1 * 1_000_000.0) as i64, 0), - ch2 = dso_parser::format_uv((self.settings.v_per_div_ch2 * 1_000_000.0) as i64, 0), - timebase = s.timebase_label(), + ch1 = dso_parser::format_uv((scale.v_per_div_ch1 * 1_000_000.0) as i64, 0), + ch2 = dso_parser::format_uv((scale.v_per_div_ch2 * 1_000_000.0) as i64, 0), + timebase = timebase, total = total, ).to_string(); } @@ -746,28 +725,17 @@ impl App { } Task::none() } - Message::GraphClicked(frac_x, frac_y) => { - // Move nearest cursor to the click position. - // If X cursors enabled, move nearest X cursor knob. + Message::MeasCursorDragged(drag) => { + // Move only the lines the canvas picked for this drag: one + // line, or an X and a Y line near their crossing. if self.settings.measurement_cursor_x_enabled { - let (lo, hi) = self.settings.cursor_x_range; - let dist_lo = (frac_x - lo).abs(); - let dist_hi = (frac_x - hi).abs(); - if dist_lo <= dist_hi { - self.settings.cursor_x_range.0 = frac_x.clamp(0.0, hi); - } else { - self.settings.cursor_x_range.1 = frac_x.clamp(lo, 1.0); + if let Some(knob) = drag.target.x { + move_knob(&mut self.settings.cursor_x_range, knob, drag.frac_x); } } - // If Y cursors enabled, move nearest Y cursor knob. if self.settings.measurement_cursor_y_enabled { - let (lo, hi) = self.settings.cursor_y_range; - let dist_lo = (frac_y - lo).abs(); - let dist_hi = (frac_y - hi).abs(); - if dist_lo <= dist_hi { - self.settings.cursor_y_range.0 = frac_y.clamp(0.0, hi); - } else { - self.settings.cursor_y_range.1 = frac_y.clamp(lo, 1.0); + if let Some(knob) = drag.target.y { + move_knob(&mut self.settings.cursor_y_range, knob, drag.frac_y); } } Task::none() @@ -922,7 +890,7 @@ impl App { Message::ContextMenuExportPngPicked(Some(path)) => { let idx = self.context_export_idx.take().unwrap_or(self.current); if let Some(cap) = self.dump.as_ref().and_then(|d| d.captures.get(idx)).map(|e| &e.capture).cloned() { - match export_png(&path, &cap, &self.settings) { + match export_png(&path, &cap, &self.scale_of(idx), &self.settings) { Ok(()) => self.status = t!("label.png_saved", path = path.display().to_string()).to_string(), Err(e) => self.status = t!("label.png_error", e = format!("{e}")).to_string(), } @@ -1049,7 +1017,7 @@ impl App { self.firmware_status = t!("label.firmware_complete").to_string(); } Err(e) => { - self.firmware_status = t!("label.firmware_error", e = format!("{e}")).to_string(); + self.firmware_status = t!("label.firmware_error", e = e.to_string()).to_string(); } } finished = true; @@ -1449,30 +1417,20 @@ impl App { .into() } - /// Apply oscilloscope state metadata (V/div, V/offset, t/div) to the - /// current settings and input fields. Used when loading captures that - /// contain embedded scope_state (screenshot packets or .zwcap files). - /// - /// Note: `v_offset_v` is stored with the same sign as the device's - /// `zero_volt_uv` field. The device's `pixel_to_volts` formula at - /// screen centre gives `−zero_volt_pixels × vpp × mult`, i.e. the - /// *opposite* sign, so we negate here. - fn apply_scope_state(&mut self, state: &dso_parser::ScopeState) { - if let Some(ref ch1) = state.ch1 { - self.settings.v_per_div_ch1 = ch1.vdiv_v; - self.settings.v_offset_ch1 = -ch1.v_offset_v; - } - if let Some(ref ch2) = state.ch2 { - self.settings.v_per_div_ch2 = ch2.vdiv_v; - self.settings.v_offset_ch2 = -ch2.v_offset_v; - } - self.settings.t_per_div_ms = state.timebase_ns_per_div as f64 / 1_000_000.0; - self.v_per_div_ch1_input = format_float(self.settings.v_per_div_ch1); - self.v_per_div_ch2_input = format_float(self.settings.v_per_div_ch2); - self.t_per_div_input = format_float(self.settings.t_per_div_ms); - self.v_offset_ch1_input = format_float(self.settings.v_offset_ch1); - self.v_offset_ch2_input = format_float(self.settings.v_offset_ch2); - self.settings.save(); + /// Scale of the capture at `idx`: its metadata scale, or the manual + /// scale for a capture without metadata (or when there is no capture). + pub(crate) fn scale_of(&self, idx: usize) -> CaptureScale { + let state = self + .dump + .as_ref() + .and_then(|d| d.captures.get(idx)) + .and_then(|e| e.record.scope_state.as_ref()); + CaptureScale::for_capture(state, &self.settings) + } + + /// Scale of the capture being shown. + pub(crate) fn current_scale(&self) -> CaptureScale { + self.scale_of(self.current) } /// Apply fine-drag scaling when Ctrl is held: only 1/10 of the raw @@ -1511,6 +1469,7 @@ impl App { ); let n_samples = cap.map(|c| c.ch1.len()).unwrap_or(DEFAULT_BUFFER_DEPTH); let has_ch2_data = cap.and_then(|c| c.ch2.as_ref()).is_some(); + let scale = self.current_scale(); let scope = Scope { capture: cap, show_ch1: self.settings.show_ch1, @@ -1546,16 +1505,16 @@ impl App { } else { None }, - v_per_div_ch1: self.settings.v_per_div_ch1, - v_per_div_ch2: self.settings.v_per_div_ch2, - t_per_div_ms: self.settings.t_per_div_ms, - v_offset_ch1: self.settings.v_offset_ch1, - v_offset_ch2: self.settings.v_offset_ch2, + v_per_div_ch1: scale.v_per_div_ch1, + v_per_div_ch2: scale.v_per_div_ch2, + t_per_div_ms: scale.t_per_div_ms, + v_offset_ch1: scale.v_offset_ch1, + v_offset_ch2: scale.v_offset_ch2, active_channel: self.current_entry() .and_then(|e| e.record.scope_state.as_ref()) .map(|s| s.active_channel) .unwrap_or(0), - on_click: Some(Message::GraphClicked), + on_cursor_drag: Some(Message::MeasCursorDragged), }; canvas(scope) .width(Length::Fill) @@ -1571,13 +1530,13 @@ impl App { let (xlo, xhi) = self.settings.cursor_x_range; let (ylo, yhi) = self.settings.cursor_y_range; - // Scale parameters (per-channel) - let v_per_div_ch1 = self.settings.v_per_div_ch1; - let v_per_div_ch2 = self.settings.v_per_div_ch2; - let t_per_div_ms = self.settings.t_per_div_ms; - let v_offset_ch1 = self.settings.v_offset_ch1; - let v_offset_ch2 = self.settings.v_offset_ch2; - let total_time_ms = 12.0 * t_per_div_ms; + // Scale of the capture being shown (its metadata, or the manual scale). + let scale = self.current_scale(); + let v_per_div_ch1 = scale.v_per_div_ch1; + let v_per_div_ch2 = scale.v_per_div_ch2; + let v_offset_ch1 = scale.v_offset_ch1; + let v_offset_ch2 = scale.v_offset_ch2; + let total_time_ms = 12.0 * scale.t_per_div_ms; let mut items: Vec> = vec![ text(t!("label.measurement")).size(13).into(), @@ -1648,6 +1607,19 @@ impl App { items.push(rule::horizontal(1).into()); // ── Scale inputs (two-column layout: CH1 | CH2) ── + // A capture without metadata is drawn with the manual scale, which + // the user edits here. A capture with metadata shows its own scale + // read-only (a text_input without on_input is disabled). + let manual_scale = scale.source == ScaleSource::Manual; + let scale_field = |placeholder: &str, + input: &str, + value: f64, + on_input: fn(String) -> Message, + width: Length| { + let shown = if manual_scale { input.to_string() } else { format_float(value) }; + let field = text_input(placeholder, &shown).size(11).width(width); + if manual_scale { field.on_input(on_input) } else { field } + }; let col_w = Length::Fixed(85.0); let input_w = Length::Fixed(42.0); items.push( @@ -1663,14 +1635,10 @@ impl App { items.push( row![ text(t!("label.vdiv")).size(11).width(col_w), - text_input("1.0", &self.v_per_div_ch1_input) - .on_input(Message::VPerCellChangedCh1) - .size(11) - .width(input_w), - text_input("1.0", &self.v_per_div_ch2_input) - .on_input(Message::VPerCellChangedCh2) - .size(11) - .width(input_w), + scale_field("1.0", &self.v_per_div_ch1_input, v_per_div_ch1, + Message::VPerCellChangedCh1, input_w), + scale_field("1.0", &self.v_per_div_ch2_input, v_per_div_ch2, + Message::VPerCellChangedCh2, input_w), ] .spacing(2) .align_y(iced::Alignment::Center) @@ -1704,14 +1672,10 @@ impl App { items.push( row![ text(t!("label.voff")).size(11).width(col_w), - text_input("0.0", &self.v_offset_ch1_input) - .on_input(Message::VOffsetChangedCh1) - .size(11) - .width(input_w), - text_input("0.0", &self.v_offset_ch2_input) - .on_input(Message::VOffsetChangedCh2) - .size(11) - .width(input_w), + scale_field("0.0", &self.v_offset_ch1_input, v_offset_ch1, + Message::VOffsetChangedCh1, input_w), + scale_field("0.0", &self.v_offset_ch2_input, v_offset_ch2, + Message::VOffsetChangedCh2, input_w), ] .spacing(2) .align_y(iced::Alignment::Center) @@ -1721,15 +1685,23 @@ impl App { items.push( row![ text(t!("label.tdiv")).size(11).width(col_w), - text_input("1.0", &self.t_per_div_input) - .on_input(Message::TPerCellChanged) - .size(11) - .width(Length::Fixed(90.0)) + scale_field("1.0", &self.t_per_div_input, scale.t_per_div_ms, + Message::TPerCellChanged, Length::Fixed(90.0)), ] .spacing(2) .align_y(iced::Alignment::Center) .into(), ); + items.push( + text(if manual_scale { + t!("label.scale_manual") + } else { + t!("label.scale_from_metadata") + }) + .size(9) + .color(Color::from_rgb(0.6, 0.6, 0.6)) + .into(), + ); items.push(text(t!("label.ac_mode")).size(9).into()); items.push(rule::horizontal(1).into()); @@ -2169,6 +2141,14 @@ use crate::canvas::{GRID_HEIGHT_PX, PX_PER_DIV}; /// to voltage. Formula from pixel_to_volts: V = V_offset + (ADC_MID - v) × V/div / PX_PER_DIV, /// where v = frac × GRID_HEIGHT_PX + PX_PER_DIV matches draw_trace's offset /// (v=25 maps to y=0, the top of the visible grid). +/// Move one knob of a measurement-cursor range, keeping `low <= high`. +fn move_knob(range: &mut (f32, f32), knob: Knob, frac: f32) { + match knob { + Knob::Low => range.0 = frac.clamp(0.0, range.1), + Knob::High => range.1 = frac.clamp(range.0, 1.0), + } +} + fn frac_to_voltage(frac: f64, v_per_div: f64, v_offset: f64) -> f64 { let v = frac * GRID_HEIGHT_PX + PX_PER_DIV; v_offset + (ADC_VALUE_MID as f64 - v) * v_per_div / PX_PER_DIV @@ -2521,6 +2501,87 @@ mod tests { assert_eq!(app.settings.cursor_x_range, (0.1, 0.9)); } + #[test] + fn cursor_drag_moves_only_the_picked_lines() { + use crate::canvas::DragTarget; + let (mut app, _) = App::new(); + app.settings.measurement_cursor_x_enabled = true; + app.settings.measurement_cursor_y_enabled = true; + app.settings.cursor_x_range = (0.2, 0.6); + app.settings.cursor_y_range = (0.3, 0.7); + + // X line only: Y range must not change. + let _ = app.update(Message::MeasCursorDragged(CursorDrag { + target: DragTarget { x: Some(Knob::High), y: None }, + frac_x: 0.8, + frac_y: 0.1, + })); + assert_eq!(app.settings.cursor_x_range, (0.2, 0.8)); + assert_eq!(app.settings.cursor_y_range, (0.3, 0.7)); + + // Both lines near their crossing. + let _ = app.update(Message::MeasCursorDragged(CursorDrag { + target: DragTarget { x: Some(Knob::Low), y: Some(Knob::Low) }, + frac_x: 0.1, + frac_y: 0.4, + })); + assert_eq!(app.settings.cursor_x_range, (0.1, 0.8)); + assert_eq!(app.settings.cursor_y_range, (0.4, 0.7)); + } + + #[test] + fn cursor_drag_keeps_knob_order_and_respects_disabled_axis() { + use crate::canvas::DragTarget; + let (mut app, _) = App::new(); + app.settings.measurement_cursor_x_enabled = true; + app.settings.measurement_cursor_y_enabled = false; + app.settings.cursor_x_range = (0.2, 0.6); + app.settings.cursor_y_range = (0.3, 0.7); + + // Dragging the low knob past the high one stops at the high one. + let _ = app.update(Message::MeasCursorDragged(CursorDrag { + target: DragTarget { x: Some(Knob::Low), y: Some(Knob::Low) }, + frac_x: 0.9, + frac_y: 0.0, + })); + assert_eq!(app.settings.cursor_x_range, (0.6, 0.6)); + assert_eq!(app.settings.cursor_y_range, (0.3, 0.7)); + } + + #[test] + fn each_capture_keeps_its_own_scale() { + let (mut app, _) = App::new(); + app.settings.v_per_div_ch1 = 0.1; + app.settings.t_per_div_ms = 5.0; + let manual_before = (app.settings.v_per_div_ch1, app.settings.t_per_div_ms); + + let dump = test_entry(Capture { ch1: vec![1, 2, 3], ch2: None }); + let mut screenshot = test_entry(Capture { ch1: vec![4, 5, 6], ch2: None }); + screenshot.record.scope_state = Some(crate::scale::tests::scope_state(None)); + app.dump = Some(LoadedDump { + path: PathBuf::from("test.zwcap"), + captures: vec![screenshot, dump], + }); + + // Capture with metadata: its own 2 V/div and 50 µs/div. + let _ = app.update(Message::SelectCapture(0)); + let s = app.current_scale(); + assert_eq!(s.source, ScaleSource::Metadata); + assert_eq!((s.v_per_div_ch1, s.t_per_div_ms), (2.0, 0.05)); + + // Debug dump without metadata: the manual scale, not the scale of + // the capture shown before it. + let _ = app.update(Message::SelectCapture(1)); + let s = app.current_scale(); + assert_eq!(s.source, ScaleSource::Manual); + assert_eq!((s.v_per_div_ch1, s.t_per_div_ms), manual_before); + + // Selecting captures never rewrites the manual scale. + assert_eq!((app.settings.v_per_div_ch1, app.settings.t_per_div_ms), manual_before); + // Exports of a capture that is not shown use that capture's scale. + assert_eq!(app.scale_of(0).source, ScaleSource::Metadata); + } + #[test] fn app_select_capture_clamps() { let (mut app, _) = App::new(); diff --git a/gui/src/canvas.rs b/gui/src/canvas.rs index 3b8369f..6af7efc 100644 --- a/gui/src/canvas.rs +++ b/gui/src/canvas.rs @@ -38,22 +38,135 @@ pub struct Scope<'a, Message = ()> { pub v_offset_ch2: f64, /// Active channel (0 = CH1, 1 = CH2). Used for device cursor voltage. pub active_channel: u8, - /// Callback message factory for graph clicks: (frac_x, frac_y). - pub on_click: Option Message>, + /// Message factory for measurement-cursor drags on the graph. + pub on_cursor_drag: Option Message>, } -/// State for cursor drag interaction on the scope canvas. +/// State of the scope canvas: cursor drag interaction and the cached +/// trace layer. #[derive(Default)] pub struct ScopeState { dragging: Option, + /// Tessellated traces. Re-tessellating 60 000 samples on every mouse + /// move of a cursor drag is what made the GUI slow; the traces only + /// change when the data or the trace options do. + traces: canvas::Cache, + /// Fingerprint of everything the cached traces depend on. + traces_key: std::cell::Cell>, } -#[derive(Debug, Clone, Copy)] -enum DragTarget { - XLow, - XHigh, - YLow, - YHigh, +/// One knob of a measurement-cursor pair. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Knob { + /// First value of the `(low, high)` range. + Low, + /// Second value of the `(low, high)` range. + High, +} + +/// The measurement-cursor lines grabbed by a drag: one line, or one X and +/// one Y line together when the press was near where they cross. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct DragTarget { + pub x: Option, + pub y: Option, +} + +/// One step of a measurement-cursor drag: move the target lines to the +/// pointer position, given as fractions (0.0..1.0) of the plot area. +#[derive(Debug, Clone, Copy, PartialEq)] +pub struct CursorDrag { + pub target: DragTarget, + pub frac_x: f32, + pub frac_y: f32, +} + +/// A press within this distance (pixels) of the crossing of the nearest X +/// and Y cursor lines drags both lines together. +pub const CROSS_GRAB_RADIUS_PX: f32 = 12.0; +/// The pointer within this distance (pixels) of a cursor line shows a +/// resize pointer. +const LINE_HOVER_PX: f32 = 6.0; + +/// Nearest knob of a cursor pair to `pos` along one axis, and its distance +/// in pixels. When both knobs sit on the same pixel, the knob on the side the +/// pointer is on wins, so the pair can be pulled apart in either direction. +fn nearest_knob(pos: f32, origin: f32, extent: f32, (lo, hi): (f32, f32)) -> (Knob, f32) { + let p_lo = origin + lo.clamp(0.0, 1.0) * extent; + let p_hi = origin + hi.clamp(0.0, 1.0) * extent; + let d_lo = (pos - p_lo).abs(); + let d_hi = (pos - p_hi).abs(); + if d_lo < d_hi || (d_lo == d_hi && pos <= p_lo) { + (Knob::Low, d_lo) + } else { + (Knob::High, d_hi) + } +} + +/// Decide which measurement-cursor lines a press at `pos` grabs. +/// +/// Near the crossing of the nearest X and Y lines (within +/// [`CROSS_GRAB_RADIUS_PX`]) both lines are grabbed; otherwise only the +/// single nearest line, measured in pixels. Returns `None` when no +/// measurement cursor is enabled. +pub fn pick_drag_target( + pos: Point, + plot: Rectangle, + cursor_x: Option<(f32, f32)>, + cursor_y: Option<(f32, f32)>, +) -> Option { + let x = cursor_x.map(|r| nearest_knob(pos.x, plot.x, plot.width, r)); + let y = cursor_y.map(|r| nearest_knob(pos.y, plot.y, plot.height, r)); + let target = match (x, y) { + (None, None) => return None, + (Some((kx, _)), None) => DragTarget { x: Some(kx), y: None }, + (None, Some((ky, _))) => DragTarget { x: None, y: Some(ky) }, + (Some((kx, dx)), Some((ky, dy))) => { + if dx.hypot(dy) <= CROSS_GRAB_RADIUS_PX { + DragTarget { x: Some(kx), y: Some(ky) } + } else if dx <= dy { + DragTarget { x: Some(kx), y: None } + } else { + DragTarget { x: None, y: Some(ky) } + } + } + }; + Some(target) +} + +/// Convert a position (canvas coordinates) to plot fractions, clamped to +/// the plot area so a drag that leaves the canvas pins the line to the edge. +fn plot_fraction(pos: Point, plot: Rectangle) -> (f32, f32) { + let fx = if plot.width > 0.0 { (pos.x - plot.x) / plot.width } else { 0.0 }; + let fy = if plot.height > 0.0 { (pos.y - plot.y) / plot.height } else { 0.0 }; + (fx.clamp(0.0, 1.0), fy.clamp(0.0, 1.0)) +} + +/// Pointer shape for a drag target. +fn interaction_for(target: DragTarget) -> mouse::Interaction { + match (target.x, target.y) { + (Some(_), Some(_)) => mouse::Interaction::Move, + (Some(_), None) => mouse::Interaction::ResizingHorizontally, + (None, Some(_)) => mouse::Interaction::ResizingVertically, + (None, None) => mouse::Interaction::default(), + } +} + +/// The plot area (grid and traces) inside a canvas of `size`, leaving room +/// for the scale labels when they are shown. +pub fn plot_rect(size: Size, show_scales: bool, has_ch1: bool, has_ch2: bool) -> Rectangle { + let (left, bottom) = if show_scales { + let label_columns = u8::from(has_ch1) + u8::from(has_ch2); + (SCALE_MARGIN_LEFT * f32::from(label_columns), SCALE_MARGIN_BOTTOM) + } else { + (0.0, 0.0) + }; + Rectangle { + x: left, + y: 0.0, + width: (size.width - left).max(0.0), + height: (size.height - bottom).max(0.0), + } } const BG: Color = Color::from_rgb(0.04, 0.06, 0.10); @@ -88,119 +201,128 @@ impl canvas::Program for Scope<'_, Message> { bounds: Rectangle, cursor: mouse::Cursor, ) -> Option> { - let on_click = self.on_click?; - let pos = cursor.position_in(bounds)?; - let gx = if self.show_scales { - match (self.has_ch1, self.has_ch2) { - (true, true) => SCALE_MARGIN_LEFT * 2.0, - (true, false) | (false, true) => SCALE_MARGIN_LEFT, - (false, false) => 0.0, - } - } else { - 0.0 + let on_cursor_drag = self.on_cursor_drag?; + let plot = plot_rect(bounds.size(), self.show_scales, self.has_ch1, self.has_ch2); + let step = |target: DragTarget, pos: Point| { + let (frac_x, frac_y) = plot_fraction(pos, plot); + canvas::Action::publish(on_cursor_drag(CursorDrag { target, frac_x, frac_y })) + .and_capture() }; - let gw = bounds.width - gx; - let gy = if self.show_scales { SCALE_MARGIN_BOTTOM } else { 0.0 }; - let gh = bounds.height - gy; - let frac_x = ((pos.x - gx) / gw).clamp(0.0, 1.0); - let frac_y = (pos.y / gh).clamp(0.0, 1.0); match event { canvas::Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left)) => { - // Determine which cursor line is nearest and start drag - let mut best_dist = f32::MAX; - let mut target: Option = None; - - if let Some((lo, hi)) = self.meas_cursor_x { - let d_lo = (frac_x - lo).abs(); - let d_hi = (frac_x - hi).abs(); - if d_lo < best_dist { - best_dist = d_lo; - target = Some(DragTarget::XLow); - } - if d_hi < best_dist { - best_dist = d_hi; - target = Some(DragTarget::XHigh); - } - } - if let Some((lo, hi)) = self.meas_cursor_y { - let d_lo = (frac_y - lo).abs(); - let d_hi = (frac_y - hi).abs(); - if d_lo < best_dist { - best_dist = d_lo; - target = Some(DragTarget::YLow); - } - if d_hi < best_dist { - // best_dist = d_hi; // not needed, last comparison - target = Some(DragTarget::YHigh); - } - } - - let _ = best_dist; - state.dragging = target; - let msg = on_click(frac_x, frac_y); - Some(canvas::Action::publish(msg).and_capture()) + // Only a press inside the canvas starts a drag. + let pos = cursor.position_in(bounds)?; + let target = + pick_drag_target(pos, plot, self.meas_cursor_x, self.meas_cursor_y)?; + state.dragging = Some(target); + Some(step(target, pos)) } - canvas::Event::Mouse(mouse::Event::CursorMoved { .. }) => { - if state.dragging.is_some() { - let msg = on_click(frac_x, frac_y); - Some(canvas::Action::publish(msg).and_capture()) - } else { - None - } + canvas::Event::Mouse(mouse::Event::CursorMoved { position }) => { + // Keep following the pointer after it leaves the canvas; the + // position is clamped to the plot edge. + let target = state.dragging?; + let pos = Point::new(position.x - bounds.x, position.y - bounds.y); + Some(step(target, pos)) } canvas::Event::Mouse(mouse::Event::ButtonReleased(mouse::Button::Left)) => { - if state.dragging.take().is_some() { - Some(canvas::Action::request_redraw()) - } else { - None - } + // Handled wherever the pointer is, so a release outside the + // canvas cannot leave a drag stuck. + state + .dragging + .take() + .map(|_| canvas::Action::request_redraw()) } _ => None, } } + fn mouse_interaction( + &self, + state: &Self::State, + bounds: Rectangle, + cursor: mouse::Cursor, + ) -> mouse::Interaction { + if let Some(target) = state.dragging { + return interaction_for(target); + } + if self.on_cursor_drag.is_none() { + return mouse::Interaction::default(); + } + let Some(pos) = cursor.position_in(bounds) else { + return mouse::Interaction::default(); + }; + let plot = plot_rect(bounds.size(), self.show_scales, self.has_ch1, self.has_ch2); + let Some(target) = pick_drag_target(pos, plot, self.meas_cursor_x, self.meas_cursor_y) + else { + return mouse::Interaction::default(); + }; + // A press anywhere moves the nearest line; show the resize pointer + // only when the pointer is actually on a line or the crossing. + let near = |range: Option<(f32, f32)>, p: f32, o: f32, e: f32| { + range.is_some_and(|r| nearest_knob(p, o, e, r).1 <= LINE_HOVER_PX) + }; + let on_x = near(self.meas_cursor_x, pos.x, plot.x, plot.width); + let on_y = near(self.meas_cursor_y, pos.y, plot.y, plot.height); + let on_target = match (target.x, target.y) { + (Some(_), Some(_)) => true, + (Some(_), None) => on_x, + (None, Some(_)) => on_y, + (None, None) => false, + }; + if on_target { + interaction_for(target) + } else { + mouse::Interaction::default() + } + } + fn draw( &self, - _state: &Self::State, + state: &Self::State, renderer: &Renderer, _theme: &Theme, bounds: Rectangle, _cursor: mouse::Cursor, ) -> Vec { - let mut frame = Frame::new(renderer, bounds.size()); + // Three layers, drawn in order: background and grid, traces (cached), + // then cursors and labels on top. + let mut base = Frame::new(renderer, bounds.size()); // Background. - let area = Path::rectangle(Point::ORIGIN, frame.size()); - frame.fill(&area, BG); - - let gx = if self.show_scales { - match (self.has_ch1, self.has_ch2) { - (true, true) => SCALE_MARGIN_LEFT * 2.0, - (true, false) | (false, true) => SCALE_MARGIN_LEFT, - (false, false) => 0.0, - } - } else { - 0.0 - }; - let gy = if self.show_scales { SCALE_MARGIN_BOTTOM } else { 0.0 }; - let gw = frame.width() - gx; - let gh = frame.height() - gy; + let area = Path::rectangle(Point::ORIGIN, base.size()); + base.fill(&area, BG); - draw_grid(&mut frame, bounds.size(), gx, gy); + let plot = plot_rect(bounds.size(), self.show_scales, self.has_ch1, self.has_ch2); + let gx = plot.x; + let gw = plot.width; + let gh = plot.height; - if let Some(cap) = self.capture { - // Draw traces for each enabled channel. + draw_grid(&mut base, bounds.size(), gx, bounds.height - gh); + + let key = self.traces_key(plot); + if state.traces_key.get() != Some(key) { + state.traces.clear(); + state.traces_key.set(Some(key)); + } + let traces = state.traces.draw(renderer, bounds.size(), |frame| { + let Some(cap) = self.capture else { return }; + // Draw traces for each enabled channel. draw_trace() clips them + // to the plot area so off-screen samples do not run over the + // scale labels. let channels = [ (self.show_ch1, Some(&cap.ch1[..]) as Option<&[u8]>, CH1_COLOR), (self.show_ch2, cap.ch2.as_deref(), CH2_COLOR), ]; for &(show, data, color) in &channels { if let Some(samples) = show.then_some(data).flatten() { - draw_trace(&mut frame, samples, color, self.view_mode, gx, gh); + draw_trace(frame, samples, color, self.view_mode, plot); } } - } else { + }); + + let mut frame = Frame::new(renderer, bounds.size()); + if self.capture.is_none() { let text = Text { content: crate::i18n::t!("app.no_capture_loaded").to_string(), position: Point::new(gx + gw / 2.0, gh / 2.0), @@ -312,7 +434,28 @@ impl canvas::Program for Scope<'_, Message> { ); } - vec![frame.into_geometry()] + vec![base.into_geometry(), traces, frame.into_geometry()] + } +} + +impl Scope<'_, Message> { + /// Fingerprint of everything the trace layer depends on: the samples, + /// the trace options and the plot area. Hashing 2 × 60 000 bytes takes + /// microseconds, far less than tessellating them. + fn traces_key(&self, plot: Rectangle) -> u64 { + use std::hash::{Hash, Hasher}; + let mut h = std::collections::hash_map::DefaultHasher::new(); + if let Some(cap) = self.capture { + cap.ch1.hash(&mut h); + cap.ch2.hash(&mut h); + } else { + 0u8.hash(&mut h); + } + (self.show_ch1, self.show_ch2, self.view_mode as u8).hash(&mut h); + for v in [plot.x, plot.y, plot.width, plot.height] { + v.to_bits().hash(&mut h); + } + h.finish() } } @@ -432,65 +575,96 @@ fn draw_scales( } } -fn draw_trace(frame: &mut Frame, samples: &[u8], color: Color, mode: ViewMode, margin_left: f32, graph_height: f32) { +/// Draw one channel's trace into `plot`. +/// +/// Line and dot modes keep every sample's contribution: with more samples +/// than pixel columns, each column draws the min/max of its samples (line) +/// or each distinct value once (dot), so a single-sample spike stays +/// visible. Smooth mode is a deliberate visual filter and averages. +fn draw_trace(frame: &mut Frame, samples: &[u8], color: Color, mode: ViewMode, plot: Rectangle) { if samples.is_empty() { return; } - let size = frame.size(); let n = samples.len(); let stroke = Stroke::default().with_color(color).with_width(1.2); - - // x maps sample i -> pixel; downsample so we never draw more vertices than pixels. - let gw = size.width - margin_left; - let max_pts = (gw as usize).max(2); - let step = n.div_ceil(max_pts).max(1); - - let value_at = |i: usize| -> f32 { - match mode { - ViewMode::Smooth => { - // Moving average with a small window relative to downsampling step. - let half = (step / 2).max(2); - let lo = i.saturating_sub(half); - let hi = (i + half + 1).min(n); - let sum: u32 = samples[lo..hi].iter().map(|&b| b as u32).sum(); - sum as f32 / (hi - lo) as f32 + let columns = (plot.width as usize).max(2); + + // Sample index (possibly fractional) -> x pixel, so that sample 0 is on + // the left edge and sample n-1 on the right edge. + let x_at = |i: f32| plot.x + i / (n - 1).max(1) as f32 * plot.width; + // Capture values use screen-coordinate convention: low value = top + // of screen = positive voltage, high value = bottom = negative voltage. + // Use device pixel density: GRID_HEIGHT_PX = V_CELLS × PX_PER_DIV. + let y_at = + |v: f32| plot.y + (((v - PX_PER_DIV as f32) as f64 / GRID_HEIGHT_PX) * plot.height as f64) as f32; + // Representative x of a column: the middle of its sample range. + let column_x = |s: &crate::plot::ColumnSpan| x_at((s.start + s.end - 1) as f32 / 2.0); + let (top, bottom) = (plot.y, plot.y + plot.height); + + // Stroke the parts of a polyline that are inside the plot area. + let mut stroke_clipped = |points: Vec<(f32, f32)>| { + let runs = crate::plot::clip_polyline_y(&points, top, bottom); + let path = Path::new(|builder| { + for run in runs.iter().filter(|r| r.len() >= 2) { + builder.move_to(Point::new(run[0].0, run[0].1)); + for &(x, y) in &run[1..] { + builder.line_to(Point::new(x, y)); + } } - _ => samples[i] as f32, - } - }; - - let to_xy = |i: usize, v: f32| -> Point { - let x = margin_left + (i as f32 / (n - 1).max(1) as f32) * gw; - // Capture values use screen-coordinate convention: low value = top - // of screen = positive voltage, high value = bottom = negative voltage. - // Use device pixel density: GRID_HEIGHT_PX = V_CELLS × PX_PER_DIV. - let y = (((v - PX_PER_DIV as f32) as f64 / GRID_HEIGHT_PX) * graph_height as f64) as f32; - Point::new(x, y) + }); + frame.stroke(&path, stroke); }; match mode { ViewMode::Dot => { - let r = 1.2; - for i in (0..n).step_by(step) { - let p = to_xy(i, value_at(i)); - let dot = Path::circle(p, r); - frame.fill(&dot, color); + const R: f32 = 1.2; + let mut dots: Vec<(f32, f32)> = Vec::new(); + if n <= columns { + dots.extend(samples.iter().enumerate().map(|(i, &v)| (x_at(i as f32), y_at(v as f32)))); + } else { + for span in crate::plot::column_spans(samples, columns) { + let x = column_x(&span); + dots.extend( + crate::plot::distinct_values(&samples[span.start..span.end]) + .map(|v| (x, y_at(v as f32))), + ); + } + } + // Off-screen samples get no dot (same as the PNG export). Each + // dot is a small square through iced's rectangle fast path: + // at this size it looks like a round dot. Putting thousands of + // overlapping circles in one path is very slow, because the fill + // tessellator must resolve every overlap. + let size = Size::new(2.0 * R, 2.0 * R); + for &(x, y) in dots.iter().filter(|d| (top..=bottom).contains(&d.1)) { + frame.fill_rectangle(Point::new(x - R, y - R), size, color); } } - ViewMode::Line | ViewMode::Smooth => { - let path = Path::new(|builder| { - let mut started = false; - for i in (0..n).step_by(step) { - let p = to_xy(i, value_at(i)); - if started { - builder.line_to(p); - } else { - builder.move_to(p); - started = true; - } - } - }); - frame.stroke(&path, stroke); + ViewMode::Line => { + let points = if n <= columns { + samples.iter().enumerate().map(|(i, &v)| (x_at(i as f32), y_at(v as f32))).collect() + } else { + crate::plot::column_spans(samples, columns) + .iter() + .flat_map(|s| { + let x = column_x(s); + s.ordered().map(|v| (x, y_at(v as f32))) + }) + .collect() + }; + stroke_clipped(points); + } + ViewMode::Smooth => { + // Moving average with a small window relative to the decimation step. + let step = n.div_ceil(columns).max(1); + let half = (step / 2).max(2); + let value_at = |i: usize| -> f32 { + let lo = i.saturating_sub(half); + let hi = (i + half + 1).min(n); + let sum: u32 = samples[lo..hi].iter().map(|&b| b as u32).sum(); + sum as f32 / (hi - lo) as f32 + }; + stroke_clipped((0..n).step_by(step).map(|i| (x_at(i as f32), y_at(value_at(i)))).collect()); } } } @@ -590,3 +764,89 @@ pub fn format_duration_ms_scale(ms: f64) -> String { format!("{:.0}ns", ms * 1_000_000.0) } } + +#[cfg(test)] +mod tests { + use super::*; + + /// 1000 × 800 plot at the canvas origin: fractions map to round pixels. + const PLOT: Rectangle = Rectangle { x: 0.0, y: 0.0, width: 1000.0, height: 800.0 }; + const X: Option<(f32, f32)> = Some((0.2, 0.6)); // lines at x = 200, 600 + const Y: Option<(f32, f32)> = Some((0.25, 0.75)); // lines at y = 200, 600 + + fn pick(x: f32, y: f32) -> Option { + pick_drag_target(Point::new(x, y), PLOT, X, Y) + } + + #[test] + fn press_near_crossing_grabs_both_lines() { + let both = DragTarget { x: Some(Knob::High), y: Some(Knob::Low) }; + assert_eq!(pick(600.0, 200.0), Some(both)); + assert_eq!(pick(608.0, 208.0), Some(both)); // 11.3 px away + } + + #[test] + fn press_outside_crossing_radius_grabs_one_line() { + // On the X line but 50 px below the crossing. + assert_eq!(pick(601.0, 250.0), Some(DragTarget { x: Some(Knob::High), y: None })); + // On the Y line, far from any X line. + assert_eq!(pick(400.0, 598.0), Some(DragTarget { x: None, y: Some(Knob::High) })); + // Just outside the radius diagonally: the closer line wins. + assert_eq!(pick(609.0, 210.0), Some(DragTarget { x: Some(Knob::High), y: None })); + } + + #[test] + fn distance_is_compared_in_pixels_not_fractions() { + // 30 px from the X line (0.03 of the width) and 40 px from the Y line + // (0.05 of the height): the X line is nearer in pixels and in fractions. + assert_eq!(pick(230.0, 240.0).unwrap(), DragTarget { x: Some(Knob::Low), y: None }); + // Wide plot: 50 px from the X line is 0.025 of 2000 px, 40 px from the + // Y line is 0.05 of 800 px. Fractions would pick X; pixels pick Y. + let wide = Rectangle { width: 2000.0, ..PLOT }; + let t = pick_drag_target(Point::new(450.0, 240.0), wide, X, Y).unwrap(); + assert_eq!(t, DragTarget { x: None, y: Some(Knob::Low) }); + } + + #[test] + fn single_axis_and_disabled_cursors() { + let p = Point::new(10.0, 10.0); + assert_eq!(pick_drag_target(p, PLOT, None, None), None); + assert_eq!( + pick_drag_target(p, PLOT, X, None), + Some(DragTarget { x: Some(Knob::Low), y: None }) + ); + assert_eq!( + pick_drag_target(p, PLOT, None, Y), + Some(DragTarget { x: None, y: Some(Knob::Low) }) + ); + } + + #[test] + fn coincident_knobs_split_towards_the_pointer() { + let same = Some((0.5, 0.5)); // both X lines at x = 500 + let right = pick_drag_target(Point::new(520.0, 0.0), PLOT, same, None).unwrap(); + assert_eq!(right.x, Some(Knob::High)); + let left = pick_drag_target(Point::new(480.0, 0.0), PLOT, same, None).unwrap(); + assert_eq!(left.x, Some(Knob::Low)); + } + + #[test] + fn plot_fraction_clamps_outside_the_plot() { + let plot = Rectangle { x: 80.0, y: 0.0, width: 400.0, height: 200.0 }; + assert_eq!(plot_fraction(Point::new(280.0, 50.0), plot), (0.5, 0.25)); + assert_eq!(plot_fraction(Point::new(-30.0, 900.0), plot), (0.0, 1.0)); + } + + #[test] + fn plot_rect_reserves_scale_margins() { + let size = Size::new(600.0, 400.0); + let full = plot_rect(size, false, true, true); + assert_eq!(full, Rectangle { x: 0.0, y: 0.0, width: 600.0, height: 400.0 }); + let one = plot_rect(size, true, true, false); + assert_eq!(one.x, SCALE_MARGIN_LEFT); + assert_eq!(one.height, 400.0 - SCALE_MARGIN_BOTTOM); + let two = plot_rect(size, true, true, true); + assert_eq!(two.x, SCALE_MARGIN_LEFT * 2.0); + assert_eq!(two.width, 600.0 - SCALE_MARGIN_LEFT * 2.0); + } +} diff --git a/gui/src/export_image.rs b/gui/src/export_image.rs index fe34542..b5bd920 100644 --- a/gui/src/export_image.rs +++ b/gui/src/export_image.rs @@ -9,6 +9,7 @@ use std::path::Path; use dso_parser::{ADC_VALUE_MID, Capture}; use crate::canvas::format_duration_ms_scale; use crate::canvas::{GRID_HEIGHT_PX, PX_PER_DIV, T_CELLS, V_CELLS}; +use crate::scale::CaptureScale; use crate::settings::{Settings, ViewMode}; // ── Colour palette (mirrors canvas.rs constants) ─────────────────────────── @@ -79,8 +80,15 @@ impl PngExportConfig { // ── Main entry point ─────────────────────────────────────────────────────── -/// Export the current capture as a PNG image. -pub fn export_png(path: &Path, cap: &Capture, settings: &Settings) -> anyhow::Result<()> { +/// Export a capture as a PNG image, labelled with that capture's `scale` +/// (its metadata scale, or the manual scale; see `scale.rs`). Display +/// options (channels, view mode, size) come from `settings`. +pub fn export_png( + path: &Path, + cap: &Capture, + scale: &CaptureScale, + settings: &Settings, +) -> anyhow::Result<()> { let config = PngExportConfig { target_width: settings.png_export_width }; let graph_w = config.graph_w(); @@ -100,7 +108,7 @@ pub fn export_png(path: &Path, cap: &Capture, settings: &Settings) -> anyhow::Re // RGBA pixel buffer for tiny-skia. let mut pixels = vec![0u8; (width * height * 4) as usize]; - for chunk in pixels.chunks_exact_mut(4) { + for chunk in pixels.as_chunks_mut::<4>().0 { chunk.copy_from_slice(&[PNG_BG[0], PNG_BG[1], PNG_BG[2], 255]); } @@ -137,7 +145,7 @@ pub fn export_png(path: &Path, cap: &Capture, settings: &Settings) -> anyhow::Re }; // ── Scale labels ───────────────────────────────────────────────── - let t_per_div_ms = settings.t_per_div_ms; + let t_per_div_ms = scale.t_per_div_ms; let draw_scales_on_region = |pixels: &mut [u8], x_off: u32, y_off: u32, w: u32, h: u32, _n_samples: usize, vpd_ch1: f64, vo_ch1: f64, ch1_color: Option<[u8; 3]>, @@ -194,12 +202,12 @@ pub fn export_png(path: &Path, cap: &Capture, settings: &Settings) -> anyhow::Re if do_split { let ch1_col = settings.show_scales.then_some(PNG_CH1); draw_one(&mut pixels, &cap.ch1, PNG_CH1, 0, - settings.v_per_div_ch1, settings.v_offset_ch1, ch1_col); + scale.v_per_div_ch1, scale.v_offset_ch1, ch1_col); let ch2_col = settings.show_scales.then_some(PNG_CH2); if let Some(ch2) = &cap.ch2 { draw_one(&mut pixels, ch2, PNG_CH2, graph_h + scale_margin_bottom, - settings.v_per_div_ch2, settings.v_offset_ch2, ch2_col); + scale.v_per_div_ch2, scale.v_offset_ch2, ch2_col); } } else { draw_grid_on(&mut pixels, 0); @@ -228,8 +236,8 @@ pub fn export_png(path: &Path, cap: &Capture, settings: &Settings) -> anyhow::Re let ch2_col = if settings.show_ch2 && has_ch2 { Some(PNG_CH2) } else { None }; draw_scales_on_region( &mut pixels, scale_margin_left, 0, graph_w, graph_h, cap.ch1.len(), - settings.v_per_div_ch1, settings.v_offset_ch1, ch1_col, - settings.v_per_div_ch2, settings.v_offset_ch2, ch2_col, + scale.v_per_div_ch1, scale.v_offset_ch1, ch1_col, + scale.v_per_div_ch2, scale.v_offset_ch2, ch2_col, ); } } @@ -298,29 +306,12 @@ fn resample_waveform( return points; } - // Downscaling: min/max envelope per column. - let mut points = Vec::with_capacity(output_width as usize * 2); - for x in 0..output_width { - let start = x as usize * n / output_width as usize; - let end = ((x + 1) as usize * n / output_width as usize) - .max(start + 1) - .min(n); - let col = &samples[start..end]; - let min = *col.iter().min().unwrap() as f64; - let max = *col.iter().max().unwrap() as f64; - let y_min = map_y(min); - let y_max = map_y(max); - - // Preserve temporal direction. - if col.first() <= col.last() { - points.push((x as f32, y_min)); - points.push((x as f32, y_max)); - } else { - points.push((x as f32, y_max)); - points.push((x as f32, y_min)); - } - } - points + // Downscaling: min/max envelope per column, in temporal order. + crate::plot::column_spans(samples, output_width as usize) + .iter() + .enumerate() + .flat_map(|(x, span)| span.ordered().map(|v| (x as f32, map_y(v as f64)))) + .collect() } /// Build an anti-aliased grid path via tiny-skia. @@ -460,9 +451,10 @@ fn draw_trace( draw_run(&mut pixmap, &run); } -/// Draw dots via tiny-skia (Dot mode). Each visible sample is rendered as a -/// small filled circle. Samples outside the vertical mesh range are skipped; -/// unlike line/smooth modes, dot mode never creates synthetic border points. +/// Draw dots via tiny-skia (Dot mode). Every visible sample is rendered as a +/// small filled circle — none are skipped, so a single-sample spike stays in +/// the image. Samples outside the vertical mesh range are skipped; unlike +/// line/smooth modes, dot mode never creates synthetic border points. /// /// When anti-aliasing is disabled, dots are drawn as individual pixels /// directly into the RGBA buffer — no scaling, no smoothing, no sub-pixel @@ -486,11 +478,12 @@ fn draw_dots( return; } - let step = n.div_ceil(width as usize).max(1); - let sample_points = (0..n).step_by(step).filter_map(|i| { - let y = waveform_y(samples[i] as f64, height); + // Same x mapping as resample_waveform(): the last sample lands on the + // last pixel column of the graph, not one past it. + let sample_points = samples.iter().enumerate().filter_map(|(i, &v)| { + let y = waveform_y(v as f64, height); is_visible_y(y, height).then(|| { - let x = i as f64 / (n - 1).max(1) as f64 * width as f64; + let x = i as f64 / (n - 1).max(1) as f64 * (width - 1) as f64; (x as f32, y) }) }); @@ -519,16 +512,19 @@ fn draw_dots( paint.set_color(rgb_color(color)); paint.anti_alias = true; + // Dots that land on the same spot (common with 60 000 samples) are drawn + // once: rounding to a quarter pixel is invisible at any export size. + let mut seen = std::collections::HashSet::new(); + let mut path = tiny_skia::PathBuilder::new(); for (x, y) in sample_points { - let Some(circle) = tiny_skia::PathBuilder::from_circle( - x_off as f32 + x, - y_off as f32 + y, - dot_radius, - ) else { - continue; - }; + if seen.insert(((x * 4.0).round() as i32, (y * 4.0).round() as i32)) { + path.push_circle(x_off as f32 + x, y_off as f32 + y, dot_radius); + } + } + // One fill for all dots; overlapping circles stay solid under Winding. + if let Some(path) = path.finish() { pixmap.fill_path( - &circle, + &path, &paint, tiny_skia::FillRule::Winding, tiny_skia::Transform::identity(), @@ -740,3 +736,51 @@ fn write_png(path: &Path, width: u32, height: u32, rgba: &[u8]) -> anyhow::Resul writer.write_image_data(rgba)?; Ok(()) } + +#[cfg(test)] +mod tests { + use super::*; + + const W: u32 = 600; + const H: u32 = 400; + + /// 60 000 flat samples at mid-screen with a single-sample spike that + /// every-N-th decimation (N = 100) would skip. + fn spiky_samples() -> Vec { + let mut s = vec![ADC_VALUE_MID; 60_000]; + s[12_345] = 60; + s + } + + /// Rows of an initially all-zero image that something was drawn on. + fn drawn_rows(pixels: &[u8]) -> Vec { + (0..H) + .filter(|&y| { + (0..W).any(|x| { + let i = ((y * W + x) * 4) as usize; + pixels[i..i + 4] != [0, 0, 0, 0] + }) + }) + .collect() + } + + #[test] + fn dot_mode_keeps_a_single_sample_spike() { + let samples = spiky_samples(); + let spike_y = waveform_y(60.0, H).round() as u32; + for antialias in [false, true] { + let mut pixels = vec![0u8; (W * H * 4) as usize]; + draw_dots(&mut pixels, W, H, &samples, PNG_CH1, 0, 0, W, H, 1.0, antialias); + let rows = drawn_rows(&pixels); + assert!(rows.contains(&spike_y), "antialias={antialias}: spike row {spike_y} missing"); + } + } + + #[test] + fn line_mode_envelope_keeps_a_single_sample_spike() { + let points = resample_waveform(&spiky_samples(), W, H); + assert_eq!(points.len(), W as usize * 2); + let spike_y = waveform_y(60.0, H); + assert_eq!(points.iter().filter(|p| p.1 == spike_y).count(), 1); + } +} diff --git a/gui/src/main.rs b/gui/src/main.rs index 28dc97d..38cfdd7 100644 --- a/gui/src/main.rs +++ b/gui/src/main.rs @@ -8,7 +8,9 @@ mod export_image; mod flash; mod i18n; mod logging; +mod plot; mod range_slider; +mod scale; mod serial; mod settings; diff --git a/gui/src/plot.rs b/gui/src/plot.rs new file mode 100644 index 0000000..8060592 --- /dev/null +++ b/gui/src/plot.rs @@ -0,0 +1,270 @@ +//! Renderer-neutral waveform helpers shared by the screen canvas +//! (`canvas.rs`) and the PNG export (`export_image.rs`). +//! +//! When a trace has more samples than the output has pixel columns, both +//! renderers must keep every sample's contribution: a single-sample spike +//! must stay visible. [`column_spans`] reduces the samples to one min/max +//! span per output column instead of picking every N-th sample. + +/// The samples that fall into one output pixel column. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct ColumnSpan { + /// Index of the first sample in this column. + pub start: usize, + /// One past the index of the last sample in this column. + pub end: usize, + /// Smallest sample value in the column. + pub min: u8, + /// Largest sample value in the column. + pub max: u8, + /// `true` when the column's first sample is not greater than its last, + /// i.e. the signal runs from `min` to `max` within the column. + pub rising: bool, +} + +impl ColumnSpan { + /// The column's extremes in temporal order, so that a polyline drawn + /// through consecutive columns follows the signal's direction. + pub fn ordered(&self) -> [u8; 2] { + if self.rising { + [self.min, self.max] + } else { + [self.max, self.min] + } + } +} + +/// Split `samples` into `columns` consecutive, non-empty groups and return +/// the min/max span of each. Every sample belongs to exactly one column. +/// +/// Returns an empty vector when there are no samples or no columns. When +/// there are fewer samples than columns, each sample gets its own column +/// and the result has `samples.len()` entries. +pub fn column_spans(samples: &[u8], columns: usize) -> Vec { + let n = samples.len(); + if n == 0 || columns == 0 { + return Vec::new(); + } + let columns = columns.min(n); + (0..columns) + .map(|c| { + let start = c * n / columns; + let end = ((c + 1) * n / columns).max(start + 1).min(n); + let col = &samples[start..end]; + let (min, max) = col + .iter() + .fold((u8::MAX, u8::MIN), |(lo, hi), &v| (lo.min(v), hi.max(v))); + ColumnSpan { + start, + end, + min, + max, + rising: col[0] <= col[col.len() - 1], + } + }) + .collect() +} + +/// Distinct sample values inside `samples`, in ascending order. +/// +/// Used by dot mode: in a column holding many samples, dots with the same +/// value land on the same pixel, so drawing each distinct value once shows +/// exactly the same picture with far fewer shapes. +pub fn distinct_values(samples: &[u8]) -> impl Iterator { + let mut seen = [false; 256]; + for &v in samples { + seen[v as usize] = true; + } + (0..=255u8).filter(move |&v| seen[v as usize]) +} + +/// Clip a polyline to the horizontal band `top..=bottom` (y grows downward). +/// +/// Returns the visible runs: each run is a polyline wholly inside the band. +/// A segment that crosses the band edge is cut exactly at the edge, so the +/// trace visibly reaches the border before it leaves the screen, like on +/// the oscilloscope. Clipping is done on the geometry itself so it does not +/// depend on renderer clip support. +pub fn clip_polyline_y(points: &[(f32, f32)], top: f32, bottom: f32) -> Vec> { + let inside = |p: (f32, f32)| (top..=bottom).contains(&p.1); + let mut runs = Vec::new(); + let mut run: Vec<(f32, f32)> = Vec::new(); + if let [only] = points { + if inside(*only) { + runs.push(vec![*only]); + } + return runs; + } + for seg in points.windows(2) { + match clip_segment_y(seg[0], seg[1], top, bottom) { + Some((a, b)) => { + // A new run starts when the segment does not continue the + // previous one (the trace left the band in between). + if run.last() != Some(&a) { + if run.len() >= 2 { + runs.push(std::mem::take(&mut run)); + } + run.clear(); + run.push(a); + } + run.push(b); + } + None => { + if run.len() >= 2 { + runs.push(std::mem::take(&mut run)); + } + run.clear(); + } + } + } + if run.len() >= 2 { + runs.push(run); + } + runs +} + +/// The part of segment `p → q` inside the band `top..=bottom`, if any. +/// Endpoints that are already inside are returned unchanged (bit-exact), so +/// consecutive segments can be joined by comparing points. +fn clip_segment_y( + p: (f32, f32), + q: (f32, f32), + top: f32, + bottom: f32, +) -> Option<((f32, f32), (f32, f32))> { + let dy = q.1 - p.1; + if dy == 0.0 { + return (top..=bottom).contains(&p.1).then_some((p, q)); + } + let t_top = (top - p.1) / dy; + let t_bottom = (bottom - p.1) / dy; + let t0 = t_top.min(t_bottom).max(0.0); + let t1 = t_top.max(t_bottom).min(1.0); + if t0 > t1 { + return None; + } + let at = |t: f32| { + if t == 0.0 { + p + } else if t == 1.0 { + q + } else { + // A cut point lies on an edge; snap y onto it exactly so that + // rounding cannot leave it just outside the band. + let y = p.1 + dy * t; + let y = if (y - top).abs() < (y - bottom).abs() { + top + } else { + bottom + }; + (p.0 + (q.0 - p.0) * t, y) + } + }; + Some((at(t0), at(t1))) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn polyline_inside_band_is_one_run() { + let pts = [(0.0, 10.0), (1.0, 20.0), (2.0, 15.0)]; + assert_eq!(clip_polyline_y(&pts, 0.0, 100.0), vec![pts.to_vec()]); + } + + #[test] + fn polyline_leaving_and_returning_is_split_at_the_edges() { + // Goes below the band (y > 100) between x = 1 and x = 3. + let pts = [ + (0.0, 50.0), + (1.0, 90.0), + (2.0, 130.0), + (3.0, 90.0), + (4.0, 50.0), + ]; + let runs = clip_polyline_y(&pts, 0.0, 100.0); + assert_eq!(runs.len(), 2); + assert_eq!(runs[0], vec![(0.0, 50.0), (1.0, 90.0), (1.25, 100.0)]); + assert_eq!(runs[1], vec![(2.75, 100.0), (3.0, 90.0), (4.0, 50.0)]); + } + + #[test] + fn polyline_entirely_outside_band_is_dropped() { + let pts = [(0.0, -10.0), (1.0, -20.0), (2.0, 300.0)]; + // The last segment crosses the whole band, so only that piece remains. + let runs = clip_polyline_y(&pts, 0.0, 100.0); + assert_eq!(runs.len(), 1); + assert_eq!(runs[0].len(), 2); + assert!(runs[0].iter().all(|p| (0.0..=100.0).contains(&p.1))); + assert!(clip_polyline_y(&[(0.0, -5.0), (1.0, -6.0)], 0.0, 100.0).is_empty()); + } + + #[test] + fn single_point_and_empty_input() { + assert_eq!( + clip_polyline_y(&[(3.0, 4.0)], 0.0, 10.0), + vec![vec![(3.0, 4.0)]] + ); + assert!(clip_polyline_y(&[(3.0, 40.0)], 0.0, 10.0).is_empty()); + assert!(clip_polyline_y(&[], 0.0, 10.0).is_empty()); + } + + #[test] + fn spans_cover_every_sample_once() { + let samples: Vec = (0..1000).map(|i| (i % 256) as u8).collect(); + let spans = column_spans(&samples, 7); + assert_eq!(spans.len(), 7); + assert_eq!(spans[0].start, 0); + assert_eq!(spans.last().unwrap().end, samples.len()); + for pair in spans.windows(2) { + assert_eq!(pair[0].end, pair[1].start); + } + } + + #[test] + fn single_sample_spike_is_kept() { + // 60 000 flat samples with one spike, reduced to 600 columns: picking + // every 100th sample would miss index 12 345. + let mut samples = vec![128u8; 60_000]; + samples[12_345] = 30; + let spans = column_spans(&samples, 600); + let hit = spans + .iter() + .find(|s| (s.start..s.end).contains(&12_345)) + .unwrap(); + assert_eq!(hit.min, 30); + assert_eq!(hit.max, 128); + assert_eq!(spans.iter().filter(|s| s.min != 128).count(), 1); + } + + #[test] + fn fewer_samples_than_columns_gives_one_span_per_sample() { + let spans = column_spans(&[5, 9, 7], 100); + assert_eq!(spans.len(), 3); + assert_eq!( + spans.iter().map(|s| (s.min, s.max)).collect::>(), + vec![(5, 5), (9, 9), (7, 7)] + ); + } + + #[test] + fn empty_inputs_give_no_spans() { + assert!(column_spans(&[], 10).is_empty()); + assert!(column_spans(&[1, 2], 0).is_empty()); + } + + #[test] + fn ordered_follows_signal_direction() { + let rising = column_spans(&[10, 50, 20, 40], 1)[0]; + assert_eq!(rising.ordered(), [10, 50]); + let falling = column_spans(&[40, 50, 10, 20], 1)[0]; + assert_eq!(falling.ordered(), [50, 10]); + } + + #[test] + fn distinct_values_are_sorted_and_unique() { + let v: Vec = distinct_values(&[7, 3, 7, 200, 3]).collect(); + assert_eq!(v, vec![3, 7, 200]); + } +} diff --git a/gui/src/scale.rs b/gui/src/scale.rs new file mode 100644 index 0000000..84f4f8d --- /dev/null +++ b/gui/src/scale.rs @@ -0,0 +1,171 @@ +//! Display scale (V/div, V offset, t/div) of one capture. +//! +//! Each capture is shown with its own scale: +//! +//! * A capture **with metadata** (a screenshot packet, or a `.zwcap` record +//! that carries a `scope_state`) uses the scale the oscilloscope reported. +//! It is fixed and cannot be edited. +//! * A capture **without metadata** (an ASCII debug dump) uses the manual +//! scale the user entered in the measurement panel, stored in settings. +//! +//! Receiving or selecting a capture never changes the manual scale, so the +//! scale of one capture cannot leak into another. + +use crate::settings::Settings; +use dso_parser::ScopeState; + +/// Where a capture's scale comes from. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum ScaleSource { + /// Reported by the oscilloscope with the capture. + Metadata, + /// Entered by the user (the capture has no metadata). + Manual, +} + +/// The scale a capture is drawn and measured with. +#[derive(Debug, Clone, Copy, PartialEq)] +pub struct CaptureScale { + /// Volts per division for CH1. + pub v_per_div_ch1: f64, + /// Volts per division for CH2. + pub v_per_div_ch2: f64, + /// Voltage at the graph centre for CH1. + pub v_offset_ch1: f64, + /// Voltage at the graph centre for CH2. + pub v_offset_ch2: f64, + /// Time per division in milliseconds. + pub t_per_div_ms: f64, + pub source: ScaleSource, +} + +impl CaptureScale { + /// The manual scale from settings. + pub fn manual(settings: &Settings) -> Self { + Self { + v_per_div_ch1: settings.v_per_div_ch1, + v_per_div_ch2: settings.v_per_div_ch2, + v_offset_ch1: settings.v_offset_ch1, + v_offset_ch2: settings.v_offset_ch2, + t_per_div_ms: settings.t_per_div_ms, + source: ScaleSource::Manual, + } + } + + /// The scale of a capture: from its metadata when it has any, otherwise + /// the manual scale. + /// + /// A value the metadata does not carry (a channel that was off, or a + /// zero timebase) falls back to the manual value; such a channel has no + /// samples to draw, so the fallback only affects empty scale labels. + pub fn for_capture(scope_state: Option<&ScopeState>, settings: &Settings) -> Self { + let manual = Self::manual(settings); + let Some(state) = scope_state else { + return manual; + }; + let mut scale = Self { + source: ScaleSource::Metadata, + ..manual + }; + // The record stores the offset with the device's `zero_volt` sign; + // the voltage at the graph centre has the opposite sign. + if let Some(ch1) = &state.ch1 { + scale.v_per_div_ch1 = ch1.vdiv_v; + scale.v_offset_ch1 = -ch1.v_offset_v; + } + if let Some(ch2) = &state.ch2 { + scale.v_per_div_ch2 = ch2.vdiv_v; + scale.v_offset_ch2 = -ch2.v_offset_v; + } + if state.timebase_ns_per_div > 0 { + scale.t_per_div_ms = state.timebase_ns_per_div as f64 / 1_000_000.0; + } + scale + } +} + +#[cfg(test)] +pub(crate) mod tests { + use super::*; + use dso_parser::ChannelState; + + /// A metadata record: CH1 2 V/div, offset stored as +0.5 V, 50 µs/div. + pub(crate) fn scope_state(ch2: Option) -> ScopeState { + ScopeState { + timebase_label: "50us".into(), + timebase_ns_per_div: 50_000, + sample_rate_hz: 1_000_000.0, + buffer_depth: 60_000, + trigger_source: "CH1".into(), + trigger_mode: "Auto".into(), + trigger_edge: "Rising".into(), + trigger_level_v: 0.0, + trigger_delay_s: 0.0, + ch1: Some(channel(2.0, 0.5)), + ch2, + cursors_x_enable: false, + cursors_y_enable: false, + cursor_x1_frac: 0.0, + cursor_x2_frac: 0.0, + cursor_y1_frac: 0.0, + cursor_y2_frac: 0.0, + active_channel: 0, + } + } + + pub(crate) fn channel(vdiv_v: f64, v_offset_v: f64) -> ChannelState { + ChannelState { + vdiv_v, + coupling: "DC".into(), + probe: "×1".into(), + v_offset_v, + measurements: None, + } + } + + fn manual_settings() -> Settings { + Settings { + v_per_div_ch1: 0.1, + v_per_div_ch2: 0.2, + v_offset_ch1: 1.0, + v_offset_ch2: -1.0, + t_per_div_ms: 5.0, + ..Settings::default() + } + } + + #[test] + fn capture_without_metadata_uses_manual_scale() { + let s = manual_settings(); + let scale = CaptureScale::for_capture(None, &s); + assert_eq!(scale.source, ScaleSource::Manual); + assert_eq!(scale, CaptureScale::manual(&s)); + assert_eq!(scale.t_per_div_ms, 5.0); + } + + #[test] + fn capture_with_metadata_uses_its_own_scale() { + let s = manual_settings(); + let state = scope_state(Some(channel(0.5, -0.25))); + let scale = CaptureScale::for_capture(Some(&state), &s); + assert_eq!(scale.source, ScaleSource::Metadata); + assert_eq!(scale.v_per_div_ch1, 2.0); + assert_eq!(scale.v_offset_ch1, -0.5); + assert_eq!(scale.v_per_div_ch2, 0.5); + assert_eq!(scale.v_offset_ch2, 0.25); + assert_eq!(scale.t_per_div_ms, 0.05); + } + + #[test] + fn missing_metadata_values_fall_back_to_manual() { + let s = manual_settings(); + let mut state = scope_state(None); + state.timebase_ns_per_div = 0; + let scale = CaptureScale::for_capture(Some(&state), &s); + assert_eq!(scale.source, ScaleSource::Metadata); + assert_eq!(scale.v_per_div_ch1, 2.0); + assert_eq!(scale.v_per_div_ch2, 0.2); + assert_eq!(scale.v_offset_ch2, -1.0); + assert_eq!(scale.t_per_div_ms, 5.0); + } +} From c6df30d8cc181c8a340f351b913792f896132d49 Mon Sep 17 00:00:00 2001 From: Roman S Samarev Date: Thu, 26 Nov 2026 21:10:37 +0300 Subject: [PATCH 2/3] GUI: canvas: zoom and pan both axes with mouse - Wheel zooms the time axis around the pointer (1.25x per notch, smooth on trackpads); horizontal scroll or Shift+wheel pans time. - Option/Alt+wheel, or wheel over the voltage labels, zooms the voltage axis. Zoom-out may go past the device screen to the full ADC range 0..=255; the screen's edges are then marked with orange lines. - Right/middle-drag pans both axes. - Double-click resets the zoom; the cursor move made by the first click is undone, so cursors stay where they were. - Zooming through the unzoomed view stops there exactly (detent). Time zoom stops at 10 visible samples, voltage zoom at 8 ADC levels. - The zoom is stored with the identity of its capture, so other captures are shown unzoomed without explicit resets. - Measurement and device cursors stay on the signal; lines outside the view are neither drawn nor grabbable. Time and voltage labels follow the visible window with enough decimals; an "X xN Y xM" indicator shows the zoomed axes. Only visible samples are drawn, clipped on both axes. PNG export is unchanged (whole capture, unzoomed). - Remove the unused n_samples field of Scope. --- docs/GUI_DESIGN.md | 25 ++ docs/USER_MANUAL.md | 31 ++ gui/src/app.rs | 105 +++++- gui/src/canvas.rs | 771 ++++++++++++++++++++++++++++++++++++++------ gui/src/plot.rs | 345 +++++++++++++++++--- 5 files changed, 1135 insertions(+), 142 deletions(-) diff --git a/docs/GUI_DESIGN.md b/docs/GUI_DESIGN.md index 20c0b72..cb67ff3 100644 --- a/docs/GUI_DESIGN.md +++ b/docs/GUI_DESIGN.md @@ -75,6 +75,31 @@ yellow CH1, cyan CH2. Renders: shape over a line or crossing. A drag keeps following the pointer when it leaves the canvas (the line stops at the plot edge) and ends on release anywhere. +* **Zoom** on both axes (`plot::View` = one `plot::AxisView` per axis, the + visible `lo..hi` in unit coordinates: fraction of the capture for time, + fraction of the device screen height for voltage). Wheel zooms time around + the pointer (1.25× per notch; trackpad pixel scrolling doubles every + 200 px); Option/Alt + wheel, or wheel over the voltage labels, zooms + voltage; horizontal scrolling or Shift + wheel pans time; right/middle-drag + pans both axes; a double-click (iced `mouse::Click`, 300 ms / 6 px) + resets both axes. Because a single click places the nearest cursor line, + the canvas remembers the cursor ranges from before the first click and + `Message::ViewReset` restores them, so a double-click only unzooms. + Limits (`AxisLimits`): time stays inside the capture and + stops at 10 visible samples; voltage may zoom out past the device screen to + the full ADC range (0..=255, `Y_LIMITS`) and stops at 8 ADC levels. Zooming + through the unzoomed span stops exactly at `AxisView::UNIT` (a detent). When + the voltage view extends past the screen, its top and bottom edges are drawn + as orange lines. The canvas publishes `Message::ViewChanged`; the app + stores the view together with the identity of the capture it was made on + (sample-buffer address and timestamp), so any other capture is shown + unzoomed without explicit resets. Only the visible samples are processed + when drawing. Measurement and device cursors stay in unit coordinates: they + are mapped through the view for drawing and hit-testing, and lines outside + the view are neither drawn nor grabbable. Time and voltage labels follow + the visible window, with enough decimals to tell divisions apart; an + `X ×N Y ×M` indicator shows the zoomed axes. PNG export is not affected + by the zoom. * Green thin lines for **device cursors** (data-supplied, read-only) with numeric labels (sample numbers for X, voltage for Y). * Optional **axis scales** toggled via "Show scales" setting. Scale values diff --git a/docs/USER_MANUAL.md b/docs/USER_MANUAL.md index 56e0467..3583a23 100644 --- a/docs/USER_MANUAL.md +++ b/docs/USER_MANUAL.md @@ -78,6 +78,37 @@ metadata (debug dumps) use the manual scale from the Measurement panel. See * **CH1** (yellow), **CH2** (cyan) — toggle visibility in the controls panel. * **View mode** dropdown: Line, Dot, or Smooth (moving-average filter). +### Zoom + +Zoom works on both axes, with the pointer over the graph: + +| Action | Effect | +|--------|--------| +| Mouse wheel up / down (or two-finger scroll on a trackpad) | Zoom **time** in / out around the pointer: the point under the pointer stays in place | +| **Option/Alt** + wheel, or wheel over the **voltage labels** on the left | Zoom **voltage** in / out around the pointer | +| Horizontal scroll (trackpad swipe, tilt wheel) or **Shift** + wheel | Pan time left / right | +| **Right-drag** (or middle-drag) | Pan both axes: the signal follows the pointer | +| **Double-click** | Reset the zoom on both axes (cursors are left where they were) | +| Zoom out on an axis | Stops once at the normal view (whole capture, device screen); keep going to zoom out further | + +The zoom factor of each zoomed axis is shown in the top-right corner of the +graph (for example `X ×4.0 Y ×2.0`), and the time and voltage labels show the +zoomed window. Time zoom stops when about 10 samples fill the width, so it is +most useful on debug dumps (60 000 samples); a screenshot has only 300 points. +Voltage zoom stops at 8 ADC steps across the height. + +The voltage axis can be zoomed out **past the device screen**, up to the full +ADC range (0–255), to show the parts of the signal the oscilloscope clipped +off its own screen. The device screen's top and bottom edges are then marked +with orange lines. + +Each capture keeps its own zoom: selecting another capture shows it unzoomed, +and coming back restores the zoom. Measurement cursors stay on the signal +while zooming; a cursor line outside the zoomed window is not drawn and cannot +be grabbed until it is in view again. Δt, ΔV and the slider positions always +refer to the whole capture and the device screen. PNG export always shows the +whole capture, unzoomed. + ## Scale configuration At the top of the **Measurement** panel you can set the real-world scale. diff --git a/gui/src/app.rs b/gui/src/app.rs index 1d94d0a..0ac4b99 100644 --- a/gui/src/app.rs +++ b/gui/src/app.rs @@ -3,7 +3,7 @@ use std::path::PathBuf; use chrono::{DateTime, Local}; -use dso_parser::{ADC_VALUE_MID, Capture, DEFAULT_BUFFER_DEPTH}; +use dso_parser::{ADC_VALUE_MID, Capture}; #[cfg(test)] use dso_parser::ADC_VALUE_MAX; use iced::widget::{ @@ -18,8 +18,22 @@ use iced::{ Element, Length, Subscription, Task, Theme, }; -use crate::canvas::{CursorDrag, Knob, Scope, Thumbnail}; +use crate::canvas::{CursorDrag, Knob, Scope, Thumbnail, ViewReset}; +use crate::plot::View; use crate::scale::{CaptureScale, ScaleSource}; + +/// Identity of a capture for remembering its zoom: the address of its +/// sample buffer (stable while the capture exists, even when the capture +/// list is reordered) plus its timestamp, so a new capture that happens to +/// reuse a freed buffer is still told apart. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +struct CaptureId(usize, DateTime); + +impl CaptureId { + fn of(entry: &CaptureEntry) -> Self { + Self(entry.capture.ch1.as_ptr() as usize, entry.timestamp) + } +} use crate::export_image::export_png; use crate::i18n::t; use crate::range_slider; @@ -70,6 +84,10 @@ pub enum Message { VOffsetChangedCh2(String), // Measurement-cursor drag on the graph (one line, or X+Y near their crossing) MeasCursorDragged(CursorDrag), + // Zoom/pan of the graph (mouse wheel, right-drag) + ViewChanged(View), + // Double-click on the graph: reset the zoom + ViewReset(ViewReset), // Misc OpenInstructions, CloseInstructions, @@ -189,6 +207,10 @@ pub struct App { was_listening_before_flash: bool, /// Target capture index for context menu export operations. context_export_idx: Option, + /// Zoom/pan of both axes and the capture it belongs to. Any other + /// capture is shown unzoomed, so selecting, receiving or deleting + /// captures needs no explicit reset. + view: Option<(CaptureId, View)>, /// Last deleted capture, available for undo (index it was at, entry). deleted_capture: Option<(usize, CaptureEntry)>, /// Timestamp of the last deletion, for 30-second undo expiry. @@ -251,6 +273,7 @@ impl App { firmware_confirming: false, was_listening_before_flash: false, context_export_idx: None, + view: None, deleted_capture: None, deleted_at: None, ctrl_pressed: false, @@ -725,6 +748,24 @@ impl App { } Task::none() } + Message::ViewChanged(view) => { + self.view = self + .current_entry() + .map(|e| (CaptureId::of(e), view)); + Task::none() + } + Message::ViewReset(reset) => { + self.view = None; + // Undo the cursor move made by the first click of the + // double-click (ranges are only present for enabled cursors). + if let Some(range) = reset.cursor_x { + self.settings.cursor_x_range = range; + } + if let Some(range) = reset.cursor_y { + self.settings.cursor_y_range = range; + } + Task::none() + } Message::MeasCursorDragged(drag) => { // Move only the lines the canvas picked for this drag: one // line, or an X and a Y line near their crossing. @@ -1429,6 +1470,15 @@ impl App { } /// Scale of the capture being shown. + /// Zoom/pan of the capture being shown; unzoomed unless the user + /// zoomed this very capture. + pub(crate) fn current_view(&self) -> View { + match (&self.view, self.current_entry()) { + (Some((id, view)), Some(e)) if *id == CaptureId::of(e) => *view, + _ => View::UNIT, + } + } + pub(crate) fn current_scale(&self) -> CaptureScale { self.scale_of(self.current) } @@ -1467,7 +1517,6 @@ impl App { cap.is_some(), cap.map(|c| c.ch1.len()).unwrap_or(0) ); - let n_samples = cap.map(|c| c.ch1.len()).unwrap_or(DEFAULT_BUFFER_DEPTH); let has_ch2_data = cap.and_then(|c| c.ch2.as_ref()).is_some(); let scale = self.current_scale(); let scope = Scope { @@ -1476,7 +1525,6 @@ impl App { show_ch2: self.settings.show_ch2, view_mode: self.settings.view_mode, show_scales: self.settings.show_scales, - n_samples, has_ch1: self.settings.show_ch1, has_ch2: self.settings.show_ch2 && has_ch2_data, meas_cursor_x: if self.settings.measurement_cursor_x_enabled { @@ -1515,6 +1563,9 @@ impl App { .map(|s| s.active_channel) .unwrap_or(0), on_cursor_drag: Some(Message::MeasCursorDragged), + view: self.current_view(), + on_view_change: Some(Message::ViewChanged), + on_view_reset: Some(Message::ViewReset), }; canvas(scope) .width(Length::Fill) @@ -2582,6 +2633,52 @@ mod tests { assert_eq!(app.scale_of(0).source, ScaleSource::Metadata); } + #[test] + fn zoom_belongs_to_the_capture_it_was_made_on() { + let (mut app, _) = App::new(); + app.dump = Some(LoadedDump { + path: PathBuf::from("test.bin"), + captures: vec![ + test_entry(Capture { ch1: vec![1; 100], ch2: None }), + test_entry(Capture { ch1: vec![2; 100], ch2: None }), + ], + }); + let zoomed = View { + x: crate::plot::AxisView { lo: 0.2, hi: 0.4 }, + y: crate::plot::AxisView { lo: -0.1, hi: 1.1 }, + }; + let _ = app.update(Message::ViewChanged(zoomed)); + assert_eq!(app.current_view(), zoomed); + + // Another capture is shown in full; coming back restores the zoom. + let _ = app.update(Message::SelectCapture(1)); + assert_eq!(app.current_view(), View::UNIT); + let _ = app.update(Message::SelectCapture(0)); + assert_eq!(app.current_view(), zoomed); + } + + #[test] + fn double_click_reset_unzooms_and_restores_cursors() { + let (mut app, _) = App::new(); + app.dump = Some(LoadedDump { + path: PathBuf::from("test.bin"), + captures: vec![test_entry(Capture { ch1: vec![1; 100], ch2: None })], + }); + let mut zoomed = View::UNIT; + zoomed.x = crate::plot::AxisView { lo: 0.2, hi: 0.4 }; + let _ = app.update(Message::ViewChanged(zoomed)); + app.settings.cursor_x_range = (0.3, 0.5); // moved by the first click + app.settings.cursor_y_range = (0.1, 0.9); + + let _ = app.update(Message::ViewReset(ViewReset { + cursor_x: Some((0.3, 0.7)), + cursor_y: None, + })); + assert_eq!(app.current_view(), View::UNIT); + assert_eq!(app.settings.cursor_x_range, (0.3, 0.7)); + assert_eq!(app.settings.cursor_y_range, (0.1, 0.9)); + } + #[test] fn app_select_capture_clamps() { let (mut app, _) = App::new(); diff --git a/gui/src/canvas.rs b/gui/src/canvas.rs index 6af7efc..c2763ff 100644 --- a/gui/src/canvas.rs +++ b/gui/src/canvas.rs @@ -1,8 +1,10 @@ //! Oscilloscope-style graph canvas (iced::widget::canvas). +use crate::plot::{AxisLimits, ClipRect, View, X_LIMITS}; use crate::settings::ViewMode; use dso_parser::{ADC_VALUE_MID, Capture}; use iced::widget::canvas::{self, Frame, Geometry, Path, Stroke, Text}; -use iced::{mouse, Color, Point, Rectangle, Renderer, Size, Theme}; +use iced::advanced::mouse::{click::Kind as ClickKind, Click as MouseClick}; +use iced::{keyboard, mouse, Color, Point, Rectangle, Renderer, Size, Theme}; /// Drawable scope view backed by an optional `Capture`. pub struct Scope<'a, Message = ()> { @@ -10,9 +12,14 @@ pub struct Scope<'a, Message = ()> { pub show_ch1: bool, pub show_ch2: bool, pub view_mode: ViewMode, - /// User-positioned measurement cursors: X range (low, high) in 0.0..1.0. + /// Visible part of the capture on both axes (zoom and pan). + pub view: View, + /// User-positioned measurement cursors: X range (low, high) in 0.0..1.0 + /// of the whole capture (not of the visible window), so they stay on + /// the signal while zooming. pub meas_cursor_x: Option<(f32, f32)>, - /// User-positioned measurement cursors: Y range (low, high) in 0.0..1.0. + /// User-positioned measurement cursors: Y range (low, high) in 0.0..1.0 + /// of the device screen height (not of the zoomed view). pub meas_cursor_y: Option<(f32, f32)>, /// Device-supplied X cursors (read-only, from capture data). pub device_cursor_x: Option<(f32, f32)>, @@ -20,8 +27,6 @@ pub struct Scope<'a, Message = ()> { pub device_cursor_y: Option<(f32, f32)>, /// Show numeric axis scales on the graph. pub show_scales: bool, - /// Number of samples for X scale calculation. - pub n_samples: usize, /// Whether CH1 data is present in the capture (for scale labelling). pub has_ch1: bool, /// Whether CH2 data is present in the capture (for scale labelling). @@ -40,6 +45,22 @@ pub struct Scope<'a, Message = ()> { pub active_channel: u8, /// Message factory for measurement-cursor drags on the graph. pub on_cursor_drag: Option Message>, + /// Message factory for zoom/pan changes (mouse wheel, right-drag). + pub on_view_change: Option Message>, + /// Message factory for a double-click: reset the zoom. + pub on_view_reset: Option Message>, +} + +/// Double-click on the graph: reset the zoom on both axes. +/// +/// The first click of the double-click already moved the nearest cursor +/// line (a click places it). The cursor ranges from before that click are +/// carried here so the app can put them back: a double-click only resets +/// the zoom. +#[derive(Debug, Clone, Copy, PartialEq, Default)] +pub struct ViewReset { + pub cursor_x: Option<(f32, f32)>, + pub cursor_y: Option<(f32, f32)>, } /// State of the scope canvas: cursor drag interaction and the cached @@ -53,6 +74,16 @@ pub struct ScopeState { traces: canvas::Cache, /// Fingerprint of everything the cached traces depend on. traces_key: std::cell::Cell>, + /// Keyboard modifiers: Shift+wheel pans, Option/Alt+wheel zooms Y. + modifiers: keyboard::Modifiers, + /// Right/middle-button pan in progress: press position and the view + /// at that moment. + panning: Option<(Point, View)>, + /// Last left press, to detect double-clicks. + last_click: Option, + /// Measurement cursor ranges just before the last single left press, + /// restored by a double-click. + before_click: ViewReset, } /// One knob of a measurement-cursor pair. @@ -73,7 +104,9 @@ pub struct DragTarget { } /// One step of a measurement-cursor drag: move the target lines to the -/// pointer position, given as fractions (0.0..1.0) of the plot area. +/// pointer position. `frac_x` is a fraction of the whole capture and +/// `frac_y` a fraction of the device screen height (the zoom is already +/// applied to both). #[derive(Debug, Clone, Copy, PartialEq)] pub struct CursorDrag { pub target: DragTarget, @@ -88,18 +121,29 @@ pub const CROSS_GRAB_RADIUS_PX: f32 = 12.0; /// resize pointer. const LINE_HOVER_PX: f32 = 6.0; -/// Nearest knob of a cursor pair to `pos` along one axis, and its distance -/// in pixels. When both knobs sit on the same pixel, the knob on the side the -/// pointer is on wins, so the pair can be pulled apart in either direction. -fn nearest_knob(pos: f32, origin: f32, extent: f32, (lo, hi): (f32, f32)) -> (Knob, f32) { - let p_lo = origin + lo.clamp(0.0, 1.0) * extent; - let p_hi = origin + hi.clamp(0.0, 1.0) * extent; - let d_lo = (pos - p_lo).abs(); - let d_hi = (pos - p_hi).abs(); - if d_lo < d_hi || (d_lo == d_hi && pos <= p_lo) { - (Knob::Low, d_lo) - } else { - (Knob::High, d_hi) +/// Nearest visible knob of a cursor pair to `pos` along one axis, and its +/// distance in pixels. `lo`/`hi` are fractions of the visible plot; a knob +/// outside `0..=1` is off-screen (zoomed out of view) and cannot be grabbed. +/// When both knobs sit on the same pixel, the knob on the side the pointer +/// is on wins, so the pair can be pulled apart in either direction. +fn nearest_knob(pos: f32, origin: f32, extent: f32, (lo, hi): (f32, f32)) -> Option<(Knob, f32)> { + let candidate = |f: f32| { + (0.0..=1.0).contains(&f).then(|| { + let p = origin + f * extent; + ((pos - p).abs(), p) + }) + }; + match (candidate(lo), candidate(hi)) { + (None, None) => None, + (Some((d, _)), None) => Some((Knob::Low, d)), + (None, Some((d, _))) => Some((Knob::High, d)), + (Some((d_lo, p_lo)), Some((d_hi, _))) => { + if d_lo < d_hi || (d_lo == d_hi && pos <= p_lo) { + Some((Knob::Low, d_lo)) + } else { + Some((Knob::High, d_hi)) + } + } } } @@ -107,16 +151,17 @@ fn nearest_knob(pos: f32, origin: f32, extent: f32, (lo, hi): (f32, f32)) -> (Kn /// /// Near the crossing of the nearest X and Y lines (within /// [`CROSS_GRAB_RADIUS_PX`]) both lines are grabbed; otherwise only the -/// single nearest line, measured in pixels. Returns `None` when no -/// measurement cursor is enabled. +/// single nearest line, measured in pixels. `cursor_x` and `cursor_y` are +/// fractions of the visible plot. Returns `None` when no measurement cursor +/// line is enabled and on screen. pub fn pick_drag_target( pos: Point, plot: Rectangle, cursor_x: Option<(f32, f32)>, cursor_y: Option<(f32, f32)>, ) -> Option { - let x = cursor_x.map(|r| nearest_knob(pos.x, plot.x, plot.width, r)); - let y = cursor_y.map(|r| nearest_knob(pos.y, plot.y, plot.height, r)); + let x = cursor_x.and_then(|r| nearest_knob(pos.x, plot.x, plot.width, r)); + let y = cursor_y.and_then(|r| nearest_knob(pos.y, plot.y, plot.height, r)); let target = match (x, y) { (None, None) => return None, (Some((kx, _)), None) => DragTarget { x: Some(kx), y: None }, @@ -152,6 +197,97 @@ fn interaction_for(target: DragTarget) -> mouse::Interaction { } } +/// Zoom factor per wheel notch (line-based scrolling, mouse wheels). +const ZOOM_PER_LINE: f64 = 1.25; +/// Pixel-based scrolling (trackpads) that doubles or halves the zoom. +const ZOOM_PIXELS_PER_DOUBLING: f64 = 200.0; +/// Fraction of the visible window panned per wheel notch. +const PAN_PER_LINE: f64 = 0.1; +/// Zooming in stops when this many samples span the plot width. +const MIN_VISIBLE_SAMPLES: f64 = 10.0; +/// Voltage zoom-in stops when this many ADC levels span the plot height. +const MIN_VISIBLE_LEVELS: f64 = 8.0; + +/// Voltage axis: the whole ADC range 0..=255, which reaches beyond the +/// device screen (values 25..=225, unit coordinates 0..=1), so zooming out +/// shows the parts of the signal the oscilloscope clipped off its screen. +pub const Y_LIMITS: AxisLimits = AxisLimits { + lo: (0.0 - PX_PER_DIV) / GRID_HEIGHT_PX, + hi: (255.0 - PX_PER_DIV) / GRID_HEIGHT_PX, +}; +/// Smallest voltage-axis span. +const Y_MIN_SPAN: f64 = MIN_VISIBLE_LEVELS / GRID_HEIGHT_PX; + +/// Smallest time-axis span for a capture of `n` samples. +pub fn min_view_span(n: usize) -> f64 { + if n > 1 { + (MIN_VISIBLE_SAMPLES / (n - 1) as f64).min(1.0) + } else { + 1.0 + } +} + +/// New view after a wheel event over the graph. +/// +/// Vertical scrolling zooms around `anchor` (pointer position as fractions +/// of the plot): scrolling up/away zooms in. It zooms the time axis, or the +/// voltage axis when `zoom_y` is set (Option/Alt held, or the pointer over +/// the voltage labels). Horizontal scrolling (trackpad swipe, tilt wheel, +/// or Shift + vertical wheel) pans the time axis; with a trackpad the signal +/// follows the fingers. +pub fn wheel_view( + view: View, + delta: mouse::ScrollDelta, + shift: bool, + zoom_y: bool, + anchor: (f64, f64), + plot_width: f32, + min_span_x: f64, +) -> View { + let (dx, dy, pixels) = match delta { + mouse::ScrollDelta::Lines { x, y } => (x as f64, y as f64, false), + mouse::ScrollDelta::Pixels { x, y } => (x as f64, y as f64, true), + }; + // Shift turns a plain vertical wheel into horizontal panning (macOS + // already reports Shift+wheel as horizontal). + let (dx, dy) = if shift && dx == 0.0 { (dy, 0.0) } else { (dx, dy) }; + let mut v = view; + if dy != 0.0 { + let factor = if pixels { + 2f64.powf(-dy / ZOOM_PIXELS_PER_DOUBLING) + } else { + ZOOM_PER_LINE.powf(-dy) + }; + if zoom_y { + v.y = v.y.zoom_at(anchor.1, factor, Y_MIN_SPAN, Y_LIMITS); + } else { + v.x = v.x.zoom_at(anchor.0, factor, min_span_x, X_LIMITS); + } + } + if dx != 0.0 { + let delta = if pixels { + -dx / f64::from(plot_width.max(1.0)) * v.x.span() + } else { + -dx * PAN_PER_LINE * v.x.span() + }; + v.x = v.x.pan(delta, X_LIMITS); + } + v +} + +/// New view while dragging with the right/middle button: the signal +/// follows the pointer on both axes. `moved` is the pointer movement since +/// the press (pixels) and `start` the view at the press. +pub fn drag_view(start: View, moved: (f32, f32), plot: Rectangle) -> View { + let (mx, my) = moved; + let dx = -f64::from(mx) / f64::from(plot.width.max(1.0)) * start.x.span(); + let dy = -f64::from(my) / f64::from(plot.height.max(1.0)) * start.y.span(); + View { + x: start.x.pan(dx, X_LIMITS), + y: start.y.pan(dy, Y_LIMITS), + } +} + /// The plot area (grid and traces) inside a canvas of `size`, leaving room /// for the scale labels when they are shown. pub fn plot_rect(size: Size, show_scales: bool, has_ch1: bool, has_ch2: bool) -> Rectangle { @@ -179,6 +315,22 @@ const MEAS_CURSOR: Color = Color::from_rgb(1.0, 0.30, 0.50); const MEAS_FILL: Color = Color::from_rgba(1.0, 0.30, 0.50, 0.08); /// Device-supplied cursors (read-only). const DEV_CURSOR: Color = Color::from_rgb(0.40, 1.0, 0.40); +/// Top and bottom edges of the device screen, shown when the voltage axis +/// is zoomed out past them. +const SCREEN_EDGE: Color = Color::from_rgb(0.75, 0.55, 0.20); + +/// Zoom indicator text: the zoom factor of each zoomed axis, e.g. +/// `X ×4.0 Y ×0.8`. +fn zoom_indicator(view: View) -> String { + let mut parts = Vec::new(); + if !view.x.is_unit() { + parts.push(format!("X ×{:.1}", 1.0 / view.x.span())); + } + if !view.y.is_unit() { + parts.push(format!("Y ×{:.1}", 1.0 / view.y.span())); + } + parts.join(" ") +} /// Build a `Text` label for a device cursor with consistent styling. fn dev_label(content: String, position: Point) -> Text { @@ -201,29 +353,108 @@ impl canvas::Program for Scope<'_, Message> { bounds: Rectangle, cursor: mouse::Cursor, ) -> Option> { - let on_cursor_drag = self.on_cursor_drag?; let plot = plot_rect(bounds.size(), self.show_scales, self.has_ch1, self.has_ch2); - let step = |target: DragTarget, pos: Point| { - let (frac_x, frac_y) = plot_fraction(pos, plot); + let view = self.view; + let step = |on_cursor_drag: fn(CursorDrag) -> Message, target: DragTarget, pos: Point| { + let (fx, fy) = plot_fraction(pos, plot); + let frac_x = view.x.to_data(f64::from(fx)) as f32; + let frac_y = view.y.to_data(f64::from(fy)) as f32; canvas::Action::publish(on_cursor_drag(CursorDrag { target, frac_x, frac_y })) .and_capture() }; match event { + canvas::Event::Keyboard(keyboard::Event::ModifiersChanged(modifiers)) => { + state.modifiers = *modifiers; + None + } + canvas::Event::Mouse(mouse::Event::WheelScrolled { delta }) => { + let on_view_change = self.on_view_change?; + let cap = self.capture?; + let pos = cursor.position_in(bounds)?; + let (ax, ay) = plot_fraction(pos, plot); + // Option/Alt, or the pointer over the voltage labels left of + // the plot, zooms the voltage axis. Over the time labels + // below the plot the wheel zooms time, as over the plot. + let zoom_y = state.modifiers.alt() || pos.x < plot.x; + let new_view = wheel_view( + view, + *delta, + state.modifiers.shift(), + zoom_y, + (f64::from(ax), f64::from(ay)), + plot.width, + min_view_span(cap.sample_count()), + ); + // Capture the wheel even at the zoom limits so it does not + // scroll a surrounding container. + Some(if new_view == view { + canvas::Action::capture() + } else { + canvas::Action::publish(on_view_change(new_view)).and_capture() + }) + } + canvas::Event::Mouse(mouse::Event::ButtonPressed( + mouse::Button::Right | mouse::Button::Middle, + )) => { + // Right/middle-drag pans both axes. + self.on_view_change?; + self.capture?; + let pos = cursor.position_in(bounds)?; + state.panning = Some((pos, view)); + Some(canvas::Action::capture()) + } + canvas::Event::Mouse(mouse::Event::ButtonReleased( + mouse::Button::Right | mouse::Button::Middle, + )) => state + .panning + .take() + .map(|_| canvas::Action::request_redraw()), + canvas::Event::Mouse(mouse::Event::CursorMoved { position }) + if state.panning.is_some() => + { + let on_view_change = self.on_view_change?; + let (start_pos, start_view) = state.panning?; + let pos = Point::new(position.x - bounds.x, position.y - bounds.y); + let moved = (pos.x - start_pos.x, pos.y - start_pos.y); + let new_view = drag_view(start_view, moved, plot); + Some(if new_view == view { + canvas::Action::capture() + } else { + canvas::Action::publish(on_view_change(new_view)).and_capture() + }) + } canvas::Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left)) => { - // Only a press inside the canvas starts a drag. + // Only a press inside the canvas counts. let pos = cursor.position_in(bounds)?; + let click = MouseClick::new(pos, mouse::Button::Left, state.last_click); + state.last_click = Some(click); + if click.kind() == ClickKind::Single { + state.before_click = ViewReset { + cursor_x: self.meas_cursor_x, + cursor_y: self.meas_cursor_y, + }; + } else if let Some(on_view_reset) = self.on_view_reset { + // Double-click: reset the zoom and undo the cursor move + // made by the first click. + state.dragging = None; + return Some( + canvas::Action::publish(on_view_reset(state.before_click)).and_capture(), + ); + } + let on_cursor_drag = self.on_cursor_drag?; let target = - pick_drag_target(pos, plot, self.meas_cursor_x, self.meas_cursor_y)?; + pick_drag_target(pos, plot, self.screen_cursor_x(), self.screen_cursor_y())?; state.dragging = Some(target); - Some(step(target, pos)) + Some(step(on_cursor_drag, target, pos)) } canvas::Event::Mouse(mouse::Event::CursorMoved { position }) => { + let on_cursor_drag = self.on_cursor_drag?; // Keep following the pointer after it leaves the canvas; the // position is clamped to the plot edge. let target = state.dragging?; let pos = Point::new(position.x - bounds.x, position.y - bounds.y); - Some(step(target, pos)) + Some(step(on_cursor_drag, target, pos)) } canvas::Event::Mouse(mouse::Event::ButtonReleased(mouse::Button::Left)) => { // Handled wherever the pointer is, so a release outside the @@ -243,6 +474,9 @@ impl canvas::Program for Scope<'_, Message> { bounds: Rectangle, cursor: mouse::Cursor, ) -> mouse::Interaction { + if state.panning.is_some() { + return mouse::Interaction::Grabbing; + } if let Some(target) = state.dragging { return interaction_for(target); } @@ -253,17 +487,21 @@ impl canvas::Program for Scope<'_, Message> { return mouse::Interaction::default(); }; let plot = plot_rect(bounds.size(), self.show_scales, self.has_ch1, self.has_ch2); - let Some(target) = pick_drag_target(pos, plot, self.meas_cursor_x, self.meas_cursor_y) + let cursor_x = self.screen_cursor_x(); + let cursor_y = self.screen_cursor_y(); + let Some(target) = pick_drag_target(pos, plot, cursor_x, cursor_y) else { return mouse::Interaction::default(); }; // A press anywhere moves the nearest line; show the resize pointer // only when the pointer is actually on a line or the crossing. let near = |range: Option<(f32, f32)>, p: f32, o: f32, e: f32| { - range.is_some_and(|r| nearest_knob(p, o, e, r).1 <= LINE_HOVER_PX) + range + .and_then(|r| nearest_knob(p, o, e, r)) + .is_some_and(|(_, d)| d <= LINE_HOVER_PX) }; - let on_x = near(self.meas_cursor_x, pos.x, plot.x, plot.width); - let on_y = near(self.meas_cursor_y, pos.y, plot.y, plot.height); + let on_x = near(cursor_x, pos.x, plot.x, plot.width); + let on_y = near(cursor_y, pos.y, plot.y, plot.height); let on_target = match (target.x, target.y) { (Some(_), Some(_)) => true, (Some(_), None) => on_x, @@ -316,7 +554,7 @@ impl canvas::Program for Scope<'_, Message> { ]; for &(show, data, color) in &channels { if let Some(samples) = show.then_some(data).flatten() { - draw_trace(frame, samples, color, self.view_mode, plot); + draw_trace(frame, samples, color, self.view_mode, plot, self.view); } } }); @@ -336,53 +574,62 @@ impl canvas::Program for Scope<'_, Message> { } // Measurement cursors (user-controlled, with shaded range). - if let Some((xl, xr)) = self.meas_cursor_x { + // X positions follow the zoom; a line outside the view is not drawn + // and the shaded band is cut at the plot edges. + if let Some((sl, sr)) = self.screen_cursor_x() { let h = gh; - let px_l = gx + xl.clamp(0.0, 1.0) * gw; - let px_r = gx + xr.clamp(0.0, 1.0) * gw; - let region = Path::rectangle( - Point::new(px_l, 0.0), - Size::new((px_r - px_l).max(0.0), h), - ); - frame.fill(®ion, MEAS_FILL); + let (band_l, band_r) = (sl.max(0.0), sr.min(1.0)); + if band_l <= band_r { + let region = Path::rectangle( + Point::new(gx + band_l * gw, 0.0), + Size::new((band_r - band_l) * gw, h), + ); + frame.fill(®ion, MEAS_FILL); + } let stroke = Stroke::default().with_color(MEAS_CURSOR).with_width(1.0); - frame.stroke(&Path::line(Point::new(px_l, 0.0), Point::new(px_l, h)), stroke); - frame.stroke(&Path::line(Point::new(px_r, 0.0), Point::new(px_r, h)), stroke); + for s in [sl, sr].into_iter().filter(|s| (0.0..=1.0).contains(s)) { + let px = gx + s * gw; + frame.stroke(&Path::line(Point::new(px, 0.0), Point::new(px, h)), stroke); + } } - if let Some((yu, yl)) = self.meas_cursor_y { + // Y positions follow the voltage zoom the same way. + if let Some((su, sl)) = self.screen_cursor_y() { let w = frame.width(); let h = gh; - let py_u = yu.clamp(0.0, 1.0) * h; - let py_l = yl.clamp(0.0, 1.0) * h; - let region = Path::rectangle( - Point::new(0.0, py_u), - Size::new(w, (py_l - py_u).max(0.0)), - ); - frame.fill(®ion, MEAS_FILL); + let (band_u, band_l) = (su.max(0.0), sl.min(1.0)); + if band_u <= band_l { + let region = Path::rectangle( + Point::new(0.0, band_u * h), + Size::new(w, (band_l - band_u) * h), + ); + frame.fill(®ion, MEAS_FILL); + } let stroke = Stroke::default().with_color(MEAS_CURSOR).with_width(1.0); - frame.stroke(&Path::line(Point::new(0.0, py_u), Point::new(w, py_u)), stroke); - frame.stroke(&Path::line(Point::new(0.0, py_l), Point::new(w, py_l)), stroke); + for s in [su, sl].into_iter().filter(|s| (0.0..=1.0).contains(s)) { + let py = s * h; + frame.stroke(&Path::line(Point::new(0.0, py), Point::new(w, py)), stroke); + } } // Device cursors (read-only, dashed-look using thinner line, different colour). let dev_stroke = Stroke::default().with_color(DEV_CURSOR).with_width(1.0); if let Some((a, b)) = self.device_cursor_x { let h = gh; + // Show time values next to device X cursors that are in view. + let total_time_ms = T_CELLS as f64 * self.t_per_div_ms; for x in [a, b] { - let px = gx + x.clamp(0.0, 1.0) * gw; + let s = self.view.x.to_screen(f64::from(x.clamp(0.0, 1.0))) as f32; + if !(0.0..=1.0).contains(&s) { + continue; + } + let px = gx + s * gw; frame.stroke( &Path::line(Point::new(px, 0.0), Point::new(px, h)), dev_stroke, ); + let t_ms = f64::from(x) * total_time_ms; + frame.fill_text(dev_label(format_duration_ms_scale(t_ms), Point::new(px + 2.0, 12.0))); } - // Show time values next to device X cursors. - let total_time_ms = T_CELLS as f64 * self.t_per_div_ms; - let fmt_time = |frac: f32| -> String { - let t_ms = frac as f64 * total_time_ms; - format_duration_ms_scale(t_ms) - }; - frame.fill_text(dev_label(fmt_time(a), Point::new(gx + a.clamp(0.0, 1.0) * gw + 2.0, 12.0))); - frame.fill_text(dev_label(fmt_time(b), Point::new(gx + b.clamp(0.0, 1.0) * gw + 2.0, 12.0))); // Also show Δt between cursors. let dt_ms = (b - a).abs() as f64 * total_time_ms; let dt_label = format!("Δt={}", format_duration_ms_scale(dt_ms)); @@ -391,8 +638,13 @@ impl canvas::Program for Scope<'_, Message> { if let Some((a, b)) = self.device_cursor_y { let w = frame.width(); let h = gh; + let to_screen = |y: f32| self.view.y.to_screen(f64::from(y.clamp(0.0, 1.0))) as f32; for y in [a, b] { - let py = y.clamp(0.0, 1.0) * h; + let s = to_screen(y); + if !(0.0..=1.0).contains(&s) { + continue; + } + let py = s * h; frame.stroke( &Path::line(Point::new(0.0, py), Point::new(w, py)), dev_stroke, @@ -413,15 +665,44 @@ impl canvas::Program for Scope<'_, Message> { }; let v_a = cursor_to_voltage(a); let v_b = cursor_to_voltage(b); - frame.fill_text(dev_label(format!("{v_a:.2}V"), Point::new(gx + 4.0, a.clamp(0.0, 1.0) * h + 2.0))); - frame.fill_text(dev_label(format!("{v_b:.2}V"), Point::new(gx + 4.0, b.clamp(0.0, 1.0) * h + 2.0))); + for (y, v) in [(a, v_a), (b, v_b)] { + let s = to_screen(y); + if (0.0..=1.0).contains(&s) { + frame.fill_text(dev_label(format!("{v:.2}V"), Point::new(gx + 4.0, s * h + 2.0))); + } + } } // Axis scales (sample numbers on X, voltage on Y per-channel) + // When the voltage axis is zoomed out past the device screen, mark + // the screen's top and bottom edges: beyond them the oscilloscope + // itself clipped the signal. + for edge in [0.0, 1.0] { + let s = self.view.y.to_screen(edge) as f32; + if s > 0.0 && s < 1.0 { + let py = s * gh; + frame.stroke( + &Path::line(Point::new(gx, py), Point::new(gx + gw, py)), + Stroke::default().with_color(SCREEN_EDGE).with_width(1.0), + ); + } + } + + if !self.view.is_unit() { + frame.fill_text(Text { + content: zoom_indicator(self.view), + position: Point::new(gx + gw - 6.0, 6.0), + color: SCALE_COLOR, + size: 11.0.into(), + align_x: iced::alignment::Horizontal::Right.into(), + ..Text::default() + }); + } + if self.show_scales { draw_scales( &mut frame, - self.n_samples, + self.view, self.has_ch1, self.has_ch2, self.v_per_div_ch1, @@ -452,11 +733,31 @@ impl Scope<'_, Message> { 0u8.hash(&mut h); } (self.show_ch1, self.show_ch2, self.view_mode as u8).hash(&mut h); + for a in [self.view.x, self.view.y] { + (a.lo.to_bits(), a.hi.to_bits()).hash(&mut h); + } for v in [plot.x, plot.y, plot.width, plot.height] { v.to_bits().hash(&mut h); } h.finish() } + + /// Measurement X cursors as fractions of the visible plot (outside + /// `0..=1` when zoomed out of view). + fn screen_cursor_x(&self) -> Option<(f32, f32)> { + self.meas_cursor_x.map(|(lo, hi)| { + let s = |f: f32| self.view.x.to_screen(f64::from(f)) as f32; + (s(lo), s(hi)) + }) + } + + /// Measurement Y cursors as fractions of the visible plot height. + fn screen_cursor_y(&self) -> Option<(f32, f32)> { + self.meas_cursor_y.map(|(lo, hi)| { + let s = |f: f32| self.view.y.to_screen(f64::from(f)) as f32; + (s(lo), s(hi)) + }) + } } fn draw_grid(frame: &mut Frame, size: Size, margin_left: f32, margin_bottom: f32) { @@ -511,7 +812,7 @@ pub const GRID_HEIGHT_PX: f64 = (V_CELLS * PX_PER_DIV as usize) as f64; #[allow(clippy::too_many_arguments)] fn draw_scales( frame: &mut Frame, - _n_samples: usize, + view: View, has_ch1: bool, has_ch2: bool, v_per_div_ch1: f64, @@ -528,13 +829,15 @@ fn draw_scales( let gw = size.width - margin_left; // X axis: time labels at each visual division, in the bottom margin. + // With zoom, the 12 divisions cover only the visible window. let total_time_ms = T_CELLS as f64 * t_per_div_ms; + let step_ms = view.x.span() * total_time_ms / cols as f64; let dx = gw / cols as f32; for i in 0..=cols { - let frac = i as f64 / cols as f64; + let frac = view.x.to_data(i as f64 / cols as f64); let time_ms = frac * total_time_ms; let x = margin_left + i as f32 * dx; - let content = format_duration_ms_scale(time_ms); + let content = format_time_label(time_ms, step_ms); let label = Text { content, position: Point::new(x + 2.0, graph_height + 2.0), @@ -551,13 +854,24 @@ fn draw_scales( let ch1_x_offset = 2.0; let ch2_x_offset = if has_ch1 { 42.0 } else { 2.0 }; + // With voltage zoom the grid lines stay put and the labels follow the + // visible window; more decimals appear once 0.01 V no longer tells + // neighbouring lines apart. let mut label_ch = |v_per_div: f64, v_offset: f64, color: Color, x_off: f32| { + let step_v = v_per_div * view.y.span(); + let decimals = if step_v > 0.0 { + ((-step_v.log10()).ceil() as i32).clamp(2, 6) as usize + } else { + 2 + }; for i in 0..=rows { - let v = ((i + 1) as f64 / rows as f64) * GRID_HEIGHT_PX; + // Grid line i at unit coordinate f holds ADC value f × 200 + 25. + let f = view.y.to_data(i as f64 / rows as f64); + let v = f * GRID_HEIGHT_PX + PX_PER_DIV; let voltage = v_offset + (ADC_VALUE_MID as f64 - v) * v_per_div / PX_PER_DIV; let y = (i as f32 / rows as f32) * graph_height; let label = Text { - content: format!("{voltage:.2}V"), + content: format!("{voltage:.decimals$}V"), position: Point::new(x_off, y + 2.0), color, size: 9.0.into(), @@ -575,35 +889,60 @@ fn draw_scales( } } -/// Draw one channel's trace into `plot`. +/// Draw one channel's trace into `plot`, showing the part of the capture +/// selected by `view`. /// -/// Line and dot modes keep every sample's contribution: with more samples -/// than pixel columns, each column draws the min/max of its samples (line) -/// or each distinct value once (dot), so a single-sample spike stays -/// visible. Smooth mode is a deliberate visual filter and averages. -fn draw_trace(frame: &mut Frame, samples: &[u8], color: Color, mode: ViewMode, plot: Rectangle) { +/// Only the visible samples (plus one on each side, so lines reach the +/// edges) are processed. Line and dot modes keep every sample's +/// contribution: with more visible samples than pixel columns, each column +/// draws the min/max of its samples (line) or each distinct value once +/// (dot), so a single-sample spike stays visible. Smooth mode is a +/// deliberate visual filter and averages. +fn draw_trace( + frame: &mut Frame, + samples: &[u8], + color: Color, + mode: ViewMode, + plot: Rectangle, + view: View, +) { if samples.is_empty() { return; } let n = samples.len(); + let last = (n - 1).max(1) as f64; let stroke = Stroke::default().with_color(color).with_width(1.2); let columns = (plot.width as usize).max(2); - // Sample index (possibly fractional) -> x pixel, so that sample 0 is on - // the left edge and sample n-1 on the right edge. - let x_at = |i: f32| plot.x + i / (n - 1).max(1) as f32 * plot.width; + // Sample index (possibly fractional) -> x pixel: sample 0 is the start + // and sample n-1 the end of the capture; the view selects the window. + let x_at = |i: f64| (f64::from(plot.x) + view.x.to_screen(i / last) * f64::from(plot.width)) as f32; // Capture values use screen-coordinate convention: low value = top // of screen = positive voltage, high value = bottom = negative voltage. // Use device pixel density: GRID_HEIGHT_PX = V_CELLS × PX_PER_DIV. - let y_at = - |v: f32| plot.y + (((v - PX_PER_DIV as f32) as f64 / GRID_HEIGHT_PX) * plot.height as f64) as f32; + // The voltage view maps that screen fraction into the visible window. + let y_at = |v: f32| { + let f = (f64::from(v) - PX_PER_DIV) / GRID_HEIGHT_PX; + (f64::from(plot.y) + view.y.to_screen(f) * f64::from(plot.height)) as f32 + }; + + // Visible sample range, widened to the neighbouring samples so the + // trace runs to the plot edges instead of stopping short of them. + let i0 = ((view.x.lo * last).floor() as usize).min(n - 1); + let i1 = ((view.x.hi * last).ceil() as usize).min(n - 1); + let visible = &samples[i0..=i1]; // Representative x of a column: the middle of its sample range. - let column_x = |s: &crate::plot::ColumnSpan| x_at((s.start + s.end - 1) as f32 / 2.0); - let (top, bottom) = (plot.y, plot.y + plot.height); + let column_x = |s: &crate::plot::ColumnSpan| x_at(i0 as f64 + (s.start + s.end - 1) as f64 / 2.0); + let clip = ClipRect { + left: plot.x, + right: plot.x + plot.width, + top: plot.y, + bottom: plot.y + plot.height, + }; // Stroke the parts of a polyline that are inside the plot area. let mut stroke_clipped = |points: Vec<(f32, f32)>| { - let runs = crate::plot::clip_polyline_y(&points, top, bottom); + let runs = crate::plot::clip_polyline(&points, clip); let path = Path::new(|builder| { for run in runs.iter().filter(|r| r.len() >= 2) { builder.move_to(Point::new(run[0].0, run[0].1)); @@ -614,18 +953,24 @@ fn draw_trace(frame: &mut Frame, samples: &[u8], color: Color, mode: ViewMode, p }); frame.stroke(&path, stroke); }; + let each_sample = || { + visible + .iter() + .enumerate() + .map(move |(k, &v)| (x_at((i0 + k) as f64), y_at(v as f32))) + }; match mode { ViewMode::Dot => { const R: f32 = 1.2; let mut dots: Vec<(f32, f32)> = Vec::new(); - if n <= columns { - dots.extend(samples.iter().enumerate().map(|(i, &v)| (x_at(i as f32), y_at(v as f32)))); + if visible.len() <= columns { + dots.extend(each_sample()); } else { - for span in crate::plot::column_spans(samples, columns) { + for span in crate::plot::column_spans(visible, columns) { let x = column_x(&span); dots.extend( - crate::plot::distinct_values(&samples[span.start..span.end]) + crate::plot::distinct_values(&visible[span.start..span.end]) .map(|v| (x, y_at(v as f32))), ); } @@ -636,15 +981,15 @@ fn draw_trace(frame: &mut Frame, samples: &[u8], color: Color, mode: ViewMode, p // overlapping circles in one path is very slow, because the fill // tessellator must resolve every overlap. let size = Size::new(2.0 * R, 2.0 * R); - for &(x, y) in dots.iter().filter(|d| (top..=bottom).contains(&d.1)) { + for &(x, y) in dots.iter().filter(|&&d| clip.contains(d)) { frame.fill_rectangle(Point::new(x - R, y - R), size, color); } } ViewMode::Line => { - let points = if n <= columns { - samples.iter().enumerate().map(|(i, &v)| (x_at(i as f32), y_at(v as f32))).collect() + let points = if visible.len() <= columns { + each_sample().collect() } else { - crate::plot::column_spans(samples, columns) + crate::plot::column_spans(visible, columns) .iter() .flat_map(|s| { let x = column_x(s); @@ -656,7 +1001,7 @@ fn draw_trace(frame: &mut Frame, samples: &[u8], color: Color, mode: ViewMode, p } ViewMode::Smooth => { // Moving average with a small window relative to the decimation step. - let step = n.div_ceil(columns).max(1); + let step = visible.len().div_ceil(columns).max(1); let half = (step / 2).max(2); let value_at = |i: usize| -> f32 { let lo = i.saturating_sub(half); @@ -664,7 +1009,12 @@ fn draw_trace(frame: &mut Frame, samples: &[u8], color: Color, mode: ViewMode, p let sum: u32 = samples[lo..hi].iter().map(|&b| b as u32).sum(); sum as f32 / (hi - lo) as f32 }; - stroke_clipped((0..n).step_by(step).map(|i| (x_at(i as f32), y_at(value_at(i)))).collect()); + stroke_clipped( + (i0..=i1) + .step_by(step) + .map(|i| (x_at(i as f64), y_at(value_at(i)))) + .collect(), + ); } } } @@ -753,6 +1103,26 @@ impl canvas::Program for Thumbnail<'_> { // ── Time formatting utilities ────────────────────────────────────────────── +/// Time-axis label for `ms`, with enough decimals to tell labels `step_ms` +/// apart (needed when zoomed in). The unit follows the value, as in +/// [`format_duration_ms_scale`]. +pub fn format_time_label(ms: f64, step_ms: f64) -> String { + let (scale, unit) = if ms.abs() >= 1.0 { + (1.0, "ms") + } else if ms.abs() >= 1e-3 { + (1e3, "µs") + } else { + (1e6, "ns") + }; + let step = step_ms.abs() * scale; + let decimals = if step > 0.0 { + (-step.log10()).ceil().clamp(0.0, 6.0) as usize + } else { + 0 + }; + format!("{:.*}{unit}", decimals, ms * scale) +} + /// Compact time-duration formatting for scale labels: ms with 0.1 precision, /// µs/ns with .0. pub fn format_duration_ms_scale(ms: f64) -> String { @@ -830,6 +1200,215 @@ mod tests { assert_eq!(left.x, Some(Knob::Low)); } + #[test] + fn off_screen_cursor_lines_cannot_be_grabbed() { + // Zoomed so that the low X line is left of the view (-0.5) and the + // high one is on screen at 0.3. + let x = Some((-0.5, 0.3)); + let t = pick_drag_target(Point::new(10.0, 0.0), PLOT, x, None).unwrap(); + assert_eq!(t.x, Some(Knob::High)); + // Both X lines out of view: a press does nothing on X. + assert_eq!(pick_drag_target(Point::new(10.0, 0.0), PLOT, Some((-0.5, 1.5)), None), None); + // ...but still reaches a Y line. + let t = pick_drag_target(Point::new(10.0, 0.0), PLOT, Some((-0.5, 1.5)), Y).unwrap(); + assert_eq!(t, DragTarget { x: None, y: Some(Knob::Low) }); + } + + use crate::plot::AxisView; + + const UP: mouse::ScrollDelta = mouse::ScrollDelta::Lines { x: 0.0, y: 1.0 }; + const DOWN: mouse::ScrollDelta = mouse::ScrollDelta::Lines { x: 0.0, y: -1.0 }; + + /// Wheel over the plot at window fractions `(ax, ay)`, 1000 px wide. + fn wheel(v: View, delta: mouse::ScrollDelta, shift: bool, zoom_y: bool, at: (f64, f64)) -> View { + wheel_view(v, delta, shift, zoom_y, at, 1000.0, 0.0) + } + + #[test] + fn wheel_up_zooms_in_around_the_pointer() { + let v = wheel(View::UNIT, UP, false, false, (0.25, 0.5)); + assert!((v.x.span() - 0.8).abs() < 1e-12); + assert!(v.y.is_unit()); + // The capture point under the pointer stays under the pointer. + assert!((v.x.to_data(0.25) - 0.25).abs() < 1e-12); + // Scrolling back down returns to the full view. + assert!(wheel(v, DOWN, false, false, (0.25, 0.5)).is_unit()); + } + + #[test] + fn option_wheel_zooms_the_voltage_axis_around_the_pointer() { + let v = wheel(View::UNIT, UP, false, true, (0.5, 0.25)); + assert!(v.x.is_unit()); + assert!((v.y.span() - 0.8).abs() < 1e-12); + assert!((v.y.to_data(0.25) - 0.25).abs() < 1e-12); + } + + #[test] + fn voltage_zoom_out_goes_past_the_screen_to_the_adc_range() { + let mut v = View::UNIT; + for _ in 0..10 { + v = wheel(v, DOWN, false, true, (0.5, 0.5)); + } + // ADC 0..=255 in screen units (screen = 25..=225). + assert!((v.y.lo - (-0.125)).abs() < 1e-12); + assert!((v.y.hi - 1.15).abs() < 1e-12); + // Zooming back in passes through the device screen view exactly. + let mut seen_unit = false; + for _ in 0..10 { + v = wheel(v, UP, false, true, (0.5, 0.5)); + seen_unit |= v.y.is_unit(); + } + assert!(seen_unit); + } + + #[test] + fn voltage_zoom_in_stops_at_eight_adc_levels() { + let mut v = View::UNIT; + for _ in 0..40 { + v = wheel(v, UP, false, true, (0.5, 0.5)); + } + assert!((v.y.span() * GRID_HEIGHT_PX - 8.0).abs() < 1e-9); + } + + #[test] + fn trackpad_pixels_zoom_smoothly() { + let v = wheel(View::UNIT, mouse::ScrollDelta::Pixels { x: 0.0, y: 200.0 }, false, false, (0.5, 0.5)); + assert!((v.x.span() - 0.5).abs() < 1e-12); + } + + #[test] + fn horizontal_scroll_and_shift_wheel_pan() { + let v = View { x: AxisView { lo: 0.4, hi: 0.6 }, y: AxisView::UNIT }; + // Trackpad swipe of 100 px on a 1000 px plot moves by 1/10 of the view. + let swiped = wheel(v, mouse::ScrollDelta::Pixels { x: -100.0, y: 0.0 }, false, false, (0.5, 0.5)); + assert!((swiped.x.lo - 0.42).abs() < 1e-12 && (swiped.x.span() - 0.2).abs() < 1e-12); + // Shift + wheel pans instead of zooming. + let shifted = wheel(v, DOWN, true, false, (0.5, 0.5)); + assert!((shifted.x.span() - 0.2).abs() < 1e-12); + assert!((shifted.x.lo - 0.42).abs() < 1e-12); + } + + #[test] + fn right_drag_moves_the_signal_with_the_pointer() { + let plot = Rectangle { x: 0.0, y: 0.0, width: 1000.0, height: 800.0 }; + let start = View { + x: AxisView { lo: 0.4, hi: 0.6 }, + y: AxisView { lo: 0.25, hi: 0.75 }, + }; + // Dragging right by 100 px shows earlier samples (view moves left by + // 100/1000 of its 0.2 span); dragging down by 80 px shows higher + // positions (view moves up by 80/800 of its 0.5 span). + let v = drag_view(start, (100.0, 80.0), plot); + assert!((v.x.lo - 0.38).abs() < 1e-12); + assert!((v.y.lo - 0.2).abs() < 1e-12); + // Unzoomed time axis cannot pan; the voltage axis stops at its limits. + let v = drag_view(View::UNIT, (300.0, 10_000.0), plot); + assert!(v.x.is_unit()); + assert!((v.y.lo - Y_LIMITS.lo).abs() < 1e-12); + } + + #[test] + fn zoom_in_stops_at_min_visible_samples() { + let mut v = View::UNIT; + let up = mouse::ScrollDelta::Lines { x: 0.0, y: 10.0 }; + for _ in 0..20 { + v = wheel_view(v, up, false, false, (0.5, 0.5), 1000.0, min_view_span(60_000)); + } + assert!((v.x.span() * 59_999.0 - 10.0).abs() < 1e-6); + assert_eq!(min_view_span(5), 1.0); + } + + #[derive(Debug, Clone, PartialEq)] + enum TestMsg { + Drag(CursorDrag), + View(View), + Reset(ViewReset), + } + + fn scope_for_clicks(cap: &Capture, cursor_x: Option<(f32, f32)>) -> Scope<'_, TestMsg> { + Scope { + capture: Some(cap), + show_ch1: true, + show_ch2: false, + view_mode: ViewMode::Line, + view: View::UNIT, + meas_cursor_x: cursor_x, + meas_cursor_y: None, + device_cursor_x: None, + device_cursor_y: None, + show_scales: false, + has_ch1: true, + has_ch2: false, + v_per_div_ch1: 1.0, + v_per_div_ch2: 1.0, + t_per_div_ms: 1.0, + v_offset_ch1: 0.0, + v_offset_ch2: 0.0, + active_channel: 0, + on_cursor_drag: Some(TestMsg::Drag), + on_view_change: Some(TestMsg::View), + on_view_reset: Some(TestMsg::Reset), + } + } + + /// Send a left press at `pos` through the canvas and return its message. + fn press(scope: &Scope<'_, TestMsg>, state: &mut ScopeState, pos: Point) -> Option { + use canvas::Program; + let event = canvas::Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left)); + let action = Program::::update(scope, state, &event, PLOT, mouse::Cursor::Available(pos))?; + action.into_inner().0 + } + + #[test] + fn double_click_resets_the_zoom_and_keeps_the_cursors() { + let cap = Capture { ch1: vec![128; 100], ch2: None }; + let mut state = ScopeState::default(); + let pos = Point::new(500.0, 400.0); + + // First click: places the nearest X cursor line, as before. + let scope = scope_for_clicks(&cap, Some((0.2, 0.6))); + assert!(matches!(press(&scope, &mut state, pos), Some(TestMsg::Drag(_)))); + + // Second click right after: reset, restoring the cursors from + // before the first click (the app has moved the line meanwhile). + let moved = scope_for_clicks(&cap, Some((0.2, 0.5))); + let reset = press(&moved, &mut state, pos); + assert_eq!( + reset, + Some(TestMsg::Reset(ViewReset { cursor_x: Some((0.2, 0.6)), cursor_y: None })) + ); + assert!(state.dragging.is_none()); + } + + #[test] + fn clicks_far_apart_are_not_a_double_click() { + let cap = Capture { ch1: vec![128; 100], ch2: None }; + let mut state = ScopeState::default(); + let scope = scope_for_clicks(&cap, Some((0.2, 0.6))); + assert!(matches!(press(&scope, &mut state, Point::new(100.0, 100.0)), Some(TestMsg::Drag(_)))); + assert!(matches!(press(&scope, &mut state, Point::new(700.0, 100.0)), Some(TestMsg::Drag(_)))); + } + + #[test] + fn zoom_indicator_names_the_zoomed_axes() { + assert_eq!(zoom_indicator(View::UNIT), ""); + let v = View { x: AxisView { lo: 0.0, hi: 0.25 }, y: AxisView::UNIT }; + assert_eq!(zoom_indicator(v), "X ×4.0"); + let v = View { x: AxisView { lo: 0.0, hi: 0.25 }, y: AxisView { lo: -0.125, hi: 1.125 } }; + assert_eq!(zoom_indicator(v), "X ×4.0 Y ×0.8"); + } + + #[test] + fn time_labels_keep_the_old_look_and_resolve_zoom_steps() { + // Unzoomed 0.2 ms/div labels are unchanged. + assert_eq!(format_time_label(0.0, 0.2), "0ns"); + assert_eq!(format_time_label(0.2, 0.2), "200µs"); + assert_eq!(format_time_label(1.2, 0.2), "1.2ms"); + // Zoomed in to 0.5 µs/div: neighbouring labels differ. + assert_eq!(format_time_label(1.0005, 0.0005), "1.0005ms"); + assert_ne!(format_time_label(0.5120, 0.0005), format_time_label(0.5125, 0.0005)); + } + #[test] fn plot_fraction_clamps_outside_the_plot() { let plot = Rectangle { x: 80.0, y: 0.0, width: 400.0, height: 200.0 }; diff --git a/gui/src/plot.rs b/gui/src/plot.rs index 8060592..1019cb5 100644 --- a/gui/src/plot.rs +++ b/gui/src/plot.rs @@ -78,28 +78,42 @@ pub fn distinct_values(samples: &[u8]) -> impl Iterator { (0..=255u8).filter(move |&v| seen[v as usize]) } -/// Clip a polyline to the horizontal band `top..=bottom` (y grows downward). +/// Axis-aligned clip rectangle (y grows downward). +#[derive(Debug, Clone, Copy, PartialEq)] +pub struct ClipRect { + pub left: f32, + pub right: f32, + pub top: f32, + pub bottom: f32, +} + +impl ClipRect { + pub fn contains(&self, p: (f32, f32)) -> bool { + (self.left..=self.right).contains(&p.0) && (self.top..=self.bottom).contains(&p.1) + } +} + +/// Clip a polyline to `rect`. /// -/// Returns the visible runs: each run is a polyline wholly inside the band. -/// A segment that crosses the band edge is cut exactly at the edge, so the -/// trace visibly reaches the border before it leaves the screen, like on +/// Returns the visible runs: each run is a polyline wholly inside the +/// rectangle. A segment that crosses an edge is cut exactly at the edge, so +/// the trace visibly reaches the border before it leaves the screen, like on /// the oscilloscope. Clipping is done on the geometry itself so it does not /// depend on renderer clip support. -pub fn clip_polyline_y(points: &[(f32, f32)], top: f32, bottom: f32) -> Vec> { - let inside = |p: (f32, f32)| (top..=bottom).contains(&p.1); +pub fn clip_polyline(points: &[(f32, f32)], rect: ClipRect) -> Vec> { let mut runs = Vec::new(); let mut run: Vec<(f32, f32)> = Vec::new(); if let [only] = points { - if inside(*only) { + if rect.contains(*only) { runs.push(vec![*only]); } return runs; } for seg in points.windows(2) { - match clip_segment_y(seg[0], seg[1], top, bottom) { + match clip_segment(seg[0], seg[1], rect) { Some((a, b)) => { // A new run starts when the segment does not continue the - // previous one (the trace left the band in between). + // previous one (the trace left the rectangle in between). if run.last() != Some(&a) { if run.len() >= 2 { runs.push(std::mem::take(&mut run)); @@ -123,25 +137,35 @@ pub fn clip_polyline_y(points: &[(f32, f32)], top: f32, bottom: f32) -> Vec Option<((f32, f32), (f32, f32))> { - let dy = q.1 - p.1; - if dy == 0.0 { - return (top..=bottom).contains(&p.1).then_some((p, q)); - } - let t_top = (top - p.1) / dy; - let t_bottom = (bottom - p.1) / dy; - let t0 = t_top.min(t_bottom).max(0.0); - let t1 = t_top.max(t_bottom).min(1.0); - if t0 > t1 { - return None; +fn clip_segment(p: (f32, f32), q: (f32, f32), rect: ClipRect) -> Option<((f32, f32), (f32, f32))> { + let (dx, dy) = (q.0 - p.0, q.1 - p.1); + let (mut t0, mut t1) = (0.0f32, 1.0f32); + // For each edge: (-direction, distance from p to the edge, inward). + for (pk, qk) in [ + (-dx, p.0 - rect.left), + (dx, rect.right - p.0), + (-dy, p.1 - rect.top), + (dy, rect.bottom - p.1), + ] { + if pk == 0.0 { + // Parallel to this edge: entirely outside or not limited by it. + if qk < 0.0 { + return None; + } + } else { + let r = qk / pk; + if pk < 0.0 { + t0 = t0.max(r); + } else { + t1 = t1.min(r); + } + if t0 > t1 { + return None; + } + } } let at = |t: f32| { if t == 0.0 { @@ -149,28 +173,265 @@ fn clip_segment_y( } else if t == 1.0 { q } else { - // A cut point lies on an edge; snap y onto it exactly so that - // rounding cannot leave it just outside the band. - let y = p.1 + dy * t; - let y = if (y - top).abs() < (y - bottom).abs() { - top - } else { - bottom - }; - (p.0 + (q.0 - p.0) * t, y) + // A cut point lies on an edge; clamp it so that rounding cannot + // leave it just outside the rectangle. + ( + (p.0 + dx * t).clamp(rect.left, rect.right), + (p.1 + dy * t).clamp(rect.top, rect.bottom), + ) } }; Some((at(t0), at(t1))) } +/// The outermost range one axis of the view may show, in the same units +/// as [`AxisView`]. +#[derive(Debug, Clone, Copy, PartialEq)] +pub struct AxisLimits { + pub lo: f64, + pub hi: f64, +} + +impl AxisLimits { + fn width(self) -> f64 { + self.hi - self.lo + } +} + +/// Time axis: the whole capture and nothing beyond it. +pub const X_LIMITS: AxisLimits = AxisLimits { lo: 0.0, hi: 1.0 }; + +/// The visible part of one axis, `lo..hi`, in "unit" coordinates: on the +/// time axis a fraction of the whole capture, on the voltage axis a fraction +/// of the device screen height (0 = top grid line, 1 = bottom grid line). +/// [`AxisView::UNIT`] is the unzoomed view. +#[derive(Debug, Clone, Copy, PartialEq)] +pub struct AxisView { + pub lo: f64, + pub hi: f64, +} + +impl Default for AxisView { + fn default() -> Self { + Self::UNIT + } +} + +impl AxisView { + /// Unzoomed: the whole capture (time), the device screen (voltage). + pub const UNIT: Self = Self { lo: 0.0, hi: 1.0 }; + /// Largest zoom-in, regardless of other limits. + const MIN_SPAN: f64 = 1e-6; + + pub fn span(self) -> f64 { + self.hi - self.lo + } + + pub fn is_unit(self) -> bool { + self == Self::UNIT + } + + /// Unit coordinate -> fraction of the visible window (outside `0..=1` + /// for positions outside the view). + pub fn to_screen(self, data: f64) -> f64 { + (data - self.lo) / self.span() + } + + /// Fraction of the visible window -> unit coordinate. + pub fn to_data(self, screen: f64) -> f64 { + self.lo + screen * self.span() + } + + /// Zoom by `factor` (< 1 zooms in) keeping the point at window + /// fraction `anchor` fixed on screen. The span stays within + /// `min_span..=limits` and the window inside `limits`. + /// + /// Zooming through the unzoomed span stops exactly at [`Self::UNIT`] + /// (a detent), so the normal view is always easy to get back to even + /// after zooming around different points. + pub fn zoom_at(self, anchor: f64, factor: f64, min_span: f64, limits: AxisLimits) -> Self { + let anchor = anchor.clamp(0.0, 1.0); + let pivot = self.to_data(anchor); + let max_span = limits.width(); + let span = (self.span() * factor).clamp(min_span.clamp(Self::MIN_SPAN, max_span), max_span); + let old = self.span(); + let unit_allowed = limits.lo <= 0.0 && limits.hi >= 1.0; + if unit_allowed && ((old < 1.0 && span >= 1.0) || (old > 1.0 && span <= 1.0)) { + return Self::UNIT; + } + Self::within(pivot - anchor * span, span, limits) + } + + /// Shift the window by `delta` (unit coordinates), stopping at the + /// limits. + pub fn pan(self, delta: f64, limits: AxisLimits) -> Self { + Self::within(self.lo + delta, self.span(), limits) + } + + /// A window of `span` starting at `lo`, moved inside `limits`. + fn within(lo: f64, span: f64, limits: AxisLimits) -> Self { + if span >= limits.width() { + return Self { + lo: limits.lo, + hi: limits.hi, + }; + } + let lo = lo.clamp(limits.lo, limits.hi - span); + Self { lo, hi: lo + span } + } +} + +/// Zoom and pan of both axes. +#[derive(Debug, Clone, Copy, PartialEq, Default)] +pub struct View { + /// Time axis. + pub x: AxisView, + /// Voltage axis. + pub y: AxisView, +} + +impl View { + /// Unzoomed on both axes. + pub const UNIT: Self = Self { + x: AxisView::UNIT, + y: AxisView::UNIT, + }; + + pub fn is_unit(self) -> bool { + self == Self::UNIT + } +} + #[cfg(test)] mod tests { use super::*; + /// A horizontal band with no left/right limit in practice. + fn band(top: f32, bottom: f32) -> ClipRect { + ClipRect { + left: -1e6, + right: 1e6, + top, + bottom, + } + } + + #[test] + fn polyline_is_cut_at_left_and_right_edges() { + let rect = ClipRect { + left: 10.0, + right: 20.0, + top: 0.0, + bottom: 100.0, + }; + let runs = clip_polyline(&[(0.0, 50.0), (15.0, 50.0), (30.0, 80.0)], rect); + assert_eq!(runs, vec![vec![(10.0, 50.0), (15.0, 50.0), (20.0, 60.0)]]); + } + + #[test] + fn diagonal_through_a_corner_region_is_cut_on_both_axes() { + let rect = ClipRect { + left: 0.0, + right: 10.0, + top: 0.0, + bottom: 10.0, + }; + // From (-5, 5) to (5, 15): enters at x = 0 (y = 10), i.e. the corner. + let runs = clip_polyline(&[(-5.0, 5.0), (5.0, 15.0)], rect); + assert!(runs.is_empty() || runs[0].iter().all(|&p| rect.contains(p))); + // From (-5, 2) to (5, 12): visible from (0, 7) to (3, 10). + let runs = clip_polyline(&[(-5.0, 2.0), (5.0, 12.0)], rect); + assert_eq!(runs, vec![vec![(0.0, 7.0), (3.0, 10.0)]]); + } + + #[test] + fn zoom_keeps_the_anchor_fixed() { + let v = AxisView::UNIT.zoom_at(0.25, 0.5, 0.0, X_LIMITS); + assert_eq!( + v, + AxisView { + lo: 0.125, + hi: 0.625 + } + ); + // The capture point under the anchor is the same before and after. + assert_eq!(AxisView::UNIT.to_data(0.25), v.to_data(0.25)); + let v2 = v.zoom_at(0.5, 0.5, 0.0, X_LIMITS); + assert!((v.to_data(0.5) - v2.to_data(0.5)).abs() < 1e-12); + } + + #[test] + fn zoom_out_stops_at_full_view_and_stays_inside() { + let v = AxisView { lo: 0.8, hi: 0.9 }; + assert_eq!(v.zoom_at(1.0, 100.0, 0.0, X_LIMITS), AxisView::UNIT); + assert!(AxisView::UNIT.zoom_at(0.0, 1.5, 0.0, X_LIMITS).is_unit()); + // Zooming out near the end shifts the window back inside the capture. + let w = v.zoom_at(1.0, 3.0, 0.0, X_LIMITS); + assert!(w.hi <= 1.0 && w.lo >= 0.0); + assert!((w.span() - 0.3).abs() < 1e-12); + } + + #[test] + fn zoom_in_is_limited_by_min_span() { + let v = AxisView::UNIT.zoom_at(0.5, 1e-9, 0.01, X_LIMITS); + assert!((v.span() - 0.01).abs() < 1e-12); + } + + /// Voltage-axis limits wider than the screen (as for the ADC range). + const WIDE: AxisLimits = AxisLimits { + lo: -0.125, + hi: 1.15, + }; + + #[test] + fn axis_can_zoom_out_past_the_unit_view_up_to_its_limits() { + let out = AxisView::UNIT.zoom_at(0.5, 1.2, 0.0, WIDE); + assert!((out.span() - 1.2).abs() < 1e-12); + assert!(out.lo >= WIDE.lo && out.hi <= WIDE.hi); + let max = out.zoom_at(0.5, 100.0, 0.0, WIDE); + assert_eq!( + max, + AxisView { + lo: WIDE.lo, + hi: WIDE.hi + } + ); + } + + #[test] + fn zooming_through_the_unit_span_stops_at_the_unit_view() { + // Zoomed in off-centre, then zoomed out past 1: lands exactly on UNIT. + let zoomed = AxisView { lo: 0.6, hi: 0.9 }; + assert_eq!(zoomed.zoom_at(0.9, 4.0, 0.0, WIDE), AxisView::UNIT); + // Zoomed out, then back in past 1: also UNIT. + let wide = AxisView { lo: -0.1, hi: 1.1 }; + assert_eq!(wide.zoom_at(0.2, 0.8, 0.0, WIDE), AxisView::UNIT); + // The next step continues normally. + assert!(AxisView::UNIT.zoom_at(0.5, 0.8, 0.0, WIDE).span() < 1.0); + } + + #[test] + fn pan_stops_at_capture_ends() { + let v = AxisView { lo: 0.4, hi: 0.6 }; + assert_eq!(v.pan(0.1, X_LIMITS), AxisView { lo: 0.5, hi: 0.7 }); + let end = v.pan(5.0, X_LIMITS); + assert!((end.hi - 1.0).abs() < 1e-12 && (end.span() - 0.2).abs() < 1e-12); + assert_eq!(v.pan(-5.0, X_LIMITS).lo, 0.0); + assert_eq!(AxisView::UNIT.pan(0.3, X_LIMITS), AxisView::UNIT); + } + + #[test] + fn screen_and_data_fractions_round_trip() { + let v = AxisView { lo: 0.2, hi: 0.4 }; + assert!((v.to_screen(0.3) - 0.5).abs() < 1e-12); + assert!((v.to_data(0.5) - 0.3).abs() < 1e-12); + assert!(v.to_screen(0.1) < 0.0); + } + #[test] fn polyline_inside_band_is_one_run() { let pts = [(0.0, 10.0), (1.0, 20.0), (2.0, 15.0)]; - assert_eq!(clip_polyline_y(&pts, 0.0, 100.0), vec![pts.to_vec()]); + assert_eq!(clip_polyline(&pts, band(0.0, 100.0)), vec![pts.to_vec()]); } #[test] @@ -183,7 +444,7 @@ mod tests { (3.0, 90.0), (4.0, 50.0), ]; - let runs = clip_polyline_y(&pts, 0.0, 100.0); + let runs = clip_polyline(&pts, band(0.0, 100.0)); assert_eq!(runs.len(), 2); assert_eq!(runs[0], vec![(0.0, 50.0), (1.0, 90.0), (1.25, 100.0)]); assert_eq!(runs[1], vec![(2.75, 100.0), (3.0, 90.0), (4.0, 50.0)]); @@ -193,21 +454,21 @@ mod tests { fn polyline_entirely_outside_band_is_dropped() { let pts = [(0.0, -10.0), (1.0, -20.0), (2.0, 300.0)]; // The last segment crosses the whole band, so only that piece remains. - let runs = clip_polyline_y(&pts, 0.0, 100.0); + let runs = clip_polyline(&pts, band(0.0, 100.0)); assert_eq!(runs.len(), 1); assert_eq!(runs[0].len(), 2); assert!(runs[0].iter().all(|p| (0.0..=100.0).contains(&p.1))); - assert!(clip_polyline_y(&[(0.0, -5.0), (1.0, -6.0)], 0.0, 100.0).is_empty()); + assert!(clip_polyline(&[(0.0, -5.0), (1.0, -6.0)], band(0.0, 100.0)).is_empty()); } #[test] fn single_point_and_empty_input() { assert_eq!( - clip_polyline_y(&[(3.0, 4.0)], 0.0, 10.0), + clip_polyline(&[(3.0, 4.0)], band(0.0, 10.0)), vec![vec![(3.0, 4.0)]] ); - assert!(clip_polyline_y(&[(3.0, 40.0)], 0.0, 10.0).is_empty()); - assert!(clip_polyline_y(&[], 0.0, 10.0).is_empty()); + assert!(clip_polyline(&[(3.0, 40.0)], band(0.0, 10.0)).is_empty()); + assert!(clip_polyline(&[], band(0.0, 10.0)).is_empty()); } #[test] From 2d70ed203a1595ecd08b35c8d1f95ddce9aba76e Mon Sep 17 00:00:00 2001 From: Roman S Samarev Date: Thu, 26 Nov 2026 21:19:08 +0300 Subject: [PATCH 3/3] Bump version to 0.3.0, move to edition 2024, update dependencies - Workspace version 0.3.0 (dso-parser and the GUI inherit it; the CLI flasher keeps its own version, edition and dependencies). - Edition 2021 -> 2024 and resolver 3 for the workspace. The edition migration adds `use<>` to plot::distinct_values (its iterator does not borrow the input). Nested ifs flagged by clippy's collapsible_if are merged into let-chains; only those blocks are reformatted. - Remove workspace.package.description, which no member used (cargo warned about it). - Dependencies: rust-i18n 3 -> 4, png 0.17 -> 0.18 (Compression::Best is now Compression::High), rfd 0.15 -> 0.18, dirs 6 -> 7 (config_dir is unchanged on all platforms, so settings stay where they are), and Cargo.lock refreshed to the latest compatible versions. - Add a test that translations load for every supported language. - README: Rust 1.85 or later is required for the 2024 edition. --- Cargo.lock | 1867 ++++++++++++++++----------------------- Cargo.toml | 11 +- README.md | 2 +- gui/Cargo.toml | 4 +- gui/src/app.rs | 155 ++-- gui/src/export_image.rs | 20 +- gui/src/i18n.rs | 19 + gui/src/logging.rs | 26 +- gui/src/plot.rs | 2 +- 9 files changed, 877 insertions(+), 1229 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c095b85..ec24005 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -26,22 +26,23 @@ checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] name = "ahash" -version = "0.8.12" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +checksum = "54dae3d1d7b8956f3506c4e999a74e77f932a59153ccf38ab8cf96db74bb9dc0" dependencies = [ "cfg-if", - "getrandom 0.3.4", + "getrandom 0.4.3", "once_cell", + "serde", "version_check", "zerocopy", ] [[package]] name = "aho-corasick" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" dependencies = [ "memchr", ] @@ -71,7 +72,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f2a1bb052857d5dd49572219344a7332b31b76405648eabac5bc68978251bcd" dependencies = [ "android-properties", - "bitflags 2.11.1", + "bitflags 2.13.2", "cc", "jni", "libc", @@ -80,7 +81,7 @@ dependencies = [ "ndk-context", "ndk-sys", "num_enum", - "thiserror 2.0.18", + "thiserror 2.0.21", ] [[package]] @@ -100,13 +101,24 @@ checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" [[package]] name = "android_system_properties" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" dependencies = [ "libc", ] +[[package]] +name = "annotate-snippets" +version = "0.12.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0258346f92c78dbc5b336b9a5b27c64447aa10643bc64e651db2edb145361564" +dependencies = [ + "anstyle", + "memchr", + "unicode-width", +] + [[package]] name = "anstream" version = "1.0.0" @@ -159,21 +171,21 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.102" +version = "1.0.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" +checksum = "2cb931c189b85683d69a5cfad41d4d418671e1ac413dd209f3f2fc31e3cfd902" [[package]] name = "arbitrary" -version = "1.4.2" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1" +checksum = "3bc62ac97cc33321f50863d514c3bc38a453947a8f9e781137e47c7401020aed" [[package]] name = "arc-swap" -version = "1.9.2" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c049c0be4daef0b145cb3555416b3b8ef5b7888a38aea1a3a155801fe7b0810b" +checksum = "84a22b5d51209f6de83d37a0b33d320acb8da88823e42a94c075140708f032a5" dependencies = [ "rustversion", ] @@ -186,9 +198,15 @@ checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] +[[package]] +name = "arraydeque" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d902e3d592a523def97af8f317b08ce16b7ab854c1985a0c671e6f15cebc236" + [[package]] name = "arrayref" version = "0.3.9" @@ -197,9 +215,9 @@ checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" [[package]] name = "arrayvec" -version = "0.7.6" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" +checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" [[package]] name = "as-raw-xcb-connection" @@ -225,28 +243,6 @@ dependencies = [ "libloading", ] -[[package]] -name = "ashpd" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2f3f79755c74fd155000314eb349864caa787c6592eace6c6882dad873d9c39" -dependencies = [ - "async-fs", - "async-net", - "enumflags2", - "futures-channel", - "futures-util", - "rand", - "raw-window-handle", - "serde", - "serde_repr", - "url", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "zbus", -] - [[package]] name = "async-broadcast" version = "0.7.2" @@ -273,9 +269,9 @@ dependencies = [ [[package]] name = "async-executor" -version = "1.14.0" +version = "1.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a" +checksum = "f426a31126c735126297bc5ea7a521263c9faff4f63ca415267ee625651c4f37" dependencies = [ "async-task", "concurrent-queue", @@ -285,17 +281,6 @@ dependencies = [ "slab", ] -[[package]] -name = "async-fs" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8034a681df4aed8b8edbd7fbe472401ecf009251c8b40556b304567052e294c5" -dependencies = [ - "async-lock", - "blocking", - "futures-lite", -] - [[package]] name = "async-io" version = "2.6.0" @@ -309,33 +294,22 @@ dependencies = [ "futures-lite", "parking", "polling", - "rustix 1.1.4", + "rustix 1.1.6", "slab", "windows-sys 0.61.2", ] [[package]] name = "async-lock" -version = "3.4.2" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f7f2596bd5b78a9fec8088ccd89180d7f9f55b94b0576823bbbdc72ee8311" +checksum = "0876700b0d007ad25d5508865a4259c3af9af6d296bf663a0d586d0bc3369f6f" dependencies = [ "event-listener", "event-listener-strategy", "pin-project-lite", ] -[[package]] -name = "async-net" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b948000fad4873c1c9339d60f2623323a0cfd3816e5181033c6a5cb68b2accf7" -dependencies = [ - "async-io", - "blocking", - "futures-lite", -] - [[package]] name = "async-process" version = "2.5.0" @@ -351,18 +325,18 @@ dependencies = [ "cfg-if", "event-listener", "futures-lite", - "rustix 1.1.4", + "rustix 1.1.6", ] [[package]] name = "async-recursion" -version = "1.1.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" +checksum = "4f8abc12baad266b1c8cec146854c195b5864b4221d4b2ca7296a7ae82d9e451" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 3.0.10", ] [[package]] @@ -377,7 +351,7 @@ dependencies = [ "cfg-if", "futures-core", "futures-io", - "rustix 1.1.4", + "rustix 1.1.6", "signal-hook-registry", "slab", "windows-sys 0.61.2", @@ -391,13 +365,13 @@ checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" [[package]] name = "async-trait" -version = "0.1.89" +version = "0.1.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" +checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 3.0.10", ] [[package]] @@ -427,7 +401,7 @@ dependencies = [ "num-traits", "pastey", "rayon", - "thiserror 2.0.18", + "thiserror 2.0.21", "v_frame", "y4m", ] @@ -457,9 +431,15 @@ dependencies = [ [[package]] name = "base62" -version = "2.2.4" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3a647dce9631f152a99ec16cfc09267ae55fe280d5dc288964027d458076323" + +[[package]] +name = "base64" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd637ac531c60eb7fbc4684dc061c2d7d90d73d758181aa02eeff0464b9eee4b" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" [[package]] name = "bit-set" @@ -478,9 +458,9 @@ checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" [[package]] name = "bit_field" -version = "0.10.3" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e4b40c7323adcfc0a41c4b88143ed58346ff65a288fc144329c5c45e05d70c6" +checksum = "cb2907cc03d08cdb1c6724ad0670ce67c4a71e1c45a6d7635224011714cfc4b1" [[package]] name = "bitflags" @@ -490,9 +470,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.11.1" +version = "2.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" [[package]] name = "bitstream-io" @@ -515,7 +495,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" dependencies = [ - "objc2 0.5.2", + "objc2 0.5.3", ] [[package]] @@ -524,14 +504,14 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" dependencies = [ - "objc2 0.6.4", + "objc2 0.6.5", ] [[package]] name = "blocking" -version = "1.6.2" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e83f8d02be6967315521be875afa792a316e28d57b5a2d401897e2a7921b7f21" +checksum = "a70e4329df6cb94385eed412ec92375c3cdd8a6e502493d1229b6414e4036dfa" dependencies = [ "async-channel", "async-task", @@ -542,9 +522,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.13.0" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f7dc094d718f2e1c1559ad110e27eeaae14a5465d3d56dd6dbd793079fbd530" +checksum = "a680398c10c7bc0488067c4612226ea905a85f607134b69f3068d505d58c4214" dependencies = [ "memchr", "serde_core", @@ -558,9 +538,9 @@ checksum = "5c0e531d93d39c34eef561e929e8a7f86d77a5af08aac4f6d6e39976c51858e9" [[package]] name = "bumpalo" -version = "3.20.3" +version = "3.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" +checksum = "87a0cf66fd1eb2fb7b822cb78370d82303750809bc6ba855f3f58e517d3238db" [[package]] name = "bytecount" @@ -570,22 +550,22 @@ checksum = "175812e0be2bccb6abe50bb8d566126198344f707e304f45c648fd8f2cc0365e" [[package]] name = "bytemuck" -version = "1.25.0" +version = "1.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec" +checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" dependencies = [ "bytemuck_derive", ] [[package]] name = "bytemuck_derive" -version = "1.10.2" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9abbd1bc6865053c427f7198e6af43bfdedc55ab791faed4fbd361d789575ff" +checksum = "6a1f896587b6f2c069c73d2f0913e2d590c3990285cd2f0b6aa02b786b4c679c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 3.0.10", ] [[package]] @@ -602,9 +582,9 @@ checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" [[package]] name = "bytes" -version = "1.11.1" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" +checksum = "776dfebd015e2d8732c684a2c71003674ccb49457b539b9e82151ba38e96dd7c" [[package]] name = "calloop" @@ -612,7 +592,7 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "log", "polling", "rustix 0.38.44", @@ -622,14 +602,13 @@ dependencies = [ [[package]] name = "calloop" -version = "0.14.4" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dbf9978365bac10f54d1d4b04f7ce4427e51f71d61f2fe15e3fed5166474df7" +checksum = "43b32313e937c8721c9d17ee9bf60699a6402b4b7c2cb6ac1bee0ffcaa4b4e5e" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "polling", - "rustix 1.1.4", - "slab", + "rustix 1.1.6", "tracing", ] @@ -651,17 +630,17 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa" dependencies = [ - "calloop 0.14.4", - "rustix 1.1.4", + "calloop 0.14.5", + "rustix 1.1.6", "wayland-backend", "wayland-client", ] [[package]] name = "cc" -version = "1.2.63" +version = "1.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "556e016178bb5662a08681bbe0f00f8e17631781a4dfc8c45e466e4b185ec27f" +checksum = "02f0e023adb368345ce0ca6cdfc0f24a06554468d0e8503e14a0841de79bfa69" dependencies = [ "find-msvc-tools", "jobserver", @@ -671,21 +650,21 @@ dependencies = [ [[package]] name = "cfg-if" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" [[package]] name = "cfg_aliases" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" [[package]] name = "chrono" -version = "0.4.44" +version = "0.4.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" dependencies = [ "iana-time-zone", "js-sys", @@ -724,9 +703,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.6.1" +version = "4.6.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51" +checksum = "50066ca966813ca8957ee15361752f19424a8ff620dbe9c8993d9f99d99b04b3" dependencies = [ "clap_builder", "clap_derive", @@ -734,9 +713,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.6.0" +version = "4.6.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" +checksum = "a0ed97c96ef4efb3cc84e09fa388df4463e7cc3224ec38d7b1d9e45749333590" dependencies = [ "anstream", "anstyle", @@ -746,27 +725,27 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.6.1" +version = "4.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2ce8604710f6733aa641a2b3731eaa1e8b3d9973d5e3565da11800813f997a9" +checksum = "b4c174f11f949b9ca8c60580925e282b9cbd5454750e506f08648b2038080cd7" dependencies = [ "heck", "proc-macro2", "quote", - "syn", + "syn 3.0.10", ] [[package]] name = "clap_lex" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" +checksum = "e0921b3876b3a1df8a1c9f912e7f94342458022c2e84288015893d83c4d62a79" [[package]] name = "clipboard-win" -version = "5.4.1" +version = "5.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bde03770d3df201d4fb868f2c9c59e66a3e4e2bd06692a0fe701e7103c7e84d4" +checksum = "052af7878466feccda12ba7a6a67d019d712f296809559b47c12c8cc196d3a9a" dependencies = [ "error-code", ] @@ -777,7 +756,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b7f4aaa047ba3c3630b080bb9860894732ff23e2aee290a418909aa6d5df38f" dependencies = [ - "objc2 0.5.2", + "objc2 0.5.3", "objc2-app-kit 0.2.2", "objc2-foundation 0.2.2", ] @@ -797,7 +776,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd63e33452ffdafd39924c4f05a5dd1e94db646c779c6bd59148a3d95fff5ad4" dependencies = [ - "thiserror 2.0.18", + "thiserror 2.0.21", "x11rb", ] @@ -835,9 +814,9 @@ dependencies = [ [[package]] name = "combine" -version = "4.6.7" +version = "4.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +checksum = "4356eba6976435498d05a311ee9fc486da3bc81c200d3f0d7dd9703b41913f92" dependencies = [ "bytes", "memchr", @@ -854,9 +833,9 @@ dependencies = [ [[package]] name = "console" -version = "0.16.3" +version = "0.16.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d64e8af5551369d19cf50138de61f1c42074ab970f74e99be916646777f8fc87" +checksum = "e96a4956774c13c126a8b5af4daa79384f4d826534c95a02d76afb39e2ab64e3" dependencies = [ "encode_unicode", "libc", @@ -920,7 +899,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "core-foundation 0.10.1", "libc", ] @@ -937,6 +916,12 @@ dependencies = [ "libc", ] +[[package]] +name = "core_detect" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48" + [[package]] name = "core_maths" version = "0.1.1" @@ -952,7 +937,7 @@ version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "173852283a9a57a3cbe365d86e74dc428a09c50421477d5ad6fe9d9509e37737" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "fontdb", "harfrust", "linebender_resource_handle", @@ -987,18 +972,18 @@ checksum = "217698eaf96b4a3f0bc4f3662aaa55bdf913cd54d7204591faa790070c6d0853" [[package]] name = "crc32fast" -version = "1.5.0" +version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +checksum = "fd9ae8fcb3ea71b0b26338b4ffb13006bb175de8fd07921089a906ce7e5e6945" dependencies = [ "cfg-if", ] [[package]] name = "crossbeam-deque" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a" dependencies = [ "crossbeam-epoch", "crossbeam-utils", @@ -1006,18 +991,18 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.18" +version = "0.9.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.21" +version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" [[package]] name = "crunchy" @@ -1034,7 +1019,7 @@ dependencies = [ "cosmic-text", "etagere", "lru", - "rustc-hash 2.1.2", + "rustc-hash 2.1.3", "wgpu", ] @@ -1083,6 +1068,15 @@ dependencies = [ "dirs-sys", ] +[[package]] +name = "dirs" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d57d423b3c82e89b9a24ca3091fee61f456a26edbd28d26c65906f4bc1dcd8f" +dependencies = [ + "dirs-sys", +] + [[package]] name = "dirs-sys" version = "0.5.0" @@ -1107,21 +1101,10 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "block2 0.6.2", "libc", - "objc2 0.6.4", -] - -[[package]] -name = "displaydoc" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ac70aa55017e108007fbaf5aa0f54b021c98f92ff8af59d42eda9da96e3dd4f" -dependencies = [ - "proc-macro2", - "quote", - "syn", + "objc2 0.6.5", ] [[package]] @@ -1156,39 +1139,39 @@ checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" [[package]] name = "dso-parser" -version = "0.2.1" +version = "0.3.0" dependencies = [ "chrono", "ciborium", "serde", "serde_json", - "thiserror 2.0.18", + "thiserror 2.0.21", ] [[package]] name = "dso3d12-gui" -version = "0.2.1" +version = "0.3.0" dependencies = [ "ab_glyph", "anyhow", "chrono", "crc", "csv", - "dirs", + "dirs 7.0.0", "dso-parser", "font-kit", "iced", "iced_aw", "log", "open", - "png 0.17.16", + "png", "rfd", "rust-i18n", "serde", "serde_json", "serialport", "sys-locale", - "thiserror 2.0.18", + "thiserror 2.0.21", "tiny-skia 0.12.0", "tokio", ] @@ -1213,9 +1196,9 @@ dependencies = [ [[package]] name = "either" -version = "1.16.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e" +checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" [[package]] name = "encode_unicode" @@ -1223,6 +1206,29 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" +[[package]] +name = "encoding_rs" +version = "0.8.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89253175e704ab869b04f9db224d38630e0211a53841a79181deae0889e169f5" +dependencies = [ + "cfg-if", + "core_detect", + "multiversion_no_op", + "rustversion", + "scopeguard", + "simdutf8", +] + +[[package]] +name = "encoding_rs_io" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fba3fe847045ecff794b9c138293a80db914678c453ad63fbf0c6a9eb6e00b22" +dependencies = [ + "encoding_rs", +] + [[package]] name = "endi" version = "1.1.1" @@ -1247,7 +1253,7 @@ checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] @@ -1267,20 +1273,20 @@ checksum = "44f23cf4b44bfce11a86ace86f8a73ffdec849c9fd00a386a53d278bd9e81fb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] name = "equivalent" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" [[package]] name = "errno" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +checksum = "e35d6e78f4cebb90e51d543db8fe41528851d6deeef6ef21ebd4bfdc1e784776" dependencies = [ "libc", "windows-sys 0.61.2", @@ -1288,9 +1294,9 @@ dependencies = [ [[package]] name = "error-code" -version = "3.3.2" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dea2df4cf52843e0452895c455a1a2cfbb842a1e7329671acf418fdc53ed4c59" +checksum = "0b5343afd4a8365a643ac588dab4cf234a190c7f6c88c9f6dd6ffe00837661b7" [[package]] name = "etagere" @@ -1313,11 +1319,10 @@ dependencies = [ [[package]] name = "event-listener" -version = "5.4.1" +version = "5.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab" +checksum = "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2" dependencies = [ - "concurrent-queue", "parking", "pin-project-lite", ] @@ -1334,14 +1339,15 @@ dependencies = [ [[package]] name = "exr" -version = "1.74.0" +version = "1.74.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4300e043a56aa2cb633c01af81ca8f699a321879a7854d3896a0ba89056363be" +checksum = "cb29d0be702adf92c645d9b2f93472906ba83d400e59f98adb3770ce5c18c2f6" dependencies = [ "bit_field", "half", "lebe", - "miniz_oxide", + "miniz_oxide 0.8.9", + "multiversion", "rayon-core", "smallvec", "zune-inflate", @@ -1349,9 +1355,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" [[package]] name = "fax" @@ -1370,18 +1376,19 @@ dependencies = [ [[package]] name = "find-msvc-tools" -version = "0.1.9" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" +checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" [[package]] name = "flate2" -version = "1.1.9" +version = "1.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" +checksum = "626d4928326b646e70f65ed36fc7cf9f206bdb68a0019ee7c6b4709da4e084c4" dependencies = [ "crc32fast", - "miniz_oxide", + "miniz_oxide 0.9.1", + "zlib-rs", ] [[package]] @@ -1420,12 +1427,12 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c7e611d49285d4c4b2e1727b72cf05353558885cc5252f93707b845dfcaf3d3" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "byteorder", "core-foundation 0.9.4", "core-graphics", "core-text", - "dirs", + "dirs 6.0.0", "dwrote", "float-ord", "freetype-sys", @@ -1450,9 +1457,9 @@ dependencies = [ [[package]] name = "font-types" -version = "0.11.3" +version = "0.12.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b38ad915f6dadd993ced50848a8291a543bd41ca62bc10740d5e64e2ab4cfd7" +checksum = "835ae9d781464a79026cde387f9cbc650c9a4909d7cf7e658b127e3c35d2f35d" dependencies = [ "bytemuck", ] @@ -1492,13 +1499,13 @@ dependencies = [ [[package]] name = "foreign-types-macros" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" +checksum = "ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 3.0.10", ] [[package]] @@ -1507,15 +1514,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" -[[package]] -name = "form_urlencoded" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" -dependencies = [ - "percent-encoding", -] - [[package]] name = "freetype-sys" version = "0.20.1" @@ -1529,9 +1527,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.32" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d" +checksum = "9a31d2a3fbaaeb2af2368bbdd904aa8e812d3c04a1ee10d3171f52d556e5d0a3" dependencies = [ "futures-channel", "futures-core", @@ -1544,9 +1542,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.32" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" dependencies = [ "futures-core", "futures-sink", @@ -1554,15 +1552,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.32" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" [[package]] name = "futures-executor" -version = "0.3.32" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d" +checksum = "031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432" dependencies = [ "futures-core", "futures-task", @@ -1571,9 +1569,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.32" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" [[package]] name = "futures-lite" @@ -1590,32 +1588,32 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.32" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 3.0.10", ] [[package]] name = "futures-sink" -version = "0.3.32" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" [[package]] name = "futures-task" -version = "0.3.32" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" [[package]] name = "futures-util" -version = "0.3.32" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" dependencies = [ "futures-channel", "futures-core", @@ -1634,21 +1632,10 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" dependencies = [ - "rustix 1.1.4", + "rustix 1.1.6", "windows-link", ] -[[package]] -name = "getrandom" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - [[package]] name = "getrandom" version = "0.3.4" @@ -1663,15 +1650,15 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" dependencies = [ "cfg-if", + "js-sys", "libc", "r-efi 6.0.0", - "wasip2", - "wasip3", + "wasm-bindgen", ] [[package]] @@ -1703,15 +1690,15 @@ checksum = "151665d9be52f9bb40fc7966565d39666f2d1e69233571b71b87791c7e0528b3" [[package]] name = "glob" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" +checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b" [[package]] name = "globset" -version = "0.4.19" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e47d37d2ae4464254884b60ab7071be2b876a9c35b696bd018ddcc76847309cd" +checksum = "71217a07f20b48b4938c14203b77b610f8a7fa6762c3f75394a10c5f31e5aee0" dependencies = [ "aho-corasick", "bstr", @@ -1754,21 +1741,21 @@ dependencies = [ [[package]] name = "gpu-alloc" -version = "0.6.0" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbcd2dba93594b227a1f57ee09b8b9da8892c34d55aa332e034a228d0fe6a171" +checksum = "45cf04b2726f02df5508c6de726acdc90cdf97ac771a9a0ffd8ba10a6e696bf9" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "gpu-alloc-types", ] [[package]] name = "gpu-alloc-types" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98ff03b468aa837d70984d55f5d3f846f6ec31fe34bbb97c4f85219caeee1ca4" +checksum = "b2bbed164dd10ed526c2e4fe3e721ca4a71c61730e5aafac6844b417b3227058" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", ] [[package]] @@ -1789,7 +1776,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b89c83349105e3732062a895becfc71a8f921bb71ecbbdd8ff99263e3b53a0ca" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "gpu-descriptor-types", "hashbrown 0.15.5", ] @@ -1800,7 +1787,17 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", +] + +[[package]] +name = "granit-parser" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e20f99e46474f56bd905c56e817ebddcf377a611f94c53ac4649e4d3fa3c0cd0" +dependencies = [ + "arraydeque", + "smallvec", ] [[package]] @@ -1831,7 +1828,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92c020db12c71d8a12a3fe7607873cade3a01a6287e29d540c8723276221b9d8" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "bytemuck", "core_maths", "read-fonts 0.35.0", @@ -1858,9 +1855,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.17.1" +version = "0.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +checksum = "735eaa21a6a5ffb2e84362faaeb90c05ba8e19797ca30428478cb6ea3a4921bc" [[package]] name = "heck" @@ -1870,9 +1867,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" +checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284" [[package]] name = "hex" @@ -1924,7 +1921,7 @@ dependencies = [ "iced_widget", "iced_winit", "image", - "thiserror 2.0.18", + "thiserror 2.0.21", ] [[package]] @@ -1949,15 +1946,15 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91ab1937d699403e7e69252ae743a902bcee9f4ab2052cc4c9a46fcf34729d85" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "bytes", "glam", "lilt", "log", "num-traits", - "rustc-hash 2.1.2", + "rustc-hash 2.1.3", "smol_str", - "thiserror 2.0.18", + "thiserror 2.0.21", "web-time", ] @@ -1991,7 +1988,7 @@ checksum = "7ef5125e110cb19cd1910a28298661c98c5d9ab02eef43594968352940e8752e" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", "ttf-parser", ] @@ -2004,7 +2001,7 @@ dependencies = [ "futures", "iced_core", "log", - "rustc-hash 2.1.2", + "rustc-hash 2.1.3", "tokio", "wasm-bindgen-futures", "wasmtimer", @@ -2016,7 +2013,7 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "234ca1c2cec4155055f68fa5fad1b5242c496ac8238d80a259bca382fb44a102" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "bytemuck", "cosmic-text", "half", @@ -2027,8 +2024,8 @@ dependencies = [ "log", "lyon_path", "raw-window-handle", - "rustc-hash 2.1.2", - "thiserror 2.0.18", + "rustc-hash 2.1.3", + "thiserror 2.0.21", "unicode-segmentation", ] @@ -2052,7 +2049,7 @@ dependencies = [ "iced_tiny_skia", "iced_wgpu", "log", - "thiserror 2.0.18", + "thiserror 2.0.21", ] [[package]] @@ -2065,14 +2062,14 @@ dependencies = [ "iced_core", "iced_futures", "raw-window-handle", - "thiserror 2.0.18", + "thiserror 2.0.21", ] [[package]] name = "iced_tiny_skia" -version = "0.14.0" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe0acf8b75a3bc914aff5f2329fdffc1b36eeaea29dda0e4bd232f1c62e9cc3d" +checksum = "c267596d742714b1853cc10c3983a367762816fc4836bd3b79f76ce76787d6f8" dependencies = [ "bytemuck", "cosmic-text", @@ -2080,7 +2077,7 @@ dependencies = [ "iced_graphics", "kurbo", "log", - "rustc-hash 2.1.2", + "rustc-hash 2.1.3", "softbuffer", "tiny-skia 0.11.4", ] @@ -2091,7 +2088,7 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff144a999b0ca0f8a10257934500060240825c42e950ec0ebee9c8ae30561c13" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "bytemuck", "cryoglyph", "futures", @@ -2101,8 +2098,8 @@ dependencies = [ "iced_graphics", "log", "lyon", - "rustc-hash 2.1.2", - "thiserror 2.0.18", + "rustc-hash 2.1.3", + "thiserror 2.0.21", "wgpu", ] @@ -2115,23 +2112,23 @@ dependencies = [ "iced_renderer", "log", "num-traits", - "rustc-hash 2.1.2", - "thiserror 2.0.18", + "rustc-hash 2.1.3", + "thiserror 2.0.21", "unicode-segmentation", ] [[package]] name = "iced_winit" -version = "0.14.0" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b7dbedc47562d1de3b9707d939f678b88c382004b7ab5a18f7a7dd723162d75" +checksum = "7589888c8e951899cc688247a69933bb7a0511f0b4b2e122ac3fcd5dacb37f72" dependencies = [ "iced_debug", "iced_program", "log", "mundy", - "rustc-hash 2.1.2", - "thiserror 2.0.18", + "rustc-hash 2.1.3", + "thiserror 2.0.21", "tracing", "wasm-bindgen-futures", "web-sys", @@ -2139,120 +2136,11 @@ dependencies = [ "winit", ] -[[package]] -name = "icu_collections" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" -dependencies = [ - "displaydoc", - "potential_utf", - "utf8_iter", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locale_core" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_normalizer" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" -dependencies = [ - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" - -[[package]] -name = "icu_properties" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" -dependencies = [ - "icu_collections", - "icu_locale_core", - "icu_properties_data", - "icu_provider", - "zerotrie", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" - -[[package]] -name = "icu_provider" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" -dependencies = [ - "displaydoc", - "icu_locale_core", - "writeable", - "yoke", - "zerofrom", - "zerotrie", - "zerovec", -] - -[[package]] -name = "id-arena" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" - -[[package]] -name = "idna" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" -dependencies = [ - "idna_adapter", - "smallvec", - "utf8_iter", -] - -[[package]] -name = "idna_adapter" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" -dependencies = [ - "icu_normalizer", - "icu_properties", -] - [[package]] name = "ignore" -version = "0.4.29" +version = "0.4.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4ffa3a0547a138e59ddd6fa3b7c672ed47e6ad6a3cd177984ff1116aa5ba742" +checksum = "df0a7d5f105e76bda602bed0a44af048542d3c9af12ec35aaf16f106c6f34270" dependencies = [ "crossbeam-deque", "globset", @@ -2278,7 +2166,7 @@ dependencies = [ "image-webp", "moxcms", "num-traits", - "png 0.18.1", + "png", "qoi", "ravif", "rayon", @@ -2300,27 +2188,25 @@ dependencies = [ [[package]] name = "imgref" -version = "1.12.1" +version = "1.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40fac9d56ed6437b198fddba683305e8e2d651aa42647f00f5ae542e7f5c94a2" +checksum = "6e44b0a4eaa4c82f441d50a963f2d5f05a787240aeee097597033e72accfd22f" [[package]] name = "indexmap" -version = "2.14.0" +version = "2.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" dependencies = [ "equivalent", - "hashbrown 0.17.1", - "serde", - "serde_core", + "hashbrown 0.17.2", ] [[package]] name = "indicatif" -version = "0.18.4" +version = "0.18.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25470f23803092da7d239834776d653104d551bc4d7eacaf31e6837854b8e9eb" +checksum = "9433806cd6b4ec1aba79c021c7e4c58fb4c3b9977c085062e611ac929998fb0c" dependencies = [ "console", "portable-atomic", @@ -2337,7 +2223,7 @@ checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] @@ -2395,9 +2281,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" +checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4" [[package]] name = "jni" @@ -2411,7 +2297,7 @@ dependencies = [ "jni-sys 0.4.1", "log", "simd_cesu8", - "thiserror 2.0.18", + "thiserror 2.0.21", "walkdir", "windows-link", ] @@ -2426,7 +2312,7 @@ dependencies = [ "quote", "rustc_version", "simd_cesu8", - "syn", + "syn 2.0.119", ] [[package]] @@ -2454,36 +2340,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" dependencies = [ "quote", - "syn", + "syn 2.0.119", ] [[package]] name = "jobserver" -version = "0.1.34" +version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3" dependencies = [ - "getrandom 0.3.4", + "getrandom 0.4.3", "libc", ] [[package]] name = "js-sys" -version = "0.3.99" +version = "0.3.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "142bc4740e452c1e57ade0cbc129f139c9093e354346f0872ef985f4f5cf5f11" +checksum = "8dc09d2154098bbf4ef54eab6b117a3c24cbbffe94046b16ee6d6d4510584d3a" dependencies = [ "cfg-if", "futures-util", - "once_cell", "wasm-bindgen", ] [[package]] name = "kamadak-exif" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1130d80c7374efad55a117d715a3af9368f0fa7a2c54573afc15a188cd984837" +checksum = "8772c92c0f41c4a672cbdee6728253e5ae8fcc1c5eb5c6c676579565684bbf68" dependencies = [ "mutate_once", ] @@ -2517,15 +2402,9 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - -[[package]] -name = "leb128fmt" -version = "0.1.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" +checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb" [[package]] name = "lebe" @@ -2535,15 +2414,15 @@ checksum = "7a79a3332a6609480d7d0c9eab957bca6b455b91bb84e66d19f5ff66294b85b8" [[package]] name = "libc" -version = "0.2.186" +version = "0.2.191" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" [[package]] name = "libfuzzer-sys" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f12a681b7dd8ce12bff52488013ba614b869148d54dd79836ab85aafdd53f08d" +checksum = "a9fd2f41a1cba099f79a0b6b6c35656cf7c03351a7bae8ff0f28f25270f929d2" dependencies = [ "arbitrary", "cc", @@ -2567,14 +2446,14 @@ checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" [[package]] name = "libredox" -version = "0.1.17" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f02ab6bace2054fb888a3c16f990117b579d14a3088e472d63c6011fa185c9d3" +checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "libc", "plain", - "redox_syscall 0.8.0", + "redox_syscall 0.9.5", ] [[package]] @@ -2599,9 +2478,9 @@ dependencies = [ [[package]] name = "lilt" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f67562e5eff6b20553fa9be1c503356768420994e28f67e3eafe6f41910e57ad" +checksum = "337d4c256f7d9f2dbd633891d48ace853efa5b1554122d9220b172ad9c03c3a9" dependencies = [ "web-time", ] @@ -2624,17 +2503,11 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" -[[package]] -name = "litemap" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" - [[package]] name = "litrs" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" +checksum = "02b614978e47ce529faee66579f2b2fe19c94aa96d910a6a9a8043b2b02d8175" [[package]] name = "lock_api" @@ -2647,9 +2520,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.30" +version = "0.4.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "616ec5685824bcc94416c6d4a7a446eea774a31efd7062c8480ba6fd06d7a6e5" +checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c" [[package]] name = "loop9" @@ -2678,9 +2551,9 @@ dependencies = [ [[package]] name = "lyon_algorithms" -version = "1.0.20" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8575c0d003ae459399623c4def180c63b77f343b1a7fee64f249b349e7699a31" +checksum = "f3a6b9d4e8b48acd531fbf1241ad9b270df6e60b6b92bdea1469f4f40899d805" dependencies = [ "lyon_path", "num-traits", @@ -2688,9 +2561,9 @@ dependencies = [ [[package]] name = "lyon_geom" -version = "1.0.19" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4336502e29e32af93cf2dad2214ed6003c17ceb5bd499df77b1de663b9042b92" +checksum = "d82dd26aa4dc0b5b70b9115de59824842bcb43cf4a28e1b1e6d0ad148c93f93e" dependencies = [ "arrayvec", "euclid", @@ -2709,9 +2582,9 @@ dependencies = [ [[package]] name = "lyon_tessellation" -version = "1.0.20" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e43b7e44161571868f5c931d12583592c223c5583eef86b08aa02b7048a3552" +checksum = "fd4872650e70dc907dd4f7ebc449d7d657a0d2658e423b2e724970870bbbf75b" dependencies = [ "float_next_after", "lyon_path", @@ -2748,15 +2621,15 @@ dependencies = [ [[package]] name = "memchr" -version = "2.8.1" +version = "2.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b947ae49db0d222b1dbc6b113ce7248a3fc3a6ca21b696717bfc000ba4484d8" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" [[package]] name = "memmap2" -version = "0.9.10" +version = "0.9.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "714098028fe011992e1c3962653c96b2d578c4b4bce9036e15ff220319b1e0e3" +checksum = "6b0ca1155a9ecc25aa12e8313a119f32edf0255fea2f44839c4ac0a12b2ac157" dependencies = [ "libc", ] @@ -2776,7 +2649,7 @@ version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00c15a6f673ff72ddcc22394663290f870fb224c1bfce55734a75c414150e605" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "block", "core-graphics-types 0.2.0", "foreign-types", @@ -2795,6 +2668,16 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "miniz_oxide" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" +dependencies = [ + "adler2", + "simd-adler32", +] + [[package]] name = "moxcms" version = "0.8.1" @@ -2806,20 +2689,48 @@ dependencies = [ ] [[package]] -name = "mundy" -version = "0.2.3" +name = "multiversion" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f32eb0db40f2df2bcfb05c93b8f73938d4c26ce9ac8881f1df0c8d3296921a73" +checksum = "eb8a68be21d0755f83bfe47e79b896cc732687cf1903f0e50585e8d6ecc53076" dependencies = [ - "android-build", - "async-io", - "cfg-if", - "dispatch", - "futures-channel", - "futures-lite", - "jni", - "ndk-context", - "objc2 0.6.4", + "multiversion-macros", + "target-features", +] + +[[package]] +name = "multiversion-macros" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a05e0c3c3e4edaa21d87c645852ed0b0c3663752bcc6ec43353bd6189dce35e1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", + "target-features", +] + +[[package]] +name = "multiversion_no_op" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "743fb55ba31b18fb1ecef6bdc9aa2743314978ac084044301a7eee33fb99a20d" + +[[package]] +name = "mundy" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f32eb0db40f2df2bcfb05c93b8f73938d4c26ce9ac8881f1df0c8d3296921a73" +dependencies = [ + "android-build", + "async-io", + "cfg-if", + "dispatch", + "futures-channel", + "futures-lite", + "jni", + "ndk-context", + "objc2 0.6.5", "objc2-app-kit 0.3.2", "objc2-foundation 0.3.2", "pin-project-lite", @@ -2844,7 +2755,7 @@ checksum = "066cf25f0e8b11ee0df221219010f213ad429855f57c494f995590c861a9a7d8" dependencies = [ "arrayvec", "bit-set", - "bitflags 2.11.1", + "bitflags 2.13.2", "cfg-if", "cfg_aliases", "codespan-reporting", @@ -2858,7 +2769,7 @@ dependencies = [ "once_cell", "rustc-hash 1.1.0", "spirv", - "thiserror 2.0.18", + "thiserror 2.0.21", "unicode-ident", ] @@ -2868,7 +2779,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "jni-sys 0.3.1", "log", "ndk-sys", @@ -2918,6 +2829,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + [[package]] name = "nom" version = "8.0.0" @@ -2935,18 +2852,18 @@ checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8" [[package]] name = "normpath" -version = "1.5.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9985ef7269fa99f3b12437bb698381da2428743ab90f20393f399fa14cab21a" +checksum = "b11ce00d2594068e8a27c9146fdc5cf9f3ac38eb42c7cd34d05fea618873ac9f" dependencies = [ "windows-sys 0.61.2", ] [[package]] name = "num-bigint" -version = "0.4.6" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" dependencies = [ "num-integer", "num-traits", @@ -2960,7 +2877,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] @@ -2975,9 +2892,9 @@ dependencies = [ [[package]] name = "num-integer" -version = "0.1.46" +version = "0.1.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" dependencies = [ "num-traits", ] @@ -3022,7 +2939,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] @@ -3042,9 +2959,9 @@ checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310" [[package]] name = "objc2" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46a785d4eeff09c14c487497c162e92766fbb3e4059a71840cecc03d9a50b804" +checksum = "19d5490aaf8f1d7cf7688dfa9b0ce07900e168852c45cd2c03f534dfd27cfd0b" dependencies = [ "objc-sys", "objc2-encode", @@ -3052,9 +2969,9 @@ dependencies = [ [[package]] name = "objc2" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a12a8ed07aefc768292f076dc3ac8c48f3781c8f2d5851dd3d98950e8c5a89f" +checksum = "08849bbd4767dfae9457696856ae1c84fe4e0281bbe4a7abff2d0e06fb7981f8" dependencies = [ "objc2-encode", ] @@ -3065,10 +2982,10 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "block2 0.5.1", "libc", - "objc2 0.5.2", + "objc2 0.5.3", "objc2-core-data 0.2.2", "objc2-core-image 0.2.2", "objc2-foundation 0.2.2", @@ -3081,10 +2998,10 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "block2 0.6.2", "libc", - "objc2 0.6.4", + "objc2 0.6.5", "objc2-cloud-kit 0.3.2", "objc2-core-data 0.3.2", "objc2-core-foundation", @@ -3094,6 +3011,7 @@ dependencies = [ "objc2-core-video", "objc2-foundation 0.3.2", "objc2-quartz-core 0.3.2", + "objc2-uniform-type-identifiers 0.3.2", ] [[package]] @@ -3102,9 +3020,9 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "block2 0.5.1", - "objc2 0.5.2", + "objc2 0.5.3", "objc2-core-location", "objc2-foundation 0.2.2", ] @@ -3115,8 +3033,8 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73ad74d880bb43877038da939b7427bba67e9dd42004a18b809ba7d87cee241c" dependencies = [ - "bitflags 2.11.1", - "objc2 0.6.4", + "bitflags 2.13.2", + "objc2 0.6.5", "objc2-foundation 0.3.2", ] @@ -3127,7 +3045,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889" dependencies = [ "block2 0.5.1", - "objc2 0.5.2", + "objc2 0.5.3", "objc2-foundation 0.2.2", ] @@ -3137,9 +3055,9 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "block2 0.5.1", - "objc2 0.5.2", + "objc2 0.5.3", "objc2-foundation 0.2.2", ] @@ -3149,8 +3067,8 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b402a653efbb5e82ce4df10683b6b28027616a2715e90009947d50b8dd298fa" dependencies = [ - "bitflags 2.11.1", - "objc2 0.6.4", + "bitflags 2.13.2", + "objc2 0.6.5", "objc2-foundation 0.3.2", ] @@ -3160,9 +3078,9 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "dispatch2", - "objc2 0.6.4", + "objc2 0.6.5", ] [[package]] @@ -3171,9 +3089,9 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "dispatch2", - "objc2 0.6.4", + "objc2 0.6.5", "objc2-core-foundation", "objc2-io-surface", ] @@ -3185,7 +3103,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80" dependencies = [ "block2 0.5.1", - "objc2 0.5.2", + "objc2 0.5.3", "objc2-foundation 0.2.2", "objc2-metal", ] @@ -3196,7 +3114,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5d563b38d2b97209f8e861173de434bd0214cf020e3423a52624cd1d989f006" dependencies = [ - "objc2 0.6.4", + "objc2 0.6.5", "objc2-foundation 0.3.2", ] @@ -3207,7 +3125,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781" dependencies = [ "block2 0.5.1", - "objc2 0.5.2", + "objc2 0.5.3", "objc2-contacts", "objc2-foundation 0.2.2", ] @@ -3218,8 +3136,8 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d" dependencies = [ - "bitflags 2.11.1", - "objc2 0.6.4", + "bitflags 2.13.2", + "objc2 0.6.5", "objc2-core-foundation", "objc2-core-graphics", ] @@ -3230,8 +3148,8 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d425caf1df73233f29fd8a5c3e5edbc30d2d4307870f802d18f00d83dc5141a6" dependencies = [ - "bitflags 2.11.1", - "objc2 0.6.4", + "bitflags 2.13.2", + "objc2 0.6.5", "objc2-core-foundation", "objc2-core-graphics", "objc2-io-surface", @@ -3249,11 +3167,11 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "block2 0.5.1", "dispatch", "libc", - "objc2 0.5.2", + "objc2 0.5.3", ] [[package]] @@ -3262,10 +3180,10 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "block2 0.6.2", "libc", - "objc2 0.6.4", + "objc2 0.6.5", "objc2-core-foundation", ] @@ -3275,8 +3193,8 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" dependencies = [ - "bitflags 2.11.1", - "objc2 0.6.4", + "bitflags 2.13.2", + "objc2 0.6.5", "objc2-core-foundation", ] @@ -3287,7 +3205,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398" dependencies = [ "block2 0.5.1", - "objc2 0.5.2", + "objc2 0.5.3", "objc2-app-kit 0.2.2", "objc2-foundation 0.2.2", ] @@ -3298,9 +3216,9 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "block2 0.5.1", - "objc2 0.5.2", + "objc2 0.5.3", "objc2-foundation 0.2.2", ] @@ -3310,9 +3228,9 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "block2 0.5.1", - "objc2 0.5.2", + "objc2 0.5.3", "objc2-foundation 0.2.2", "objc2-metal", ] @@ -3323,8 +3241,8 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" dependencies = [ - "bitflags 2.11.1", - "objc2 0.6.4", + "bitflags 2.13.2", + "objc2 0.6.5", "objc2-core-foundation", "objc2-foundation 0.3.2", ] @@ -3335,7 +3253,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc" dependencies = [ - "objc2 0.5.2", + "objc2 0.5.3", "objc2-foundation 0.2.2", ] @@ -3345,9 +3263,9 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "block2 0.5.1", - "objc2 0.5.2", + "objc2 0.5.3", "objc2-cloud-kit 0.2.2", "objc2-core-data 0.2.2", "objc2-core-image 0.2.2", @@ -3356,7 +3274,7 @@ dependencies = [ "objc2-link-presentation", "objc2-quartz-core 0.2.2", "objc2-symbols", - "objc2-uniform-type-identifiers", + "objc2-uniform-type-identifiers 0.2.2", "objc2-user-notifications", ] @@ -3367,19 +3285,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe" dependencies = [ "block2 0.5.1", - "objc2 0.5.2", + "objc2 0.5.3", "objc2-foundation 0.2.2", ] +[[package]] +name = "objc2-uniform-type-identifiers" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7902ac02859fc1f7045f8b598c63f1ae0cc7efeaa06a9bc9f3d9a3c955974fa4" +dependencies = [ + "objc2 0.6.5", + "objc2-foundation 0.3.2", +] + [[package]] name = "objc2-user-notifications" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "block2 0.5.1", - "objc2 0.5.2", + "objc2 0.5.3", "objc2-core-location", "objc2-foundation 0.2.2", ] @@ -3398,13 +3326,12 @@ checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" [[package]] name = "open" -version = "5.3.5" +version = "5.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fbaa89d2ddc8473c78a3adf69eea8cffa28c483b8e02a971ef31527cd0fc92c" +checksum = "8d8c8b8e725ad26404d6896eb2f064294a0a7b4f1d9120210d85544684c4ca95" dependencies = [ "is-wsl", "libc", - "pathdiff", ] [[package]] @@ -3425,9 +3352,9 @@ dependencies = [ [[package]] name = "ordered-float" -version = "5.3.0" +version = "5.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7d950ca161dc355eaf28f82b11345ed76c6e1f6eb1f4f4479e0323b9e2fbd0e" +checksum = "7f59006ce1e204c30956638535b74d317bca99477b9356dfaec54c37f6f600ab" dependencies = [ "num-traits", ] @@ -3503,12 +3430,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec" -[[package]] -name = "pathdiff" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3" - [[package]] name = "pathfinder_geometry" version = "0.5.1" @@ -3521,9 +3442,9 @@ dependencies = [ [[package]] name = "pathfinder_simd" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4500030c302e4af1d423f36f3b958d1aecb6c04184356ed5a833bf6b60435777" +checksum = "866282e66a5609f51217181eecb81cf4f2bf78c79d41b662f9cf711e0fcb60ff" dependencies = [ "rustc_version", ] @@ -3536,35 +3457,29 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "pin-project" -version = "1.1.13" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924" +checksum = "a6c2123f4708bbd422630a6dae7c03f678b1ce1f1c99e4c4b3beac69c8174cc9" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.13" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b" +checksum = "358938fd6df944c1e44bb328b60fb275f13c804aac47ba26a1165d45a3f87756" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 3.0.10", ] [[package]] name = "pin-project-lite" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" - -[[package]] -name = "pin-utils" -version = "0.1.0" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +checksum = "c938015719552d665fd0553b90d96cd7ff58e83e4c061ca99e6bb78865a72752" [[package]] name = "piper" @@ -3579,9 +3494,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.33" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e" +checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" [[package]] name = "plain" @@ -3589,30 +3504,17 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" -[[package]] -name = "png" -version = "0.17.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526" -dependencies = [ - "bitflags 1.3.2", - "crc32fast", - "fdeflate", - "flate2", - "miniz_oxide", -] - [[package]] name = "png" version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "crc32fast", "fdeflate", "flate2", - "miniz_oxide", + "miniz_oxide 0.8.9", ] [[package]] @@ -3625,40 +3527,31 @@ dependencies = [ "concurrent-queue", "hermit-abi", "pin-project-lite", - "rustix 1.1.4", + "rustix 1.1.6", "windows-sys 0.61.2", ] [[package]] name = "pollster" -version = "0.4.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f3a9f18d041e6d0e102a0a46750538147e5e8992d3b4873aaafee2520b00ce3" +checksum = "7e9b9cf600136f5b976fbc5727d58c26e1ecab8ee23088d44ef1c7af793550ab" [[package]] name = "portable-atomic" -version = "1.13.1" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" +checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" [[package]] name = "portable-atomic-util" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2a106d1259c23fac8e543272398ae0e3c0b8d33c88ed73d0cc71b0f1d902618" +checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" dependencies = [ "portable-atomic", ] -[[package]] -name = "potential_utf" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" -dependencies = [ - "zerovec", -] - [[package]] name = "ppv-lite86" version = "0.2.21" @@ -3674,23 +3567,13 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" -[[package]] -name = "prettyplease" -version = "0.2.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" -dependencies = [ - "proc-macro2", - "syn", -] - [[package]] name = "proc-macro-crate" version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" dependencies = [ - "toml_edit 0.25.12+spec-1.1.0", + "toml_edit 0.25.21+spec-1.1.0", ] [[package]] @@ -3712,14 +3595,14 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] name = "proc-macro2" -version = "1.0.106" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" dependencies = [ "unicode-ident", ] @@ -3740,14 +3623,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4488a4a36b9a4ba6b9334a32a39971f77c1436ec82c38707bce707699cc3bbcb" dependencies = [ "quote", - "syn", + "syn 2.0.119", ] [[package]] name = "pxfm" -version = "0.1.29" +version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0c5ccf5294c6ccd63a74f1565028353830a9c2f5eb0c682c355c471726a6e3f" +checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea" [[package]] name = "qoi" @@ -3766,18 +3649,18 @@ checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" [[package]] name = "quick-xml" -version = "0.39.4" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdcc8dd4e2f670d309a5f0e83fe36dfdc05af317008fea29144da1a2ac858e5e" +checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1" dependencies = [ "memchr", ] [[package]] name = "quote" -version = "1.0.45" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" dependencies = [ "proc-macro2", ] @@ -3796,9 +3679,9 @@ checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" [[package]] name = "rand" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c5af06bb1b7d3216d91932aed5265164bf384dc89cd6ba05cf59a35f5f76ea" +checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" dependencies = [ "rand_chacha", "rand_core", @@ -3831,9 +3714,9 @@ checksum = "ca45419789ae5a7899559e9512e58ca889e41f04f1f2445e9f4b290ceccd1d08" [[package]] name = "rangemap" -version = "1.7.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "973443cf09a9c8656b574a866ab68dfa19f0867d0340648c7d2f6a71b8a8ea68" +checksum = "f2d43a8c8c74056248124068fde0df374d1ddf9039e747d190f01c36faeaab08" [[package]] name = "rav1e" @@ -3865,7 +3748,7 @@ dependencies = [ "rand", "rand_chacha", "simd_helpers", - "thiserror 2.0.18", + "thiserror 2.0.21", "v_frame", "wasm-bindgen", ] @@ -3924,12 +3807,13 @@ dependencies = [ [[package]] name = "read-fonts" -version = "0.37.0" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b634fabf032fab15307ffd272149b622260f55974d9fad689292a5d33df02e5" +checksum = "046a7d674daf459825b32f5062056d6882db0d2f5a479fbd76ccfc870ac18709" dependencies = [ "bytemuck", - "font-types 0.11.3", + "font-types 0.12.7", + "once_cell", ] [[package]] @@ -3947,34 +3831,33 @@ version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", ] [[package]] name = "redox_syscall" -version = "0.8.0" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c7591fa2c6b601dfcfe5f043f65a1c39fcdf50efefcd7f1572e538c1f4b398d" +checksum = "580c875845b41ecb1564ad1ae4703044cef774145e3d7a94dc2b3fa7c97868fd" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", ] [[package]] name = "redox_users" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" +checksum = "60dc65c0ff1a7ae1294b0c67b9f14baf70b644404010370171787bfac1038fc0" dependencies = [ - "getrandom 0.2.17", "libredox", - "thiserror 2.0.18", + "thiserror 2.0.21", ] [[package]] name = "regex" -version = "1.13.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0e75113e14dc5acb068cd0786884f214f1312650a3d36d269f5c4f3cdee8a2" +checksum = "9807af0e638c12e753aa1b4e601791bf2a8f71274023c8bbeec12fc149950857" dependencies = [ "aho-corasick", "memchr", @@ -3984,9 +3867,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.15" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f388202e4b80542a0921078cc23b6333bcf1409c1e3f86404cae4766a6131db" +checksum = "41d60ef07df457506a0a1a2073112eb4aae5733dbd2813c3da77d1b0fd441158" dependencies = [ "aho-corasick", "memchr", @@ -3995,9 +3878,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.11" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" +checksum = "d902046e6a28a1e4c3cab97258a0ce11e994903f01c2d97a9447a0b3df85f4f6" [[package]] name = "renderdoc-sys" @@ -4007,26 +3890,30 @@ checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" [[package]] name = "rfd" -version = "0.15.4" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef2bee61e6cffa4635c72d7d81a84294e28f0930db0ddcb0f66d10244674ebed" +checksum = "c4b9d4857b10297ffb0f64cae711e983a7aeaee561848d56d429d3858bd8ed93" dependencies = [ - "ashpd", "block2 0.6.2", "dispatch2", "js-sys", + "libc", "log", - "objc2 0.6.4", + "objc2 0.6.5", "objc2-app-kit 0.3.2", "objc2-core-foundation", "objc2-foundation 0.3.2", + "objc2-uniform-type-identifiers 0.3.2", + "percent-encoding", "pollster", "raw-window-handle", - "urlencoding", "wasm-bindgen", "wasm-bindgen-futures", + "wayland-backend", + "wayland-client", + "wayland-protocols", "web-sys", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -4043,12 +3930,11 @@ checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97" [[package]] name = "rust-i18n" -version = "3.1.5" +version = "4.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda2551fdfaf6cc5ee283adc15e157047b92ae6535cf80f6d4962d05717dc332" +checksum = "8502e73e6461c738659455c5d2cf95bc132760a6f203c717e66ee72b78906d7f" dependencies = [ "globwalk", - "once_cell", "regex", "rust-i18n-macro", "rust-i18n-support", @@ -4057,39 +3943,34 @@ dependencies = [ [[package]] name = "rust-i18n-macro" -version = "3.1.5" +version = "4.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22baf7d7f56656d23ebe24f6bb57a5d40d2bce2a5f1c503e692b5b2fa450f965" +checksum = "d54a28dd9d46108d56b9f0c85b220908844233e561c03087890325104f90f2c6" dependencies = [ "glob", - "once_cell", "proc-macro2", "quote", "rust-i18n-support", "serde", "serde_json", - "serde_yaml", - "syn", + "syn 2.0.119", ] [[package]] name = "rust-i18n-support" -version = "3.1.5" +version = "4.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "940ed4f52bba4c0152056d771e563b7133ad9607d4384af016a134b58d758f19" +checksum = "e806c2a9701cbd6043992cd935c30cb1fdb128fa15e7b506f3b46f97045737c0" dependencies = [ "arc-swap", "base62", + "foldhash 0.2.0", "globwalk", "itertools 0.11.0", - "lazy_static", "normpath", - "once_cell", - "proc-macro2", - "regex", "serde", + "serde-saphyr", "serde_json", - "serde_yaml", "siphasher", "toml", "triomphe", @@ -4103,9 +3984,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustc-hash" -version = "2.1.2" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" [[package]] name = "rustc_version" @@ -4122,7 +4003,7 @@ version = "0.38.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "errno", "libc", "linux-raw-sys 0.4.15", @@ -4131,11 +4012,11 @@ dependencies = [ [[package]] name = "rustix" -version = "1.1.4" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "errno", "libc", "linux-raw-sys 0.12.1", @@ -4144,9 +4025,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.22" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" [[package]] name = "ryu" @@ -4190,9 +4071,9 @@ dependencies = [ [[package]] name = "self_cell" -version = "1.2.2" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b12e76d157a900eb52e81bc6e9f3069344290341720e9178cde2407113ac8d89" +checksum = "2ab42ca02749e120097e328d91d415325bdf43b1c72c4c8badf37375fe40a813" [[package]] name = "semver" @@ -4202,39 +4083,56 @@ checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" [[package]] name = "serde" -version = "1.0.228" +version = "1.0.229" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" dependencies = [ "serde_core", "serde_derive", ] +[[package]] +name = "serde-saphyr" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8050abb251097357e24aff63ba2c52a6309ecb7d23a5474023df960a02694d8" +dependencies = [ + "annotate-snippets", + "base64", + "encoding_rs_io", + "granit-parser", + "nohash-hasher", + "num-traits", + "serde_core", + "smallvec", + "zmij", +] + [[package]] name = "serde_core" -version = "1.0.228" +version = "1.0.229" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.228" +version = "1.0.229" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 3.0.10", ] [[package]] name = "serde_json" -version = "1.0.150" +version = "1.0.154" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" dependencies = [ "itoa", "memchr", @@ -4245,13 +4143,13 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.20" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c" +checksum = "8d3b1629de253c70a0508c3899572da79ca359fdab27c7920ff00406df418906" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 3.0.10", ] [[package]] @@ -4263,26 +4161,13 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_yaml" -version = "0.9.34+deprecated" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" -dependencies = [ - "indexmap", - "itoa", - "ryu", - "serde", - "unsafe-libyaml", -] - [[package]] name = "serialport" -version = "4.9.0" +version = "4.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4d91116f97173694f1642263b2ff837f80d933aa837e2314969f6728f661df3" +checksum = "6ba5f8f29aa20853c4e3e85a33ec580eb66be1f057142e77a333834a318bacf2" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "cfg-if", "core-foundation 0.10.1", "core-foundation-sys", @@ -4313,15 +4198,15 @@ dependencies = [ [[package]] name = "simd-adler32" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214" +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" [[package]] name = "simd_cesu8" -version = "1.1.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94f90157bb87cddf702797c5dadfa0be7d266cdf49e22da2fcaa32eff75b2c33" +checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520" dependencies = [ "rustc_version", "simdutf8", @@ -4329,12 +4214,9 @@ dependencies = [ [[package]] name = "simd_helpers" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6" -dependencies = [ - "quote", -] +checksum = "f48ea32978b7ad365bd1ecce83827746d5d50dc006a8c85112b7acc3c716e3e7" [[package]] name = "simdutf8" @@ -4344,9 +4226,9 @@ checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" [[package]] name = "siphasher" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649" +checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256" [[package]] name = "skrifa" @@ -4360,12 +4242,12 @@ dependencies = [ [[package]] name = "skrifa" -version = "0.40.0" +version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fbdfe3d2475fbd7ddd1f3e5cf8288a30eb3e5f95832829570cd88115a7434ac" +checksum = "819ab7d62b1d3e72d9d9dea5650bac30424f9111364bb94928dbf5ecad1baa68" dependencies = [ "bytemuck", - "read-fonts 0.37.0", + "read-fonts 0.41.0", ] [[package]] @@ -4385,9 +4267,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.15.1" +version = "1.16.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" +checksum = "3244542535d5de959d90ec55d1b5ff0fd2bb7b1310223907d5f11932847f7b59" [[package]] name = "smithay-client-toolkit" @@ -4395,7 +4277,7 @@ version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "calloop 0.13.0", "calloop-wayland-source 0.3.0", "cursor-icon", @@ -4420,15 +4302,15 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0512da38f5e2b31201a93524adb8d3136276fa4fe4aafab4e1f727a82b534cc0" dependencies = [ - "bitflags 2.11.1", - "calloop 0.14.4", + "bitflags 2.13.2", + "calloop 0.14.5", "calloop-wayland-source 0.4.1", "cursor-icon", "libc", "log", "memmap2", - "rustix 1.1.4", - "thiserror 2.0.18", + "rustix 1.1.6", + "thiserror 2.0.21", "wayland-backend", "wayland-client", "wayland-csd-frame", @@ -4473,14 +4355,14 @@ dependencies = [ "js-sys", "memmap2", "ndk", - "objc2 0.6.4", + "objc2 0.6.5", "objc2-core-foundation", "objc2-core-graphics", "objc2-foundation 0.3.2", "objc2-quartz-core 0.3.2", "raw-window-handle", "redox_syscall 0.5.18", - "rustix 1.1.4", + "rustix 1.1.6", "tiny-xlib", "tracing", "wasm-bindgen", @@ -4498,7 +4380,7 @@ version = "0.3.0+sdk-1.3.268.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", ] [[package]] @@ -4533,20 +4415,20 @@ checksum = "0193cc4331cfd2f3d2011ef287590868599a2f33c3e69bc22c1a3d3acf9e02fb" [[package]] name = "swash" -version = "0.2.7" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "842f3cd369c2ba38966204f983eaa5e54a8e84a7d7159ed36ade2b6c335aae64" +checksum = "6c2499c2d826531388872b2268718aed907a39bd785ab0dcfe57fab26283f92e" dependencies = [ - "skrifa 0.40.0", + "skrifa 0.44.0", "yazi", "zeno", ] [[package]] name = "syn" -version = "2.0.117" +version = "2.0.119" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" dependencies = [ "proc-macro2", "quote", @@ -4554,14 +4436,14 @@ dependencies = [ ] [[package]] -name = "synstructure" -version = "0.13.2" +name = "syn" +version = "3.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79" dependencies = [ "proc-macro2", "quote", - "syn", + "unicode-ident", ] [[package]] @@ -4594,9 +4476,15 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] +[[package]] +name = "target-features" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1bbb9f3c5c463a01705937a24fdabc5047929ac764b2d5b9cf681c1f5041ed5" + [[package]] name = "tempfile" version = "3.27.0" @@ -4604,9 +4492,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" dependencies = [ "fastrand", - "getrandom 0.4.2", + "getrandom 0.4.3", "once_cell", - "rustix 1.1.4", + "rustix 1.1.6", "windows-sys 0.61.2", ] @@ -4639,11 +4527,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.18" +version = "2.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" dependencies = [ - "thiserror-impl 2.0.18", + "thiserror-impl 2.0.21", ] [[package]] @@ -4654,18 +4542,18 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] name = "thiserror-impl" -version = "2.0.18" +version = "2.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 3.0.10", ] [[package]] @@ -4707,7 +4595,7 @@ dependencies = [ "bytemuck", "cfg-if", "log", - "png 0.18.1", + "png", "tiny-skia-path 0.12.0", ] @@ -4746,36 +4634,17 @@ dependencies = [ "tracing", ] -[[package]] -name = "tinystr" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" -dependencies = [ - "displaydoc", - "zerovec", -] - [[package]] name = "tinyvec" -version = "1.11.0" +version = "1.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" [[package]] name = "tokio" -version = "1.52.3" +version = "1.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" dependencies = [ "pin-project-lite", ] @@ -4803,9 +4672,9 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "1.1.1+spec-1.1.0" +version = "1.1.3+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" +checksum = "173f25c883cd2176a2d8212155638c0a60d484a9d84546d270866f40f56b6e49" dependencies = [ "serde_core", ] @@ -4826,23 +4695,23 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.25.12+spec-1.1.0" +version = "0.25.21+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2153edc6955a6c354fad8f5efd38b6a8769bdccf9fe50f8e1329f81b0baa5d7" +checksum = "88497dab46de5bf343ec66b05c251e48c6213f3e9170c70a70a823f7abe886a4" dependencies = [ "indexmap", - "toml_datetime 1.1.1+spec-1.1.0", + "toml_datetime 1.1.3+spec-1.1.0", "toml_parser", - "winnow 1.0.3", + "winnow 1.0.5", ] [[package]] name = "toml_parser" -version = "1.1.2+spec-1.1.0" +version = "1.1.7+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" +checksum = "0bb28d6e049a9766c3bd91a8326e6179f5b132dec87906bb97018ef7a2f3431a" dependencies = [ - "winnow 1.0.3", + "winnow 1.0.5", ] [[package]] @@ -4871,7 +4740,7 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] @@ -4885,9 +4754,9 @@ dependencies = [ [[package]] name = "triomphe" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b40688ea6389c8171614b25491f71d4a27946e0c7ce2da1c6de27e25abf1a0ae" +checksum = "0d15f4f5898bcfc5d8a8e45ed30b2f108d710c1a2e5489dbf80e078f707181bc" dependencies = [ "arc-swap", "serde", @@ -4916,11 +4785,11 @@ dependencies = [ [[package]] name = "unescaper" -version = "0.1.8" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4064ed685c487dbc25bd3f0e9548f2e34bab9d18cefc700f9ec2dba74ba1138e" +checksum = "7285e83a80ce76f5e7bce79fa41f68d78ba62d1003cf27bf748ab24413808cf4" dependencies = [ - "thiserror 2.0.18", + "thiserror 2.0.21", ] [[package]] @@ -4931,9 +4800,9 @@ checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" [[package]] name = "unicode-ident" -version = "1.0.24" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" [[package]] name = "unicode-linebreak" @@ -4943,27 +4812,21 @@ checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" [[package]] name = "unicode-script" -version = "0.5.8" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "383ad40bb927465ec0ce7720e033cb4ca06912855fc35db31b5755d0de75b1ee" +checksum = "aa04c955db05429d464c74d495c1ee677e1866e783a4c3747f9c0cef7756cabf" [[package]] name = "unicode-segmentation" -version = "1.13.2" +version = "1.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9629274872b2bfaf8d66f5f15725007f635594914870f65218920345aa11aa8c" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" [[package]] name = "unicode-width" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" - -[[package]] -name = "unicode-xid" -version = "0.2.6" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +checksum = "ca718471876992059f251e33aafc334346ada08042b7661dd1fe313a9bced557" [[package]] name = "unit-prefix" @@ -4971,37 +4834,6 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81e544489bf3d8ef66c953931f56617f423cd4b5494be343d9b9d3dda037b9a3" -[[package]] -name = "unsafe-libyaml" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" - -[[package]] -name = "url" -version = "2.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", - "serde", - "serde_derive", -] - -[[package]] -name = "urlencoding" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" - -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - [[package]] name = "utf8parse" version = "0.2.2" @@ -5010,9 +4842,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.23.2" +version = "1.29.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d258b83ceec21034727ecee8c382cfa6c3e133699b0742c64571814fb420c9f7" +checksum = "3c14b15dffa2f4bd712103e857140aa04a4f2ff6e955c77d7eb8e53ee02a3b64" dependencies = [ "js-sys", "serde_core", @@ -5038,46 +4870,30 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "walkdir" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +checksum = "b42e295b7452c4604982280d8586001fcad9b8b201cac67bca9771e7a7475403" dependencies = [ "same-file", "winapi-util", ] -[[package]] -name = "wasi" -version = "0.11.1+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" - [[package]] name = "wasip2" -version = "1.0.3+wasi-0.2.9" +version = "1.0.4+wasi-0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" dependencies = [ - "wit-bindgen 0.57.1", -] - -[[package]] -name = "wasip3" -version = "0.4.0+wasi-0.3.0-rc-2026-01-06" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" -dependencies = [ - "wit-bindgen 0.51.0", + "wit-bindgen", ] [[package]] name = "wasm-bindgen" -version = "0.2.122" +version = "0.2.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed04576f974d2b2fba0f38c51dbc5518011e38c36bf1143164be765528fd409" +checksum = "a0181c14ddd6c7b8b0b0132a5f1ea2f32be0d893cd3ea97b6e3b28886b8a3d1c" dependencies = [ "cfg-if", - "once_cell", "rustversion", "wasm-bindgen-macro", "wasm-bindgen-shared", @@ -5085,19 +4901,20 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.72" +version = "0.4.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9473dbd2991ae90b6291c3c32c30c6187ac49aa32f9905d1cce280ec1e110b0f" +checksum = "5e14e0327cb5368ad60ccb22d04a9827a693c95a926d8d125e9fa39e0baec501" dependencies = [ "js-sys", + "tokio", "wasm-bindgen", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.122" +version = "0.2.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "916151b09da36bd82f6615cbf3a419e2f0ba23a03c6160e8e92eb6bd4aa1dec6" +checksum = "6e931a02a39abdbf66966fc35902b5ed58344750a70885bed4ebb3d8eaf28ed9" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -5105,83 +4922,49 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.122" +version = "0.2.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "299047362ccbfce148b67ab7e73349f77748e00c8296f9542adfad2ad82c5c5e" +checksum = "2ca4b54280e455bd831e33a6b8e734baf432fe63fbc35c42ac14ce67a043a53a" dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn", + "syn 3.0.10", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.122" +version = "0.2.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a929b2c61f11ba3e9bc35b50c1f25cb38e0e892c0c231ae2b8cf78d5dad4437" +checksum = "3b1f9c3798725016c6ee5f2f57869ec0831e8bbc0ab0310a86e787e97f41389e" dependencies = [ "unicode-ident", ] -[[package]] -name = "wasm-encoder" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" -dependencies = [ - "leb128fmt", - "wasmparser", -] - -[[package]] -name = "wasm-metadata" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" -dependencies = [ - "anyhow", - "indexmap", - "wasm-encoder", - "wasmparser", -] - -[[package]] -name = "wasmparser" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" -dependencies = [ - "bitflags 2.11.1", - "hashbrown 0.15.5", - "indexmap", - "semver", -] - [[package]] name = "wasmtimer" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c598d6b99ea013e35844697fc4670d08339d5cda15588f193c6beedd12f644b" +checksum = "c62b7f338e4397a45d054c15a2b36a93d57cccdda7be11a7d7b045d47b5e70ce" dependencies = [ "futures", "js-sys", "parking_lot", - "pin-utils", + "pin-project-lite", "slab", "wasm-bindgen", ] [[package]] name = "wayland-backend" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2857dd20b54e916ec7253b3d6b4d5c4d7d4ca2c33c2e11c6c76a99bd8744755d" +checksum = "38a91b4eaddff87b1cd1074985e3713da4af2c49742d1b356b2c01670a67a078" dependencies = [ "cc", "downcast-rs", - "rustix 1.1.4", + "rustix 1.1.6", "scoped-tls", "smallvec", "wayland-sys", @@ -5189,12 +4972,12 @@ dependencies = [ [[package]] name = "wayland-client" -version = "0.31.14" +version = "0.31.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c7c96bb74690c3189b5c9cb4ca1627062bb23693a4fad9d8c3de958260144" +checksum = "e3c36a0f861ad76d0901f2800b46321410d9f73f2ea88aac0650d86c32688073" dependencies = [ - "bitflags 2.11.1", - "rustix 1.1.4", + "bitflags 2.13.2", + "rustix 1.1.6", "wayland-backend", "wayland-scanner", ] @@ -5205,7 +4988,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "cursor-icon", "wayland-backend", ] @@ -5216,18 +4999,18 @@ version = "0.31.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a52d18780be9b1314328a3de5f930b73d2200112e3849ca6cb11822793fb34d" dependencies = [ - "rustix 1.1.4", + "rustix 1.1.6", "wayland-client", "xcursor", ] [[package]] name = "wayland-protocols" -version = "0.32.12" +version = "0.32.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "563a85523cade2429938e790815fd7319062103b9f4a2dc806e9b53b95982d8f" +checksum = "23d0c813de3daa2ed6520af85a3bd49b0e722a3078506899aa9686fea58dc4b6" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "wayland-backend", "wayland-client", "wayland-scanner", @@ -5239,7 +5022,7 @@ version = "20250721.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40a1f863128dcaaec790d7b4b396cc9b9a7a079e878e18c47e6c2d2c5a8dcbb1" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "wayland-backend", "wayland-client", "wayland-protocols", @@ -5252,7 +5035,7 @@ version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e9567599ef23e09b8dad6e429e5738d4509dfc46b3b21f32841a304d16b29c8" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "wayland-backend", "wayland-client", "wayland-protocols", @@ -5265,7 +5048,7 @@ version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b6d8cf1eb2c1c31ed1f5643c88a6e53538129d4af80030c8cabd1f9fa884d91" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "wayland-backend", "wayland-client", "wayland-protocols", @@ -5278,7 +5061,7 @@ version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eb04e52f7836d7c7976c78ca0250d61e33873c34156a2a1fc9474828ec268234" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "wayland-backend", "wayland-client", "wayland-protocols", @@ -5287,9 +5070,9 @@ dependencies = [ [[package]] name = "wayland-scanner" -version = "0.31.10" +version = "0.31.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c324a910fd86ebdc364a3e61ec1f11737d3b1d6c273c0239ee8ff4bc0d24b4a" +checksum = "338e30461b3a2b67d70eb30a6d89f8e0c93a833e07d2ae89085cd070c4a00ac0" dependencies = [ "proc-macro2", "quick-xml", @@ -5310,9 +5093,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.99" +version = "0.3.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621441cfc37b84979402712047321980c178f299193a3589d05b99e8763436" +checksum = "d7d179596ff5ec0f6de4db64d54011bde6289cc49603d3a6e4ce3f329207ab88" dependencies = [ "js-sys", "wasm-bindgen", @@ -5341,7 +5124,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfe68bac7cde125de7a731c3400723cadaaf1703795ad3f4805f187459cd7a77" dependencies = [ "arrayvec", - "bitflags 2.11.1", + "bitflags 2.13.2", "cfg-if", "cfg_aliases", "document-features", @@ -5372,7 +5155,7 @@ dependencies = [ "arrayvec", "bit-set", "bit-vec", - "bitflags 2.11.1", + "bitflags 2.13.2", "bytemuck", "cfg_aliases", "document-features", @@ -5387,7 +5170,7 @@ dependencies = [ "raw-window-handle", "rustc-hash 1.1.0", "smallvec", - "thiserror 2.0.18", + "thiserror 2.0.21", "wgpu-core-deps-apple", "wgpu-core-deps-emscripten", "wgpu-core-deps-windows-linux-android", @@ -5432,7 +5215,7 @@ dependencies = [ "arrayvec", "ash", "bit-set", - "bitflags 2.11.1", + "bitflags 2.13.2", "block", "bytemuck", "cfg-if", @@ -5463,7 +5246,7 @@ dependencies = [ "raw-window-handle", "renderdoc-sys", "smallvec", - "thiserror 2.0.18", + "thiserror 2.0.21", "wasm-bindgen", "web-sys", "wgpu-types", @@ -5477,11 +5260,11 @@ version = "27.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afdcf84c395990db737f2dd91628706cb31e86d72e53482320d368e52b5da5eb" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "bytemuck", "js-sys", "log", - "thiserror 2.0.18", + "thiserror 2.0.21", "web-sys", ] @@ -5527,7 +5310,7 @@ dependencies = [ "clipboard_wayland", "clipboard_x11", "raw-window-handle", - "thiserror 2.0.18", + "thiserror 2.0.21", ] [[package]] @@ -5606,7 +5389,7 @@ checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] @@ -5617,7 +5400,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] @@ -5628,7 +5411,7 @@ checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] @@ -5639,7 +5422,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] @@ -5804,7 +5587,7 @@ dependencies = [ "ahash", "android-activity", "atomic-waker", - "bitflags 2.11.1", + "bitflags 2.13.2", "block2 0.5.1", "bytemuck", "calloop 0.13.0", @@ -5818,7 +5601,7 @@ dependencies = [ "libc", "memmap2", "ndk", - "objc2 0.5.2", + "objc2 0.5.3", "objc2-app-kit 0.2.2", "objc2-foundation 0.2.2", "objc2-ui-kit", @@ -5858,9 +5641,9 @@ dependencies = [ [[package]] name = "winnow" -version = "1.0.3" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0592e1c9d151f854e6fd382574c3a0855250e1d9b2f99d9281c6e6391af352f1" +checksum = "8c3b93199df0ab874cdf0c6a94f0a0dc3423fe41f1cafb62b8bd7b1deb277aef" dependencies = [ "memchr", ] @@ -5874,100 +5657,12 @@ dependencies = [ "winapi", ] -[[package]] -name = "wit-bindgen" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" -dependencies = [ - "wit-bindgen-rust-macro", -] - [[package]] name = "wit-bindgen" version = "0.57.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" -[[package]] -name = "wit-bindgen-core" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" -dependencies = [ - "anyhow", - "heck", - "wit-parser", -] - -[[package]] -name = "wit-bindgen-rust" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" -dependencies = [ - "anyhow", - "heck", - "indexmap", - "prettyplease", - "syn", - "wasm-metadata", - "wit-bindgen-core", - "wit-component", -] - -[[package]] -name = "wit-bindgen-rust-macro" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" -dependencies = [ - "anyhow", - "prettyplease", - "proc-macro2", - "quote", - "syn", - "wit-bindgen-core", - "wit-bindgen-rust", -] - -[[package]] -name = "wit-component" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" -dependencies = [ - "anyhow", - "bitflags 2.11.1", - "indexmap", - "log", - "serde", - "serde_derive", - "serde_json", - "wasm-encoder", - "wasm-metadata", - "wasmparser", - "wit-parser", -] - -[[package]] -name = "wit-parser" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" -dependencies = [ - "anyhow", - "id-arena", - "indexmap", - "log", - "semver", - "serde", - "serde_derive", - "serde_json", - "unicode-xid", - "wasmparser", -] - [[package]] name = "wm-tools" version = "0.1.2" @@ -5982,12 +5677,6 @@ dependencies = [ "tabled", ] -[[package]] -name = "writeable" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" - [[package]] name = "x11-dl" version = "2.21.0" @@ -6010,7 +5699,7 @@ dependencies = [ "libc", "libloading", "once_cell", - "rustix 1.1.4", + "rustix 1.1.6", "x11rb-protocol", ] @@ -6022,9 +5711,9 @@ checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd" [[package]] name = "xcursor" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec9e4a500ca8864c5b47b8b482a73d62e4237670e5b5f1d6b9e3cae50f28f2b" +checksum = "163b33ed8786455e2fa5d72f554057ce3f3182425434f756cd39c99839d88e23" [[package]] name = "xkbcommon-dl" @@ -6032,7 +5721,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5" dependencies = [ - "bitflags 2.11.1", + "bitflags 2.13.2", "dlib", "log", "once_cell", @@ -6047,9 +5736,9 @@ checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" [[package]] name = "xml-rs" -version = "0.8.28" +version = "0.8.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ae8337f8a065cfc972643663ea4279e04e7256de865aa66fe25cec5fb912d3f" +checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7" [[package]] name = "y4m" @@ -6059,9 +5748,9 @@ checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448" [[package]] name = "yazi" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e01738255b5a16e78bbb83e7fbba0a1e7dd506905cfc53f4622d89015a03fbb5" +checksum = "ac366ea532fa8ee6a992cec9dea525b1dc284e69702f36c2ab5fbebadc81ec86" [[package]] name = "yeslogic-fontconfig-sys" @@ -6074,34 +5763,11 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "yoke" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abe8c5fda708d9ca3df187cae8bfb9ceda00dd96231bed36e445a1a48e66f9ca" -dependencies = [ - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - [[package]] name = "zbus" -version = "5.16.0" +version = "5.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eee682d202a77e4a9f3b2c2bdf48a7b28af5c08c34ddf66f98c93e5e39464285" +checksum = "5db4be7c075cb421e4b7ee645541604239bd243ba7c357511f4ff3a74b555907" dependencies = [ "async-broadcast", "async-executor", @@ -6119,14 +5785,14 @@ dependencies = [ "hex", "libc", "ordered-stream", - "rustix 1.1.4", + "rustix 1.1.6", "serde", "serde_repr", "tracing", "uds_windows", "uuid", "windows-sys 0.61.2", - "winnow 1.0.3", + "winnow 1.0.5", "zbus_macros", "zbus_names", "zvariant", @@ -6134,14 +5800,14 @@ dependencies = [ [[package]] name = "zbus_macros" -version = "5.16.0" +version = "5.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adf1bd45a81a103745b1757754762a26e8cd01e4532e4d6c8ec431624b80d1d6" +checksum = "2990635d09ade6df1868f72f8cac69a876a90981e8bd3c40b1be413f8dc88f40" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn", + "syn 3.0.10", "zbus_names", "zvariant", "zvariant_utils", @@ -6149,15 +5815,24 @@ dependencies = [ [[package]] name = "zbus_names" -version = "4.3.2" +version = "4.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7074f3e50b894eac91750142016d30d0a89be8e67dbfd9704fb875825760e52d" +checksum = "812a12be4ead7a59e18ea8f047d08add0066b73bc62fc1467066a2472ae088dd" dependencies = [ "serde", - "winnow 1.0.3", + "winnow 1.0.5", "zvariant", ] +[[package]] +name = "zcheapstr" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2da34e7164b75d803c3197b86e6cf61b874106fbd472c5082575a8bc5fbd0907" +dependencies = [ + "serde", +] + [[package]] name = "zeno" version = "0.3.3" @@ -6166,89 +5841,41 @@ checksum = "6df3dc4292935e51816d896edcd52aa30bc297907c26167fec31e2b0c6a32524" [[package]] name = "zerocopy" -version = "0.8.50" +version = "0.8.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b065d4f0e55f82fae73202e189638116a87c55ab6b8e6c2721e13dd9d854ad1" +checksum = "cba8a86aee14fc8cc6c208af60854b3d4ab7185a9a369a12c648faa2716ff42a" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b631b19d36a892ab55420c92dbc83ccd79274f25be714855d3074aa71cab639" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "zerofrom" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.7" +version = "0.8.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" +checksum = "f89bca3b96ceb3cfcb4572790402f977442270d252b9a8504ebc258760c55f94" dependencies = [ "proc-macro2", "quote", - "syn", - "synstructure", + "syn 2.0.119", ] [[package]] -name = "zerotrie" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" -dependencies = [ - "displaydoc", - "yoke", - "zerofrom", -] - -[[package]] -name = "zerovec" -version = "0.11.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" -dependencies = [ - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.11.3" +name = "zlib-rs" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] +checksum = "aa76918995d776d9dd34d371030be228d021137449771493d56e29f77e4148ac" [[package]] name = "zmij" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" [[package]] name = "zune-core" -version = "0.5.1" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb8a0807f7c01457d0379ba880ba6322660448ddebc890ce29bb64da71fb40f9" +checksum = "d56377fd46368984a170bc5aac5567e52ca5da874caa60bea39fcbca78fb658b" [[package]] name = "zune-inflate" @@ -6270,41 +5897,41 @@ dependencies = [ [[package]] name = "zvariant" -version = "5.12.0" +version = "5.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a192a0bde63360d77a7523c833d4b4ce6070a927e2c53246e4c540b1a3e27be0" +checksum = "80bf6d6cd6a4b601acb64cfb8284cdc643fcfa75ef26ae3c46ec8aa4e8a1fbb7" dependencies = [ "endi", "enumflags2", "serde", - "url", - "winnow 1.0.3", + "winnow 1.0.5", + "zcheapstr", "zvariant_derive", "zvariant_utils", ] [[package]] name = "zvariant_derive" -version = "5.12.0" +version = "5.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bc6cde9c01c511074be97f7ccb6c19d0da89e3f8662e812e999dcfd4638737" +checksum = "ef2672456ba1cb54b5eaec136e63135b3c7495fb938e53b28a62e633496d486d" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn", + "syn 3.0.10", "zvariant_utils", ] [[package]] name = "zvariant_utils" -version = "3.4.0" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e8535915cfa75547e559d8c68e8139909a4aeee076831e4ef7fc59d8172c4d6" +checksum = "bad0294361a320b694a328460dc73add56c306150f5cb6bfafc44446120008a3" dependencies = [ "proc-macro2", "quote", "serde", - "syn", - "winnow 1.0.3", + "syn 3.0.10", + "winnow 1.0.5", ] diff --git a/Cargo.toml b/Cargo.toml index 7ad725f..8320587 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -resolver = "2" +resolver = "3" members = [ "flasher", "dso-parser", @@ -7,9 +7,8 @@ members = [ ] [workspace.package] -version = "0.2.1" -edition = "2021" -description = "Tools for ZeeWeii DSO3D12 oscilloscope and Winner Micro MCUs" +version = "0.3.0" +edition = "2024" license = "MIT" repository = "https://github.com/rssdev10/wm-tools" @@ -17,6 +16,6 @@ repository = "https://github.com/rssdev10/wm-tools" anyhow = "1.0" thiserror = "2.0" log = "0.4" -rust-i18n = "3" -png = "0.17" +rust-i18n = "4" +png = "0.18" tiny-skia = "0.12" diff --git a/README.md b/README.md index 4f2d3c1..fa52797 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ To use the snapshot view feature, you must install the modified firmware. For mo ## Requirements -- Rust toolchain (stable, 2021 edition or later) +- Rust toolchain (stable, 1.85 or later for the 2024 edition) - A USB-to-serial adapter connected to the target device (or integrated one) ## How to build diff --git a/gui/Cargo.toml b/gui/Cargo.toml index 214f819..1f3b82a 100644 --- a/gui/Cargo.toml +++ b/gui/Cargo.toml @@ -19,8 +19,8 @@ iced = { version = "0.14", features = ["canvas", "tokio", "advanced", "image"] } iced_aw = { version = "0.14", features = ["context_menu"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -rfd = "0.15" -dirs = "6.0" +rfd = "0.18" +dirs = "7.0" csv = "1.3" chrono = { version = "0.4", default-features = false, features = ["clock"] } serialport = "4.6" diff --git a/gui/src/app.rs b/gui/src/app.rs index 0ac4b99..f8aa90b 100644 --- a/gui/src/app.rs +++ b/gui/src/app.rs @@ -468,12 +468,12 @@ impl App { Task::none() } Message::SelectCapture(i) => { - if let Some(d) = &self.dump { - if i < d.captures.len() { - // The selected capture brings its own scale; the - // manual scale in settings is left unchanged. - self.current = i; - } + if let Some(d) = &self.dump + && i < d.captures.len() + { + // The selected capture brings its own scale; the + // manual scale in settings is left unchanged. + self.current = i; } Task::none() } @@ -700,51 +700,54 @@ impl App { } Message::VPerCellChangedCh1(s) => { self.v_per_div_ch1_input = s.clone(); - if let Ok(v) = s.parse::() { - if v > 0.0 && v.is_finite() { - self.settings.v_per_div_ch1 = v; - self.settings.save(); - } + if let Ok(v) = s.parse::() + && v > 0.0 + && v.is_finite() + { + self.settings.v_per_div_ch1 = v; + self.settings.save(); } Task::none() } Message::VPerCellChangedCh2(s) => { self.v_per_div_ch2_input = s.clone(); - if let Ok(v) = s.parse::() { - if v > 0.0 && v.is_finite() { - self.settings.v_per_div_ch2 = v; - self.settings.save(); - } + if let Ok(v) = s.parse::() + && v > 0.0 + && v.is_finite() + { + self.settings.v_per_div_ch2 = v; + self.settings.save(); } Task::none() } Message::TPerCellChanged(s) => { self.t_per_div_input = s.clone(); - if let Ok(v) = s.parse::() { - if v > 0.0 && v.is_finite() { - self.settings.t_per_div_ms = v; - self.settings.save(); - } + if let Ok(v) = s.parse::() + && v > 0.0 + && v.is_finite() + { + self.settings.t_per_div_ms = v; + self.settings.save(); } Task::none() } Message::VOffsetChangedCh1(s) => { self.v_offset_ch1_input = s.clone(); - if let Ok(v) = s.parse::() { - if v.is_finite() { - self.settings.v_offset_ch1 = v; - self.settings.save(); - } + if let Ok(v) = s.parse::() + && v.is_finite() + { + self.settings.v_offset_ch1 = v; + self.settings.save(); } Task::none() } Message::VOffsetChangedCh2(s) => { self.v_offset_ch2_input = s.clone(); - if let Ok(v) = s.parse::() { - if v.is_finite() { - self.settings.v_offset_ch2 = v; - self.settings.save(); - } + if let Ok(v) = s.parse::() + && v.is_finite() + { + self.settings.v_offset_ch2 = v; + self.settings.save(); } Task::none() } @@ -769,15 +772,15 @@ impl App { Message::MeasCursorDragged(drag) => { // Move only the lines the canvas picked for this drag: one // line, or an X and a Y line near their crossing. - if self.settings.measurement_cursor_x_enabled { - if let Some(knob) = drag.target.x { - move_knob(&mut self.settings.cursor_x_range, knob, drag.frac_x); - } + if self.settings.measurement_cursor_x_enabled + && let Some(knob) = drag.target.x + { + move_knob(&mut self.settings.cursor_x_range, knob, drag.frac_x); } - if self.settings.measurement_cursor_y_enabled { - if let Some(knob) = drag.target.y { - move_knob(&mut self.settings.cursor_y_range, knob, drag.frac_y); - } + if self.settings.measurement_cursor_y_enabled + && let Some(knob) = drag.target.y + { + move_knob(&mut self.settings.cursor_y_range, knob, drag.frac_y); } Task::none() } @@ -798,18 +801,18 @@ impl App { } Message::CloseSettings => { // Apply settings - if let Ok(b) = self.settings_baud_input.parse::() { - if b > 0 { - self.settings.baud_rate = b; - } + if let Ok(b) = self.settings_baud_input.parse::() + && b > 0 + { + self.settings.baud_rate = b; } let p = self.settings_port_input.trim().to_string(); self.settings.serial_port = if p.is_empty() { None } else { Some(p) }; // PNG export width: minimum 300 px, 0 = default small. - if let Ok(w) = self.png_width_input.trim().parse::() { - if w == 0 || w >= 300 { - self.settings.png_export_width = w; - } + if let Ok(w) = self.png_width_input.trim().parse::() + && (w == 0 || w >= 300) + { + self.settings.png_export_width = w; } self.settings.save(); self.show_settings = false; @@ -858,12 +861,12 @@ impl App { Message::PortScanTick => { self.available_ports = serial::list_ports(); // Auto-listen: if enabled and not currently listening and a port is available - if self.settings.auto_listen && !self.listening { - if let Some(port) = &self.settings.serial_port { - if self.available_ports.contains(port) { - return self.update(Message::StartListening); - } - } + if self.settings.auto_listen + && !self.listening + && let Some(port) = &self.settings.serial_port + && self.available_ports.contains(port) + { + return self.update(Message::StartListening); } Task::none() } @@ -877,16 +880,16 @@ impl App { Task::none() } Message::ContextMenuDeleteAt(idx) => { - if let Some(ref mut dump) = self.dump { - if idx < dump.captures.len() { - let entry = dump.captures.remove(idx); - self.deleted_capture = Some((idx, entry)); - self.deleted_at = Some(std::time::Instant::now()); - if self.current >= dump.captures.len() && self.current > 0 { - self.current -= 1; - } - self.status = t!("label.deleted", n = idx + 1).to_string(); + if let Some(ref mut dump) = self.dump + && idx < dump.captures.len() + { + let entry = dump.captures.remove(idx); + self.deleted_capture = Some((idx, entry)); + self.deleted_at = Some(std::time::Instant::now()); + if self.current >= dump.captures.len() && self.current > 0 { + self.current -= 1; } + self.status = t!("label.deleted", n = idx + 1).to_string(); } Task::none() } @@ -905,14 +908,14 @@ impl App { Task::none() } Message::UndoExpiredTick => { - if let Some(at) = self.deleted_at { - if at.elapsed().as_secs() >= 30 { - self.deleted_capture = None; - self.deleted_at = None; - // Clear the status hint only if it still mentions undo - if self.status.contains("Undo") { - self.status = t!("label.undo_expired").to_string(); - } + if let Some(at) = self.deleted_at + && at.elapsed().as_secs() >= 30 + { + self.deleted_capture = None; + self.deleted_at = None; + // Clear the status hint only if it still mentions undo + if self.status.contains("Undo") { + self.status = t!("label.undo_expired").to_string(); } } Task::none() @@ -979,12 +982,12 @@ impl App { self.show_firmware = false; self.firmware_confirming = false; // Auto-reconnect if we were listening before - if self.was_listening_before_flash && !self.listening { - if let Some(port) = &self.settings.serial_port { - if self.available_ports.contains(port) { - return self.update(Message::StartListening); - } - } + if self.was_listening_before_flash + && !self.listening + && let Some(port) = &self.settings.serial_port + && self.available_ports.contains(port) + { + return self.update(Message::StartListening); } Task::none() } diff --git a/gui/src/export_image.rs b/gui/src/export_image.rs index b5bd920..1a3cf86 100644 --- a/gui/src/export_image.rs +++ b/gui/src/export_image.rs @@ -220,15 +220,15 @@ pub fn export_png( scale_margin_left, 0, graph_w, graph_h, trace_w, smooth, antialias); } } - if settings.show_ch2 { - if let Some(ch2) = &cap.ch2 { - if dot_mode { - draw_dots(&mut pixels, width, height, ch2, PNG_CH2, - scale_margin_left, 0, graph_w, graph_h, dot_radius, antialias); - } else { - draw_trace(&mut pixels, width, height, ch2, PNG_CH2, - scale_margin_left, 0, graph_w, graph_h, trace_w, smooth, antialias); - } + if settings.show_ch2 + && let Some(ch2) = &cap.ch2 + { + if dot_mode { + draw_dots(&mut pixels, width, height, ch2, PNG_CH2, + scale_margin_left, 0, graph_w, graph_h, dot_radius, antialias); + } else { + draw_trace(&mut pixels, width, height, ch2, PNG_CH2, + scale_margin_left, 0, graph_w, graph_h, trace_w, smooth, antialias); } } if settings.show_scales { @@ -730,7 +730,7 @@ fn write_png(path: &Path, width: u32, height: u32, rgba: &[u8]) -> anyhow::Resul let mut encoder = png::Encoder::new(w, width, height); encoder.set_color(png::ColorType::Rgba); encoder.set_depth(png::BitDepth::Eight); - encoder.set_compression(png::Compression::Best); + encoder.set_compression(png::Compression::High); let mut writer = encoder.write_header()?; writer.write_image_data(rgba)?; diff --git a/gui/src/i18n.rs b/gui/src/i18n.rs index 1070a7a..d4b5ff2 100644 --- a/gui/src/i18n.rs +++ b/gui/src/i18n.rs @@ -42,3 +42,22 @@ pub fn detect_system_language() -> String { } "en".into() } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn translations_load_for_every_language() { + // A missing locale file or a broken loader makes t! return the key. + for (code, _, _) in LANGUAGES { + let s = t!("app.no_capture_loaded", locale = code); + assert_ne!(s, "app.no_capture_loaded", "locale {code} not loaded"); + } + assert_eq!(t!("app.title", locale = "en"), "DSO3D12 Viewer"); + assert_ne!( + t!("app.no_capture_loaded", locale = "ru"), + t!("app.no_capture_loaded", locale = "en") + ); + } +} diff --git a/gui/src/logging.rs b/gui/src/logging.rs index 9815c98..786d5ca 100644 --- a/gui/src/logging.rs +++ b/gui/src/logging.rs @@ -41,18 +41,18 @@ impl log::Log for FileLogger { if record.level() <= self.stderr_level { eprint!("{line}"); } - if let Ok(mut guard) = self.file.lock() { - if let Some(f) = guard.as_mut() { - let _ = f.write_all(line.as_bytes()); - } + if let Ok(mut guard) = self.file.lock() + && let Some(f) = guard.as_mut() + { + let _ = f.write_all(line.as_bytes()); } } fn flush(&self) { - if let Ok(mut g) = self.file.lock() { - if let Some(f) = g.as_mut() { - let _ = f.flush(); - } + if let Ok(mut g) = self.file.lock() + && let Some(f) = g.as_mut() + { + let _ = f.flush(); } } } @@ -87,11 +87,11 @@ pub fn init() { fn rotate_if_needed(path: &PathBuf) { const MAX_BYTES: u64 = 1_000_000; - if let Ok(meta) = std::fs::metadata(path) { - if meta.len() > MAX_BYTES { - let backup = path.with_extension("log.1"); - let _ = std::fs::rename(path, backup); - } + if let Ok(meta) = std::fs::metadata(path) + && meta.len() > MAX_BYTES + { + let backup = path.with_extension("log.1"); + let _ = std::fs::rename(path, backup); } } diff --git a/gui/src/plot.rs b/gui/src/plot.rs index 1019cb5..77e5890 100644 --- a/gui/src/plot.rs +++ b/gui/src/plot.rs @@ -70,7 +70,7 @@ pub fn column_spans(samples: &[u8], columns: usize) -> Vec { /// Used by dot mode: in a column holding many samples, dots with the same /// value land on the same pixel, so drawing each distinct value once shows /// exactly the same picture with far fewer shapes. -pub fn distinct_values(samples: &[u8]) -> impl Iterator { +pub fn distinct_values(samples: &[u8]) -> impl Iterator + use<> { let mut seen = [false; 256]; for &v in samples { seen[v as usize] = true;