1 /*        $NetBSD: m_motif.h,v 1.2 2013/11/22 15:52:06 christos Exp $ */
2 /*-
3  * Copyright (c) 1996
4  *        Rob Zimmermann.  All rights reserved.
5  * Copyright (c) 1996
6  *        Keith Bostic.  All rights reserved.
7  *
8  * See the LICENSE file for redistribution information.
9  *
10  *        "Id: m_motif.h,v 8.11 1996/12/20 10:26:59 bostic Exp  (Berkeley) Date: 1996/12/20 10:26:59 ";
11  */
12 
13 /*
14  * Color support
15  */
16 #define   COLOR_INVALID       0xff      /* force color change */
17 
18 /*
19  * These are color indices.  When vi passes color info, we can do 2..0x3f
20  * in the 8 bits I've allocated.
21  */
22 #define   COLOR_STANDARD      0x00      /* standard video */
23 #define   COLOR_INVERSE       0x01      /* reverse video */
24 
25 /* These are flag bits, they override the above colors. */
26 #define   COLOR_CARET         0x80      /* draw the caret */
27 #define   COLOR_SELECT        0x40      /* draw the selection */
28 
29 #define   ToRowCol( scr, lin, r, c )    \
30               r = (lin) / scr->cols;    \
31               c = ((lin) - r * (scr->cols)) % scr->cols;
32 #define   Linear( scr, y, x ) \
33               ( (y) * scr->cols + (x) )
34 #define   CharAt( scr, y, x ) \
35               ( scr->characters + Linear( scr, y, x ) )
36 #define   FlagAt( scr, y, x ) \
37               ( scr->flags + Linear( scr, y, x ) )
38 
39 #define   XPOS( scr, x )      \
40           scr->ch_width * (x)
41 #define   YTOP( scr, y )      \
42           scr->ch_height * (y)
43 #define   YPOS( scr, y )      \
44           YTOP( scr, ((y)+1) ) - scr->ch_descent
45 
46 #define   ROW( scr, y )       \
47           ( (y) / scr->ch_height )
48 
49 #define   COLUMN( scr, x )    \
50           ( (x) / scr->ch_width )
51 
52 /* Describes a single 'screen' implemented in X widgetry. */
53 typedef   struct {
54     Widget          parent,             /* the pane */
55                     area,               /* text goes here */
56                     form,               /* holds text and scrollbar */
57                     scroll;             /* not connected yet */
58     Region          clip;
59     int             color;
60     int             rows,
61                     cols;
62     int             ch_width,
63                     ch_height,
64                     ch_descent;
65     int             curx, cury;
66     char  *characters;
67     char  *flags;
68     Boolean         init;
69 } xvi_screen;
70 
71 /* Option type. */
72 typedef enum {
73           optToggle,
74           optInteger,
75           optString,
76           optFile,
77           optTerminator
78 } optKind;
79 
80 /* Option entry. */
81 typedef struct {
82           optKind   kind;                                   /* Option type. */
83           String    name;                                   /* Option name. */
84           void      *value;                                 /* Current option value. */
85           u_int     flags;                                  /* Associated flags. */
86 } optData;
87 
88 /* Option page. */
89 typedef   struct {
90           String    name;
91           String    description;
92           Widget    holder;
93           optData   *toggles;
94           optData   *ints;
95           optData   *others;
96 } optSheet;
97 
98 /* Utilities for converting X resources...
99  *
100  * __XutConvertResources( Widget, String root, XutResource *, int count )
101  *        The resource block is loaded with converted values
102  *        If the X resource does not exist, no change is made to the value
103  *        'root' should be the application name.
104  */
105 typedef   enum {
106     XutRKinteger,
107     XutRKboolean,
108     XutRKpixel,
109     XutRKpixelBackup,         /* if XutRKpixel fails */
110     XutRKfont,
111     XutRKcursor
112 } XutResourceKind;
113 
114 typedef struct {
115     String                    name;
116     XutResourceKind kind;
117     void            *value;
118 } XutResource;
119 
120 /* Internal use: */
121 extern GC    __vi_copy_gc;
122 extern void          (*__vi_exitp) __P((void));
123 extern xvi_screen *__vi_screen;
124 
125 #include "motif_extern.h"
126