Fixed a bug in Am2900; created dlatch8/80; relayouted some components
[Mograsim.git] / net.mograsim.logic.model.editor / src / net / mograsim / logic / model / editor / states / StateManager.java
1 package net.mograsim.logic.model.editor.states;
2
3 import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
4 import net.mograsim.logic.model.editor.Editor;
5 import net.mograsim.logic.model.editor.handles.Handle.HandleClickInfo;
6
7 public class StateManager
8 {
9         private EditorState state;
10
11         public StateManager(Editor session)
12         {
13                 state = new SelectionState(session, this);
14                 state.onEntry();
15         }
16
17         public EditorState getState()
18         {
19                 return state;
20         }
21
22         public void setState(EditorState state)
23         {
24                 this.state.onExit();
25                 this.state = state;
26                 state.onEntry();
27         }
28
29         public void add()
30         {
31                 state.add();
32         }
33
34         public void delete()
35         {
36                 state.delete();
37         }
38
39         public void copy()
40         {
41                 state.copy();
42         }
43
44         public void paste()
45         {
46                 state.paste();
47         }
48
49         public void duplicate()
50         {
51                 state.duplicate();
52         }
53
54         public void grab()
55         {
56                 state.grab();
57         }
58
59         public void mouseMoved(double x, double y)
60         {
61                 state.mouseMoved(x, y);
62         }
63
64         public void select(Point pos, boolean additive)
65         {
66                 state.select(pos, additive);
67         }
68
69         public boolean clickedHandle(HandleClickInfo handleClickInfo)
70         {
71                 return state.clickedHandle(handleClickInfo);
72         }
73
74         public void boxSelect()
75         {
76                 state.boxSelect();
77         }
78 }