dais_core/commands.rs
1/// Every user action in Dais is represented as a discrete typed command.
2///
3/// Commands are dispatched through the [`CommandBus`](crate::bus::CommandBus) and processed
4/// by the presentation engine. The UI never mutates state directly — all mutations flow
5/// through commands.
6///
7/// This design enables future external control surfaces (REST API, WebSocket, mobile remote)
8/// to be added as new command sources without modifying the engine.
9#[derive(Debug, Clone, PartialEq)]
10pub enum Command {
11 // -- Navigation --
12 /// Advance to the first page of the next logical slide group.
13 NextSlide,
14 /// Go back to the first page of the previous logical slide group.
15 PreviousSlide,
16 /// Advance one PDF page (next overlay/build step within a group).
17 NextOverlay,
18 /// Go back one PDF page (previous overlay/build step).
19 PreviousOverlay,
20 /// Jump to the first slide.
21 FirstSlide,
22 /// Jump to the last slide.
23 LastSlide,
24 /// Jump to a specific logical slide by index (0-based).
25 GoToSlide(usize),
26
27 // -- Display modes --
28 /// Freeze/unfreeze the audience display.
29 ToggleFreeze,
30 /// Black out/restore the audience display.
31 ToggleBlackout,
32 /// Toggle the whiteboard (blank white drawing canvas on audience).
33 ToggleWhiteboard,
34 /// Toggle screen-share mode (audience window as normal window).
35 ToggleScreenShareMode,
36 /// Toggle presentation mode (single-monitor: console ↔ fullscreen HUD).
37 TogglePresentationMode,
38
39 // -- Presentation aids --
40 /// Toggle the laser pointer on/off.
41 ToggleLaser,
42 /// Cycle the laser pointer visual style.
43 CycleLaserStyle,
44 /// Update the pointer position (normalized 0..1 coordinates relative to slide).
45 SetPointerPosition(f32, f32),
46 /// Toggle freehand ink drawing mode.
47 ToggleInk,
48 /// Add a point to the current ink stroke (normalized coordinates).
49 AddInkPoint(f32, f32),
50 /// Finish the current ink stroke (pen lifted).
51 FinishInkStroke,
52 /// Clear all ink on the current page.
53 ClearInk,
54 /// Set the active pen color (RGBA). Affects only future strokes.
55 SetInkColor([u8; 4]),
56 /// Set the active pen width in logical pixels. Affects only future strokes.
57 SetInkWidth(f32),
58 /// Cycle the active pen color through the built-in preset list.
59 CycleInkColor,
60 /// Cycle the active pen width through the built-in preset list.
61 CycleInkWidth,
62 /// Toggle the spotlight overlay.
63 ToggleSpotlight,
64 /// Update the spotlight center position (normalized coordinates).
65 SetSpotlightPosition(f32, f32),
66 /// Toggle zoom mode on the audience display.
67 ToggleZoom,
68 /// Set the zoom region center and magnification factor.
69 SetZoomRegion { center: (f32, f32), factor: f32 },
70
71 // -- Timer --
72 /// Start the timer (or resume if paused).
73 StartTimer,
74 /// Pause the timer.
75 PauseTimer,
76 /// Toggle the timer between running and paused.
77 ToggleTimer,
78 /// Reset the timer to its initial state.
79 ResetTimer,
80
81 // -- UI panels --
82 /// Toggle the slide overview grid.
83 ToggleSlideOverview,
84 /// Toggle the notes panel visibility.
85 ToggleNotesPanel,
86 /// Toggle inline markdown editing for the current slide's notes.
87 ToggleNotesEdit,
88 /// Replace the current slide's notes markdown.
89 SetCurrentSlideNotes(String),
90 /// Increase notes font size by one step.
91 IncrementNotesFontSize,
92 /// Decrease notes font size by one step.
93 DecrementNotesFontSize,
94
95 // -- Text boxes --
96 /// Toggle text box placement mode.
97 ToggleTextBoxMode,
98 /// Place a new text box on the current slide (normalized coordinates).
99 PlaceTextBox { x: f32, y: f32, w: f32, h: f32 },
100 /// Update the content of a text box.
101 EditTextBoxContent { id: u64, content: String },
102 /// Move a text box to a new position (normalized coordinates).
103 MoveTextBox { id: u64, x: f32, y: f32 },
104 /// Resize a text box (normalized size).
105 ResizeTextBox { id: u64, w: f32, h: f32 },
106 /// Delete a text box by ID.
107 DeleteTextBox { id: u64 },
108 /// Select a text box by ID.
109 SelectTextBox(u64),
110 /// Deselect the currently selected text box.
111 DeselectTextBox,
112 /// Enter inline edit mode for the selected text box.
113 BeginTextBoxEdit { id: u64 },
114 /// Set the font size of a text box.
115 SetTextBoxFontSize { id: u64, size: f32 },
116 /// Set the text color of a text box (RGBA).
117 SetTextBoxColor { id: u64, color: [u8; 4] },
118 /// Set the background fill of a text box (RGBA, or None to clear).
119 SetTextBoxBackground { id: u64, color: Option<[u8; 4]> },
120
121 // -- System --
122 /// Quit the application.
123 Quit,
124 /// Save the current sidecar data to disk.
125 SaveSidecar,
126}