summaryrefslogtreecommitdiff
path: root/anim/src/hexdump.zig
diff options
context:
space:
mode:
Diffstat (limited to 'anim/src/hexdump.zig')
-rw-r--r--anim/src/hexdump.zig33
1 files changed, 30 insertions, 3 deletions
diff --git a/anim/src/hexdump.zig b/anim/src/hexdump.zig
index 165f241..bd76150 100644
--- a/anim/src/hexdump.zig
+++ b/anim/src/hexdump.zig
@@ -64,9 +64,36 @@ pub const Of = struct {
region: u24 = theme.color.region.heap,
};
-/// The dump: `count` rows from `first`, at `x` (its panel's left edge
-/// is the band's middle), the rows from `y`. The rows of what the drawing
-/// draws have quiet brackets.
+/// The band's view of bytes: its own panel over the state column, the
+/// tag `its bytes` with the range shown (`about`) and the legend of runs.
+/// Returns its `Ui` (the panel's origin) and how many rows it holds.
+pub fn panel(f: *@import("sketch").Frame, placed: @import("anim").Placed, stage: *const @import("stage.zig").Stage, about: []const u8, legend: []const ui.Legend) View {
+ const box = stage.box(placed, .view);
+ const u = @import("context.zig").at(f, placed, box).faded(placed.value(stage.view));
+ if (box.h < m.tag + m.row) return .{ .u = u, .rows = 0, .box = box };
+ // Its own box, as it moves; the drawing's panel clips itself again after.
+ u.clip(.{ .x = 0, .y = 0, .w = box.w, .h = box.h });
+ _ = u.panel(box.w, box.h, "its bytes", .{ .legend = legend });
+ const tag = theme.size.sans.tag;
+ u.text(.sans, theme.size.sans.micro, 28 + u.width(.sans_medium, tag, "its bytes") + 12, m.tag - 6, about, t.faint);
+ return .{ .u = u, .rows = theme.layout.rowsIn(box.h), .box = box };
+}
+
+/// The view's panel as drawn: its `Ui`, how many rows it holds, its box.
+pub const View = struct {
+ u: ui.Ui,
+ rows: usize,
+ box: Rect,
+
+ /// What a sprint cannot show: veiled, over its rows.
+ pub fn veil(v: View, now: cursors.Now) void {
+ @import("context.zig").veiled(v.u, v.box, now.sprint_veil);
+ }
+};
+
+/// The dump: `count` rows from `first`, at `x` in `u` (the view's
+/// panel), the rows from `y`. The rows of what the drawing draws have
+/// quiet brackets.
pub fn draw(u: ui.Ui, now: cursors.Now, x: f32, y: f32, first: u64, count: usize, of: Of) void {
const v = u.moved(x, 0);
const moment = now.shown(.memory);