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
use super::*;
use super::super::tools::*;
use animation::*;
use std::sync::*;
pub struct SelectionTools<Anim: 'static+Animation> {
select: Arc<FloTool<Anim>>,
adjust: Arc<FloTool<Anim>>,
pan: Arc<FloTool<Anim>>
}
pub struct PaintTools<Anim: 'static+Animation> {
pencil: Arc<FloTool<Anim>>,
ink: Arc<FloTool<Anim>>,
eraser: Arc<FloTool<Anim>>
}
impl<Anim: Animation> SelectionTools<Anim> {
pub fn new() -> SelectionTools<Anim> {
SelectionTools {
select: Select::new().to_flo_tool(),
adjust: Adjust::new().to_flo_tool(),
pan: Pan::new().to_flo_tool()
}
}
}
impl<Anim: Animation> PaintTools<Anim> {
pub fn new() -> PaintTools<Anim> {
PaintTools {
pencil: Pencil::new().to_flo_tool(),
ink: Ink::new().to_flo_tool(),
eraser: Eraser::new().to_flo_tool()
}
}
}
impl<Anim: Animation> ToolSet<Anim> for SelectionTools<Anim> {
fn set_name(&self) -> String { "Selection".to_string() }
fn tools(&self) -> Vec<Arc<FloTool<Anim>>> {
vec![
Arc::clone(&self.select),
Arc::clone(&self.adjust),
Arc::clone(&self.pan)
]
}
}
impl<Anim: Animation> ToolSet<Anim> for PaintTools<Anim> {
fn set_name(&self) -> String { "Paint".to_string() }
fn tools(&self) -> Vec<Arc<FloTool<Anim>>> {
vec![
Arc::clone(&self.pencil),
Arc::clone(&self.ink),
Arc::clone(&self.eraser)
]
}
}