Mercurial > 510Connectbot
comparison src/com/five_ten_sg/connectbot/transport/TN5250.java @ 84:8f23b05a51f7
convert ctrl keys to virtual keys; use proper android home directory
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Mon, 16 Jun 2014 11:25:37 -0700 |
parents | 7ae9b0c382ec |
children | 1bc2229562f8 |
comparison
equal
deleted
inserted
replaced
83:4ccfde0bc506 | 84:8f23b05a51f7 |
---|---|
68 hostmask = Pattern.compile("^([0-9a-z.-]+)(:(\\d+))?$", Pattern.CASE_INSENSITIVE); | 68 hostmask = Pattern.compile("^([0-9a-z.-]+)(:(\\d+))?$", Pattern.CASE_INSENSITIVE); |
69 } | 69 } |
70 | 70 |
71 | 71 |
72 class vt320x5250 extends vt320 { | 72 class vt320x5250 extends vt320 { |
73 private HashMap<Integer, Integer> controls; | |
73 private HashMap<Integer, String> mnemonics; | 74 private HashMap<Integer, String> mnemonics; |
74 | 75 |
75 public vt320x5250() { | 76 public vt320x5250() { |
76 this(80,24); | 77 this(80,24); |
77 } | 78 } |
78 | 79 |
79 public vt320x5250(int width, int height) { | 80 public vt320x5250(int width, int height) { |
80 super(width, height); | 81 super(width, height); |
82 controls = new HashMap<Integer, Integer>(); | |
83 controls.put(0x08, KEY_BACK_SPACE); | |
84 controls.put(0x09, KEY_TAB); | |
85 controls.put(0x0d, KEY_ENTER); | |
86 controls.put(0x1b, KEY_ESCAPE); | |
87 | |
81 mnemonics = new HashMap<Integer, String>(); | 88 mnemonics = new HashMap<Integer, String>(); |
82 mnemonics.put(KEY_PAUSE , "[attn]"); | 89 mnemonics.put(KEY_PAUSE , "[attn]"); |
83 mnemonics.put(KEY_F1 , "[pf1]"); | 90 mnemonics.put(KEY_F1 , "[pf1]"); |
84 mnemonics.put(KEY_F2 , "[pf2]"); | 91 mnemonics.put(KEY_F2 , "[pf2]"); |
85 mnemonics.put(KEY_F3 , "[pf3]"); | 92 mnemonics.put(KEY_F3 , "[pf3]"); |
142 if (bridge.monitor != null) bridge.monitor.hostData(b); | 149 if (bridge.monitor != null) bridge.monitor.hostData(b); |
143 screen52.sendKeys(new String(b)); | 150 screen52.sendKeys(new String(b)); |
144 } | 151 } |
145 @Override | 152 @Override |
146 public void write(int b) { | 153 public void write(int b) { |
147 if (bridge.monitor != null) bridge.monitor.hostData(b); | 154 if (controls.containsKey(b)) { |
148 screen52.sendKeys(new String(new byte[] {(byte)b})); | 155 keyPressed(controls.get(b), ' ', 0); |
156 } | |
157 else { | |
158 if (bridge.monitor != null) bridge.monitor.hostData(b); | |
159 screen52.sendKeys(new String(new byte[] {(byte)b})); | |
160 } | |
149 } | 161 } |
150 @Override | 162 @Override |
151 public void keyPressed(int keyCode, char keyChar, int modifiers) { | 163 public void keyPressed(int keyCode, char keyChar, int modifiers) { |
152 if (mnemonics.containsKey(keyCode)) { | 164 if (mnemonics.containsKey(keyCode)) { |
153 String s = mnemonics.get(keyCode); | 165 String s = mnemonics.get(keyCode); |