This commit is contained in:
@@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
|
||||
import com.melloware.jintellitype.JIntellitype;
|
||||
|
||||
import pm.application.windows.Key;
|
||||
import pm.macro.event.Press;
|
||||
|
||||
public class Hotkey extends Press {
|
||||
@@ -13,23 +14,27 @@ public class Hotkey extends Press {
|
||||
public Hotkey(int modifier, int keycode) {
|
||||
super(null); // Todo: nettere oplossing zoeken / controleren op null
|
||||
int id = hotkeyList.size();
|
||||
button = new HotkeyButton(id);
|
||||
button = new Modifier(id);
|
||||
jit.registerHotKey(id, modifier, keycode);
|
||||
hotkeyList.add(this);
|
||||
}
|
||||
|
||||
public Hotkey(int modifier, char key) {
|
||||
this(modifier, (int) Character.toUpperCase(key));
|
||||
public Hotkey(int modifier, char character) {
|
||||
this(modifier, (int) Character.toUpperCase(character));
|
||||
}
|
||||
|
||||
public Hotkey(char key) {
|
||||
this(0, (int) Character.toUpperCase(key));
|
||||
public Hotkey(char character) {
|
||||
this(0, (int) Character.toUpperCase(character));
|
||||
}
|
||||
|
||||
public Hotkey(int keycode) {
|
||||
this(0, keycode);
|
||||
}
|
||||
|
||||
public Hotkey(Key key) {
|
||||
this(key.getCode());
|
||||
}
|
||||
|
||||
public static void initialise(ArrayList<Hotkey> actionList, JIntellitype jit) {
|
||||
Hotkey.hotkeyList = actionList;
|
||||
Hotkey.jit = jit;
|
||||
|
||||
@@ -10,6 +10,7 @@ import pm.Action;
|
||||
import pm.Device;
|
||||
import pm.Target;
|
||||
import pm.Task;
|
||||
import pm.application.windows.Key;
|
||||
import pm.exception.EventException;
|
||||
import pm.exception.device.DeviceInitialiseException;
|
||||
import pm.macro.event.Press;
|
||||
@@ -30,17 +31,23 @@ public class JIntellitypeDevice extends Device implements HotkeyListener, Intell
|
||||
jit.addHotKeyListener(this);
|
||||
jit.addIntellitypeListener(this);
|
||||
add(
|
||||
new Hotkey(HotkeyButton.CTRL | HotkeyButton.WIN, 'q'),
|
||||
new Hotkey(Key.PRIOR),
|
||||
new Task(Action.PREVIOUS, Target.MAIN));
|
||||
add(
|
||||
new Hotkey(Key.NEXT),
|
||||
new Task(Action.NEXT, Target.MAIN));
|
||||
add(
|
||||
new Hotkey(Modifier.CTRL | Modifier.WIN, 'q'),
|
||||
new Task(Action.PLAY, Target.APPLICATIONS));
|
||||
add(
|
||||
new Hotkey(HotkeyButton.CTRL | HotkeyButton.WIN, 'x'),
|
||||
new Hotkey(Modifier.CTRL | Modifier.WIN, 'x'),
|
||||
new Task(Action.EXIT, Target.MAIN));
|
||||
add(
|
||||
new Hotkey(HotkeyButton.CTRL | HotkeyButton.WIN, 't'),
|
||||
new Hotkey(Modifier.CTRL | Modifier.WIN, 't'),
|
||||
new Task(Action.TEST, Target.MAIN));
|
||||
add(
|
||||
new Hotkey(HotkeyButton.CTRL | HotkeyButton.WIN, 'r'),
|
||||
new Hotkey(HotkeyButton.CTRL | HotkeyButton.WIN, 's'),
|
||||
new Hotkey(Modifier.CTRL | Modifier.WIN, 'r'),
|
||||
new Hotkey(Modifier.CTRL | Modifier.WIN, 's'),
|
||||
new Continuous(Action.REPEAT, Target.APPLICATIONS, 500));
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.melloware.jintellitype.JIntellitype;
|
||||
|
||||
import pm.Button;
|
||||
|
||||
public class HotkeyButton implements Button {
|
||||
public class Modifier implements Button {
|
||||
public static final int
|
||||
ALT = JIntellitype.MOD_ALT,
|
||||
CTRL = JIntellitype.MOD_CONTROL,
|
||||
@@ -13,7 +13,7 @@ public class HotkeyButton implements Button {
|
||||
|
||||
protected int code;
|
||||
|
||||
protected HotkeyButton(int code) {
|
||||
protected Modifier(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user