restructured so that one can add a vi widget anywhere.
[nvi.git] / motif_l / m_motif.h
blobfefbdcfc44afa5dd647811cc6e343e29824090eb
1 /*-
2 * Copyright (c) 1996
3 * Rob Zimmermann. All rights reserved.
4 * Copyright (c) 1996
5 * Keith Bostic. All rights reserved.
7 * See the LICENSE file for redistribution information.
9 * "$Id: m_motif.h,v 8.3 1996/12/10 17:07:23 bostic Exp $ (Berkeley) $Date: 1996/12/10 17:07:23 $";
12 /* Describes a single 'screen' implemented in X widgetry. */
13 typedef struct {
14 Widget parent, /* the pane */
15 area, /* text goes here */
16 form, /* holds text and scrollbar */
17 scroll; /* not connected yet */
18 Region clip;
19 int color;
20 int rows,
21 cols;
22 int ch_width,
23 ch_height,
24 ch_descent;
25 int curx, cury;
26 char *characters;
27 char *flags;
28 Boolean init;
29 } xvi_screen;
31 extern xvi_screen *_vi_screen;
34 * Color support
36 #define COLOR_INVALID 0xff /* force color change */
39 * These are color indices. When vi passes color info, we can do 2..0x3f
40 * in the 8 bits I've allocated.
42 #define COLOR_STANDARD 0x00 /* standard video */
43 #define COLOR_INVERSE 0x01 /* reverse video */
45 /* These are flag bits, they override the above colors. */
46 #define COLOR_CARET 0x80 /* draw the caret */
47 #define COLOR_SELECT 0x40 /* draw the selection */
49 #define ToRowCol( scr, lin, r, c ) \
50 r = (lin) / scr->cols; \
51 c = ((lin) - r * (scr->cols)) % scr->cols;
52 #define Linear( scr, y, x ) \
53 ( (y) * scr->cols + (x) )
54 #define CharAt( scr, y, x ) \
55 ( scr->characters + Linear( scr, y, x ) )
56 #define FlagAt( scr, y, x ) \
57 ( scr->flags + Linear( scr, y, x ) )
59 #define XPOS( scr, x ) \
60 scr->ch_width * (x)
61 #define YTOP( scr, y ) \
62 scr->ch_height * (y)
63 #define YPOS( scr, y ) \
64 YTOP( scr, ((y)+1) ) - scr->ch_descent
66 #define ROW( scr, y ) \
67 ( (y) / scr->ch_height )
69 #define COLUMN( scr, x ) \
70 ( (x) / scr->ch_width )
72 extern GC _vi_copy_gc;
73 extern Widget top_level;
76 /* public routines */
77 extern Boolean vi_pipe_input_func();
79 extern char *vi_progname;