source: trunk/third/x3270/screen.h @ 11123

Revision 11123, 2.5 KB checked in by ghudson, 27 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r11122, which included commits to RCS files with non-trunk default branches.
Line 
1/*
2 * Modifications Copyright 1993, 1994, 1995 by Paul Mattes.
3 * Original X11 Port Copyright 1990 by Jeff Sparkes.
4 *  Permission to use, copy, modify, and distribute this software and its
5 *  documentation for any purpose and without fee is hereby granted,
6 *  provided that the above copyright notice appear in all copies and that
7 *  both that copyright notice and this permission notice appear in
8 *  supporting documentation.
9 *
10 * Copyright 1989 by Georgia Tech Research Corporation, Atlanta, GA 30332.
11 *  All Rights Reserved.  GTRC hereby grants public use of this software.
12 *  Derivative works based on this software must incorporate this copyright
13 *  notice.
14 */
15
16/*
17 *      screen.h
18 *
19 *              Screen definitions for x3270.
20 */
21
22#define fCHAR_WIDTH(f)  ((f)->max_bounds.width)
23#define CHAR_WIDTH      fCHAR_WIDTH(*efontinfo)
24#define fCHAR_HEIGHT(f) ((f)->ascent + (f)->descent)
25#define CHAR_HEIGHT     fCHAR_HEIGHT(*efontinfo)
26
27#define HHALO   2       /* number of pixels to pad screen left-right */
28#define VHALO   1       /* number of pixels to pad screen top-bottom */
29
30#define cwX_TO_COL(x_pos, cw)   (((x_pos)-HHALO) / (cw))
31#define chY_TO_ROW(y_pos, ch)   (((y_pos)-VHALO) / (ch))
32#define cwCOL_TO_X(col, cw)     (((col) * (cw)) + HHALO)
33#define chROW_TO_Y(row, ch)     (((row)+1) * (ch) + VHALO)
34
35#define ssX_TO_COL(x_pos)       cwX_TO_COL(x_pos, ss->char_width)
36#define ssY_TO_ROW(y_pos)       chY_TO_ROW(y_pos, ss->char_height)
37#define ssCOL_TO_X(col)         cwCOL_TO_X(col, ss->char_width)
38#define ssROW_TO_Y(row)         chROW_TO_Y(row, ss->char_height)
39
40#define X_TO_COL(x_pos)         cwX_TO_COL(x_pos, *char_width)
41#define Y_TO_ROW(y_pos)         chY_TO_ROW(y_pos, *char_height)
42#define COL_TO_X(col)           cwCOL_TO_X(col, *char_width)
43#define ROW_TO_Y(row)           chROW_TO_Y(row, *char_height)
44
45#define SGAP    ((*efontinfo)->descent+3)       /* gap between screen
46                                                   and status line */
47
48#define SCREEN_WIDTH(cw)        (cwCOL_TO_X(maxCOLS, cw) + HHALO)
49#define SCREEN_HEIGHT(ch)       (chROW_TO_Y(maxROWS, ch) + VHALO+SGAP+VHALO)
50
51/* selections */
52
53#define SELECTED(baddr)         (selected[(baddr)/8] & (1 << ((baddr)%8)))
54#define SET_SELECT(baddr)       (selected[(baddr)/8] |= (1 << ((baddr)%8)))
55
56/*
57 * Screen position structure.
58 */
59union sp {
60        struct {
61                unsigned cg  : 8;       /* character code */
62                unsigned sel : 1;       /* selection status */
63                unsigned fg  : 6;       /* foreground color (flag/inv/0-15) */
64                unsigned gr  : 4;       /* graphic rendition */
65                unsigned cs  : 3;       /* character set */
66        } bits;
67        unsigned long word;
68};
69
70/*
71 * screen.c data structures. *
72 */
73extern int       *char_width, *char_height;
74extern unsigned char *selected;         /* selection bitmap */
Note: See TracBrowser for help on using the repository browser.