diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-28 12:57:47 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:14 -0300 |
| commit | 30c2c8a154e770b3920bcfd7d553825fe9182bf4 (patch) | |
| tree | ecdce274f1cb25095c72f4da62b7c35e23aee04c /src/config.zig | |
| parent | 8f31fc6bfaae2d29b2bb5cc2149fcd7033cd9724 (diff) | |
| download | pardes-30c2c8a154e770b3920bcfd7d553825fe9182bf4.tar.gz pardes-30c2c8a154e770b3920bcfd7d553825fe9182bf4.zip | |
Move the frame into draw.zig and the transitions out of layout.zig
Pure moves, no behaviour change. draw.zig holds the whole core frame in
order: render, the pane, tag, header and notice painters it calls, and the
character-effect composition (Pardes.render stays a declaration alias).
Presentation.zig is the panel presentation state as a file struct, and
animation.zig the easing curves, transition kinds, tracks and boxes, the
character effects' sources and the generic displayed-value transition, all
of which lived in layout.zig. layout.zig keeps only layout.
Diffstat (limited to 'src/config.zig')
| -rw-r--r-- | src/config.zig | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/config.zig b/src/config.zig index 6d0cf0a6..122c0e75 100644 --- a/src/config.zig +++ b/src/config.zig @@ -1,6 +1,7 @@ const std = @import("std"); const builtin = @import("builtin"); const layout = @import("layout.zig"); +const animation = @import("animation.zig"); const limits = @import("memory.zig").limits; const pardes = @import("pardes.zig"); const builtins = @import("builtins.zig"); @@ -609,10 +610,10 @@ pub const Runtime = struct { tagline_percent: u8 = 100, } = .{}, - panel_transition: layout.Transition = .off, - scene_effects: layout.SceneEffect = .{}, + panel_transition: animation.Transition = .off, + scene_effects: animation.SceneEffect = .{}, - pub fn toggleTransition(state: *Runtime, effect: layout.Transition) void { + pub fn toggleTransition(state: *Runtime, effect: animation.Transition) void { std.debug.assert(effect != .off); state.panel_transition = if (state.panel_transition == effect) .off else effect; } @@ -689,7 +690,7 @@ pub const Runtime = struct { pub const MessageTime = enum { linger, fall, dissolve }; pub const Toggle = enum { colors, wrap, tree_context_tag_style, tag_bottom, debug, focus_tint, column_tags, syntax_bold, verbose, message_animation, ligatures }; - pub const Scene = std.meta.FieldEnum(layout.SceneEffect); + pub const Scene = std.meta.FieldEnum(animation.SceneEffect); pub const Action = union(enum) { toggle: Toggle, @@ -701,7 +702,7 @@ pub const Runtime = struct { window_blur, message_ms: MessageTime, dump_dir, - transition: layout.Transition, + transition: animation.Transition, scene: Scene, }; @@ -806,7 +807,7 @@ pub const Runtime = struct { if (actionCount(.shell) != 1 or actionCount(.theme) != 1 or actionCount(.font) != 1 or actionCount(.tagline_size) != 1 or actionCount(.window_opacity) != 1 or actionCount(.window_blur) != 1) @compileError("Shell, Theme, Font, TaglineSize, WindowOpacity, and WindowBlur actions must each occur exactly once"); - for (std.enums.values(layout.Transition)) |effect| { + for (std.enums.values(animation.Transition)) |effect| { const expected: comptime_int = @intFromBool(effect != .off); if (actionCount(.{ .transition = effect }) != expected) @compileError("non-off panel transition must occur exactly once: " ++ @tagName(effect)); @@ -814,7 +815,7 @@ pub const Runtime = struct { for (std.enums.values(Scene)) |effect| { if (actionCount(.{ .scene = effect }) != 1) @compileError("scene effect must occur exactly once: " ++ @tagName(effect)); - if (@FieldType(layout.SceneEffect, @tagName(effect)) != bool) + if (@FieldType(animation.SceneEffect, @tagName(effect)) != bool) @compileError("scene effect fields must be booleans: " ++ @tagName(effect)); } } @@ -929,7 +930,7 @@ pub const Runtime = struct { return if (text.len == 0) "(none)" else text; } - fn transitionSettingName(transition: layout.Transition) []const u8 { + fn transitionSettingName(transition: animation.Transition) []const u8 { if (transition == .off) return "off"; return findAction(.{ .transition = transition }).?.word; } @@ -1080,13 +1081,13 @@ pub const Runtime = struct { const slide = findAction(.{ .transition = .slide }).?; const zoom = findAction(.{ .transition = .zoom }).?; try std.testing.expect(apply(&state, slide, "on")); - try std.testing.expectEqual(layout.Transition.slide, state.panel_transition); + try std.testing.expectEqual(animation.Transition.slide, state.panel_transition); try std.testing.expect(apply(&state, zoom, "off")); - try std.testing.expectEqual(layout.Transition.slide, state.panel_transition); + try std.testing.expectEqual(animation.Transition.slide, state.panel_transition); try std.testing.expect(apply(&state, slide, "on")); - try std.testing.expectEqual(layout.Transition.slide, state.panel_transition); + try std.testing.expectEqual(animation.Transition.slide, state.panel_transition); try std.testing.expect(apply(&state, slide, null)); - try std.testing.expectEqual(layout.Transition.off, state.panel_transition); + try std.testing.expectEqual(animation.Transition.off, state.panel_transition); try std.testing.expect(!apply(&state, slide, "yes")); const scene = findAction(.{ .scene = std.enums.values(Scene)[0] }).?; try std.testing.expect(apply(&state, scene, "on")); @@ -1126,9 +1127,9 @@ pub const Runtime = struct { try std.testing.expectEqualStrings("fish", state.shell.requested.get()); try std.testing.expect(state.shell.pending); try std.testing.expect(apply(&state, find("PanelAscii").?, null)); - try std.testing.expectEqual(layout.Transition.ascii, state.panel_transition); + try std.testing.expectEqual(animation.Transition.ascii, state.panel_transition); try std.testing.expect(apply(&state, find("PanelAscii").?, null)); - try std.testing.expectEqual(layout.Transition.off, state.panel_transition); + try std.testing.expectEqual(animation.Transition.off, state.panel_transition); try std.testing.expect(apply(&state, find("Crt").?, null)); try std.testing.expect(state.scene_effects.crt); } |
