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
pub mod brush;
pub mod grids;
pub mod texturessettings;

/// Tools and settings where <i>user interface</i> requests user's
/// inputs
pub mod setter;

use crate::utils::FullPixel;

const MAX_SIZE: usize = 16;

/// Possible content for a cell
#[derive(Clone, Copy)]
pub enum Pixel {
  Empty,
  Full(FullPixel),
}

/// Grid types
#[derive(Hash, Eq, PartialEq, Debug, Clone, Copy)]
pub enum Grid {
  Generation,
}

/// Workspace tools: grids management
#[derive(Clone, Copy, Eq, PartialEq)]
pub enum WorkspaceTool {
  AddGrid([char; MAX_SIZE]),
  RenameGrid([char; MAX_SIZE]),
  DeleteGrid,
  SwitchGrid(usize),
}

/// Grid tools: grid cleaner and grid size incrementors and decrementors
#[derive(Clone, Copy, Eq, PartialEq)]
pub enum GridTool {
  ClearGrid,
  HeightDecrementor,
  HeightIncrementor,
  WidthDecrementor,
  WidthIncrementor,
}

/// Grid cells' content setters
#[derive(Clone, Copy, Eq, PartialEq)]
pub enum CellTool {
  PixelBrush(FullPixel, u16, u16),
  PixelEraser(u16, u16),
}

/// Tool types
#[derive(Clone, Copy, Eq, PartialEq)]
pub enum Tool {
  WorkspaceSetter(WorkspaceTool),
  GridSetter(GridTool),
  CellSetter(CellTool),
}