xref: /netbsd/external/bsd/nvi/dist/motif_l/m_motif.h (revision 08d478e3)
1*08d478e3Schristos /*	$NetBSD: m_motif.h,v 1.2 2013/11/22 15:52:06 christos Exp $	*/
23a571abcSchristos /*-
33a571abcSchristos  * Copyright (c) 1996
43a571abcSchristos  *	Rob Zimmermann.  All rights reserved.
53a571abcSchristos  * Copyright (c) 1996
63a571abcSchristos  *	Keith Bostic.  All rights reserved.
73a571abcSchristos  *
83a571abcSchristos  * See the LICENSE file for redistribution information.
93a571abcSchristos  *
103a571abcSchristos  *	"Id: m_motif.h,v 8.11 1996/12/20 10:26:59 bostic Exp  (Berkeley) Date: 1996/12/20 10:26:59 ";
113a571abcSchristos  */
123a571abcSchristos 
133a571abcSchristos /*
143a571abcSchristos  * Color support
153a571abcSchristos  */
163a571abcSchristos #define	COLOR_INVALID	0xff	/* force color change */
173a571abcSchristos 
183a571abcSchristos /*
193a571abcSchristos  * These are color indices.  When vi passes color info, we can do 2..0x3f
203a571abcSchristos  * in the 8 bits I've allocated.
213a571abcSchristos  */
223a571abcSchristos #define	COLOR_STANDARD	0x00	/* standard video */
233a571abcSchristos #define	COLOR_INVERSE	0x01	/* reverse video */
243a571abcSchristos 
253a571abcSchristos /* These are flag bits, they override the above colors. */
263a571abcSchristos #define	COLOR_CARET	0x80	/* draw the caret */
273a571abcSchristos #define	COLOR_SELECT	0x40	/* draw the selection */
283a571abcSchristos 
293a571abcSchristos #define	ToRowCol( scr, lin, r, c )	\
303a571abcSchristos 	    r = (lin) / scr->cols;	\
313a571abcSchristos 	    c = ((lin) - r * (scr->cols)) % scr->cols;
323a571abcSchristos #define	Linear( scr, y, x )	\
333a571abcSchristos 	    ( (y) * scr->cols + (x) )
343a571abcSchristos #define	CharAt( scr, y, x )	\
353a571abcSchristos 	    ( scr->characters + Linear( scr, y, x ) )
363a571abcSchristos #define	FlagAt( scr, y, x )	\
373a571abcSchristos 	    ( scr->flags + Linear( scr, y, x ) )
383a571abcSchristos 
393a571abcSchristos #define	XPOS( scr, x )	\
403a571abcSchristos 	scr->ch_width * (x)
413a571abcSchristos #define	YTOP( scr, y )	\
423a571abcSchristos 	scr->ch_height * (y)
433a571abcSchristos #define	YPOS( scr, y )	\
443a571abcSchristos 	YTOP( scr, ((y)+1) ) - scr->ch_descent
453a571abcSchristos 
463a571abcSchristos #define	ROW( scr, y )	\
473a571abcSchristos 	( (y) / scr->ch_height )
483a571abcSchristos 
493a571abcSchristos #define	COLUMN( scr, x )	\
503a571abcSchristos 	( (x) / scr->ch_width )
513a571abcSchristos 
523a571abcSchristos /* Describes a single 'screen' implemented in X widgetry. */
533a571abcSchristos typedef	struct {
543a571abcSchristos     Widget	parent,		/* the pane */
553a571abcSchristos 		area,		/* text goes here */
563a571abcSchristos 		form,		/* holds text and scrollbar */
573a571abcSchristos 		scroll;		/* not connected yet */
583a571abcSchristos     Region	clip;
593a571abcSchristos     int		color;
603a571abcSchristos     int		rows,
613a571abcSchristos 		cols;
623a571abcSchristos     int		ch_width,
633a571abcSchristos 		ch_height,
643a571abcSchristos 		ch_descent;
653a571abcSchristos     int		curx, cury;
663a571abcSchristos     char	*characters;
673a571abcSchristos     char	*flags;
683a571abcSchristos     Boolean	init;
693a571abcSchristos } xvi_screen;
703a571abcSchristos 
713a571abcSchristos /* Option type. */
723a571abcSchristos typedef enum {
733a571abcSchristos 	optToggle,
743a571abcSchristos 	optInteger,
753a571abcSchristos 	optString,
763a571abcSchristos 	optFile,
773a571abcSchristos 	optTerminator
783a571abcSchristos } optKind;
793a571abcSchristos 
803a571abcSchristos /* Option entry. */
813a571abcSchristos typedef struct {
823a571abcSchristos 	optKind	kind;				/* Option type. */
833a571abcSchristos 	String	name;				/* Option name. */
843a571abcSchristos 	void	*value;				/* Current option value. */
853a571abcSchristos 	u_int	flags;				/* Associated flags. */
863a571abcSchristos } optData;
873a571abcSchristos 
883a571abcSchristos /* Option page. */
893a571abcSchristos typedef	struct {
903a571abcSchristos 	String	name;
913a571abcSchristos 	String	description;
923a571abcSchristos 	Widget	holder;
933a571abcSchristos 	optData	*toggles;
943a571abcSchristos 	optData	*ints;
953a571abcSchristos 	optData	*others;
963a571abcSchristos } optSheet;
973a571abcSchristos 
983a571abcSchristos /* Utilities for converting X resources...
993a571abcSchristos  *
1003a571abcSchristos  * __XutConvertResources( Widget, String root, XutResource *, int count )
1013a571abcSchristos  *	The resource block is loaded with converted values
1023a571abcSchristos  *	If the X resource does not exist, no change is made to the value
1033a571abcSchristos  *	'root' should be the application name.
1043a571abcSchristos  */
1053a571abcSchristos typedef	enum {
1063a571abcSchristos     XutRKinteger,
1073a571abcSchristos     XutRKboolean,
1083a571abcSchristos     XutRKpixel,
1093a571abcSchristos     XutRKpixelBackup,	/* if XutRKpixel fails */
1103a571abcSchristos     XutRKfont,
1113a571abcSchristos     XutRKcursor
1123a571abcSchristos } XutResourceKind;
1133a571abcSchristos 
1143a571abcSchristos typedef struct {
1153a571abcSchristos     String		name;
1163a571abcSchristos     XutResourceKind	kind;
1173a571abcSchristos     void		*value;
1183a571abcSchristos } XutResource;
1193a571abcSchristos 
1203a571abcSchristos /* Internal use: */
1213a571abcSchristos extern GC	   __vi_copy_gc;
1223a571abcSchristos extern void	 (*__vi_exitp) __P((void));
1233a571abcSchristos extern xvi_screen *__vi_screen;
1243a571abcSchristos 
125*08d478e3Schristos #include "motif_extern.h"
126