-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathMacro.java
More file actions
146 lines (111 loc) · 3.01 KB
/
Macro.java
File metadata and controls
146 lines (111 loc) · 3.01 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
package com.mattsmeets.macrokey.model;
import com.mattsmeets.macrokey.model.command.CommandInterface;
import com.mattsmeets.macrokey.model.command.StringCommand;
import java.util.UUID;
/**
* Model for Macro's (Bindings)
*/
public class Macro implements MacroInterface {
/**
* Unique Macro Identifier
*/
private UUID umid;
// 0 = keyboard, 1 = mouse
private int interfaceType = 0;
// 0 = no modifier
private int modifier = 0;
/**
* Key code of the button that is bound
*/
private int keyCode;
/**
* Hold key to repeat command
*/
private boolean repeat;
/**
* Command in string form
*/
private CommandInterface command;
/**
* If the macro is active (default: true)
*/
private boolean active;
public Macro(UUID umid, int keyCode, CommandInterface command, boolean active, boolean repeat) {
this.umid = umid;
this.keyCode = keyCode;
this.command = command;
this.active = active;
this.interfaceType = 0;
this.modifier = 0;
this.repeat = repeat;
}
public Macro(UUID umid, int keyCode, CommandInterface command, int interfaceType, int modifier, boolean active, boolean repeat) {
this.umid = umid;
this.keyCode = keyCode;
this.command = command;
this.active = active;
this.interfaceType = interfaceType;
this.modifier = modifier;
this.repeat = repeat;
}
private Macro(int keyCode, CommandInterface command, boolean active) {
this(UUID.randomUUID(), keyCode, command, active, false);
}
public Macro(int keyCode, String command, boolean active) {
this(keyCode, new StringCommand(command), active);
}
public Macro() {
this.umid = UUID.randomUUID();
this.active = true;
this.repeat = false;
}
public UUID getUMID() {
return umid;
}
public int getKeyCode() {
return keyCode;
}
public Macro setKeyCode(int keyCode) {
this.keyCode = keyCode;
return this;
}
public CommandInterface getCommand() {
return command;
}
public Macro setCommand(CommandInterface command) {
this.command = command;
return this;
}
public boolean isActive() {
return active;
}
public Macro setActive(boolean active) {
this.active = active;
return this;
}
public boolean willRepeat() {
return repeat;
}
public Macro setRepeat(boolean repeat) {
this.repeat = repeat;
return this;
}
@Override
public Macro setInterfaceType(int interfaceType) {
this.interfaceType = interfaceType;
return this;
}
@Override
public int getInterfaceType() {
return this.interfaceType;
}
@Override
public Macro setModifier(int modifier) {
this.modifier = modifier;
return this;
}
@Override
public int getModifier() {
return this.modifier;
}
}