1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
//! **The ball pane between frames** (bl-d2af): open or not, what each channel
//! last said its board and its bindings are, and what the aimed workspace last said
//! it holds.
//!
//! # It is the queue's shape and the tuning pane's, at once
//!
//! Two of its four reads name no workspace — `balls` and `board` — so their
//! subject is every channel this box holds and each answer replaces its own
//! channel's section (`super::queue`'s rule, and the roster's before it). Two
//! name one — `workspace-balls` and `marks` — so their subject is the aimed
//! workspace, and they are retired when the aim moves exactly as the roles are
//! (`super::tuning`).
//!
//! **The PANE is the channel-wide one, and only its workspace half is retired.** A
//! pane about every channel's board does not stop being about them because the
//! operator aimed somewhere else; what would be wrong is painting one workspace's
//! balls under another workspace's name, and that is the answers, not the pane. So
//! [`Model::aim_at`](super::Model) drops the two workspace answers and leaves the
//! pane standing — which is the same rule the tuning pane keeps, read on a
//! pane whose subject is wider than its aimed section.
//!
//! # Its acts are a module of their own
//!
//! [`acts`] holds the five (bl-f7ae) — opening the block, closing it, and the
//! one door that sends — and [`block`] holds the value they are about. This
//! file is what the reads last said; those two are what the operator would do
//! about it.
//!
//! # All four reads STAND, on the trail's terms
//!
//! A board is what is happening: a drone starts, a ball is claimed, a loop
//! ticks, and every one of those changes the pane under an operator who is
//! looking at it. So the set is keyed on the pane (`crate::state::Open::Board`)
//! and asked only while somebody is looking — the trail's reasoning
//! (`super::trail`), one noun over.
/// The pane's five acts: what the model does with each, and where it sends it.
pub mod acts;
/// The block a ball's text is authored in, and the gestures it composes.
pub mod block;
use super::{Lookup, Model};
use crate::reply::balls::BallRow;
use crate::ui::Channel;
/// **One channel's board** — its columns and its loops, and the channel they
/// came down as the client's own stamp.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Columns {
pub channel: Channel,
pub board: crate::reply::board::Board,
}
/// **One channel's binding table**, stamped the same way.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Bindings {
pub channel: Channel,
pub rows: Vec<BallRow>,
}
impl Model {
/// **Open the ball pane.** It takes no subject: two of its four reads name
/// no workspace, so *what is on the board* is answerable from an unaimed
/// seat — and that is the seat most likely to be asking it. An aim only
/// adds the workspace's own half.
pub fn begin_board(&mut self) {
self.lookup = Some(Lookup::Board);
}
/// **Whether the ball pane is the one standing.**
pub fn boarding(&self) -> bool {
self.lookup == Some(Lookup::Board)
}
/// File one channel's board, on [`Model::asking`](super::Model)'s terms:
/// this channel's section is replaced and every other stands.
pub(super) fn columned(&mut self, channel: &Channel, board: crate::reply::board::Board) {
let answered = Columns {
channel: channel.clone(),
board,
};
match self
.columns
.iter_mut()
.find(|held| held.channel.name == channel.name)
{
Some(held) => *held = answered,
None => self.columns.push(answered),
}
}
/// File one channel's binding table, on the same terms.
pub(super) fn bound(&mut self, channel: &Channel, rows: Vec<BallRow>) {
let answered = Bindings {
channel: channel.clone(),
rows,
};
match self
.bindings
.iter_mut()
.find(|held| held.channel.name == channel.name)
{
Some(held) => *held = answered,
None => self.bindings.push(answered),
}
}
/// **The aimed workspace's two answers go with the workspace they are about**, and
/// the authoring block with them (bl-f7ae) — it is opened on one workspace's
/// ball and stamps that workspace's own name, so a block left standing over a
/// new aim would offer to amend a ball under a claimant nobody is.
/// called by the act that moves the aim. `None` is a workspace nobody has asked
/// yet, and the old workspace's answer is not this workspace's — the reading
/// `Model::roles` gets, for the same reason.
pub(super) fn retire_workspace_balls(&mut self) {
self.holding = None;
self.marks = None;
self.authoring = None;
}
}
#[cfg(test)]
mod tests;