t_tek_mv.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 repositioning the graphics
  16. cursor on a Tektronix display, by emitting an escape sequence.
  17. The reposition command automatically knocks the Tektronix into a
  18. non-alpha mode. We choose either PLOT or POINT mode, depending on
  19. whether the polyline we're drawing is connected, or is simply a set of
  20. disconnected points. That information is stored in our drawing state.
  21. If we are already in PLOT/POINT mode, emitting the escape sequence will
  22. prevent a line being drawn at the time of the move (the "dark vector"
  23. concept). That is just what we want. */
  24. #include "sys-defines.h"
  25. #include "extern.h"
  26. void
  27. _pl_t_tek_move (R___(Plotter *_plotter) int xx, int yy)
  28. {
  29. int correct_tek_mode =
  30. _plotter->drawstate->points_are_connected ? TEK_MODE_PLOT : TEK_MODE_POINT;
  31. switch (correct_tek_mode)
  32. {
  33. case TEK_MODE_POINT:
  34. /* ASCII FS, i.e. ^\ (enter POINT mode)*/
  35. _write_byte (_plotter->data, '\034');
  36. break;
  37. case TEK_MODE_PLOT:
  38. /* ASCII GS, i.e. ^] (enter PLOT mode) */
  39. _write_byte (_plotter->data, '\035');
  40. break;
  41. default: /* shouldn't happen */
  42. return;
  43. }
  44. /* output location to the Tektronix */
  45. _pl_t_tek_vector (R___(_plotter) xx, yy);
  46. /* Tek position is now correct */
  47. _plotter->tek_pos.x = xx;
  48. _plotter->tek_pos.y = yy;
  49. _plotter->tek_position_is_unknown = false;
  50. /* Tek is now in correct mode for plotting vectors */
  51. _plotter->tek_mode_is_unknown = false;
  52. _plotter->tek_mode = correct_tek_mode;
  53. /* re-emphasize: on return we'll be in either PLOT or POINT mode. */
  54. return;
  55. }