1 | package org.honours.gui;
|
---|
2 |
|
---|
3 | import java.awt.event.KeyEvent;
|
---|
4 | import java.awt.event.KeyListener;
|
---|
5 |
|
---|
6 | import org.expeditee.gui.DisplayIO;
|
---|
7 | import org.expeditee.gui.Frame;
|
---|
8 | import org.expeditee.gui.FrameGraphics;
|
---|
9 | import org.expeditee.gui.FrameKeyboardActions;
|
---|
10 | import org.honours.actions.MiscActions;
|
---|
11 |
|
---|
12 | public class KeyboardActions implements KeyListener{
|
---|
13 |
|
---|
14 | private static KeyboardActions _instance = null;
|
---|
15 |
|
---|
16 | private KeyboardActions(){}
|
---|
17 |
|
---|
18 | public static KeyboardActions getInstance(){
|
---|
19 | if(_instance == null)
|
---|
20 | _instance = new KeyboardActions();
|
---|
21 |
|
---|
22 | return _instance;
|
---|
23 | }
|
---|
24 |
|
---|
25 | @Override
|
---|
26 | public void keyPressed(KeyEvent e) {
|
---|
27 |
|
---|
28 | int keyCode = e.getKeyCode();
|
---|
29 | //Frame currFrame = DisplayIO.getCurrentFrame();
|
---|
30 |
|
---|
31 | //TODO:Check if current frame is a "content-layer"
|
---|
32 |
|
---|
33 | //If F9 (Audience Mode button) has been pressed.
|
---|
34 | if(keyCode == KeyEvent.VK_F9){
|
---|
35 |
|
---|
36 | if(FrameGraphics.isAudienceMode()){
|
---|
37 | //turn off display of toolbar.
|
---|
38 | HonoursFrameIO.DISPLAY_TOOLBAR = false;
|
---|
39 | MiscActions.ToggleToolbar();
|
---|
40 |
|
---|
41 | //turn off display of toggle toolbar
|
---|
42 | HonoursFrameIO.DISPLAY_TOGGLER = false;
|
---|
43 | MiscActions.ToggleToggler();
|
---|
44 |
|
---|
45 | }else{
|
---|
46 | HonoursFrameIO.DISPLAY_TOOLBAR = true;
|
---|
47 | MiscActions.ToggleToolbar();
|
---|
48 |
|
---|
49 | HonoursFrameIO.DISPLAY_TOGGLER = true;
|
---|
50 | MiscActions.ToggleToggler();
|
---|
51 |
|
---|
52 | }
|
---|
53 | }
|
---|
54 |
|
---|
55 |
|
---|
56 | FrameKeyboardActions.getInstance().keyPressed(e);
|
---|
57 | }
|
---|
58 |
|
---|
59 | @Override
|
---|
60 | public void keyReleased(KeyEvent e) {
|
---|
61 | FrameKeyboardActions.getInstance().keyReleased(e);
|
---|
62 |
|
---|
63 | }
|
---|
64 |
|
---|
65 | @Override
|
---|
66 | public void keyTyped(KeyEvent e) {
|
---|
67 | FrameKeyboardActions.getInstance().keyTyped(e);
|
---|
68 | }
|
---|
69 |
|
---|
70 |
|
---|
71 | }
|
---|