The drawing of the chooser's rules: the network that runs, drawn by rete-draw. Shared by the test that
holds the checked-in picture to it and by the example that writes the picture.
4#![allow(dead_code)]
6use rete::Then; 7use rete_draw::Legend; 8use whiskers_chooser::{ChooserDomain, Effect, Fact, Note, Step, network}; 9 10fn words(then: Then<ChooserDomain>) -> String { 11 match then { 12 Then::Do(Effect::Enter) => "open the chooser".to_owned(), 13 Then::Do(Effect::StepCharacter(Step::Next)) => "show the next character".to_owned(), 14 Then::Do(Effect::StepCharacter(Step::Previous)) => "show the previous character".to_owned(), 15 Then::Do(Effect::StepVoice(Step::Next)) => "show the next voice".to_owned(), 16 Then::Do(Effect::StepVoice(Step::Previous)) => "show the previous voice".to_owned(), 17 Then::Do(Effect::SayHi) => "say hi in its saved voice".to_owned(), 18 Then::Do(Effect::SayVoice) => "say the voice's name in it".to_owned(), 19 Then::Do(Effect::Save) => "save this character and voice".to_owned(), 20 Then::Do(Effect::Discard) => "put back what was saved".to_owned(), 21 Then::Do(Effect::Leave) => "close the chooser".to_owned(), 22 Then::Note(Note::NotOpen) => "ignore: not open".to_owned(), 23 Then::Note(Note::AlreadyOpen) => "ignore: open already".to_owned(), 24 Then::Note(Note::NoVoices) => "ignore: no voices listed".to_owned(), 25 Then::End(end) => match end {}, 26 } 27} 28 29fn legend() -> Legend<ChooserDomain> { 30 Legend { 31 frames: vec![ 32 ("the shell · one ask".to_owned(), vec![Fact::Input, Fact::Editing, Fact::Unsaved, Fact::Voices]), 33 ("an effect, once done".to_owned(), vec![Fact::Entered, Fact::CharacterMoved, Fact::VoiceMoved, Fact::Said, Fact::Saved, Fact::Discarded, Fact::Closed]), 34 ], 35 then: words, 36 } 37} 38 39const STYLE: &str = "svg { background: #fefefe; font: 11px monospace; }\n\ 40rect, circle { fill: #fefefe; stroke: #1e1e1e; stroke-width: 1; }\n\ 41text { fill: #1e1e1e; }\n\ 42line, path { stroke: #1e1e1e; stroke-width: 1; fill: none; opacity: 0.3; }\n\ 43polygon { fill: #1e1e1e; opacity: 0.3; }\n\ 44.frame rect { fill: none; stroke-dasharray: 1 3; }\n\ 45.frame text { opacity: 0.7; }\n";