comparison src/com/five_ten_sg/connectbot/transport/TN5250.java @ 52:0e3fc85d0586 tn5250

start tn5250 integration
author Carl Byington <carl@five-ten-sg.com>
date Wed, 11 Jun 2014 12:18:18 -0700
parents 8c6de858bb73
children e872762ec105
comparison
equal deleted inserted replaced
51:8c6de858bb73 52:0e3fc85d0586
151 return true; 151 return true;
152 } 152 }
153 else if (keyCode == KeyEvent.KEYCODE_SHIFT_RIGHT 153 else if (keyCode == KeyEvent.KEYCODE_SHIFT_RIGHT
154 && (metaState & META_TAB) != 0) { 154 && (metaState & META_TAB) != 0) {
155 metaState &= ~(META_TAB | META_TRANSIENT); 155 metaState &= ~(META_TAB | META_TRANSIENT);
156 buffer.write("[tab]"); 156 sendEncoded("[tab]");
157 return true; 157 return true;
158 } 158 }
159 } 159 }
160 else if (PreferenceConstants.KEYMODE_LEFT.equals(keymode)) { 160 else if (PreferenceConstants.KEYMODE_LEFT.equals(keymode)) {
161 if (keyCode == KeyEvent.KEYCODE_ALT_LEFT 161 if (keyCode == KeyEvent.KEYCODE_ALT_LEFT
165 return true; 165 return true;
166 } 166 }
167 else if (keyCode == KeyEvent.KEYCODE_SHIFT_LEFT 167 else if (keyCode == KeyEvent.KEYCODE_SHIFT_LEFT
168 && (metaState & META_TAB) != 0) { 168 && (metaState & META_TAB) != 0) {
169 metaState &= ~(META_TAB | META_TRANSIENT); 169 metaState &= ~(META_TAB | META_TRANSIENT);
170 buffer.write("[tab]"); 170 sendEncoded("[tab]");
171 return true; 171 return true;
172 } 172 }
173 } 173 }
174 174
175 return false; 175 return false;
268 return true; 268 return true;
269 269
270 if (uchar < 0x80) 270 if (uchar < 0x80)
271 buffer.write(uchar); 271 buffer.write(uchar);
272 else 272 else
273 buffer.write(new String(Character.toChars(uchar)).getBytes(encoding)); 273 sendEncoded(new String(Character.toChars(uchar)));
274 274
275 return true; 275 return true;
276 } 276 }
277 277
278 // send ctrl and meta-keys as appropriate 278 // send ctrl and meta-keys as appropriate
398 case KEYCODE_ESCAPE: 398 case KEYCODE_ESCAPE:
399 buffer.write(0x1b); 399 buffer.write(0x1b);
400 return true; 400 return true;
401 401
402 case KeyEvent.KEYCODE_TAB: 402 case KeyEvent.KEYCODE_TAB:
403 buffer.write("[tab]"); 403 sendEncoded("[tab]");
404 return true; 404 return true;
405 405
406 case KEYCODE_PAGE_DOWN: 406 case KEYCODE_PAGE_DOWN:
407 buffer.write("[pgdown]"); 407 sendEncoded("[pgdown]");
408 metaState &= ~META_TRANSIENT; 408 metaState &= ~META_TRANSIENT;
409 bridge.tryKeyVibrate(); 409 bridge.tryKeyVibrate();
410 return true; 410 return true;
411 411
412 case KEYCODE_PAGE_UP: 412 case KEYCODE_PAGE_UP:
413 buffer.write("[pgup]"); 413 sendEncoded("[pgup]");
414 metaState &= ~META_TRANSIENT; 414 metaState &= ~META_TRANSIENT;
415 bridge.tryKeyVibrate(); 415 bridge.tryKeyVibrate();
416 return true; 416 return true;
417 417
418 case KeyEvent.KEYCODE_MOVE_HOME: 418 case KeyEvent.KEYCODE_MOVE_HOME:
419 buffer.write("[home]"); 419 sendEncoded("[home]");
420 metaState &= ~META_TRANSIENT; 420 metaState &= ~META_TRANSIENT;
421 bridge.tryKeyVibrate(); 421 bridge.tryKeyVibrate();
422 return true; 422 return true;
423 423
424 case KeyEvent.KEYCODE_MOVE_END: 424 case KeyEvent.KEYCODE_MOVE_END:
425 buffer.write("[end]"); // does not exist!! 425 sendEncoded("[end]"); // does not exist!!
426 metaState &= ~META_TRANSIENT; 426 metaState &= ~META_TRANSIENT;
427 bridge.tryKeyVibrate(); 427 bridge.tryKeyVibrate();
428 return true; 428 return true;
429 429
430 case KeyEvent.KEYCODE_CAMERA: 430 case KeyEvent.KEYCODE_CAMERA:
455 PreferenceConstants.HWBUTTON_ESC); 455 PreferenceConstants.HWBUTTON_ESC);
456 return (handleShortcut(v, hwbuttonShortcut)); 456 return (handleShortcut(v, hwbuttonShortcut));
457 457
458 case KeyEvent.KEYCODE_DEL: 458 case KeyEvent.KEYCODE_DEL:
459 if ((metaState & META_ALT_MASK) != 0) { 459 if ((metaState & META_ALT_MASK) != 0) {
460 buffer.write("[insert]"); 460 sendEncoded("[insert]");
461 } 461 }
462 else { 462 else {
463 buffer.write("[backspace]"); 463 sendEncoded("[backspace]");
464 } 464 }
465 465
466 metaState &= ~META_TRANSIENT; 466 metaState &= ~META_TRANSIENT;
467 return true; 467 return true;
468 468
469 case KeyEvent.KEYCODE_ENTER: 469 case KeyEvent.KEYCODE_ENTER:
470 buffer.write("[enter]"); 470 sendEncoded("[enter]");
471 metaState &= ~META_TRANSIENT; 471 metaState &= ~META_TRANSIENT;
472 return true; 472 return true;
473 473
474 case KeyEvent.KEYCODE_DPAD_LEFT: 474 case KeyEvent.KEYCODE_DPAD_LEFT:
475 if (selectingForCopy) { 475 if (selectingForCopy) {
476 selectionArea.decrementColumn(); 476 selectionArea.decrementColumn();
477 bridge.redraw(); 477 bridge.redraw();
478 } 478 }
479 else { 479 else {
480 if ((metaState & META_ALT_MASK) != 0) { 480 if ((metaState & META_ALT_MASK) != 0) {
481 buffer.write("[home]"); 481 sendEncoded("[home]");
482 } 482 }
483 else { 483 else {
484 buffer.write("[left]"); 484 sendEncoded("[left]");
485 } 485 }
486 486
487 metaState &= ~META_TRANSIENT; 487 metaState &= ~META_TRANSIENT;
488 bridge.tryKeyVibrate(); 488 bridge.tryKeyVibrate();
489 } 489 }
495 selectionArea.decrementRow(); 495 selectionArea.decrementRow();
496 bridge.redraw(); 496 bridge.redraw();
497 } 497 }
498 else { 498 else {
499 if ((metaState & META_ALT_MASK) != 0) { 499 if ((metaState & META_ALT_MASK) != 0) {
500 buffer.write("[pgup]"); 500 sendEncoded("[pgup]");
501 } 501 }
502 else { 502 else {
503 buffer.write("[up]"); 503 sendEncoded("[up]");
504 } 504 }
505 505
506 metaState &= ~META_TRANSIENT; 506 metaState &= ~META_TRANSIENT;
507 bridge.tryKeyVibrate(); 507 bridge.tryKeyVibrate();
508 } 508 }
514 selectionArea.incrementRow(); 514 selectionArea.incrementRow();
515 bridge.redraw(); 515 bridge.redraw();
516 } 516 }
517 else { 517 else {
518 if ((metaState & META_ALT_MASK) != 0) { 518 if ((metaState & META_ALT_MASK) != 0) {
519 buffer.write("[pgdown]"); 519 sendEncoded("[pgdown]");
520 } 520 }
521 else { 521 else {
522 buffer.write("[down]"); 522 sendEncoded("[down]");
523 } 523 }
524 524
525 metaState &= ~META_TRANSIENT; 525 metaState &= ~META_TRANSIENT;
526 bridge.tryKeyVibrate(); 526 bridge.tryKeyVibrate();
527 } 527 }
533 selectionArea.incrementColumn(); 533 selectionArea.incrementColumn();
534 bridge.redraw(); 534 bridge.redraw();
535 } 535 }
536 else { 536 else {
537 if ((metaState & META_ALT_MASK) != 0) { 537 if ((metaState & META_ALT_MASK) != 0) {
538 buffer.write("[end]"); 538 sendEncoded("[end]"); // does not exist!!
539 } 539 }
540 else { 540 else {
541 buffer.write("[right]"); 541 sendEncoded("[right]");
542 } 542 }
543 543
544 metaState &= ~META_TRANSIENT; 544 metaState &= ~META_TRANSIENT;
545 bridge.tryKeyVibrate(); 545 bridge.tryKeyVibrate();
546 } 546 }