Annotation of researchv9/X11/src/X.V11R1/lib/oldXtk/TextDisp.h, revision 1.1.1.1

1.1       root        1: /* $Header: TextDisp.h,v 1.1 87/09/11 07:59:23 toddb Exp $ */
                      2: /*
                      3:  *     sccsid: @(#)TextDisp.h  1.14    2/25/87
                      4:  */
                      5: 
                      6: /*
                      7:  * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
                      8:  * 
                      9:  *                         All Rights Reserved
                     10:  * 
                     11:  * Permission to use, copy, modify, and distribute this software and its 
                     12:  * documentation for any purpose and without fee is hereby granted, 
                     13:  * provided that the above copyright notice appear in all copies and that
                     14:  * both that copyright notice and this permission notice appear in 
                     15:  * supporting documentation, and that the name of Digital Equipment
                     16:  * Corporation not be used in advertising or publicity pertaining to
                     17:  * distribution of the software without specific, written prior permission.  
                     18:  * 
                     19:  * 
                     20:  * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
                     21:  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
                     22:  * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
                     23:  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
                     24:  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
                     25:  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
                     26:  * SOFTWARE.
                     27:  */
                     28: 
                     29: /* File: TextDisp.h */
                     30: 
                     31: #define MAXCUT 30000   /* Maximum number of characters that can be cut. */
                     32: 
                     33: #define LF     0x0a
                     34: #define CR     0x0d
                     35: #define TAB    0x09
                     36: #define BS     0x08
                     37: #define SP     0x20
                     38: #define DEL    0x7f
                     39: #define BSLASH '\\'
                     40: 
                     41: #define EDITDONE 0
                     42: #define EDITERROR 1
                     43: #define POSITIONERROR 2
                     44: 
                     45: typedef enum {XtsdLeft, XtsdRight} ScanDirection;
                     46: typedef enum {XtstPositions, XtstWhiteSpace, XtstEOL, XtstParagraph, XtstFile} ScanType;
                     47: 
                     48: typedef struct {
                     49:     int  firstPos;
                     50:     int  length;
                     51:     char *ptr;
                     52:     } XtTextBlock, *TextBlockPtr;
                     53: 
                     54: typedef struct {
                     55:     int                    (*read)();
                     56:     int                    (*replace)();
                     57:     XtTextPosition  (*getLastPos)();
                     58:     int                    (*setLastPos)();
                     59:     XtTextPosition  (*scan)();
                     60:     XtEditType      (*editType)();
                     61:     int                    *data;
                     62:     } XtTextSource, *TextSourcePtr;
                     63: 
                     64: typedef struct {
                     65:     Display *dpy;
                     66:     int (*display)();
                     67:     int (*insertCursor)();
                     68:     int (*clearToBackground)();
                     69:     int (*findPosition)();
                     70:     int (*findDistance)();
                     71:     int (*resolve)();
                     72:     int (*maxLines)();
                     73:     int (*maxHeight)();
                     74:     int *data;
                     75:     } XtTextSink, *TextSinkPtr;
                     76: 
                     77: /* displayable text management data structures */
                     78: 
                     79: typedef struct {
                     80:     XtTextPosition position;
                     81:     Position x, y, endX;
                     82:     } LineTableEntry, *LineTableEntryPtr;
                     83: 
                     84: /* Line Tables are n+1 long - last position displayed is in last lt entry */
                     85: typedef struct {
                     86:     XtTextPosition  top;       /* Top of the displayed text.           */
                     87:     int                    lines;      /* How many lines in this table.        */
                     88:     LineTableEntry  *info;     /* A dynamic array, one entry per line  */
                     89:     } LineTable, *LineTablePtr;
                     90: 
                     91: typedef enum {XtisOn, XtisOff} InsertState;
                     92: 
                     93: typedef enum {XtselectNull, XtselectPosition, XtselectChar, XtselectWord,
                     94:     XtselectLine, XtselectParagraph, XtselectAll} XtSelectType;
                     95: 
                     96: typedef enum {XtsmTextSelect, XtsmTextExtend} SelectionMode;
                     97: 
                     98: typedef enum {XtactionStart, XtactionAdjust, XtactionEnd} SelectionAction;
                     99: 
                    100: typedef struct {
                    101:     XtTextPosition left, right;
                    102:     XtSelectType  type;
                    103: } TextSelection;
                    104: 
                    105: #define IsPositionVisible(ctx, pos)    (pos >= ctx->lt.info[0].position && \
                    106:            pos <= ctx->lt.info[ctx->lt.lines].position)
                    107: 
                    108: /* Private Text Definitions */
                    109: 
                    110: typedef int (*ActionProc)();
                    111: 
                    112: typedef XtSelectType SelectionArray[20];
                    113: 
                    114: typedef struct  {
                    115:     Display        *dpy;
                    116:     XtTextSource    *source;
                    117:     XtTextSink      *sink;
                    118:     LineTable       lt;
                    119:     XtTextPosition  insertPos;
                    120:     TextSelection   s;
                    121:     ScanDirection   extendDir;
                    122:     TextSelection   origSel;       /* the selection being modified */
                    123:     SelectionArray  sarray;        /* Array to cycle for selections. */
                    124:     Dimension       width, height;  /* Dimensions of the text subwindow */
                    125:     Dimension      leftmargin;     /* Width of left margin. */
                    126:     int                    options;        /* wordbreak, scroll, etc. */
                    127:     unsigned short  lasttime;       /* timestamp of last processed action */
                    128:     unsigned short  time;          /* timestamp of last key or button action */
                    129:     Position       x, y;           /* x, y coords for key or button action */
                    130:     Window         sbar;           /* The vertical scroll bar (none = 0).  */
                    131:     Window         outer;          /* Parent of scrollbar & text (if any) */
                    132:     Window         w;              /* Actual window containing text.  */
                    133:     XtTextPosition  *updateFrom;    /* Array of start positions for update. */
                    134:     XtTextPosition  *updateTo;      /* Array of end positions for update. */
                    135:     int                    numranges;      /* How many update ranges there are. */
                    136:     int                    maxranges;      /* How many update ranges we've space for */
                    137:     Boolean        showposition;   /* True if we need to show the position. */
                    138:     XtTextPosition  lastPos;       /* Last position of source. */
                    139:     Window         dialog;         /* Window containing dialog, if any. */
                    140:     Dimension      borderWidth;    /* width of window border (if any) */
                    141:     XtEventsPtr     eventTable;     /* Table for translation mgr. */
                    142:     caddr_t        state;          /* translation manager state handle */
                    143:     Pixel          border, background;     /* window colors */
                    144:     GC                     gc;
                    145:     Boolean        hasfocus;   /* TRUE if we currently have input focus. */
                    146: } TextContext, *TextContextPtr;

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.