749N/A/*
749N/A* $XConsortium: TextP.h,v 1.42 89/11/21 15:48:03 swick Exp $
749N/A*/
749N/A
749N/A
749N/A/***********************************************************
749N/ACopyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
749N/Aand the Massachusetts Institute of Technology, Cambridge, Massachusetts.
749N/A
749N/A All Rights Reserved
749N/A
749N/APermission to use, copy, modify, and distribute this software and its
749N/Adocumentation for any purpose and without fee is hereby granted,
749N/Aprovided that the above copyright notice appear in all copies and that
749N/Aboth that copyright notice and this permission notice appear in
749N/Asupporting documentation, and that the names of Digital or MIT not be
749N/Aused in advertising or publicity pertaining to distribution of the
749N/Asoftware without specific, written prior permission.
749N/A
749N/ADIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
749N/AALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
749N/ADIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
749N/AANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
749N/AWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
749N/AARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
749N/ASOFTWARE.
749N/A
749N/A******************************************************************/
749N/A
749N/A#ifndef _XawTextP_h
749N/A#define _XawTextP_h
749N/A
749N/A#include <./Xaw3_1Text.h>
749N/A#include <./Xaw3_1SimpleP.h>
749N/A
749N/A/****************************************************************
749N/A *
749N/A * Text widget private
749N/A *
749N/A ****************************************************************/
749N/A#define MAXCUT 30000 /* Maximum number of characters that can be cut. */
749N/A
749N/A#define abs(x) (((x) < 0) ? (-(x)) : (x))
749N/A
749N/A#define GETLASTPOS XawTextSourceScan(ctx->text.source, 0, \
749N/A XawstAll, XawsdRight, 1, TRUE)
749N/A
749N/A#define zeroPosition ((XawTextPosition) 0)
749N/A
749N/Aextern XtActionsRec textActionsTable[];
749N/Aextern Cardinal textActionsTableCount;
749N/A
749N/A#define LF 0x0a
749N/A#define CR 0x0d
749N/A#define TAB 0x09
749N/A#define BS 0x08
749N/A#define SP 0x20
749N/A#define DEL 0x7f
749N/A#define BSLASH '\\'
749N/A
749N/A/* constants that subclasses may want to know */
749N/A#define DEFAULT_TEXT_HEIGHT ((Dimension)~0)
749N/A
749N/A/* displayable text management data structures */
749N/A
749N/Atypedef struct {
749N/A XawTextPosition position;
749N/A Position y;
749N/A Dimension textWidth;
749N/A} XawTextLineTableEntry, *XawTextLineTableEntryPtr;
749N/A
749N/Atypedef struct {
749N/A XawTextPosition left, right;
749N/A XawTextSelectType type;
749N/A Atom* selections;
749N/A int atom_count;
749N/A int array_size;
749N/A} XawTextSelection;
749N/A
749N/A/* Line Tables are n+1 long - last position displayed is in last lt entry */
749N/Atypedef struct {
749N/A XawTextPosition top; /* Top of the displayed text. */
749N/A int lines; /* How many lines in this table. */
749N/A XawTextLineTableEntry *info; /* A dynamic array, one entry per line */
749N/A} XawTextLineTable, *XawTextLineTablePtr;
749N/A
749N/A
749N/Atypedef struct _XawTextMargin {
749N/A Position left, right, top, bottom;
749N/A} XawTextMargin;
749N/A
749N/A#define VMargins(ctx) ( (ctx)->text.margin.top + (ctx)->text.margin.bottom )
749N/A#define HMargins(ctx) ( (ctx)->text.margin.left + (ctx)->text.margin.right )
749N/A
749N/A#define IsPositionVisible(ctx, pos) \
749N/A (pos >= ctx->text.lt.info[0].position && \
749N/A pos < ctx->text.lt.info[ctx->text.lt.lines].position)
749N/A
749N/A/*
749N/A * Search & Replace data structure.
749N/A */
749N/A
749N/Astruct SearchAndReplace {
749N/A Boolean selection_changed; /* flag so that the selection cannot be
749N/A changed out from underneath query-replace.*/
749N/A Widget search_popup; /* The poppup widget that allows searches.*/
749N/A Widget label1; /* The label widgets for the search window. */
749N/A Widget label2;
749N/A Widget left_toggle; /* The left search toggle radioGroup. */
749N/A Widget right_toggle; /* The right search toggle radioGroup. */
749N/A Widget rep_label; /* The Replace label string. */
749N/A Widget rep_text; /* The Replace text field. */
749N/A Widget search_text; /* The Search text field. */
749N/A Widget rep_one; /* The Replace one button. */
749N/A Widget rep_all; /* The Replace all button. */
749N/A};
749N/A
749N/A/* Private Text Definitions */
749N/A
749N/Atypedef int (*ActionProc)();
749N/A
749N/A/* New fields for the Text widget class record */
749N/A
749N/Atypedef struct {int empty;} TextClassPart;
749N/A
749N/A/* Full class record declaration */
749N/Atypedef struct _TextClassRec {
749N/A CoreClassPart core_class;
749N/A SimpleClassPart simple_class;
749N/A TextClassPart text_class;
749N/A} TextClassRec;
749N/A
749N/Aextern TextClassRec textClassRec;
749N/A
749N/A/* New fields for the Text widget record */
749N/Atypedef struct _TextPart {
749N/A /* resources */
749N/A
749N/A Widget source, sink;
749N/A XawTextPosition insertPos;
749N/A XawTextSelection s;
749N/A XawTextSelectType *sarray; /* Array to cycle for selections. */
749N/A int options; /* wordbreak, scroll, etc. */
749N/A int dialog_horiz_offset; /* position for popup dialog */
749N/A int dialog_vert_offset; /* position for popup dialog */
749N/A Boolean display_caret; /* insertion pt visible iff T */
749N/A Boolean auto_fill; /* Auto fill mode? */
749N/A XawTextScrollMode scroll_vert, scroll_horiz; /*what type of scrollbars.*/
749N/A XawTextWrapMode wrap; /* The type of wrapping. */
749N/A XawTextResizeMode resize; /* what to resize */
749N/A XawTextMargin r_margin; /* The real margins. */
749N/A
749N/A /* private state */
749N/A
749N/A XawTextMargin margin; /* The current margins. */
749N/A XawTextLineTable lt;
749N/A XawTextScanDirection extendDir;
749N/A XawTextSelection origSel; /* the selection being modified */
749N/A Time lasttime; /* timestamp of last processed action */
749N/A Time time; /* time of last key or button action */
749N/A Position ev_x, ev_y; /* x, y coords for key or button action */
749N/A Widget vbar, hbar; /* The scroll bars (none = NULL). */
749N/A struct SearchAndReplace * search;/* Search and replace structure. */
749N/A Widget file_insert; /* The file insert popup widget. */
749N/A XawTextPosition *updateFrom; /* Array of start positions for update. */
749N/A XawTextPosition *updateTo; /* Array of end positions for update. */
749N/A int numranges; /* How many update ranges there are. */
749N/A int maxranges; /* How many ranges we have space for */
749N/A XawTextPosition lastPos; /* Last position of source. */
749N/A GC gc;
749N/A Boolean showposition; /* True if we need to show the position. */
749N/A Boolean hasfocus; /* TRUE if we currently have input focus.*/
749N/A Boolean update_disabled; /* TRUE if display updating turned off */
749N/A Boolean single_char; /* Single character replaced. */
749N/A XawTextPosition old_insert; /* Last insertPos for batched updates */
749N/A short mult; /* Multiplier. */
749N/A
749N/A /* private state, shared w/Source and Sink */
749N/A Boolean redisplay_needed; /* in SetValues */
749N/A
749N/A} TextPart;
749N/A
749N/A/*************************************************************
749N/A *
749N/A * Resource types private to Text widget.
749N/A *
749N/A *************************************************************/
749N/A
749N/A#define XtRScrollMode "ScrollMode"
749N/A#define XtRWrapMode "WrapMode"
749N/A#define XtRResizeMode "ResizeMode"
749N/A
749N/A/****************************************************************
749N/A *
749N/A * Full instance record declaration
749N/A *
749N/A ****************************************************************/
749N/A
749N/Atypedef struct _TextRec {
749N/A CorePart core;
749N/A SimplePart simple;
749N/A TextPart text;
749N/A} TextRec;
749N/A
749N/A#ifdef XAW_BC
749N/A/*************************************************************
749N/A * For Compatibility only. */
749N/A
749N/A#define XtTextLineTable XawTextLineTable
749N/A#define XtTextLineTablePtr XawTextLineTablePtr
749N/A#define XtTextLineTableEntry XawTextLineTableEntry
749N/A#define XtTextLineTableEntryPtr XawTextLineTableEntryPtr
749N/A
749N/A/*************************************************************/
749N/A#endif /* XAW_BC */
749N/A
749N/A#endif /* _XawTextP_h */