Standout box()

Brandon Allbery allbery at ncoast.UUCP
Wed Oct 22 05:13:51 AEST 1986


Expires:


Quoted from <640 at dg_rtp.UUCP> ["Re: boxes in curses"], by meissner at dg_rtp.UUCP (Michael Meissner)...
+---------------
| In article <2245 at elroy.UUCP>  alan at elroy.UUCP (Alan S. Mazer) writes:
| > Basically what you need to do is to skip using box() and define your own
| > function which draws a box (or border) using highlighted spaces.  This should
| > look pretty clean and curses will maintain it should it be clobbered.
| 
|     I have one minor nit about highlighted spaces -- it would only work on
| terminals which highlight with reverse video (as opposed to highlighting with
| dim, bold, or underlines).  But given that caveat, it sounds like a nifty
| solution.
+---------------

The documentation for sys5 curses states that if you set the 0x80 bit you get
standout mode.  (I think this works but is undocumented in BSD curses.)  So
the statement

#define STANDOUT	0x80

	box(win, ' '|STANDOUT, ' '|STANDOUT);

should give you a reverse-video box (if standout is reverse video) without
any extra programming.

One more caveat on this:  Televideo-style (magic cookie) terminals will
botch this badly.

Speaking of boxes, now that ncoast is back on the net, I will see about
posting my "tgraph" package.  It uses a terminfo-like database "/usr/lib/tgraph"
and a function "graph" (also "wgraph", "mvwgraph", "mvgraph") to implement
character graphics on terminals which support it.  You have to define the
A_ALTCHARSET attribute (smacs, rmacs, AND sgr), and the tgraph database
states what characters to print in A_ALTCHARSET mode to display graphic
characters.  Terminals which aren't in /usr/lib/tgraph get -, |, + graphics.
I've used this on a Wyse 50 and a VT100; it has also been tested on non-
graphics terminals.  It's nice to be able to write curses applications which
use a terminal's graphics characters.

The function graph(str) displays box graphics as specified by str; the
\n character is caught and processed correctly, other characters are
translated to the terminal's box graphics set via /usr/lib/tgraph, and
unknown characters print as spaces.  Example:

	graph(",---.\n|   |\n>---<\n|   |\n`---'\n");

produces a stacked box,

+---+			,---.
|   |			|   |
+---+	for the input:	>---<
|   |			|   |
+---+			`---'

on non-graphic terminals and uses the correct graphic characters on VT100s,
Wyse 50s, and anything else you define in the tgraph database.  The characters
used in graph() strings are intended to give an approximation to the correct
picture when viewed.

I'll be posting it soon if people want it.  (Oh, yes -- sys5 only, unless
you have Pavel Curtis's curses running or you have hacked extra attributes
into your curses.)

++Brandon
-- 
  ---------------- /--/	Brandon S. Allbery		UUCP: decvax!cwruecmp!
 /              / /|\/	Tridelta Industries, Inc.        ncoast!tdi2!brandon
----    -------- /-++	7350 Corporate Blvd.		PHONE: +1 216 974 9210
   /   / /---,  ----	Mentor, Ohio 44060		SYSOP: UNaXcess/ncoast
  /   / /    / /  /	     -- HOME --			 (216) 781-6201 24 hrs.
 /   / /    / /  /	6615 Center St. Apt. A1-105	ARPA:  ncoast!allbery%
----  -----~ ----	Mentor, Ohio 44060-4101		case.CSNET at relay.cs.net
An Open Letter To Tim Maroney:  If you don't want dogma, stop feeding it to us!



More information about the Comp.unix.wizards mailing list