source: other-projects/GlamED/trunk/src/org/honours/gui/KeyboardActions.java@ 26757

Last change on this file since 26757 was 26757, checked in by davidb, 11 years ago

Fixed bug with Audience Mode not working in GlamED. Need to check if the current frame displayed is a collection item frame. If not then just run Audience Mode as per normal, otherwise need to hide any visible overlays such as the toolbar and "view/hide toolbar" button.

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