From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- sys/gio/cursor/gtrwaitp.x | 94 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 sys/gio/cursor/gtrwaitp.x (limited to 'sys/gio/cursor/gtrwaitp.x') diff --git a/sys/gio/cursor/gtrwaitp.x b/sys/gio/cursor/gtrwaitp.x new file mode 100644 index 00000000..67f46dd8 --- /dev/null +++ b/sys/gio/cursor/gtrwaitp.x @@ -0,0 +1,94 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include +include +include +include +include "gtr.h" +include "grc.h" + +# GTR_WAITPAGE -- Print the "hit return to continue" message on the terminal +# screen and wait for the user to respond before returning to graphics mode. +# Redrawing of the graphics frame is optional. + +procedure gtr_waitpage (fd, stream) + +int fd # output file +int stream # graphics stream + +int key, i +pointer tty, tr +int getci(), ttystati() +pointer ttyodes(), gtr_init() +errchk gtr_init, ttyodes + +begin + tr = gtr_init (stream) + tty = ttyodes ("terminal") + + repeat { + # Print prompt in standout mode. + call ttyclearln (fd, tty) + call ttyso (fd, tty, YES) + call fprintf (fd, + "[space=cmhelp,return=quit+redraw,q=quit+noredraw]") + call ttyso (fd, tty, NO) + call flush (fd) + + # Wait for user to hit a key. This is done in text mode via + # a raw getc rather than via a cursor read to avoid switching to + # graphics mode. On some terminals with separate text and + # graphics planes a switch to graphics mode turns off the text + # plane. + + call fseti (STDIN, F_RAW, YES) + if (getci (STDIN, key) == EOF) + key = '\r' + call fseti (STDIN, F_RAW, NO) + + # Take the action commanded by the user. At present the morehelp + # option merely prints cursor mode help; this is appropriate + # because the first waitpage call occurs after printing user help + # in response to ? (or after a :.show). + + switch (key) { + case 'q': + # Quit, do not clear graphics and redraw. + if (TR_PAGE(tr) == NO) { + # If screen paging is disabled (text drawn underneath + # transparent graphics overlay), clear the text frame + # only, using the clear line function. + + do i = 1, ttystati (tty, TTY_NLINES) { + call ttygoto (fd, tty, 1, i) + call ttyclearln (fd, tty) + } + } else + call ttyclearln (fd, tty) + + call flush (fd) + call gki_reactivatews (stream, 0) + break + + case '\r', '\n': + # Quit, clear graphics and redraw. + call ttyclearln (fd, tty) + call flush (fd) + call gki_reactivatews (stream, 0) + call gtr_redraw (stream) + break + + case ' ': + # Print cursor mode help. + iferr (call pagefile (KEYSFILE, "cursor mode help")) + call erract (EA_WARN) + + default: + # Illegal keystroke. + call printf ("\007") + call flush (STDOUT) + } + } + + call ttycdes (tty) +end -- cgit