1use crate::attrs::dropdowns::direct_dropdown::FromDirectDropdownString;
2
3#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
4pub enum GreaterThan {
5 Loudness,
6 Timer,
7}
8
9#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
10pub enum ForwardBackward {
11 Forward,
12 Backward,
13}
14
15#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
16pub enum SensingDragmode {
17 Draggable,
18 NotDraggable,
19}
20
21#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone)]
22pub enum SensingOfProperty {
23 Volume,
24 Timer,
25 Other(svalue::ARc<str>),
26}
27
28#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
29pub enum LooksEffect {
30 Color,
31 Fisheye,
32 Whirl,
33 Pixelate,
34 Mosaic,
35 Brightness,
36 Ghost,
37}
38
39#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
40pub enum SoundEffect {
41 Pitch,
42}
43
44#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
45pub enum LooksTargetNumbername {
46 Name,
47 Number,
48}
49
50#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
51pub enum LooksGotoFrontBack {
52 Front,
53 Back,
54}
55
56#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
57pub enum MotionRotationstyle {
58 DontRotate,
59 LeftRight,
60 AllAround,
61}
62impl FromDirectDropdownString for LooksGotoFrontBack {
63 const VALID_HINT: &'static str = "either 'front' or 'back'";
64 fn from_direct_dropdown_string(val: &str) -> Option<Self> {
65 Some(match val {
66 "front" => Self::Front,
67 "back" => Self::Back,
68 _ => return None,
69 })
70 }
71}
72impl FromDirectDropdownString for ForwardBackward {
73 const VALID_HINT: &'static str = "either 'forward' or 'backward'";
74 fn from_direct_dropdown_string(val: &str) -> Option<Self> {
75 Some(match val {
76 "forward" => Self::Forward,
77 "backward" => Self::Backward,
78 _ => return None,
79 })
80 }
81}
82
83impl FromDirectDropdownString for MotionRotationstyle {
84 const VALID_HINT: &'static str = "";
85 fn from_direct_dropdown_string(val: &str) -> Option<Self> {
86 Some(match val {
87 "left-right" => Self::LeftRight,
88 "don't rotate" => Self::DontRotate,
89 "all around" => Self::AllAround,
90 _ => return None,
91 })
92 }
93}
94
95impl FromDirectDropdownString for LooksTargetNumbername {
96 const VALID_HINT: &'static str = "either 'name' or 'number'";
97 fn from_direct_dropdown_string(val: &str) -> Option<Self> {
98 Some(match val {
99 "name" => Self::Name,
100 "number" => Self::Number,
101 _ => return None,
102 })
103 }
104}
105
106#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
107pub enum SensingCurrent {
108 Month,
109 Year,
110 Date,
111 Hour,
112 Minute,
113 Second,
114 DayOfWeek,
115}
116
117#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
118pub enum OperatorMathop {
119 TenRaisedTo,
120 Cos,
121 Sin,
122 Exp,
123 Abs,
124 ArcusCos,
125 Tan,
126 Ln,
127 Sqrt,
128 ArcusSin,
129 ArcusTan,
130 Floor,
131 Ceiling,
132 Log,
133}
134impl FromDirectDropdownString for OperatorMathop {
135 const VALID_HINT: &'static str = "'e ^', 'abs', '10 ^', 'ceiling', 'floor', ...";
136 fn from_direct_dropdown_string(val: &str) -> Option<Self> {
137 Some(match val {
138 "e ^" => Self::Exp,
139 "abs" => Self::Abs,
140 "10 ^" => Self::TenRaisedTo,
141 "acos" => Self::ArcusCos,
142 "asin" => Self::ArcusSin,
143 "atan" => Self::ArcusTan,
144 "cos" => Self::Cos,
145 "sin" => Self::Sin,
146 "tan" => Self::Tan,
147 "sqrt" => Self::Sqrt,
148 "floor" => Self::Floor,
149 "ceiling" => Self::Ceiling,
150 "log" => Self::Log,
151 "ln" => Self::Ln,
152 _ => return None,
153 })
154 }
155}
156
157impl FromDirectDropdownString for SensingCurrent {
158 const VALID_HINT: &'static str = "'MONTH', 'YEAR', 'DAYOFWEEK', ...";
159 fn from_direct_dropdown_string(val: &str) -> Option<Self> {
160 Some(match val {
161 "MONTH" => Self::Month,
162 "YEAR" => Self::Year,
163 "DATE" => Self::Date,
164 "DAYOFWEEK" => Self::DayOfWeek,
165 "HOUR" => Self::Hour,
166 "MINUTE" => Self::Minute,
167 "SECOND" => Self::Second,
168 _ => return None,
169 })
170 }
171}
172
173impl FromDirectDropdownString for SensingDragmode {
174 const VALID_HINT: &'static str = "either 'not draggable' or 'draggable'";
175 fn from_direct_dropdown_string(val: &str) -> Option<Self> {
176 Some(match val {
177 "not draggable" => Self::NotDraggable,
178 "draggable" => Self::Draggable,
179 _ => return None,
180 })
181 }
182}
183
184impl FromDirectDropdownString for GreaterThan {
185 const VALID_HINT: &'static str = "either 'LOUDNESS' or 'TIMER'";
186 fn from_direct_dropdown_string(val: &str) -> Option<Self> {
187 Some(match val {
188 "LOUDNESS" => GreaterThan::Loudness,
189 "TIMER" => GreaterThan::Timer,
190 _ => return None,
191 })
192 }
193}
194impl FromDirectDropdownString for SoundEffect {
195 const VALID_HINT: &'static str = "'PITCH', ...";
196 fn from_direct_dropdown_string(val: &str) -> Option<Self> {
197 Some(match val {
198 "PITCH" => Self::Pitch,
199 _ => return None,
200 })
201 }
202}
203impl FromDirectDropdownString for LooksEffect {
204 const VALID_HINT: &'static str = "'COLOR', 'FISHEYE', ...";
205 fn from_direct_dropdown_string(val: &str) -> Option<Self> {
206 Some(match val {
207 "COLOR" => Self::Color,
208 "FISHEYE" => Self::Fisheye,
209 "WHIRL" => Self::Whirl,
210 "BRIGHTNESS" => Self::Brightness,
211 "GHOST" => Self::Ghost,
212 "PIXELATE" => Self::Pixelate,
213 "MOSAIC" => Self::Mosaic,
214 _ => return None,
215 })
216 }
217}
218impl FromDirectDropdownString for SensingOfProperty {
219 const VALID_HINT: &'static str =
220 "'volume' or 'timer' for one manifestation, multiple values for other";
221 fn from_direct_dropdown_string(val: &str) -> Option<Self> {
222 Some(match val {
223 "volume" => Self::Volume,
224 "timer" => Self::Timer,
225 val => Self::Other(val.into()),
226 })
227 }
228}