749N/A/*
749N/A* $XConsortium: TextP.h,v 1.54 95/06/14 15:07:27 kaleb Exp $
749N/A*/
749N/A
749N/A
749N/A/***********************************************************
749N/A
749N/ACopyright (c) 1987, 1988, 1994 X Consortium
749N/A
749N/APermission is hereby granted, free of charge, to any person obtaining a copy
749N/Aof this software and associated documentation files (the "Software"), to deal
749N/Ain the Software without restriction, including without limitation the rights
749N/Ato use, copy, modify, merge, publish, distribute, sublicense, and/or sell
749N/Acopies of the Software, and to permit persons to whom the Software is
749N/Afurnished to do so, subject to the following conditions:
749N/A
749N/AThe above copyright notice and this permission notice shall be included in
749N/Aall copies or substantial portions of the Software.
749N/A
749N/ATHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
749N/AIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
749N/AFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
749N/AX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
749N/AAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
749N/ACONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
749N/A
749N/AExcept as contained in this notice, the name of the X Consortium shall not be
749N/Aused in advertising or otherwise to promote the sale, use or other dealings
749N/Ain this Software without prior written authorization from the X Consortium.
749N/A
749N/A
749N/ACopyright 1987, 1988 by Digital Equipment Corporation, Maynard, 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 name of Digital 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 <X11/Xaw/Text.h>
749N/A#include <X11/Xaw/SimpleP.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 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 _XawTextActionsTable[];
749N/Aextern Cardinal _XawTextActionsTableCount;
749N/A
749N/A#define XawLF 0x0a
749N/A#define XawCR 0x0d
749N/A#define XawTAB 0x09
749N/A#define XawBS 0x08
749N/A#define XawSP 0x20
749N/A#define XawDEL 0x7f
749N/A#define XawESC 0x1b
749N/A#define XawBSLASH '\\'
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/Atypedef struct _XawTextSelectionSalt {
749N/A struct _XawTextSelectionSalt *next;
749N/A XawTextSelection s;
749N/A /*
749N/A * The element "contents" stores the CT string which is gotten in the
749N/A * function _XawTextSaltAwaySelection().
749N/A */
749N/A char *contents;
749N/A int length;
749N/A} XawTextSelectionSalt;
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/Astruct text_move {
749N/A int h, v;
749N/A struct text_move * next;
749N/A};
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 XawTextSelectionSalt *salt; /* salted away 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 XtCallbackList unrealize_callbacks; /* used for scrollbars */
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 struct text_move * copy_area_offsets; /* Text offset area (linked list) */
749N/A
749N/A /* private state, shared w/Source and Sink */
749N/A Boolean redisplay_needed; /* in SetValues */
749N/A XawTextSelectionSalt *salt2; /* salted away selections */
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/********************************************
749N/A *
749N/A * Semi-private functions
749N/A * for use by other Xaw modules only
749N/A *
749N/A *******************************************/
749N/A
749N/Aextern void _XawTextBuildLineTable (
749N/A#if NeedFunctionPrototypes
749N/A TextWidget /*ctx*/,
749N/A XawTextPosition /*top pos*/,
749N/A _XtBoolean /* force_rebuild */
749N/A#endif
749N/A);
749N/A
749N/Aextern char* _XawTextGetSTRING(
749N/A#if NeedFunctionPrototypes
749N/A TextWidget /*ctx*/,
749N/A XawTextPosition /*left*/,
749N/A XawTextPosition /*right*/
749N/A#endif
749N/A);
749N/A
749N/Aextern void _XawTextSaltAwaySelection(
749N/A#if NeedFunctionPrototypes
749N/A TextWidget /*ctx*/,
749N/A Atom* /*selections*/,
749N/A int /*num_atoms*/
749N/A#endif
749N/A);
749N/A
749N/Aextern void _XawTextPosToXY(
749N/A#if NeedFunctionPrototypes
749N/A Widget /* w */,
749N/A XawTextPosition /* pos */,
749N/A Position * /* x */,
749N/A Position * /*y */
749N/A#endif
749N/A);
749N/A
749N/A#endif /* _XawTextP_h */
749N/A
749N/A