1
package org.herac.tuxguitar.gui.system.keybindings;
3
import org.herac.tuxguitar.gui.TuxGuitar;
4
import org.herac.tuxguitar.gui.actions.Action;
5
import org.herac.tuxguitar.gui.actions.caret.GoDownAction;
6
import org.herac.tuxguitar.gui.actions.caret.GoLeftAction;
7
import org.herac.tuxguitar.gui.actions.caret.GoRightAction;
8
import org.herac.tuxguitar.gui.actions.caret.GoUpAction;
9
import org.herac.tuxguitar.gui.actions.duration.DecrementDurationAction;
10
import org.herac.tuxguitar.gui.actions.duration.IncrementDurationAction;
11
import org.herac.tuxguitar.gui.actions.note.ChangeNoteAction;
12
import org.herac.tuxguitar.gui.actions.note.InsertNoteAction;
13
import org.herac.tuxguitar.gui.actions.note.RemoveNoteAction;
15
public class KeyBindingReserveds {
17
private static KeyBindingAction[] reserveds = new KeyBindingAction[]{
18
new KeyBindingAction(ChangeNoteAction.NAME,new KeyBinding(KeyBindingConstants.NUMBER_0,0)),
19
new KeyBindingAction(ChangeNoteAction.NAME,new KeyBinding(KeyBindingConstants.NUMBER_1,0)),
20
new KeyBindingAction(ChangeNoteAction.NAME,new KeyBinding(KeyBindingConstants.NUMBER_2,0)),
21
new KeyBindingAction(ChangeNoteAction.NAME,new KeyBinding(KeyBindingConstants.NUMBER_3,0)),
22
new KeyBindingAction(ChangeNoteAction.NAME,new KeyBinding(KeyBindingConstants.NUMBER_4,0)),
23
new KeyBindingAction(ChangeNoteAction.NAME,new KeyBinding(KeyBindingConstants.NUMBER_5,0)),
24
new KeyBindingAction(ChangeNoteAction.NAME,new KeyBinding(KeyBindingConstants.NUMBER_6,0)),
25
new KeyBindingAction(ChangeNoteAction.NAME,new KeyBinding(KeyBindingConstants.NUMBER_7,0)),
26
new KeyBindingAction(ChangeNoteAction.NAME,new KeyBinding(KeyBindingConstants.NUMBER_8,0)),
27
new KeyBindingAction(ChangeNoteAction.NAME,new KeyBinding(KeyBindingConstants.NUMBER_9,0)),
28
new KeyBindingAction(ChangeNoteAction.NAME,new KeyBinding(KeyBindingConstants.KEYPAD_0,0)),
29
new KeyBindingAction(ChangeNoteAction.NAME,new KeyBinding(KeyBindingConstants.KEYPAD_1,0)),
30
new KeyBindingAction(ChangeNoteAction.NAME,new KeyBinding(KeyBindingConstants.KEYPAD_2,0)),
31
new KeyBindingAction(ChangeNoteAction.NAME,new KeyBinding(KeyBindingConstants.KEYPAD_3,0)),
32
new KeyBindingAction(ChangeNoteAction.NAME,new KeyBinding(KeyBindingConstants.KEYPAD_4,0)),
33
new KeyBindingAction(ChangeNoteAction.NAME,new KeyBinding(KeyBindingConstants.KEYPAD_5,0)),
34
new KeyBindingAction(ChangeNoteAction.NAME,new KeyBinding(KeyBindingConstants.KEYPAD_6,0)),
35
new KeyBindingAction(ChangeNoteAction.NAME,new KeyBinding(KeyBindingConstants.KEYPAD_7,0)),
36
new KeyBindingAction(ChangeNoteAction.NAME,new KeyBinding(KeyBindingConstants.KEYPAD_8,0)),
37
new KeyBindingAction(ChangeNoteAction.NAME,new KeyBinding(KeyBindingConstants.KEYPAD_9,0)),
38
new KeyBindingAction(RemoveNoteAction.NAME,new KeyBinding(KeyBindingConstants.BACKSPACE,0)),
39
new KeyBindingAction(RemoveNoteAction.NAME,new KeyBinding(KeyBindingConstants.DELETE,0)),
40
new KeyBindingAction(InsertNoteAction.NAME,new KeyBinding(KeyBindingConstants.INSERT,0)),
41
new KeyBindingAction(IncrementDurationAction.NAME,new KeyBinding(16777259,0)),
42
new KeyBindingAction(DecrementDurationAction.NAME,new KeyBinding(16777261,0)),
43
new KeyBindingAction(GoUpAction.NAME,new KeyBinding(KeyBindingConstants.UP,0)),
44
new KeyBindingAction(GoDownAction.NAME,new KeyBinding(KeyBindingConstants.DOWN,0)),
45
new KeyBindingAction(GoLeftAction.NAME,new KeyBinding(KeyBindingConstants.LEFT,0)),
46
new KeyBindingAction(GoRightAction.NAME,new KeyBinding(KeyBindingConstants.RIGHT,0)),
49
public static boolean isReserved(KeyBinding kb){
50
for(int i = 0;i < reserveds.length;i++){
51
if(kb.isSameAs(reserveds[i].getKeyBinding())){
58
public static Action getActionForKeyBinding(KeyBinding kb){
59
for(int i = 0;i < reserveds.length;i++){
60
if(kb.isSameAs(reserveds[i].getKeyBinding())){
61
return TuxGuitar.instance().getAction(reserveds[i].getAction());
67
public static KeyBinding getKeyBindingForAction(String action){
68
for(int i = 0;i < reserveds.length;i++){
69
if(action.equals(reserveds[i].getAction())){
70
return reserveds[i].getKeyBinding();