t_tek_md.c 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /* This file is part of the GNU plotutils package. Copyright (C) 1995,
  2. 1996, 1997, 1998, 1999, 2000, 2005, 2008, Free Software Foundation, Inc.
  3. The GNU plotutils package is free software. You may redistribute it
  4. and/or modify it under the terms of the GNU General Public License as
  5. published by the Free Software foundation; either version 2, or (at your
  6. option) any later version.
  7. The GNU plotutils package is distributed in the hope that it will be
  8. useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. General Public License for more details.
  11. You should have received a copy of the GNU General Public License along
  12. with the GNU plotutils package; see the file COPYING. If not, write to
  13. the Free Software Foundation, Inc., 51 Franklin St., Fifth Floor,
  14. Boston, MA 02110-1301, USA. */
  15. /* This file contains a low-level routine for shifting a Tektronix graphics
  16. device to a specified display mode, by emitting an escape sequence if
  17. necessary. */
  18. /* Basic Tektronix modes are alpha mode (for drawing alphanumeric
  19. characters in any of four character sizes), ``graph mode'' i.e. vector
  20. plot mode (for drawing line segments), and GIN (graphics input) mode,
  21. which requests a cursor location from the user. The EGM (enhanced
  22. graphics module), besides increasing the addressable point from 0..1023
  23. x 0..1023 to 0..4095 x 0..4095, added three additional modes: point plot
  24. mode, special point plot mode, and incremental plot mode.
  25. Switching among the three basic modes is accomplished thus:
  26. US, CR, or ESC FF: enter alpha mode (CR repositions cursor to left edge,
  27. and ESC FF homes it)
  28. GS: enter graph mode
  29. ESC ENQ: enquire cursor location (works in both alpha, graph mode),
  30. i.e. temporarily enter GIN mode and back out. In alpha mode
  31. cursor location is lower left corner of flickerint 8x9 cursor.
  32. ESC SUB: enter GIN mode, turn on positionable crosshair cursor
  33. and send address in response to ESC ENQ. Thumbwheels
  34. (potentiometers located on the keyboard) were used for positioning.
  35. Getting back to alpha / graph mode from GIN is complicated; it's
  36. best to send a US or GS to ensure this happens.
  37. A genuine 4014 doesn't normally plot the first vector drawn after graph
  38. mode is entered via GS (it's ``dark vector''). To get it plotted, you
  39. need to issue a BEL, VT, HT, LF, CR or BS immediately after issuing the
  40. GS. Only the first of these (BEL) won't disturb the location of the
  41. graphics cursor.
  42. If the EGM is present, we also have:
  43. FS: enter point plot mode
  44. RS: enter incremental mode
  45. ESC FS: enter special point plot mode
  46. Point plot commands are identical to vector plot commands (the endpoint
  47. of the vector is drawn). Incremental plot mode allows motion by one
  48. unit in any of 8 directions, on receipt of a single byte. First byte
  49. after RS must be a beam-off or beam-on command.
  50. In special point plot mode, the byte after the ESC FS (and the byte
  51. which precedes every point address thereafter) is interpreted as an
  52. intensity character, which determines the on-time of the beam. It is
  53. loaded into an intensity register. This allows control of the dot size
  54. (focused vs. unfocused), and brightness, in any of these three new
  55. modes.
  56. The user can also control the trichotomy normal z-axis (i.e. focused
  57. beam) / defocused z-axis (i.e. defocused beam) / write-thru mode (see
  58. tek2plot.c for the control codes used for this). Write-thru simply
  59. means that written data, whether alpha characters or vectors, are
  60. written to screen but are not refreshed. So they appear briefly and
  61. then vanish (unless they are refreshed under user control, by drawing
  62. them repeatedly).
  63. WARNING: it is a peculiarity of the 4014 that in the following list,
  64. one can mode-switch only _downward_, not upward! The exception is
  65. that one can always switch up to alpha mode.
  66. alpha mode
  67. vector mode
  68. point plot mode
  69. special point plot mode
  70. incremental plot mode.
  71. Control codes that would switch `upward' are ignored. GIN mode can be
  72. switched into from any mode, however.
  73. */
  74. #include "sys-defines.h"
  75. #include "extern.h"
  76. void
  77. _pl_t_tek_mode(R___(Plotter *_plotter) int newmode)
  78. {
  79. if (_plotter->tek_mode_is_unknown || _plotter->tek_mode != newmode)
  80. /* need to emit escape sequence */
  81. {
  82. switch (newmode)
  83. {
  84. case TEK_MODE_ALPHA:
  85. /* ASCII US, i.e. ^_ (enter alpha mode) */
  86. _write_byte (_plotter->data, '\037');
  87. break;
  88. case TEK_MODE_PLOT:
  89. if ((_plotter->tek_mode_is_unknown)
  90. || (_plotter->tek_mode == TEK_MODE_POINT)
  91. || (_plotter->tek_mode == TEK_MODE_INCREMENTAL))
  92. /* ASCII US, i.e. ^_ (enter alpha) */
  93. _write_byte (_plotter->data, '\037');
  94. /* ASCII GS, i.e. ^] (enter vector mode)*/
  95. _write_byte (_plotter->data, '\035');
  96. break;
  97. case TEK_MODE_POINT:
  98. if ((_plotter->tek_mode_is_unknown) ||
  99. (_plotter->tek_mode == TEK_MODE_INCREMENTAL))
  100. /* ASCII US, i.e. ^_ (enter alpha) */
  101. _write_byte (_plotter->data, '\037');
  102. /* ASCII FS, i.e. ^\ (enter point mode) */
  103. _write_byte (_plotter->data, '\034');
  104. break;
  105. case TEK_MODE_INCREMENTAL:
  106. /* ASCII RS, i.e. ^^ (enter incplot mode)*/
  107. _write_byte (_plotter->data, '\036');
  108. break;
  109. default:
  110. break;
  111. }
  112. /* Tektronix is now in specified internal state */
  113. _plotter->tek_mode = newmode;
  114. _plotter->tek_mode_is_unknown = false;
  115. }
  116. }